package com.tencent.mm.plugin.appbrand.ui; import a50.g; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.graphics.Color; import android.os.Looper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.view.ViewPropertyAnimator; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.tencent.midas.data.APMidasPluginInfo; import com.tencent.mm.R; import com.tencent.mm.plugin.appbrand.AppBrandRuntimeWC; import com.tencent.mm.plugin.appbrand.config.AppBrandGlobalSystemConfig; import com.tencent.mm.plugin.appbrand.config.AppBrandInitConfigWC; import com.tencent.mm.plugin.appbrand.config.WxaAttributes; import com.tencent.mm.plugin.appbrand.game.preload.f; import com.tencent.mm.plugin.appbrand.game.preload.ui.BootstrapProgressBar; import com.tencent.mm.plugin.appbrand.launching.h1; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.MMApplicationContext; import com.tencent.mm.sdk.platformtools.MMHandlerThread; import com.tencent.mm.sdk.platformtools.MTimerHandler; import com.tencent.mm.sdk.platformtools.Util; import com.tencent.mm.ui.x4; import ie1.h; import java.util.ArrayList; import mv0.z; import vf0.b; import wg4.b0; import xv0.e; import yz3.j; /* access modifiers changed from: package-private */ public final class k0 extends e4 implements h1 { public ImageView A; public ImageView B; public TextView C; public TextView D; public LinearLayout E; public AppBrandCircleProgressView F; public mv0.d G; public e.b H = e.b.PORTRAIT; public TextView I; public boolean J; public Runnable K = null; public RelativeLayout L; public boolean M = false; public boolean N = false; public boolean P = false; public int Q; public boolean R = false; public int S = 30; public RelativeLayout T; public ImageView U; public BootstrapProgressBar V; public boolean W; /* renamed from: p0 reason: collision with root package name */ public boolean f95741p0; /* renamed from: x reason: collision with root package name */ public AppBrandRuntimeWC f95742x; /* renamed from: x0 reason: collision with root package name */ public Boolean f95743x0; /* renamed from: y reason: collision with root package name */ public ImageView f95744y; /* renamed from: y0 reason: collision with root package name */ public boolean f95745y0 = false; /* renamed from: z reason: collision with root package name */ public ImageView f95746z; public class a implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ kh4.a f95747d; /* renamed from: com.tencent.mm.plugin.appbrand.ui.k0$a$a reason: collision with other inner class name */ public class C0947a extends AnimatorListenerAdapter { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ ViewParent f95749d; /* renamed from: com.tencent.mm.plugin.appbrand.ui.k0$a$a$a reason: collision with other inner class name */ public class RunnableC0948a implements Runnable { public RunnableC0948a() { } public void run() { Log.i("MicroMsg.AppBrandGameUILoadingSplash", "animateHide, remove splash"); k0.this.setVisibility(8); C0947a aVar = C0947a.this; ((ViewGroup) aVar.f95749d).removeView(k0.this); kh4.a aVar2 = a.this.f95747d; if (aVar2 != null) { aVar2.invoke(); } } } public C0947a(ViewParent viewParent) { this.f95749d = viewParent; } public void onAnimationEnd(Animator animator) { k0.this.post(new RunnableC0948a()); } } public a(kh4.a aVar) { this.f95747d = aVar; } public void run() { ViewParent parent = k0.this.getParent(); if (!(parent instanceof ViewGroup)) { Log.i("MicroMsg.AppBrandGameUILoadingSplash", "animateHide, wrong ViewGroup"); return; } k0.this.F.e(); ViewPropertyAnimator animate = k0.this.animate(); animate.setStartDelay((long) (((float) animate.getDuration()) * 0.8f)); animate.setDuration((long) (((float) animate.getDuration()) * 1.0f)); animate.setListener(new C0947a(parent)); animate.alpha(0.0f).start(); } } public class b implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ int f95752d; public b(int i15) { this.f95752d = i15; } public void run() { Log.i("MicroMsg.AppBrandGameUILoadingSplash", "onDataTransferState state=" + this.f95752d); if (this.f95752d == 3) { k0 k0Var = k0.this; if (k0Var.J) { k0Var.I.setVisibility(0); k0.this.I.setText(R.string.a0d); return; } k0Var.K = this; } } } public class c implements MTimerHandler.CallBack { /* renamed from: d reason: collision with root package name */ public float f95754d = 50.0f; public c(e0 e0Var) { } @Override // com.tencent.mm.sdk.platformtools.MTimerHandler.CallBack public boolean onTimerExpired() { float f15 = this.f95754d; if (f15 >= 100.0f) { return false; } this.f95754d = f15 + 0.33f; if (k0.this.T.getVisibility() != 0) { return true; } k0.this.V.setProgress(this.f95754d); return true; } } public class d implements MTimerHandler.CallBack { /* renamed from: d reason: collision with root package name */ public int f95756d = 50; public d(e0 e0Var) { } @Override // com.tencent.mm.sdk.platformtools.MTimerHandler.CallBack public boolean onTimerExpired() { int i15 = this.f95756d; if (i15 >= 100) { return false; } int i16 = i15 + 1; this.f95756d = i16; k0.this.F.setProgress(i16); if (this.f95756d == 100) { k0 k0Var = k0.this; k0Var.J = true; Runnable runnable = k0Var.K; if (runnable != null) { runnable.run(); k0.this.K = null; } } return true; } } public k0(Context context, AppBrandRuntimeWC appBrandRuntimeWC) { super(context); String str; String str2; this.f95742x = appBrandRuntimeWC; Log.i("MicroMsg.AppBrandGameUILoadingSplash", APMidasPluginInfo.LAUNCH_INTERFACE_INIT); int i15 = -1; setLayoutParams(new ViewGroup.LayoutParams(-1, -1)); LayoutInflater.from(getContext()).inflate(R.layout.f365404h6, this); this.T = (RelativeLayout) findViewById(R.id.f362256wy); this.U = (ImageView) findViewById(R.id.f362257wz); this.V = (BootstrapProgressBar) findViewById(R.id.f362258x0); f.a().b(999, 1); if (((h) j.c(h.class)).Lk0(h.c.f231952hf, false) && this.f95742x != null) { long currentTicks = Util.currentTicks(); AppBrandInitConfigWC f25 = this.f95742x.z1(); WxaAttributes.WxaVersionCoverImageInfo wxaVersionCoverImageInfo = f25.H.f85662i; if (wxaVersionCoverImageInfo == null) { str = null; } else { str = wxaVersionCoverImageInfo.f85655d; } if (!Util.isNullOrNil(str)) { this.M = true; Log.i("MicroMsg.AppBrandGameUILoadingSplash", "loadingImgUrl:%s", str); f.a().b(1000, 1); e04.a.a(new h0(this, str, new g0(this, currentTicks))); WxaAttributes.WxaVersionCoverImageInfo wxaVersionCoverImageInfo2 = f25.H.f85662i; if (wxaVersionCoverImageInfo2 == null) { str2 = null; } else { str2 = wxaVersionCoverImageInfo2.f85656e; } if (!Util.isNullOrNil(str2)) { int parseColor = Color.parseColor(str2); this.Q = parseColor; this.V.setProgressColor(parseColor); Log.i("MicroMsg.AppBrandGameUILoadingSplash", "loadingProgressBarColor:%s", Integer.valueOf(this.Q)); } else { int color = getContext().getResources().getColor(R.color.f358059cy); this.Q = color; this.V.setProgressColor(color); } this.V.setAnimated(true); this.V.setStriped(true); MMHandlerThread.postToMainThreadDelayed(new i0(this), 1000); MMHandlerThread.postToMainThreadDelayed(new j0(this), 2000); } else { f.a().b(1000, 0); } } this.L = (RelativeLayout) findViewById(R.id.f362268xa); ImageView imageView = (ImageView) findViewById(R.id.f362263x5); this.f95744y = imageView; imageView.setImageDrawable(vf0.a.h()); this.C = (TextView) findViewById(R.id.f362267x9); this.f95746z = (ImageView) findViewById(R.id.f362270xc); this.A = (ImageView) findViewById(R.id.x_); this.E = (LinearLayout) findViewById(R.id.f362260x2); this.I = (TextView) findViewById(R.id.ilx); AppBrandCircleProgressView appBrandCircleProgressView = (AppBrandCircleProgressView) findViewById(R.id.f362266x8); this.F = appBrandCircleProgressView; appBrandCircleProgressView.setCircleColor(getResources().getColor(R.color.BW_0_Alpha_0_1)); this.F.setDotWidth((float) getResources().getDimensionPixelSize(R.dimen.f359455n7)); this.F.setDotColor(getResources().getColor(R.color.f357939m)); this.F.setCircleStrokeWidth((float) getResources().getDimensionPixelSize(R.dimen.f359454n6)); this.F.setProgressColor(getResources().getColor(R.color.f357939m)); this.F.setProgressWidth((float) getResources().getDimensionPixelSize(R.dimen.f359456n8)); if (MMApplicationContext.isMainProcess()) { this.F.setTransitionTimingMs(Integer.MAX_VALUE); } RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.A.getLayoutParams(); RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.f95746z.getLayoutParams(); this.G = (mv0.d) this.f95742x.Y().a(getContext(), mv0.d.class); LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, -2); layoutParams3.gravity = 21; z.b(this.G); this.E.addView(this.G, layoutParams3); z.a(this.E); if (this.f95742x.z1().f85476j == 1) { this.A.setVisibility(0); } else { this.A.setVisibility(8); } RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) this.V.getLayoutParams(); e.b a15 = this.f95742x.m0().getOrientationHandler().a(); this.H = a15; Log.i("MicroMsg.AppBrandGameUILoadingSplash", "mLastDeviceOrientation :%s", a15); e.b bVar = this.H; if (bVar == e.b.LANDSCAPE_SENSOR || bVar == e.b.LANDSCAPE_LOCKED || bVar == e.b.LANDSCAPE_LEFT || bVar == e.b.LANDSCAPE_RIGHT) { if (this.A.getVisibility() == 0) { layoutParams2.bottomMargin = gy3.a.f(getContext(), R.dimen.f359443mv); layoutParams.topMargin = gy3.a.f(getContext(), R.dimen.f359447mz); this.A.setLayoutParams(layoutParams); } else { layoutParams2.bottomMargin = gy3.a.f(getContext(), R.dimen.f359444mw); } layoutParams4.bottomMargin = gy3.a.f(getContext(), R.dimen.f359435mn); layoutParams4.width = gy3.a.f(getContext(), R.dimen.f359436mo); } else { if (this.A.getVisibility() == 0) { layoutParams2.bottomMargin = gy3.a.f(getContext(), R.dimen.f359444mw); layoutParams.topMargin = gy3.a.f(getContext(), R.dimen.f359449n1); this.A.setLayoutParams(layoutParams); } else { layoutParams2.bottomMargin = gy3.a.f(getContext(), R.dimen.f359444mw); } layoutParams4.width = gy3.a.f(getContext(), R.dimen.f359438mq); layoutParams4.bottomMargin = gy3.a.f(getContext(), R.dimen.f359437mp); } this.V.setLayoutParams(layoutParams4); this.f95746z.setLayoutParams(layoutParams2); Q(getResources().getColor(R.color.f357929c), true, true); this.G.setBackgroundColor(0); mv0.d dVar = this.G; if (this.f95743x0 == null) { this.f95743x0 = Boolean.valueOf(x4.B()); } dVar.setStyleColor(!this.f95743x0.booleanValue() ? -16777216 : i15); this.G.setHomeButtonOnClickListener(new l0(this)); i3.f(getContext(), true); if (!this.M) { this.F.f(); } ArrayList arrayList = new ArrayList(); arrayList.add(Integer.valueOf((int) R.id.f362267x9)); arrayList.add(Integer.valueOf((int) R.id.f361677go)); arrayList.add(Integer.valueOf((int) R.id.f361676gn)); w0.d(arrayList, this); this.D = (TextView) findViewById(R.id.f362262x4); this.D.setTextSize(0, gy3.a.g(getContext()) * 11.0f); k2.a(this.f95744y, this.F, this.C); ViewGroup.LayoutParams layoutParams5 = this.A.getLayoutParams(); layoutParams5.width = gy3.a.h(MMApplicationContext.getContext(), R.dimen.f359450n2); layoutParams5.height = gy3.a.h(MMApplicationContext.getContext(), R.dimen.f359448n0); ImageView imageView2 = this.A; imageView2.setLayoutParams(imageView2.getLayoutParams()); this.B = (ImageView) findViewById(R.id.f362261x3); if (this.f95742x.z1().f85478o > 0) { try { Log.i("MicroMsg.AppBrandGameUILoadingSplash", "setAgeAppropriateImageView ageAppropriateLevel:%d,ageAppropriateIcon:%s", Integer.valueOf(this.f95742x.z1().f85478o), AppBrandGlobalSystemConfig.b().V); String str3 = (String) new g(AppBrandGlobalSystemConfig.b().V).get(String.valueOf(this.f95742x.z1().f85478o)); if (str3 != null) { this.D.setGravity(19); this.B.setVisibility(0); this.B.setOnClickListener(new e0(this, "https://game.weixin.qq.com/cgi-bin/minigame/static/age-tips/index.html?appid=" + this.f95742x.f83180j + "&age=" + this.f95742x.z1().f85478o + "#wechat_redirect")); String str4 = vf0.b.f325587g; b.q.f325637a.b(this.B, str3, null, new f0(this)); return; } } catch (a50.f e15) { Log.printErrStackTrace("MicroMsg.AppBrandGameUILoadingSplash", e15, "JSONException: setAgeAppropriateImageView ageAppropriateIcon age error", new Object[0]); } catch (Exception e16) { Log.printErrStackTrace("MicroMsg.AppBrandGameUILoadingSplash", e16, "Exception: setAgeAppropriateImageView ageAppropriateIcon age error", new Object[0]); } this.B.setVisibility(8); this.D.setGravity(17); return; } this.B.setVisibility(8); this.D.setGravity(17); } public static void T(k0 k0Var) { if (k0Var.P && k0Var.N) { Log.i("MicroMsg.AppBrandGameUILoadingSplash", "showCutomView"); k0Var.T.setVisibility(0); k0Var.L.setVisibility(4); k0Var.V.bringToFront(); k0Var.E.bringToFront(); } } @Override // com.tencent.mm.plugin.appbrand.ui.l4 public void F(kh4.a<b0> aVar) { this.f95745y0 = true; Log.w("MicroMsg.AppBrandGameUILoadingSplash", "animateHide"); post(new a(aVar)); } @Override // com.tencent.mm.plugin.appbrand.launching.h1 public void K(int i15) { MMHandlerThread.postToMainThread(new b(i15)); } @Override // com.tencent.mm.plugin.appbrand.ui.f4 public String R() { String str; AppBrandRuntimeWC appBrandRuntimeWC = this.f95742x; if (appBrandRuntimeWC == null) { str = "null"; } else { str = appBrandRuntimeWC.f83180j; } return "AppBrandGameUILoadingSplash:" + str; } @Override // com.tencent.mm.plugin.appbrand.ui.f4, com.tencent.mm.plugin.appbrand.ui.l4 public View getView() { return this; } @Override // h54.b public void onLayout(boolean z15, int i15, int i16, int i17, int i18) { super.onLayout(z15, i15, i16, i17, i18); e.b a15 = this.f95742x.m0().getOrientationHandler().a(); if (a15 != this.H) { this.H = a15; RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.A.getLayoutParams(); RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.V.getLayoutParams(); RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.f95746z.getLayoutParams(); if (a15 == e.b.LANDSCAPE_SENSOR || a15 == e.b.LANDSCAPE_LOCKED || a15 == e.b.LANDSCAPE_LEFT || a15 == e.b.LANDSCAPE_RIGHT) { if (this.A.getVisibility() == 0) { layoutParams3.bottomMargin = gy3.a.f(getContext(), R.dimen.f359443mv); layoutParams.topMargin = gy3.a.f(getContext(), R.dimen.f359447mz); this.A.setLayoutParams(layoutParams); } else { layoutParams3.bottomMargin = gy3.a.f(getContext(), R.dimen.f359444mw); } layoutParams2.width = gy3.a.f(getContext(), R.dimen.f359436mo); layoutParams2.bottomMargin = gy3.a.f(getContext(), R.dimen.f359435mn); } else { if (this.A.getVisibility() == 0) { layoutParams3.bottomMargin = gy3.a.f(getContext(), R.dimen.f359444mw); layoutParams.topMargin = gy3.a.f(getContext(), R.dimen.f359449n1); this.A.setLayoutParams(layoutParams); } else { layoutParams3.bottomMargin = gy3.a.f(getContext(), R.dimen.f359444mw); } layoutParams2.width = gy3.a.f(getContext(), R.dimen.f359438mq); layoutParams2.bottomMargin = gy3.a.f(getContext(), R.dimen.f359437mp); } this.V.setLayoutParams(layoutParams2); this.f95746z.setLayoutParams(layoutParams3); requestLayout(); } } @Override // com.tencent.mm.plugin.appbrand.ui.l4 public void q(String str, String str2) { String str3 = vf0.b.f325587g; b.q.f325637a.b(this.f95744y, str, null, vf0.j.f325646d); this.C.setText(str2); } @Override // com.tencent.mm.plugin.appbrand.ui.l4 public void r(int i15) { } @Override // com.tencent.mm.plugin.appbrand.ui.e4, com.tencent.mm.plugin.appbrand.ui.f4, com.tencent.mm.plugin.appbrand.ui.l4 public void setProgress(int i15) { if (!this.M) { if (i15 < 100) { this.F.setProgress(i15 / 2); } else if (!this.W) { this.W = true; new MTimerHandler(Looper.getMainLooper(), (MTimerHandler.CallBack) new d(null), true).startTimer(0, 50); } } else if (this.N || !this.R) { if (i15 < 100) { if (this.T.getVisibility() == 0) { this.V.setProgress(((float) i15) / 2.0f); } } else if (!this.f95741p0) { this.f95741p0 = true; new MTimerHandler(Looper.getMainLooper(), (MTimerHandler.CallBack) new c(null), true).startTimer(0, (long) (1000 / this.S)); } } else if (i15 < 100) { this.F.setProgress(i15 / 2); } else if (!this.W) { this.W = true; new MTimerHandler(Looper.getMainLooper(), (MTimerHandler.CallBack) new d(null), true).startTimer(0, 100); } } }