what-the-bank/sources/com/scb/phone/view/fragment/bankingagent/BaseBankingAgentsFragment.java

172 lines
5.2 KiB
Java

package com.scb.phone.view.fragment.bankingagent;
import android.content.Context;
import android.os.SystemClock;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.scb.phone.R;
import com.scb.phone.view.adapter.bankingagent.BankingAgentAdapter;
import com.scb.phone.view.fragment.BaseFragment;
import java.util.ArrayList;
import java.util.List;
import o.C14957gcv;
import o.FE;
import o.InterfaceC12824fIT;
import o.InterfaceC16541pFg;
import o.InterfaceC6624cYb;
/* loaded from: classes5.dex */
public abstract class BaseBankingAgentsFragment extends BaseFragment implements InterfaceC6624cYb.Sts, InterfaceC12824fIT {
private HBt c;
private BankingAgentAdapter d;
private long j;
@BindView
protected RelativeLayout mEmptyCard;
@BindView
protected TextView mEmptyDescription;
@BindView
protected TextView mEmptyTitle;
@BindView
protected View mFooterView;
@BindView
protected RecyclerView mRecyclerView;
@BindView
protected View mTopView;
/* loaded from: classes5.dex */
public interface HBt {
void d(FE fe);
}
public abstract void d();
@Override // com.scb.phone.view.fragment.Hilt_BaseFragment, androidx.fragment.app.Fragment
public void onAttach(Context context) {
C14957gcv.e(context, "");
super.onAttach(context);
if (getParentFragment() instanceof HBt) {
InterfaceC16541pFg parentFragment = getParentFragment();
C14957gcv.d(parentFragment, "");
this.c = (HBt) parentFragment;
}
}
@Override // androidx.fragment.app.Fragment
public void onDetach() {
this.c = null;
super.onDetach();
}
@Override // o.InterfaceC6624cYb.Sts
public final void b(List<FE> list) {
C14957gcv.e(list, "");
RecyclerView recyclerView = this.mRecyclerView;
RecyclerView recyclerView2 = null;
if (recyclerView == null) {
C14957gcv.a("");
recyclerView = null;
}
recyclerView.setVisibility(0);
View view = this.mFooterView;
if (view == null) {
C14957gcv.a("");
view = null;
}
view.setVisibility(0);
View view2 = this.mTopView;
if (view2 == null) {
C14957gcv.a("");
view2 = null;
}
view2.setVisibility(0);
BankingAgentAdapter bankingAgentAdapter = this.d;
if (bankingAgentAdapter == null) {
Context requireContext = requireContext();
C14957gcv.c(requireContext, "");
List<FE> list2 = list;
C14957gcv.e(list2, "");
this.d = new BankingAgentAdapter(requireContext, new ArrayList(list2), this);
} else {
C14957gcv.e(bankingAgentAdapter);
C14957gcv.e(list, "");
bankingAgentAdapter.b.clear();
bankingAgentAdapter.b.addAll(list);
bankingAgentAdapter.notifyDataSetChanged();
}
RecyclerView recyclerView3 = this.mRecyclerView;
if (recyclerView3 == null) {
C14957gcv.a("");
recyclerView3 = null;
}
recyclerView3.setNestedScrollingEnabled(false);
RecyclerView recyclerView4 = this.mRecyclerView;
if (recyclerView4 != null) {
recyclerView2 = recyclerView4;
} else {
C14957gcv.a("");
}
recyclerView2.setAdapter(this.d);
}
@Override // o.InterfaceC12824fIT
public final void a(int i) {
HBt hBt;
if (SystemClock.elapsedRealtime() - this.j < 300) {
return;
}
BankingAgentAdapter bankingAgentAdapter = this.d;
if (bankingAgentAdapter != null) {
FE fe = !bankingAgentAdapter.b.isEmpty() ? bankingAgentAdapter.b.get(i) : null;
if (fe != null && (hBt = this.c) != null) {
hBt.d(fe);
}
}
this.j = SystemClock.elapsedRealtime();
}
@Override // o.InterfaceC6624cYb.Sts
public final void c() {
TextView textView = this.mEmptyTitle;
RelativeLayout relativeLayout = null;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(getResources().getString(R.string.banking_select_agent_error_title));
TextView textView2 = this.mEmptyDescription;
if (textView2 == null) {
C14957gcv.a("");
textView2 = null;
}
textView2.setText(getResources().getString(R.string.banking_select_agent_error_description));
RelativeLayout relativeLayout2 = this.mEmptyCard;
if (relativeLayout2 != null) {
relativeLayout = relativeLayout2;
} else {
C14957gcv.a("");
}
relativeLayout.setVisibility(0);
}
@OnClick
public final void onEmptyLayoutClick() {
RelativeLayout relativeLayout = this.mEmptyCard;
if (relativeLayout == null) {
C14957gcv.a("");
relativeLayout = null;
}
relativeLayout.setVisibility(8);
d();
}
}