深瞳优学 v2.3.8版本的 MD5 值为:b789cae3101125f00094fd8828daf997
以下内容为反编译后的 UtilAlertDialog.java 源代码,内容仅作参考
package cn.com.a1school.evaluation.dialog;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.view.GravityCompat;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.com.a1school.evaluation.R;
import cn.com.a1school.evaluation.base.jumpListener;
import cn.com.a1school.evaluation.util.SystemUtil;
public class UtilAlertDialog extends BaseDialog {
@BindView(R.id.dialog)
public LinearLayout alertDialog;
public String appName;
public String before;
@BindView(R.id.beforePolicy)
public TextView beforePolicy;
public boolean bold;
@BindView(R.id.cancel)
public Button cancel;
public String cancelText;
@BindView(R.id.confirm)
public Button confirm;
public String confirmText;
public String desc;
public String descColor;
public float descSize;
@BindView(R.id.descText)
public TextView descText;
@BindView(R.id.divider)
View divider;
@BindView(R.id.editText)
EditText editText;
boolean isCenter;
boolean isOneButton;
public String jump;
@BindView(R.id.jumpText)
public TextView jumpText;
public jumpListener listener;
private ConfirmListener mDialogCallBackListener;
private CancelListener mDialogCancelListener;
@BindView(R.id.policy)
public LinearLayout policy;
public String showEditText;
public String showEditTextHint;
@BindView(R.id.title)
public TextView title;
@BindView(R.id.titleGap)
public View titleGap;
public String titleName;
public interface CancelListener {
void cancel(UtilAlertDialog utilAlertDialog);
}
public interface ConfirmListener {
void confirm(UtilAlertDialog utilAlertDialog);
}
public UtilAlertDialog setClickCancelListener(CancelListener cancelListener) {
this.mDialogCancelListener = cancelListener;
return this;
}
public UtilAlertDialog setOnConfirmListener(ConfirmListener confirmListener) {
this.mDialogCallBackListener = confirmListener;
return this;
}
public jumpListener getListener() {
return this.listener;
}
public void setListener(jumpListener jumplistener) {
this.listener = jumplistener;
}
public UtilAlertDialog(Context context, String str) {
super(context, R.style.AppTheme_Dialog);
this.isOneButton = false;
this.titleName = null;
this.descColor = null;
this.confirmText = null;
this.cancelText = null;
this.descSize = 0.0f;
this.bold = true;
this.showEditText = null;
this.showEditTextHint = null;
this.appName = "深瞳优学app";
this.jump = "";
this.before = "";
this.isCenter = false;
this.desc = str;
}
public UtilAlertDialog(Context context, String str, String str2, String str3) {
super(context, R.style.AppTheme_Dialog);
this.isOneButton = false;
this.titleName = null;
this.descColor = null;
this.confirmText = null;
this.cancelText = null;
this.descSize = 0.0f;
this.bold = true;
this.showEditText = null;
this.showEditTextHint = null;
this.appName = "深瞳优学app";
this.jump = "";
this.before = "";
this.isCenter = false;
this.desc = str;
this.confirmText = str2;
this.cancelText = str3;
}
public UtilAlertDialog setDescStyle(String str, float f, boolean z) {
this.descColor = str;
this.descSize = f;
this.bold = z;
return this;
}
public UtilAlertDialog setTitle(String str) {
this.titleName = str;
return this;
}
public UtilAlertDialog setConfirmTextAndCancelText(String str, String str2) {
this.confirmText = str;
this.cancelText = str2;
return this;
}
public void setDesc(String str) {
this.desc = str;
if (this.descText != null) {
if (str == null && "".equals(str)) {
return;
}
this.descText.setText(str);
this.descText.setVisibility(0);
}
}
public void setJumpText(String str) {
this.jump = str;
if (this.jumpText != null) {
if (str != null || "".equals(str)) {
this.jumpText.setText(str);
this.jumpText.setVisibility(0);
}
}
}
public void setBeforePolicy(String str) {
this.before = str;
if (this.beforePolicy != null) {
if (str != null || "".equals(str)) {
this.beforePolicy.setText(str);
this.beforePolicy.setVisibility(0);
}
}
}
public void setEditTextHint(String str) {
this.showEditTextHint = str;
}
public void setEditText(String str) {
this.showEditText = str;
EditText editText = this.editText;
if (editText != null) {
editText.setText(str);
}
}
public void setInitText() {
EditText editText = this.editText;
if (editText != null) {
editText.setText("");
}
}
public EditText getEditView() {
return this.editText;
}
public String getEditText() {
EditText editText = this.editText;
return editText != null ? editText.getText().toString().trim() : "";
}
public int[] getDialogHeight() {
int[] iArr = {0, 0};
this.alertDialog.measure(0, 0);
iArr[0] = SystemUtil.dip2px(this.alertDialog.getMeasuredWidth());
iArr[1] = SystemUtil.dip2px(this.alertDialog.getMeasuredHeight());
return iArr;
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.alert_dialog);
ButterKnife.bind(this);
if (this.isOneButton) {
this.divider.setVisibility(8);
this.cancel.setVisibility(8);
}
String str = this.desc;
if (str == null || "".equals(str)) {
this.descText.setVisibility(8);
}
this.descText.setText(this.desc);
String str2 = this.jump;
if (str2 != null && !SystemUtil.isEmpty(str2)) {
this.jumpText.setText(this.jump);
this.jumpText.setVisibility(0);
float f = this.descSize;
if (f != 0.0f) {
this.jumpText.setTextSize(f);
}
} else {
this.jumpText.setVisibility(8);
}
String str3 = this.before;
if (str3 != null && !SystemUtil.isEmpty(str3)) {
this.beforePolicy.setText(this.before);
this.beforePolicy.setVisibility(0);
float f2 = this.descSize;
if (f2 != 0.0f) {
this.beforePolicy.setTextSize(f2);
}
} else {
this.beforePolicy.setVisibility(8);
}
if (this.isCenter) {
this.descText.setGravity(17);
} else {
this.descText.setGravity(GravityCompat.START);
}
String str4 = this.descColor;
if (str4 != null) {
this.descText.setTextColor(Color.parseColor(str4));
}
float f3 = this.descSize;
if (f3 != 0.0f) {
this.descText.setTextSize(f3);
}
if (this.bold) {
this.descText.getPaint().setFlags(32);
}
if (!SystemUtil.isEmpty(this.confirmText)) {
this.confirm.setText(this.confirmText);
}
if (!SystemUtil.isEmpty(this.cancelText)) {
this.cancel.setText(this.cancelText);
} else {
this.cancel.setVisibility(8);
}
if (this.titleName != null) {
this.title.setVisibility(0);
this.title.setText(this.titleName);
} else {
this.titleGap.setVisibility(0);
}
String str5 = this.showEditTextHint;
if (str5 != null) {
this.editText.setHint(str5);
this.editText.setVisibility(0);
}
String str6 = this.showEditText;
if (str6 != null) {
this.editText.setText(str6);
this.editText.setVisibility(0);
}
this.confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
UtilAlertDialog.this.hideKeyboard();
UtilAlertDialog.this.cancel();
if (UtilAlertDialog.this.mDialogCallBackListener != null) {
UtilAlertDialog.this.mDialogCallBackListener.confirm(UtilAlertDialog.this);
}
}
});
setCanceledOnTouchOutside(false);
}
@OnClick({R.id.cancel})
public void cancelBtn() {
hideKeyboard();
cancel();
CancelListener cancelListener = this.mDialogCancelListener;
if (cancelListener != null) {
cancelListener.cancel(this);
}
}
public void hideKeyboard() {
((InputMethodManager) getContext().getSystemService("input_method")).hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
}
@OnClick({R.id.jumpText})
public void jumpToWeb() {
String str = "https://api.yxuer.com:8443/school-evaluation/private/index.html?name=" + this.appName;
jumpListener jumplistener = this.listener;
if (jumplistener != null) {
jumplistener.jumpToWeb(str);
}
}
public void descCenter() {
this.isCenter = true;
}
public void setOneBtnStyle() {
this.isOneButton = true;
}
}