导航菜单

页面标题

页面副标题

星辰VPN v1.2.3 - SettingActivity.java 源代码

正在查看: 星辰VPN v1.2.3 应用的 SettingActivity.java JAVA 源代码文件

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


package com.moetor.ui.mine;

import android.view.View;
import android.widget.CompoundButton;
import com.lihang.ShadowLayout;
import com.moetor.R$id;
import com.moetor.R$layout;
import com.moetor.R$mipmap;
import com.moetor.app.ENV;
import com.moetor.app.ExtKt;
import com.moetor.base.BaseActivity;
import com.moetor.helper.ConfigHelper;
import com.moetor.mvp.contract.SettingContract;
import com.moetor.mvp.presenter.SettingPresenter;
import com.moetor.mvp.request.ChangePwdRequest;
import com.moetor.mvp.request.UserUpdateRequest;
import com.moetor.mvp.response.ControlBean;
import com.moetor.mvp.response.VersionBean;
import com.moetor.utils.DateUtils;
import com.moetor.view.MyImageButton;
import com.moetor.view.MyTextView;
import com.moetor.view.TipsDialog;
import constant.UiType;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function3;
import model.UiConfig;
import model.UpdateConfig;
import update.UpdateAppUtils;

@Metadata(d1 = {"\u0000`\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0002\b\u000f\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u00032\u00020\u00042\u00020\u0005B\u0005¢\u0006\u0002\u0010\u0006J\b\u0010\u0017\u001a\u00020\u0002H\u0014J\b\u0010\u0018\u001a\u00020\nH\u0014J\b\u0010\u0019\u001a\u00020\u001aH\u0014J\b\u0010\u001b\u001a\u00020\u001aH\u0014J\u0018\u0010\u001c\u001a\u00020\u001a2\u0006\u0010\u001d\u001a\u00020\u001e2\u0006\u0010\u001f\u001a\u00020 H\u0016J\u0010\u0010!\u001a\u00020\u001a2\u0006\u0010\"\u001a\u00020#H\u0016J\u001a\u0010$\u001a\u00020\u001a2\b\u0010%\u001a\u0004\u0018\u00010&2\u0006\u0010'\u001a\u00020\u001eH\u0016J\u0012\u0010(\u001a\u00020\u001a2\b\u0010)\u001a\u0004\u0018\u00010*H\u0016J\"\u0010+\u001a\u00020\u001a2\u0006\u0010\u001d\u001a\u00020\u001e2\b\u0010,\u001a\u0004\u0018\u00010&2\u0006\u0010'\u001a\u00020\u001eH\u0016J\"\u0010-\u001a\u00020\u001a2\u0006\u0010\"\u001a\u00020#2\b\u0010,\u001a\u0004\u0018\u00010&2\u0006\u0010'\u001a\u00020\u001eH\u0016J\u0010\u0010.\u001a\u00020\u001a2\u0006\u0010/\u001a\u000200H\u0016J\u0010\u00101\u001a\u00020\u001a2\u0006\u0010\"\u001a\u00020#H\u0016R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010\t\u001a\u00020\n8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\r\u0010\u000e\u001a\u0004\b\u000b\u0010\fR\u001b\u0010\u000f\u001a\u00020\n8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0011\u0010\u000e\u001a\u0004\b\u0010\u0010\fR\u000e\u0010\u0012\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010\u0013\u001a\u00020\b8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0016\u0010\u000e\u001a\u0004\b\u0014\u0010\u0015¨\u00062"}, d2 = {"Lcom/moetor/ui/mine/SettingActivity;", "Lcom/moetor/base/BaseActivity;", "Lcom/moetor/mvp/presenter/SettingPresenter;", "Lcom/moetor/mvp/contract/SettingContract$View;", "Landroid/view/View$OnClickListener;", "Landroid/widget/CompoundButton$OnCheckedChangeListener;", "()V", "mPrivacyLink", "", "mRemindExpire", "", "getMRemindExpire", "()I", "mRemindExpire$delegate", "Lkotlin/Lazy;", "mRemindTraffic", "getMRemindTraffic", "mRemindTraffic$delegate", "mServiceLink", "mTgGroup", "getMTgGroup", "()Ljava/lang/String;", "mTgGroup$delegate", "createPresenter", "initLayoutId", "initStatusBar", "", "initView", "onChangePwd", "success", "", "dialog", "Lcom/moetor/ui/mine/ChangePwdDialog;", "onChangePwdError", "e", "Lcom/moetor/net/ApiException$RespException;", "onCheckedChanged", "buttonView", "Landroid/widget/CompoundButton;", "isChecked", "onClick", "v", "Landroid/view/View;", "onUserUpdate", "cb", "onUserUpdateError", "onVersion", "bean", "Lcom/moetor/mvp/response/VersionBean;", "onVersionError", "app_maomaoRelease"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final class SettingActivity extends BaseActivity<SettingPresenter> implements SettingContract.View, View.OnClickListener, CompoundButton.OnCheckedChangeListener {
    public Map<Integer, View> _$_findViewCache = new LinkedHashMap();

    private final Lazy mRemindExpire = LazyKt.lazy(new Function0<Integer>() {
        {
            super(0);
        }

        @Override
        public final Integer invoke() {
            return Integer.valueOf(SettingActivity.this.getIntent().getIntExtra("remind_expire", 0));
        }
    });

    private final Lazy mRemindTraffic = LazyKt.lazy(new Function0<Integer>() {
        {
            super(0);
        }

        @Override
        public final Integer invoke() {
            return Integer.valueOf(SettingActivity.this.getIntent().getIntExtra("remind_traffic", 0));
        }
    });

    private final Lazy mTgGroup = LazyKt.lazy(new Function0<String>() {
        {
            super(0);
        }

        @Override
        public final String invoke() {
            String stringExtra = SettingActivity.this.getIntent().getStringExtra("tg_group");
            return stringExtra == null ? "" : stringExtra;
        }
    });
    private String mServiceLink = "";
    private String mPrivacyLink = "";

    private final int getMRemindExpire() {
        return ((Number) this.mRemindExpire.getValue()).intValue();
    }

    private final int getMRemindTraffic() {
        return ((Number) this.mRemindTraffic.getValue()).intValue();
    }

    private final String getMTgGroup() {
        return (String) this.mTgGroup.getValue();
    }

    public static final boolean m53initView$lambda2(SettingActivity this$0, View view) {
        kotlin.jvm.internal.b.i(this$0, "this$0");
        StringBuilder sb = new StringBuilder();
        sb.append("包名:com.moetor.freenetmt\n");
        sb.append("授权类型:永久版\n");
        StringBuilder n = android.support.v4.media.b.n("授权域名:");
        n.append(ConfigHelper.INSTANCE.getInstance().getBaseUrl());
        n.append('\n');
        sb.append(n.toString());
        sb.append("配置地址:https://m.goudan.site/mt.json");
        final String sb2 = sb.toString();
        kotlin.jvm.internal.b.h(sb2, "StringBuilder().run {\n  …\n            }.toString()");
        new TipsDialog(this$0).show(new Function1<TipsDialog, Unit>() {
            {
                super(1);
            }

            @Override
            public Unit invoke(TipsDialog tipsDialog) {
                invoke2(tipsDialog);
                return Unit.INSTANCE;
            }

            public final void invoke2(TipsDialog show) {
                kotlin.jvm.internal.b.i(show, "$this$show");
                show.title("授权信息");
                show.content(sb2);
                show.hidePositive();
                TipsDialog.negative$default(show, "好的", false, null, 6, null);
                int i = R$id.tv_content;
                ((MyTextView) show.findViewById(i)).setGravity(8388611);
                ((MyTextView) show.findViewById(i)).setTextIsSelectable(true);
            }
        });
        return true;
    }

    @Override
    public void _$_clearFindViewByIdCache() {
        this._$_findViewCache.clear();
    }

    @Override
    public View _$_findCachedViewById(int i) {
        Map<Integer, View> map = this._$_findViewCache;
        View view = map.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        if (findViewById == null) {
            return null;
        }
        map.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    @Override
    public int initLayoutId() {
        return R$layout.activity_setting;
    }

    @Override
    public void initStatusBar() {
        super.initStatusBar();
        com.gyf.immersionbar.g.A(this, new View[]{_$_findCachedViewById(R$id.status_bar_view)});
    }

    @Override
    public void initView() {
        throw new UnsupportedOperationException("Method not decompiled: com.moetor.ui.mine.SettingActivity.initView():void");
    }

    @Override
    public void onChangePwd(boolean success, ChangePwdDialog dialog) {
        kotlin.jvm.internal.b.i(dialog, "dialog");
        if (!success) {
            ExtKt.toastError("修改失败,请重试");
        } else {
            ExtKt.toastSuccess("修改成功");
            dialog.dismiss();
        }
    }

    @Override
    public void onChangePwdError(com.moetor.net.ApiException.RespException r4) {
        throw new UnsupportedOperationException("Method not decompiled: com.moetor.ui.mine.SettingActivity.onChangePwdError(com.moetor.net.ApiException$RespException):void");
    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        SettingPresenter mPresenter;
        if (kotlin.jvm.internal.b.d(buttonView, _$_findCachedViewById(R$id.switch_expired))) {
            SettingPresenter mPresenter2 = getMPresenter();
            if (mPresenter2 != null) {
                UserUpdateRequest userUpdateRequest = new UserUpdateRequest();
                userUpdateRequest.setRemind_expire(isChecked ? 1 : 0);
                mPresenter2.userUpdate(userUpdateRequest, buttonView, getMRemindExpire() == 1);
                return;
            }
            return;
        }
        if (!kotlin.jvm.internal.b.d(buttonView, _$_findCachedViewById(R$id.switch_traffic)) || (mPresenter = getMPresenter()) == null) {
            return;
        }
        UserUpdateRequest userUpdateRequest2 = new UserUpdateRequest();
        userUpdateRequest2.setRemind_traffic(isChecked ? 1 : 0);
        mPresenter.userUpdate(userUpdateRequest2, buttonView, getMRemindTraffic() == 1);
    }

    @Override
    public void onClick(View v) {
        if (kotlin.jvm.internal.b.d(v, (MyImageButton) _$_findCachedViewById(R$id.ib_back))) {
            onBackPressed();
            return;
        }
        if (kotlin.jvm.internal.b.d(v, (MyTextView) _$_findCachedViewById(R$id.tv_change_pwd))) {
            new ChangePwdDialog(this).show(new Function1<ChangePwdDialog, Unit>() {
                {
                    super(1);
                }

                @Override
                public Unit invoke(ChangePwdDialog changePwdDialog) {
                    invoke2(changePwdDialog);
                    return Unit.INSTANCE;
                }

                public final void invoke2(ChangePwdDialog show) {
                    kotlin.jvm.internal.b.i(show, "$this$show");
                    final SettingActivity settingActivity = SettingActivity.this;
                    show.positive(new Function3<ChangePwdDialog, String, String, Unit>() {
                        {
                            super(3);
                        }

                        @Override
                        public Unit invoke(ChangePwdDialog changePwdDialog, String str, String str2) {
                            invoke2(changePwdDialog, str, str2);
                            return Unit.INSTANCE;
                        }

                        public final void invoke2(ChangePwdDialog dialog, String old, String str) {
                            SettingPresenter mPresenter;
                            kotlin.jvm.internal.b.i(dialog, "dialog");
                            kotlin.jvm.internal.b.i(old, "old");
                            kotlin.jvm.internal.b.i(str, "new");
                            if (old.length() < 8) {
                                ExtKt.toastError("旧密码位数不正确");
                                return;
                            }
                            if (str.length() < 8) {
                                ExtKt.toastError("新密码至少8位字符");
                                return;
                            }
                            mPresenter = SettingActivity.this.getMPresenter();
                            if (mPresenter != null) {
                                ChangePwdRequest changePwdRequest = new ChangePwdRequest();
                                changePwdRequest.setOld_password(old);
                                changePwdRequest.setNew_password(str);
                                mPresenter.changePwd(changePwdRequest, dialog);
                            }
                        }
                    });
                }
            });
            return;
        }
        if (kotlin.jvm.internal.b.d(v, _$_findCachedViewById(R$id.ll_version))) {
            SettingPresenter settingPresenter = (SettingPresenter) getMPresenter();
            if (settingPresenter != null) {
                settingPresenter.version();
                return;
            }
            return;
        }
        if (kotlin.jvm.internal.b.d(v, (ShadowLayout) _$_findCachedViewById(R$id.sl_tg_group))) {
            String mTgGroup = getMTgGroup();
            kotlin.jvm.internal.b.h(mTgGroup, "mTgGroup");
            ExtKt.openBrowserUrl(this, mTgGroup);
        } else if (kotlin.jvm.internal.b.d(v, (MyTextView) _$_findCachedViewById(R$id.tv_agreement_service))) {
            ExtKt.openBrowserUrl(this, this.mServiceLink);
        } else if (kotlin.jvm.internal.b.d(v, (MyTextView) _$_findCachedViewById(R$id.tv_agreement_privacy))) {
            ExtKt.openBrowserUrl(this, this.mPrivacyLink);
        }
    }

    @Override
    public void onUserUpdate(boolean success, CompoundButton cb, boolean isChecked) {
        if (success) {
            return;
        }
        ExtKt.toastError("操作失败,请重试");
        if (cb == null) {
            return;
        }
        cb.setChecked(isChecked);
    }

    @Override
    public void onUserUpdateError(com.moetor.net.ApiException.RespException r4, android.widget.CompoundButton r5, boolean r6) {
        throw new UnsupportedOperationException("Method not decompiled: com.moetor.ui.mine.SettingActivity.onUserUpdateError(com.moetor.net.ApiException$RespException, android.widget.CompoundButton, boolean):void");
    }

    @Override
    public void onVersion(final VersionBean bean) {
        Boolean versionUpdateForce;
        kotlin.jvm.internal.b.i(bean, "bean");
        if (!ExtKt.compareVersion(bean.getAndroid_version())) {
            ExtKt.toastSuccess("已是最新版本");
            return;
        }
        ConfigHelper.Companion companion = ConfigHelper.INSTANCE;
        ControlBean controlData = companion.getInstance().getControlData();
        if (controlData != null ? kotlin.jvm.internal.b.d(controlData.getVersionUpdateJump(), Boolean.TRUE) : false) {
            new TipsDialog(this).show(new Function1<TipsDialog, Unit>() {
                {
                    super(1);
                }

                @Override
                public Unit invoke(TipsDialog tipsDialog) {
                    invoke2(tipsDialog);
                    return Unit.INSTANCE;
                }

                public final void invoke2(TipsDialog show) {
                    Boolean versionUpdateForce2;
                    kotlin.jvm.internal.b.i(show, "$this$show");
                    show.title("发现新版本");
                    show.content("当前版本:1.2.3\n最新版本:" + VersionBean.this.getAndroid_version() + "\n是否跳转至下载页?");
                    ConfigHelper.Companion companion2 = ConfigHelper.INSTANCE;
                    ControlBean controlData2 = companion2.getInstance().getControlData();
                    boolean booleanValue = (controlData2 == null || (versionUpdateForce2 = controlData2.getVersionUpdateForce()) == null) ? true : versionUpdateForce2.booleanValue();
                    final SettingActivity settingActivity = this;
                    final VersionBean versionBean = VersionBean.this;
                    TipsDialog.positive$default(show, null, booleanValue, new Function1<TipsDialog, Unit>() {
                        {
                            super(1);
                        }

                        @Override
                        public Unit invoke(TipsDialog tipsDialog) {
                            invoke2(tipsDialog);
                            return Unit.INSTANCE;
                        }

                        public final void invoke2(TipsDialog it) {
                            kotlin.jvm.internal.b.i(it, "it");
                            ExtKt.openBrowserUrl(SettingActivity.this, versionBean.getAndroid_download_url());
                        }
                    }, 1, null);
                    ControlBean controlData3 = companion2.getInstance().getControlData();
                    if (controlData3 != null ? kotlin.jvm.internal.b.d(controlData3.getVersionUpdateForce(), Boolean.TRUE) : false) {
                        show.hideNegative();
                    }
                }
            });
            return;
        }
        UiConfig uiConfig = new UiConfig(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1048575, null);
        uiConfig.setUiType(UiType.PLENTIFUL);
        uiConfig.setTitleTextSize(Float.valueOf(18.0f));
        UpdateConfig updateConfig = new UpdateConfig(false, false, false, false, false, null, null, 0, false, false, 0, false, false, null, 0, 32767, null);
        updateConfig.setDebug(false);
        ControlBean controlData2 = companion.getInstance().getControlData();
        updateConfig.setForce((controlData2 == null || (versionUpdateForce = controlData2.getVersionUpdateForce()) == null) ? false : versionUpdateForce.booleanValue());
        updateConfig.setApkSavePath(ENV.APP.INSTANCE.getUPDATE_APK_CACHE_FOLDER());
        updateConfig.setApkSaveName(String.valueOf(DateUtils.INSTANCE.currentTimeMillis()));
        updateConfig.setShowNotification(false);
        updateConfig.setNotifyImgRes(R$mipmap.ic_launcher);
        updateConfig.setShowDownloadingToast(true);
        updateConfig.setAlwaysShowDownLoadDialog(true);
        UpdateAppUtils updateTitle = UpdateAppUtils.getInstance().apkUrl(bean.getAndroid_download_url()).updateTitle("发现新版本");
        StringBuilder n = android.support.v4.media.b.n("当前版本:1.2.3\n最新版本:");
        n.append(bean.getAndroid_version());
        updateTitle.updateContent(n.toString()).updateConfig(updateConfig).uiConfig(uiConfig).update();
    }

    @Override
    public void onVersionError(com.moetor.net.ApiException.RespException r4) {
        throw new UnsupportedOperationException("Method not decompiled: com.moetor.ui.mine.SettingActivity.onVersionError(com.moetor.net.ApiException$RespException):void");
    }

    @Override
    public SettingPresenter createPresenter() {
        return new SettingPresenter(this);
    }
}