what-the-bank/sources/com/scb/phone/view/fragment/landingpage/GroupFavoriteFragment.java

297 lines
9.9 KiB
Java

package com.scb.phone.view.fragment.landingpage;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.scb.phone.R;
import com.scb.phone.view.activity.BaseActivity;
import com.scb.phone.view.activity.investment.InvestmentDetailsActivity;
import com.scb.phone.view.activity.personalize.ShortcutRouterActivity;
import com.scb.phone.view.activity.promptpay.PromptPayQRActivity;
import com.scb.phone.view.adapter.landingpage.TileAdapter;
import com.scb.phone.view.fragment.landingpage.GroupFavoriteFragment;
import java.util.List;
import java.util.NoSuchElementException;
import o.C0907Rf;
import o.C12914fKz;
import o.GEP;
import o.InterfaceC13391fZD;
import o.InterfaceC6678cZu;
import o.Jel;
import o.PRA;
import o.YKU;
import o.bMZ;
import o.bVA;
import o.fSJ;
import o.fSQ;
import o.glR;
import o.nMh;
import o.vaj;
import o.zEQ;
/* loaded from: classes5.dex */
public class GroupFavoriteFragment extends Hilt_GroupFavoriteFragment implements InterfaceC6678cZu {
private boolean d;
private fSJ f;
private fSJ g;
@InterfaceC13391fZD
public bMZ groupFavoritePresenter;
private C0907Rf.Sts j;
@BindView
TextView mEmptyTextView;
@BindView
RelativeLayout mRemoveTileLayout;
@BindView
TextView mRemoveTileTextView;
@BindView
ImageView mTrashImageView;
@Override // o.InterfaceC12854fJL
public final void G() {
}
@Override // o.InterfaceC6633cYk
public final void o() {
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.2131559684, viewGroup, false);
ButterKnife.c(this, inflate);
this.g = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_ADD_TILE_TO_CHILD")).subscribe(new fSQ(this) { // from class: o.flB
private GroupFavoriteFragment c;
@Override // o.fSQ
public final void c(Object obj) {
GroupFavoriteFragment.a(this.c);
}
{
this.c = this;
}
}, new fSQ() { // from class: o.flD
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
this.f = glR.Ge_(getActivity(), new IntentFilter("com.scb.phone/BROADCAST_SHOW_QUICK_OPERATION_SNACK_BAR")).subscribe(new fSQ(this) { // from class: o.flG
private GroupFavoriteFragment a;
@Override // o.fSQ
public final void c(Object obj) {
GroupFavoriteFragment.avm_(this.a, (Intent) obj);
}
{
this.a = this;
}
}, new fSQ() { // from class: o.flD
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
C0907Rf.Sts sts = (C0907Rf.Sts) getActivity().getIntent().getParcelableExtra("EXTRA_TILE_PROPERTIES");
this.j = sts;
if (sts == null) {
getActivity().finish();
}
String a = bVA.a((int) this.j.x);
if (a != null) {
((BaseActivity) getActivity()).scbAnalytics.c(a);
}
super.aa();
Y();
Z();
u(this.j.K);
e(this.mRecyclerView, this.mRemoveTileLayout, null);
bMZ bmz = this.groupFavoritePresenter;
bmz.e((bMZ) this);
bmz.a = this;
this.groupFavoritePresenter.c(this.j.x);
return inflate;
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroy() {
fSJ fsj = this.g;
if (fsj != null && !fsj.isDisposed()) {
this.g.dispose();
}
fSJ fsj2 = this.f;
if (fsj2 != null && !fsj2.isDisposed()) {
this.f.dispose();
}
this.groupFavoritePresenter.w_();
super.onDestroy();
}
@Override // com.scb.phone.view.fragment.BaseFragment
public final void aa() {
super.aa();
Y();
Z();
u(this.j.K);
}
@Override // o.InterfaceC12854fJL
public final void d_(boolean z) {
Resources resources;
int i;
this.mTrashImageView.setColorFilter(nMh.getColor(getContext(), z ? R.color.f3462131099854 : R.color.f14042131100912), PorterDuff.Mode.SRC_ATOP);
TextView textView = this.mRemoveTileTextView;
if (z) {
resources = getResources();
i = R.dimen.f28292131166595;
} else {
resources = getResources();
i = R.dimen.f28172131166583;
}
textView.setTextSize(2, resources.getDimensionPixelSize(i) / getResources().getDisplayMetrics().density);
}
@Override // o.InterfaceC12854fJL
public final void d(long j) {
this.groupFavoritePresenter.d(j);
}
@Override // o.InterfaceC6633cYk
public final void b(C0907Rf.Sts sts) {
if (this.d) {
return;
}
this.d = true;
ShortcutRouterActivity.b(getContext(), sts);
}
@Override // o.InterfaceC6633cYk
public final void j() {
startActivity(new Intent(getContext(), (Class<?>) InvestmentDetailsActivity.class));
}
@Override // o.InterfaceC6633cYk
public final void f() {
startActivity(new Intent(getActivity(), (Class<?>) PromptPayQRActivity.class));
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.scb.phone.view.fragment.landingpage.BaseDragAndDropFragment
public final void e(long j) {
this.groupFavoritePresenter.b(j);
}
@Override // o.InterfaceC12854fJL
public final void a(long j, long j2) {
this.groupFavoritePresenter.c(j, j2);
}
@Override // com.scb.phone.view.fragment.BaseFragment, o.InterfaceC6638cYp
public final void v() {
this.mRecyclerView.setVisibility(8);
this.mEmptyTextView.setVisibility(8);
super.v();
}
@Override // com.scb.phone.view.fragment.BaseFragment, o.InterfaceC6638cYp
public final void aq_() {
super.aq_();
if (this.mRecyclerView != null) {
this.mRecyclerView.setVisibility(0);
}
}
@Override // androidx.fragment.app.Fragment
public void onResume() {
super.onResume();
this.d = false;
}
@Override // o.InterfaceC6678cZu
public final void l() {
this.mEmptyTextView.setVisibility(0);
this.mEmptyTextView.setText(String.format(getString(R.string.empty_favorite), this.j.K));
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.scb.phone.view.fragment.landingpage.BaseDragAndDropFragment, o.InterfaceC6633cYk
public final void c(final long j) {
zEQ d;
TileAdapter tileAdapter = ((BaseDragAndDropFragment) this).c;
List<C0907Rf.Sts> list = (List) new YKU(tileAdapter.e).b(new Jel(j) { // from class: o.ewc
private long b;
@Override // o.Jel
public final boolean e(Object obj) {
return TileAdapter.d(this.b, (C0907Rf.Sts) obj);
}
{
this.b = j;
}
}).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8()));
YKU yku = new YKU(list);
int c = (int) (new YKU(yku.a, new vaj(yku.b, new Jel() { // from class: o.ewg
@Override // o.Jel
public final boolean e(Object obj) {
return TileAdapter.b((C0907Rf.Sts) obj);
}
})).c() % 3);
YKU yku2 = new YKU(tileAdapter.e);
YKU yku3 = new YKU(yku2.a, new GEP(yku2.b, new Jel() { // from class: o.ewm
@Override // o.Jel
public final boolean e(Object obj) {
return TileAdapter.e((C0907Rf.Sts) obj);
}
}));
if (yku3.b.hasNext()) {
d = zEQ.a(yku3.b.next());
} else {
d = zEQ.d();
}
if (d.d != 0) {
T t = d.d;
if (t == 0) {
throw new NoSuchElementException("No value present");
}
((C0907Rf.Sts) t).H = 3 - c;
}
tileAdapter.e(list);
if (((BaseDragAndDropFragment) this).c.getItemCount() == 2) {
l();
}
}
public static /* synthetic */ void a(GroupFavoriteFragment groupFavoriteFragment) {
groupFavoriteFragment.e(groupFavoriteFragment.mRecyclerView, groupFavoriteFragment.mRemoveTileLayout, null);
groupFavoriteFragment.groupFavoritePresenter.c(groupFavoriteFragment.j.x);
}
public static /* synthetic */ void avm_(GroupFavoriteFragment groupFavoriteFragment, Intent intent) {
boolean booleanExtra = intent.getBooleanExtra("com.scb.phone.EXTRA_SHOW_SNACK_BAR", false);
boolean booleanExtra2 = intent.getBooleanExtra("com.scb.phone.EXTRA_IS_SUCCESS", true);
if (!booleanExtra || groupFavoriteFragment.getActivity() == null) {
return;
}
FragmentActivity activity = groupFavoriteFragment.getActivity();
int i = booleanExtra2 ? R.drawable.ic_check_circle_white_24dp : R.drawable.ic_error_white_24dp;
C12914fKz.e(new Object[]{activity, Integer.valueOf(R.id.view_group_root), Integer.valueOf(i), intent.getStringExtra("com.scb.phone.EXTRA_MESSAGE"), Integer.valueOf(booleanExtra2 ? R.color.f13832131100891 : R.color.f2852131099792), Integer.valueOf(((Integer) C12914fKz.e(new Object[]{groupFavoriteFragment.getActivity()}, 27586478, -27586464, (int) System.currentTimeMillis())).intValue())}, 1796001485, -1796001467, R.id.view_group_root);
}
}