ZStore v1.7版本的 MD5 值为:ca9bb200afd8d690876bd39318f8215c
以下内容为反编译后的 f.java 源代码,内容仅作参考
package com.applovin.impl.adview.activity.b;
import android.R;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PointF;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.StrictMode;
import android.os.SystemClock;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import androidx.annotation.Nullable;
import com.applovin.communicator.AppLovinCommunicator;
import com.applovin.communicator.AppLovinCommunicatorMessage;
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.adview.AppLovinVideoView;
import com.applovin.impl.adview.h;
import com.applovin.impl.adview.k;
import com.applovin.impl.adview.n;
import com.applovin.impl.adview.u;
import com.applovin.impl.adview.w;
import com.applovin.impl.adview.x;
import com.applovin.impl.sdk.e.ac;
import com.applovin.impl.sdk.e.r;
import com.applovin.impl.sdk.o;
import com.applovin.impl.sdk.utils.AppLovinSdkExtraParameterKey;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sdk.utils.Utils;
import com.applovin.impl.sdk.utils.t;
import com.applovin.impl.sdk.utils.v;
import com.applovin.sdk.AppLovinAdClickListener;
import com.applovin.sdk.AppLovinAdDisplayListener;
import com.applovin.sdk.AppLovinAdVideoPlaybackListener;
import com.applovin.sdk.AppLovinSdkUtils;
import com.iab.omid.library.applovin.adsession.FriendlyObstructionPurpose;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public class f extends com.applovin.impl.adview.activity.b.a implements AppLovinCommunicatorSubscriber {
@Nullable
protected h A;
@Nullable
protected final ImageView B;
@Nullable
protected w C;
@Nullable
protected final ProgressBar D;
@Nullable
protected ImageView E;
protected final k F;
protected boolean G;
protected long H;
protected boolean I;
private final com.applovin.impl.adview.activity.a.c J;
private MediaPlayer K;
private final b L;
private final a M;
private final Handler N;
private final boolean O;
private int P;
private int Q;
private boolean R;
private final AtomicBoolean S;
private final AtomicBoolean T;
private long U;
private long V;
protected final AppLovinVideoView x;
protected final com.applovin.impl.adview.a y;
@Nullable
protected final n z;
public f(com.applovin.impl.sdk.ad.e eVar, Activity activity, @Nullable Map<String, Object> map, o oVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
super(eVar, activity, map, oVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
this.J = new com.applovin.impl.adview.activity.a.c(this.a, this.e, this.b);
this.E = null;
this.L = new b();
this.M = new a();
this.N = new Handler(Looper.getMainLooper());
this.F = new k(this.N, this.b);
this.O = this.a.f();
this.G = Utils.isVideoMutedInitially(this.b);
this.Q = -1;
this.S = new AtomicBoolean();
this.T = new AtomicBoolean();
this.U = -2L;
this.V = 0L;
if (!eVar.hasVideoUrl()) {
throw new IllegalStateException("Attempting to use fullscreen video ad presenter for non-video ad");
}
this.x = new AppLovinVideoView(activity);
this.x.setOnPreparedListener(this.L);
this.x.setOnCompletionListener(this.L);
this.x.setOnErrorListener(this.L);
this.x.setOnTouchListener(new AppLovinTouchToClickListener(oVar, com.applovin.impl.sdk.c.b.aX, activity, this.L));
c cVar = new c();
if (eVar.r() >= 0) {
this.z = new n(eVar.x(), activity);
this.z.setVisibility(8);
this.z.setOnClickListener(cVar);
} else {
this.z = null;
}
if (a(this.G, oVar)) {
this.B = new ImageView(activity);
this.B.setScaleType(ImageView.ScaleType.FIT_CENTER);
this.B.setClickable(true);
this.B.setOnClickListener(cVar);
e(this.G);
} else {
this.B = null;
}
String C = eVar.C();
if (StringUtils.isValidString(C)) {
x xVar = new x(oVar);
xVar.a(new WeakReference<>(this.M));
this.C = new w(xVar, activity);
this.C.a(C);
} else {
this.C = null;
}
if (this.O) {
this.y = new com.applovin.impl.adview.a(activity, ((Integer) oVar.a(com.applovin.impl.sdk.c.b.cU)).intValue(), R.attr.progressBarStyleLarge);
this.y.setColor(Color.parseColor("#75FFFFFF"));
this.y.setBackgroundColor(Color.parseColor("#00000000"));
this.y.setVisibility(8);
AppLovinCommunicator.getInstance(activity).subscribe(this, "video_caching_failed");
} else {
this.y = null;
}
final int m = m();
boolean z = ((Boolean) oVar.a(com.applovin.impl.sdk.c.b.cE)).booleanValue() && m > 0;
if (this.A == null && z) {
this.A = new h(activity);
int I = eVar.I();
this.A.setTextColor(I);
this.A.setTextSize(((Integer) oVar.a(com.applovin.impl.sdk.c.b.cD)).intValue());
this.A.setFinishedStrokeColor(I);
this.A.setFinishedStrokeWidth(((Integer) oVar.a(com.applovin.impl.sdk.c.b.cC)).intValue());
this.A.setMax(m);
this.A.setProgress(m);
this.F.a("COUNTDOWN_CLOCK", TimeUnit.SECONDS.toMillis(1L), new k.a() {
@Override
public void a() {
if (f.this.A != null) {
long seconds = m - TimeUnit.MILLISECONDS.toSeconds(f.this.x.getCurrentPosition());
if (seconds <= 0) {
f.this.n = true;
} else if (f.this.C()) {
f.this.A.setProgress((int) seconds);
}
}
}
@Override
public boolean b() {
return f.this.C();
}
});
}
if (eVar.R()) {
this.D = new ProgressBar(activity, null, R.attr.progressBarStyleHorizontal);
this.D.setMax(10000);
this.D.setPadding(0, 0, 0, 0);
if (com.applovin.impl.sdk.utils.h.d()) {
this.D.setProgressTintList(ColorStateList.valueOf(eVar.S()));
}
this.F.a("PROGRESS_BAR", ((Long) oVar.a(com.applovin.impl.sdk.c.b.cR)).longValue(), new k.a() {
@Override
public void a() {
if (f.this.I) {
f.this.D.setVisibility(8);
} else {
f.this.D.setProgress((int) ((f.this.x.getCurrentPosition() / ((float) f.this.H)) * 10000.0f));
}
}
@Override
public boolean b() {
return !f.this.I;
}
});
return;
}
this.D = null;
}
@Override
public void d() {
a((ViewGroup) null);
}
@Override
public void a(@Nullable ViewGroup viewGroup) {
String str;
this.J.a(this.B, this.z, this.C, this.y, this.D, this.A, this.x, this.f, this.g, this.E, viewGroup);
if (com.applovin.impl.sdk.utils.h.g() && (str = this.b.D().getExtraParameters().get(AppLovinSdkExtraParameterKey.AUDIO_FOCUS_REQUEST)) != null) {
this.x.setAudioFocusRequest(Integer.parseInt(str));
}
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
a(!this.O);
this.x.setVideoURI(this.a.h());
StrictMode.setThreadPolicy(allowThreadDiskReads);
if (this.a.ap()) {
this.v.a(this.a, new Runnable() {
@Override
public void run() {
f.this.a(250L);
}
});
}
if (this.g != null) {
this.g.a();
}
this.x.start();
if (this.O) {
y();
}
this.f.renderAd(this.a);
this.d.b(this.O ? 1L : 0L);
if (this.z != null) {
this.b.N().a(new ac(this.b, new Runnable() {
@Override
public void run() {
f.this.E();
}
}), r.b.MAIN, this.a.s(), true);
}
super.b(this.G);
}
public void c(long j) {
this.H = j;
}
public void E() {
if (this.T.compareAndSet(false, true)) {
a(this.z, this.a.r(), new Runnable() {
@Override
public void run() {
f.this.U = -1L;
f.this.V = SystemClock.elapsedRealtime();
}
});
}
}
@Override
public void c(boolean z) {
super.c(z);
if (z) {
a(0L);
} else if (!this.I) {
e();
}
}
@Override
public void h() {
this.F.b();
this.N.removeCallbacksAndMessages(null);
n();
super.h();
}
@Override
@SuppressLint({"LongLogTag"})
public void k() {
com.applovin.impl.sdk.x xVar = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.c("AppLovinFullscreenActivity", "Destroying video components");
}
try {
if (((Boolean) this.b.a(com.applovin.impl.sdk.c.b.gu)).booleanValue()) {
com.applovin.impl.sdk.utils.w.a(this.C);
this.C = null;
}
if (this.O) {
AppLovinCommunicator.getInstance(this.e).unsubscribe(this, "video_caching_failed");
}
if (this.x != null) {
this.x.pause();
this.x.stopPlayback();
}
if (this.K != null) {
this.K.release();
}
} catch (Throwable th) {
Log.e("AppLovinFullscreenActivity", "Unable to destroy presenter", th);
}
super.k();
}
public void a(PointF pointF, boolean z) {
if (this.a.E()) {
com.applovin.impl.sdk.x xVar = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.b("AppLovinFullscreenActivity", "Clicking through video");
}
Uri k = this.a.k();
if (k != null) {
this.b.F().trackAndLaunchVideoClick(this.a, k, pointF, z, this, this.f != null ? this.f.getContext() : o.z());
com.applovin.impl.sdk.utils.n.a(this.s, this.a);
this.d.b();
this.p++;
return;
}
return;
}
F();
}
private void F() {
u D = this.a.D();
if (D != null && D.e() && !this.I && this.C != null) {
final boolean z = this.C.getVisibility() == 4;
final long f = D.f();
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (z) {
v.a(f.this.C, f, (Runnable) null);
} else {
v.b(f.this.C, f, null);
}
}
});
}
}
protected boolean C() {
return (this.n || this.I || !this.x.isPlaying()) ? false : true;
}
public void c() {
this.U = SystemClock.elapsedRealtime() - this.V;
com.applovin.impl.sdk.x xVar = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.b("AppLovinFullscreenActivity", "Skipping video with skip time: " + this.U + "ms");
}
this.d.f();
this.o++;
if (this.a.y()) {
h();
} else {
B();
}
}
@Override
public void e() {
com.applovin.impl.sdk.x xVar = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.b("AppLovinFullscreenActivity", "Pausing video");
}
this.Q = this.x.getCurrentPosition();
this.x.pause();
this.F.c();
com.applovin.impl.sdk.x xVar2 = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.b("AppLovinFullscreenActivity", "Paused video at position " + this.Q + "ms");
}
}
private void d(boolean z) {
this.P = D();
if (z) {
this.x.pause();
} else {
this.x.stopPlayback();
}
}
@Override
public void a(long j) {
a(new Runnable() {
@Override
public void run() {
f.this.G();
}
}, j);
}
public void G() {
if (this.I) {
com.applovin.impl.sdk.x xVar = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.d("AppLovinFullscreenActivity", "Skip video resume - postitial shown");
return;
}
return;
}
if (this.b.Z().isApplicationPaused()) {
com.applovin.impl.sdk.x xVar2 = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.d("AppLovinFullscreenActivity", "Skip video resume - app paused");
return;
}
return;
}
if (this.Q >= 0) {
com.applovin.impl.sdk.x xVar3 = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.b("AppLovinFullscreenActivity", "Resuming video at position " + this.Q + "ms for MediaPlayer: " + this.K);
}
this.x.seekTo(this.Q);
this.x.start();
this.F.a();
this.Q = -1;
a(new Runnable() {
@Override
public void run() {
if (f.this.y != null) {
f.this.y.a();
f.this.a(new Runnable() {
@Override
public void run() {
f.this.y.b();
}
}, 2000L);
}
}
}, 250L);
return;
}
com.applovin.impl.sdk.x xVar4 = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.b("AppLovinFullscreenActivity", "Invalid last video position");
}
}
public void y() {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (f.this.y != null) {
f.this.y.a();
}
}
});
}
public void z() {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (f.this.y != null) {
f.this.y.b();
}
}
});
}
public void c(String str) {
com.applovin.impl.sdk.x xVar = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.e("AppLovinFullscreenActivity", "Encountered media error: " + str + " for ad: " + this.a);
}
if (this.S.compareAndSet(false, true)) {
if (this.t instanceof com.applovin.impl.sdk.ad.h) {
((com.applovin.impl.sdk.ad.h) this.t).onAdDisplayFailed(str);
}
h();
}
}
@Override
public boolean s() {
return D() >= this.a.T();
}
public int D() {
long currentPosition = this.x.getCurrentPosition();
if (this.R) {
return 100;
}
if (currentPosition > 0) {
return (int) ((((float) currentPosition) / ((float) this.H)) * 100.0f);
}
return this.P;
}
@Override
protected boolean t() {
return u() && !s();
}
public void B() {
com.applovin.impl.sdk.x xVar = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.b("AppLovinFullscreenActivity", "Showing postitial...");
}
d(this.a.aO());
this.J.a(this.h, this.g, this.f);
a("javascript:al_onPoststitialShow(" + this.o + "," + this.p + ");", this.a.V());
if (this.h != null) {
if (this.a.t() >= 0) {
a(this.h, this.a.t(), new Runnable() {
@Override
public void run() {
f.this.k = SystemClock.elapsedRealtime();
}
});
} else {
this.h.setVisibility(0);
}
}
ArrayList arrayList = new ArrayList();
if (this.h != null) {
arrayList.add(new com.applovin.impl.sdk.a.d(this.h, FriendlyObstructionPurpose.CLOSE_AD, "close button"));
}
if (this.g != null && this.g.b()) {
arrayList.add(new com.applovin.impl.sdk.a.d(this.g, FriendlyObstructionPurpose.NOT_VISIBLE, this.g.getIdentifier()));
}
this.a.o().a(this.f, arrayList);
w();
this.I = true;
}
private static boolean a(boolean z, o oVar) {
if (!((Boolean) oVar.a(com.applovin.impl.sdk.c.b.cJ)).booleanValue()) {
return false;
}
if (((Boolean) oVar.a(com.applovin.impl.sdk.c.b.cK)).booleanValue() && !z) {
return ((Boolean) oVar.a(com.applovin.impl.sdk.c.b.cM)).booleanValue();
}
return true;
}
private void e(boolean z) {
if (com.applovin.impl.sdk.utils.h.d()) {
AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) this.e.getDrawable(z ? com.applovin.sdk.R.drawable.applovin_ic_unmute_to_mute : com.applovin.sdk.R.drawable.applovin_ic_mute_to_unmute);
if (animatedVectorDrawable != null) {
this.B.setScaleType(ImageView.ScaleType.FIT_XY);
this.B.setImageDrawable(animatedVectorDrawable);
animatedVectorDrawable.start();
return;
}
}
Uri aH = z ? this.a.aH() : this.a.aI();
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
this.B.setImageURI(aH);
StrictMode.setThreadPolicy(allowThreadDiskReads);
}
public void A() {
if (this.K != null) {
try {
int i = !this.G ? 0 : 1;
this.K.setVolume(i, i);
this.G = this.G ? false : true;
e(this.G);
a(this.G, 0L);
} catch (Throwable th) {
}
}
}
@Override
public void a() {
com.applovin.impl.sdk.x xVar = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.b("AppLovinFullscreenActivity", "Continue video from prompt - will resume in onWindowFocusChanged(true) when alert dismisses");
}
}
@Override
public void b() {
com.applovin.impl.sdk.x xVar = this.c;
if (com.applovin.impl.sdk.x.a()) {
this.c.b("AppLovinFullscreenActivity", "Skipping video from prompt");
}
c();
}
@Override
protected void n() {
super.a(D(), this.O, s(), this.U);
}
@Override
protected void v() {
long ah;
if (this.a.ag() >= 0 || this.a.ah() >= 0) {
if (this.a.ag() >= 0) {
ah = this.a.ag();
} else {
com.applovin.impl.sdk.ad.a aVar = (com.applovin.impl.sdk.ad.a) this.a;
long j = this.H > 0 ? 0 + this.H : 0L;
if (aVar.ai()) {
int l = (int) ((com.applovin.impl.sdk.ad.a) this.a).l();
if (l > 0) {
j += TimeUnit.SECONDS.toMillis(l);
} else {
int t = (int) aVar.t();
if (t > 0) {
j += TimeUnit.SECONDS.toMillis(t);
}
}
}
ah = (long) (j * (this.a.ah() / 100.0d));
}
b(ah);
}
}
@Override
public void x() {
super.x();
this.J.a(this.C);
this.J.a((View) this.z);
if (!u() || this.I) {
H();
}
}
public void H() {
this.J.a(this.i);
this.k = SystemClock.elapsedRealtime();
}
@Override
public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
if ("video_caching_failed".equals(appLovinCommunicatorMessage.getTopic())) {
Bundle messageData = appLovinCommunicatorMessage.getMessageData();
long j = messageData.getLong("ad_id");
if (((Boolean) this.b.a(com.applovin.impl.sdk.c.b.gb)).booleanValue() && j == this.a.getAdIdNumber() && this.O) {
int i = messageData.getInt("load_response_code");
String string = messageData.getString("load_exception_message");
if ((string != null || i < 200 || i >= 300) && !this.R && !this.x.isPlaying()) {
c("Video cache error during stream. ResponseCode=" + i + ", exception=" + string);
}
}
}
}
@Override
public String getCommunicatorId() {
return "FullscreenVideoAdPresenter";
}
private class b implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, MediaPlayer.OnInfoListener, MediaPlayer.OnPreparedListener, AppLovinTouchToClickListener.OnClickListener {
private b() {
}
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
f.this.K = mediaPlayer;
mediaPlayer.setOnInfoListener(f.this.L);
mediaPlayer.setOnErrorListener(f.this.L);
int i = f.this.G ? 0 : 1;
mediaPlayer.setVolume(i, i);
f.this.m = (int) TimeUnit.MILLISECONDS.toSeconds(mediaPlayer.getDuration());
f.this.c(mediaPlayer.getDuration());
f.this.v();
com.applovin.impl.sdk.x xVar = f.this.c;
if (com.applovin.impl.sdk.x.a()) {
f.this.c.b("AppLovinFullscreenActivity", "MediaPlayer prepared: " + f.this.K);
}
}
@Override
public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) {
com.applovin.impl.sdk.x xVar = f.this.c;
if (com.applovin.impl.sdk.x.a()) {
f.this.c.b("AppLovinFullscreenActivity", "MediaPlayer Info: (" + i + ", " + i2 + ")");
}
if (i == 701) {
f.this.y();
f.this.d.g();
return false;
}
if (i == 3) {
f.this.F.a();
if (f.this.z != null) {
f.this.E();
}
f.this.z();
if (f.this.v.c()) {
f.this.e();
return false;
}
return false;
}
if (i == 702) {
f.this.z();
return false;
}
return false;
}
@Override
public boolean onError(MediaPlayer mediaPlayer, int i, int i2) {
f.this.c("Video view error (" + i + "," + i2 + ")");
f.this.x.start();
return true;
}
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
com.applovin.impl.sdk.x xVar = f.this.c;
if (com.applovin.impl.sdk.x.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Video completed");
}
f.this.R = true;
if (!f.this.l) {
f.this.B();
} else if (f.this.u()) {
f.this.H();
}
}
@Override
public void onClick(View view, PointF pointF) {
f.this.a(pointF, false);
}
}
private class c implements View.OnClickListener {
private c() {
}
@Override
public void onClick(View view) {
if (view == f.this.z) {
if (f.this.t()) {
f.this.e();
f.this.q();
f.this.v.b();
return;
}
f.this.c();
return;
}
if (view == f.this.B) {
f.this.A();
return;
}
com.applovin.impl.sdk.x xVar = f.this.c;
if (com.applovin.impl.sdk.x.a()) {
f.this.c.e("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
}
}
}
private class a implements x.a {
private a() {
}
@Override
public void a(w wVar) {
com.applovin.impl.sdk.x xVar = f.this.c;
if (com.applovin.impl.sdk.x.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Clicking through from video button...");
}
f.this.a(wVar.getAndClearLastClickLocation(), false);
}
@Override
public void b(w wVar) {
com.applovin.impl.sdk.x xVar = f.this.c;
if (com.applovin.impl.sdk.x.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Closing ad from video button...");
}
f.this.h();
}
@Override
public void c(w wVar) {
com.applovin.impl.sdk.x xVar = f.this.c;
if (com.applovin.impl.sdk.x.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Skipping video from video button...");
}
f.this.c();
}
@Override
public void d(w wVar) {
com.applovin.impl.sdk.x xVar = f.this.c;
if (com.applovin.impl.sdk.x.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Attempting to install app from video button...");
}
f.this.a(wVar.getAndClearLastClickLocation(), true);
}
@Override
public void a(Uri uri, w wVar) {
com.applovin.impl.sdk.x xVar = f.this.c;
if (com.applovin.impl.sdk.x.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Attempting to load a url from video button...");
}
t.a(uri, f.this.f.getController(), f.this.b);
}
}
}