导航菜单

页面标题

页面副标题

Easycash v3.75.13 - LenderDeleteAccountActivity.java 源代码

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

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


package com.fintopia.lender.module.setting;

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.fintopia.lender.R;
import com.fintopia.lender.module.account.model.FetchUserResponse;
import com.fintopia.lender.module.baseui.LenderCommonActivity;
import com.fintopia.lender.module.launch.AppGeneralConfigUtils;
import com.fintopia.lender.module.maintab.MainActivity;
import com.fintopia.lender.module.network.ILenderApiRoutes;
import com.fintopia.lender.module.network.LenderResponseCode;
import com.fintopia.lender.module.security.OtpPurpose;
import com.fintopia.lender.module.utils.YqdUtils;
import com.fintopia.lender.widget.LenderAuthGeneralView;
import com.fintopia.lender.widget.LenderConfirmDialog;
import com.fintopia.lender.widget.LenderDoubleContentSingleButtonDialog;
import com.fintopia.lender.widget.LenderSingleButtonDialog;
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.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 LenderDeleteAccountActivity extends LenderCommonActivity {
    private String A;
    private String C;
    private boolean D;

    @BindView(4641)
    LenderAuthGeneralView agvCaptcha;

    @BindView(4642)
    LenderAuthGeneralView agvIdCard;

    @BindView(4643)
    LenderAuthGeneralView agvMobile;

    @BindView(5138)
    LinearLayout llIVR;

    @BindView(5686)
    TextView tvIvrCountDown;

    @BindView(5912)
    TextView tvTryVerification;

    private ButtonTimer f163v;

    private CustomCountDownTimer f164w;

    int f165x;
    private String y;

    private final int f162u = 400001;
    private String z = "";
    private final String B = "40000108";

    private void A0(final VerificationType verificationType) {
        showLoadingDialog();
        ((ILenderApiRoutes) this.apiHelper.a()).A(this.y, OtpPurpose.DELETE_USER.name(), verificationType.name()).a0(Schedulers.c()).K(AndroidSchedulers.a()).a(new IdnObserver<BooleanResponse>(this) {
            public void onError(Throwable th, BooleanResponse booleanResponse) {
                super.onError(th, booleanResponse);
                if (((IdnBaseResult) booleanResponse).status.code == LenderResponseCode.SEND_SMS_TOO_FAST_CODE.code) {
                    LenderDeleteAccountActivity.this.u0(verificationType);
                } else if (LenderDeleteAccountActivity.this.f163v != null) {
                    LenderDeleteAccountActivity.this.f163v.onFinish();
                }
            }

            public void onSuccess(BooleanResponse booleanResponse) {
                LenderDeleteAccountActivity.this.u0(verificationType);
            }
        });
    }

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

    private void c0() {
        startActivity(MainActivity.IntentBuilder.e(this).d().a());
    }

    private DeleteAccountRequest d0() {
        ArrayList arrayList = new ArrayList();
        String str = "";
        try {
            JSONObject jSONObject = new JSONObject(this.C);
            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.y, arrayList, str);
    }

    private void e0() {
        LenderDoubleContentSingleButtonDialog.d(this).l("dialog_ivr_verification_delete_account").k(getString(R.string.lender_ivr_verification_dlg_title)).h(MessageFormat.format(getString(R.string.lender_ivr_verification_dlg_content), EcFormatUtil.u(this.userSession.b().b))).j(getString(R.string.lender_ivr_verification_dlg_sub_content)).g(R.string.lender_ivr_dlg_call).i(new LenderDoubleContentSingleButtonDialog.OnDoubleContentDialogButtonClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                LenderDeleteAccountActivity.this.j0(dialogInterface, i);
            }
        }).show();
    }

    public void f0() {
        LenderSingleButtonDialog i = LenderSingleButtonDialog.d(this).k("dialog_delete_later").j(getString(R.string.ec_safe_tip)).f(R.string.ec_delete_user_later_tip).e(R.string.lender_ok).i(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i2) {
                LenderDeleteAccountActivity.this.k0(dialogInterface, i2);
            }
        });
        i.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public final boolean onKey(DialogInterface dialogInterface, int i2, KeyEvent keyEvent) {
                boolean l0;
                l0 = LenderDeleteAccountActivity.this.l0(dialogInterface, i2, keyEvent);
                return l0;
            }
        });
        i.show();
    }

    public void g0() {
        LenderConfirmDialog.e(this).s("dialog_retain_lender").r(getString(R.string.lender_warm_prompt)).f(R.string.ec_retain_dlg_content).o(R.string.ec_continue_use).j(R.string.ec_confirm_delete).n(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                LenderDeleteAccountActivity.this.m0(dialogInterface, i);
            }
        }).i(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                LenderDeleteAccountActivity.this.n0(dialogInterface, i);
            }
        }).show();
    }

    private void h0() {
        String str = this.userSession.f().customerServiceNumber;
        String format = MessageFormat.format(getString(R.string.ec_retain_dlg_force_content), str);
        int indexOf = format.indexOf(str);
        int length = str.length() + indexOf;
        SpannableString spannableString = new SpannableString(format);
        spannableString.setSpan(YqdUtils.c(this, new Runnable() {
            @Override
            public final void run() {
                LenderDeleteAccountActivity.this.o0();
            }
        }), indexOf, length, 33);
        LenderConfirmDialog.e(this).s("dialog_retain_force_lender").r(getString(R.string.ec_important_tip)).g(spannableString).o(R.string.ec_continue_use).j(R.string.ec_confirm_delete).n(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                LenderDeleteAccountActivity.this.p0(dialogInterface, i);
            }
        }).i(new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                LenderDeleteAccountActivity.this.q0(dialogInterface, i);
            }
        }).show();
    }

    private void i0() {
        if (this.f163v == null) {
            ButtonTimer buttonTimer = new ButtonTimer(this.agvCaptcha.btnRight, 60000L, 1000L) {
                public void onFinish() {
                    super.onFinish();
                    LenderDeleteAccountActivity.this.B0();
                    LenderDeleteAccountActivity.this.llIVR.setClickable(true);
                    LenderDeleteAccountActivity.this.tvIvrCountDown.setVisibility(8);
                    LenderDeleteAccountActivity lenderDeleteAccountActivity = LenderDeleteAccountActivity.this;
                    lenderDeleteAccountActivity.tvTryVerification.setTextColor(lenderDeleteAccountActivity.getResources().getColor(R.color.c_base_blue));
                }
            };
            this.f163v = buttonTimer;
            buttonTimer.b(R.drawable.base_shape_mid_gray_r_8).d(getString(R.string.ec_count_down_second)).c(R.drawable.lender_shape_blue_r_8).h(getString(R.string.ec_send));
        }
        this.f163v.start();
    }

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

    @SensorsDataInstrumented
    public void k0(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        BaseUtils.o(getApplicationContext(), R.string.ec_delete_apply_success);
        c0();
        SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
        AutoTrackHelper.trackViewOnClick(dialogInterface, i);
    }

    public boolean l0(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
        if (i != 4) {
            return false;
        }
        dialogInterface.dismiss();
        BaseUtils.o(getApplicationContext(), R.string.ec_delete_apply_success);
        c0();
        return true;
    }

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

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

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

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

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

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

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

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

    public void t0() {
        logout(false, false);
        BaseUtils.o(getApplicationContext(), R.string.ec_delete_account_success);
        finish();
    }

    public void u0(VerificationType verificationType) {
        dismissLoadingDialog();
        this.llIVR.setClickable(false);
        this.tvTryVerification.setTextColor(getResources().getColor(R.color.c_base_light_black));
        if (verificationType == VerificationType.SMS) {
            i0();
            this.tvIvrCountDown.setVisibility(8);
            return;
        }
        this.agvCaptcha.btnRight.setEnabled(false);
        this.agvCaptcha.btnRight.setBackgroundResource(R.drawable.base_shape_mid_gray_r_8);
        this.tvIvrCountDown.setVisibility(0);
        CustomCountDownTimer customCountDownTimer = new CustomCountDownTimer(60000L, 1000L) {
            public void e() {
                LenderDeleteAccountActivity.this.agvCaptcha.btnRight.setEnabled(true);
                LenderDeleteAccountActivity.this.agvCaptcha.btnRight.setBackgroundResource(R.drawable.lender_shape_blue_r_8);
                LenderDeleteAccountActivity.this.tvIvrCountDown.setVisibility(8);
                LenderDeleteAccountActivity lenderDeleteAccountActivity = LenderDeleteAccountActivity.this;
                lenderDeleteAccountActivity.tvTryVerification.setTextColor(lenderDeleteAccountActivity.getResources().getColor(R.color.c_base_blue));
                LenderDeleteAccountActivity.this.llIVR.setClickable(true);
            }

            public void f(long j) {
                ?? r0 = LenderDeleteAccountActivity.this;
                r0.tvIvrCountDown.setText(String.format(r0.getString(R.string.ec_count_down_second), Long.valueOf(j / 1000)));
            }
        };
        this.f164w = customCountDownTimer;
        customCountDownTimer.g();
    }

    private void v0() {
        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) {
                LenderDeleteAccountActivity.this.r0(view);
            }
        });
    }

    private void w0() {
        int i = AppGeneralConfigUtils.o().q().displayTipsRetryNumber;
        this.f165x = i;
        renderIVRVerificationView(i <= 0);
    }

    public void x0() {
        this.agvMobile.setUnChangeContentText(this.y);
    }

    private void y0() {
        ((ILenderApiRoutes) this.apiHelper.a()).n(d0()).a(new IdnObserver<DeleteUserResponse>(this) {
            public void onSuccess(DeleteUserResponse deleteUserResponse) {
                LenderDeleteAccountActivity.this.dismissLoadingDialog();
                if (DeleteUserResponse.StatusEnum.COMPLETE.name().equals(deleteUserResponse.body.deleteStatus)) {
                    LenderDeleteAccountActivity.this.t0();
                } else if (DeleteUserResponse.StatusEnum.PENDING.name().equals(deleteUserResponse.body.deleteStatus)) {
                    LenderDeleteAccountActivity.this.f0();
                }
            }
        });
    }

    private void z0() {
        ((ILenderApiRoutes) this.apiHelper.a()).G(this.z, this.A, this.y, "40000108").a(new IdnObserver<BooleanResponse>(this) {
            public void onError(Throwable th, BooleanResponse booleanResponse) {
                super.onError(th, booleanResponse);
                if (((IdnBaseResult) booleanResponse).status.code == 400001) {
                    LenderDeleteAccountActivity.this.finish();
                }
            }

            public void onSuccess(BooleanResponse booleanResponse) {
                LenderDeleteAccountActivity.this.dismissLoadingDialog();
                LenderDeleteAccountActivity.this.g0();
            }
        });
    }

    @Override
    protected void A() {
        super.A();
        x0();
        renderIdCardView();
        v0();
        w0();
    }

    @Override
    protected void G(@NonNull Bundle bundle) {
        super.G(bundle);
        bundle.putString("reason", this.C);
        bundle.putBoolean("hasIdentity", this.D);
        bundle.putString("paramMobileNumber", this.y);
    }

    @OnClick({4693})
    public void clickConfirm() {
        if (BaseUtils.l()) {
            return;
        }
        this.z = this.agvIdCard.getTrimmedText();
        this.A = this.agvCaptcha.getTrimmedText();
        if (this.D && TextUtils.isEmpty(this.z)) {
            showToast(getString(R.string.lender_please_input_idcard_number));
            showSoftInput(this.agvIdCard.getEtContent());
        } else if (TextUtils.isEmpty(this.A)) {
            BaseUtils.p(this, getString(R.string.lender_please_input_otp));
            showSoftInput(this.agvCaptcha.getEtContent());
        } else if (this.A.length() < 6) {
            BaseUtils.p(this, getString(R.string.lender_digit_code_incorrect));
            showSoftInput(this.agvCaptcha.getEtContent());
        } else {
            showLoadingDialog();
            z0();
        }
    }

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

    @OnClick({5138})
    public void onClickIVR() {
        if (BaseUtils.l()) {
            return;
        }
        e0();
    }

    public void renderIVRVerificationView(boolean z) {
        if (z) {
            this.llIVR.setVisibility(0);
        } else {
            this.llIVR.setVisibility(8);
        }
    }

    public void renderIdCardView() {
        if (!this.D) {
            this.agvIdCard.setVisibility(8);
            return;
        }
        this.agvIdCard.setVisibility(0);
        this.agvIdCard.getEtContent().setKeyListener(DigitsKeyListener.getInstance("0123456789"));
        this.agvIdCard.setFormatter(new LenderAuthGeneralView.Formatter() {
            @Override
            public final String a(String str) {
                String s0;
                s0 = LenderDeleteAccountActivity.s0(str);
                return s0;
            }
        });
        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() {
        ((ILenderApiRoutes) this.apiHelper.a()).E().a(new IdnObserver<FetchUserResponse>(this) {
            public void onError(Throwable th, FetchUserResponse fetchUserResponse) {
                super.onError(th, fetchUserResponse);
                LenderDeleteAccountActivity.this.finish();
            }

            public void onSuccess(FetchUserResponse fetchUserResponse) {
                LenderDeleteAccountActivity.this.y = fetchUserResponse.body.mobileNumber;
                LenderDeleteAccountActivity.this.x0();
                LenderDeleteAccountActivity.this.userSession.b().a = fetchUserResponse.body.name;
                LenderDeleteAccountActivity.this.userSession.b().b = fetchUserResponse.body.mobileNumber;
                LenderDeleteAccountActivity.this.userSession.b().c = fetchUserResponse.body.hasPassword;
                LenderDeleteAccountActivity.this.userSession.b().d(fetchUserResponse.body.traceId);
                LenderDeleteAccountActivity.this.dismissLoadingDialog();
            }
        });
    }

    @Override
    protected void w() {
        super.w();
        if (TextUtils.isEmpty(this.y)) {
            showLoadingDialog();
            sendFetchUserInfoRequest();
        }
    }

    @Override
    protected void y(@NonNull Bundle bundle) {
        super.y(bundle);
        this.y = bundle.getString("paramMobileNumber");
        this.C = bundle.getString("reason");
        this.D = bundle.getBoolean("hasIdentity");
    }
}