VegeFruits v7.1版本的 MD5 值为:2ff167dfba698c783e879938fe00b9ce
以下内容为反编译后的 az.java 源代码,内容仅作参考
package com.applovin.impl.adview;
import android.R;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.res.ColorStateList;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import com.applovin.adview.AppLovinAdView;
import com.applovin.adview.AppLovinTouchToClickListener;
import com.applovin.impl.sdk.AppLovinAdServiceImpl;
import com.applovin.impl.sdk.AppLovinSdkImpl;
import com.applovin.impl.sdk.dr;
import com.applovin.impl.sdk.ds;
import com.applovin.impl.sdk.dv;
import com.applovin.impl.sdk.fq;
import com.applovin.sdk.AppLovinAd;
import com.applovin.sdk.AppLovinAdSize;
import com.applovin.sdk.AppLovinAdType;
import com.applovin.sdk.AppLovinLogger;
import com.applovin.sdk.AppLovinSdkUtils;
import com.tapjoy.TapjoyConstants;
import java.lang.ref.WeakReference;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public abstract class az extends Activity implements aq {
public static final String KEY_WRAPPER_ID = "com.applovin.interstitial.wrapper_id";
public static volatile bz lastKnownWrapper = null;
private ak A;
private View B;
private ai C;
private ImageView D;
private com.applovin.impl.sdk.bb F;
private cl G;
private ProgressBar H;
private cn I;
private AppLovinAdView a;
private bz b;
protected am countdownManager;
public volatile com.applovin.impl.sdk.ad currentAd;
public String currentPlacement;
private dv d;
public AppLovinLogger logger;
public AppLovinSdkImpl sdk;
public dr settingsProxy;
private Handler v;
public AppLovinVideoView videoView;
private Handler w;
private FrameLayout x;
private ak y;
private View z;
private volatile boolean c = false;
private volatile boolean e = false;
private volatile boolean f = false;
private volatile boolean g = false;
private volatile boolean h = false;
private volatile boolean i = false;
private volatile boolean j = false;
private volatile boolean k = false;
private volatile boolean l = false;
protected volatile boolean poststitialWasDisplayed = false;
private boolean m = false;
protected volatile boolean videoMuted = false;
private volatile boolean n = false;
private boolean o = true;
private boolean p = false;
protected int computedLengthSeconds = 0;
private boolean q = false;
private long r = 0;
private long s = 0;
private int t = 0;
private AtomicBoolean u = new AtomicBoolean(false);
private WeakReference<MediaPlayer> E = new WeakReference<>(null);
private boolean A() {
return E() && !isFullyWatched() && this.settingsProxy.E() && this.F != null;
}
private boolean B() {
return F() && !D() && this.settingsProxy.F() && this.F != null;
}
private int C() {
if (!(this.currentAd instanceof com.applovin.impl.sdk.g)) {
return 0;
}
float h = ((com.applovin.impl.sdk.g) this.currentAd).h();
if (h <= 0.0f) {
h = this.currentAd.q();
}
return (int) Math.min((fq.a(System.currentTimeMillis() - this.r) / h) * 100.0d, 100.0d);
}
private boolean D() {
return C() >= this.currentAd.K();
}
private boolean E() {
return AppLovinAdType.INCENTIVIZED.equals(this.currentAd.getType());
}
private boolean F() {
return !this.currentAd.f() && E();
}
private void G() {
if (!this.c || this.q) {
if (this.a == null) {
exitWithError("AdView was null");
return;
}
this.a.setAdDisplayListener(new bm(this));
this.a.setAdClickListener(new bn(this));
this.currentAd = (com.applovin.impl.sdk.ad) this.b.b();
a(this.currentAd);
k();
this.n = this.currentAd.b();
if (this.n) {
this.logger.d("InterActivity", "Preparing stream for " + this.currentAd.d());
} else {
this.logger.d("InterActivity", "Preparing cached video playback for " + this.currentAd.d());
}
a(this.currentAd.d());
this.y.bringToFront();
if (o() && this.z != null) {
this.z.bringToFront();
}
if (this.A != null) {
this.A.bringToFront();
}
if (!this.currentAd.Q()) {
this.a.renderAd(this.currentAd, this.currentPlacement);
}
this.b.a(true);
if (this.currentAd.f()) {
return;
}
if (F() && this.settingsProxy.K()) {
d(this.currentAd);
}
showPoststitial();
}
}
private boolean H() {
return this.videoMuted;
}
private void I() {
this.sdk.put(ds.h, Integer.valueOf(this.videoView.getCurrentPosition()));
this.sdk.put(ds.i, true);
try {
this.countdownManager.c();
} catch (Throwable th) {
this.logger.e("InterActivity", "Unable to pause countdown timers", th);
}
this.videoView.pause();
}
private void J() {
long max = Math.max(0L, new dr(this.sdk).ab());
if (max > 0) {
this.sdk.getLogger().d("InterActivity", "Resuming video with delay of " + max);
this.w.postDelayed(new bo(this), max);
} else {
this.sdk.getLogger().d("InterActivity", "Resuming video immediately");
K();
}
}
public void K() {
if (this.poststitialWasDisplayed || this.videoView == null || this.videoView.isPlaying()) {
return;
}
this.videoView.seekTo(((Integer) this.sdk.get(ds.h, Integer.valueOf(this.videoView.getDuration()))).intValue());
this.videoView.start();
this.countdownManager.a();
}
private void L() {
if (this.j) {
return;
}
try {
if (this.currentAd.f()) {
double videoPercentViewed = getVideoPercentViewed();
String a = this.currentAd.a((int) videoPercentViewed, this.currentPlacement, this.n);
if (fq.isValidString(a)) {
this.sdk.getPostbackService().dispatchPostbackAsync(a, null);
} else {
this.logger.e("InterActivity", "Received invalid placement aware parameterized video completion url. No postback dispatched.");
}
a(this.currentAd, videoPercentViewed, isFullyWatched());
return;
}
if ((this.currentAd instanceof com.applovin.impl.sdk.g) && F() && this.settingsProxy.K()) {
int C = C();
this.logger.d("InterActivity", "Rewarded playable engaged at " + C + " percent");
a(this.currentAd, C, C >= this.currentAd.K());
}
} catch (Throwable th) {
if (this.logger != null) {
this.logger.e("InterActivity", "Failed to notify end listener.", th);
}
}
}
private int a(int i) {
return AppLovinSdkUtils.dpToPx(this, i);
}
private int a(int i, boolean z) {
if (z) {
if (i == 0) {
return 0;
}
if (i == 1) {
return 9;
}
if (i == 2) {
return 8;
}
if (i == 3) {
return 1;
}
} else {
if (i == 0) {
return 1;
}
if (i == 1) {
return 0;
}
if (i == 2) {
return 9;
}
if (i == 3) {
return 8;
}
}
return -1;
}
private static int a(Display display) {
if (display.getWidth() == display.getHeight()) {
return 3;
}
return display.getWidth() < display.getHeight() ? 1 : 2;
}
private void a(long j, ak akVar) {
this.w.postDelayed(new bf(this, akVar), j);
}
private void a(Uri uri) {
this.videoView = new AppLovinVideoView(this);
if (uri != null) {
this.videoView.setOnPreparedListener(new bp(this));
this.videoView.setOnCompletionListener(new bs(this));
this.videoView.setOnErrorListener(new bt(this));
this.videoView.setVideoURI(uri);
}
this.videoView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1, 17));
this.videoView.setOnTouchListener(new AppLovinTouchToClickListener(this, new bv(this)));
this.x.addView(this.videoView);
setContentView(this.x);
q();
}
public void a(View view, boolean z, long j) {
AlphaAnimation alphaAnimation = new AlphaAnimation(z ? 0.0f : 1.0f, z ? 1.0f : 0.0f);
alphaAnimation.setDuration(j);
alphaAnimation.setAnimationListener(new bl(this, view, z));
view.startAnimation(alphaAnimation);
}
private void a(com.applovin.impl.sdk.ad adVar) {
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
this.x = new FrameLayout(this);
this.x.setLayoutParams(layoutParams);
this.x.setBackgroundColor(adVar.E());
this.w = new Handler();
this.v = new Handler();
this.countdownManager = new am(this.v, this.sdk);
}
public void a(AppLovinAd appLovinAd) {
com.applovin.impl.sdk.bk.a(this.b.d(), appLovinAd, this.sdk);
this.g = true;
}
private void a(AppLovinAd appLovinAd, double d, boolean z) {
this.j = true;
com.applovin.impl.sdk.bk.a(this.b.c(), appLovinAd, d, z, this.sdk);
}
private void a(boolean z) {
AppLovinSdkUtils.safePopulateImageView(this.D, z ? this.currentAd.W() : this.currentAd.X(), a(this.settingsProxy.s()));
}
private boolean a() {
int identifier = getResources().getIdentifier(this.settingsProxy.M(), "bool", TapjoyConstants.TJC_DEVICE_PLATFORM_TYPE);
return identifier > 0 && getResources().getBoolean(identifier);
}
public void b() {
getWindow().getDecorView().setSystemUiVisibility(5894);
}
private void b(int i, boolean z) {
boolean J = this.settingsProxy.J();
if (this.b.f() != com.applovin.impl.sdk.af.ACTIVITY_PORTRAIT) {
if (this.b.f() == com.applovin.impl.sdk.af.ACTIVITY_LANDSCAPE) {
if (z) {
if (i != 0 && i != 2) {
this.c = true;
setRequestedOrientation(0);
return;
} else {
if (J) {
setRequestedOrientation(i == 2 ? 8 : 0);
return;
}
return;
}
}
if (i != 1 && i != 3) {
this.c = true;
setRequestedOrientation(0);
return;
} else {
if (J) {
setRequestedOrientation(i != 1 ? 8 : 0);
return;
}
return;
}
}
return;
}
if (!z) {
if (i != 0 && i != 2) {
this.c = true;
setRequestedOrientation(1);
return;
} else {
if (J) {
setRequestedOrientation(i != 0 ? 9 : 1);
return;
}
return;
}
}
if (i != 1 && i != 3) {
this.c = true;
setRequestedOrientation(1);
} else if (J) {
if (i == 1) {
setRequestedOrientation(9);
} else {
setRequestedOrientation(1);
}
}
}
public void b(AppLovinAd appLovinAd) {
dismiss();
c(appLovinAd);
}
private void b(boolean z) {
this.videoMuted = z;
MediaPlayer mediaPlayer = this.E.get();
if (mediaPlayer != null) {
int i = z ? 0 : 1;
mediaPlayer.setVolume(i, i);
}
}
private void c(AppLovinAd appLovinAd) {
if (this.h) {
return;
}
this.h = true;
if (this.b != null) {
com.applovin.impl.sdk.bk.b(this.b.d(), appLovinAd, this.sdk);
}
}
private boolean c() {
if (this.b == null || this.settingsProxy == null || this.settingsProxy.a()) {
return true;
}
if (this.settingsProxy.c() && this.k) {
return true;
}
return this.settingsProxy.b() && this.poststitialWasDisplayed;
}
public void d() {
if (!this.currentAd.x() || this.currentAd.g() == null) {
f();
g();
} else {
this.sdk.getLogger().d("InterActivity", "Clicking through video...");
clickThroughFromVideo();
}
}
private void d(AppLovinAd appLovinAd) {
if (this.i) {
return;
}
this.i = true;
com.applovin.impl.sdk.bk.a(this.b.c(), appLovinAd, this.sdk);
}
public void e() {
if (this.d.b() == -1) {
this.d.b(System.currentTimeMillis() - this.r);
}
}
private void f() {
if (!this.settingsProxy.p() || this.C == null || this.C.getVisibility() == 8) {
return;
}
a(this.C, this.C.getVisibility() == 4, 750L);
}
private void g() {
ck w = this.currentAd.w();
if (w == null || !w.e() || this.poststitialWasDisplayed || this.G == null) {
return;
}
a(this.G, this.G.getVisibility() == 4, w.f());
}
private void h() {
this.sdk.put(ds.i, false);
this.sdk.put(ds.h, 0);
}
public void i() {
this.f = true;
showPoststitial();
}
public boolean j() {
return ((Integer) this.sdk.get(ds.h, 0)).intValue() > 0 ? this.videoMuted : this.settingsProxy.y() ? this.sdk.getSettings().isMuted() : this.settingsProxy.w();
}
private void k() {
this.y = ak.a(this.sdk, this, this.currentAd.r());
this.y.setVisibility(8);
this.y.setOnClickListener(new bw(this));
int a = a(this.currentAd.L());
int i = (this.currentAd.O() ? 3 : 5) | 48;
int i2 = (this.currentAd.P() ? 3 : 5) | 48;
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(a, a, i | 48);
this.y.a(a);
int a2 = a(this.currentAd.M());
int a3 = a(this.currentAd.N());
layoutParams.setMargins(a3, a2, a3, a2);
this.x.addView(this.y, layoutParams);
this.A = ak.a(this.sdk, this, this.currentAd.s());
this.A.setVisibility(8);
this.A.setOnClickListener(new bx(this));
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(a, a, i2);
layoutParams2.setMargins(a3, a2, a3, a2);
this.A.a(a);
this.x.addView(this.A, layoutParams2);
this.A.bringToFront();
if (o()) {
int a4 = a(new dr(this.sdk).k());
this.z = new View(this);
this.z.setBackgroundColor(0);
this.z.setVisibility(8);
this.B = new View(this);
this.B.setBackgroundColor(0);
this.B.setVisibility(8);
int i3 = a + a4;
int a5 = a2 - a(5);
FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(i3, i3, i);
layoutParams3.setMargins(a5, a5, a5, a5);
FrameLayout.LayoutParams layoutParams4 = new FrameLayout.LayoutParams(i3, i3, i2);
layoutParams4.setMargins(a5, a5, a5, a5);
this.z.setOnClickListener(new by(this));
this.B.setOnClickListener(new bb(this));
this.x.addView(this.z, layoutParams3);
this.z.bringToFront();
this.x.addView(this.B, layoutParams4);
this.B.bringToFront();
}
}
public void l() {
if (this.D == null) {
try {
this.videoMuted = j();
this.D = new ImageView(this);
if (m()) {
this.sdk.getLogger().d("InterActivity", "Mute button should be hidden");
return;
}
int a = a(this.settingsProxy.s());
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(a, a, this.settingsProxy.t());
this.D.setScaleType(ImageView.ScaleType.FIT_CENTER);
int a2 = a(this.settingsProxy.u());
layoutParams.setMargins(a2, a2, a2, a2);
Uri W = this.videoMuted ? this.currentAd.W() : this.currentAd.X();
if (W == null) {
this.sdk.getLogger().e("InterActivity", "Attempting to add mute button but could not find uri = " + W);
return;
}
this.sdk.getLogger().d("InterActivity", "Added mute button with params: " + layoutParams);
a(this.videoMuted);
this.D.setClickable(true);
this.D.setOnClickListener(new bc(this));
this.x.addView(this.D, layoutParams);
this.D.bringToFront();
} catch (Exception e) {
this.sdk.getLogger().w("InterActivity", "Failed to attach mute button", e);
}
}
}
private boolean m() {
if (this.settingsProxy.q()) {
return (!this.settingsProxy.r() || j() || this.settingsProxy.x()) ? false : true;
}
return true;
}
public void n() {
runOnUiThread(new bd(this));
}
public boolean o() {
return this.settingsProxy.k() > 0;
}
public void p() {
runOnUiThread(new be(this));
}
private void q() {
if (this.currentAd.p() >= 0.0f) {
a(fq.c(this.currentAd.p()), (!this.m || this.A == null) ? this.y : this.A);
}
}
public void r() {
boolean z = this.settingsProxy.h() && u() > 0;
if (this.C == null && z) {
this.C = new ai(this);
int D = this.currentAd.D();
this.C.c(D);
this.C.b(this.settingsProxy.g());
this.C.d(D);
this.C.a(this.settingsProxy.f());
this.C.b(u());
this.C.a(u());
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(a(this.settingsProxy.e()), a(this.settingsProxy.e()), this.settingsProxy.o());
int a = a(this.settingsProxy.n());
layoutParams.setMargins(a, a, a, a);
this.x.addView(this.C, layoutParams);
this.C.bringToFront();
this.C.setVisibility(0);
this.countdownManager.a("COUNTDOWN_CLOCK", 1000L, new bg(this, t()));
}
}
public boolean s() {
return (this.p || this.poststitialWasDisplayed || !this.videoView.isPlaying()) ? false : true;
}
private long t() {
return TimeUnit.SECONDS.toMillis(u());
}
private int u() {
int C = this.currentAd.C();
return (C <= 0 && this.settingsProxy.m()) ? this.computedLengthSeconds + 1 : C;
}
@SuppressLint({"NewApi"})
public void v() {
if (this.H == null && this.currentAd.I()) {
this.logger.i("InterActivity", "Attaching video progress bar...");
this.H = new ProgressBar(this, null, R.attr.progressBarStyleHorizontal);
this.H.setMax(this.settingsProxy.ad());
this.H.setPadding(0, 0, 0, 0);
if (com.applovin.impl.sdk.t.g()) {
try {
this.H.setProgressTintList(ColorStateList.valueOf(this.currentAd.J()));
} catch (Throwable th) {
this.logger.e("InterActivity", "Unable to update progress bar color.", th);
}
}
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(this.videoView.getWidth(), 20, 80);
layoutParams.setMargins(0, 0, 0, this.settingsProxy.ae());
this.x.addView(this.H, layoutParams);
this.H.bringToFront();
this.countdownManager.a("PROGRESS_BAR", this.settingsProxy.ac(), new bh(this));
}
}
public void w() {
ck w = this.currentAd.w();
if (AppLovinSdkUtils.isValidString(this.currentAd.v()) && w != null && this.G == null) {
this.logger.i("InterActivity", "Attaching video button...");
this.G = x();
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams((int) ((w.a() / 100.0d) * this.videoView.getWidth()), (int) (this.videoView.getHeight() * (w.b() / 100.0d)), w.d());
int a = a(w.c());
layoutParams.setMargins(a, a, a, a);
this.x.addView(this.G, layoutParams);
this.G.bringToFront();
if (w.i() > 0.0f) {
this.G.setVisibility(4);
this.w.postDelayed(new bi(this, w), fq.c(w.i()));
}
if (w.j() > 0.0f) {
this.w.postDelayed(new bj(this, w), fq.c(w.j()));
}
}
}
private cl x() {
this.logger.d("InterActivity", "Create video button with HTML = " + this.currentAd.v());
cm cmVar = new cm(this.sdk);
this.I = new bk(this);
cmVar.a(new WeakReference<>(this.I));
cl clVar = new cl(cmVar, getApplicationContext());
clVar.a(this.currentAd.v());
return clVar;
}
public void y() {
if (!A()) {
skipVideo();
return;
}
I();
this.logger.d("InterActivity", "Prompting incentivized ad close warning");
this.F.b();
}
public void z() {
if (!B()) {
dismiss();
} else {
this.logger.d("InterActivity", "Prompting incentivized non-video ad close warning");
this.F.c();
}
}
public void clickThroughFromVideo() {
try {
e();
((AppLovinAdServiceImpl) this.sdk.getAdService()).trackAndLaunchVideoClick(this.currentAd, this.currentPlacement, this.a, this.currentAd.g());
com.applovin.impl.sdk.bk.a(this.b.e(), this.currentAd, this.sdk);
} catch (Throwable th) {
this.sdk.getLogger().e("InterActivity", "Encountered error while clicking through video.", th);
}
}
public void continueVideo() {
K();
}
@Override
public void dismiss() {
long currentTimeMillis = System.currentTimeMillis() - this.r;
this.d.a(currentTimeMillis);
this.logger.i("InterActivity", "Dismissing ad after " + currentTimeMillis + " milliseconds elapsed");
((AdViewControllerImpl) this.a.getAdViewController()).setIsForegroundClickInvalidated(true);
h();
L();
if (this.b != null) {
if (this.currentAd != null) {
c(this.currentAd);
}
this.b.a(false);
this.b.h();
}
finish();
}
public void exitWithError(String str) {
try {
Log.e("InterActivity", "Failed to properly render an Interstitial Activity, due to error: " + str, new Throwable("Initialized = " + bz.d + "; CleanedUp = " + bz.e));
c(new com.applovin.impl.sdk.ah());
} catch (Exception e) {
Log.e("InterActivity", "Failed to show a video ad due to error:", e);
}
finish();
}
public boolean getPoststitialWasDisplayed() {
return this.poststitialWasDisplayed;
}
public int getVideoPercentViewed() {
if (this.f) {
return 100;
}
if (this.videoView != null) {
int duration = this.videoView.getDuration();
return duration > 0 ? (int) ((this.videoView.getCurrentPosition() / duration) * 100.0d) : this.t;
}
this.logger.e("InterActivity", "No video view detected on video end");
return 0;
}
public void handleMediaError() {
if (!this.u.compareAndSet(false, true)) {
this.logger.e("InterActivity", "Already handled media player error. Doing nothing...");
return;
}
if (this.settingsProxy.j()) {
this.logger.e("InterActivity", "Handling media player error - Finishing activity...");
finish();
} else {
this.logger.e("InterActivity", "Handling media player error - Showing poststitial...");
showPoststitial();
}
this.logger.e("InterActivity", "Finished handling media player error.");
}
public boolean isFullyWatched() {
return getVideoPercentViewed() >= this.currentAd.K();
}
@Override
public void onBackPressed() {
if (c()) {
this.logger.d("InterActivity", "Back button was pressed; forwarding to Android for handling...");
super.onBackPressed();
return;
}
try {
if (this.m && this.A != null && this.A.getVisibility() == 0 && this.A.getAlpha() > 0.0f && !this.k) {
this.logger.d("InterActivity", "Back button was pressed; forwarding as a click to skip button.");
this.A.performClick();
} else if (this.y == null || this.y.getVisibility() != 0 || this.y.getAlpha() <= 0.0f) {
this.logger.d("InterActivity", "Back button was pressed, but was not eligible for dismissal.");
} else {
this.logger.d("InterActivity", "Back button was pressed; forwarding as a click to close button.");
this.y.performClick();
}
} catch (Exception e) {
super.onBackPressed();
}
}
@Override
public void onCreate(Bundle bundle) {
boolean z = true;
super.onCreate(bundle);
requestWindowFeature(1);
String stringExtra = getIntent().getStringExtra(KEY_WRAPPER_ID);
if (stringExtra == null || stringExtra.isEmpty()) {
exitWithError("Wrapper ID is null");
} else {
this.b = bz.a(stringExtra);
if (this.b == null && lastKnownWrapper != null) {
this.b = lastKnownWrapper;
}
if (this.b != null) {
AppLovinAd b = this.b.b();
this.sdk = (AppLovinSdkImpl) this.b.a();
this.logger = this.b.a().getLogger();
this.settingsProxy = new dr(this.b.a());
this.d = new dv(this.sdk);
this.currentPlacement = this.b.g();
if (b != null) {
com.applovin.impl.sdk.ad adVar = (com.applovin.impl.sdk.ad) b;
View findViewById = findViewById(R.id.content);
if (findViewById != null) {
if (adVar.f()) {
findViewById.setBackgroundColor(adVar.E());
} else {
findViewById.setBackgroundColor(adVar.F());
}
}
this.r = System.currentTimeMillis();
this.d.a(b);
this.d.b(-1L);
if (adVar.y()) {
getWindow().setFlags(16777216, 16777216);
}
Display defaultDisplay = ((WindowManager) getSystemService("window")).getDefaultDisplay();
int a = a(defaultDisplay);
int rotation = defaultDisplay.getRotation();
boolean z2 = (a == 2 && rotation == 0) || (a == 2 && rotation == 2) || ((a == 1 && rotation == 1) || (a == 1 && rotation == 3));
if (adVar.B()) {
int a2 = a(rotation, z2);
if (a2 != -1) {
this.logger.d("InterActivity", "Locking activity orientation to current orientation: " + a2);
setRequestedOrientation(a2);
} else {
this.logger.e("InterActivity", "Unable to detect current orientation. Locking to targeted orientation...");
b(rotation, z2);
}
} else {
this.logger.d("InterActivity", "Locking activity orientation to targeted orientation...");
b(rotation, z2);
}
this.a = new AppLovinAdView(this.sdk, AppLovinAdSize.INTERSTITIAL, this);
this.a.setAutoDestroy(false);
this.b.a((aq) this);
this.m = this.settingsProxy.l();
if (!com.applovin.impl.sdk.t.a(getApplicationContext()) && !com.applovin.impl.sdk.t.a(getApplicationContext())) {
z = false;
}
this.q = z;
this.F = new com.applovin.impl.sdk.bb(this.sdk, this);
} else {
exitWithError("No current ad found.");
}
} else {
exitWithError("Wrapper is null; initialized state: " + Boolean.toString(bz.d));
}
}
this.sdk.put(ds.i, false);
h();
G();
}
@Override
protected void onDestroy() {
try {
try {
if (this.a != null) {
ViewParent parent = this.a.getParent();
if (parent != null && (parent instanceof ViewGroup)) {
((ViewGroup) parent).removeView(this.a);
}
this.a.destroy();
this.a = null;
}
if (this.videoView != null) {
this.videoView.pause();
this.videoView.stopPlayback();
}
if (this.countdownManager != null) {
this.countdownManager.b();
}
if (this.w != null) {
this.w.removeCallbacksAndMessages(null);
}
if (this.v != null) {
this.v.removeCallbacksAndMessages(null);
}
if (this.currentAd != null) {
L();
c(this.currentAd);
}
} catch (Throwable th) {
this.logger.w("InterActivity", "Unable to destroy video view", th);
if (this.currentAd != null) {
L();
c(this.currentAd);
}
}
super.onDestroy();
} catch (Throwable th2) {
if (this.currentAd != null) {
L();
c(this.currentAd);
}
throw th2;
}
}
@Override
protected void onPause() {
this.logger.d("InterActivity", "App paused...");
this.s = System.currentTimeMillis();
if (!this.e) {
if (this.q) {
I();
} else if (!this.c) {
I();
}
}
this.b.a(false);
this.F.a();
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
this.logger.d("InterActivity", "App resumed...");
this.b.a(true);
if (this.o) {
return;
}
this.d.c(System.currentTimeMillis() - this.s);
if (!((Boolean) this.sdk.get(ds.i, false)).booleanValue() || this.F.d() || this.poststitialWasDisplayed) {
boolean i = this.currentAd instanceof com.applovin.impl.sdk.g ? ((com.applovin.impl.sdk.g) this.currentAd).i() : false;
if (this.currentAd == null || !this.settingsProxy.i() || this.currentAd.z() || !this.poststitialWasDisplayed || this.y == null || i) {
return;
}
a(0L, this.y);
return;
}
J();
if (this.currentAd == null || !this.settingsProxy.i() || this.currentAd.A() || this.poststitialWasDisplayed || !this.m || this.A == null) {
return;
}
a(0L, this.A);
}
@Override
public void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
if (z) {
this.logger.d("InterActivity", "Window gained focus");
try {
if (com.applovin.impl.sdk.t.f() && this.settingsProxy.D() && a()) {
b();
if (this.settingsProxy.N() > 0) {
this.w.postDelayed(new ba(this), this.settingsProxy.N());
}
} else {
getWindow().setFlags(1024, 1024);
}
if (this.settingsProxy.L() && !this.poststitialWasDisplayed) {
J();
}
} catch (Throwable th) {
this.logger.e("InterActivity", "Setting window flags failed.", th);
}
} else {
this.logger.d("InterActivity", "Window lost focus");
if (this.settingsProxy.L() && !this.poststitialWasDisplayed) {
I();
}
}
this.o = false;
}
public void playVideo() {
d(this.currentAd);
this.videoView.start();
this.countdownManager.a();
}
public boolean shouldContinueFullLengthVideoCountdown() {
return (this.f || this.poststitialWasDisplayed) ? false : true;
}
public void showPoststitial() {
try {
if (this.videoView != null) {
this.t = getVideoPercentViewed();
this.videoView.stopPlayback();
}
if (this.a != null) {
ViewParent parent = this.a.getParent();
if (parent instanceof ViewGroup) {
((ViewGroup) parent).removeView(this.a);
}
FrameLayout frameLayout = new FrameLayout(this);
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
frameLayout.setBackgroundColor(this.currentAd.F());
frameLayout.addView(this.a);
if (this.currentAd.Q()) {
this.a.renderAd(this.currentAd, this.currentPlacement);
}
if (this.x != null) {
this.x.removeAllViewsInLayout();
}
if (o() && this.z != null) {
frameLayout.addView(this.z);
this.z.bringToFront();
}
if (this.y != null) {
ViewParent parent2 = this.y.getParent();
if (parent2 instanceof ViewGroup) {
((ViewGroup) parent2).removeView(this.y);
}
frameLayout.addView(this.y);
this.y.bringToFront();
}
setContentView(frameLayout);
if (this.settingsProxy.H()) {
this.a.setVisibility(4);
this.a.setVisibility(0);
}
n adWebView = ((AdViewControllerImpl) this.a.getAdViewController()).getAdWebView();
if (adWebView != null) {
adWebView.a("javascript:al_onPoststitialShow();");
}
}
if (this.currentAd instanceof com.applovin.impl.sdk.g ? ((com.applovin.impl.sdk.g) this.currentAd).i() : false) {
this.logger.d("InterActivity", "Skip showing of close button");
} else if (this.currentAd.q() >= 0.0f) {
a(fq.c(this.currentAd.q()), this.y);
} else if (this.currentAd.q() == -2.0f) {
this.y.setVisibility(0);
} else {
a(0L, this.y);
}
this.poststitialWasDisplayed = true;
} catch (Throwable th) {
this.logger.e("InterActivity", "Encountered error while showing poststitial. Dismissing...", th);
dismiss();
}
}
public void skipVideo() {
if (this.currentAd.u()) {
dismiss();
} else {
showPoststitial();
}
}
public void toggleMute() {
boolean z = !H();
try {
b(z);
a(z);
} catch (Throwable th) {
this.logger.e("InterActivity", "Unable to set volume to " + z, th);
}
}
}