导航菜单

页面标题

页面副标题

Credmex v3.12.2 - PersonalInformationActivity.java 源代码

正在查看: Credmex v3.12.2 应用的 PersonalInformationActivity.java JAVA 源代码文件

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


package com.credmex.authentication.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.activity.result.ActivityResultLauncher;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.credmex.AuthUtils;
import com.credmex.authentication.helper.AutoJumpHelper;
import com.credmex.authentication.helper.QuitAuthHelper;
import com.credmex.authentication.personalinfomation.DistrictStatePickHolder;
import com.credmex.authentication.personalinfomation.StreedPickHolder;
import com.credmex.commom.CommonActivity;
import com.credmex.models.IndexDataBean;
import com.credmex.models.response.LabelBeanResponse;
import com.credmex.models.response.SpecificAreaResponse;
import com.credmex.models.response.UploadIdentityInfoV2Response;
import com.credmex.net.CredMexObserver;
import com.credmex.net.IApiRoutes;
import com.credmex.track.ThirdPartEventUtils;
import com.credmex.track.ThirdPartTrackEvents;
import com.credmex.track.ThirdPartTrackLib;
import com.credmex.utils.CalenderUploadHelper;
import com.credmex.utils.YqdUtils;
import com.credmex.widght.editTextBridge.DefaultTextWatcher;
import com.google.android.gms.location.GeofenceStatusCodes;
import com.open.mx.ui.base.BaseComponent;
import com.open.mx.ui.base.BaseComponentPresenter;
import com.open.mx.ui.base.ComponentState;
import com.open.mx.ui.components.EditTextComponent;
import com.open.mx.ui.components.ItemPickComponent;
import com.open.mx.ui.event.ComponentEvent;
import com.open.mx.ui.event.ComponentEventCenter;
import com.open.mx.ui.model.LabelBean;
import com.open.mx.ui.presenter.DataFetcher;
import com.open.mx.ui.presenter.pickhold.SinglePickHolder;
import com.open.mx.ui.views.button.PrimaryButton;
import com.open.mxbaselib.sentrybusiness.ISentryBusinessEventAutoFinish;
import com.veda.android.bananalibrary.infrastructure.BaseActivity;
import com.veda.supertoolkit.customtools.CollectionUtils;
import com.veda.supertoolkit.lifecycle.LifecycleEvent;
import com.veda.supertoolkit.widgets.BaseUtils;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.sentry.SpanStatus;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class PersonalInformationActivity extends AuthHandleAutoJumpActivity implements ISentryBusinessEventAutoFinish {
    private List<TextView> H = new ArrayList();
    private ArrayList<IndexDataBean> I = new ArrayList<>();
    private AutoJumpHelper J;
    private AutoJumpHelper K;
    private AutoJumpHelper R;
    private AutoJumpHelper S;
    private AutoJumpHelper T;
    private BaseComponentPresenter<CommonActivity> U;
    private DistrictStatePickHolder V;
    private StreedPickHolder W;
    private CalenderUploadHelper X;

    @BindView(2131361937)
    PrimaryButton btnConfirm;

    @BindView(2131362133)
    EditTextComponent<CommonActivity> detailAddressComponent;

    @BindView(2131362165)
    ItemPickComponent<CommonActivity> educationComponent;

    @BindView(2131362445)
    LinearLayout llAuthTip;

    @BindView(2131362519)
    LinearLayout llContent;

    @BindView(2131362689)
    EditTextComponent<CommonActivity> postCodeComponent;

    @BindView(2131362880)
    ItemPickComponent<CommonActivity> stateDistrictComponent;

    @BindView(2131362885)
    ItemPickComponent<CommonActivity> streetComponent;

    @BindView(2131362886)
    EditTextComponent<CommonActivity> streetEditComponent;

    @BindView(2131362983)
    TextView tvAuthTip;

    private void A0() {
        this.H.add(this.educationComponent.l0());
        this.H.add(this.postCodeComponent.F0());
        this.H.add(this.stateDistrictComponent.l0());
        this.H.add(this.detailAddressComponent.F0());
    }

    private boolean B0() {
        if (!this.stateDistrictComponent.k()) {
            showErrorToast(2131821121);
            return false;
        }
        if (!this.streetComponent.k() || (L0() && !this.streetEditComponent.k())) {
            showErrorToast(2131821123);
            return false;
        }
        if (!this.detailAddressComponent.k()) {
            showErrorToast(2131821116);
            this.detailAddressComponent.b0();
            return false;
        }
        if (this.detailAddressComponent.getResult().length() >= 5) {
            return true;
        }
        showErrorToast(2131820579);
        this.detailAddressComponent.b0();
        return false;
    }

    private boolean C0() {
        if (this.postCodeComponent.k()) {
            return true;
        }
        showErrorToast(2131821120);
        this.postCodeComponent.b0();
        return false;
    }

    private boolean D0() {
        if (this.educationComponent.k()) {
            return true;
        }
        showErrorToast(2131821126);
        this.J.run();
        return false;
    }

    public void E0(List<String> list) {
        if (CollectionUtils.a(list)) {
            return;
        }
        this.I.clear();
        for (String str : list) {
            this.I.add(new IndexDataBean(str, str));
        }
        this.I.add(new IndexDataBean(getString(2131821080), getString(2131821080)));
    }

    private void F0() {
        this.detailAddressComponent.setPresenter(this.U);
        this.detailAddressComponent.setTrackSource("R.id.et_detail_address");
        this.detailAddressComponent.c(new BaseComponent.ComponentDoneListener() {
            public final void a(Object obj) {
                PersonalInformationActivity.this.M0((String) obj);
            }
        });
    }

    private void G0() {
        this.stateDistrictComponent.setPresenter(this.U);
        this.stateDistrictComponent.setTrackSource("R.id.tv_state_district");
        DistrictStatePickHolder districtStatePickHolder = new DistrictStatePickHolder("R.id.tv_state_district", this, this.stateDistrictComponent);
        this.V = districtStatePickHolder;
        this.stateDistrictComponent.setPickHolder(districtStatePickHolder);
        this.stateDistrictComponent.c(new BaseComponent.ComponentDoneListener() {
            public final void a(Object obj) {
                PersonalInformationActivity.this.N0((List) obj);
            }
        });
    }

    private void H0() {
        this.educationComponent.setPresenter(this.U);
        this.educationComponent.setPickHolder(new SinglePickHolder(getString(2131820746), "R.id.tv_education"));
        this.educationComponent.c(new BaseComponent.ComponentDoneListener() {
            public final void a(Object obj) {
                PersonalInformationActivity.this.O0((List) obj);
            }
        });
        this.educationComponent.setDataFetcher(new DataFetcher() {
            public final void a(ItemPickComponent itemPickComponent, DataFetcher.FetchCallBack fetchCallBack) {
                PersonalInformationActivity.this.P0(itemPickComponent, fetchCallBack);
            }
        });
    }

    private void J0() {
        this.postCodeComponent.setPresenter(this.U);
        this.postCodeComponent.F0().setInputType(2);
        this.postCodeComponent.setTrackSource("R.id.et_post_code");
        this.postCodeComponent.F0().addTextChangedListener(new DefaultTextWatcher() {
            @Override
            public void afterTextChanged(Editable editable) {
                if (PersonalInformationActivity.this.postCodeComponent.F0().getText().toString().length() == 5) {
                    PersonalInformationActivity.this.postCodeComponent.P(ComponentState.d);
                    PersonalInformationActivity.this.X0();
                }
            }
        });
        ThirdPartEventUtils.f(this.postCodeComponent.F0());
        this.postCodeComponent.c(new BaseComponent.ComponentDoneListener() {
            public final void a(Object obj) {
                PersonalInformationActivity.this.Q0((String) obj);
            }
        });
    }

    private void K0() {
        this.streetComponent.setPresenter(this.U);
        StreedPickHolder streedPickHolder = new StreedPickHolder("R.id.tv_street", this, this.streetComponent) {
            @Override
            public void s(ActivityResultLauncher<Intent> activityResultLauncher) {
                LabelBean z0 = PersonalInformationActivity.this.stateDistrictComponent.z0();
                if (z0 == null) {
                    return;
                }
                if (!z0.label.equals(z0.value)) {
                    activityResultLauncher.launch(SelectAreaActivity.args((Activity) PersonalInformationActivity.this, GeofenceStatusCodes.GEOFENCE_REQUEST_TOO_FREQUENT, z0.value));
                } else {
                    if (CollectionUtils.a(PersonalInformationActivity.this.I)) {
                        return;
                    }
                    ?? r0 = PersonalInformationActivity.this;
                    activityResultLauncher.launch(SelectAreaActivity.args((Activity) r0, GeofenceStatusCodes.GEOFENCE_REQUEST_TOO_FREQUENT, (ArrayList<IndexDataBean>) ((PersonalInformationActivity) r0).I));
                }
            }
        };
        this.W = streedPickHolder;
        this.streetComponent.setPickHolder(streedPickHolder);
        this.streetComponent.setTrackSource("R.id.tv_street");
        this.streetComponent.c(new BaseComponent.ComponentDoneListener() {
            public final void a(Object obj) {
                PersonalInformationActivity.this.R0((List) obj);
            }
        });
        this.streetEditComponent.setPresenter(this.U);
        this.streetEditComponent.setTrackSource("R.id.et_street");
        this.streetEditComponent.c(new BaseComponent.ComponentDoneListener() {
            public final void a(Object obj) {
                PersonalInformationActivity.this.S0((String) obj);
            }
        });
    }

    public boolean L0() {
        LabelBean v0 = this.streetComponent.v0();
        if (v0 == null) {
            return false;
        }
        return getString(2131821080).equals(v0.label);
    }

    public void M0(String str) {
        this.T.d();
    }

    public void N0(List list) {
        W0();
        if (this.stateDistrictComponent.v0() == null || this.stateDistrictComponent.z0() == null) {
            this.streetComponent.setEnabled(false);
        } else {
            this.streetComponent.setEnabled(true);
        }
        this.R.d();
    }

    public void O0(List list) {
        this.J.d();
    }

    public void P0(ItemPickComponent itemPickComponent, final DataFetcher.FetchCallBack fetchCallBack) {
        showLoadingDialog();
        ((IApiRoutes) this.apiHelper.a()).M0().a(new CredMexObserver<LabelBeanResponse>(this) {
            @Override
            public void onError(Throwable th, LabelBeanResponse labelBeanResponse) {
                super.onError(th, (Throwable) labelBeanResponse);
                fetchCallBack.onError();
                PersonalInformationActivity.this.reportFullyDisplayed();
            }

            public void onSuccess(LabelBeanResponse labelBeanResponse) {
                PersonalInformationActivity.this.dismissLoadingDialog();
                fetchCallBack.onSuccess(labelBeanResponse.body);
                PersonalInformationActivity.this.reportFullyDisplayed();
            }
        });
    }

    public void Q0(String str) {
        if (this.postCodeComponent.F0().getText().toString().length() == 5 || this.stateDistrictComponent.k()) {
            return;
        }
        this.stateDistrictComponent.b0();
    }

    public void R0(List list) {
        LabelBean v0 = this.streetComponent.v0();
        if (v0 == null) {
            return;
        }
        if (!v0.label.equals(getResources().getString(2131821080))) {
            this.S.d();
            return;
        }
        this.streetComponent.setVisibility(8);
        this.streetEditComponent.setVisibility(0);
        this.streetEditComponent.b0();
    }

    public void S0(String str) {
        this.S.d();
    }

    public void T0(ComponentEvent componentEvent) throws Exception {
        configureBtnConfirmEnable();
    }

    public void U0() {
        if (D0() && C0() && B0()) {
            Z0();
        }
    }

    private void W0() {
        this.streetEditComponent.u();
        this.streetComponent.u();
        this.streetComponent.setVisibility(0);
        this.streetEditComponent.setVisibility(8);
    }

    public void X0() {
        showLoadingDialog();
        ((IApiRoutes) this.apiHelper.a()).B0(this.postCodeComponent.getResult().trim()).a(new CredMexObserver<SpecificAreaResponse>(this) {
            public void onSuccess(SpecificAreaResponse specificAreaResponse) {
                PersonalInformationActivity.this.dismissLoadingDialog();
                SpecificAreaResponse.AreaBean areaBean = specificAreaResponse.body;
                String str = areaBean.state;
                LabelBean labelBean = new LabelBean(str, str);
                String str2 = areaBean.district;
                PersonalInformationActivity.this.stateDistrictComponent.u0(new LabelBean[]{labelBean, new LabelBean(str2, str2)});
                PersonalInformationActivity.this.streetComponent.setVisibility(0);
                PersonalInformationActivity.this.streetEditComponent.setVisibility(8);
                PersonalInformationActivity.this.streetEditComponent.u();
                PersonalInformationActivity.this.E0(areaBean.streets);
                if (!CollectionUtils.a(PersonalInformationActivity.this.I)) {
                    PersonalInformationActivity.this.streetComponent.u0(new LabelBean[]{(IndexDataBean) PersonalInformationActivity.this.I.get(0)});
                }
                PersonalInformationActivity.this.streetComponent.setEnabled(true);
                PersonalInformationActivity.this.K.e(500L);
            }
        });
    }

    private void Y0() {
        if (this.X == null) {
            this.X = new CalenderUploadHelper(this, "PersonalInformationActivity", new Runnable() {
                @Override
                public final void run() {
                    PersonalInformationActivity.this.U0();
                }
            });
        }
        this.X.a(true, true);
    }

    private void Z0() {
        showLoadingDialog();
        HashMap hashMap = new HashMap();
        hashMap.put("education", this.educationComponent.v0().value);
        hashMap.put("postCode", this.postCodeComponent.getResult().trim());
        hashMap.put("state", this.stateDistrictComponent.v0().label);
        hashMap.put("district", this.stateDistrictComponent.z0().label);
        if (L0()) {
            hashMap.put("street", this.streetEditComponent.getResult().trim());
        } else {
            hashMap.put("street", this.streetComponent.v0().label);
        }
        hashMap.put("detailAddress", this.detailAddressComponent.getResult().trim());
        ((IApiRoutes) this.apiHelper.a()).h0(((BaseActivity) this).gson.t(hashMap)).a(new CredMexObserver<UploadIdentityInfoV2Response>(this) {
            @Override
            public void onError(Throwable th, UploadIdentityInfoV2Response uploadIdentityInfoV2Response) {
                super.onError(th, (Throwable) uploadIdentityInfoV2Response);
                PersonalInformationActivity.this.businessTransaction("UserAuthOrder").b(SpanStatus.INTERNAL_ERROR);
                PersonalInformationActivity.this.dismissLoadingDialog();
            }

            public void onSuccess(UploadIdentityInfoV2Response uploadIdentityInfoV2Response) {
                PersonalInformationActivity.this.businessTransaction("UserAuthOrder").n(SpanStatus.OK);
                PersonalInformationActivity.this.V0();
            }
        });
    }

    public static void startPersonalInfoActivity(Activity activity) {
        activity.startActivity(new Intent(activity, (Class<?>) PersonalInformationActivity.class));
    }

    @Override
    protected void G(@NonNull Bundle bundle) {
        super.G(bundle);
        this.educationComponent.j(bundle);
        this.postCodeComponent.j(bundle);
        this.stateDistrictComponent.j(bundle);
        this.streetComponent.j(bundle);
        this.streetEditComponent.j(bundle);
        this.detailAddressComponent.j(bundle);
    }

    @Override
    @SuppressLint({"CheckResult"})
    protected void J() {
        super.J();
        this.U = new BaseComponentPresenter<>(this);
        duringActive(ComponentEventCenter.d().c(this)).W(new Consumer() {
            public final void accept(Object obj) {
                PersonalInformationActivity.this.T0((ComponentEvent) obj);
            }
        }, new com.credmex.activity.x2());
        H0();
        J0();
        G0();
        K0();
        F0();
    }

    @Override
    protected void K() {
        super.K();
        A0();
        I0();
        this.llAuthTip.setVisibility(TextUtils.isEmpty(this.authUtil.y()) ? 8 : 0);
        this.tvAuthTip.setText(this.authUtil.y());
        this.streetComponent.setEnabled(this.stateDistrictComponent.k());
        ThirdPartEventUtils.f(this.streetEditComponent.F0());
        ThirdPartEventUtils.f(this.detailAddressComponent.F0());
    }

    void V0() {
        dismissLoadingDialog();
        this.authUtil.t(this, new AuthUtils.DefaultAuthCallBack(this));
    }

    @Override
    protected void X(@NonNull Bundle bundle) {
        super.X(bundle);
        this.educationComponent.v(bundle);
        this.postCodeComponent.v(bundle);
        this.stateDistrictComponent.v(bundle);
        this.streetComponent.v(bundle);
        this.streetEditComponent.v(bundle);
        this.detailAddressComponent.v(bundle);
    }

    public void configureBtnConfirmEnable() {
        this.btnConfirm.setEnabled(YqdUtils.e(this.H) && (L0() ? this.streetEditComponent.k() : this.streetComponent.k()));
    }

    @Override
    protected void e0() {
        this.J = new AutoJumpHelper(this) {
            @Override
            public boolean a() {
                return PersonalInformationActivity.this.educationComponent.k();
            }

            @Override
            public void g() {
                PersonalInformationActivity.this.educationComponent.b0();
            }
        };
        this.K = new AutoJumpHelper(this) {
            @Override
            public boolean a() {
                return PersonalInformationActivity.this.postCodeComponent.k();
            }

            @Override
            public void g() {
                PersonalInformationActivity.this.postCodeComponent.b0();
            }
        };
        this.R = new AutoJumpHelper(this) {
            @Override
            public boolean a() {
                return PersonalInformationActivity.this.stateDistrictComponent.k();
            }

            @Override
            protected boolean b() {
                return false;
            }

            @Override
            public void g() {
                PersonalInformationActivity.this.stateDistrictComponent.b0();
            }
        };
        this.S = new AutoJumpHelper(this) {
            @Override
            public boolean a() {
                return PersonalInformationActivity.this.L0() ? PersonalInformationActivity.this.streetEditComponent.k() : PersonalInformationActivity.this.streetComponent.k();
            }

            @Override
            protected boolean b() {
                return PersonalInformationActivity.this.L0();
            }

            @Override
            public void g() {
                if (PersonalInformationActivity.this.L0()) {
                    PersonalInformationActivity.this.streetEditComponent.b0();
                } else {
                    PersonalInformationActivity.this.streetComponent.b0();
                }
            }
        };
        this.T = new AutoJumpHelper(this) {
            @Override
            public boolean a() {
                return PersonalInformationActivity.this.detailAddressComponent.k();
            }

            @Override
            public void g() {
                PersonalInformationActivity.this.detailAddressComponent.b0();
            }
        };
        this.J.f(this.K);
        this.K.f(this.R);
        this.R.f(this.S);
        this.S.f(this.T);
    }

    @Override
    public View getContentView() {
        return this.llContent;
    }

    @Override
    public int getLayoutID() {
        return 2131558688;
    }

    @Override
    protected boolean i0() {
        return this.educationComponent.l() && this.streetComponent.l() && this.streetEditComponent.l() && this.postCodeComponent.l() && this.stateDistrictComponent.l() && this.detailAddressComponent.l();
    }

    @Override
    protected void j0() {
        AutoJumpHelper autoJumpHelper = this.J;
        if (autoJumpHelper != null) {
            autoJumpHelper.run();
        }
    }

    @Override
    protected void l0() {
        this.D.f();
    }

    @Override
    public void onBackPressed() {
        this.G = true;
        QuitAuthHelper.n(this.authUtil, this.userSession.f().quitAuthDialogInfo, this);
    }

    @Override
    protected void onCreate(Bundle bundle) {
        businessTransaction("UserAuthOrder");
        super.onCreate(bundle);
    }

    @OnClick({2131361937})
    public void onViewClicked(View view) {
        if (BaseUtils.b()) {
            return;
        }
        ThirdPartTrackLib.d(this, ThirdPartTrackEvents.UserAuth.MEX_VERIFY_BTN_NEXT);
        if (this.userSession.f().isFetchCalenderInfo) {
            Y0();
        } else {
            U0();
        }
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnCreated(@NonNull Runnable runnable) {
        return com.veda.supertoolkit.lifecycle.i.a(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnDestroy(@NonNull Runnable runnable) {
        return com.veda.supertoolkit.lifecycle.i.b(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
        return com.veda.supertoolkit.lifecycle.i.c(this, lifecycleEvent, runnable);
    }

    private void I0() {
    }
}