导航菜单

页面标题

页面副标题

Easycash v3.75.13 - DeleteAccountActivity.java 源代码

正在查看: Easycash v3.75.13 应用的 DeleteAccountActivity.java JAVA 源代码文件

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


package com.lingyue.easycash.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.InputFilter;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.method.DigitsKeyListener;
import android.view.KeyEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.lingyue.easycash.R;
import com.lingyue.easycash.account.model.UserResponse;
import com.lingyue.easycash.activity.EasyCashMainActivity;
import com.lingyue.easycash.commom.EasyCashCommonActivity;
import com.lingyue.easycash.models.MobileVerificationPurpose;
import com.lingyue.easycash.models.UserGlobal;
import com.lingyue.easycash.net.EasyCashResponseCode;
import com.lingyue.easycash.utils.EasycashUmengEvent;
import com.lingyue.easycash.utils.YqdUtils;
import com.lingyue.easycash.widght.AuthGeneralView;
import com.lingyue.easycash.widght.AuthGeneralViewV2;
import com.lingyue.easycash.widght.BaseAuthGeneralView;
import com.lingyue.easycash.widght.EasycashConfirmDialog;
import com.lingyue.easycash.widght.EasycashDoubleContentSingleButtonDialog;
import com.lingyue.easycash.widght.EasycashSingleButtonDialog;
import com.lingyue.idnbaselib.framework.lifecycle.LifecycleEvent;
import com.lingyue.idnbaselib.model.DeleteAccountRequest;
import com.lingyue.idnbaselib.model.IdnBaseResult;
import com.lingyue.idnbaselib.model.IdnObserver;
import com.lingyue.idnbaselib.model.response.BooleanResponse;
import com.lingyue.idnbaselib.model.response.DeleteUserResponse;
import com.lingyue.idnbaselib.utils.EcFormatUtil;
import com.lingyue.idnbaselib.utils.ThirdPartEventUtils;
import com.lingyue.idnbaselib.utils.VerificationType;
import com.lingyue.idnbaselib.widget.ButtonTimer;
import com.lingyue.supertoolkit.widgets.BaseUtils;
import com.lingyue.supertoolkit.widgets.countdown.CustomCountDownTimer;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.yangqianguan.statistics.AutoTrackHelper;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import java.text.MessageFormat;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class DeleteAccountActivity extends EasyCashCommonActivity {
    private ButtonTimer C;
    private CustomCountDownTimer D;
    int E;
    private String F;
    private String H;
    private String J;
    private boolean K;

    @BindView(R.id.agv_captcha)
    AuthGeneralView agvCaptcha;

    @BindView(R.id.agv_id_card)
    AuthGeneralViewV2 agvIdCard;

    @BindView(R.id.agv_phone_number)
    AuthGeneralView agvMobile;

    @BindView(R.id.ll_ivr)
    LinearLayout llIVR;

    @BindView(R.id.tv_ivr_count_down)
    TextView tvIvrCountDown;

    @BindView(R.id.tv_try_ivr_verification)
    TextView tvTryVerification;
    private final int B = 400001;
    private String G = "";
    private final String I = "40000108";

    public void A0(VerificationType verificationType) {
        dismissLoadingDialog();
        this.llIVR.setClickable(false);
        this.tvTryVerification.setTextColor(getResources().getColor(2131099787));
        if (verificationType == VerificationType.SMS) {
            n0();
            this.tvIvrCountDown.setVisibility(8);
            return;
        }
        this.agvCaptcha.btnRight.setEnabled(false);
        this.agvCaptcha.btnRight.setBackgroundResource(2131230964);
        this.tvIvrCountDown.setVisibility(0);
        CustomCountDownTimer customCountDownTimer = new CustomCountDownTimer(60000L, 1000L) {
            @Override
            public void e() {
                DeleteAccountActivity.this.agvCaptcha.btnRight.setEnabled(true);
                DeleteAccountActivity.this.agvCaptcha.btnRight.setBackgroundResource(R.drawable.easycash_shape_c_green_r_8);
                DeleteAccountActivity.this.tvIvrCountDown.setVisibility(8);
                DeleteAccountActivity deleteAccountActivity = DeleteAccountActivity.this;
                deleteAccountActivity.tvTryVerification.setTextColor(deleteAccountActivity.getResources().getColor(2131099780));
                DeleteAccountActivity.this.llIVR.setClickable(true);
            }

            @Override
            public void f(long j) {
                ?? r0 = DeleteAccountActivity.this;
                r0.tvIvrCountDown.setText(String.format(r0.getString(2131886774), Long.valueOf(j / 1000)));
            }
        };
        this.D = customCountDownTimer;
        customCountDownTimer.g();
    }

    private void B0() {
        this.agvCaptcha.getEtContent().setKeyListener(DigitsKeyListener.getInstance("0123456789"));
        this.agvCaptcha.getEtContent().setFilters(new InputFilter[]{new InputFilter.LengthFilter(6)});
        this.agvCaptcha.btnRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DeleteAccountActivity.this.w0(view);
            }
        });
    }

    private void C0() {
        int i = this.userSession.f().verificationConfig.displayTipsRetryNumber;
        this.E = i;
        renderIVRVerificationView(i <= 0);
    }

    private void D0() {
        this.agvMobile.setUnChangeContentText(this.F);
    }

    private void E0() {
        this.apiHelper.a().n(i0()).a(new IdnObserver<DeleteUserResponse>(this) {
            @Override
            public void onSuccess(DeleteUserResponse deleteUserResponse) {
                DeleteAccountActivity.this.dismissLoadingDialog();
                if (DeleteUserResponse.StatusEnum.COMPLETE.name().equals(deleteUserResponse.body.deleteStatus)) {
                    DeleteAccountActivity.this.z0();
                } else if (DeleteUserResponse.StatusEnum.PENDING.name().equals(deleteUserResponse.body.deleteStatus)) {
                    DeleteAccountActivity.this.k0();
                }
            }
        });
    }

    private void F0() {
        this.apiHelper.a().G(this.G, this.H, this.F, "40000108").a(new IdnObserver<BooleanResponse>(this) {
            @Override
            public void onError(Throwable th, BooleanResponse booleanResponse) {
                super.onError(th, (Throwable) booleanResponse);
                if (booleanResponse.status.code == 400001) {
                    DeleteAccountActivity.this.finish();
                }
            }

            @Override
            public void onSuccess(BooleanResponse booleanResponse) {
                DeleteAccountActivity.this.dismissLoadingDialog();
                DeleteAccountActivity.this.l0();
            }
        });
    }

    private void G0(final VerificationType verificationType) {
        showLoadingDialog();
        this.apiHelper.a().A(this.F, MobileVerificationPurpose.DELETE_USER.name(), verificationType.name()).a0(Schedulers.c()).K(AndroidSchedulers.a()).a(new IdnObserver<IdnBaseResult>(this) {
            @Override
            public void onSuccess(IdnBaseResult idnBaseResult) {
                DeleteAccountActivity.this.A0(verificationType);
            }

            @Override
            public void onError(Throwable th, IdnBaseResult idnBaseResult) {
                super.onError(th, (Throwable) idnBaseResult);
                if (idnBaseResult.status.code == EasyCashResponseCode.SEND_SMS_TOO_FAST_CODE.code) {
                    DeleteAccountActivity.this.A0(verificationType);
                } else if (DeleteAccountActivity.this.C != null) {
                    DeleteAccountActivity.this.C.onFinish();
                }
            }
        });
    }

    private void H0(@NonNull String str) {
        boolean z2 = !TextUtils.isEmpty(this.userSession.g());
        ThirdPartEventUtils.n(getApplicationContext(), str + "_status_" + z2);
    }

    public void I0() {
        int i = this.E - 1;
        this.E = i;
        if (i == 0) {
            renderIVRVerificationView(true);
        }
    }

    private void h0() {
        startActivity(EasyCashMainActivity.IntentBuilder.f(this).d().a());
    }

    private DeleteAccountRequest i0() {
        ArrayList arrayList = new ArrayList();
        String str = "";
        try {
            JSONObject jSONObject = new JSONObject(this.J);
            str = jSONObject.getString("note");
            JSONArray jSONArray = jSONObject.getJSONArray("reasons");
            for (int i = 0; i < jSONArray.length(); i++) {
                arrayList.add((String) jSONArray.get(i));
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return new DeleteAccountRequest(this.F, arrayList, str);
    }

    private void j0() {
        EasycashDoubleContentSingleButtonDialog.e(this).m("dialog_ivr_verification_delete_account").l(getString(R.string.easycash_ivr_verification_dlg_title)).i(MessageFormat.format(getString(R.string.easycash_ivr_verification_dlg_content), EcFormatUtil.u(this.userSession.b().mobileNumber))).k(getString(R.string.easycash_ivr_verification_dlg_sub_content)).h(R.string.easycash_ivr_dlg_call).j(new EasycashDoubleContentSingleButtonDialog.OnDoubleContentDialogButtonClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                DeleteAccountActivity.this.o0(dialogInterface, i);
            }
        }).show();
    }

    public void k0() {
        EasycashSingleButtonDialog l = EasycashSingleButtonDialog.d(this).o("dialog_delete_later").m(getString(2131886869)).g(2131886779).f(R.string.ok).l(new EasycashSingleButtonDialog.OnDialogButtonClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                DeleteAccountActivity.this.p0(dialogInterface, i);
            }
        });
        l.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public final boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                boolean q0;
                q0 = DeleteAccountActivity.this.q0(dialogInterface, i, keyEvent);
                return q0;
            }
        });
        l.show();
    }

    public void l0() {
        EasycashConfirmDialog.f(this).q("dialog_retain").p(getString(R.string.live_warm_prompt)).g(2131886867).n(2131886773).k(2131886768).m(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                DeleteAccountActivity.this.r0(dialogInterface, i);
            }
        }).j(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                DeleteAccountActivity.this.s0(dialogInterface, i);
            }
        }).show();
    }

    private void m0() {
        String str = this.userSession.f().customerServiceNumber;
        String format = MessageFormat.format(getString(2131886868), str);
        int indexOf = format.indexOf(str);
        int length = str.length() + indexOf;
        SpannableString spannableString = new SpannableString(format);
        spannableString.setSpan(YqdUtils.l(new Runnable() {
            @Override
            public final void run() {
                DeleteAccountActivity.this.t0();
            }
        }), indexOf, length, 33);
        EasycashConfirmDialog.f(this).q("dialog_retain_force").p(getString(2131886790)).h(spannableString).n(2131886773).k(2131886768).m(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                DeleteAccountActivity.this.u0(dialogInterface, i);
            }
        }).j(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                DeleteAccountActivity.this.v0(dialogInterface, i);
            }
        }).show();
    }

    private void n0() {
        if (this.C == null) {
            ButtonTimer buttonTimer = new ButtonTimer(this.agvCaptcha.btnRight, 60000L, 1000L) {
                @Override
                public void onFinish() {
                    super.onFinish();
                    DeleteAccountActivity.this.I0();
                    DeleteAccountActivity.this.llIVR.setClickable(true);
                    DeleteAccountActivity.this.tvIvrCountDown.setVisibility(8);
                    DeleteAccountActivity deleteAccountActivity = DeleteAccountActivity.this;
                    deleteAccountActivity.tvTryVerification.setTextColor(deleteAccountActivity.getResources().getColor(2131099780));
                }
            };
            this.C = buttonTimer;
            buttonTimer.b(2131230964).d(getString(2131886774)).c(R.drawable.easycash_shape_c_green_r_8).h(getString(2131886871));
        }
        this.C.start();
    }

    public void o0(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        G0(VerificationType.IVR);
    }

    public void p0(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        BaseUtils.o(getApplicationContext(), 2131886778);
        h0();
    }

    public boolean q0(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
        if (i != 4) {
            return false;
        }
        dialogInterface.dismiss();
        BaseUtils.o(getApplicationContext(), 2131886778);
        h0();
        return true;
    }

    @SensorsDataInstrumented
    public void r0(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        h0();
        finish();
        SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
        AutoTrackHelper.trackViewOnClick(dialogInterface, i);
    }

    @SensorsDataInstrumented
    public void s0(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        m0();
        SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
        AutoTrackHelper.trackViewOnClick(dialogInterface, i);
    }

    public static void startDeleteAccountActivity(Activity activity, boolean z2, String str, String str2) {
        Intent intent = new Intent(activity, (Class<?>) DeleteAccountActivity.class);
        intent.putExtra("hasIdentity", z2);
        intent.putExtra("reason", str);
        intent.putExtra("paramMobileNumber", str2);
        activity.startActivity(intent);
    }

    public void t0() {
        startActivity(new Intent("android.intent.action.DIAL", Uri.parse("tel:" + this.userSession.f().customerServiceNumber)));
    }

    @SensorsDataInstrumented
    public void u0(DialogInterface dialogInterface, int i) {
        h0();
        finish();
        SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
        AutoTrackHelper.trackViewOnClick(dialogInterface, i);
    }

    @SensorsDataInstrumented
    public void v0(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        showLoadingDialog();
        E0();
        SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
        AutoTrackHelper.trackViewOnClick(dialogInterface, i);
    }

    @SensorsDataInstrumented
    public void w0(View view) {
        if (BaseUtils.l()) {
            SensorsDataAutoTrackHelper.trackViewOnClick(view);
            AutoTrackHelper.trackViewOnClick(view);
        } else {
            G0(VerificationType.SMS);
            SensorsDataAutoTrackHelper.trackViewOnClick(view);
            AutoTrackHelper.trackViewOnClick(view);
        }
    }

    public static String x0(String str) {
        String replaceAll = str.replaceAll("\\D", "");
        return replaceAll.length() > 6 ? replaceAll.replaceAll("(\\d{6})(?=\\d)", "$1 ") : replaceAll;
    }

    public void y0(UserResponse userResponse) {
        UserResponse.Body body = userResponse.body;
        if (body != null) {
            this.F = body.mobileNumber;
            D0();
            UserGlobal b = this.userSession.b();
            UserResponse.Body body2 = userResponse.body;
            b.userName = body2.name;
            b.mobileNumber = body2.mobileNumber;
            b.hasPassword = body2.hasPassword;
            b.updateTraceId(body2.traceId);
        }
    }

    public void z0() {
        logout();
        jumpToMainPage();
        BaseUtils.o(getApplicationContext(), 2131886777);
        finish();
    }

    @Override
    protected void B(@NonNull Bundle bundle) {
        super.B(bundle);
        this.F = bundle.getString("paramMobileNumber");
        this.J = bundle.getString("reason");
        this.K = bundle.getBoolean("hasIdentity");
    }

    @Override
    protected void D() {
        super.D();
        D0();
        renderIdCardView();
        B0();
        C0();
    }

    @Override
    protected void N(@NonNull Bundle bundle) {
        super.N(bundle);
        bundle.putString("reason", this.J);
        bundle.putBoolean("hasIdentity", this.K);
        bundle.putString("paramMobileNumber", this.F);
    }

    @OnClick({2131361988})
    public void clickConfirm() {
        if (BaseUtils.l()) {
            return;
        }
        this.G = this.agvIdCard.getTrimmedText();
        this.H = this.agvCaptcha.getTrimmedText();
        if (this.K && TextUtils.isEmpty(this.G)) {
            showToast(getString(R.string.please_input_idcard_number));
            showSoftInput(this.agvIdCard.getEtContent());
            return;
        }
        if (TextUtils.isEmpty(this.H)) {
            BaseUtils.p(this, getString(R.string.input_verification_code));
            showSoftInput(this.agvCaptcha.getEtContent());
        } else if (this.H.length() < 6) {
            BaseUtils.p(this, getString(R.string.input_six_verification_code));
            showSoftInput(this.agvCaptcha.getEtContent());
        } else {
            H0("before_req");
            showLoadingDialog();
            F0();
        }
    }

    @Override
    public int getLayoutID() {
        return R.layout.layout_activity_delete_account;
    }

    @OnClick({R.id.ll_ivr})
    public void onClickIVR() {
        if (BaseUtils.l()) {
            return;
        }
        j0();
    }

    public void renderIVRVerificationView(boolean z2) {
        if (!z2) {
            this.llIVR.setVisibility(8);
        } else {
            this.llIVR.setVisibility(0);
            ThirdPartEventUtils.y(this, EasycashUmengEvent.d1);
        }
    }

    public void renderIdCardView() {
        if (!this.K) {
            this.agvIdCard.setVisibility(8);
            return;
        }
        this.agvIdCard.setVisibility(0);
        this.agvIdCard.getEtContent().setKeyListener(DigitsKeyListener.getInstance("0123456789"));
        this.agvIdCard.setFormatter(new BaseAuthGeneralView.Formatter() {
            @Override
            public final String a(String str) {
                String x0;
                x0 = DeleteAccountActivity.x0(str);
                return x0;
            }
        });
        this.agvIdCard.getEtContent().setFilters(new InputFilter[]{new InputFilter.LengthFilter(18)});
    }

    @Override
    public Disposable runOnActiveEvent(Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.a(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnCreated(@NonNull Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.b(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnDestroy(@NonNull Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.c(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.d(this, lifecycleEvent, runnable);
    }

    @Override
    public Disposable runOnEvents(@NonNull LifecycleEvent[] lifecycleEventArr, @Nullable Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.e(this, lifecycleEventArr, runnable);
    }

    public void sendFetchUserInfoRequest() {
        this.apiHelper.a().E().a(new IdnObserver<UserResponse>(this) {
            @Override
            public void onError(Throwable th, UserResponse userResponse) {
                super.onError(th, (Throwable) userResponse);
                DeleteAccountActivity.this.finish();
            }

            @Override
            public void onSuccess(UserResponse userResponse) {
                DeleteAccountActivity.this.y0(userResponse);
                DeleteAccountActivity.this.dismissLoadingDialog();
            }
        });
    }

    @Override
    protected void z() {
        super.z();
        if (TextUtils.isEmpty(this.F)) {
            showLoadingDialog();
            sendFetchUserInfoRequest();
        }
        H0("init");
    }
}