正在查看: TodoCrédito v1.4 应用的 BaseDialog.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: TodoCrédito v1.4 应用的 BaseDialog.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.kongzue.dialogx.interfaces;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.k;
import androidx.lifecycle.n;
import androidx.lifecycle.p;
import com.kongzue.dialogx.DialogX;
import com.kongzue.dialogx.R$id;
import com.kongzue.dialogx.dialogs.WaitDialog;
import com.kongzue.dialogx.impl.DialogFragmentImpl;
import com.kongzue.dialogx.util.DialogXFloatingWindowActivity;
import com.kongzue.dialogx.util.TextInfo;
import com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import me.jessyan.autosize.BuildConfig;
import x3.a;
public abstract class BaseDialog implements n {
public static Thread A;
public static WeakReference<Activity> B;
public static List<BaseDialog> C;
public static Map<String, z3.a> D;
public static WeakReference<Handler> E;
public WeakReference<Activity> f7623c;
public WeakReference<FrameLayout> f7624d;
public WeakReference<View> f7625e;
public WeakReference<DialogFragmentImpl> f7626g;
public WeakReference<DialogXFloatingWindowActivity> f7628i;
public WeakReference<z3.b> f7629j;
public boolean f7631l;
public boolean f7632m;
public long f7637r;
public long f7638s;
public int f7639t;
public int f7640u;
public int f7641v;
public int f7642w;
public boolean f7644y;
public boolean f7645z;
public DialogX.IMPL_MODE f7627h = DialogX.f7536e;
public p f7630k = new p(this);
public Integer f7636q = null;
public int[] f7643x = new int[4];
public f f7633n = DialogX.f7533b;
public DialogX.THEME f7634o = DialogX.f7534c;
public boolean f7635p = DialogX.f7541j;
public enum BOOLEAN {
TRUE,
FALSE
}
public enum BUTTON_SELECT_RESULT {
NONE,
BUTTON_OK,
BUTTON_CANCEL,
BUTTON_OTHER
}
public class a implements a.InterfaceC0235a {
@Override
public void a(Activity activity) {
BaseDialog.N(activity);
}
}
public class b implements z3.a {
public final View f7648b;
public class a implements Runnable {
public final FrameLayout f7649c;
public a(FrameLayout frameLayout) {
this.f7649c = frameLayout;
}
@Override
public void run() {
if (b.this.f7648b.getParent() != BaseDialog.this.H()) {
if (b.this.f7648b.getParent() != null) {
((ViewGroup) b.this.f7648b.getParent()).removeView(b.this.f7648b);
}
this.f7649c.addView(b.this.f7648b);
} else {
BaseDialog.n(((BaseDialog) b.this.f7648b.getTag()).k() + "已处于显示状态,请勿重复执行 show() 指令。");
}
}
}
public b(View view) {
this.f7648b = view;
}
@Override
public void a(Activity activity) {
BaseDialog.this.f7628i = new WeakReference<>((DialogXFloatingWindowActivity) activity);
BaseDialog.this.f7628i.get().Y(BaseDialog.this.E());
FrameLayout t8 = BaseDialog.t(activity);
if (t8 == null) {
return;
}
BaseDialog.a0(new a(t8));
}
}
public class c implements Runnable {
public final View f7651c;
public final BaseDialog f7652d;
public c(View view, BaseDialog baseDialog) {
this.f7651c = view;
this.f7652d = baseDialog;
}
@Override
public void run() {
if (this.f7651c.getParent() != this.f7652d.H()) {
if (this.f7651c.getParent() != null) {
((ViewGroup) this.f7651c.getParent()).removeView(this.f7651c);
}
this.f7652d.H().addView(this.f7651c);
} else {
BaseDialog.n(((BaseDialog) this.f7651c.getTag()).k() + "已处于显示状态,请勿重复执行 show() 指令。");
}
}
}
public class d implements Runnable {
public final View f7653c;
public final BaseDialog f7654d;
public d(View view, BaseDialog baseDialog) {
this.f7653c = view;
this.f7654d = baseDialog;
}
@Override
public void run() {
if (this.f7653c.getParent() != null && (this.f7653c.getParent() instanceof ViewGroup)) {
((ViewGroup) this.f7653c.getParent()).removeView(this.f7653c);
} else if (this.f7654d.H() == null) {
return;
} else {
this.f7654d.H().removeView(this.f7653c);
}
BaseDialog.Y();
}
}
public static class e {
public static final int[] f7655a;
static {
int[] iArr = new int[DialogX.IMPL_MODE.values().length];
f7655a = iArr;
try {
iArr[DialogX.IMPL_MODE.WINDOW.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f7655a[DialogX.IMPL_MODE.DIALOG_FRAGMENT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f7655a[DialogX.IMPL_MODE.FLOATING_ACTIVITY.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
public BaseDialog() {
this.f7631l = true;
this.f7637r = -1L;
this.f7638s = -1L;
this.f7631l = DialogX.f7547p;
this.f7637r = DialogX.f7549r;
this.f7638s = DialogX.f7550s;
}
public static Context F() {
Activity K = K();
if (K != null) {
return K;
}
Context q8 = q();
if (q8 != null) {
return q8;
}
n("DialogX 未初始化(E2)。\n请检查是否在启动对话框前进行初始化操作,使用以下代码进行初始化:\nDialogX.init(context);\n\n另外建议您前往查看 DialogX 的文档进行使用:https://github.com/kongzue/DialogX");
return null;
}
public static List<BaseDialog> I() {
return C == null ? new ArrayList() : new CopyOnWriteArrayList(C);
}
public static FragmentManager J(Activity activity) {
if (activity instanceof AppCompatActivity) {
return ((AppCompatActivity) activity).A();
}
return null;
}
public static Activity K() {
WeakReference<Activity> weakReference = B;
if (weakReference != null && weakReference.get() != null) {
return B.get();
}
M(null);
WeakReference<Activity> weakReference2 = B;
if (weakReference2 != null && weakReference2.get() != null) {
return B.get();
}
Activity d9 = x3.a.d();
M(d9);
return d9;
}
public static Thread L() {
if (A == null) {
A = Looper.getMainLooper().getThread();
}
return A;
}
public static void M(Context context) {
if (context == null) {
context = x3.a.d();
}
if (context instanceof Activity) {
N((Activity) context);
}
x3.a.e(context, new a());
}
public static void N(Activity activity) {
if (x3.a.f(activity)) {
return;
}
try {
A = Looper.getMainLooper().getThread();
B = new WeakReference<>(activity);
} catch (Exception e9) {
e9.printStackTrace();
n("DialogX.init: 初始化异常,找不到Activity的根布局");
}
}
public static boolean P(CharSequence charSequence) {
String valueOf = String.valueOf(charSequence);
return charSequence == null || valueOf.trim().isEmpty() || "null".equals(valueOf) || "(null)".equals(valueOf);
}
public static void R(Object obj) {
if (DialogX.f7532a) {
Log.i(">>>", obj.toString());
}
}
public static void S(Activity activity) {
if (C != null) {
CopyOnWriteArrayList copyOnWriteArrayList = new CopyOnWriteArrayList(C);
for (int size = copyOnWriteArrayList.size() - 1; size >= 0; size--) {
BaseDialog baseDialog = (BaseDialog) copyOnWriteArrayList.get(size);
if (baseDialog.E() == activity && baseDialog.f7632m && baseDialog.w() != null) {
View findViewById = baseDialog.w().findViewById(R$id.box_root);
if (findViewById instanceof DialogXBaseRelativeLayout) {
DialogXBaseRelativeLayout dialogXBaseRelativeLayout = (DialogXBaseRelativeLayout) findViewById;
if (dialogXBaseRelativeLayout.d()) {
dialogXBaseRelativeLayout.f();
return;
}
} else {
continue;
}
}
}
}
}
public static void W(Activity activity) {
WeakReference<View> weakReference;
WeakReference<DialogFragmentImpl> weakReference2;
int i9 = e.f7655a[DialogX.f7536e.ordinal()];
if (i9 != 1) {
if (i9 != 2) {
if (i9 != 3 && C != null) {
Iterator it = new CopyOnWriteArrayList(C).iterator();
while (it.hasNext()) {
BaseDialog baseDialog = (BaseDialog) it.next();
if (baseDialog.E() == activity) {
baseDialog.h();
C.remove(baseDialog);
if (baseDialog instanceof WaitDialog) {
((WaitDialog) baseDialog).f1();
}
}
}
}
} else if (C != null) {
Iterator it2 = new CopyOnWriteArrayList(C).iterator();
while (it2.hasNext()) {
BaseDialog baseDialog2 = (BaseDialog) it2.next();
if (baseDialog2.E() == activity && (weakReference2 = baseDialog2.f7626g) != null && weakReference2.get() != null) {
baseDialog2.f7626g.get().X1();
if (baseDialog2 instanceof WaitDialog) {
((WaitDialog) baseDialog2).f1();
}
C.remove(baseDialog2);
}
}
}
} else if (C != null) {
Iterator it3 = new CopyOnWriteArrayList(C).iterator();
while (it3.hasNext()) {
BaseDialog baseDialog3 = (BaseDialog) it3.next();
if (baseDialog3.E() == activity && (weakReference = baseDialog3.f7625e) != null) {
z3.c.b(weakReference.get());
if (baseDialog3 instanceof WaitDialog) {
((WaitDialog) baseDialog3).f1();
}
C.remove(baseDialog3);
}
}
}
if (activity == K()) {
i();
}
}
public static void X(BaseDialog baseDialog) {
List<BaseDialog> list = C;
if (list != null) {
list.remove(baseDialog);
}
}
public static void Y() {
if (C != null) {
CopyOnWriteArrayList copyOnWriteArrayList = new CopyOnWriteArrayList(C);
for (int size = copyOnWriteArrayList.size() - 1; size >= 0; size--) {
BaseDialog baseDialog = (BaseDialog) copyOnWriteArrayList.get(size);
if (baseDialog.E() == K() && baseDialog.f7632m && baseDialog.w() != null) {
View findViewById = baseDialog.w().findViewById(R$id.box_root);
if ((findViewById instanceof DialogXBaseRelativeLayout) && ((DialogXBaseRelativeLayout) findViewById).d()) {
findViewById.requestFocus();
return;
}
}
}
}
}
public static void a0(Runnable runnable) {
if (!DialogX.f7551t || (L() != null && Thread.currentThread() == L())) {
runnable.run();
} else {
b0(runnable, true);
}
}
public static void b0(Runnable runnable, boolean z8) {
z().post(runnable);
}
public static void c0(Runnable runnable, long j9) {
if (j9 < 0) {
return;
}
if (!DialogX.f7551t) {
runnable.run();
}
z().postDelayed(runnable, j9);
}
public static void f(BaseDialog baseDialog) {
if (C == null) {
C = new CopyOnWriteArrayList();
}
C.add(baseDialog);
}
public static void h0(View view) {
BaseDialog baseDialog;
if (view == null || (baseDialog = (BaseDialog) view.getTag()) == null) {
return;
}
if (baseDialog.f7632m) {
if (baseDialog.w() != null) {
baseDialog.w().setVisibility(0);
return;
}
n(((BaseDialog) view.getTag()).k() + "已处于显示状态,请勿重复执行 show() 指令。");
return;
}
baseDialog.f7625e = new WeakReference<>(view);
R(baseDialog.k() + ".show on " + baseDialog.E());
f(baseDialog);
int i9 = e.f7655a[baseDialog.f7627h.ordinal()];
if (i9 == 1) {
z3.c.c(baseDialog.E(), view, true);
return;
}
if (i9 == 2) {
DialogFragmentImpl dialogFragmentImpl = new DialogFragmentImpl(baseDialog, view);
dialogFragmentImpl.k2(J(baseDialog.E()), "DialogX");
baseDialog.f7626g = new WeakReference<>(dialogFragmentImpl);
return;
}
if (i9 != 3) {
if (baseDialog.H() == null) {
return;
}
a0(new c(view, baseDialog));
return;
}
if (D == null) {
D = new HashMap();
}
D.put(baseDialog.k(), baseDialog.new b(view));
DialogXFloatingWindowActivity V = DialogXFloatingWindowActivity.V();
if (V != null && V.X(baseDialog.E().hashCode())) {
V.a0(baseDialog.k());
return;
}
Intent intent = new Intent(F(), (Class<?>) DialogXFloatingWindowActivity.class);
if (baseDialog.E() == null) {
intent.addFlags(268435456);
}
intent.putExtra("dialogXKey", baseDialog.k());
intent.putExtra("fromActivityUiStatus", (baseDialog.E() == null || t(baseDialog.E()) == null) ? 0 : t(baseDialog.E()).getSystemUiVisibility());
intent.putExtra("from", F().hashCode());
F().startActivity(intent);
if (Integer.valueOf(Build.VERSION.SDK_INT).intValue() <= 5 || baseDialog.E() == null) {
return;
}
baseDialog.E().overridePendingTransition(0, 0);
}
public static void i() {
WeakReference<Activity> weakReference = B;
if (weakReference != null) {
weakReference.clear();
}
B = null;
System.gc();
}
public static void j0(TextView textView, TextInfo textInfo) {
}
public static void m(View view) {
if (view == null) {
return;
}
BaseDialog baseDialog = (BaseDialog) view.getTag();
R(baseDialog.k() + ".dismiss");
X(baseDialog);
WeakReference<View> weakReference = baseDialog.f7625e;
if (weakReference != null) {
weakReference.clear();
}
int i9 = e.f7655a[baseDialog.f7627h.ordinal()];
if (i9 == 1) {
z3.c.b(view);
} else if (i9 == 2) {
WeakReference<DialogFragmentImpl> weakReference2 = baseDialog.f7626g;
if (weakReference2 != null && weakReference2.get() != null) {
baseDialog.f7626g.get().X1();
}
} else if (i9 != 3) {
b0(new d(view, baseDialog), true);
} else {
WeakReference<DialogXFloatingWindowActivity> weakReference3 = baseDialog.f7628i;
if (weakReference3 != null && weakReference3.get() != null) {
FrameLayout t8 = t(baseDialog.f7628i.get());
if (t8 != null) {
t8.removeView(view);
}
baseDialog.f7628i.get().U(baseDialog.k());
Y();
}
}
if (baseDialog.v() == null || baseDialog.v().a()) {
return;
}
baseDialog.v().b();
}
public static void n(Object obj) {
if (DialogX.f7532a) {
Log.e(">>>", obj.toString());
}
}
public static z3.a p(String str) {
if (str == null) {
return null;
}
return D.get(str);
}
public static Context q() {
return x3.a.b();
}
public static FrameLayout t(Activity activity) {
if (activity == null || activity.getWindow() == null || !(activity.getWindow().getDecorView() instanceof FrameLayout)) {
return null;
}
return (FrameLayout) activity.getWindow().getDecorView();
}
public static Handler z() {
WeakReference<Handler> weakReference = E;
if (weakReference != null && weakReference.get() != null) {
return E.get();
}
WeakReference<Handler> weakReference2 = new WeakReference<>(new Handler(Looper.getMainLooper()));
E = weakReference2;
return weakReference2.get();
}
public int A() {
int i9 = this.f7640u;
return i9 == 0 ? DialogX.f7538g : i9;
}
public int B() {
int i9 = this.f7639t;
return i9 == 0 ? DialogX.f7537f : i9;
}
public int C() {
int i9 = this.f7642w;
return i9 == 0 ? DialogX.f7540i : i9;
}
public int D() {
int i9 = this.f7641v;
return i9 == 0 ? DialogX.f7539h : i9;
}
public Activity E() {
WeakReference<Activity> weakReference = this.f7623c;
if (weakReference == null || weakReference.get() == null) {
f0(K());
}
return this.f7623c.get();
}
public Resources G() {
return E() != null ? E().getResources() : q() == null ? Resources.getSystem() : q().getResources();
}
public FrameLayout H() {
Activity E2 = E();
if (E2 == null) {
E2 = K();
if (E2 == null) {
n("DialogX 错误:在 getRootFrameLayout() 时无法获取绑定的 activity,请确认是否正确初始化:\nDialogX.init(context);\n\n或者使用 .show(activity) 启动对话框\n另外建议您前往查看 DialogX 的文档进行使用:https://github.com/kongzue/DialogX");
return null;
}
f0(E2);
}
FrameLayout t8 = t(E2);
if (t8 != null) {
WeakReference<FrameLayout> weakReference = new WeakReference<>(t8);
this.f7624d = weakReference;
return weakReference.get();
}
n("DialogX 错误:在 getRootFrameLayout() 时无法获 activity(" + E2 + ") 的 decorView,请检查该 activity 是否正常显示且可以使 DialogX 基于其显示。\n若该 activity 不可用,可通过以下代码配置豁免 DialogX 对话框绑定至该 activity,例如:\nDialogX.unsupportedActivitiesPackageNames = new String[]{\n \"com.bytedance.sdk.openadsdk.stub.activity\",\n \"com.mobile.auth.gatewayauth\",\n \"com.google.android.gms.ads\"\n};\n\n另外建议您前往查看 DialogX 的文档进行使用:https://github.com/kongzue/DialogX");
return null;
}
public boolean O() {
DialogX.THEME theme = this.f7634o;
return theme == DialogX.THEME.AUTO ? q() == null ? this.f7634o == DialogX.THEME.LIGHT : (G().getConfiguration().uiMode & 48) == 16 : theme == DialogX.THEME.LIGHT;
}
public boolean Q() {
return this.f7632m;
}
public void T() {
}
public void U() {
}
public void V() {
}
public abstract void Z();
@Override
@NonNull
public Lifecycle a() {
return this.f7630k;
}
public void d0(View view) {
this.f7625e = new WeakReference<>(view);
}
public void e0(Lifecycle.State state) {
p pVar = this.f7630k;
if (pVar == null || state == null) {
return;
}
try {
pVar.o(state);
} catch (Exception unused) {
}
}
public final void f0(Activity activity) {
this.f7623c = new WeakReference<>(activity);
}
public void g() {
this.f7645z = true;
this.f7644y = false;
f0(K());
if (E() == null) {
M(null);
if (E() == null) {
n("DialogX 未初始化(E5)。\n请检查是否在启动对话框前进行初始化操作,使用以下代码进行初始化:\nDialogX.init(context);\n\n另外建议您前往查看 DialogX 的文档进行使用:https://github.com/kongzue/DialogX");
return;
}
}
if (this.f7627h != DialogX.IMPL_MODE.VIEW && (E() instanceof n)) {
((n) E()).a().a(new k() {
@Override
public void e(@NonNull n nVar, @NonNull Lifecycle.Event event) {
if (event == Lifecycle.Event.ON_DESTROY) {
BaseDialog.W(BaseDialog.this.E());
}
}
});
}
View currentFocus = E().getCurrentFocus();
if (currentFocus != null) {
((InputMethodManager) E().getSystemService("input_method")).hideSoftInputFromWindow(currentFocus.getWindowToken(), 2);
}
}
public abstract <D extends BaseDialog> D g0();
public void h() {
WeakReference<Activity> weakReference = this.f7623c;
if (weakReference != null) {
weakReference.clear();
}
this.f7625e = null;
this.f7623c = null;
}
public void i0(TextView textView, CharSequence charSequence) {
if (textView == null) {
return;
}
if (P(charSequence)) {
textView.setVisibility(8);
textView.setText(BuildConfig.FLAVOR);
} else {
textView.setVisibility(0);
textView.setText(charSequence);
}
}
public View j(int i9) {
if (E() != null) {
return LayoutInflater.from(E()).inflate(i9, (ViewGroup) null);
}
n("DialogX 未初始化(E3)。\n请检查是否在启动对话框前进行初始化操作,使用以下代码进行初始化:\nDialogX.init(context);\n\n另外建议您前往查看 DialogX 的文档进行使用:https://github.com/kongzue/DialogX");
return null;
}
public abstract String k();
public int l(float f9) {
return (int) ((f9 * G().getDisplayMetrics().density) + 0.5f);
}
public List<View> o(View view) {
ArrayList arrayList = new ArrayList();
if (view instanceof com.kongzue.dialogx.interfaces.a) {
arrayList.add(view);
}
if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
for (int i9 = 0; i9 < viewGroup.getChildCount(); i9++) {
List<View> o8 = o(viewGroup.getChildAt(i9));
if (o8 != null) {
arrayList.addAll(o8);
}
}
}
if (arrayList.isEmpty()) {
return null;
}
return arrayList;
}
public int r(int i9) {
if (q() != null) {
return G().getColor(i9);
}
n("DialogX 未初始化(E7)。\n请检查是否在启动对话框前进行初始化操作,使用以下代码进行初始化:\nDialogX.init(context);\n\n另外建议您前往查看 DialogX 的文档进行使用:https://github.com/kongzue/DialogX");
return -16777216;
}
public Integer s(Integer num, Integer num2) {
return Integer.valueOf(r(num == null ? num2.intValue() : num.intValue()));
}
public DialogX.IMPL_MODE u() {
return this.f7627h;
}
public z3.b v() {
WeakReference<z3.b> weakReference = this.f7629j;
if (weakReference == null) {
return null;
}
return weakReference.get();
}
public View w() {
WeakReference<View> weakReference = this.f7625e;
if (weakReference == null) {
return null;
}
return weakReference.get();
}
public Float x(Float f9, Float f10) {
if (f9.floatValue() > 0.0f) {
R("return styleValue=" + f9);
return f9;
}
R("styleValue=" + f9 + "<=0 ");
StringBuilder sb = new StringBuilder();
sb.append("return defaultValue=");
sb.append(f10);
R(sb.toString());
return f10;
}
public Integer y(Integer num, Integer num2) {
return num.intValue() <= 0 ? num2 : num;
}
}