Kufar v3.2.0版本的 MD5 值为:6a4d203db1c561c7e3bcd50d23fed59f
以下内容为反编译后的 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 by.kufar.complaint.ui.ComplaintActivity;
import com.applovin.adview.AppLovinAdView;
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.t;
import com.applovin.impl.adview.u;
import com.applovin.impl.adview.v;
import com.applovin.impl.adview.w;
import com.applovin.impl.sdk.e.o;
import com.applovin.impl.sdk.e.z;
import com.applovin.impl.sdk.p;
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.k;
import com.applovin.impl.sdk.utils.r;
import com.applovin.impl.sdk.utils.s;
import com.applovin.impl.sdk.y;
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 final ProgressBar A;
@Nullable
protected ImageView B;
protected final j C;
protected boolean D;
protected long E;
protected boolean F;
private final com.applovin.impl.adview.activity.a.c G;
private MediaPlayer H;
private final b I;
private final a J;
private final Handler K;
private final boolean L;
private int M;
private int N;
private boolean O;
private final AtomicBoolean P;
private final AtomicBoolean Q;
private long R;
private long S;
protected final AppLovinVideoView f29681v;
protected final com.applovin.impl.adview.a f29682w;
@Nullable
protected final m f29683x;
@Nullable
protected final ImageView f29684y;
@Nullable
protected v f29685z;
public class a implements w.a {
private a() {
}
@Override
public void a(v vVar) {
y yVar = f.this.f29606c;
if (y.a()) {
f.this.f29606c.b("AppLovinFullscreenActivity", "Clicking through from video button...");
}
f.this.a(vVar.getAndClearLastClickLocation(), false);
}
@Override
public void b(v vVar) {
y yVar = f.this.f29606c;
if (y.a()) {
f.this.f29606c.b("AppLovinFullscreenActivity", "Closing ad from video button...");
}
f.this.h();
}
@Override
public void c(v vVar) {
y yVar = f.this.f29606c;
if (y.a()) {
f.this.f29606c.b("AppLovinFullscreenActivity", "Skipping video from video button...");
}
f.this.c();
}
@Override
public void d(v vVar) {
y yVar = f.this.f29606c;
if (y.a()) {
f.this.f29606c.b("AppLovinFullscreenActivity", "Attempting to install app from video button...");
}
f.this.a(vVar.getAndClearLastClickLocation(), true);
}
}
public 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, false);
}
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
y yVar = f.this.f29606c;
if (y.a()) {
f.this.f29606c.b("AppLovinFullscreenActivity", "Video completed");
}
f.this.O = true;
f fVar = f.this;
if (!fVar.f29615l) {
fVar.A();
} else if (fVar.t()) {
f.this.F();
}
}
@Override
public boolean onError(MediaPlayer mediaPlayer, int i11, int i12) {
f.this.c("Video view error (" + i11 + "," + i12 + ")");
f.this.f29681v.start();
return true;
}
@Override
public boolean onInfo(MediaPlayer mediaPlayer, int i11, int i12) {
y yVar = f.this.f29606c;
if (y.a()) {
f.this.f29606c.b("AppLovinFullscreenActivity", "MediaPlayer Info: (" + i11 + ", " + i12 + ")");
}
if (i11 == 701) {
f.this.x();
f.this.f29607d.g();
return false;
}
if (i11 == 3) {
f.this.C.a();
f fVar = f.this;
if (fVar.f29683x != null) {
fVar.C();
}
f.this.y();
if (f.this.f29623t.c()) {
f.this.e();
return false;
}
return false;
}
if (i11 == 702) {
f.this.y();
return false;
}
return false;
}
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
f.this.H = mediaPlayer;
mediaPlayer.setOnInfoListener(f.this.I);
mediaPlayer.setOnErrorListener(f.this.I);
float f11 = !f.this.D ? 1 : 0;
mediaPlayer.setVolume(f11, f11);
f.this.c(mediaPlayer.getDuration());
f.this.u();
y yVar = f.this.f29606c;
if (y.a()) {
f.this.f29606c.b("AppLovinFullscreenActivity", "MediaPlayer prepared: " + f.this.H);
}
}
}
public class c implements View.OnClickListener {
private c() {
}
@Override
public void onClick(View view) {
f fVar = f.this;
if (view == fVar.f29683x) {
if (fVar.s()) {
f.this.e();
f.this.p();
f.this.f29623t.b();
return;
}
f.this.c();
return;
}
if (view == fVar.f29684y) {
fVar.z();
return;
}
y yVar = fVar.f29606c;
if (y.a()) {
f.this.f29606c.e("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
}
}
}
public f(com.applovin.impl.sdk.ad.e eVar, Activity activity, @Nullable Map<String, Object> map, p pVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
super(eVar, activity, map, pVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
this.G = new com.applovin.impl.adview.activity.a.c(this.f29604a, this.f29608e, this.f29605b);
this.B = null;
b bVar = new b();
this.I = bVar;
a aVar = new a();
this.J = aVar;
Handler handler = new Handler(Looper.getMainLooper());
this.K = handler;
j jVar = new j(handler, this.f29605b);
this.C = jVar;
boolean f11 = this.f29604a.f();
this.L = f11;
this.D = Utils.isVideoMutedInitially(this.f29605b);
this.N = -1;
this.P = new AtomicBoolean();
this.Q = new AtomicBoolean();
this.R = -2L;
this.S = 0L;
if (eVar.hasVideoUrl()) {
AppLovinVideoView appLovinVideoView = new AppLovinVideoView(activity);
this.f29681v = appLovinVideoView;
appLovinVideoView.setOnPreparedListener(bVar);
appLovinVideoView.setOnCompletionListener(bVar);
appLovinVideoView.setOnErrorListener(bVar);
appLovinVideoView.setOnTouchListener(new AppLovinTouchToClickListener(pVar, com.applovin.impl.sdk.c.b.aZ, activity, bVar));
c cVar = new c();
if (eVar.r() >= 0) {
m mVar = new m(eVar.x(), activity);
this.f29683x = mVar;
mVar.setVisibility(8);
mVar.setOnClickListener(cVar);
} else {
this.f29683x = null;
}
if (a(this.D, pVar)) {
ImageView imageView = new ImageView(activity);
this.f29684y = imageView;
imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
imageView.setClickable(true);
imageView.setOnClickListener(cVar);
e(this.D);
} else {
this.f29684y = null;
}
String C = eVar.C();
if (StringUtils.isValidString(C)) {
w wVar = new w(pVar);
wVar.a(new WeakReference<>(aVar));
v vVar = new v(wVar, activity);
this.f29685z = vVar;
vVar.a(C);
} else {
this.f29685z = null;
}
if (f11) {
com.applovin.impl.adview.a aVar2 = new com.applovin.impl.adview.a(activity, ((Integer) pVar.a(com.applovin.impl.sdk.c.b.cQ)).intValue(), R.attr.progressBarStyleLarge);
this.f29682w = aVar2;
aVar2.setColor(Color.parseColor("#75FFFFFF"));
aVar2.setBackgroundColor(Color.parseColor("#00000000"));
aVar2.setVisibility(8);
AppLovinCommunicator.getInstance(activity).subscribe(this, "video_caching_failed");
} else {
this.f29682w = null;
}
if (eVar.O()) {
ProgressBar progressBar = new ProgressBar(activity, null, R.attr.progressBarStyleHorizontal);
this.A = progressBar;
progressBar.setMax(10000);
progressBar.setPadding(0, 0, 0, 0);
if (com.applovin.impl.sdk.utils.h.d()) {
progressBar.setProgressTintList(ColorStateList.valueOf(eVar.P()));
}
jVar.a("PROGRESS_BAR", ((Long) pVar.a(com.applovin.impl.sdk.c.b.cN)).longValue(), new j.a() {
@Override
public void a() {
f fVar = f.this;
if (fVar.F) {
fVar.A.setVisibility(8);
return;
}
float currentPosition = fVar.f29681v.getCurrentPosition();
f fVar2 = f.this;
fVar2.A.setProgress((int) ((currentPosition / ((float) fVar2.E)) * 10000.0f));
}
@Override
public boolean b() {
return !f.this.F;
}
});
return;
}
this.A = null;
return;
}
throw new IllegalStateException("Attempting to use fullscreen video ad presenter for non-video ad");
}
public void C() {
if (this.Q.compareAndSet(false, true)) {
a(this.f29683x, this.f29604a.r(), new Runnable() {
@Override
public void run() {
f.this.R = -1L;
f.this.S = SystemClock.elapsedRealtime();
}
});
}
}
private void D() {
v vVar;
final boolean z11;
t D = this.f29604a.D();
if (D != null && D.e() && !this.F && (vVar = this.f29685z) != null) {
if (vVar.getVisibility() == 4) {
z11 = true;
} else {
z11 = false;
}
final long f11 = D.f();
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (z11) {
r.a(f.this.f29685z, f11, (Runnable) null);
} else {
r.b(f.this.f29685z, f11, null);
}
}
});
}
}
public void E() {
if (this.F) {
if (y.a()) {
this.f29606c.d("AppLovinFullscreenActivity", "Skip video resume - postitial shown");
return;
}
return;
}
if (this.f29605b.Y().isApplicationPaused()) {
if (y.a()) {
this.f29606c.d("AppLovinFullscreenActivity", "Skip video resume - app paused");
return;
}
return;
}
if (this.N >= 0) {
if (y.a()) {
this.f29606c.b("AppLovinFullscreenActivity", "Resuming video at position " + this.N + "ms for MediaPlayer: " + this.H);
}
this.f29681v.seekTo(this.N);
this.f29681v.start();
this.C.a();
this.N = -1;
a(new Runnable() {
@Override
public void run() {
com.applovin.impl.adview.a aVar = f.this.f29682w;
if (aVar != null) {
aVar.a();
f.this.a(new Runnable() {
@Override
public void run() {
f.this.f29682w.b();
}
}, 2000L);
}
}
}, 250L);
return;
}
if (y.a()) {
this.f29606c.b("AppLovinFullscreenActivity", "Invalid last video position");
}
}
public void F() {
this.G.a(this.f29612i);
this.f29614k = SystemClock.elapsedRealtime();
}
public void A() {
if (y.a()) {
this.f29606c.b("AppLovinFullscreenActivity", "Showing postitial...");
}
d(this.f29604a.aL());
this.G.a(this.f29611h, this.f29610g, this.f29609f);
a("javascript:al_onPoststitialShow(" + this.f29616m + "," + this.f29617n + ");", this.f29604a.S());
if (this.f29611h != null) {
if (this.f29604a.t() >= 0) {
a(this.f29611h, this.f29604a.t(), new Runnable() {
@Override
public void run() {
f.this.f29614k = SystemClock.elapsedRealtime();
}
});
} else {
this.f29611h.setVisibility(0);
}
}
ArrayList arrayList = new ArrayList();
m mVar = this.f29611h;
if (mVar != null) {
arrayList.add(new com.applovin.impl.sdk.a.d(mVar, FriendlyObstructionPurpose.CLOSE_AD, "close button"));
}
u uVar = this.f29610g;
if (uVar != null && uVar.b()) {
u uVar2 = this.f29610g;
arrayList.add(new com.applovin.impl.sdk.a.d(uVar2, FriendlyObstructionPurpose.NOT_VISIBLE, uVar2.getIdentifier()));
}
this.f29604a.o().a(this.f29609f, arrayList);
v();
this.F = true;
}
public int B() {
long currentPosition = this.f29681v.getCurrentPosition();
if (this.O) {
return 100;
}
if (currentPosition > 0) {
return (int) ((((float) currentPosition) / ((float) this.E)) * 100.0f);
}
return this.M;
}
@Override
public String getCommunicatorId() {
return "FullscreenVideoAdPresenter";
}
@Override
public void h() {
this.C.b();
this.K.removeCallbacksAndMessages(null);
m();
super.h();
}
@Override
@SuppressLint({"LongLogTag"})
public void k() {
if (y.a()) {
this.f29606c.c("AppLovinFullscreenActivity", "Destroying video components");
}
try {
if (((Boolean) this.f29605b.a(com.applovin.impl.sdk.c.b.fR)).booleanValue()) {
s.a(this.f29685z);
this.f29685z = null;
}
if (this.L) {
AppLovinCommunicator.getInstance(this.f29608e).unsubscribe(this, "video_caching_failed");
}
AppLovinVideoView appLovinVideoView = this.f29681v;
if (appLovinVideoView != null) {
appLovinVideoView.pause();
this.f29681v.stopPlayback();
}
MediaPlayer mediaPlayer = this.H;
if (mediaPlayer != null) {
mediaPlayer.release();
}
} catch (Throwable th2) {
Log.e("AppLovinFullscreenActivity", "Unable to destroy presenter", th2);
}
super.k();
}
@Override
public void m() {
super.a(B(), this.L, r(), this.R);
}
@Override
public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
if ("video_caching_failed".equals(appLovinCommunicatorMessage.getTopic())) {
Bundle messageData = appLovinCommunicatorMessage.getMessageData();
long j11 = messageData.getLong(ComplaintActivity.KEY_AD_ID);
if (((Boolean) this.f29605b.a(com.applovin.impl.sdk.c.b.f31608fz)).booleanValue() && j11 == this.f29604a.getAdIdNumber() && this.L) {
int i11 = messageData.getInt("load_response_code");
String string = messageData.getString("load_exception_message");
if ((string != null || i11 < 200 || i11 >= 300) && !this.O && !this.f29681v.isPlaying()) {
c("Video cache error during stream. ResponseCode=" + i11 + ", exception=" + string);
}
}
}
}
@Override
public boolean r() {
if (B() >= this.f29604a.Q()) {
return true;
}
return false;
}
@Override
public boolean s() {
if (t() && !r()) {
return true;
}
return false;
}
@Override
public void u() {
long ae2;
long millis;
long j11 = 0;
if (this.f29604a.ad() >= 0 || this.f29604a.ae() >= 0) {
if (this.f29604a.ad() >= 0) {
ae2 = this.f29604a.ad();
} else {
com.applovin.impl.sdk.ad.a aVar = (com.applovin.impl.sdk.ad.a) this.f29604a;
long j12 = this.E;
if (j12 > 0) {
j11 = 0 + j12;
}
if (aVar.af()) {
int l11 = (int) ((com.applovin.impl.sdk.ad.a) this.f29604a).l();
if (l11 > 0) {
millis = TimeUnit.SECONDS.toMillis(l11);
} else {
int t11 = (int) aVar.t();
if (t11 > 0) {
millis = TimeUnit.SECONDS.toMillis(t11);
}
}
j11 += millis;
}
ae2 = (long) (j11 * (this.f29604a.ae() / 100.0d));
}
b(ae2);
}
}
@Override
public void w() {
super.w();
this.G.a(this.f29685z);
this.G.a((View) this.f29683x);
if (!t() || this.F) {
F();
}
}
public void x() {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
com.applovin.impl.adview.a aVar = f.this.f29682w;
if (aVar != null) {
aVar.a();
}
}
});
}
public void y() {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
com.applovin.impl.adview.a aVar = f.this.f29682w;
if (aVar != null) {
aVar.b();
}
}
});
}
public void z() {
int i11;
MediaPlayer mediaPlayer = this.H;
if (mediaPlayer == null) {
return;
}
try {
boolean z11 = false;
if (!this.D) {
i11 = 0;
} else {
i11 = 1;
}
float f11 = i11;
mediaPlayer.setVolume(f11, f11);
if (!this.D) {
z11 = true;
}
this.D = z11;
e(z11);
a(this.D, 0L);
} catch (Throwable unused) {
}
}
public void c(long j11) {
this.E = j11;
}
@Override
public void d() {
a((ViewGroup) null);
}
@Override
public void e() {
if (y.a()) {
this.f29606c.b("AppLovinFullscreenActivity", "Pausing video");
}
this.N = this.f29681v.getCurrentPosition();
this.f29681v.pause();
this.C.c();
if (y.a()) {
this.f29606c.b("AppLovinFullscreenActivity", "Paused video at position " + this.N + "ms");
}
}
private void d(boolean z11) {
this.M = B();
if (z11) {
this.f29681v.pause();
} else {
this.f29681v.stopPlayback();
}
}
@Override
public void b() {
if (y.a()) {
this.f29606c.b("AppLovinFullscreenActivity", "Skipping video from prompt");
}
c();
}
@Override
public void c(boolean z11) {
super.c(z11);
if (z11) {
a(0L);
} else {
if (this.F) {
return;
}
e();
}
}
@Override
public void a(@Nullable ViewGroup viewGroup) {
String str;
this.G.a(this.f29684y, this.f29683x, this.f29685z, this.f29682w, this.A, this.f29681v, this.f29609f, this.f29610g, this.B, viewGroup);
if (com.applovin.impl.sdk.utils.h.g() && (str = this.f29605b.C().getExtraParameters().get(AppLovinSdkExtraParameterKey.AUDIO_FOCUS_REQUEST)) != null) {
this.f29681v.setAudioFocusRequest(Integer.parseInt(str));
}
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
a(!this.L);
this.f29681v.setVideoURI(this.f29604a.h());
StrictMode.setThreadPolicy(allowThreadDiskReads);
if (this.f29604a.am()) {
this.f29623t.a(this.f29604a, new Runnable() {
@Override
public void run() {
f.this.a(250L);
}
});
}
u uVar = this.f29610g;
if (uVar != null) {
uVar.a();
}
this.f29681v.start();
if (this.L) {
x();
}
this.f29609f.renderAd(this.f29604a);
this.f29607d.b(this.L ? 1L : 0L);
if (this.f29683x != null) {
this.f29605b.M().a(new z(this.f29605b, new Runnable() {
@Override
public void run() {
f.this.C();
}
}), o.a.MAIN, this.f29604a.s(), true);
}
super.b(this.D);
}
private void e(boolean z11) {
if (com.applovin.impl.sdk.utils.h.d()) {
AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) this.f29608e.getDrawable(z11 ? com.applovin.sdk.R.drawable.applovin_ic_unmute_to_mute : com.applovin.sdk.R.drawable.applovin_ic_mute_to_unmute);
if (animatedVectorDrawable != null) {
this.f29684y.setScaleType(ImageView.ScaleType.FIT_XY);
this.f29684y.setImageDrawable(animatedVectorDrawable);
animatedVectorDrawable.start();
return;
}
}
Uri aE = z11 ? this.f29604a.aE() : this.f29604a.aF();
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
this.f29684y.setImageURI(aE);
StrictMode.setThreadPolicy(allowThreadDiskReads);
}
public void c() {
this.R = SystemClock.elapsedRealtime() - this.S;
if (y.a()) {
this.f29606c.b("AppLovinFullscreenActivity", "Skipping video with skip time: " + this.R + "ms");
}
this.f29607d.f();
this.f29616m++;
if (this.f29604a.y()) {
h();
} else {
A();
}
}
public void c(String str) {
if (y.a()) {
this.f29606c.e("AppLovinFullscreenActivity", "Encountered media error: " + str + " for ad: " + this.f29604a);
}
if (this.P.compareAndSet(false, true)) {
AppLovinAdDisplayListener appLovinAdDisplayListener = this.f29621r;
if (appLovinAdDisplayListener instanceof com.applovin.impl.sdk.ad.h) {
((com.applovin.impl.sdk.ad.h) appLovinAdDisplayListener).onAdDisplayFailed(str);
}
h();
}
}
public void a(PointF pointF, boolean z11) {
if (this.f29604a.E()) {
if (y.a()) {
this.f29606c.b("AppLovinFullscreenActivity", "Clicking through video");
}
Uri k11 = this.f29604a.k();
if (k11 != null) {
AppLovinAdView appLovinAdView = this.f29609f;
this.f29605b.E().trackAndLaunchVideoClick(this.f29604a, k11, pointF, z11, this, appLovinAdView != null ? appLovinAdView.getContext() : p.y());
k.a(this.f29620q, this.f29604a);
this.f29607d.b();
this.f29617n++;
return;
}
return;
}
D();
}
@Override
public void a(long j11) {
a(new Runnable() {
@Override
public void run() {
f.this.E();
}
}, j11);
}
private static boolean a(boolean z11, p pVar) {
if (!((Boolean) pVar.a(com.applovin.impl.sdk.c.b.cF)).booleanValue()) {
return false;
}
if (!((Boolean) pVar.a(com.applovin.impl.sdk.c.b.cG)).booleanValue() || z11) {
return true;
}
return ((Boolean) pVar.a(com.applovin.impl.sdk.c.b.cI)).booleanValue();
}
@Override
public void a() {
if (y.a()) {
this.f29606c.b("AppLovinFullscreenActivity", "Continue video from prompt - will resume in onWindowFocusChanged(true) when alert dismisses");
}
}
}