导航菜单

页面标题

页面副标题

Credmex v3.12.2 - RepaymentMethodActivity.java 源代码

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

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


package com.credmex.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.activity.result.ActivityResultLauncher;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.widget.NestedScrollView;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.credmex.activity.LaunchActivityFolder.SplashActivity;
import com.credmex.adapters.OnItemClickListener;
import com.credmex.adapters.RepayAccountNumberAdapter;
import com.credmex.adapters.RepaySubChannelAdapter;
import com.credmex.commom.CommonActivity;
import com.credmex.models.BannerBean;
import com.credmex.models.CashBooleanResponse;
import com.credmex.models.RepayTermsBean;
import com.credmex.models.RepayVirtualAccountBean;
import com.credmex.models.response.Coupon;
import com.credmex.models.response.RepayVirtualAccountNewAndRepaymentCouponResponse;
import com.credmex.models.response.RepayVirtualAccountNewResponse;
import com.credmex.models.response.RepayVirtualAccountResponse;
import com.credmex.models.response.RepaymentCouponResponse;
import com.credmex.net.CredMexObserver;
import com.credmex.net.CredMexResponseCode;
import com.credmex.net.IApiRoutes;
import com.credmex.route.RouteCenter;
import com.credmex.track.SensorTrackEvent;
import com.credmex.track.ThirdPartTrackEvents;
import com.credmex.track.ThirdPartTrackLib;
import com.credmex.track.TrackEventParamsConfigurator;
import com.credmex.utils.BannerExposureHelper;
import com.credmex.utils.TextStyleUtil;
import com.credmex.viewModel.RepaymentMethodActivityViewModel;
import com.credmex.widght.Banner.RepayAdBannerView;
import com.credmex.widght.dialog.CommonDialog;
import com.credmex.widght.dialog.bottomDialog.CouponBottomSelectDialog;
import com.credmex.widght.dialog.bottomDialog.RepayAccountNumberBottomDialog;
import com.credmex.widght.dialog.bottomDialog.RepayChannelBottomDialog;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.veda.android.bananalibrary.infrastructure.BaseActivity;
import com.veda.android.imageloaderlib.Imager;
import com.veda.supertoolkit.customtools.CollectionUtils;
import com.veda.supertoolkit.lifecycle.LifecycleEvent;
import com.veda.supertoolkit.utils.FormatUtil;
import com.veda.supertoolkit.utils.ViewUtil;
import com.veda.supertoolkit.widgets.BaseUtils;
import com.yangqianguan.statistics.AutoTrackHelper;
import com.yangqianguan.statistics.interfaces.DataTrackOnRecyclerViewItemClickListener;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.BiFunction;
import io.reactivex.schedulers.Schedulers;
import io.supercharge.shimmerlayout.ShimmerLayout;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import retrofit2.Response;

public class RepaymentMethodActivity extends CommonActivity {
    private CouponBottomSelectDialog D;
    private RepayChannelBottomDialog E;
    private RepaymentMethodActivityViewModel F;
    private RepayAccountNumberAdapter G;
    private RepaySubChannelAdapter H;
    private CountDownTimer I;
    private Disposable J;
    private RepayAccountNumberBottomDialog K;

    @BindView(2131361980)
    RepayAdBannerView bvBanner;

    @BindView(2131362000)
    CheckBox cbCouponTip;

    @BindView(2131362391)
    ImageView ivRepayLogo;

    @BindView(2131362437)
    LinearLayout llAccountNumber;

    @BindView(2131362464)
    LinearLayout llCoupon;

    @BindView(2131362478)
    LinearLayout llErrorContent;

    @BindView(2131362502)
    LinearLayout llMap;

    @BindView(2131362535)
    LinearLayout llRepayChannel;

    @BindView(2131362529)
    LinearLayout llRepayChannelCannotUse;

    @BindView(2131362531)
    LinearLayout llRepayChannelNetError;

    @BindView(2131362636)
    NestedScrollView nsvRepayMethod;

    @BindView(2131362735)
    RelativeLayout rlSpeGuide;

    @BindView(2131362747)
    RecyclerView rvAccountNumber;

    @BindView(2131362753)
    RecyclerView rvChannelType;

    @BindView(2131362848)
    ShimmerLayout skeletonAccountNumberShimmerLayout;

    @BindView(2131362849)
    ShimmerLayout skeletonShimmerLayout;

    @BindView(2131362987)
    TextView tvAvailableAmount;

    @BindView(2131363033)
    TextView tvCouponTip;

    @BindView(2131363059)
    TextView tvDeductAmount;

    @BindView(2131363074)
    TextView tvFinalAmount;

    @BindView(2131363171)
    TextView tvRepayAmount;

    @BindView(2131363174)
    TextView tvRepayTitle;

    @BindView(2131363279)
    View vLineSpeGuide;

    private void G0(RepayVirtualAccountBean repayVirtualAccountBean, boolean z) {
        RepaymentMethodActivityViewModel repaymentMethodActivityViewModel = this.F;
        repaymentMethodActivityViewModel.P(repaymentMethodActivityViewModel.x(repayVirtualAccountBean));
        RepaymentMethodActivityViewModel repaymentMethodActivityViewModel2 = this.F;
        repaymentMethodActivityViewModel2.a(repaymentMethodActivityViewModel2.t());
        k1();
        refreshRepaySubChannel();
        refreshMapView();
        refreshRepayGeneralInfo(z);
        if (TextUtils.isEmpty(this.F.i())) {
            I0();
        } else {
            o1();
        }
    }

    private void H0(RepayVirtualAccountBean repayVirtualAccountBean) {
        if (repayVirtualAccountBean == null || TextUtils.isEmpty(repayVirtualAccountBean.changeChannel)) {
            return;
        }
        showLoadingDialog();
        HashMap hashMap = new HashMap();
        hashMap.put("currentChannel", this.F.B());
        hashMap.put("channel", repayVirtualAccountBean.changeChannel);
        hashMap.put(ThirdPartTrackEvents.Order.Keys.AMOUNT, this.F.u());
        hashMap.put("couponId", this.F.i());
        hashMap.put("instalmentIds", this.F.f());
        ((IApiRoutes) this.apiHelper.a()).i(hashMap).a(new CredMexObserver<RepayVirtualAccountResponse>(this) {
            public void onSuccess(RepayVirtualAccountResponse repayVirtualAccountResponse) {
                RepaymentMethodActivity.this.F.N(false);
                RepaymentMethodActivity.this.dismissLoadingDialog();
                RepaymentMethodActivity.this.t1(repayVirtualAccountResponse.body);
            }
        });
    }

    public void I0() {
        if (this.F.z() == null || !this.F.z().canBeUsed) {
            u1();
            return;
        }
        removeDisposable(this.J);
        this.J = null;
        showLoadingDialog();
        this.rvAccountNumber.setVisibility(8);
        HashMap hashMap = new HashMap();
        hashMap.put("channel", this.F.B());
        hashMap.put(ThirdPartTrackEvents.Order.Keys.AMOUNT, this.F.u());
        hashMap.put("couponId", this.F.i());
        hashMap.put("instalmentIds", this.F.f());
        ((IApiRoutes) this.apiHelper.a()).i(hashMap).a(new CredMexObserver<RepayVirtualAccountResponse>(this) {
            @Override
            public void onError(Throwable th, RepayVirtualAccountResponse repayVirtualAccountResponse) {
                super.onError(th, (Throwable) repayVirtualAccountResponse);
                if (repayVirtualAccountResponse.status.code == CredMexResponseCode.REPAY_CHANNEL_CANNOT_USE.code) {
                    RepaymentMethodActivity.this.u1();
                } else {
                    RepaymentMethodActivity.this.w1();
                }
                RepaymentMethodActivity.this.L0();
                RepaymentMethodActivity.this.reportFullyDisplayed();
            }

            public void onSuccess(RepayVirtualAccountResponse repayVirtualAccountResponse) {
                RepaymentMethodActivity.this.i1(repayVirtualAccountResponse);
                RepaymentMethodActivity.this.dismissLoadingDialog();
                RepaymentMethodActivity.this.L0();
                RepaymentMethodActivity.this.reportFullyDisplayed();
            }

            public void onSubscribe(Disposable disposable) {
                super.onSubscribe(disposable);
                RepaymentMethodActivity.this.J = disposable;
            }
        });
    }

    private String J0(@Nullable RepayVirtualAccountNewAndRepaymentCouponResponse repayVirtualAccountNewAndRepaymentCouponResponse) {
        return (repayVirtualAccountNewAndRepaymentCouponResponse == null || !repayVirtualAccountNewAndRepaymentCouponResponse.isSuccess()) ? getString(2131821037) : (repayVirtualAccountNewAndRepaymentCouponResponse.repayVirtualAccountNewResponse.isSuccess() || TextUtils.isEmpty(repayVirtualAccountNewAndRepaymentCouponResponse.repayVirtualAccountNewResponse.getErrorMsg())) ? (repayVirtualAccountNewAndRepaymentCouponResponse.repaymentCouponResponse.isSuccess() || TextUtils.isEmpty(repayVirtualAccountNewAndRepaymentCouponResponse.repaymentCouponResponse.getErrorMsg())) ? getString(2131821037) : repayVirtualAccountNewAndRepaymentCouponResponse.repaymentCouponResponse.getErrorMsg() : repayVirtualAccountNewAndRepaymentCouponResponse.repayVirtualAccountNewResponse.getErrorMsg();
    }

    private void K0(String str) {
        AutoRepayActivity.startAutoRepayActivity(this, str);
    }

    public void L0() {
        this.llAccountNumber.setVisibility(0);
        this.skeletonAccountNumberShimmerLayout.o();
        this.skeletonAccountNumberShimmerLayout.setVisibility(8);
    }

    public void M0() {
        this.skeletonShimmerLayout.o();
        this.skeletonShimmerLayout.setVisibility(8);
    }

    private void N0() {
        new BannerExposureHelper(this, this.nsvRepayMethod).d(this, this.bvBanner, new BannerExposureHelper.BannerExposureDelegate() {
            @Override
            public final void a(Object obj) {
                RepaymentMethodActivity.this.R0((BannerBean) obj);
            }
        });
    }

    private void O0() {
        ArrayList<BannerBean> q2 = this.F.q();
        if (CollectionUtils.a(q2)) {
            this.bvBanner.setVisibility(8);
        } else {
            this.bvBanner.setVisibility(0);
            this.bvBanner.j(q2, new OnItemClickListener() {
                public final void a(View view, int i2, Object obj) {
                    RepaymentMethodActivity.this.S0(view, i2, (BannerBean) obj);
                }
            });
        }
    }

    private void P0() {
        setWindowStatusBarColor(this, 2131099974);
        setToolbarPurple();
    }

    private void Q0() {
        e1(SensorTrackEvent.MEX_REPAY_METHOD_TUTORIAL_CLICK);
        String E = this.F.E();
        if (TextUtils.isEmpty(E)) {
            return;
        }
        Intent intent = new Intent((Context) this, (Class<?>) WebViewActivity.class);
        intent.putExtra("actionUrl", E);
        intent.putExtra(WebViewActivity.INTENT_KEY_IS_IMMERSIVE_MODE, true);
        jumpToWebPage(intent, (ActivityResultLauncher<Intent>) null);
    }

    public void R0(BannerBean bannerBean) {
        n1(SensorTrackEvent.MEX_REPAY_METHOD_BANNER_SHOW, bannerBean);
    }

    public void S0(View view, int i2, BannerBean bannerBean) {
        if (bannerBean != null && !TextUtils.isEmpty(bannerBean.redirectUrl)) {
            n1(SensorTrackEvent.MEX_REPAY_METHOD_BANNER_CLICK, bannerBean);
            RouteCenter.y(this, bannerBean.redirectUrl);
        }
        AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, bannerBean);
    }

    public void T0(SensorTrackEvent sensorTrackEvent, Map map) {
        map.putAll(sensorTrackEvent.getTrackEventParams());
        map.put(ThirdPartTrackEvents.Repay.Keys.REPAY_METHOD_CHANNEL_TYPE, this.F.B());
        map.put(ThirdPartTrackEvents.Repay.Keys.REPAY_METHOD_CHANNEL_NAME, this.F.A());
    }

    public static void U0(SensorTrackEvent sensorTrackEvent, String str, String str2, Map map) {
        map.putAll(sensorTrackEvent.getTrackEventParams());
        map.put(ThirdPartTrackEvents.Repay.Keys.REPAY_METHOD_CHANNEL_TYPE, str);
        map.put(ThirdPartTrackEvents.Repay.Keys.REPAY_METHOD_CHANNEL_NAME, str2);
    }

    public void V0(View view, int i2, RepayVirtualAccountBean repayVirtualAccountBean) {
        this.G.k(i2);
        AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, repayVirtualAccountBean);
    }

    public void W0(View view, int i2, RepayVirtualAccountBean repayVirtualAccountBean) {
        H0(repayVirtualAccountBean);
    }

    public void X0(View view, int i2, RepayVirtualAccountBean repayVirtualAccountBean) {
        if (repayVirtualAccountBean == null) {
            AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, repayVirtualAccountBean);
            return;
        }
        f1(SensorTrackEvent.MEX_REPAY_METHOD_CHANNEL_TYPE_CLICK, repayVirtualAccountBean.channelType, repayVirtualAccountBean.channelName);
        this.H.h(repayVirtualAccountBean.channelType);
        G0(repayVirtualAccountBean, false);
        AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, repayVirtualAccountBean);
    }

    public void Y0(SensorTrackEvent sensorTrackEvent, BannerBean bannerBean, Map map) {
        map.putAll(sensorTrackEvent.getTrackEventParams());
        map.put(ThirdPartTrackEvents.Repay.Keys.REPAY_METHOD_CHANNEL_TYPE, this.F.B());
        map.put(ThirdPartTrackEvents.Repay.Keys.REPAY_METHOD_CHANNEL_NAME, this.F.A());
        map.put(ThirdPartTrackEvents.Home.Keys.RESOURCE_ID, bannerBean.id);
        map.put(ThirdPartTrackEvents.Home.Keys.RESOURCE_URL, bannerBean.redirectUrl);
    }

    public void Z0(View view, int i2, Coupon coupon) {
        this.F.a(coupon);
        k1();
        o1();
        AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, coupon);
    }

    public void a1(View view, int i2, RepayVirtualAccountBean repayVirtualAccountBean) {
        if (repayVirtualAccountBean == null) {
            AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, repayVirtualAccountBean);
            return;
        }
        if (repayVirtualAccountBean.directDebit) {
            K0(repayVirtualAccountBean.channelType);
            AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, repayVirtualAccountBean);
        } else {
            if (!repayVirtualAccountBean.channelName.equals(this.F.A())) {
                G0(repayVirtualAccountBean, true);
                AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, repayVirtualAccountBean);
                return;
            }
            RepaymentMethodActivityViewModel repaymentMethodActivityViewModel = this.F;
            if (repaymentMethodActivityViewModel.o(repaymentMethodActivityViewModel.s())) {
                H0(this.F.s());
            }
            this.E.dismiss();
            AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, repayVirtualAccountBean);
        }
    }

    public void b1(Map map) {
        map.put(ThirdPartTrackEvents.Repay.Keys.CHANNEL_TYPE, this.F.B());
        map.put("is_success", Boolean.FALSE);
        map.put(ThirdPartTrackEvents.Repay.Keys.ERROR_MSG, "cannotUse");
    }

    public void c1(Map map) {
        map.put(ThirdPartTrackEvents.Repay.Keys.CHANNEL_TYPE, this.F.B());
        map.put("is_success", Boolean.TRUE);
    }

    public void d1(Map map) {
        map.put(ThirdPartTrackEvents.Repay.Keys.CHANNEL_TYPE, this.F.B());
        map.put("is_success", Boolean.FALSE);
        map.put(ThirdPartTrackEvents.Repay.Keys.ERROR_MSG, "netError");
    }

    public void e1(@NonNull final SensorTrackEvent sensorTrackEvent) {
        ThirdPartTrackLib.e(this, sensorTrackEvent.getEventKey(), new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                RepaymentMethodActivity.this.T0(sensorTrackEvent, map);
            }
        });
    }

    private void f1(@NonNull final SensorTrackEvent sensorTrackEvent, @NonNull final String str, @NonNull final String str2) {
        ThirdPartTrackLib.e(this, sensorTrackEvent.getEventKey(), new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                RepaymentMethodActivity.U0(SensorTrackEvent.this, str, str2, map);
            }
        });
    }

    public void g1(@Nullable RepayVirtualAccountNewAndRepaymentCouponResponse repayVirtualAccountNewAndRepaymentCouponResponse) {
        dismissLoadingDialog();
        reportFullyDisplayed();
        BaseUtils.e(getApplicationContext(), J0(repayVirtualAccountNewAndRepaymentCouponResponse));
        M0();
        q1(true);
    }

    public void h1(RepayVirtualAccountNewResponse repayVirtualAccountNewResponse) {
        this.F.O(repayVirtualAccountNewResponse);
        refreshRepayGeneralInfo(true);
        refreshRepaySubChannel();
        refreshMapView();
        O0();
        if (this.F.G()) {
            showRepayChannelDialog();
        }
    }

    public void i1(RepayVirtualAccountResponse repayVirtualAccountResponse) {
        if (repayVirtualAccountResponse == null || CollectionUtils.a(repayVirtualAccountResponse.body)) {
            w1();
            return;
        }
        v1();
        l1();
        s1(repayVirtualAccountResponse.body);
        refreshRepayAccountNumber(repayVirtualAccountResponse.body);
        refreshMapView();
        if (this.F.o(repayVirtualAccountResponse.body.get(0))) {
            DataTrackOnRecyclerViewItemClickListener dataTrackOnRecyclerViewItemClickListener = this.E;
            if (dataTrackOnRecyclerViewItemClickListener == null || !dataTrackOnRecyclerViewItemClickListener.isShowing()) {
                H0(repayVirtualAccountResponse.body.get(0));
            } else {
                this.F.L(repayVirtualAccountResponse.body.get(0));
            }
        }
    }

    public void j1(RepaymentCouponResponse repaymentCouponResponse) {
        RepaymentCouponResponse.BodyBean bodyBean;
        if (repaymentCouponResponse == null || (bodyBean = repaymentCouponResponse.body) == null) {
            return;
        }
        this.F.l(bodyBean.enabledCoupons, bodyBean.disabledCoupons);
        k1();
    }

    private void k1() {
        this.llCoupon.setVisibility(this.F.j() ? 8 : 0);
        Coupon h2 = this.F.h();
        this.tvAvailableAmount.setText(this.F.c(this));
        if (h2 == null) {
            this.tvAvailableAmount.setTextColor(getResources().getColor(2131099726));
            this.tvAvailableAmount.setTypeface(ResourcesCompat.getFont(this, 2131296259));
            this.tvAvailableAmount.setTextSize(1, 14.0f);
            this.cbCouponTip.setVisibility(8);
        } else {
            this.tvAvailableAmount.setTextColor(getResources().getColor(2131099745));
            this.tvAvailableAmount.setTypeface(ResourcesCompat.getFont(this, 2131296258));
            this.tvAvailableAmount.setTextSize(1, 16.0f);
            this.cbCouponTip.setVisibility(0);
        }
        l1();
    }

    private void l1() {
        this.tvFinalAmount.setText(FormatUtil.k(this.F.u()));
        this.tvRepayAmount.setVisibility(this.F.u().compareTo(this.F.g()) < 0 ? 0 : 8);
        this.tvRepayAmount.setText(String.valueOf(this.F.g()));
        this.tvRepayAmount.getPaint().setFlags(17);
    }

    private void m1() {
        if (!this.F.I()) {
            this.rlSpeGuide.setVisibility(8);
            this.vLineSpeGuide.setVisibility(8);
        } else {
            this.rlSpeGuide.setVisibility(0);
            this.vLineSpeGuide.setVisibility(0);
            e1(SensorTrackEvent.MEX_REPAY_METHOD_TUTORIAL_SHOW);
        }
    }

    private void n1(@NonNull final SensorTrackEvent sensorTrackEvent, final BannerBean bannerBean) {
        ThirdPartTrackLib.e(this, sensorTrackEvent.getEventKey(), new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                RepaymentMethodActivity.this.Y0(sensorTrackEvent, bannerBean, map);
            }
        });
    }

    public void o1() {
        showLoadingDialog();
        HashMap hashMap = new HashMap();
        hashMap.put(ThirdPartTrackEvents.Order.Keys.AMOUNT, this.F.g().toString());
        hashMap.put("couponId", this.F.i());
        hashMap.put("instalmentIds", this.F.f());
        ((IApiRoutes) this.apiHelper.a()).z0(hashMap).H(Schedulers.c()).t(AndroidSchedulers.a()).a(new CredMexObserver<CashBooleanResponse>(this) {
            public void onSuccess(CashBooleanResponse cashBooleanResponse) {
                RepaymentMethodActivity.this.dismissLoadingDialog();
                RepaymentMethodActivity.this.I0();
            }

            @Override
            public void onError(Throwable th, CashBooleanResponse cashBooleanResponse) {
                super.onError(th, (Throwable) cashBooleanResponse);
                RepaymentMethodActivity.this.I0();
            }
        });
    }

    private void p1() {
        showLoadingDialog();
        Observable.O(((IApiRoutes) this.apiHelper.a()).I(this.F.g().toString(), this.F.f(), this.F.H()), ((IApiRoutes) this.apiHelper.a()).b1(this.F.g().toString(), this.F.f()), new BiFunction() {
            public final Object apply(Object obj, Object obj2) {
                return new RepayVirtualAccountNewAndRepaymentCouponResponse((Response) obj, (Response) obj2);
            }
        }).a(new Observer<RepayVirtualAccountNewAndRepaymentCouponResponse>() {
            public void onNext(@io.reactivex.annotations.NonNull RepayVirtualAccountNewAndRepaymentCouponResponse repayVirtualAccountNewAndRepaymentCouponResponse) {
                if (repayVirtualAccountNewAndRepaymentCouponResponse == null || !repayVirtualAccountNewAndRepaymentCouponResponse.isSuccess() || !repayVirtualAccountNewAndRepaymentCouponResponse.repayVirtualAccountNewResponse.isSuccess() || !repayVirtualAccountNewAndRepaymentCouponResponse.repaymentCouponResponse.isSuccess()) {
                    RepaymentMethodActivity.this.g1(repayVirtualAccountNewAndRepaymentCouponResponse);
                    return;
                }
                RepaymentMethodActivity.this.h1(repayVirtualAccountNewAndRepaymentCouponResponse.repayVirtualAccountNewResponse);
                RepaymentMethodActivity.this.j1(repayVirtualAccountNewAndRepaymentCouponResponse.repaymentCouponResponse);
                RepaymentMethodActivity.this.dismissLoadingDialog();
                RepaymentMethodActivity.this.M0();
                RepaymentMethodActivity.this.q1(false);
                if (TextUtils.isEmpty(RepaymentMethodActivity.this.F.i())) {
                    RepaymentMethodActivity.this.I0();
                } else {
                    RepaymentMethodActivity.this.o1();
                }
                RepaymentMethodActivity.this.e1(SensorTrackEvent.MEX_REPAY_METHOD_SHOW);
            }

            public void onError(@io.reactivex.annotations.NonNull Throwable th) {
                RepaymentMethodActivity.this.g1(null);
            }

            public void onSubscribe(@io.reactivex.annotations.NonNull Disposable disposable) {
                RepaymentMethodActivity.super.onSubscribe(disposable);
            }

            public void onComplete() {
            }
        });
    }

    public void q1(boolean z) {
        if (z) {
            this.llErrorContent.setVisibility(0);
            this.nsvRepayMethod.setVisibility(8);
            setToolbarBright();
            ((BaseActivity) this).f.setNavigationIcon(2131231018);
            return;
        }
        this.llErrorContent.setVisibility(8);
        this.nsvRepayMethod.setVisibility(0);
        setToolbarPurple();
        ((BaseActivity) this).f.setNavigationIcon(2131231019);
    }

    private void r1() {
        N0();
        this.llRepayChannel.setOnClickListener(new View.OnClickListener() {
            @Override
            @SensorsDataInstrumented
            public void onClick(View view) {
                RepaymentMethodActivity.this.showRepayChannelDialog();
                RepaymentMethodActivity.this.e1(SensorTrackEvent.MEX_REPAY_METHOD_CHANGE_CHANNEL_TYPE_CLICK);
                SensorsDataAutoTrackHelper.trackViewOnClick(view);
                AutoTrackHelper.trackViewOnClick(view);
            }
        });
        ViewUtil.b(this.cbCouponTip, 20);
        this.cbCouponTip.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            @SensorsDataInstrumented
            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                if (z) {
                    RepaymentMethodActivity.this.y1();
                } else {
                    RepaymentMethodActivity.this.tvCouponTip.setVisibility(8);
                    if (RepaymentMethodActivity.this.I != null) {
                        RepaymentMethodActivity.this.I.cancel();
                    }
                }
                SensorsDataAutoTrackHelper.trackViewOnClick(compoundButton);
                AutoTrackHelper.b(compoundButton, z);
            }
        });
    }

    private void s1(List<RepayVirtualAccountBean> list) {
        if (CollectionUtils.a(list) || list.size() == 1) {
            return;
        }
        CommonDialog.CommonDialogBuilder.c(this).q("dialog_multi_payment").h(2131231023).o(2131821029).m(2131821351, new b()).d(1).j(TextStyleUtil.j(FormatUtil.h(getString(2131821028), new Object[]{Integer.valueOf(list.size()), list.get(0).channelLimitAmount}), new TextStyleUtil.TextStyleInfo().a(Boolean.TRUE).c(2131099734))).a().show();
    }

    public static void startRepaymentMethodActivity(Activity activity, ArrayList<String> arrayList, Coupon coupon, ArrayList<RepayTermsBean> arrayList2) {
        startRepaymentMethodActivity(activity, arrayList, coupon, arrayList2, false);
    }

    public void t1(List<RepayVirtualAccountBean> list) {
        RepayAccountNumberBottomDialog repayAccountNumberBottomDialog = this.K;
        if (repayAccountNumberBottomDialog == null) {
            this.K = new RepayAccountNumberBottomDialog(this, list);
        } else {
            repayAccountNumberBottomDialog.j(list);
        }
        this.K.show();
    }

    public void u1() {
        ThirdPartTrackLib.e(this, ThirdPartTrackEvents.Repay.MEX_REPAY_METHOD_SELECT, new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                RepaymentMethodActivity.this.b1(map);
            }
        });
        this.llRepayChannelCannotUse.setVisibility(0);
        this.llRepayChannelNetError.setVisibility(8);
        this.rvAccountNumber.setVisibility(8);
    }

    private void v1() {
        ThirdPartTrackLib.e(this, ThirdPartTrackEvents.Repay.MEX_REPAY_METHOD_SELECT, new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                RepaymentMethodActivity.this.c1(map);
            }
        });
        this.rvAccountNumber.setVisibility(0);
        this.llRepayChannelNetError.setVisibility(8);
        this.llRepayChannelCannotUse.setVisibility(8);
    }

    public void w1() {
        ThirdPartTrackLib.e(this, ThirdPartTrackEvents.Repay.MEX_REPAY_METHOD_SELECT, new TrackEventParamsConfigurator() {
            @Override
            public final void a(Map map) {
                RepaymentMethodActivity.this.d1(map);
            }
        });
        this.llRepayChannelNetError.setVisibility(0);
        this.llRepayChannelCannotUse.setVisibility(8);
        this.rvAccountNumber.setVisibility(8);
    }

    private void x1() {
        this.nsvRepayMethod.setVisibility(8);
        this.llErrorContent.setVisibility(8);
        this.skeletonShimmerLayout.setVisibility(0);
        this.skeletonShimmerLayout.n();
        this.llAccountNumber.setVisibility(8);
        this.skeletonAccountNumberShimmerLayout.setVisibility(0);
        this.skeletonAccountNumberShimmerLayout.n();
    }

    public void y1() {
        CountDownTimer countDownTimer = this.I;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
        if (this.I == null) {
            this.I = new CountDownTimer(SplashActivity.COUNT_DOWN_WITH_SPLASH_DURATION, 1000L) {
                @Override
                public void onFinish() {
                    RepaymentMethodActivity.this.tvCouponTip.setVisibility(8);
                    RepaymentMethodActivity.this.cbCouponTip.setChecked(false);
                }

                @Override
                public void onTick(long j2) {
                }
            };
        }
        this.I.start();
        this.tvCouponTip.setVisibility(0);
    }

    @Override
    protected void G(@NonNull Bundle bundle) {
        super.G(bundle);
        Coupon coupon = (Coupon) bundle.getSerializable("select_coupon");
        ArrayList<String> stringArrayList = bundle.getStringArrayList("instalment_id_list");
        ArrayList<RepayTermsBean> arrayList = (ArrayList) bundle.getSerializable("repay_terms_bean_list");
        boolean z = bundle.getBoolean("repayment_is_show_new_channel", false);
        RepaymentMethodActivityViewModel repaymentMethodActivityViewModel = this.F;
        if (repaymentMethodActivityViewModel != null) {
            repaymentMethodActivityViewModel.m(coupon, arrayList, stringArrayList);
            this.F.N(z);
        }
    }

    @Override
    protected void K() {
        x1();
        P0();
        r1();
        k1();
    }

    @Override
    protected void X(@NonNull Bundle bundle) {
        super.X(bundle);
        bundle.putStringArrayList("instalment_id_list", this.F.f());
        bundle.putSerializable("repay_terms_bean_list", this.F.b());
        bundle.putSerializable("select_coupon", this.F.h());
        bundle.putBoolean("repayment_is_show_new_channel", this.F.H());
    }

    public void finish() {
        Intent intent = getIntent();
        intent.putExtra("repay_terms_bean_list", this.F.b());
        setResult(2001, intent);
        super/*android.app.Activity*/.finish();
    }

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

    @Override
    protected void onCreate(Bundle bundle) {
        this.F = (RepaymentMethodActivityViewModel) new ViewModelProvider(this).get(RepaymentMethodActivityViewModel.class);
        super.onCreate(bundle);
    }

    @Override
    protected void onDestroy() {
        CouponBottomSelectDialog couponBottomSelectDialog = this.D;
        if (couponBottomSelectDialog != null) {
            couponBottomSelectDialog.dismiss();
        }
        RepayChannelBottomDialog repayChannelBottomDialog = this.E;
        if (repayChannelBottomDialog != null) {
            repayChannelBottomDialog.dismiss();
        }
        CountDownTimer countDownTimer = this.I;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
        super.onDestroy();
    }

    @Override
    protected void onResume() {
        super.onResume();
        RepaymentMethodActivityViewModel repaymentMethodActivityViewModel = this.F;
        if (repaymentMethodActivityViewModel == null || repaymentMethodActivityViewModel.k()) {
            finish();
        }
        p1();
    }

    @OnClick({2131361967, 2131363238, 2131362464, 2131362732, 2131362735, 2131363239})
    public void onViewClick(View view) {
        if (BaseUtils.b()) {
        }
        switch (view.getId()) {
            case 2131361967:
                this.llErrorContent.setVisibility(8);
                p1();
                break;
            case 2131362464:
                showCouponDialog();
                e1(SensorTrackEvent.MEX_REPAY_METHOD_COUPON_CLICK);
                break;
            case 2131362732:
                if (!TextUtils.isEmpty(this.F.C())) {
                    jumpToWebPage(this.F.C());
                    e1(SensorTrackEvent.MEX_REPAY_METHOD_MAP_CLICK);
                    break;
                }
                break;
            case 2131362735:
                Q0();
                break;
            case 2131363238:
                showRepayChannelDialog();
                break;
            case 2131363239:
                I0();
                break;
        }
    }

    public void refreshMapView() {
        if (TextUtils.isEmpty(this.F.C())) {
            this.llMap.setVisibility(8);
        } else {
            this.llMap.setVisibility(0);
            e1(SensorTrackEvent.MEX_REPAY_METHOD_MAP_SHOW);
        }
    }

    public void refreshRepayAccountNumber(List<RepayVirtualAccountBean> list) {
        RepayAccountNumberAdapter repayAccountNumberAdapter = this.G;
        if (repayAccountNumberAdapter != null) {
            repayAccountNumberAdapter.f(list);
            return;
        }
        RepayAccountNumberAdapter repayAccountNumberAdapter2 = new RepayAccountNumberAdapter(this, list);
        this.G = repayAccountNumberAdapter2;
        repayAccountNumberAdapter2.j(new OnItemClickListener() {
            public final void a(View view, int i2, Object obj) {
                RepaymentMethodActivity.this.V0(view, i2, (RepayVirtualAccountBean) obj);
            }
        });
        this.G.i(new RepayAccountNumberAdapter.OnChangeChannelClickListener() {
            @Override
            public final void a(View view, int i2, Object obj) {
                RepaymentMethodActivity.this.W0(view, i2, (RepayVirtualAccountBean) obj);
            }
        });
        this.rvAccountNumber.setFocusable(false);
        this.rvAccountNumber.setNestedScrollingEnabled(false);
        this.rvAccountNumber.setLayoutManager(new LinearLayoutManager(this));
        this.rvAccountNumber.setHasFixedSize(true);
        this.rvAccountNumber.setItemAnimator(new DefaultItemAnimator());
        this.rvAccountNumber.setAdapter(this.G);
    }

    public void refreshRepayChannelDialog() {
        RepayChannelBottomDialog repayChannelBottomDialog = this.E;
        if (repayChannelBottomDialog != null) {
            repayChannelBottomDialog.t(this.F.r(), this.F.A(), this.F.y());
        }
    }

    public void refreshRepayGeneralInfo(boolean z) {
        RepayVirtualAccountBean z2 = this.F.z();
        if (z2 != null) {
            if (!this.F.n() || this.F.J()) {
                this.tvDeductAmount.setVisibility(8);
            } else {
                this.tvDeductAmount.setText("-" + FormatUtil.k(z2.repayChannelDeductAmount));
                this.tvDeductAmount.setVisibility(0);
            }
            Imager.a().b(this, this.F.v(), this.ivRepayLogo);
            this.tvRepayTitle.setText(z2.channelName);
        }
        l1();
        m1();
    }

    public void refreshRepaySubChannel() {
        ArrayList<RepayVirtualAccountBean> D = this.F.D();
        if (CollectionUtils.a(D)) {
            this.rvChannelType.setVisibility(8);
            return;
        }
        if (!this.F.J()) {
            this.rvChannelType.setVisibility(8);
            return;
        }
        this.rvChannelType.setVisibility(0);
        int min = Math.min(D.size(), 3);
        if (this.H != null) {
            this.rvChannelType.getLayoutManager().setSpanCount(min);
            this.H.d(D);
            return;
        }
        RepaySubChannelAdapter repaySubChannelAdapter = new RepaySubChannelAdapter(this, D, this.F.B());
        this.H = repaySubChannelAdapter;
        repaySubChannelAdapter.g(new OnItemClickListener() {
            public final void a(View view, int i2, Object obj) {
                RepaymentMethodActivity.this.X0(view, i2, (RepayVirtualAccountBean) obj);
            }
        });
        this.rvChannelType.setFocusable(false);
        this.rvChannelType.setNestedScrollingEnabled(false);
        this.rvChannelType.setLayoutManager(new GridLayoutManager(this, min));
        this.rvChannelType.setHasFixedSize(true);
        this.rvChannelType.setItemAnimator(new DefaultItemAnimator());
        this.rvChannelType.setAdapter(this.H);
    }

    @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);
    }

    public void showCouponDialog() {
        if (this.F.j()) {
            return;
        }
        CouponBottomSelectDialog couponBottomSelectDialog = this.D;
        if (couponBottomSelectDialog != null) {
            couponBottomSelectDialog.dismiss();
        }
        this.D = new CouponBottomSelectDialog(this, this.F.d(), getString(2131821181), new OnItemClickListener() {
            public final void a(View view, int i2, Object obj) {
                RepaymentMethodActivity.this.Z0(view, i2, (Coupon) obj);
            }
        });
        if (this.F.h() != null) {
            this.D.k(this.F.h().id);
        }
        this.D.show();
    }

    public void showRepayChannelDialog() {
        RepayChannelBottomDialog repayChannelBottomDialog = this.E;
        if (repayChannelBottomDialog != null) {
            repayChannelBottomDialog.dismiss();
        }
        ?? repayChannelBottomDialog2 = new RepayChannelBottomDialog(this, this.F.r(), this.F.A(), this.F.y(), new OnItemClickListener() {
            public final void a(View view, int i2, Object obj) {
                RepaymentMethodActivity.this.a1(view, i2, (RepayVirtualAccountBean) obj);
            }
        });
        this.E = repayChannelBottomDialog2;
        repayChannelBottomDialog2.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialogInterface) {
                RepaymentMethodActivity.this.F.N(false);
            }
        });
        this.E.show();
        this.F.M(true);
        e1(SensorTrackEvent.MEX_REPAY_METHOD_DIALOG_SHOW);
    }

    public static void startRepaymentMethodActivity(Activity activity, ArrayList<String> arrayList, Coupon coupon, ArrayList<RepayTermsBean> arrayList2, boolean z) {
        Intent intent = new Intent(activity, (Class<?>) RepaymentMethodActivity.class);
        intent.putExtra("instalment_id_list", arrayList);
        intent.putExtra("select_coupon", coupon);
        intent.putExtra("repay_terms_bean_list", arrayList2);
        intent.putExtra("repayment_is_show_new_channel", z);
        activity.startActivityForResult(intent, 1010);
    }
}