导航菜单

页面标题

页面副标题

Mabilis Cash v1.19.4 - PHSettingActivity.java 源代码

正在查看: Mabilis Cash v1.19.4 应用的 PHSettingActivity.java JAVA 源代码文件

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


package com.loans.mabiliscash.setting;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDialog;
import com.fintopia.libCommon.common.CommonActivity;
import com.fintopia.libCommon.common.CommonResult;
import com.fintopia.libCommon.widgets.dialog.CancelClickListener;
import com.fintopia.libCommon.widgets.dialog.ConfirmClickListener;
import com.lingyue.supertoolkit.statistics.TrackingUtil;
import com.lingyue.supertoolkit.tools.customtools.Logger;
import com.lingyue.supertoolkit.widgets.ToastCompat;
import com.loans.mabiliscash.R;
import com.loans.mabiliscash.common.BindClickCall;
import com.loans.mabiliscash.common.PHViewBindingActivity;
import com.loans.mabiliscash.databinding.ActivitySettingBinding;
import com.loans.mabiliscash.models.DelAccountApplyBody;
import com.loans.mabiliscash.models.DelAccountCanApplyBody;
import com.loans.mabiliscash.models.DelAccountStatus;
import com.loans.mabiliscash.models.TrackingEvents;
import com.loans.mabiliscash.models.event.EventLoginOrRegisterEnd;
import com.loans.mabiliscash.models.response.DelAccountApplyStatusResponse;
import com.loans.mabiliscash.models.response.DelAccountCanApplyResponse;
import com.loans.mabiliscash.models.response.PHBooleanResponse;
import com.loans.mabiliscash.models.response.UserResponse;
import com.loans.mabiliscash.modifyphone.PHCurrentPhoneNumberVerifyActivity;
import com.loans.mabiliscash.net.ECObserver;
import com.loans.mabiliscash.widght.PHCommonDialog;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

public class PHSettingActivity extends PHViewBindingActivity<ActivitySettingBinding> {
    private DelAccountApplyBody p;

    public void A0(DelAccountApplyStatusResponse delAccountApplyStatusResponse) {
        DelAccountApplyBody delAccountApplyBody = delAccountApplyStatusResponse.body;
        if (delAccountApplyBody == null) {
            return;
        }
        this.p = delAccountApplyBody;
        if (DelAccountStatus.PROCESSING == delAccountApplyBody.applyStatus) {
            ((ActivitySettingBinding) this.o).e.setVisibility(8);
            ((ActivitySettingBinding) this.o).f.setVisibility(0);
        } else {
            ((ActivitySettingBinding) this.o).e.setVisibility(0);
            ((ActivitySettingBinding) this.o).f.setVisibility(8);
        }
    }

    private void B0() {
        showLoadingDialog();
        this.apiHelper.a().k().a(new ECObserver<PHBooleanResponse>(this) {
            @Override
            public void c(PHBooleanResponse pHBooleanResponse) {
                PHSettingActivity.this.dismissLoadingDialog();
                if (pHBooleanResponse.body) {
                    CommonActivity commonActivity = PHSettingActivity.this;
                    ToastCompat.g(commonActivity, commonActivity.getResources().getString(R.string.cancel_successfully));
                    PHSettingActivity.this.K0();
                }
            }
        });
    }

    private void C0() {
        this.apiHelper.a().n0().a(new ECObserver<PHBooleanResponse>(this) {
            @Override
            public void e(Throwable th, PHBooleanResponse pHBooleanResponse) {
                super.e(th, pHBooleanResponse);
                PHSettingActivity.this.Q();
            }

            @Override
            public void c(PHBooleanResponse pHBooleanResponse) {
                PHSettingActivity.this.dismissLoadingDialog();
                ((ActivitySettingBinding) ((PHViewBindingActivity) PHSettingActivity.this).o).c.setVisibility(pHBooleanResponse.body ? 0 : 8);
                if (pHBooleanResponse.body) {
                    TrackingUtil.i(PHSettingActivity.this, TrackingEvents.PH_SETTING_PAGE_SHOW_MODIFY_MOBILE);
                }
                PHSettingActivity.this.Q();
            }
        });
    }

    private void D0() {
        showLoadingDialog();
        this.apiHelper.a().x().a(new ECObserver<DelAccountCanApplyResponse>(this) {
            @Override
            public void c(DelAccountCanApplyResponse delAccountCanApplyResponse) {
                PHSettingActivity.this.dismissLoadingDialog();
                DelAccountCanApplyBody delAccountCanApplyBody = delAccountCanApplyResponse.body;
                if (delAccountCanApplyBody.status) {
                    PHSettingActivity.this.r0();
                } else {
                    PHSettingActivity.this.I0(delAccountCanApplyBody.note);
                }
            }
        });
    }

    private void E0() {
        this.apiHelper.a().T().a(new ECObserver<PHBooleanResponse>(this) {
            @Override
            public void e(Throwable th, PHBooleanResponse pHBooleanResponse) {
                super.e(th, pHBooleanResponse);
            }

            @Override
            public void c(PHBooleanResponse pHBooleanResponse) {
                PHSettingActivity.this.dismissLoadingDialog();
                PHCurrentPhoneNumberVerifyActivity.start(PHSettingActivity.this);
            }
        });
    }

    private void F0() {
        this.apiHelper.a().p().a(new ECObserver<DelAccountApplyStatusResponse>(this) {
            @Override
            public void e(Throwable th, DelAccountApplyStatusResponse delAccountApplyStatusResponse) {
                super.e(th, delAccountApplyStatusResponse);
                PHSettingActivity.this.Q();
            }

            @Override
            public void c(DelAccountApplyStatusResponse delAccountApplyStatusResponse) {
                PHSettingActivity.this.dismissLoadingDialog();
                PHSettingActivity.this.A0(delAccountApplyStatusResponse);
                PHSettingActivity.this.Q();
            }
        });
    }

    private void G0() {
        this.apiHelper.a().logout().a(new ECObserver<CommonResult>(this) {
            @Override
            protected boolean d() {
                return false;
            }

            @Override
            public void c(CommonResult commonResult) {
            }
        });
    }

    private void H0() {
        new PHCommonDialog.Builder(this).j(R.string.always_finish_activities_dialog_content).f(R.string.settings).b(R.string.cancel).k(TrackingEvents.ALWAYS_FINISH_ACTIVITIES_CLOSE_DIALOG).g(new ConfirmClickListener() {
            public final void a(AppCompatDialog appCompatDialog) {
                PHSettingActivity.this.x0(appCompatDialog);
            }
        }).a().show();
    }

    public void I0(String str) {
        new PHCommonDialog.Builder(this).l(R.string.tips).i(str).f(R.string.ok).k(TrackingEvents.PH_DEL_ACCOUNT_NOT_APPLIED_DIALOG).g(new ConfirmClickListener() {
            public final void a(AppCompatDialog appCompatDialog) {
                appCompatDialog.dismiss();
            }
        }).a().show();
    }

    private void J0(DelAccountApplyBody delAccountApplyBody) {
        new PHCommonDialog.Builder(this).i(delAccountApplyBody.note).f(R.string.cancel_deletion).b(R.string.close).k(TrackingEvents.PH_DEL_ACCOUNT_PROCESSING_DIALOG).g(new ConfirmClickListener() {
            public final void a(AppCompatDialog appCompatDialog) {
                PHSettingActivity.this.z0(appCompatDialog);
            }
        }).a().show();
    }

    public void K0() {
        showLoadingDialog();
        C0();
        F0();
    }

    private void o0() {
        if (q0()) {
            H0();
        }
    }

    private void p0() {
        new PHCommonDialog.Builder(this).j(R.string.confirm_logout).f(R.string.no).b(R.string.yes).c(new CancelClickListener() {
            public final void a(AppCompatDialog appCompatDialog) {
                PHSettingActivity.this.t0(appCompatDialog);
            }
        }).k(TrackingEvents.PH_SETTING_LOG_OUT_CONFIRM_DIALOG).a().show();
    }

    private boolean q0() {
        return Settings.Global.getInt(getContentResolver(), TrackingEvents.ALWAYS_FINISH_ACTIVITIES, 0) == 1;
    }

    public void r0() {
        jumpToWebPage(this.appGlobal.a.a().toString() + "webview/unsubscribe?mobileNumber=" + this.userSession.c().mobileNumber);
    }

    public void s0() {
        dismissLoadingDialog();
        logout(-1);
    }

    public static void start(Context context) {
        context.startActivity(new Intent(context, (Class<?>) PHSettingActivity.class));
    }

    public void t0(AppCompatDialog appCompatDialog) {
        TrackingUtil.j(this, TrackingEvents.PH_SETTING_LOG_OUT_CONFIRM, "");
        G0();
        showLoadingDialog();
        appCompatDialog.dismiss();
        getWindow().getDecorView().postDelayed(new Runnable() {
            @Override
            public final void run() {
                PHSettingActivity.this.s0();
            }
        }, 500L);
    }

    public void u0(View view) {
        TrackingUtil.i(this, TrackingEvents.PH_SETTING_PAGE_CLICK_LOGOUT);
        if (p()) {
            p0();
        }
    }

    public void v0(View view) {
        if (this.p == null) {
            F0();
            return;
        }
        TrackingUtil.i(this, TrackingEvents.PH_SETTING_PAGE_CLICK_DEL_ACCOUNT);
        DelAccountStatus delAccountStatus = DelAccountStatus.PROCESSING;
        DelAccountApplyBody delAccountApplyBody = this.p;
        if (delAccountStatus == delAccountApplyBody.applyStatus) {
            J0(delAccountApplyBody);
        } else {
            D0();
        }
    }

    public void w0(View view) {
        if (p()) {
            TrackingUtil.i(this, TrackingEvents.PH_SETTING_PAGE_CLICK_MODIFY_MOBILE);
            E0();
        }
    }

    public void x0(AppCompatDialog appCompatDialog) {
        try {
            startActivity(new Intent("android.settings.APPLICATION_DEVELOPMENT_SETTINGS"));
        } catch (Exception e) {
            Logger.c().b(e.fillInStackTrace().toString());
        }
    }

    public void z0(AppCompatDialog appCompatDialog) {
        B0();
        appCompatDialog.dismiss();
    }

    @Override
    protected void O(UserResponse userResponse) {
        super.O(userResponse);
        K0();
    }

    @Override
    protected void k(@NonNull Bundle bundle) {
        super.k(bundle);
        this.p = (DelAccountApplyBody) bundle.getSerializable("del_account_apply_status_body");
    }

    @Override
    public ActivitySettingBinding bindingInflater() {
        return ActivitySettingBinding.c(getLayoutInflater());
    }

    protected void o() {
        super.o();
        ((ActivitySettingBinding) this.o).d.setVisibility(p() ? 0 : 8);
        V(((ActivitySettingBinding) this.o).d, new BindClickCall() {
            @Override
            public final void onClick(View view) {
                PHSettingActivity.this.u0(view);
            }
        });
        V(((ActivitySettingBinding) this.o).b, new BindClickCall() {
            @Override
            public final void onClick(View view) {
                PHSettingActivity.this.v0(view);
            }
        });
        V(((ActivitySettingBinding) this.o).c, new BindClickCall() {
            @Override
            public final void onClick(View view) {
                PHSettingActivity.this.w0(view);
            }
        });
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        EventBus.c().o(this);
        o0();
        TrackingUtil.i(this, TrackingEvents.PH_SETTING_PAGE_OPEN);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.c().q(this);
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEventRegisterSuccess(EventLoginOrRegisterEnd eventLoginOrRegisterEnd) {
        finish();
    }

    protected void onResume() {
        super.onResume();
        if (!p() || TextUtils.isEmpty(this.userSession.c().mobileNumber)) {
            sendFetchUserInfoRequest();
        } else {
            K0();
        }
    }

    protected void s(@NonNull Bundle bundle) {
        super.s(bundle);
        bundle.putSerializable("del_account_apply_status_body", this.p);
    }
}