package com.ubt.jimu.widgets; import android.content.Context; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.TextView; import androidx.appcompat.app.AppCompatDialog; import com.ubt.jimu.JimuApplication; import com.ubt.jimu.R; import com.ubt.jimu.widgets.UDialog; import com.ubtech.utils.DisplayUtil; import io.reactivex.disposables.CompositeDisposable; /* loaded from: classes2.dex */ public class UDialog extends AppCompatDialog { private CompositeDisposable c; public static class Builder { private Context a; private TextView b; private Button c; private String d; private String e; private View.OnClickListener f; private UDialog g; public Builder(Context context) { this.a = context; this.g = new UDialog(context); } public Builder a(int i) { this.d = this.a.getString(i); return this; } public Builder a(int i, View.OnClickListener onClickListener) { this.e = this.a.getString(i); this.f = onClickListener; return this; } public UDialog a() { int i; double d; int a; int a2; this.g.setContentView(R.layout.dialog_common); this.b = (TextView) this.g.findViewById(R.id.tvTips); this.c = (Button) this.g.findViewById(R.id.btnOk); this.g.setCancelable(false); this.g.setCanceledOnTouchOutside(false); this.b.setText(this.d); this.c.setText(this.e); this.c.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.k @Override // android.view.View.OnClickListener public final void onClick(View view) { UDialog.Builder.this.a(view); } }); Window window = this.g.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.a, 516.0f); a2 = DisplayUtil.a(this.a, 322.0f); } else { a = DisplayUtil.a(this.a, 344.55f); a2 = DisplayUtil.a(this.a, 209.75f); } if (a > i || a2 > i2) { i = a; i2 = a2; } attributes.width = i; attributes.height = i2; attributes.gravity = 17; window.setAttributes(attributes); return this.g; } public /* synthetic */ void a(View view) { this.g.dismiss(); View.OnClickListener onClickListener = this.f; if (onClickListener != null) { onClickListener.onClick(view); } } } public UDialog(Context context) { super(context); this.c = new CompositeDisposable(); } @Override // android.app.Dialog, android.content.DialogInterface public void dismiss() { super.dismiss(); this.c.dispose(); this.c.a(); } }