抖映智能创作 v1.0.4版本的 MD5 值为:964d3a4f9a92da3d4edfc23c5180d390
以下内容为反编译后的 MyCustomDialogKt.java 源代码,内容仅作参考
package com.ncc.ai.utils;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.CountDownTimer;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
import androidx.appcompat.app.b;
import androidx.fragment.app.FragmentManager;
import androidx.view.CoroutineLiveDataKt;
import com.ncc.ai.dialog.CdkDialog;
import com.ncc.ai.dialog.WxDialog;
import com.ncc.ai.utils.MyCustomDialogKt;
import com.qslx.basal.Constants;
import com.qslx.basal.model.UpgradeBean;
import com.qslx.basal.utils.AppUtilsKt;
import com.qslx.basal.utils.MMKVUtils;
import com.qslx.basal.utils.ScreenUtils;
import com.ut.device.AidConstants;
import e7.f0;
import e7.g;
import java.io.File;
import java.util.List;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import n5.e;
import n5.h;
import o5.a1;
import o5.e1;
import o5.s3;
import o5.u3;
import o5.w3;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import x0.d;
public final class MyCustomDialogKt {
public static final void showCommonDialog(@NotNull Activity activity, @NotNull SpannableString content, @NotNull String confirmStr, @NotNull String cancelStr, @NotNull final Function1<? super Boolean, Unit> listener) {
Intrinsics.checkNotNullParameter(activity, "<this>");
Intrinsics.checkNotNullParameter(content, "content");
Intrinsics.checkNotNullParameter(confirmStr, "confirmStr");
Intrinsics.checkNotNullParameter(cancelStr, "cancelStr");
Intrinsics.checkNotNullParameter(listener, "listener");
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
?? a10 = new b.a(activity, h.f19125a).a();
Intrinsics.checkNotNullExpressionValue(a10, "Builder(this, R.style.DialogTheme).create()");
objectRef.element = a10;
s3 s3Var = (s3) d.e(LayoutInflater.from(activity), e.f19105n0, null, false);
if (s3Var != null) {
s3Var.B.setHighlightColor(0);
s3Var.B.setText(content);
s3Var.B.setMovementMethod(LinkMovementMethod.getInstance());
s3Var.C.setText(cancelStr);
s3Var.A.setText(confirmStr);
s3Var.C.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showCommonDialog$lambda$17$lambda$15(Function1.this, objectRef, view);
}
});
s3Var.A.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showCommonDialog$lambda$17$lambda$16(Function1.this, objectRef, view);
}
});
}
((b) objectRef.element).g(s3Var.w());
((b) objectRef.element).setCancelable(false);
((b) objectRef.element).show();
Window window = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window);
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.gravity = 17;
attributes.width = (int) (ScreenUtils.Companion.getScreenWidth(activity) * 0.79d);
attributes.height = -2;
Window window2 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window2);
window2.setAttributes(attributes);
Window window3 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window3);
window3.getDecorView().setPadding(0, 0, 0, 0);
Window window4 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window4);
window4.getDecorView().setBackgroundColor(0);
}
public static void showCommonDialog$default(Activity activity, SpannableString spannableString, String str, String str2, Function1 function1, int i10, Object obj) {
if ((i10 & 2) != 0) {
str = "同意";
}
if ((i10 & 4) != 0) {
str2 = "不同意";
}
showCommonDialog(activity, spannableString, str, str2, function1);
}
public static final void showCommonDialog$lambda$17$lambda$15(Function1 listener, Ref.ObjectRef dialog, View view) {
Intrinsics.checkNotNullParameter(listener, "$listener");
Intrinsics.checkNotNullParameter(dialog, "$dialog");
listener.invoke(Boolean.FALSE);
((b) dialog.element).dismiss();
}
public static final void showCommonDialog$lambda$17$lambda$16(Function1 listener, Ref.ObjectRef dialog, View view) {
Intrinsics.checkNotNullParameter(listener, "$listener");
Intrinsics.checkNotNullParameter(dialog, "$dialog");
listener.invoke(Boolean.TRUE);
((b) dialog.element).dismiss();
}
public static final void showPrivacyDialog(@NotNull Activity activity, @NotNull SpannableString spannableString, @NotNull final String cancelStr, @NotNull String confirmStr, @NotNull final Function1<? super String, Unit> listener) {
Intrinsics.checkNotNullParameter(activity, "<this>");
Intrinsics.checkNotNullParameter(spannableString, "spannableString");
Intrinsics.checkNotNullParameter(cancelStr, "cancelStr");
Intrinsics.checkNotNullParameter(confirmStr, "confirmStr");
Intrinsics.checkNotNullParameter(listener, "listener");
if (Intrinsics.areEqual(cancelStr, "不同意")) {
MMKVUtils mMKVUtils = MMKVUtils.INSTANCE;
mMKVUtils.encode(Constants.PRIVACY_PAGE_SHOW, Integer.valueOf(mMKVUtils.decodeInt(Constants.PRIVACY_PAGE_SHOW) + 1));
}
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
?? a10 = new b.a(activity, h.f19125a).a();
Intrinsics.checkNotNullExpressionValue(a10, "Builder(this, R.style.DialogTheme).create()");
objectRef.element = a10;
s3 s3Var = (s3) d.e(LayoutInflater.from(activity), e.f19105n0, null, false);
if (s3Var != null) {
s3Var.B.setHighlightColor(0);
s3Var.B.setText(spannableString);
s3Var.B.setMovementMethod(LinkMovementMethod.getInstance());
s3Var.C.setText(cancelStr);
s3Var.A.setText(confirmStr);
s3Var.C.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showPrivacyDialog$lambda$5$lambda$3(Function1.this, cancelStr, objectRef, view);
}
});
s3Var.A.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showPrivacyDialog$lambda$5$lambda$4(cancelStr, listener, objectRef, view);
}
});
}
((b) objectRef.element).g(s3Var.w());
((b) objectRef.element).setCancelable(false);
((b) objectRef.element).show();
Window window = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window);
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.gravity = 17;
attributes.width = (int) (ScreenUtils.Companion.getScreenWidth(activity) * 0.79d);
attributes.height = -2;
Window window2 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window2);
window2.setAttributes(attributes);
Window window3 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window3);
window3.getDecorView().setPadding(0, 0, 0, 0);
Window window4 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window4);
window4.getDecorView().setBackgroundColor(0);
}
public static void showPrivacyDialog$default(Activity activity, SpannableString spannableString, String str, String str2, Function1 function1, int i10, Object obj) {
if ((i10 & 2) != 0) {
str = "不同意";
}
if ((i10 & 4) != 0) {
str2 = "同意";
}
showPrivacyDialog(activity, spannableString, str, str2, function1);
}
public static final void showPrivacyDialog$lambda$5$lambda$3(Function1 listener, String cancelStr, Ref.ObjectRef dialog, View view) {
Intrinsics.checkNotNullParameter(listener, "$listener");
Intrinsics.checkNotNullParameter(cancelStr, "$cancelStr");
Intrinsics.checkNotNullParameter(dialog, "$dialog");
listener.invoke("cancel");
if (!Intrinsics.areEqual(cancelStr, "不同意")) {
((b) dialog.element).dismiss();
} else {
MMKVUtils mMKVUtils = MMKVUtils.INSTANCE;
mMKVUtils.encode(Constants.PRIVACY_PAGE_CANCEL, Integer.valueOf(mMKVUtils.decodeInt(Constants.PRIVACY_PAGE_CANCEL) + 1));
}
}
public static final void showPrivacyDialog$lambda$5$lambda$4(String cancelStr, Function1 listener, Ref.ObjectRef dialog, View view) {
Intrinsics.checkNotNullParameter(cancelStr, "$cancelStr");
Intrinsics.checkNotNullParameter(listener, "$listener");
Intrinsics.checkNotNullParameter(dialog, "$dialog");
if (Intrinsics.areEqual(cancelStr, "不同意")) {
MMKVUtils mMKVUtils = MMKVUtils.INSTANCE;
mMKVUtils.encode(Constants.PRIVACY_PAGE_CONFIRM, Integer.valueOf(mMKVUtils.decodeInt(Constants.PRIVACY_PAGE_CONFIRM) + 1));
}
listener.invoke("confirm");
((b) dialog.element).dismiss();
}
public static final void showPrivacyOutDialog(@NotNull Activity activity, @NotNull final Function1<? super String, Unit> listener) {
Intrinsics.checkNotNullParameter(activity, "<this>");
Intrinsics.checkNotNullParameter(listener, "listener");
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
?? a10 = new b.a(activity, h.f19125a).a();
Intrinsics.checkNotNullExpressionValue(a10, "Builder(this, R.style.DialogTheme).create()");
objectRef.element = a10;
u3 u3Var = (u3) d.e(LayoutInflater.from(activity), e.f19107o0, null, false);
if (u3Var != null) {
u3Var.C.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showPrivacyOutDialog$lambda$8$lambda$6(Ref.ObjectRef.this, listener, view);
}
});
u3Var.A.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showPrivacyOutDialog$lambda$8$lambda$7(Ref.ObjectRef.this, view);
}
});
}
((b) objectRef.element).g(u3Var.w());
((b) objectRef.element).setCancelable(false);
((b) objectRef.element).show();
Window window = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window);
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.gravity = 17;
attributes.width = (int) (ScreenUtils.Companion.getScreenWidth(activity) * 0.87d);
attributes.height = -2;
Window window2 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window2);
window2.setAttributes(attributes);
Window window3 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window3);
window3.getDecorView().setPadding(0, 0, 0, 0);
Window window4 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window4);
window4.getDecorView().setBackgroundColor(0);
}
public static final void showPrivacyOutDialog$lambda$8$lambda$6(Ref.ObjectRef dialog, Function1 listener, View view) {
Intrinsics.checkNotNullParameter(dialog, "$dialog");
Intrinsics.checkNotNullParameter(listener, "$listener");
((b) dialog.element).dismiss();
listener.invoke("cancel");
}
public static final void showPrivacyOutDialog$lambda$8$lambda$7(Ref.ObjectRef dialog, View view) {
Intrinsics.checkNotNullParameter(dialog, "$dialog");
((b) dialog.element).dismiss();
}
public static final void showServiceGuideDialog(@NotNull final Activity activity, @NotNull final Function1<? super Boolean, Unit> listener) {
Intrinsics.checkNotNullParameter(activity, "<this>");
Intrinsics.checkNotNullParameter(listener, "listener");
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
?? a10 = new b.a(activity).a();
Intrinsics.checkNotNullExpressionValue(a10, "Builder(this).create()");
objectRef.element = a10;
final a1 a1Var = (a1) d.e(LayoutInflater.from(activity), e.B, null, false);
if (a1Var != null) {
a1Var.C.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showServiceGuideDialog$lambda$2$lambda$0(Ref.ObjectRef.this, listener, view);
}
});
a1Var.A.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showServiceGuideDialog$lambda$2$lambda$1(Ref.ObjectRef.this, listener, view);
}
});
new CountDownTimer() {
{
super(CoroutineLiveDataKt.DEFAULT_TIMEOUT, 1000L);
}
@Override
public void onFinish() {
if (activity.isFinishing()) {
return;
}
a1.this.D.setVisibility(8);
a1.this.A.setVisibility(0);
}
@Override
public void onTick(long j10) {
a1.this.D.setText(String.valueOf(j10 / AidConstants.EVENT_REQUEST_STARTED));
}
}.start();
}
((b) objectRef.element).g(a1Var.w());
((b) objectRef.element).setCancelable(false);
((b) objectRef.element).show();
Window window = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window);
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.gravity = 17;
ScreenUtils.Companion companion = ScreenUtils.Companion;
attributes.width = (int) (companion.getScreenWidth(activity) * 0.79d);
attributes.height = -2;
Window window2 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window2);
window2.setAttributes(attributes);
Window window3 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window3);
window3.getDecorView().setPadding(0, 0, 0, companion.dip2px(36.0f));
Window window4 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window4);
window4.getDecorView().setBackgroundColor(0);
}
public static final void showServiceGuideDialog$lambda$2$lambda$0(Ref.ObjectRef dialog, Function1 listener, View view) {
Intrinsics.checkNotNullParameter(dialog, "$dialog");
Intrinsics.checkNotNullParameter(listener, "$listener");
((b) dialog.element).dismiss();
listener.invoke(Boolean.TRUE);
}
public static final void showServiceGuideDialog$lambda$2$lambda$1(Ref.ObjectRef dialog, Function1 listener, View view) {
Intrinsics.checkNotNullParameter(dialog, "$dialog");
Intrinsics.checkNotNullParameter(listener, "$listener");
((b) dialog.element).dismiss();
listener.invoke(Boolean.FALSE);
}
public static final void showUpgradeDialog(@NotNull final Activity activity, @NotNull final UpgradeBean upgradeBean) {
Intrinsics.checkNotNullParameter(activity, "<this>");
Intrinsics.checkNotNullParameter(upgradeBean, "upgradeBean");
final Ref.BooleanRef booleanRef = new Ref.BooleanRef();
AlertDialog create = new AlertDialog.Builder(activity).create();
final w3 w3Var = (w3) d.e(LayoutInflater.from(activity), e.f19109p0, null, false);
if (w3Var != null) {
w3Var.F.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showUpgradeDialog$lambda$14$lambda$12(activity, upgradeBean, view);
}
});
w3Var.C.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showUpgradeDialog$lambda$14$lambda$13(Ref.BooleanRef.this, activity, w3Var, upgradeBean, view);
}
});
create.setView(w3Var.w());
create.setCancelable(false);
create.show();
Window window = create.getWindow();
Intrinsics.checkNotNull(window);
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.gravity = 17;
ScreenUtils.Companion companion = ScreenUtils.Companion;
attributes.width = (int) (companion.getScreenWidth(activity) * 0.73d);
attributes.height = -2;
Window window2 = create.getWindow();
Intrinsics.checkNotNull(window2);
window2.setAttributes(attributes);
Window window3 = create.getWindow();
Intrinsics.checkNotNull(window3);
window3.getDecorView().setPadding(0, 0, 0, companion.dip2px(36.0f));
Window window4 = create.getWindow();
Intrinsics.checkNotNull(window4);
window4.getDecorView().setBackgroundColor(0);
}
}
public static final void showUpgradeDialog$lambda$14$lambda$12(Activity this_showUpgradeDialog, UpgradeBean upgradeBean, View view) {
Intrinsics.checkNotNullParameter(this_showUpgradeDialog, "$this_showUpgradeDialog");
Intrinsics.checkNotNullParameter(upgradeBean, "$upgradeBean");
this_showUpgradeDialog.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(upgradeBean.getUrl())));
}
public static final void showUpgradeDialog$lambda$14$lambda$13(final Ref.BooleanRef isDownload, final Activity this_showUpgradeDialog, final w3 this_apply, final UpgradeBean upgradeBean, View view) {
Intrinsics.checkNotNullParameter(isDownload, "$isDownload");
Intrinsics.checkNotNullParameter(this_showUpgradeDialog, "$this_showUpgradeDialog");
Intrinsics.checkNotNullParameter(this_apply, "$this_apply");
Intrinsics.checkNotNullParameter(upgradeBean, "$upgradeBean");
if (isDownload.element) {
return;
}
f0.e(this_showUpgradeDialog).c("android.permission.MANAGE_EXTERNAL_STORAGE").d(new g() {
@Override
public void onDenied(@NotNull List<String> permissions, boolean z10) {
Intrinsics.checkNotNullParameter(permissions, "permissions");
if (z10) {
Toast.makeText(this_showUpgradeDialog, "权限获取失败,功能无法使用", 0).show();
}
}
@Override
public void onGranted(@NotNull List<String> permissions, boolean z10) {
Intrinsics.checkNotNullParameter(permissions, "permissions");
if (z10) {
File file = new File(a8.a.a().c());
Log.e("showUpgradeDialog", "showUpgradeDialog: " + file.getAbsolutePath());
w3.this.C.setText("下载中...");
w3.this.B.setVisibility(0);
w3.this.D.setVisibility(8);
isDownload.element = true;
com.ncc.ai.utils.loadvideo.a h10 = com.ncc.ai.utils.loadvideo.a.h();
String url = upgradeBean.getUrl();
String absolutePath = file.getAbsolutePath();
final w3 w3Var = w3.this;
final Activity activity = this_showUpgradeDialog;
h10.b(url, absolutePath, true, new a8.b() {
public void error(@Nullable Exception exc) {
w3.this.C.setText("下载失败,请稍后重试");
}
@Override
public void onDownLoadFilePath(@Nullable String str) {
Activity activity2 = activity;
if (str == null) {
str = "";
}
MyUtilsKt.installApp(activity2, str);
}
@Override
public void onFileDownStatus(int i10, @Nullable Object obj, int i11, long j10, long j11) {
if (i10 == 0 && w3.this.B.getProgress() + 3 < i11) {
w3.this.B.setProgress(i11);
} else if (1 == i10) {
w3.this.B.setProgress(100);
}
}
});
}
}
});
}
public static final void showVipGuideDialog(@NotNull final i1.d dVar, @NotNull final Function1<? super Boolean, Unit> listener) {
Intrinsics.checkNotNullParameter(dVar, "<this>");
Intrinsics.checkNotNullParameter(listener, "listener");
if (MyUtilsKt.isCdkChannel()) {
WxDialog wxDialog = new WxDialog(dVar);
FragmentManager supportFragmentManager = dVar.getSupportFragmentManager();
Intrinsics.checkNotNullExpressionValue(supportFragmentManager, "this.supportFragmentManager");
wxDialog.show(supportFragmentManager);
return;
}
MyUtilsKt.sendTalkingDataEvent("Paid_pop-up_display");
MMKVUtils mMKVUtils = MMKVUtils.INSTANCE;
if (!mMKVUtils.decodeBoolean(Constants.MMKV_VIP_PAGE) && !MyUtilsKt.isBDSearch()) {
mMKVUtils.encode(Constants.MMKV_VIP_PAGE, Boolean.TRUE);
MountainServiceKt.sendVolcanoEvent$default("user_register", mMKVUtils.decodeString(Constants.MMKV_USER_ID), 0, 4, null);
}
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
?? a10 = new b.a(dVar, h.f19125a).a();
Intrinsics.checkNotNullExpressionValue(a10, "Builder(this, R.style.DialogTheme).create()");
objectRef.element = a10;
e1 e1Var = (e1) d.e(LayoutInflater.from(dVar), e.D, null, false);
if (e1Var != null) {
e1Var.A.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showVipGuideDialog$lambda$11$lambda$9(Ref.ObjectRef.this, view);
}
});
e1Var.B.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MyCustomDialogKt.showVipGuideDialog$lambda$11$lambda$10(Ref.ObjectRef.this, dVar, listener, view);
}
});
}
((b) objectRef.element).g(e1Var.w());
((b) objectRef.element).setCancelable(false);
((b) objectRef.element).show();
Window window = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window);
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.gravity = 17;
attributes.width = (int) (ScreenUtils.Companion.getScreenWidth(dVar) * 0.82d);
attributes.height = -2;
Window window2 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window2);
window2.setAttributes(attributes);
Window window3 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window3);
window3.getDecorView().setPadding(0, 0, 0, 0);
Window window4 = ((b) objectRef.element).getWindow();
Intrinsics.checkNotNull(window4);
window4.getDecorView().setBackgroundColor(0);
}
public static final void showVipGuideDialog$lambda$11$lambda$10(Ref.ObjectRef dialog, i1.d this_showVipGuideDialog, Function1 listener, View view) {
Intrinsics.checkNotNullParameter(dialog, "$dialog");
Intrinsics.checkNotNullParameter(this_showVipGuideDialog, "$this_showVipGuideDialog");
Intrinsics.checkNotNullParameter(listener, "$listener");
((b) dialog.element).dismiss();
if (Intrinsics.areEqual(AppUtilsKt.getChannel(), "xlj")) {
CdkDialog cdkDialog = new CdkDialog(this_showVipGuideDialog);
FragmentManager supportFragmentManager = this_showVipGuideDialog.getSupportFragmentManager();
Intrinsics.checkNotNullExpressionValue(supportFragmentManager, "this@showVipGuideDialog.supportFragmentManager");
cdkDialog.show(supportFragmentManager);
return;
}
MyUtilsKt.sendTalkingDataEvent("Paid_pop-up_window_click");
listener.invoke(Boolean.TRUE);
}
public static final void showVipGuideDialog$lambda$11$lambda$9(Ref.ObjectRef dialog, View view) {
Intrinsics.checkNotNullParameter(dialog, "$dialog");
((b) dialog.element).dismiss();
}
}