package com.kwad.components.ad.splashscreen.b; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.os.Vibrator; import android.view.View; import android.view.ViewGroup; import android.view.ViewStub; import android.widget.TextView; import com.alibaba.fastjson.asm.Opcodes; import com.kwad.components.ad.splashscreen.d.a; import com.kwad.components.ad.splashscreen.g; import com.kwad.components.ad.splashscreen.h; import com.kwad.components.ad.splashscreen.widget.KsShakeView; import com.kwad.components.core.c.a.c; import com.kwad.sdk.R; import com.kwad.sdk.core.g.b; import com.kwad.sdk.core.g.d; import com.kwad.sdk.core.response.model.AdInfo; import com.kwad.sdk.utils.bi; import com.kwad.sdk.widget.e; import com.kwad.sdk.widget.i; import org.json.JSONObject; public final class j extends e implements View.OnClickListener, g, b, e { private static long iS = 400; private com.kwad.components.ad.splashscreen.e BF; private ViewGroup BJ; private KsShakeView BK; private TextView BL; private boolean Bi; private a By; private d gF; private Vibrator gG; private void kJ() { if (this.Br != null) { a aVar = this.By; if (aVar == null) { this.By = new a(getContext(), this.Br.mAdTemplate) { /* class com.kwad.components.ad.splashscreen.b.j.AnonymousClass2 */ @Override // com.kwad.components.ad.splashscreen.d.a public final void aa(String str) { if (j.this.BL != null) { TextView textView = j.this.BL; textView.setText("或点击" + str); } } }; } else { aVar.setAdTemplate(this.Br.mAdTemplate); } c cVar = this.Br.mApkDownloadHelper; if (cVar != null) { cVar.b(this.By); } } } private void kM() { TextView textView = this.BL; if (textView != null) { textView.setText(this.BF.jU()); } KsShakeView ksShakeView = this.BK; if (ksShakeView != null) { ksShakeView.aa(this.BF.jV()); } if (com.kwad.components.ad.splashscreen.d.c.b(this.Br)) { com.kwad.components.ad.splashscreen.d.c.a(this.BL, -1, 60, -1, -1); } } private void kN() { if (this.BJ != null && this.Br != null) { this.BJ.setVisibility(0); com.kwad.sdk.core.report.a.c(this.Br.mAdTemplate, (int) Opcodes.INVOKEINTERFACE, (JSONObject) null); } } @Override // com.kwad.sdk.mvp.Presenter, com.kwad.components.ad.splashscreen.b.e public final void ay() { super.ay(); if (this.Br != null) { AdInfo cs = com.kwad.sdk.core.response.a.d.cs(this.Br.mAdTemplate); getContext(); this.BF = com.kwad.components.ad.splashscreen.e.a(this.Br.mAdTemplate, cs, this.Br.mApkDownloadHelper, 2); float bL = com.kwad.sdk.core.response.a.b.bL(this.Br.mAdTemplate); d dVar = this.gF; if (dVar == null) { d dVar2 = new d(bL); this.gF = dVar2; dVar2.a(this); } else { dVar.I(bL); } kM(); if (com.kwad.sdk.core.response.a.a.as(cs)) { kJ(); } kN(); this.gF.bB(getContext()); this.BK.post(new Runnable() { /* class com.kwad.components.ad.splashscreen.b.j.AnonymousClass1 */ public final void run() { j.this.BK.lb(); } }); com.kwad.components.ad.splashscreen.local.b.F(getContext()); this.Bi = com.kwad.sdk.core.response.a.c.ch(this.Br.mAdTemplate); new i(this.BK.getContext(), this.BK, this); this.Br.a(this); } } @Override // com.kwad.sdk.core.g.b public final void cc() { com.kwad.sdk.core.report.a.aO(this.Br.mAdTemplate); } @Override // com.kwad.sdk.core.g.b public final void d(final double d) { boolean mg = com.kwad.components.core.c.kwai.b.mg(); if (!this.Br.AP.qE() || mg) { bi.a(new Runnable() { /* class com.kwad.components.ad.splashscreen.b.j.AnonymousClass3 */ public final void run() { j.this.gF.Oa(); } }, null, 500); return; } this.BK.a(new AnimatorListenerAdapter() { /* class com.kwad.components.ad.splashscreen.b.j.AnonymousClass4 */ public final void onAnimationEnd(Animator animator) { super.onAnimationEnd(animator); if (j.this.Br != null) { j.this.Br.a(j.this.getContext(), 157, 2, new h.a() { /* class com.kwad.components.ad.splashscreen.b.j.AnonymousClass4.AnonymousClass1 */ @Override // com.kwad.components.ad.splashscreen.h.a public final void b(com.kwad.sdk.core.report.g gVar) { gVar.h(d); } }); } j.this.BK.lb(); bi.a(new Runnable() { /* class com.kwad.components.ad.splashscreen.b.j.AnonymousClass4.AnonymousClass2 */ public final void run() { com.kwad.sdk.core.e.b.d("SplashShakePresenter", "onShakeEvent openGate2"); j.this.gF.Oa(); } }, null, 500); } }); bi.a(getContext(), this.gG); } @Override // com.kwad.sdk.widget.e public final void d(View view) { com.kwad.sdk.core.e.b.d("SplashShakePresenter", "onSingleTap: " + view); if (com.kwad.sdk.core.response.a.b.cz(com.kwad.sdk.core.response.a.d.cs(this.Br.mAdTemplate)) && this.Br != null) { this.Br.c(getContext(), Opcodes.IFLE, 1); } } @Override // com.kwad.sdk.widget.e public final void e(View view) { com.kwad.sdk.core.e.b.d("SplashShakePresenter", "onSlide: enableSlickClick: " + this.Bi); if (this.Bi && this.Br != null) { this.Br.c(view.getContext(), Opcodes.IFEQ, 1); } } @Override // com.kwad.components.ad.splashscreen.g public final void jW() { d dVar = this.gF; if (dVar != null) { dVar.bC(getContext()); } } public final void onClick(View view) { com.kwad.sdk.core.e.b.d("SplashShakePresenter", "onClick: " + view); if (view.equals(this.BK) && this.Br != null && this.Br.mAdTemplate != null && com.kwad.sdk.core.response.a.b.cz(com.kwad.sdk.core.response.a.d.cs(this.Br.mAdTemplate))) { this.Br.c(getContext(), Opcodes.IFLE, 1); } } @Override // com.kwad.sdk.mvp.Presenter public final void onCreate() { super.onCreate(); Context context = getContext(); if (context != null) { this.gG = (Vibrator) context.getSystemService("vibrator"); } ViewStub viewStub = (ViewStub) findViewById(R.id.ksad_shake_layout); this.BJ = (ViewGroup) (viewStub != null ? viewStub.inflate() : findViewById(R.id.ksad_shake_root)); this.BL = (TextView) this.BJ.findViewById(R.id.ksad_shake_action); KsShakeView ksShakeView = (KsShakeView) this.BJ.findViewById(R.id.ksad_shake_view); this.BK = ksShakeView; ksShakeView.setOnClickListener(this); } @Override // com.kwad.sdk.mvp.Presenter public final void onUnbind() { super.onUnbind(); com.kwad.sdk.core.e.b.d("SplashShakePresenter", "onUnbind"); if (this.Br != null) { this.Br.b(this); } d dVar = this.gF; if (dVar != null) { dVar.bC(getContext()); } KsShakeView ksShakeView = this.BK; if (ksShakeView != null) { ksShakeView.bz(); } } }