Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
package com.ubt.jimu.base.dialog;
/* loaded from: classes.dex */
public interface IDialogListener {
void onCancle();
void onOk();
}

View File

@@ -0,0 +1,349 @@
package com.ubt.jimu.base.dialog;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.ColorDrawable;
import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.ubt.jimu.Channel;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubt.jimu.base.cache.Cache;
import com.ubt.jimu.update.UpdateManager;
import com.ubt.jimu.utils.NetWorkUtil;
import com.ubt.jimu.utils.SystemUtils;
import com.ubtech.utils.DisplayUtil;
/* loaded from: classes.dex */
public class JimuSimpleDialog extends Dialog implements View.OnClickListener {
public Button btnCancel;
public Button btnOk;
public String cancel;
public int cancleBtnBg;
public String content;
private ImageView imgLogo;
private OnDismissListener mOnDismissListener;
public String ok;
private DialogInterface.OnClickListener onCancelListener;
private DialogInterface.OnClickListener onOkListener;
private TextView tvDialogTitle;
private TextView tvTips;
public static class Builder {
private String cancel;
private int cancleBtnBg;
private String content;
private Context context;
private String logoUrl;
private String ok;
private DialogInterface.OnClickListener onCancelListener;
private DialogInterface.OnClickListener onOkListener;
private String title;
private int logoResId = 0;
private boolean canceledOnTouchOutside = true;
private int gravity = 17;
public Builder(Context context) {
this.context = context;
}
public JimuSimpleDialog build() {
int i;
double d;
int a;
int a2;
JimuSimpleDialog jimuSimpleDialog = new JimuSimpleDialog(this.context);
jimuSimpleDialog.requestWindowFeature(1);
jimuSimpleDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
jimuSimpleDialog.content = this.content;
jimuSimpleDialog.ok = this.ok;
jimuSimpleDialog.cancel = this.cancel;
jimuSimpleDialog.onOkListener = this.onOkListener;
jimuSimpleDialog.onCancelListener = this.onCancelListener;
jimuSimpleDialog.cancleBtnBg = this.cancleBtnBg;
View inflate = LayoutInflater.from(this.context).inflate(R.layout.dialog_jimu_simple, (ViewGroup) null, false);
jimuSimpleDialog.intView(inflate, this);
jimuSimpleDialog.setContentView(inflate);
jimuSimpleDialog.setCanceledOnTouchOutside(this.canceledOnTouchOutside);
Window window = jimuSimpleDialog.getWindow();
WindowManager.LayoutParams attributes = window.getAttributes();
window.setBackgroundDrawableResource(R.color.translucent);
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
int max = Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l()));
if (JimuApplication.l().i()) {
i = (int) (max * 0.5039d);
d = 0.624d;
} else {
i = (int) (max * 0.5165d);
d = 0.6088d;
}
int i2 = (int) (i * d);
if (JimuApplication.l().i()) {
a = DisplayUtil.a(this.context, 516.0f);
a2 = DisplayUtil.a(this.context, 322.0f);
} else {
a = DisplayUtil.a(this.context, 344.55f);
a2 = DisplayUtil.a(this.context, 209.75f);
}
if (a > i || a2 > i2) {
i = a;
i2 = a2;
}
attributes.width = i;
attributes.height = i2;
attributes.gravity = 17;
window.setAttributes(attributes);
return jimuSimpleDialog;
}
public Builder cancel(String str) {
this.cancel = str;
return this;
}
public Builder canceledOnTouchOutside(boolean z) {
this.canceledOnTouchOutside = z;
return this;
}
public Builder cancleBtnBg(int i) {
this.cancleBtnBg = i;
return this;
}
public Builder content(String str) {
this.content = str;
return this;
}
public Builder gravity(int i) {
this.gravity = i;
return this;
}
public Builder logoResId(int i) {
this.logoResId = i;
return this;
}
public Builder logoUrl(String str) {
this.logoUrl = str;
return this;
}
public Builder ok(String str) {
this.ok = str;
return this;
}
public Builder onCancel(DialogInterface.OnClickListener onClickListener) {
this.onCancelListener = onClickListener;
return this;
}
public Builder onOk(DialogInterface.OnClickListener onClickListener) {
this.onOkListener = onClickListener;
return this;
}
public Builder title(String str) {
this.title = str;
return this;
}
public Builder cancel(int i) {
this.cancel = this.context.getString(i);
return this;
}
public Builder content(int i) {
this.content = this.context.getString(i);
return this;
}
public Builder ok(int i) {
this.ok = this.context.getString(i);
return this;
}
public Builder title(int i) {
this.title = this.context.getString(i);
return this;
}
}
public interface OnDismissListener {
void onDismiss(Dialog dialog);
}
public JimuSimpleDialog(Context context) {
super(context);
}
public static JimuSimpleDialog buildSimpleDialog(Activity activity, String str, String str2, String str3, String str4, int i, DialogInterface.OnClickListener onClickListener, DialogInterface.OnClickListener onClickListener2) {
return new Builder(activity).title(str3).cancel(str2).ok(str).content(str4).gravity(i).onCancel(onClickListener).onOk(onClickListener2).build();
}
public static boolean shouldShowWifiOnlyDialog(Context context) {
return NetWorkUtil.a(context) == NetWorkUtil.NetworkType.MOBILE && Cache.getInstance().isWifiOnly() && !Cache.getInstance().isShowMobileDataTips();
}
public static boolean showWifiOnlyDialog(Context context, final DialogInterface.OnClickListener onClickListener, final DialogInterface.OnClickListener onClickListener2, boolean z) {
if (context != null && !z && shouldShowWifiOnlyDialog(context)) {
new Builder(context).title(R.string.mobile_data_tips).cancel(R.string.cancel).ok(R.string.key_continue).content(R.string.tips_using_mobile_data).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.JimuSimpleDialog.4
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
DialogInterface.OnClickListener onClickListener3 = onClickListener;
if (onClickListener3 != null) {
onClickListener3.onClick(dialogInterface, i);
}
dialogInterface.dismiss();
}
}).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.JimuSimpleDialog.3
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
DialogInterface.OnClickListener onClickListener3 = onClickListener2;
if (onClickListener3 != null) {
onClickListener3.onClick(dialogInterface, i);
Cache.getInstance().setShowMobileDataTips(true);
}
dialogInterface.dismiss();
}
}).build().show();
return true;
}
if (onClickListener2 == null) {
return false;
}
onClickListener2.onClick(null, -1);
return false;
}
public static Dialog versionUpdateDialog(final Activity activity, boolean z, String str) {
Builder builder = new Builder(activity);
builder.title(R.string.update_title).ok(R.string.update_sure).content(str).gravity(3).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.JimuSimpleDialog.1
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
if (Channel.GOOGLE_PLAY.getChannelName().equals("google_play")) {
SystemUtils.a(activity);
dialogInterface.dismiss();
} else {
UpdateManager.c().a(activity);
dialogInterface.dismiss();
}
}
}).build();
if (!z) {
builder.cancel(R.string.cancel).canceledOnTouchOutside(true).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.JimuSimpleDialog.2
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
}
return builder.build();
}
@Override // android.app.Dialog, android.content.DialogInterface
public void dismiss() {
super.dismiss();
OnDismissListener onDismissListener = this.mOnDismissListener;
if (onDismissListener != null) {
onDismissListener.onDismiss(this);
}
}
public void intView(View view, Builder builder) {
this.tvDialogTitle = (TextView) view.findViewById(R.id.tvDialogTitle);
this.tvTips = (TextView) view.findViewById(R.id.tvTips);
this.imgLogo = (ImageView) view.findViewById(R.id.imgLogo);
this.btnCancel = (Button) view.findViewById(R.id.btnCancel);
this.btnOk = (Button) view.findViewById(R.id.btnOk);
this.btnCancel.setOnClickListener(this);
this.btnOk.setOnClickListener(this);
if (!TextUtils.isEmpty(this.content)) {
this.tvTips.setText(this.content);
this.tvTips.setMovementMethod(ScrollingMovementMethod.getInstance());
}
if (this.onCancelListener == null) {
this.btnCancel.setVisibility(8);
}
if (this.onOkListener == null) {
this.btnOk.setVisibility(8);
}
if (!TextUtils.isEmpty(this.ok)) {
this.btnOk.setText(this.ok);
}
if (!TextUtils.isEmpty(this.cancel)) {
this.btnCancel.setText(this.cancel);
}
if (TextUtils.isEmpty(builder.title)) {
this.tvDialogTitle.setVisibility(8);
} else {
this.tvDialogTitle.setVisibility(0);
this.tvDialogTitle.setText(builder.title);
}
if (!TextUtils.isEmpty(builder.logoUrl)) {
Glide.e(getContext()).a(builder.logoUrl).a(this.imgLogo);
} else if (builder.logoResId != 0) {
this.imgLogo.setImageResource(builder.logoResId);
} else {
this.imgLogo.setVisibility(8);
}
if (17 != builder.gravity) {
this.tvTips.setGravity(builder.gravity);
}
int i = this.cancleBtnBg;
if (i != 0) {
this.btnCancel.setBackgroundResource(i);
}
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
int id = view.getId();
if (id == R.id.btnCancel) {
DialogInterface.OnClickListener onClickListener = this.onCancelListener;
if (onClickListener != null) {
onClickListener.onClick(this, 0);
return;
} else {
dismiss();
return;
}
}
if (id != R.id.btnOk) {
dismiss();
return;
}
DialogInterface.OnClickListener onClickListener2 = this.onOkListener;
if (onClickListener2 != null) {
onClickListener2.onClick(this, 0);
} else {
dismiss();
}
}
public void setOnDismissListener(OnDismissListener onDismissListener) {
this.mOnDismissListener = onDismissListener;
}
public JimuSimpleDialog(Context context, int i) {
super(context, i);
}
protected JimuSimpleDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
super(context, z, onCancelListener);
}
}

View File

@@ -0,0 +1,259 @@
package com.ubt.jimu.base.dialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.ColorDrawable;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.text.style.TextAppearanceSpan;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.launcher.ARouter;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubt.jimu.base.dialog.LegalExamineDialog;
import com.ubt.jimu.base.entities.Constant;
import com.ubt.jimu.utils.LocaleUtils;
import com.ubt.jimu.utils.SPUtils;
import com.ubtech.utils.DisplayUtil;
/* loaded from: classes.dex */
public class LegalExamineDialog extends Dialog implements View.OnClickListener {
public Button btnCancel;
public Button btnOk;
public String cancel;
private CheckBox checkBox;
public String content;
private TextView contentTv;
private Context context;
private LegalResult legalResult;
public String ok;
private TextView tipTv;
public static class Builder {
private Context context;
private LegalResult legalResult;
public Builder(Context context) {
this.context = context;
}
static /* synthetic */ boolean a(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
return i == 4;
}
public LegalExamineDialog build() {
int a;
int a2;
LegalExamineDialog legalExamineDialog = new LegalExamineDialog(this.context);
legalExamineDialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.ubt.jimu.base.dialog.a
@Override // android.content.DialogInterface.OnKeyListener
public final boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
return LegalExamineDialog.Builder.a(dialogInterface, i, keyEvent);
}
});
legalExamineDialog.context = this.context;
legalExamineDialog.legalResult = this.legalResult;
legalExamineDialog.requestWindowFeature(1);
legalExamineDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
View inflate = LayoutInflater.from(this.context).inflate(R.layout.dialog_jimu_legal_examine, (ViewGroup) null, false);
legalExamineDialog.intView(inflate, this);
legalExamineDialog.setContentView(inflate);
legalExamineDialog.setCanceledOnTouchOutside(false);
Window window = legalExamineDialog.getWindow();
WindowManager.LayoutParams attributes = window.getAttributes();
window.setBackgroundDrawableResource(R.color.translucent);
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
int max = (int) (Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l())) * 0.712d);
int i = (int) (max * 0.657d);
if (JimuApplication.l().i()) {
a = DisplayUtil.a(this.context, 516.0f);
a2 = DisplayUtil.a(this.context, 322.0f);
} else {
a = DisplayUtil.a(this.context, 344.55f);
a2 = DisplayUtil.a(this.context, 209.75f);
}
if (a > max || a2 > i) {
max = a;
}
attributes.width = max;
attributes.gravity = 17;
window.setAttributes(attributes);
return legalExamineDialog;
}
public Builder onLegalResult(LegalResult legalResult) {
this.legalResult = legalResult;
return this;
}
}
public interface LegalResult {
void pass();
void reject();
}
public LegalExamineDialog(Context context) {
super(context);
}
private SpannableStringBuilder buildChildPrivacy(final Context context, int i) {
String string = context.getResources().getString(R.string.child_privaty_policy_with_punctuation);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
spannableStringBuilder.setSpan(new TextAppearanceSpan(context, i), 0, string.length(), 33);
spannableStringBuilder.setSpan(new ClickableSpan() { // from class: com.ubt.jimu.base.dialog.LegalExamineDialog.4
@Override // android.text.style.ClickableSpan
public void onClick(View view) {
Postcard a = ARouter.b().a("/page/web");
a.a("url", "file:////android_asset/privacy/jimuChildren.html?language=" + LocaleUtils.c());
a.a("title", "");
a.a("type", 0);
a.a("show_title", false);
a.t();
}
@Override // android.text.style.ClickableSpan, android.text.style.CharacterStyle
public void updateDrawState(TextPaint textPaint) {
super.updateDrawState(textPaint);
textPaint.setColor(context.getResources().getColor(R.color.bg_4AACF5));
textPaint.bgColor = context.getResources().getColor(R.color.translucent);
textPaint.setUnderlineText(false);
}
}, 0, string.length(), 33);
return spannableStringBuilder;
}
private SpannableStringBuilder buildUserProtocol(final Context context, int i) {
String string = context.getResources().getString(R.string.common_gdpr_content_02);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
spannableStringBuilder.setSpan(new TextAppearanceSpan(context, i), 0, string.length(), 33);
spannableStringBuilder.setSpan(new ClickableSpan() { // from class: com.ubt.jimu.base.dialog.LegalExamineDialog.3
@Override // android.text.style.ClickableSpan
public void onClick(View view) {
Postcard a = ARouter.b().a("/page/web");
a.a("url", "file:////android_asset/user/index.html?language=" + LocaleUtils.c());
a.a("title", "");
a.a("type", 0);
a.a("show_title", false);
a.t();
}
@Override // android.text.style.ClickableSpan, android.text.style.CharacterStyle
public void updateDrawState(TextPaint textPaint) {
super.updateDrawState(textPaint);
textPaint.setColor(context.getResources().getColor(R.color.bg_4AACF5));
textPaint.bgColor = context.getResources().getColor(R.color.translucent);
textPaint.setUnderlineText(false);
}
}, 0, string.length(), 33);
return spannableStringBuilder;
}
private SpannableStringBuilder buildprivacy(final Context context, int i) {
String string = context.getResources().getString(R.string.common_gdpr_content_04);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
spannableStringBuilder.setSpan(new TextAppearanceSpan(context, i), 0, string.length(), 33);
spannableStringBuilder.setSpan(new ClickableSpan() { // from class: com.ubt.jimu.base.dialog.LegalExamineDialog.2
@Override // android.text.style.ClickableSpan
public void onClick(View view) {
Postcard a = ARouter.b().a("/page/web");
a.a("url", "file:////android_asset/privacy/index.html?language=" + LocaleUtils.c());
a.a("title", "");
a.a("type", 0);
a.a("show_title", false);
a.t();
}
@Override // android.text.style.ClickableSpan, android.text.style.CharacterStyle
public void updateDrawState(TextPaint textPaint) {
super.updateDrawState(textPaint);
textPaint.setColor(context.getResources().getColor(R.color.bg_4AACF5));
textPaint.bgColor = context.getResources().getColor(R.color.translucent);
textPaint.setUnderlineText(false);
}
}, 0, string.length(), 33);
return spannableStringBuilder;
}
@Override // android.app.Dialog, android.content.DialogInterface
public void dismiss() {
super.dismiss();
}
public void intView(View view, Builder builder) {
this.contentTv = (TextView) view.findViewById(R.id.content);
this.tipTv = (TextView) view.findViewById(R.id.tips);
this.btnCancel = (Button) view.findViewById(R.id.btnCancel);
this.btnOk = (Button) view.findViewById(R.id.btnOk);
this.checkBox = (CheckBox) view.findViewById(R.id.checkbox_agree);
this.btnCancel.setOnClickListener(this);
this.btnOk.setOnClickListener(this);
this.contentTv.setMovementMethod(new LinkMovementMethod());
this.contentTv.append(this.context.getResources().getString(R.string.common_gdpr_content_01));
this.contentTv.append(buildUserProtocol(this.context, R.style.JSpecilTextAppearance));
this.contentTv.append(this.context.getResources().getString(R.string.comma));
this.contentTv.append(buildprivacy(this.context, R.style.JSpecilTextAppearance));
this.contentTv.append(this.context.getResources().getString(R.string.common_gdpr_content_03));
this.contentTv.append(buildChildPrivacy(this.context, R.style.JSpecilTextAppearance));
this.contentTv.append(this.context.getResources().getString(R.string.common_gdpr_content_05));
this.tipTv.setMovementMethod(new LinkMovementMethod());
this.tipTv.append(this.context.getString(R.string.common_gdpr_tip_01));
this.tipTv.append(buildUserProtocol(this.context, R.style.JSpecilTextAppearanceSmall));
this.tipTv.append(this.context.getResources().getString(R.string.comma));
this.tipTv.append(buildprivacy(this.context, R.style.JSpecilTextAppearanceSmall));
this.tipTv.append(this.context.getResources().getString(R.string.common_gdpr_tip_02));
this.tipTv.append(buildChildPrivacy(this.context, R.style.JSpecilTextAppearanceSmall));
this.tipTv.append(this.context.getString(R.string.common_gdpr_tip_03));
this.btnOk.setText(this.context.getResources().getString(R.string.dialog_legal_agree));
this.btnCancel.setText(this.context.getString(R.string.dialog_legal_reject));
this.btnCancel.setBackgroundResource(R.drawable.sel_common_negative_btn);
this.btnOk.setEnabled(false);
this.btnOk.setAlpha(0.5f);
this.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.ubt.jimu.base.dialog.LegalExamineDialog.1
@Override // android.widget.CompoundButton.OnCheckedChangeListener
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
if (z) {
LegalExamineDialog.this.btnOk.setEnabled(true);
LegalExamineDialog.this.btnOk.setAlpha(1.0f);
} else {
LegalExamineDialog.this.btnOk.setEnabled(false);
LegalExamineDialog.this.btnOk.setAlpha(0.5f);
}
}
});
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
int id = view.getId();
if (id == R.id.btnCancel) {
this.legalResult.reject();
} else if (id != R.id.btnOk) {
dismiss();
} else {
SPUtils.a(Constant.NoviceGuide.AGREE_LEGAL_EXAMINE, true);
this.legalResult.pass();
}
}
public LegalExamineDialog(Context context, int i) {
super(context, i);
}
protected LegalExamineDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
super(context, z, onCancelListener);
}
}

View File

@@ -0,0 +1,95 @@
package com.ubt.jimu.base.dialog;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import com.ubt.jimu.R;
/* loaded from: classes.dex */
public class LoadingDialog extends Dialog {
private ImageView imgLoading;
private Activity mActivity;
private RotateAnimation rotateAnimation;
private TextView tvProgress;
public LoadingDialog(Context context) {
this(context, 0);
}
private void initView() {
this.tvProgress = (TextView) findViewById(R.id.tvProgress);
this.imgLoading = (ImageView) findViewById(R.id.imgLoading);
}
private void startAnimation() {
RotateAnimation rotateAnimation = this.rotateAnimation;
if (rotateAnimation != null) {
rotateAnimation.cancel();
this.imgLoading.clearAnimation();
}
this.rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
this.rotateAnimation.setRepeatCount(-1);
this.rotateAnimation.setDuration(800L);
this.rotateAnimation.setInterpolator(new LinearInterpolator());
this.rotateAnimation.setRepeatMode(1);
this.imgLoading.startAnimation(this.rotateAnimation);
}
@Override // android.app.Dialog, android.content.DialogInterface
public void dismiss() {
RotateAnimation rotateAnimation = this.rotateAnimation;
if (rotateAnimation != null) {
rotateAnimation.cancel();
}
this.rotateAnimation = null;
this.imgLoading.clearAnimation();
Activity activity = this.mActivity;
if (activity == null || activity.isFinishing() || this.mActivity.isDestroyed()) {
return;
}
super.dismiss();
}
@Override // android.app.Dialog
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
getWindow().requestFeature(1);
setContentView(R.layout.dialog_loading);
getWindow().setBackgroundDrawable(new ColorDrawable(0));
getWindow().setLayout(-1, -1);
setCanceledOnTouchOutside(false);
initView();
}
@Override // android.app.Dialog
public void show() {
super.show();
startAnimation();
}
public void updateProgress(String str) {
TextView textView;
if (TextUtils.isEmpty(str) || (textView = this.tvProgress) == null) {
return;
}
textView.setText(str);
}
public LoadingDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
super(context, z, onCancelListener);
this.mActivity = (Activity) context;
}
public LoadingDialog(Context context, int i) {
super(context, i);
this.mActivity = (Activity) context;
}
}

View File

@@ -0,0 +1,181 @@
package com.ubt.jimu.base.dialog;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubtech.utils.DisplayUtil;
/* loaded from: classes.dex */
public class LoginCheckCodeDialog extends Dialog {
private Button btnCancel;
private Button btnOk;
private Callback callback;
private Context context;
private String emailText;
private EditText etCaptcha;
private TextView get_emial_verify_code;
private boolean isTablet;
private int loginType;
private String phoneText;
private TextView tvTitle;
public interface Callback {
void onCancel();
void onGetCaptcha();
void onOK(String str);
}
public LoginCheckCodeDialog(Context context) {
super(context, R.style.window_dialog);
this.context = context;
this.isTablet = JimuApplication.l().i();
}
public void disableGetCodeTextView() {
TextView textView = this.get_emial_verify_code;
if (textView != null) {
textView.setClickable(false);
}
}
public void enableGetCodeTextView() {
TextView textView = this.get_emial_verify_code;
if (textView != null) {
textView.setClickable(true);
}
}
public void initView() {
this.tvTitle = (TextView) findViewById(R.id.tv_title);
this.tvTitle.setMovementMethod(ScrollingMovementMethod.getInstance());
this.etCaptcha = (EditText) findViewById(R.id.et_captcha);
this.btnCancel = (Button) findViewById(R.id.btn_cancel);
this.btnCancel.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.base.dialog.LoginCheckCodeDialog.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (LoginCheckCodeDialog.this.callback != null) {
LoginCheckCodeDialog.this.callback.onCancel();
}
LoginCheckCodeDialog.this.dismiss();
}
});
this.btnOk = (Button) findViewById(R.id.btn_ok);
this.btnOk.setEnabled(false);
this.btnOk.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.base.dialog.LoginCheckCodeDialog.2
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (LoginCheckCodeDialog.this.callback != null) {
LoginCheckCodeDialog.this.callback.onOK(LoginCheckCodeDialog.this.etCaptcha.getText().toString().trim());
}
}
});
this.get_emial_verify_code = (TextView) findViewById(R.id.get_emial_verify_code);
this.get_emial_verify_code.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.base.dialog.LoginCheckCodeDialog.3
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (LoginCheckCodeDialog.this.callback != null) {
LoginCheckCodeDialog.this.callback.onGetCaptcha();
}
}
});
this.etCaptcha.addTextChangedListener(new TextWatcher() { // from class: com.ubt.jimu.base.dialog.LoginCheckCodeDialog.4
@Override // android.text.TextWatcher
public void afterTextChanged(Editable editable) {
}
@Override // android.text.TextWatcher
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override // android.text.TextWatcher
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
if (TextUtils.isEmpty(charSequence)) {
LoginCheckCodeDialog.this.btnOk.setEnabled(false);
} else {
if (LoginCheckCodeDialog.this.btnOk.isEnabled()) {
return;
}
LoginCheckCodeDialog.this.btnOk.setEnabled(true);
}
}
});
}
@Override // android.app.Dialog
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.dialog_login_check_code);
setUpWindows();
initView();
setCanceledOnTouchOutside(false);
}
public void setCallback(Callback callback) {
this.callback = callback;
}
public void setUpWindows() {
Window window = getWindow();
window.setBackgroundDrawable(new ColorDrawable(0));
WindowManager.LayoutParams attributes = window.getAttributes();
int a = DisplayUtil.a(this.context, this.isTablet ? 400.0f : 352.0f);
int a2 = DisplayUtil.a(this.context, this.isTablet ? 300.0f : 220.0f);
attributes.width = a;
attributes.height = a2;
attributes.gravity = 17;
window.setAttributes(attributes);
}
public void startCountDown() {
TextView textView = this.get_emial_verify_code;
if (textView == null) {
return;
}
textView.setClickable(false);
new CountDownTimer(60000L, 1000L) { // from class: com.ubt.jimu.base.dialog.LoginCheckCodeDialog.5
@Override // android.os.CountDownTimer
public void onFinish() {
LoginCheckCodeDialog.this.get_emial_verify_code.setText(R.string.get_captcha);
LoginCheckCodeDialog.this.get_emial_verify_code.setClickable(true);
}
@Override // android.os.CountDownTimer
public void onTick(long j) {
LoginCheckCodeDialog.this.get_emial_verify_code.setText((j / 1000) + "s");
}
}.start();
}
public LoginCheckCodeDialog(Context context, Callback callback) {
super(context, R.style.window_dialog);
this.context = context;
this.callback = callback;
this.isTablet = JimuApplication.l().i();
}
public LoginCheckCodeDialog(Context context, int i, String str, String str2, Callback callback) {
super(context, R.style.window_dialog);
this.context = context;
this.callback = callback;
this.loginType = i;
this.phoneText = str;
this.emailText = str2;
this.isTablet = JimuApplication.l().i();
}
}

View File

@@ -0,0 +1,301 @@
package com.ubt.jimu.base.dialog;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.ColorDrawable;
import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubtech.utils.DisplayUtil;
import com.ubtech.view.dialog.SimpleDialog;
/* loaded from: classes.dex */
public class PermissionHintDialog extends Dialog implements View.OnClickListener {
public Button btnCancel;
public Button btnOk;
public String cancel;
public String content;
private ImageView imgLogo;
public String ok;
private DialogInterface.OnClickListener onCancelListener;
private DialogInterface.OnClickListener onOkListener;
private TextView tvDialogTitle;
private TextView tvTips;
public static class Builder {
private String cancel;
private String content;
private Context context;
private String logoUrl;
private String ok;
private DialogInterface.OnClickListener onCancelListener;
private DialogInterface.OnClickListener onOkListener;
private String title;
private int logoResId = 0;
private boolean canceledOnTouchOutside = true;
private int gravity = 17;
public Builder(Context context) {
this.context = context;
}
public PermissionHintDialog build() {
int i;
double d;
int a;
int a2;
PermissionHintDialog permissionHintDialog = new PermissionHintDialog(this.context);
permissionHintDialog.requestWindowFeature(1);
permissionHintDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
permissionHintDialog.content = this.content;
permissionHintDialog.ok = this.ok;
permissionHintDialog.cancel = this.cancel;
permissionHintDialog.onOkListener = this.onOkListener;
permissionHintDialog.onCancelListener = this.onCancelListener;
View inflate = LayoutInflater.from(this.context).inflate(R.layout.dialog_permission_hint, (ViewGroup) null, false);
permissionHintDialog.intView(inflate, this);
permissionHintDialog.setContentView(inflate);
permissionHintDialog.setCanceledOnTouchOutside(this.canceledOnTouchOutside);
Window window = permissionHintDialog.getWindow();
WindowManager.LayoutParams attributes = window.getAttributes();
window.setBackgroundDrawableResource(R.color.translucent);
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
int max = Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l()));
if (JimuApplication.l().i()) {
i = (int) (max * 0.5039d);
d = 0.624d;
} else {
i = (int) (max * 0.5165d);
d = 0.6088d;
}
int i2 = (int) (i * d);
if (JimuApplication.l().i()) {
a = DisplayUtil.a(this.context, 516.0f);
a2 = DisplayUtil.a(this.context, 322.0f);
} else {
a = DisplayUtil.a(this.context, 344.55f);
a2 = DisplayUtil.a(this.context, 209.75f);
}
if (a > i || a2 > i2) {
i = a;
i2 = a2;
}
attributes.width = i;
attributes.height = i2;
attributes.gravity = 17;
window.setAttributes(attributes);
return permissionHintDialog;
}
public Builder cancel(String str) {
this.cancel = str;
return this;
}
public Builder canceledOnTouchOutside(boolean z) {
this.canceledOnTouchOutside = z;
return this;
}
public Builder content(String str) {
this.content = str;
return this;
}
public Builder gravity(int i) {
this.gravity = i;
return this;
}
public Builder logoResId(int i) {
this.logoResId = i;
return this;
}
public Builder logoUrl(String str) {
this.logoUrl = str;
return this;
}
public Builder ok(String str) {
this.ok = str;
return this;
}
public Builder onCancel(DialogInterface.OnClickListener onClickListener) {
this.onCancelListener = onClickListener;
return this;
}
public Builder onOk(DialogInterface.OnClickListener onClickListener) {
this.onOkListener = onClickListener;
return this;
}
public Builder title(String str) {
this.title = str;
return this;
}
public Builder cancel(int i) {
this.cancel = this.context.getString(i);
return this;
}
public Builder content(int i) {
this.content = this.context.getString(i);
return this;
}
public Builder ok(int i) {
this.ok = this.context.getString(i);
return this;
}
public Builder title(int i) {
this.title = this.context.getString(i);
return this;
}
}
public PermissionHintDialog(Context context) {
super(context);
}
public static PermissionHintDialog buildSimpleDialog(Activity activity, String str, String str2, String str3, String str4, int i, DialogInterface.OnClickListener onClickListener, DialogInterface.OnClickListener onClickListener2) {
return new Builder(activity).title(str3).cancel(str2).ok(str).content(str4).gravity(i).onCancel(onClickListener).onOk(onClickListener2).build();
}
public static boolean showBluetoothEnableFailedHint(Context context) {
new SimpleDialog.Builder(context).d(R.string.permission_button_text_permission_denied_warning_dialog).a((CharSequence) context.getResources().getString(R.string.permission_waring_text_bluetooth_enable_failed)).b(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.PermissionHintDialog.4
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}).a().show();
return true;
}
public static boolean showLocationPermissionDeniedHint(Context context) {
new Builder(context).ok(R.string.permission_button_text_permission_denied_warning_dialog).content(String.format(context.getResources().getString(R.string.permission_prompt_open_permission_by_settings), context.getResources().getString(R.string.permission_location))).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.PermissionHintDialog.2
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
}
}).build().show();
return true;
}
public static boolean showPermissionDeniedHint(Context context, String str) {
new Builder(context).ok(R.string.permission_button_text_permission_denied_warning_dialog).content(str).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.PermissionHintDialog.1
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
}
}).build().show();
return true;
}
public static boolean showStoragePermissionDeniedHint(Context context) {
new Builder(context).ok(R.string.permission_button_text_permission_denied_warning_dialog).content(String.format(context.getResources().getString(R.string.permission_prompt_open_permission_by_settings), context.getResources().getString(R.string.permission_storage))).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.PermissionHintDialog.3
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
}
}).build().show();
return true;
}
public void intView(View view, Builder builder) {
this.tvDialogTitle = (TextView) view.findViewById(R.id.tvDialogTitle);
this.tvTips = (TextView) view.findViewById(R.id.tvTips);
this.imgLogo = (ImageView) view.findViewById(R.id.imgLogo);
this.btnCancel = (Button) view.findViewById(R.id.btnCancel);
this.btnOk = (Button) view.findViewById(R.id.btnOk);
this.btnCancel.setOnClickListener(this);
this.btnOk.setOnClickListener(this);
if (!TextUtils.isEmpty(this.content)) {
this.tvTips.setText(this.content);
this.tvTips.setMovementMethod(ScrollingMovementMethod.getInstance());
}
if (this.onCancelListener == null) {
this.btnCancel.setVisibility(8);
} else if (JimuApplication.l().i()) {
this.btnCancel.setBackgroundResource(R.drawable.negative_btn_bg_pad);
} else {
this.btnCancel.setBackgroundResource(R.drawable.negative_btn_bg);
}
if (this.onOkListener == null) {
this.btnOk.setVisibility(8);
} else if (JimuApplication.l().i()) {
this.btnOk.setBackgroundResource(R.drawable.positive_btn_bg_pad);
} else {
this.btnOk.setBackgroundResource(R.drawable.positive_btn_bg);
}
if (!TextUtils.isEmpty(this.ok)) {
this.btnOk.setText(this.ok);
}
if (!TextUtils.isEmpty(this.cancel)) {
this.btnCancel.setText(this.cancel);
}
if (TextUtils.isEmpty(builder.title)) {
this.tvDialogTitle.setVisibility(8);
} else {
this.tvDialogTitle.setVisibility(0);
this.tvDialogTitle.setText(builder.title);
}
if (!TextUtils.isEmpty(builder.logoUrl)) {
Glide.e(getContext()).a(builder.logoUrl).a(this.imgLogo);
} else if (builder.logoResId != 0) {
this.imgLogo.setImageResource(builder.logoResId);
} else {
this.imgLogo.setVisibility(8);
}
if (17 != builder.gravity) {
this.tvTips.setGravity(builder.gravity);
}
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
int id = view.getId();
if (id == R.id.btnCancel) {
DialogInterface.OnClickListener onClickListener = this.onCancelListener;
if (onClickListener != null) {
onClickListener.onClick(this, 0);
return;
} else {
dismiss();
return;
}
}
if (id != R.id.btnOk) {
dismiss();
return;
}
DialogInterface.OnClickListener onClickListener2 = this.onOkListener;
if (onClickListener2 == null) {
dismiss();
} else {
onClickListener2.onClick(this, 0);
dismiss();
}
}
public PermissionHintDialog(Context context, int i) {
super(context, i);
}
protected PermissionHintDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
super(context, z, onCancelListener);
}
}

View File

@@ -0,0 +1,145 @@
package com.ubt.jimu.base.dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubtech.utils.DisplayUtil;
/* loaded from: classes.dex */
public class SimpleQuestionDialog extends DialogFragment implements View.OnClickListener {
public static final int GRAVITY_CENTER = 2;
public static final int GRAVITY_LEFT = 1;
public static final String KEY_CANCELBUTTON = "cancel";
public static final String KEY_OK_BUTTON = "ok";
public static final String KEY_TIPS = "tips";
public static final String KEY_TIPS_GRAVITY = "tipsGravity";
public static final String KEY_TITLE = "title";
private TextView cancelBtn;
private String cancelButton;
private IDialogListener listener;
private TextView okBtn;
private String okButton;
private String tips;
private int tipsGravity;
private TextView tipsTxt;
private String title;
private TextView tvTitle;
public static SimpleQuestionDialog newInstance(String str) {
Bundle bundle = new Bundle();
bundle.putString(KEY_TIPS, str);
SimpleQuestionDialog simpleQuestionDialog = new SimpleQuestionDialog();
simpleQuestionDialog.setArguments(bundle);
return simpleQuestionDialog;
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (view.getId() == R.id.simple_question_dialog_ok) {
IDialogListener iDialogListener = this.listener;
if (iDialogListener != null) {
iDialogListener.onOk();
}
dismiss();
return;
}
if (view.getId() == R.id.simple_question_dialog_cancel) {
IDialogListener iDialogListener2 = this.listener;
if (iDialogListener2 != null) {
iDialogListener2.onCancle();
}
dismiss();
}
}
@Override // android.app.DialogFragment, android.app.Fragment
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setCancelable(false);
Bundle arguments = getArguments();
if (arguments != null) {
this.title = arguments.getString("title");
this.tips = arguments.getString(KEY_TIPS);
this.okButton = arguments.getString(KEY_OK_BUTTON);
this.cancelButton = arguments.getString(KEY_CANCELBUTTON);
this.tipsGravity = arguments.getInt(KEY_TIPS_GRAVITY);
}
}
@Override // android.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
getDialog().requestWindowFeature(1);
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0));
View inflate = layoutInflater.inflate(R.layout.dialog_simple_question, viewGroup);
this.tvTitle = (TextView) inflate.findViewById(R.id.simple_question_dialog_title);
this.tipsTxt = (TextView) inflate.findViewById(R.id.simple_question_dialog_info);
this.okBtn = (TextView) inflate.findViewById(R.id.simple_question_dialog_ok);
this.cancelBtn = (TextView) inflate.findViewById(R.id.simple_question_dialog_cancel);
this.okBtn.setOnClickListener(this);
this.cancelBtn.setOnClickListener(this);
this.tipsTxt.setText(this.tips + " ");
if (!TextUtils.isEmpty(this.okButton)) {
this.okBtn.setText(this.okButton);
}
if (!TextUtils.isEmpty(this.cancelButton)) {
this.cancelBtn.setText(this.cancelButton);
}
if (TextUtils.isEmpty(this.title)) {
int a = DisplayUtil.a((Context) getActivity(), 46.0f);
this.tipsTxt.setPadding(a, a, a, a);
this.tvTitle.setVisibility(8);
} else {
this.tvTitle.setVisibility(0);
this.tvTitle.setText(this.title);
}
int i = this.tipsGravity;
if (i > 0) {
setTextLeft(i);
}
return inflate;
}
public void setListener(IDialogListener iDialogListener) {
this.listener = iDialogListener;
}
public void setTextLeft(int i) {
TextView textView = this.tipsTxt;
if (textView != null) {
if (i == 1) {
textView.setGravity(3);
} else if (i == 2) {
textView.setGravity(17);
}
}
}
public static SimpleQuestionDialog newInstance(String str, String str2, String str3) {
Bundle bundle = new Bundle();
bundle.putString(KEY_OK_BUTTON, str);
bundle.putString(KEY_CANCELBUTTON, str2);
bundle.putString(KEY_TIPS, str3);
SimpleQuestionDialog simpleQuestionDialog = new SimpleQuestionDialog();
simpleQuestionDialog.setArguments(bundle);
return simpleQuestionDialog;
}
public static SimpleQuestionDialog newInstance(String str, String str2, String str3, String str4, int i) {
Bundle bundle = new Bundle();
bundle.putString("title", str);
bundle.putString(KEY_OK_BUTTON, str2);
bundle.putString(KEY_CANCELBUTTON, str3);
bundle.putString(KEY_TIPS, str4);
bundle.putInt(KEY_TIPS_GRAVITY, i);
SimpleQuestionDialog simpleQuestionDialog = new SimpleQuestionDialog();
simpleQuestionDialog.setArguments(bundle);
return simpleQuestionDialog;
}
}

View File

@@ -0,0 +1,265 @@
package com.ubt.jimu.base.dialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubtech.utils.DisplayUtil;
import com.ubtech.view.widget.UButton;
/* loaded from: classes.dex */
public class UpdateDialog extends Dialog implements View.OnClickListener {
private boolean backAble;
private UButton btnCancel;
private UButton btnOk;
private String cancel;
private boolean canceledOnTouchOutside;
private String content;
private ImageView imgLeft;
private ImageView imgRight;
private boolean isLeft;
private boolean isRight;
private int leftResId;
private InteractionListner mInteractionListener;
private String ok;
private int rightResId;
private String title;
private TextView tvContent;
private TextView tvDialogTitle;
public static class Builder {
private String cancel;
private String content;
private int leftResId;
private InteractionListner mInteractionListner;
private String ok;
private int rightResId;
private String title;
private boolean canceledOnTouchOutside = true;
private boolean backAble = true;
private boolean isLeft = false;
private boolean isRight = false;
public Builder backAble(boolean z) {
this.backAble = z;
return this;
}
public Builder cancel(String str) {
this.cancel = str;
return this;
}
public Builder canceledOnTouchOutside(boolean z) {
this.canceledOnTouchOutside = z;
return this;
}
public Builder content(String str) {
this.content = str;
return this;
}
public Builder interactionListener(InteractionListner interactionListner) {
this.mInteractionListner = interactionListner;
return this;
}
public Builder isLeft(boolean z) {
this.isLeft = z;
return this;
}
public Builder isRight(boolean z) {
this.isRight = z;
return this;
}
public Builder leftResId(int i) {
this.leftResId = i;
return this;
}
public Builder ok(String str) {
this.ok = str;
return this;
}
public Builder rightResId(int i) {
this.rightResId = i;
return this;
}
public Builder title(String str) {
this.title = str;
return this;
}
}
public interface InteractionListner {
void onCancelClick(UpdateDialog updateDialog);
void onLeftImgClick(UpdateDialog updateDialog);
void onOkClick(UpdateDialog updateDialog);
void onRightImgClick(UpdateDialog updateDialog);
}
public UpdateDialog(Context context, Builder builder) {
super(context);
this.canceledOnTouchOutside = builder.canceledOnTouchOutside;
this.backAble = builder.backAble;
this.isLeft = builder.isLeft;
this.isRight = builder.isRight;
this.leftResId = builder.leftResId;
this.rightResId = builder.rightResId;
this.title = builder.title;
this.content = builder.content;
this.cancel = builder.cancel;
this.ok = builder.ok;
this.mInteractionListener = builder.mInteractionListner;
}
private void initView() {
this.imgLeft = (ImageView) findViewById(R.id.imgLeft);
this.imgRight = (ImageView) findViewById(R.id.imgRight);
this.tvDialogTitle = (TextView) findViewById(R.id.tvDialogTitle);
this.tvContent = (TextView) findViewById(R.id.tvContent);
this.btnCancel = (UButton) findViewById(R.id.btnCancel);
this.btnOk = (UButton) findViewById(R.id.btnOk);
this.imgLeft.setOnClickListener(this);
this.imgRight.setOnClickListener(this);
this.btnCancel.setOnClickListener(this);
this.btnOk.setOnClickListener(this);
if (this.isLeft) {
this.imgLeft.setVisibility(0);
this.imgLeft.setImageResource(this.leftResId);
} else {
this.imgLeft.setVisibility(8);
}
if (this.isRight) {
this.imgRight.setVisibility(0);
this.imgRight.setImageResource(this.rightResId);
} else {
this.imgRight.setVisibility(8);
}
if (TextUtils.isEmpty(this.cancel)) {
this.btnCancel.setVisibility(8);
} else {
this.btnCancel.setVisibility(0);
this.btnCancel.setText(this.cancel);
}
if (TextUtils.isEmpty(this.ok)) {
this.btnOk.setVisibility(8);
} else {
this.btnOk.setVisibility(0);
this.btnOk.setText(this.ok);
}
if (TextUtils.isEmpty(this.title)) {
this.tvDialogTitle.setVisibility(4);
} else {
this.tvDialogTitle.setVisibility(0);
this.tvDialogTitle.setText(this.title);
}
if (TextUtils.isEmpty(this.content)) {
this.tvContent.setVisibility(4);
return;
}
this.tvContent.setVisibility(0);
this.tvContent.setText(this.content);
this.tvContent.setMovementMethod(ScrollingMovementMethod.getInstance());
}
private void setupWindow() {
int i;
double d;
int a;
int a2;
requestWindowFeature(1);
setContentView(R.layout.firmware_update_dialog);
Window window = getWindow();
window.setBackgroundDrawable(new ColorDrawable(0));
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
WindowManager.LayoutParams attributes = window.getAttributes();
int max = Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l()));
if (JimuApplication.l().i()) {
i = (int) (max * 0.5039d);
d = 0.624d;
} else {
i = (int) (max * 0.5165d);
d = 0.6088d;
}
int i2 = (int) (i * d);
if (JimuApplication.l().i()) {
a = DisplayUtil.a(getContext(), 516.0f);
a2 = DisplayUtil.a(getContext(), 322.0f);
} else {
a = DisplayUtil.a(getContext(), 344.0f);
a2 = DisplayUtil.a(getContext(), 222.5f);
}
if (a > i || a2 > i2) {
i = a;
i2 = a2;
}
attributes.width = i;
attributes.height = i2;
attributes.gravity = 17;
window.setAttributes(attributes);
setCanceledOnTouchOutside(this.canceledOnTouchOutside);
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (this.mInteractionListener == null) {
}
switch (view.getId()) {
case R.id.btnCancel /* 2131296362 */:
this.mInteractionListener.onCancelClick(this);
break;
case R.id.btnOk /* 2131296369 */:
this.mInteractionListener.onOkClick(this);
break;
case R.id.imgLeft /* 2131296847 */:
this.mInteractionListener.onLeftImgClick(this);
break;
case R.id.imgRight /* 2131296875 */:
this.mInteractionListener.onRightImgClick(this);
break;
}
}
@Override // android.app.Dialog
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setupWindow();
initView();
}
@Override // android.app.Dialog, android.view.KeyEvent.Callback
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (this.backAble) {
return super.onKeyDown(i, keyEvent);
}
return true;
}
public UpdateDialog(Context context, int i) {
super(context, i);
}
protected UpdateDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
super(context, z, onCancelListener);
}
}

View File

@@ -0,0 +1,161 @@
package com.ubt.jimu.base.dialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.ColorDrawable;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubt.jimu.base.dialog.UserExperienceDialog;
import com.ubtech.utils.DisplayUtil;
/* loaded from: classes.dex */
public class UserExperienceDialog extends Dialog implements View.OnClickListener {
public Button btnCancel;
public Button btnOk;
public String cancel;
public String content;
private Context context;
public String ok;
private DialogInterface.OnClickListener onCancelListener;
private DialogInterface.OnClickListener onOkListener;
private TextView tvTips;
public static class Builder {
private Context context;
private DialogInterface.OnClickListener onCancelListener;
private DialogInterface.OnClickListener onOkListener;
public Builder(Context context) {
this.context = context;
}
static /* synthetic */ boolean a(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
return i == 4;
}
public UserExperienceDialog build() {
int i;
double d;
int a;
int a2;
UserExperienceDialog userExperienceDialog = new UserExperienceDialog(this.context);
userExperienceDialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.ubt.jimu.base.dialog.b
@Override // android.content.DialogInterface.OnKeyListener
public final boolean onKey(DialogInterface dialogInterface, int i2, KeyEvent keyEvent) {
return UserExperienceDialog.Builder.a(dialogInterface, i2, keyEvent);
}
});
userExperienceDialog.context = this.context;
userExperienceDialog.onOkListener = this.onOkListener;
userExperienceDialog.onCancelListener = this.onCancelListener;
userExperienceDialog.requestWindowFeature(1);
userExperienceDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
View inflate = LayoutInflater.from(this.context).inflate(R.layout.dialog_jimu_user_experience, (ViewGroup) null, false);
userExperienceDialog.intView(inflate, this);
userExperienceDialog.setContentView(inflate);
userExperienceDialog.setCanceledOnTouchOutside(false);
Window window = userExperienceDialog.getWindow();
WindowManager.LayoutParams attributes = window.getAttributes();
window.setBackgroundDrawableResource(R.color.translucent);
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
int max = Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l()));
if (JimuApplication.l().i()) {
i = (int) (max * 0.5039d);
d = 0.624d;
} else {
i = (int) (max * 0.5165d);
d = 0.6088d;
}
int i2 = (int) (i * d);
if (JimuApplication.l().i()) {
a = DisplayUtil.a(this.context, 516.0f);
a2 = DisplayUtil.a(this.context, 322.0f);
} else {
a = DisplayUtil.a(this.context, 344.55f);
a2 = DisplayUtil.a(this.context, 209.75f);
}
if (a > i || a2 > i2) {
i = a;
i2 = a2;
}
attributes.width = i;
attributes.height = i2;
attributes.gravity = 17;
window.setAttributes(attributes);
return userExperienceDialog;
}
public Builder onCancel(DialogInterface.OnClickListener onClickListener) {
this.onCancelListener = onClickListener;
return this;
}
public Builder onOk(DialogInterface.OnClickListener onClickListener) {
this.onOkListener = onClickListener;
return this;
}
}
public UserExperienceDialog(Context context) {
super(context);
}
@Override // android.app.Dialog, android.content.DialogInterface
public void dismiss() {
super.dismiss();
}
public void intView(View view, Builder builder) {
this.tvTips = (TextView) view.findViewById(R.id.tvTips);
this.btnCancel = (Button) view.findViewById(R.id.btnCancel);
this.btnOk = (Button) view.findViewById(R.id.btnOk);
this.btnCancel.setOnClickListener(this);
this.btnOk.setOnClickListener(this);
this.tvTips.setText("体验优化");
this.btnOk.setText(this.context.getResources().getString(R.string.gdpr_agree));
this.btnCancel.setText("暂不同意");
this.btnCancel.setBackgroundResource(R.drawable.sel_common_negative_btn);
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
int id = view.getId();
if (id == R.id.btnCancel) {
DialogInterface.OnClickListener onClickListener = this.onCancelListener;
if (onClickListener != null) {
onClickListener.onClick(this, 0);
return;
} else {
dismiss();
return;
}
}
if (id != R.id.btnOk) {
dismiss();
return;
}
DialogInterface.OnClickListener onClickListener2 = this.onOkListener;
if (onClickListener2 != null) {
onClickListener2.onClick(this, 0);
} else {
dismiss();
}
}
public UserExperienceDialog(Context context, int i) {
super(context, i);
}
protected UserExperienceDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
super(context, z, onCancelListener);
}
}

View File

@@ -0,0 +1,76 @@
package com.ubt.jimu.base.dialog;
import android.R;
import android.app.DialogFragment;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
/* loaded from: classes.dex */
public class WaitDialogSupport extends DialogFragment {
private AnimationDrawable backgroundAnimation;
private Animation rotateAnimaLow;
private String tip;
private TextView tipTv;
public static DialogFragment newInstance(String str) {
WaitDialogSupport waitDialogSupport = new WaitDialogSupport();
Bundle bundle = new Bundle();
bundle.putString("tip", str);
waitDialogSupport.setArguments(bundle);
return waitDialogSupport;
}
@Override // android.app.DialogFragment
public void dismiss() {
try {
super.dismiss();
} catch (Throwable th) {
th.printStackTrace();
}
Animation animation = this.rotateAnimaLow;
if (animation != null) {
animation.cancel();
this.rotateAnimaLow = null;
}
AnimationDrawable animationDrawable = this.backgroundAnimation;
if (animationDrawable != null) {
animationDrawable.stop();
this.backgroundAnimation = null;
}
}
@Override // android.app.DialogFragment, android.app.Fragment
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setStyle(0, R.style.Theme.Translucent.NoTitleBar.Fullscreen);
this.tip = getArguments().getString("tip");
}
@Override // android.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(com.ubt.jimu.R.layout.dialog_wait, viewGroup, false);
ImageView imageView = (ImageView) inflate.findViewById(com.ubt.jimu.R.id.wait_dialog_img);
this.tipTv = (TextView) inflate.findViewById(com.ubt.jimu.R.id.dialog_wait_tv_loading_tips);
if (TextUtils.isEmpty(this.tip)) {
this.tipTv.setVisibility(8);
} else {
this.tipTv.setText(this.tip);
}
this.rotateAnimaLow = AnimationUtils.loadAnimation(getActivity(), com.ubt.jimu.R.anim.anima_dialog_wait);
imageView.startAnimation(this.rotateAnimaLow);
this.backgroundAnimation = (AnimationDrawable) imageView.getBackground();
AnimationDrawable animationDrawable = this.backgroundAnimation;
if (animationDrawable != null) {
animationDrawable.start();
}
return inflate;
}
}