导航菜单

页面标题

页面副标题

六分钟步行测试管理软件 v1.1.0.2112120029 - DownloadFailedActivity.java 源代码

正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 DownloadFailedActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.allenliu.versionchecklib.v2.ui;

import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import androidx.appcompat.app.AlertDialog;
import com.allenliu.versionchecklib.R;
import com.allenliu.versionchecklib.callback.CommitClickListener;
import com.allenliu.versionchecklib.utils.ALog;
import com.allenliu.versionchecklib.utils.AllenEventBusUtil;
import com.allenliu.versionchecklib.v2.AllenVersionChecker;
import com.allenliu.versionchecklib.v2.builder.BuilderManager;
import com.allenliu.versionchecklib.v2.builder.DownloadBuilder;
import com.allenliu.versionchecklib.v2.eventbus.CommonEvent;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

@Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u00002\u00020\u00012\u00020\u0002B\u0005¢\u0006\u0002\u0010\u0003J\u0010\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\tH\u0016J\u0012\u0010\n\u001a\u00020\u00072\b\u0010\u000b\u001a\u0004\u0018\u00010\fH\u0014J\b\u0010\r\u001a\u00020\u0007H\u0014J\b\u0010\u000e\u001a\u00020\u0007H\u0014J\b\u0010\u000f\u001a\u00020\u0007H\u0014J\u0014\u0010\u0010\u001a\u00020\u00072\n\u0010\u0011\u001a\u0006\u0012\u0002\b\u00030\u0012H\u0017J\b\u0010\u0013\u001a\u00020\u0007H\u0002J\b\u0010\u0014\u001a\u00020\u0007H\u0016J\b\u0010\u0015\u001a\u00020\u0007H\u0016J\b\u0010\u0016\u001a\u00020\u0007H\u0002R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0017"}, d2 = {"Lcom/allenliu/versionchecklib/v2/ui/DownloadFailedActivity;", "Lcom/allenliu/versionchecklib/v2/ui/AllenBaseActivity;", "Landroid/content/DialogInterface$OnCancelListener;", "()V", "downloadFailedDialog", "Landroid/app/Dialog;", "onCancel", "", "dialogInterface", "Landroid/content/DialogInterface;", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onPause", "onResume", "onStop", "receiveEvent", "commonEvent", "Lcom/allenliu/versionchecklib/v2/eventbus/CommonEvent;", "retryDownload", "showCustomDialog", "showDefaultDialog", "showDowloadFailedDialog", "library_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class DownloadFailedActivity extends AllenBaseActivity implements DialogInterface.OnCancelListener {
    private Dialog downloadFailedDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        showDowloadFailedDialog();
    }

    @Override
    public void showDefaultDialog() {
        AlertDialog create = new AlertDialog.Builder(this).setMessage(getString(R.string.versionchecklib_download_fail_retry)).setPositiveButton(getString(R.string.versionchecklib_confirm), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                DownloadFailedActivity.showDefaultDialog$lambda$0(DownloadFailedActivity.this, dialogInterface, i);
            }
        }).setNegativeButton(getString(R.string.versionchecklib_cancel), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                DownloadFailedActivity.showDefaultDialog$lambda$1(DownloadFailedActivity.this, dialogInterface, i);
            }
        }).create();
        create.setCanceledOnTouchOutside(false);
        create.setCancelable(true);
        create.show();
        this.downloadFailedDialog = create;
    }

    public static final void showDefaultDialog$lambda$0(DownloadFailedActivity downloadFailedActivity, DialogInterface dialogInterface, int i) {
        Intrinsics.checkNotNullParameter(downloadFailedActivity, "this$0");
        downloadFailedActivity.retryDownload();
    }

    public static final void showDefaultDialog$lambda$1(DownloadFailedActivity downloadFailedActivity, DialogInterface dialogInterface, int i) {
        Intrinsics.checkNotNullParameter(downloadFailedActivity, "this$0");
        Intrinsics.checkNotNullExpressionValue(dialogInterface, "d");
        downloadFailedActivity.onCancel(dialogInterface);
    }

    @Override
    public void showCustomDialog() {
        BuilderManager.doWhenNotNull$default(BuilderManager.INSTANCE, null, new DownloadFailedActivity$showCustomDialog$1(this), 1, null);
    }

    private final void showDowloadFailedDialog() {
        AllenEventBusUtil.sendEventBusStick(102);
        BuilderManager.doWhenNotNull$default(BuilderManager.INSTANCE, null, new Function1<DownloadBuilder, Unit>() {
            {
                super(1);
            }

            public final Unit invoke(DownloadBuilder downloadBuilder) {
                Dialog dialog;
                Intrinsics.checkNotNullParameter(downloadBuilder, "$this$doWhenNotNull");
                if (downloadBuilder.getCustomDownloadFailedListener() != null) {
                    ALog.e("show customization failed dialog");
                    DownloadFailedActivity.this.showCustomDialog();
                } else {
                    ALog.e("show default failed dialog");
                    DownloadFailedActivity.this.showDefaultDialog();
                }
                dialog = DownloadFailedActivity.this.downloadFailedDialog;
                if (dialog == null) {
                    return null;
                }
                dialog.setOnCancelListener(DownloadFailedActivity.this);
                return Unit.INSTANCE;
            }
        }, 1, null);
    }

    @Override
    public void onCancel(DialogInterface dialogInterface) {
        Intrinsics.checkNotNullParameter(dialogInterface, "dialogInterface");
        ALog.e("on cancel");
        cancelHandler();
        checkForceUpdate();
        AllenVersionChecker.getInstance().cancelAllMission();
        finish();
    }

    public final void retryDownload() {
        BuilderManager.doWhenNotNull$default(BuilderManager.INSTANCE, null, new Function1<DownloadBuilder, Unit>() {
            public final Unit invoke(DownloadBuilder downloadBuilder) {
                Intrinsics.checkNotNullParameter(downloadBuilder, "$this$doWhenNotNull");
                CommitClickListener downloadFailedCommitClickListener = downloadBuilder.getDownloadFailedCommitClickListener();
                if (downloadFailedCommitClickListener == null) {
                    return null;
                }
                downloadFailedCommitClickListener.onCommitClick();
                return Unit.INSTANCE;
            }
        }, 1, null);
        AllenEventBusUtil.sendEventBus(98);
    }

    @Override
    protected void onStop() {
        super.onStop();
        Dialog dialog = this.downloadFailedDialog;
        if (dialog != null) {
            Intrinsics.checkNotNull(dialog);
            if (dialog.isShowing()) {
                Dialog dialog2 = this.downloadFailedDialog;
                Intrinsics.checkNotNull(dialog2);
                dialog2.dismiss();
            }
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        Dialog dialog = this.downloadFailedDialog;
        if (dialog != null) {
            Intrinsics.checkNotNull(dialog);
            if (dialog.isShowing()) {
                return;
            }
            Dialog dialog2 = this.downloadFailedDialog;
            Intrinsics.checkNotNull(dialog2);
            dialog2.show();
        }
    }

    @Override
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void receiveEvent(CommonEvent<?> commonEvent) {
        Intrinsics.checkNotNullParameter(commonEvent, "commonEvent");
        super.receiveEvent(commonEvent);
        if (commonEvent.getEventType() == 98) {
            finish();
        }
    }
}