导航菜单

页面标题

页面副标题

Easycash v3.75.13 - ECQuickRepayManageActivity.java 源代码

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

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


package com.lingyue.easycash.business.quickrepay;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.lingyue.easycash.R;
import com.lingyue.easycash.commom.EasyCashCommonActivity;
import com.lingyue.easycash.models.DirectDebitEnableAccount;
import com.lingyue.easycash.models.enums.DirectDebitGuidePageStrategy;
import com.lingyue.easycash.models.event.QuickRepayNewCardBindEvent;
import com.lingyue.easycash.models.response.DirectDebitBankInfo;
import com.lingyue.easycash.models.response.DirectDebitQueryResponse;
import com.lingyue.easycash.utils.EasycashUmengEvent;
import com.lingyue.easycash.utils.H5DialogUtil;
import com.lingyue.easycash.utils.SensorTrackEvent;
import com.lingyue.easycash.widght.EasycashQuickRepaymentDialog;
import com.lingyue.easycash.widght.bottomDialog.EasyCashBottomQuickRepayDialog;
import com.lingyue.idnbaselib.framework.lifecycle.LifecycleEvent;
import com.lingyue.idnbaselib.model.AppResourceReportPageType;
import com.lingyue.idnbaselib.model.IdnObserver;
import com.lingyue.idnbaselib.model.response.BooleanResponse;
import com.lingyue.idnbaselib.utils.DevUtil;
import com.lingyue.idnbaselib.utils.JsonParamsBuilder;
import com.lingyue.idnbaselib.utils.ThirdPartEventUtils;
import com.lingyue.idnbaselib.widget.OnItemClickListener;
import com.lingyue.supertoolkit.customtools.CollectionUtils;
import com.lingyue.supertoolkit.widgets.BaseUtils;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.yangqianguan.statistics.AutoTrackHelper;
import io.reactivex.disposables.Disposable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONException;
import org.json.JSONObject;

public class ECQuickRepayManageActivity extends EasyCashCommonActivity {
    private QuickRepayManageListAdapter B;
    private String C;
    private String D;

    @BindView(R.id.btn_add_bank)
    Button btnAddBank;

    @BindView(R.id.rv_bank_list)
    RecyclerView rvBankList;

    @BindView(R.id.tv_no_more)
    TextView tvNoMore;

    @BindView(R.id.tv_title)
    TextView tvTitle;
    public List<DirectDebitBankInfo> supportBankList = new ArrayList();
    public List<DirectDebitEnableAccount> enabledAccountList = new ArrayList();

    static class AnonymousClass3 {
        static final int[] a;

        static {
            int[] iArr = new int[DirectDebitGuidePageStrategy.values().length];
            a = iArr;
            try {
                iArr[DirectDebitGuidePageStrategy.PAGE_A.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[DirectDebitGuidePageStrategy.PAGE_B.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[DirectDebitGuidePageStrategy.ORIGINAL_PAGE.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[DirectDebitGuidePageStrategy.UNKNOWN.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
        }
    }

    @NonNull
    private String a0(@NonNull String str, @NonNull String str2) {
        return Uri.parse(this.appGlobal.a.a().toString()).buildUpon().path(str).appendQueryParameter("bank", str2).appendQueryParameter("test_name", this.D).appendQueryParameter("reqSpeBar", "1").appendQueryParameter("isAppBarHid", "1").build().toString();
    }

    private void b0(@NonNull String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        int i = AnonymousClass3.a[DirectDebitGuidePageStrategy.fromName(this.D).ordinal()];
        if (i == 1) {
            H5DialogUtil.v(this, a0("rc/popup/quick-payment-celebrate-popup", str), "QuickPayGuideDialog", AppResourceReportPageType.REPAYMENT_PAGE.name());
            return;
        }
        if (i == 2) {
            H5DialogUtil.v(this, a0("rc/popup/quick-payment-ticket-popup", str), "QuickPayGuideDialog", AppResourceReportPageType.REPAYMENT_PAGE.name());
        } else if (i == 3 || i == 4) {
            jumpToWebPage(a0("webview/bank-card-example", str));
        }
    }

    private void c0() {
        this.a.setVisibility(this.userSession.f().showCustomerService ? 0 : 8);
        this.a.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                ECQuickRepayManageActivity.this.d0(view);
            }
        });
    }

    @SensorsDataInstrumented
    public void d0(View view) {
        if (BaseUtils.l()) {
            SensorsDataAutoTrackHelper.trackViewOnClick(view);
            AutoTrackHelper.trackViewOnClick(view);
        } else {
            openCustomerService();
            SensorsDataAutoTrackHelper.trackViewOnClick(view);
            AutoTrackHelper.trackViewOnClick(view);
        }
    }

    public void e0(DirectDebitBankInfo directDebitBankInfo) {
        if (directDebitBankInfo == null) {
            return;
        }
        j0(directDebitBankInfo.bankValue);
        b0(directDebitBankInfo.bankValue);
    }

    public void f0(DialogInterface dialogInterface) {
        ThirdPartEventUtils.D(this, EasycashUmengEvent.F4, new JsonParamsBuilder().d("source").a("quickRepayManage").c());
        k0();
    }

    @SensorsDataInstrumented
    public static void g0(DialogInterface dialogInterface, int i) {
        if (BaseUtils.l()) {
            SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
            AutoTrackHelper.trackViewOnClick(dialogInterface, i);
        } else {
            dialogInterface.dismiss();
            SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
            AutoTrackHelper.trackViewOnClick(dialogInterface, i);
        }
    }

    @SensorsDataInstrumented
    public void h0(DirectDebitEnableAccount directDebitEnableAccount, DialogInterface dialogInterface, int i) {
        if (BaseUtils.l()) {
            SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
            AutoTrackHelper.trackViewOnClick(dialogInterface, i);
        } else {
            m0("DISABLED", directDebitEnableAccount.accountId);
            dialogInterface.dismiss();
            SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i);
            AutoTrackHelper.trackViewOnClick(dialogInterface, i);
        }
    }

    public void i0(View view, int i, final DirectDebitEnableAccount directDebitEnableAccount) {
        if (BaseUtils.l()) {
            AutoTrackHelper.trackRecyclerViewItemOnClick(view, i, directDebitEnableAccount);
            return;
        }
        if (DirectDebitEnableAccount.STATUS.ENABLED == DirectDebitEnableAccount.STATUS.fromName(directDebitEnableAccount.status)) {
            EasycashQuickRepaymentDialog easycashQuickRepaymentDialog = new EasycashQuickRepaymentDialog(this);
            easycashQuickRepaymentDialog.e(directDebitEnableAccount.bankBasicInfo.bankLabel);
            easycashQuickRepaymentDialog.j(getString(R.string.easycash_confirm_disable_quick_pay));
            easycashQuickRepaymentDialog.c(directDebitEnableAccount.bankBasicInfo.logoUrl);
            easycashQuickRepaymentDialog.f(directDebitEnableAccount.maskedAccountNumber);
            easycashQuickRepaymentDialog.g(getString(2131887733), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    ECQuickRepayManageActivity.g0(dialogInterface, i2);
                }
            });
            easycashQuickRepaymentDialog.h(getString(R.string.easycash_disable), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    ECQuickRepayManageActivity.this.h0(directDebitEnableAccount, dialogInterface, i2);
                }
            });
            easycashQuickRepaymentDialog.show();
        } else {
            m0("ENABLED", directDebitEnableAccount.accountId);
        }
        AutoTrackHelper.trackRecyclerViewItemOnClick(view, i, directDebitEnableAccount);
    }

    private void j0(@NonNull String str) {
        try {
            SensorTrackEvent sensorTrackEvent = SensorTrackEvent.EC_OPEN_QUICK_REPAY_BANK_ENTER_CLICK;
            JSONObject a = sensorTrackEvent.a();
            a.put("entry_page", "个人中心设置页面入口");
            a.put("pay_source", str);
            a.put(com.umeng.analytics.pro.d.M, this.C);
            ThirdPartEventUtils.Q(this, sensorTrackEvent, a);
        } catch (JSONException e) {
            DevUtil.a(e);
        }
    }

    private void l0() {
        QuickRepayManageListAdapter quickRepayManageListAdapter = new QuickRepayManageListAdapter(this, this.enabledAccountList);
        this.B = quickRepayManageListAdapter;
        quickRepayManageListAdapter.d(new OnItemClickListener() {
            public final void a(View view, int i, Object obj) {
                ECQuickRepayManageActivity.this.i0(view, i, (DirectDebitEnableAccount) obj);
            }
        });
        this.rvBankList.setLayoutManager(new LinearLayoutManager(this));
        this.rvBankList.setAdapter(this.B);
        DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this, 1);
        Drawable drawable = ContextCompat.getDrawable(this, R.drawable.easycash_shape_line);
        Objects.requireNonNull(drawable);
        dividerItemDecoration.setDrawable(drawable);
        this.rvBankList.addItemDecoration(dividerItemDecoration);
    }

    private void m0(String str, int i) {
        showLoadingDialog();
        this.apiHelper.a().e1(str, i).a(new IdnObserver<BooleanResponse>(this) {
            @Override
            public void onSuccess(BooleanResponse booleanResponse) {
                ECQuickRepayManageActivity.this.n0();
            }
        });
    }

    public void n0() {
        showLoadingDialog();
        this.apiHelper.a().y0().a(new IdnObserver<DirectDebitQueryResponse>(this) {
            @Override
            public void onError(Throwable th, DirectDebitQueryResponse directDebitQueryResponse) {
                super.onError(th, (Throwable) directDebitQueryResponse);
                ECQuickRepayManageActivity.this.tvNoMore.setVisibility(0);
                ECQuickRepayManageActivity.this.rvBankList.setVisibility(8);
                ECQuickRepayManageActivity.this.tvTitle.setVisibility(8);
                ECQuickRepayManageActivity.this.btnAddBank.setVisibility(8);
            }

            @Override
            public void onSuccess(DirectDebitQueryResponse directDebitQueryResponse) {
                if (!directDebitQueryResponse.body.isEnable()) {
                    ECQuickRepayManageActivity.this.tvNoMore.setVisibility(0);
                    ECQuickRepayManageActivity.this.rvBankList.setVisibility(8);
                    ECQuickRepayManageActivity.this.tvTitle.setVisibility(8);
                    ECQuickRepayManageActivity.this.btnAddBank.setVisibility(8);
                    ECQuickRepayManageActivity.this.dismissLoadingDialog();
                    return;
                }
                ECQuickRepayManageActivity.this.C = directDebitQueryResponse.body.provider;
                ECQuickRepayManageActivity.this.D = directDebitQueryResponse.body.guidePageStrategy;
                if (CollectionUtils.f(directDebitQueryResponse.body.linkedAccountList)) {
                    ECQuickRepayManageActivity.this.tvNoMore.setVisibility(0);
                    ECQuickRepayManageActivity.this.tvTitle.setVisibility(8);
                } else {
                    ECQuickRepayManageActivity.this.enabledAccountList.clear();
                    ECQuickRepayManageActivity.this.enabledAccountList.addAll(directDebitQueryResponse.body.linkedAccountList);
                    ECQuickRepayManageActivity.this.B.notifyDataSetChanged();
                    ECQuickRepayManageActivity.this.rvBankList.setVisibility(0);
                    ECQuickRepayManageActivity.this.tvNoMore.setVisibility(8);
                    ECQuickRepayManageActivity.this.tvTitle.setVisibility(0);
                }
                ECQuickRepayManageActivity.this.supportBankList.clear();
                ECQuickRepayManageActivity.this.supportBankList.addAll(directDebitQueryResponse.body.supportBankList);
                ECQuickRepayManageActivity eCQuickRepayManageActivity = ECQuickRepayManageActivity.this;
                eCQuickRepayManageActivity.btnAddBank.setVisibility(CollectionUtils.f(eCQuickRepayManageActivity.supportBankList) ? 8 : 0);
                ECQuickRepayManageActivity.this.dismissLoadingDialog();
            }
        });
    }

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

    @Override
    protected void D() {
        super.D();
        c0();
        l0();
    }

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

    protected void k0() {
        try {
            SensorTrackEvent sensorTrackEvent = SensorTrackEvent.EC_OPEN_QUICK_REPAY_BANK_ENTER_SHOW;
            JSONObject a = sensorTrackEvent.a();
            a.put("entry_page", "个人中心设置页面入口");
            a.put(com.umeng.analytics.pro.d.M, this.C);
            ThirdPartEventUtils.Q(this, sensorTrackEvent, a);
        } catch (JSONException e) {
            DevUtil.a(e);
        }
    }

    @OnClick({R.id.btn_add_bank})
    public void onClickAddBank() {
        if (BaseUtils.l() || CollectionUtils.f(this.supportBankList)) {
            return;
        }
        EasyCashBottomQuickRepayDialog easyCashBottomQuickRepayDialog = new EasyCashBottomQuickRepayDialog(this, this.supportBankList, new EasyCashBottomQuickRepayDialog.CallBack() {
            @Override
            public final void a(DirectDebitBankInfo directDebitBankInfo) {
                ECQuickRepayManageActivity.this.e0(directDebitBankInfo);
            }
        });
        easyCashBottomQuickRepayDialog.setOnShowListener(new DialogInterface.OnShowListener() {
            @Override
            public final void onShow(DialogInterface dialogInterface) {
                ECQuickRepayManageActivity.this.f0(dialogInterface);
            }
        });
        easyCashBottomQuickRepayDialog.show();
    }

    @Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
    public void onQuickRepayNewCardBindEvent(QuickRepayNewCardBindEvent quickRepayNewCardBindEvent) {
        EventBus.c().q(quickRepayNewCardBindEvent);
        n0();
    }

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

    @Override
    protected void z() {
        super.z();
        n0();
    }
}