Perfume Of Love v2.14.9版本的 MD5 值为:16011aefc5a55805771706ce3b259b4e
以下内容为反编译后的 f.java 源代码,内容仅作参考
package com.applovin.impl.adview.activity.b;
import android.app.Activity;
import android.content.Context;
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.AppLovinSdkExtraParameterKey;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sdk.utils.Utils;
import com.applovin.impl.sdk.utils.h;
import com.applovin.impl.sdk.utils.k;
import com.applovin.impl.sdk.utils.r;
import com.applovin.impl.sdk.v;
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 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 ImageView A;
protected final j B;
protected boolean C;
protected long D;
protected boolean E;
private final com.applovin.impl.adview.activity.a.c F;
private MediaPlayer G;
private final b H;
private final a I;
private final Handler J;
private final boolean K;
private int L;
private int M;
private boolean N;
private final AtomicBoolean O;
private final AtomicBoolean P;
private long Q;
private long R;
protected final AppLovinVideoView u;
protected final com.applovin.impl.adview.a v;
protected final m w;
protected final ImageView x;
protected final t y;
protected final ProgressBar z;
private class a implements u.a {
private a() {
}
@Override
public void a(t tVar) {
v vVar = f.this.c;
if (v.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Clicking through from video button...");
}
f.this.a(tVar.getAndClearLastClickLocation());
}
@Override
public void b(t tVar) {
v vVar = f.this.c;
if (v.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Closing ad from video button...");
}
f.this.h();
}
@Override
public void c(t tVar) {
v vVar = f.this.c;
if (v.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) {
v vVar = f.this.c;
if (v.a()) {
f.this.c.b("AppLovinFullscreenActivity", "Video completed");
}
f.this.N = true;
if (!f.this.k) {
f.this.A();
} else if (f.this.t()) {
f.this.F();
}
}
@Override
public boolean onError(MediaPlayer mediaPlayer, int i, int i2) {
f fVar = f.this;
fVar.c("Video view error (" + i + "," + i2 + ")");
f.this.u.start();
return true;
}
@Override
public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) {
v vVar = f.this.c;
if (v.a()) {
v vVar2 = f.this.c;
vVar2.b("AppLovinFullscreenActivity", "MediaPlayer Info: (" + i + ", " + i2 + ")");
}
if (i == 701) {
f.this.x();
f.this.d.g();
return false;
} else if (i != 3) {
if (i == 702) {
f.this.y();
return false;
}
return false;
} else {
f.this.B.a();
if (f.this.w != null) {
f.this.C();
}
f.this.y();
if (f.this.s.c()) {
f.this.e();
return false;
}
return false;
}
}
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
f.this.G = mediaPlayer;
mediaPlayer.setOnInfoListener(f.this.H);
mediaPlayer.setOnErrorListener(f.this.H);
float f = !f.this.C ? 1 : 0;
mediaPlayer.setVolume(f, f);
f.this.c(mediaPlayer.getDuration());
f.this.u();
v vVar = f.this.c;
if (v.a()) {
f.this.c.b("AppLovinFullscreenActivity", "MediaPlayer prepared: " + f.this.G);
}
}
}
private class c implements View.OnClickListener {
private c() {
}
@Override
public void onClick(View view) {
if (view == f.this.w) {
if (!f.this.s()) {
f.this.c();
return;
}
f.this.e();
f.this.p();
f.this.s.b();
} else if (view == f.this.x) {
f.this.z();
} else {
v vVar = f.this.c;
if (v.a()) {
v vVar2 = f.this.c;
vVar2.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.F = new com.applovin.impl.adview.activity.a.c(this.a, this.e, this.b);
this.A = null;
b bVar = new b();
this.H = bVar;
a aVar = new a();
this.I = aVar;
Handler handler = new Handler(Looper.getMainLooper());
this.J = handler;
j jVar = new j(handler, this.b);
this.B = jVar;
boolean f = this.a.f();
this.K = f;
this.C = Utils.isVideoMutedInitially(this.b);
this.M = -1;
this.O = new AtomicBoolean();
this.P = new AtomicBoolean();
this.Q = -2L;
this.R = 0L;
if (!eVar.hasVideoUrl()) {
throw new IllegalStateException("Attempting to use fullscreen video ad presenter for non-video ad");
}
AppLovinVideoView appLovinVideoView = new AppLovinVideoView(activity);
this.u = appLovinVideoView;
appLovinVideoView.setOnPreparedListener(bVar);
appLovinVideoView.setOnCompletionListener(bVar);
appLovinVideoView.setOnErrorListener(bVar);
appLovinVideoView.setOnTouchListener(new AppLovinTouchToClickListener(nVar, com.applovin.impl.sdk.c.b.ba, activity, bVar));
c cVar = new c();
if (eVar.r() >= 0) {
m mVar = new m(eVar.x(), activity);
this.w = mVar;
mVar.setVisibility(8);
mVar.setOnClickListener(cVar);
} else {
this.w = null;
}
if (a(this.C, nVar)) {
ImageView imageView = new ImageView(activity);
this.x = imageView;
imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
imageView.setClickable(true);
imageView.setOnClickListener(cVar);
e(this.C);
} else {
this.x = null;
}
String C = eVar.C();
if (StringUtils.isValidString(C)) {
u uVar = new u(nVar);
uVar.a(new WeakReference<>(aVar));
t tVar = new t(uVar, activity);
this.y = tVar;
tVar.a(C);
} else {
this.y = null;
}
if (f) {
com.applovin.impl.adview.a aVar2 = new com.applovin.impl.adview.a(activity, ((Integer) nVar.a(com.applovin.impl.sdk.c.b.cP)).intValue(), 16842874);
this.v = aVar2;
aVar2.setColor(Color.parseColor("#75FFFFFF"));
aVar2.setBackgroundColor(Color.parseColor("#00000000"));
aVar2.setVisibility(8);
AppLovinCommunicator.getInstance(activity).subscribe(this, "video_caching_failed");
} else {
this.v = null;
}
if (!eVar.O()) {
this.z = null;
return;
}
ProgressBar progressBar = new ProgressBar(activity, null, 16842872);
this.z = progressBar;
progressBar.setMax(10000);
progressBar.setPadding(0, 0, 0, 0);
if (h.d()) {
progressBar.setProgressTintList(ColorStateList.valueOf(eVar.P()));
}
jVar.a("PROGRESS_BAR", ((Long) nVar.a(com.applovin.impl.sdk.c.b.cM)).longValue(), new j.a() {
@Override
public void a() {
if (f.this.E) {
f.this.z.setVisibility(8);
return;
}
f.this.z.setProgress((int) ((f.this.u.getCurrentPosition() / ((float) f.this.D)) * 10000.0f));
}
@Override
public boolean b() {
return !f.this.E;
}
});
}
public void C() {
if (this.P.compareAndSet(false, true)) {
a(this.w, this.a.r(), new Runnable() {
@Override
public void run() {
f.this.Q = -1L;
f.this.R = SystemClock.elapsedRealtime();
}
});
}
}
private void D() {
t tVar;
s D = this.a.D();
if (D == null || !D.e() || this.E || (tVar = this.y) == null) {
return;
}
final boolean z = tVar.getVisibility() == 4;
final long f = D.f();
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (z) {
r.a(f.this.y, f, (Runnable) null);
} else {
r.b(f.this.y, f, null);
}
}
});
}
public void E() {
if (this.E) {
v vVar = this.c;
if (v.a()) {
this.c.d("AppLovinFullscreenActivity", "Skip video resume - postitial shown");
}
} else if (this.b.U().isApplicationPaused()) {
v vVar2 = this.c;
if (v.a()) {
this.c.d("AppLovinFullscreenActivity", "Skip video resume - app paused");
}
} else if (this.M < 0) {
v vVar3 = this.c;
if (v.a()) {
this.c.b("AppLovinFullscreenActivity", "Invalid last video position");
}
} else {
v vVar4 = this.c;
if (v.a()) {
v vVar5 = this.c;
vVar5.b("AppLovinFullscreenActivity", "Resuming video at position " + this.M + "ms for MediaPlayer: " + this.G);
}
this.u.seekTo(this.M);
this.u.start();
this.B.a();
this.M = -1;
a(new Runnable() {
@Override
public void run() {
if (f.this.v != null) {
f.this.v.a();
f.this.a(new Runnable() {
@Override
public void run() {
f.this.v.b();
}
}, 2000L);
}
}
}, 250L);
}
}
public void F() {
this.F.a(this.h);
this.j = SystemClock.elapsedRealtime();
}
private static boolean a(boolean z, n nVar) {
if (((Boolean) nVar.a(com.applovin.impl.sdk.c.b.cE)).booleanValue()) {
if (!((Boolean) nVar.a(com.applovin.impl.sdk.c.b.cF)).booleanValue() || z) {
return true;
}
return ((Boolean) nVar.a(com.applovin.impl.sdk.c.b.cH)).booleanValue();
}
return false;
}
private void d(boolean z) {
this.L = B();
if (z) {
this.u.pause();
} else {
this.u.stopPlayback();
}
}
private void e(boolean z) {
if (h.d()) {
AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) this.e.getDrawable(z ? R.drawable.applovin_ic_unmute_to_mute : R.drawable.applovin_ic_mute_to_unmute);
if (animatedVectorDrawable != null) {
this.x.setScaleType(ImageView.ScaleType.FIT_XY);
this.x.setImageDrawable(animatedVectorDrawable);
animatedVectorDrawable.start();
return;
}
}
Uri aC = z ? this.a.aC() : this.a.aD();
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
this.x.setImageURI(aC);
StrictMode.setThreadPolicy(allowThreadDiskReads);
}
public void A() {
v vVar = this.c;
if (v.a()) {
this.c.b("AppLovinFullscreenActivity", "Showing postitial...");
}
d(this.a.aJ());
this.F.a(this.g, this.f);
a("javascript:al_onPoststitialShow(" + this.l + "," + this.m + ");", this.a.S());
if (this.g != null) {
int i = (this.a.t() > 0L ? 1 : (this.a.t() == 0L ? 0 : -1));
m mVar = this.g;
if (i >= 0) {
a(mVar, this.a.t(), new Runnable() {
@Override
public void run() {
f.this.j = SystemClock.elapsedRealtime();
}
});
} else {
mVar.setVisibility(0);
}
}
v();
this.E = true;
}
public int B() {
long currentPosition = this.u.getCurrentPosition();
if (this.N) {
return 100;
}
return currentPosition > 0 ? (int) ((((float) currentPosition) / ((float) this.D)) * 100.0f) : this.L;
}
@Override
public void a() {
v vVar = this.c;
if (v.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.E();
}
}, j);
}
public void a(PointF pointF) {
Context x;
if (!this.a.E()) {
D();
return;
}
v vVar = this.c;
if (v.a()) {
this.c.b("AppLovinFullscreenActivity", "Clicking through video");
}
Uri k = this.a.k();
if (k != null) {
if (this.f != null) {
x = this.f.getContext();
} else {
n nVar = this.b;
x = n.x();
}
this.b.D().trackAndLaunchVideoClick(this.a, k, pointF, this, x);
k.a(this.p, this.a);
this.d.b();
this.m++;
}
}
@Override
public void a(ViewGroup viewGroup) {
String str;
this.F.a(this.x, this.w, this.y, this.v, this.z, this.u, this.f, this.A, viewGroup);
if (h.g() && (str = this.b.B().getExtraParameters().get(AppLovinSdkExtraParameterKey.AUDIO_FOCUS_REQUEST)) != null) {
this.u.setAudioFocusRequest(Integer.parseInt(str));
}
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
a(!this.K);
this.u.setVideoURI(this.a.h());
StrictMode.setThreadPolicy(allowThreadDiskReads);
if (this.a.am()) {
this.s.a(this.a, new Runnable() {
@Override
public void run() {
f.this.a(250L);
}
});
}
this.u.start();
if (this.K) {
x();
}
this.f.renderAd(this.a);
this.d.b(this.K ? 1L : 0L);
if (this.w != null) {
this.b.K().a(new z(this.b, new Runnable() {
@Override
public void run() {
f.this.C();
}
}), o.a.MAIN, this.a.s(), true);
}
super.b(this.C);
}
@Override
public void b() {
v vVar = this.c;
if (v.a()) {
this.c.b("AppLovinFullscreenActivity", "Skipping video from prompt");
}
c();
}
public void c() {
this.Q = SystemClock.elapsedRealtime() - this.R;
v vVar = this.c;
if (v.a()) {
this.c.b("AppLovinFullscreenActivity", "Skipping video with skip time: " + this.Q + "ms");
}
this.d.f();
this.l++;
if (this.a.y()) {
h();
} else {
A();
}
}
public void c(long j) {
this.D = j;
}
public void c(String str) {
v vVar = this.c;
if (v.a()) {
v vVar2 = this.c;
vVar2.e("AppLovinFullscreenActivity", "Encountered media error: " + str + " for ad: " + this.a);
}
if (this.O.compareAndSet(false, true)) {
if (this.q instanceof com.applovin.impl.sdk.ad.g) {
((com.applovin.impl.sdk.ad.g) this.q).onAdDisplayFailed(str);
}
h();
}
}
@Override
public void c(boolean z) {
super.c(z);
if (z) {
a(0L);
} else if (this.E) {
} else {
e();
}
}
@Override
public void d() {
a((ViewGroup) null);
}
@Override
public void e() {
v vVar = this.c;
if (v.a()) {
this.c.b("AppLovinFullscreenActivity", "Pausing video");
}
this.M = this.u.getCurrentPosition();
this.u.pause();
this.B.c();
v vVar2 = this.c;
if (v.a()) {
v vVar3 = this.c;
vVar3.b("AppLovinFullscreenActivity", "Paused video at position " + this.M + "ms");
}
}
@Override
public String getCommunicatorId() {
return "FullscreenVideoAdPresenter";
}
@Override
public void h() {
this.B.b();
this.J.removeCallbacksAndMessages(null);
m();
super.h();
}
@Override
public void k() {
v vVar = this.c;
if (v.a()) {
this.c.c("AppLovinFullscreenActivity", "Destroying video components");
}
try {
if (this.K) {
AppLovinCommunicator.getInstance(this.e).unsubscribe(this, "video_caching_failed");
}
AppLovinVideoView appLovinVideoView = this.u;
if (appLovinVideoView != null) {
appLovinVideoView.pause();
this.u.stopPlayback();
}
MediaPlayer mediaPlayer = this.G;
if (mediaPlayer != null) {
mediaPlayer.release();
}
} catch (Throwable th) {
Log.e("AppLovinFullscreenActivity", "Unable to destroy presenter", th);
}
super.k();
}
@Override
protected void m() {
super.a(B(), this.K, r(), this.Q);
}
@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.fg)).booleanValue() && j == this.a.getAdIdNumber() && this.K) {
int i = messageData.getInt("load_response_code");
String string = messageData.getString("load_exception_message");
if ((string == null && i >= 200 && i < 300) || this.N || this.u.isPlaying()) {
return;
}
c("Video cache error during stream. ResponseCode=" + i + ", exception=" + string);
}
}
}
@Override
public boolean r() {
return B() >= this.a.Q();
}
@Override
protected boolean s() {
return t() && !r();
}
@Override
protected void u() {
long ae;
int l;
if (this.a.ad() >= 0 || this.a.ae() >= 0) {
int i = (this.a.ad() > 0L ? 1 : (this.a.ad() == 0L ? 0 : -1));
com.applovin.impl.sdk.ad.e eVar = this.a;
if (i >= 0) {
ae = eVar.ad();
} else {
com.applovin.impl.sdk.ad.a aVar = (com.applovin.impl.sdk.ad.a) eVar;
long j = this.D;
long j2 = j > 0 ? 0 + j : 0L;
if (aVar.af() && ((l = (int) ((com.applovin.impl.sdk.ad.a) this.a).l()) > 0 || (l = (int) aVar.t()) > 0)) {
j2 += TimeUnit.SECONDS.toMillis(l);
}
ae = (long) (j2 * (this.a.ae() / 100.0d));
}
b(ae);
}
}
@Override
public void w() {
super.w();
this.F.a(this.y);
this.F.a((View) this.w);
if (!t() || this.E) {
F();
}
}
public void x() {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (f.this.v != null) {
f.this.v.a();
}
}
});
}
public void y() {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (f.this.v != null) {
f.this.v.b();
}
}
});
}
public void z() {
MediaPlayer mediaPlayer = this.G;
if (mediaPlayer == null) {
return;
}
try {
float f = !this.C ? 0 : 1;
mediaPlayer.setVolume(f, f);
boolean z = this.C ? false : true;
this.C = z;
e(z);
a(this.C, 0L);
} catch (Throwable unused) {
}
}
}