atsameip v0.1版本的 MD5 值为:28547cf98b0a2d02acb37969dcfb83e9
以下内容为反编译后的 f.java 源代码,内容仅作参考
package com.applovin.impl.adview.activity.b;
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 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.j;
import com.applovin.impl.adview.m;
import com.applovin.impl.adview.s;
import com.applovin.impl.adview.t;
import com.applovin.impl.adview.u;
import com.applovin.impl.sdk.e.o;
import com.applovin.impl.sdk.e.z;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sdk.utils.Utils;
import com.applovin.impl.sdk.utils.p;
import com.applovin.impl.sdk.w;
import com.applovin.sdk.AppLovinAdClickListener;
import com.applovin.sdk.AppLovinAdDisplayListener;
import com.applovin.sdk.AppLovinAdVideoPlaybackListener;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.R;
import com.yandex.metrica.YandexMetricaDefaultValues;
import java.lang.ref.WeakReference;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public class f extends com.applovin.impl.adview.activity.b.a implements AppLovinCommunicatorSubscriber {
protected boolean A;
protected long B;
protected boolean C;
private final com.applovin.impl.adview.activity.a.c D;
private MediaPlayer E;
private final b F;
private final a G;
private final Handler H;
private final boolean I;
private int J;
private int K;
private boolean L;
private final AtomicBoolean M;
private final AtomicBoolean N;
private long O;
private long P;
protected final AppLovinVideoView t;
protected final com.applovin.impl.adview.a u;
protected final m v;
protected final ImageView w;
protected final t x;
protected final ProgressBar y;
protected final j z;
private class a implements u.a {
private a() {
}
@Override
public void a(t tVar) {
if (w.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Clicking through from video button...");
}
f.this.a(tVar.getAndClearLastClickLocation());
}
@Override
public void b(t tVar) {
if (w.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Closing ad from video button...");
}
f.this.h();
}
@Override
public void c(t tVar) {
if (w.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Skipping video from video button...");
}
f.this.c();
}
}
private class b implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, MediaPlayer.OnInfoListener, MediaPlayer.OnPreparedListener, AppLovinTouchToClickListener.OnClickListener {
private b() {
}
@Override
public void onClick(View view, PointF pointF) {
f.this.a(pointF);
}
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
if (w.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Video completed");
}
f.this.L = true;
f.this.x();
}
@Override
public boolean onError(MediaPlayer mediaPlayer, int i, int i2) {
f fVar = f.this;
fVar.c("Video view error (" + i + "," + i2 + ")");
f.this.t.start();
return true;
}
@Override
public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) {
if (w.a()) {
w wVar = f.this.c;
wVar.b("AppLovinFullscreenActivity", "MediaPlayer Info: (" + i + ", " + i2 + ")");
}
if (i == 701) {
f.this.u();
f.this.d.g();
return false;
} else if (i != 3) {
if (i == 702) {
f.this.v();
return false;
}
return false;
} else {
f.this.z.a();
if (f.this.v != null) {
f.this.z();
}
f.this.v();
if (f.this.q.c()) {
f.this.e();
return false;
}
return false;
}
}
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
f.this.E = mediaPlayer;
mediaPlayer.setOnInfoListener(f.this.F);
mediaPlayer.setOnErrorListener(f.this.F);
float f = !f.this.A ? 1 : 0;
mediaPlayer.setVolume(f, f);
f.this.c(mediaPlayer.getDuration());
f.this.t();
if (w.a()) {
f.this.c.b("AppLovinFullscreenActivity", "MediaPlayer prepared: " + f.this.E);
}
}
}
private class c implements View.OnClickListener {
private c() {
}
@Override
public void onClick(View view) {
if (view == f.this.v) {
if (!f.this.r()) {
f.this.c();
return;
}
f.this.e();
f.this.o();
f.this.q.b();
} else if (view == f.this.w) {
f.this.w();
} else if (w.a()) {
w wVar = f.this.c;
wVar.e("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
}
}
}
public f(com.applovin.impl.sdk.ad.e eVar, Activity activity, n nVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
super(eVar, activity, nVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
this.D = new com.applovin.impl.adview.activity.a.c(this.a, this.e, this.b);
this.F = new b();
this.G = new a();
Handler handler = new Handler(Looper.getMainLooper());
this.H = handler;
this.z = new j(handler, this.b);
this.I = this.a.f();
this.A = Utils.isVideoMutedInitially(this.b);
this.K = -1;
this.M = new AtomicBoolean();
this.N = new AtomicBoolean();
this.O = -2L;
this.P = 0L;
if (!eVar.hasVideoUrl()) {
throw new IllegalStateException("Attempting to use fullscreen video ad presenter for non-video ad");
}
AppLovinVideoView appLovinVideoView = new AppLovinVideoView(activity, nVar);
this.t = appLovinVideoView;
appLovinVideoView.setOnPreparedListener(this.F);
this.t.setOnCompletionListener(this.F);
this.t.setOnErrorListener(this.F);
this.t.setOnTouchListener(new AppLovinTouchToClickListener(nVar, com.applovin.impl.sdk.c.b.aM, activity, this.F));
c cVar = new c();
if (eVar.q() >= 0) {
m mVar = new m(eVar.w(), activity);
this.v = mVar;
mVar.setVisibility(8);
this.v.setOnClickListener(cVar);
} else {
this.v = null;
}
if (a(this.A, nVar)) {
ImageView imageView = new ImageView(activity);
this.w = imageView;
imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
this.w.setClickable(true);
this.w.setOnClickListener(cVar);
e(this.A);
} else {
this.w = null;
}
String B = eVar.B();
if (StringUtils.isValidString(B)) {
u uVar = new u(nVar);
uVar.a(new WeakReference<>(this.G));
t tVar = new t(uVar, activity);
this.x = tVar;
tVar.a(B);
} else {
this.x = null;
}
if (this.I) {
com.applovin.impl.adview.a aVar = new com.applovin.impl.adview.a(activity, ((Integer) nVar.a(com.applovin.impl.sdk.c.b.cC)).intValue(), 16842874);
this.u = aVar;
aVar.setColor(Color.parseColor("#75FFFFFF"));
this.u.setBackgroundColor(Color.parseColor("#00000000"));
this.u.setVisibility(8);
AppLovinCommunicator.getInstance(activity).subscribe(this, "video_caching_failed");
} else {
this.u = null;
}
if (!eVar.L()) {
this.y = null;
return;
}
ProgressBar progressBar = new ProgressBar(activity, null, 16842872);
this.y = progressBar;
progressBar.setMax(YandexMetricaDefaultValues.DEFAULT_MAX_REPORTS_COUNT_UPPER_BOUND);
this.y.setPadding(0, 0, 0, 0);
if (com.applovin.impl.sdk.utils.g.d()) {
this.y.setProgressTintList(ColorStateList.valueOf(eVar.M()));
}
this.z.a("PROGRESS_BAR", ((Long) nVar.a(com.applovin.impl.sdk.c.b.cz)).longValue(), new j.a() {
@Override
public void a() {
if (f.this.C) {
f.this.y.setVisibility(8);
return;
}
f.this.y.setProgress((int) ((f.this.t.getCurrentPosition() / ((float) f.this.B)) * 10000.0f));
}
@Override
public boolean b() {
return !f.this.C;
}
});
}
private void A() {
t tVar;
s C = this.a.C();
if (C == null || !C.e() || this.C || (tVar = this.x) == null) {
return;
}
final boolean z = tVar.getVisibility() == 4;
final long f = C.f();
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (z) {
p.a(f.this.x, f, (Runnable) null);
} else {
p.b(f.this.x, f, null);
}
}
});
}
public void B() {
if (this.C) {
if (w.a()) {
this.c.d("AppLovinFullscreenActivity", "Skip video resume - postitial shown");
}
} else if (this.b.ad().a()) {
if (w.a()) {
this.c.d("AppLovinFullscreenActivity", "Skip video resume - app paused");
}
} else if (this.K < 0) {
if (w.a()) {
this.c.b("AppLovinFullscreenActivity", "Invalid last video position");
}
} else {
if (w.a()) {
w wVar = this.c;
wVar.b("AppLovinFullscreenActivity", "Resuming video at position " + this.K + "ms for MediaPlayer: " + this.E);
}
this.t.seekTo(this.K);
this.t.start();
this.z.a();
this.K = -1;
a(new Runnable() {
@Override
public void run() {
if (f.this.u != null) {
f.this.u.a();
f.this.a(new Runnable() {
@Override
public void run() {
f.this.u.b();
}
}, 2000L);
}
}
}, 250L);
}
}
private static boolean a(boolean z, n nVar) {
if (((Boolean) nVar.a(com.applovin.impl.sdk.c.b.cr)).booleanValue()) {
if (!((Boolean) nVar.a(com.applovin.impl.sdk.c.b.cs)).booleanValue() || z) {
return true;
}
return ((Boolean) nVar.a(com.applovin.impl.sdk.c.b.cu)).booleanValue();
}
return false;
}
private void d(boolean z) {
this.J = y();
if (z) {
this.t.pause();
} else {
this.t.stopPlayback();
}
}
private void e(boolean z) {
if (com.applovin.impl.sdk.utils.g.d()) {
AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) this.e.getDrawable(z ? R.drawable.unmute_to_mute : R.drawable.mute_to_unmute);
if (animatedVectorDrawable != null) {
this.w.setScaleType(ImageView.ScaleType.FIT_XY);
this.w.setImageDrawable(animatedVectorDrawable);
animatedVectorDrawable.start();
return;
}
}
Uri aA = z ? this.a.aA() : this.a.aB();
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
this.w.setImageURI(aA);
StrictMode.setThreadPolicy(allowThreadDiskReads);
}
public void z() {
if (this.N.compareAndSet(false, true)) {
a(this.v, this.a.q(), new Runnable() {
@Override
public void run() {
f.this.O = -1L;
f.this.P = SystemClock.elapsedRealtime();
}
});
}
}
@Override
public void a() {
if (w.a()) {
this.c.b("AppLovinFullscreenActivity", "Continue video from prompt - will resume in onWindowFocusChanged(true) when alert dismisses");
}
}
@Override
public void a(long j) {
a(new Runnable() {
@Override
public void run() {
f.this.B();
}
}, j);
}
public void a(PointF pointF) {
if (!this.a.D()) {
A();
return;
}
if (w.a()) {
this.c.b("AppLovinFullscreenActivity", "Clicking through video");
}
Uri k = this.a.k();
if (k != null) {
this.b.u().trackAndLaunchVideoClick(this.a, k, pointF, this, this.f != null ? this.f.getContext() : this.b.L());
com.applovin.impl.sdk.utils.j.a(this.n, this.a);
this.d.b();
this.k++;
}
}
@Override
public void a(ViewGroup viewGroup) {
this.D.a(this.w, this.v, this.x, this.u, this.y, this.t, this.f, viewGroup);
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
a(!this.I);
this.t.setVideoURI(this.a.h());
StrictMode.setThreadPolicy(allowThreadDiskReads);
if (this.a.ak()) {
this.q.a(this.a, new Runnable() {
@Override
public void run() {
f.this.a(250L);
}
});
}
this.t.start();
if (this.I) {
u();
}
this.f.renderAd(this.a);
this.d.b(this.I ? 1L : 0L);
if (this.v != null) {
this.b.S().a(new z(this.b, new Runnable() {
@Override
public void run() {
f.this.z();
}
}), o.a.MAIN, this.a.r(), true);
}
super.b(this.A);
}
@Override
public void b() {
if (w.a()) {
this.c.b("AppLovinFullscreenActivity", "Skipping video from prompt");
}
c();
}
public void c() {
this.O = SystemClock.elapsedRealtime() - this.P;
if (w.a()) {
this.c.b("AppLovinFullscreenActivity", "Skipping video with skip time: " + this.O + "ms");
}
this.d.f();
this.j++;
if (this.a.x()) {
h();
} else {
x();
}
}
public void c(long j) {
this.B = j;
}
public void c(String str) {
if (w.a()) {
w wVar = this.c;
wVar.e("AppLovinFullscreenActivity", "Encountered media error: " + str + " for ad: " + this.a);
}
if (this.M.compareAndSet(false, true)) {
if (this.o instanceof com.applovin.impl.sdk.ad.g) {
((com.applovin.impl.sdk.ad.g) this.o).onAdDisplayFailed(str);
}
h();
}
}
@Override
public void c(boolean z) {
super.c(z);
if (z) {
a(((Boolean) this.b.a(com.applovin.impl.sdk.c.b.eN)).booleanValue() ? 0L : 250L);
} else if (this.C) {
} else {
e();
}
}
@Override
public void d() {
a((ViewGroup) null);
}
@Override
public void e() {
if (w.a()) {
this.c.b("AppLovinFullscreenActivity", "Pausing video");
}
this.K = this.t.getCurrentPosition();
this.t.pause();
this.z.c();
if (w.a()) {
w wVar = this.c;
wVar.b("AppLovinFullscreenActivity", "Paused video at position " + this.K + "ms");
}
}
@Override
public String getCommunicatorId() {
return "FullscreenVideoAdPresenter";
}
@Override
public void h() {
this.z.b();
this.H.removeCallbacksAndMessages(null);
l();
super.h();
}
@Override
public void j() {
if (w.a()) {
this.c.c("AppLovinFullscreenActivity", "Destroying video components");
}
try {
if (this.I) {
AppLovinCommunicator.getInstance(this.e).unsubscribe(this, "video_caching_failed");
}
if (this.t != null) {
this.t.pause();
this.t.stopPlayback();
}
if (this.E != null) {
this.E.release();
}
} catch (Throwable th) {
Log.e("AppLovinFullscreenActivity", "Unable to destroy presenter", th);
}
super.j();
}
@Override
protected void l() {
super.a(y(), this.I, q(), this.O);
}
@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.eO)).booleanValue() && j == this.a.getAdIdNumber() && this.I) {
int i = messageData.getInt("load_response_code");
String string = messageData.getString("load_exception_message");
if ((string == null && i >= 200 && i < 300) || this.L || this.t.isPlaying()) {
return;
}
c("Video cache error during stream. ResponseCode=" + i + ", exception=" + string);
}
}
}
@Override
public boolean q() {
return y() >= this.a.N();
}
@Override
protected boolean r() {
return s() && !q();
}
@Override
protected void t() {
long j;
int l;
if (this.a.aa() >= 0 || this.a.ab() >= 0) {
int i = (this.a.aa() > 0L ? 1 : (this.a.aa() == 0L ? 0 : -1));
com.applovin.impl.sdk.ad.e eVar = this.a;
if (i >= 0) {
j = eVar.aa();
} else {
com.applovin.impl.sdk.ad.a aVar = (com.applovin.impl.sdk.ad.a) eVar;
long j2 = this.B;
long j3 = j2 > 0 ? 0 + j2 : 0L;
if (aVar.ac() && ((l = (int) ((com.applovin.impl.sdk.ad.a) this.a).l()) > 0 || (l = (int) aVar.s()) > 0)) {
j3 += TimeUnit.SECONDS.toMillis(l);
}
double d = j3;
double ab = this.a.ab();
Double.isNaN(ab);
Double.isNaN(d);
j = (long) (d * (ab / 100.0d));
}
b(j);
}
}
public void u() {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (f.this.u != null) {
f.this.u.a();
}
}
});
}
public void v() {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (f.this.u != null) {
f.this.u.b();
}
}
});
}
public void w() {
if (this.E == null) {
return;
}
try {
float f = !this.A ? 0 : 1;
this.E.setVolume(f, f);
boolean z = this.A ? false : true;
this.A = z;
e(z);
a(this.A, 0L);
} catch (Throwable unused) {
}
}
public void x() {
if (w.a()) {
this.c.b("AppLovinFullscreenActivity", "Showing postitial...");
}
d(this.a.aI());
this.D.a(this.g, this.f);
a("javascript:al_onPoststitialShow(" + this.j + "," + this.k + ");", this.a.P());
if (this.g != null) {
int i = (this.a.s() > 0L ? 1 : (this.a.s() == 0L ? 0 : -1));
m mVar = this.g;
if (i >= 0) {
a(mVar, this.a.s(), new Runnable() {
@Override
public void run() {
f.this.i = SystemClock.elapsedRealtime();
}
});
} else {
mVar.setVisibility(0);
}
}
this.C = true;
}
public int y() {
long currentPosition = this.t.getCurrentPosition();
if (this.L) {
return 100;
}
return currentPosition > 0 ? (int) ((((float) currentPosition) / ((float) this.B)) * 100.0f) : this.J;
}
}