导航菜单

页面标题

页面副标题

Credmex v3.12.2 - SearchBankActivity.java 源代码

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

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


package com.credmex.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.activity.result.ActivityResultLauncher;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import com.credmex.adapters.HeaderFooterWrapper;
import com.credmex.adapters.OnItemClickListener;
import com.credmex.adapters.SearchBankListAdapter;
import com.credmex.commom.CommonActivity;
import com.credmex.models.bank.SupportedBankBean;
import com.credmex.track.ThirdPartEventUtils;
import com.credmex.widght.navigationGroup.indexBar.helper.IndexBarDataHelperImpl;
import com.credmex.widght.navigationGroup.suspension.decoration.SuspensionDecoration;
import com.open.mx.ui.model.LabelBean;
import com.veda.android.bananalibrary.infrastructure.BaseActivity;
import com.veda.supertoolkit.customtools.CollectionUtils;
import com.veda.supertoolkit.lifecycle.LifecycleEvent;
import com.yangqianguan.statistics.AutoTrackHelper;
import io.reactivex.disposables.Disposable;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;

public class SearchBankActivity extends CommonActivity {
    public static final String PARAM_BANK_INFO = "paramBankInfo";
    public static final String PARAM_COMMON_BANK = "paramCommonBank";
    public static final String PARAM_FULL_BANK = "paramFullBank";
    private ArrayList<SupportedBankBean> D;
    private ArrayList<SupportedBankBean> E;
    private ArrayList<SupportedBankBean> F;
    private HeaderFooterWrapper G;
    private SearchBankListAdapter H;

    @BindView(2131362182)
    AppCompatEditText etSearchBank;

    @BindView(2131362763)
    RecyclerView rvFullBanks;

    @BindView(2131362734)
    RecyclerView rvSearchBanks;

    private void e0() {
        if (!CollectionUtils.a(this.F)) {
            for (int i2 = 0; i2 < this.F.size(); i2++) {
                SupportedBankBean supportedBankBean = this.F.get(i2);
                supportedBankBean.setTop(true);
                supportedBankBean.setIndexTag("↑");
            }
            this.E.addAll(0, this.F);
        }
        IndexBarDataHelperImpl indexBarDataHelperImpl = new IndexBarDataHelperImpl();
        indexBarDataHelperImpl.d(this.E);
        indexBarDataHelperImpl.a(this.E);
    }

    private void f0() {
        this.rvFullBanks.setLayoutManager(new LinearLayoutManager(this));
        SearchBankListAdapter searchBankListAdapter = new SearchBankListAdapter(this, this.E);
        searchBankListAdapter.d(new OnItemClickListener() {
            public final void a(View view, int i2, Object obj) {
                SearchBankActivity.this.h0(view, i2, (SupportedBankBean) obj);
            }
        });
        View inflate = LayoutInflater.from(this).inflate(2131558530, (ViewGroup) null);
        inflate.setLayoutParams(new ViewGroup.LayoutParams(-1, -2));
        HeaderFooterWrapper headerFooterWrapper = new HeaderFooterWrapper(searchBankListAdapter);
        this.G = headerFooterWrapper;
        headerFooterWrapper.b(inflate);
        this.rvFullBanks.setAdapter(this.G);
        SuspensionDecoration suspensionDecoration = new SuspensionDecoration(this, this.E);
        suspensionDecoration.f(1);
        suspensionDecoration.d(ContextCompat.getColor(this, 2131099728));
        suspensionDecoration.e(ContextCompat.getColor(this, 2131099726));
        this.rvFullBanks.addItemDecoration(suspensionDecoration);
    }

    private void g0() {
        this.rvSearchBanks.setLayoutManager(new LinearLayoutManager(this));
        SearchBankListAdapter searchBankListAdapter = new SearchBankListAdapter(this, this.D);
        this.H = searchBankListAdapter;
        this.rvSearchBanks.setAdapter(searchBankListAdapter);
        this.H.d(new OnItemClickListener() {
            public final void a(View view, int i2, Object obj) {
                SearchBankActivity.this.i0(view, i2, (SupportedBankBean) obj);
            }
        });
    }

    public void h0(View view, int i2, SupportedBankBean supportedBankBean) {
        k0(supportedBankBean);
        AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, supportedBankBean);
    }

    public void i0(View view, int i2, SupportedBankBean supportedBankBean) {
        k0(supportedBankBean);
        AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, supportedBankBean);
    }

    public void j0(String str) {
        if (CollectionUtils.a(this.E)) {
            return;
        }
        this.D.clear();
        if (str.length() == 0) {
            this.rvSearchBanks.setVisibility(8);
            this.rvFullBanks.setVisibility(0);
            this.H.notifyDataSetChanged();
            return;
        }
        Iterator<SupportedBankBean> it = this.E.iterator();
        while (it.hasNext()) {
            SupportedBankBean next = it.next();
            if (((LabelBean) next).label.toLowerCase().contains(str.toLowerCase())) {
                this.D.add(next);
            }
        }
        this.H.notifyDataSetChanged();
        this.rvSearchBanks.setVisibility(0);
        this.rvFullBanks.setVisibility(8);
    }

    private void k0(SupportedBankBean supportedBankBean) {
        Intent intent = new Intent();
        intent.putExtra(PARAM_BANK_INFO, (Serializable) supportedBankBean);
        setResult(-1, intent);
        finish();
    }

    public static void startSearchBankActivity(Activity activity, ArrayList<SupportedBankBean> arrayList, ArrayList<SupportedBankBean> arrayList2) {
        Intent intent = new Intent(activity, (Class<?>) SearchBankActivity.class);
        Bundle bundle = new Bundle();
        bundle.putSerializable(PARAM_FULL_BANK, arrayList);
        bundle.putSerializable(PARAM_COMMON_BANK, arrayList2);
        intent.putExtras(bundle);
        activity.startActivityForResult(intent, 1006);
    }

    @Override
    protected void D() {
        super.D();
        e0();
        f0();
        g0();
    }

    @Override
    protected void G(@NonNull Bundle bundle) {
        super.G(bundle);
        this.E = (ArrayList) bundle.getSerializable(PARAM_FULL_BANK);
        this.F = (ArrayList) bundle.getSerializable(PARAM_COMMON_BANK);
        this.D = new ArrayList<>();
    }

    @Override
    protected void K() {
        super.K();
        ((BaseActivity) this).f.setNavigationIcon(2131230998);
        this.etSearchBank.addTextChangedListener(new TextWatcher() {
            @Override
            public void afterTextChanged(Editable editable) {
                SearchBankActivity.this.j0(editable.toString());
            }

            @Override
            public void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
            }
        });
        ThirdPartEventUtils.f(this.etSearchBank);
    }

    @Override
    protected void X(@NonNull Bundle bundle) {
        super.X(bundle);
        bundle.putSerializable(PARAM_FULL_BANK, this.E);
    }

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

    @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 static void startSearchBankActivity(Activity activity, ArrayList<SupportedBankBean> arrayList, ArrayList<SupportedBankBean> arrayList2, ActivityResultLauncher<Intent> activityResultLauncher) {
        Intent intent = new Intent(activity, (Class<?>) SearchBankActivity.class);
        Bundle bundle = new Bundle();
        bundle.putSerializable(PARAM_FULL_BANK, arrayList);
        bundle.putSerializable(PARAM_COMMON_BANK, arrayList2);
        intent.putExtras(bundle);
        activityResultLauncher.launch(intent);
    }
}