package com.apkpure.aegon.main.mainfragment; import android.content.Context; import android.content.res.TypedArray; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.apkpure.aegon.R; import com.apkpure.aegon.app.newcard.model.AppCardData; import com.apkpure.aegon.application.AegonApplication; import com.apkpure.aegon.application.RealApplicationLike; import com.apkpure.aegon.minigames.TopGamesViewHolder; import com.apkpure.aegon.minigames.widget.MiniGameGridView; import com.apkpure.aegon.minigames.widget.MiniGameHorizontalCard; import com.apkpure.aegon.plugin.topon.api1.IAdErrorDelegate; import com.apkpure.aegon.widgets.MultiTypeRecyclerView; import com.chad.library.adapter.base.BaseMultiItemQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.entity.MultiItemEntity; import com.google.android.gms.common.internal.ServiceSpecificExtraArgs; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; import com.tencent.trpcprotocol.projecta.common.card_data.nano.CardData; import com.tencent.trpcprotocol.projecta.common.common_card.nano.CommonCardItem; import com.tencent.trpcprotocol.projecta.common.game_info.nano.GameInfo; import e.g.a.c.n.n.j; import e.g.a.f.f; import e.g.a.h0.b.h; import e.g.a.i0.a0; import e.g.a.i0.g0; import e.g.a.i0.p1; import e.g.a.i0.r1; import e.g.a.i0.w; import e.g.a.t.b.i; import e.g.a.t.e.j1; import e.g.a.t.e.r; import e.g.a.t.e.s; import e.g.a.t.e.u; import e.g.a.t.e.v; import e.g.a.u.k; import e.g.a.u.q; import e.g.a.u.r.m; import e.g.a.u.r.o; import e.g.a.u.r.p; import e.g.a.u.t.e; import e.w.c.e.b.l; import i.i.d.e.d; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Objects; import k.g.c; import o.o.g; import p.a.v0; public class MiniGamesFragment extends i implements BaseQuickAdapter.RequestLoadMoreListener, j.b { public static final /* synthetic */ int J = 0; public boolean A = false; public boolean B = false; public boolean C = true; public long H = 0; public boolean I; /* renamed from: g reason: collision with root package name */ public MultiTypeRecyclerView f1755g; /* renamed from: h reason: collision with root package name */ public H5CardAdapter f1756h; /* renamed from: i reason: collision with root package name */ public FrameLayout f1757i; /* renamed from: j reason: collision with root package name */ public AppBarLayout f1758j; /* renamed from: k reason: collision with root package name */ public CollapsingToolbarLayout f1759k; /* renamed from: l reason: collision with root package name */ public ImageView f1760l; /* renamed from: m reason: collision with root package name */ public Toolbar f1761m; /* renamed from: n reason: collision with root package name */ public TextView f1762n; /* renamed from: o reason: collision with root package name */ public int f1763o = 1; /* renamed from: p reason: collision with root package name */ public boolean f1764p = false; /* renamed from: q reason: collision with root package name */ public boolean f1765q = false; /* renamed from: r reason: collision with root package name */ public String f1766r; /* renamed from: s reason: collision with root package name */ public boolean f1767s = false; /* renamed from: t reason: collision with root package name */ public int f1768t = 0; public boolean u = false; public boolean v = false; public long w; public long x; public long y; public long z; public static class H5CardAdapter extends BaseMultiItemQuickAdapter<b, BaseViewHolder> { public H5CardAdapter(List<b> list) { super(list); addItemType(3, R.layout.arg_RES_2131493377); addItemType(1, R.layout.arg_RES_2131493373); addItemType(2, R.layout.arg_RES_2131493374); addItemType(4, R.layout.arg_RES_2131493375); } @Override // com.chad.library.adapter.base.BaseQuickAdapter public void convert(BaseViewHolder baseViewHolder, Object obj) { b bVar = (b) obj; Boolean bool = Boolean.FALSE; int itemViewType = baseViewHolder.getItemViewType(); CommonCardItem commonCardItem = bVar.b; boolean z = false; if (itemViewType != 1) { String str = "discover_new_games"; if (itemViewType == 2) { MiniGameGridView miniGameGridView = (MiniGameGridView) baseViewHolder.getView(R.id.arg_RES_2131296730); if (commonCardItem.dataType == 6) { z = true; } if (z) { miniGameGridView.setDiscoverNewGameGardNumbers(bVar.c); } miniGameGridView.setParentView(miniGameGridView); miniGameGridView.B0(commonCardItem); int layoutPosition = baseViewHolder.getLayoutPosition(); o.s.c.j.e(miniGameGridView, "cardView"); e.g.a.s.l.a.O0(miniGameGridView, 1120, str, layoutPosition, bool); } else if (itemViewType == 3) { ((TextView) baseViewHolder.getView(R.id.arg_RES_2131296734)).setText(commonCardItem.title); LinearLayout linearLayout = (LinearLayout) baseViewHolder.getView(R.id.arg_RES_2131297707); int i2 = commonCardItem.dataType; int layoutPosition2 = baseViewHolder.getLayoutPosition(); o.s.c.j.e(linearLayout, "cardView"); if (i2 == 7) { str = "editor_choice"; } else if (i2 == 8) { str = "trending_games"; } else if (i2 != 9) { str = ""; } e.g.a.s.l.a.O0(linearLayout, 1120, str, layoutPosition2, bool); MiniGameGridView miniGameGridView2 = (MiniGameGridView) baseViewHolder.getView(R.id.arg_RES_2131296730); miniGameGridView2.setParentView(linearLayout); miniGameGridView2.B0(commonCardItem); } else if (itemViewType == 4) { if (baseViewHolder.getAssociatedObject() == null) { baseViewHolder.setAssociatedObject(new TopGamesViewHolder(this.mContext, baseViewHolder)); } Object associatedObject = baseViewHolder.getAssociatedObject(); if (associatedObject instanceof TopGamesViewHolder) { TopGamesViewHolder topGamesViewHolder = (TopGamesViewHolder) associatedObject; Objects.requireNonNull(topGamesViewHolder); o.s.c.j.e(commonCardItem, "commonCardItem"); CardData[] cardDataArr = commonCardItem.data; List m2 = cardDataArr == null ? null : g.m(cardDataArr); if (m2 != null) { topGamesViewHolder.d = e.g.a.s.l.a.e0(topGamesViewHolder.f1811a); topGamesViewHolder.b.setText(commonCardItem.title); RecyclerView recyclerView = topGamesViewHolder.c; recyclerView.setLayoutManager(new LinearLayoutManager(topGamesViewHolder.f1811a)); recyclerView.setHasFixedSize(true); RecyclerView.e adapter = recyclerView.getAdapter(); if (!(adapter instanceof TopGamesViewHolder.a)) { recyclerView.setAdapter(new TopGamesViewHolder.a(topGamesViewHolder, m2)); recyclerView.h(new q(topGamesViewHolder.f1811a)); } else { ((TopGamesViewHolder.a) adapter).setNewData(m2); } } } View view = baseViewHolder.itemView; int layoutPosition3 = baseViewHolder.getLayoutPosition(); o.s.c.j.e(view, "cardView"); e.g.a.s.l.a.O0(view, 1140, "top_games", layoutPosition3, bool); } } else { ((TextView) baseViewHolder.getView(R.id.arg_RES_2131296734)).setText(commonCardItem.title); LinearLayout linearLayout2 = (LinearLayout) baseViewHolder.getView(R.id.arg_RES_2131297707); o.s.c.j.e(linearLayout2, "cardView"); e.g.a.s.l.a.O0(linearLayout2, 1119, "recently_played", 0, bool); MiniGameHorizontalCard miniGameHorizontalCard = (MiniGameHorizontalCard) baseViewHolder.getView(R.id.arg_RES_2131296730); miniGameHorizontalCard.setParentView(linearLayout2); miniGameHorizontalCard.B0(commonCardItem); } } } public class a implements l.a.i<List<b>> { public final /* synthetic */ boolean b; public a(boolean z) { this.b = z; } @Override // l.a.i public void b(Throwable th) { MiniGamesFragment.this.f1755g.d(null, th); MiniGamesFragment.this.f1756h.loadMoreFail(); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // l.a.i public void d(List<b> list) { List<b> list2 = list; MiniGamesFragment.this.f1756h.loadMoreComplete(); if (this.b) { MiniGamesFragment.this.f1756h.setNewData(list2); } else { MiniGamesFragment.this.f1756h.addData((Collection) list2); } MiniGamesFragment miniGamesFragment = MiniGamesFragment.this; if (!miniGamesFragment.f1764p) { miniGamesFragment.f1756h.loadMoreEnd(true); } } @Override // l.a.i public void g(l.a.l.b bVar) { } @Override // l.a.i public void onComplete() { MiniGamesFragment.this.y = System.currentTimeMillis(); MiniGamesFragment miniGamesFragment = MiniGamesFragment.this; boolean z = miniGamesFragment.u; if (!z) { miniGamesFragment.z = miniGamesFragment.y - miniGamesFragment.x; } if (!z && miniGamesFragment.v) { miniGamesFragment.u = true; long j2 = miniGamesFragment.w; long j3 = miniGamesFragment.y; long j4 = miniGamesFragment.z; HashMap<String, Object> e2 = f.b().e(); if (e2 == null) { e2 = new HashMap<>(); } e2.put("pop_type", "page_mini_game_pop"); e2.put("pop_id", Long.valueOf(k.f7244a)); e2.put("pv_id", "page_pop"); e.g.a.h0.b.o.a d = f.b().d(); if (d != null) { e2.put(AppCardData.KEY_SCENE, Long.valueOf(d.scene)); } e2.put("first_show_page_time", Long.valueOf(j2)); e2.put("req_end_time", Long.valueOf(j3)); e2.put("req_time", Long.valueOf(j4)); h.o("AppMiniGameLoad", null, e2); } MiniGamesFragment miniGamesFragment2 = MiniGamesFragment.this; if (miniGamesFragment2.f1756h != null && miniGamesFragment2.v) { miniGamesFragment2.L1(); } if (MiniGamesFragment.this.f1756h.getData().size() == 0) { MiniGamesFragment.this.f1755g.h(R.string.arg_RES_2131821181); } else { MiniGamesFragment.this.f1755g.a(); } } } public static class b implements MultiItemEntity { public CommonCardItem b; public int c; public int d; public b(int i2) { this.d = i2; } @Override // com.chad.library.adapter.base.entity.MultiItemEntity public int getItemType() { return this.d; } } public static MiniGamesFragment M1() { MiniGamesFragment miniGamesFragment = new MiniGamesFragment(); miniGamesFragment.setArguments(new Bundle()); return miniGamesFragment; } @Override // e.g.a.t.b.i public boolean F1() { return true; } @Override // e.g.a.t.b.i public void I1() { super.I1(); if (this.C) { View view = getView(); this.f1767s = e.g.a.u.j.b().a(this.c).size() > 0; t0(view); CoordinatorLayout coordinatorLayout = (CoordinatorLayout) view.findViewById(R.id.arg_RES_2131297714); this.f1757i = (FrameLayout) view.findViewById(R.id.arg_RES_2131298323); this.f1755g = (MultiTypeRecyclerView) view.findViewById(R.id.arg_RES_2131298234); this.f1758j = (AppBarLayout) view.findViewById(R.id.arg_RES_2131296444); this.f1759k = (CollapsingToolbarLayout) view.findViewById(R.id.arg_RES_2131296910); this.f1760l = (ImageView) view.findViewById(R.id.arg_RES_2131297349); this.f1761m = (Toolbar) view.findViewById(R.id.arg_RES_2131298667); this.f1762n = (TextView) view.findViewById(R.id.arg_RES_2131298668); this.f1758j.a(new j1(this)); w wVar = w.f6575a; wVar.g(this.f1761m, null); this.f1762n.setTextColor(wVar.j()); this.f1755g.setLayoutManager(new LinearLayoutManager(this.c)); MultiTypeRecyclerView multiTypeRecyclerView = this.f1755g; H5CardAdapter h5CardAdapter = new H5CardAdapter(new ArrayList()); this.f1756h = h5CardAdapter; multiTypeRecyclerView.setAdapter(h5CardAdapter); this.f1755g.setOnRefreshListener(new v(this)); this.f1755g.setErrorClickLister(new e.g.a.t.e.q(this)); this.f1755g.setNoDataClickLister(new r(this)); this.f1756h.setLoadMoreView(new r1()); this.f1756h.setOnLoadMoreListener(this, this.f1755g.getRecyclerView()); View view2 = new View(this.c); view2.setLayoutParams(new ViewGroup.LayoutParams(-1, p1.a(this.c, 58.0f))); this.f1756h.addFooterView(view2); N1(); e.g.a.s.l.a.c1(view.findViewById(R.id.arg_RES_2131298566), 2141); O1(); Context context = this.c; e.g.a.u.t.h hVar = e.g.a.u.t.h.f7316a; o.s.c.j.e(context, "mContext"); c.T(v0.b, null, null, new e.g.a.u.t.i(context, null), 3, null); this.C = false; } this.f1767s = e.g.a.u.j.b().a(this.c).size() > 0; g0.q(getActivity(), "mini-game", getClass().getSimpleName()); List<GameInfo> list = e.g.a.u.j.b().b; if (!i.i.d.c.H(list)) { b bVar = new b(1); bVar.b = new CommonCardItem(); if (TextUtils.isEmpty(this.f1766r)) { String string = getResources().getString(R.string.arg_RES_2131821060); bVar.b.title = string; this.f1766r = string; } else { bVar.b.title = this.f1766r; } bVar.b.data = new CardData[Math.min(list.size(), 30)]; int i2 = 0; while (i2 < list.size() && i2 < 30) { bVar.b.data[i2] = new CardData(); bVar.b.data[i2].gameInfo = list.get(i2); i2++; } H5CardAdapter h5CardAdapter2 = this.f1756h; if (!(h5CardAdapter2 == null || h5CardAdapter2.getData() == null || this.f1756h.getData().size() <= 0)) { if (this.f1765q) { this.f1756h.setData(0, bVar); } else { this.f1756h.addData(0, bVar); this.f1765q = true; } this.f1756h.notifyItemChanged(0); this.f1756h.notifyDataSetChanged(); } } O1(); m.d().f(o.QuitCenter, null); j.e(this); j.p(2142); j.p(2141); this.B = true; Q1(); if (this.d instanceof e.g.a.t.b.a) { e.g.a.h0.b.o.a aVar = new e.g.a.h0.b.o.a(); aVar.scene = 2141; ((e.g.a.t.b.a) this.d).Y1(aVar); } } @Override // e.g.a.t.b.i public void J1() { this.B = false; j jVar = j.f5065a; o.s.c.j.e(this, ServiceSpecificExtraArgs.CastExtraArgs.LISTENER); j.f5070i.add(this); j.p(2141); j.p(2142); } @Override // e.g.a.t.b.i public void K1() { H5CardAdapter h5CardAdapter; this.v = true; this.w = System.currentTimeMillis(); if (!this.u && (h5CardAdapter = this.f1756h) != null && !h5CardAdapter.getData().isEmpty()) { this.u = true; long j2 = this.w; long j3 = this.y; long j4 = this.z; HashMap<String, Object> e2 = f.b().e(); if (e2 == null) { e2 = new HashMap<>(); } e2.put("pop_type", "page_mini_game_pop"); e2.put("pop_id", Long.valueOf(k.f7244a)); e2.put("pv_id", "page_pop"); e.g.a.h0.b.o.a d = f.b().d(); if (d != null) { e2.put(AppCardData.KEY_SCENE, Long.valueOf(d.scene)); } e2.put("first_show_page_time", Long.valueOf(j2)); e2.put("req_end_time", Long.valueOf(j3)); e2.put("req_time", Long.valueOf(j4)); h.o("AppMiniGameLoad", null, e2); } if (this.f1756h != null) { L1(); } } public final void L1() { int i2; if (isAdded() && !j.f(2141) && !this.A && d.b(requireActivity()) && !this.I && !m.d().f7275h) { this.I = true; if (e.g.a.r.d.c.c == null) { synchronized (e.g.a.r.d.c.class) { if (e.g.a.r.d.c.c == null) { int i3 = AegonApplication.f1165e; Context context = RealApplicationLike.getContext(); o.s.c.j.d(context, "getContext()"); e.g.a.r.d.c.c = new e.g.a.r.d.c(context); } } } e.g.a.r.d.c cVar = e.g.a.r.d.c.c; o.s.c.j.c(cVar); String d = a0.d(); if (!TextUtils.isEmpty(d)) { o.s.c.j.e(d, "keyTimeStr"); try { String c = cVar.c("key_pre_game_center_shortcut_show_count", ""); if (c.length() > 0) { p pVar = (p) e.g.a.r.c.a.e(c, p.class); if (o.s.c.j.a(pVar == null ? null : pVar.b(), d)) { i2 = pVar.a(); if (e.g.a.u.t.j.a() != 0 && i2 < e.g.a.u.t.j.a() && !cVar.d("key_pre_game_center_shortcut", false)) { new e().F1(getChildFragmentManager()); o.s.c.j.e(d, "keyTimeStr"); String h2 = e.g.a.r.c.a.h(new p(d, i2 + 1)); o.s.c.j.d(h2, "objectToJson(ShortcutCen…Count(keyTimeStr, count))"); cVar.j("key_pre_game_center_shortcut_show_count", h2); return; } return; } } } catch (Exception unused) { } i2 = 0; if (e.g.a.u.t.j.a() != 0) { } } } } public final void N1() { long[] jArr; this.f1768t = 0; List<Long> a2 = e.g.a.u.j.b().a(this.c); if (!a2.isEmpty()) { if (a2.size() > 30) { a2 = a2.subList(0, 30); } e.g.a.u.j b2 = e.g.a.u.j.b(); Objects.requireNonNull(b2); o.s.c.j.e(a2, "list"); b2.f7243a = a2; jArr = new long[a2.size()]; for (int i2 = 0; i2 < a2.size(); i2++) { jArr[i2] = a2.get(i2).longValue(); } } else { jArr = new long[0]; } P1(true, jArr); } public final void O1() { if (this.f1767s) { TypedArray obtainStyledAttributes = this.c.obtainStyledAttributes(new int[]{R.attr.arg_RES_2130968581}); int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(0, 0); obtainStyledAttributes.recycle(); int a2 = p1.a(this.c, 1.0f) + dimensionPixelSize; this.f1760l.getLayoutParams().height = a2; this.f1759k.getLayoutParams().height = a2; this.f1758j.setExpanded(false); this.f1761m.setAlpha(1.0f); this.f1762n.setAlpha(1.0f); CollapsingToolbarLayout collapsingToolbarLayout = this.f1759k; w wVar = w.f6575a; collapsingToolbarLayout.setBackgroundColor(wVar.h(this.c)); this.f1762n.setTextColor(wVar.j()); this.f1760l.setVisibility(4); return; } this.f1760l.getLayoutParams().height = p1.a(this.c, 120.0f); this.f1760l.setVisibility(0); int i2 = AegonApplication.f1165e; e.f.a.e.c.Y(RealApplicationLike.getContext(), "https://image.winudf.com/v2/user/admin/YWRtaW5fbWluaV9nYW1lX2hlYWRlci5wbmdfMTY1Nzg1ODk1MjM3Ng/image.png?fakeurl=1", this.f1760l, new e.h.a.q.g()); } public final void P1(boolean z2, long[] jArr) { this.x = System.currentTimeMillis(); this.y = 0; new l.a.n.e.b.d(new u(this, jArr, z2)).f(new e.g.a.t.e.p(this)).l(l.a.p.a.f15787e).n(l.a.p.a.c).k(new s(this)).l(l.a.k.a.a.a()).a(new a(z2)); } public final void Q1() { if (this.A || System.currentTimeMillis() - this.H < 2000) { e.f.a.g.a.a("TopOnAds", "interstitial ad has shown", new Object[0]); } else if (isAdded() && this.B) { if (j.f(2141)) { j.y(this.d, 2141); } else { j.p(2141); } } } @Override // e.g.a.c.n.n.j.b public void V(int i2) { long j2 = (long) i2; if (j2 == 2141 || j2 == 2142) { this.A = true; this.H = System.currentTimeMillis(); } } @Override // e.g.a.t.b.i public String b1() { return "page_mini_game"; } @Override // e.g.a.c.n.n.j.b public void c(int i2) { } @Override // e.g.a.c.n.n.j.b public void d(int i2) { if (((long) i2) == 2141) { Q1(); } } @Override // e.g.a.c.n.n.j.b public void d0(int i2) { long j2 = (long) i2; if (j2 == 2141) { this.A = false; } if (j2 == 2141 || j2 == 2142) { this.H = System.currentTimeMillis(); } } @Override // e.g.a.c.n.n.j.b public void m0(int i2, IAdErrorDelegate iAdErrorDelegate) { } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.arg_RES_2131493179, viewGroup, false); l.b1(this, inflate); return inflate; } @Override // e.w.e.a.b.t.c.c, androidx.fragment.app.Fragment, e.g.a.t.b.i public void onDestroyView() { this.u = false; this.w = 0; this.v = false; super.onDestroyView(); } @Override // com.chad.library.adapter.base.BaseQuickAdapter.RequestLoadMoreListener public void onLoadMoreRequested() { P1(false, new long[0]); } @Override // e.g.a.t.b.i, e.g.a.t.b.h public long v1() { return 2141; } @Override // e.g.a.t.b.i public HashMap<String, Object> w0() { return super.w0(); } }