正在查看: All File Recovery v1.0.2 应用的 MaxAdViewImpl.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: All File Recovery v1.0.2 应用的 MaxAdViewImpl.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.applovin.impl.mediation.ads;
import K.O0;
import K.l0;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.applovin.impl.AbstractC0536g3;
import com.applovin.impl.AbstractC0565k0;
import com.applovin.impl.AbstractC0575l2;
import com.applovin.impl.AbstractC0640q2;
import com.applovin.impl.AbstractC0742z6;
import com.applovin.impl.AbstractRunnableC0716w4;
import com.applovin.impl.C0531f6;
import com.applovin.impl.C0548i;
import com.applovin.impl.C0650r5;
import com.applovin.impl.C0655s2;
import com.applovin.impl.C0729y1;
import com.applovin.impl.E;
import com.applovin.impl.EnumC0540h;
import com.applovin.impl.mediation.MaxErrorImpl;
import com.applovin.impl.mediation.ads.a;
import com.applovin.impl.q7;
import com.applovin.impl.r7;
import com.applovin.impl.s7;
import com.applovin.impl.sdk.C0667f;
import com.applovin.impl.sdk.C0676o;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxAdListener;
import com.applovin.mediation.MaxAdRevenueListener;
import com.applovin.mediation.MaxAdViewAdListener;
import com.applovin.mediation.MaxAdViewConfiguration;
import com.applovin.mediation.MaxError;
import com.applovin.mediation.ads.MaxAdView;
import com.applovin.sdk.AppLovinSdk;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.Locale;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import r3.C1008b6;
public class MaxAdViewImpl extends com.applovin.impl.mediation.ads.a implements C0667f.a, s7.a, C0548i.b {
private boolean A;
private boolean B;
private boolean C;
private boolean D;
private final Context a;
private final MaxAdView b;
private final String c;
private final View d;
private long e;
private C0655s2 f;
private String g;
private String h;
private final MaxAdViewConfiguration i;
private final b j;
private final d k;
private final C0667f l;
private final r7 m;
private final s7 n;
private final Object o;
private final Object p;
private C0655s2 q;
private MaxAd r;
private boolean s;
private boolean t;
private boolean u;
private final AtomicBoolean v;
private boolean w;
private boolean x;
private boolean y;
private boolean z;
public class b extends c {
private b() {
super();
}
@Override
public void onAdLoadFailed(String str, MaxError maxError) {
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
C0676o c0676o2 = maxAdViewImpl.logger;
String str2 = maxAdViewImpl.tag;
StringBuilder sb = new StringBuilder("MaxAdListener.onAdLoadFailed(adUnitId=");
sb.append(str);
sb.append(", error=");
sb.append(maxError);
sb.append("), listener=");
h.a(sb, MaxAdViewImpl.this.adListener, c0676o2, str2);
}
AbstractC0575l2.a(MaxAdViewImpl.this.adListener, str, maxError, true);
MaxAdViewImpl.this.a(maxError);
}
@Override
public void onAdLoaded(MaxAd maxAd) {
if (MaxAdViewImpl.this.a()) {
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "Precache ad with ad unit ID '" + MaxAdViewImpl.this.adUnitId + "' loaded after MaxAdView was destroyed. Destroying the ad.");
}
MaxAdViewImpl.this.sdk.X().destroyAd(maxAd);
return;
}
C0655s2 c0655s2 = (C0655s2) maxAd;
c0655s2.g(MaxAdViewImpl.this.g);
c0655s2.f(MaxAdViewImpl.this.h);
if (c0655s2.y() == null) {
MaxAdViewImpl.this.sdk.X().destroyAd(c0655s2);
onAdLoadFailed(c0655s2.getAdUnitId(), new MaxErrorImpl(-5001, "Ad view not fully loaded"));
return;
}
if (c0655s2.p0()) {
long k0 = c0655s2.k0();
MaxAdViewImpl.this.sdk.O();
if (C0676o.a()) {
C0676o O = MaxAdViewImpl.this.sdk.O();
String str = MaxAdViewImpl.this.tag;
StringBuilder a = M.c.a("Scheduling banner ad refresh ", k0, " milliseconds from now for '");
a.append(MaxAdViewImpl.this.adUnitId);
a.append("'...");
O.a(str, a.toString());
}
MaxAdViewImpl.this.l.a(k0);
if (MaxAdViewImpl.this.l.g() || MaxAdViewImpl.this.u) {
C0676o c0676o2 = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl2 = MaxAdViewImpl.this;
maxAdViewImpl2.logger.a(maxAdViewImpl2.tag, "Pausing ad refresh for publisher");
}
MaxAdViewImpl.this.l.j();
}
}
C0676o c0676o3 = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl3 = MaxAdViewImpl.this;
C0676o c0676o4 = maxAdViewImpl3.logger;
String str2 = maxAdViewImpl3.tag;
StringBuilder sb = new StringBuilder("MaxAdListener.onAdLoaded(ad=");
sb.append(maxAd);
sb.append("), listener=");
h.a(sb, MaxAdViewImpl.this.adListener, c0676o4, str2);
}
AbstractC0575l2.f(MaxAdViewImpl.this.adListener, maxAd, true);
MaxAdViewImpl.this.d(c0655s2);
}
}
public abstract class c implements MaxAdListener, MaxAdViewAdListener, MaxAdRevenueListener, a.InterfaceC0099a {
private c() {
}
@Override
public void onAdClicked(MaxAd maxAd) {
if (maxAd.equals(MaxAdViewImpl.this.q)) {
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
C0676o c0676o2 = maxAdViewImpl.logger;
String str = maxAdViewImpl.tag;
StringBuilder sb = new StringBuilder("MaxAdListener.onAdClicked(ad=");
sb.append(maxAd);
sb.append("), listener=");
h.a(sb, MaxAdViewImpl.this.adListener, c0676o2, str);
}
AbstractC0575l2.a(MaxAdViewImpl.this.adListener, maxAd, true);
}
}
@Override
public void onAdCollapsed(MaxAd maxAd) {
if (maxAd.equals(((Boolean) MaxAdViewImpl.this.sdk.a(AbstractC0536g3.x7)).booleanValue() ? MaxAdViewImpl.this.r : MaxAdViewImpl.this.q)) {
MaxAdViewImpl.this.r = null;
if ((MaxAdViewImpl.this.q.q0() || MaxAdViewImpl.this.B) && MaxAdViewImpl.this.s) {
MaxAdViewImpl.this.s = false;
MaxAdViewImpl.this.startAutoRefresh();
}
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
C0676o c0676o2 = maxAdViewImpl.logger;
String str = maxAdViewImpl.tag;
StringBuilder sb = new StringBuilder("MaxAdViewAdListener.onAdCollapsed(ad=");
sb.append(maxAd);
sb.append("), listener=");
h.a(sb, MaxAdViewImpl.this.adListener, c0676o2, str);
}
AbstractC0575l2.b(MaxAdViewImpl.this.adListener, maxAd, true);
}
}
@Override
public void onAdDisplayFailed(MaxAd maxAd, MaxError maxError) {
if (maxAd.equals(MaxAdViewImpl.this.q)) {
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
C0676o c0676o2 = maxAdViewImpl.logger;
String str = maxAdViewImpl.tag;
StringBuilder sb = new StringBuilder("MaxAdListener.onAdDisplayFailed(ad=");
sb.append(maxAd);
sb.append(", error=");
sb.append(maxError);
sb.append("), listener=");
h.a(sb, MaxAdViewImpl.this.adListener, c0676o2, str);
}
AbstractC0575l2.a(MaxAdViewImpl.this.adListener, maxAd, maxError, true);
}
}
@Override
public void onAdDisplayed(MaxAd maxAd) {
if (maxAd.equals(MaxAdViewImpl.this.q)) {
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
C0676o c0676o2 = maxAdViewImpl.logger;
String str = maxAdViewImpl.tag;
StringBuilder sb = new StringBuilder("MaxAdListener.onAdDisplayed(ad=");
sb.append(maxAd);
sb.append("), listener=");
h.a(sb, MaxAdViewImpl.this.adListener, c0676o2, str);
}
AbstractC0575l2.c(MaxAdViewImpl.this.adListener, maxAd, true);
}
}
@Override
public void onAdExpanded(MaxAd maxAd) {
if (maxAd.equals(MaxAdViewImpl.this.q)) {
if (((Boolean) MaxAdViewImpl.this.sdk.a(AbstractC0536g3.x7)).booleanValue()) {
MaxAdViewImpl.this.r = maxAd;
}
if ((MaxAdViewImpl.this.q.q0() || MaxAdViewImpl.this.B) && !MaxAdViewImpl.this.l.g()) {
MaxAdViewImpl.this.s = true;
MaxAdViewImpl.this.stopAutoRefresh();
}
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
C0676o c0676o2 = maxAdViewImpl.logger;
String str = maxAdViewImpl.tag;
StringBuilder sb = new StringBuilder("MaxAdViewAdListener.onAdExpanded(ad=");
sb.append(maxAd);
sb.append("), listener=");
h.a(sb, MaxAdViewImpl.this.adListener, c0676o2, str);
}
AbstractC0575l2.d(MaxAdViewImpl.this.adListener, maxAd, true);
}
}
@Override
public void onAdHidden(MaxAd maxAd) {
if (maxAd.equals(MaxAdViewImpl.this.q)) {
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
C0676o c0676o2 = maxAdViewImpl.logger;
String str = maxAdViewImpl.tag;
StringBuilder sb = new StringBuilder("MaxAdListener.onAdHidden(ad=");
sb.append(maxAd);
sb.append("), listener=");
h.a(sb, MaxAdViewImpl.this.adListener, c0676o2, str);
}
AbstractC0575l2.e(MaxAdViewImpl.this.adListener, maxAd, true);
}
}
@Override
public void onAdRequestStarted(String str) {
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
C0676o c0676o2 = maxAdViewImpl.logger;
String str2 = maxAdViewImpl.tag;
StringBuilder a = j.l.a("MaxAdRequestListener.onAdRequestStarted(adUnitId=", str, "), listener=");
a.append(MaxAdViewImpl.this.requestListener);
c0676o2.a(str2, a.toString());
}
AbstractC0575l2.a(MaxAdViewImpl.this.requestListener, str, true);
}
@Override
public void onAdRevenuePaid(MaxAd maxAd) {
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "MaxAdRevenueListener.onAdRevenuePaid(ad=" + maxAd + "), listener=" + MaxAdViewImpl.this.revenueListener);
}
AbstractC0575l2.a(MaxAdViewImpl.this.revenueListener, maxAd, true);
}
}
public class d extends c {
private d() {
super();
}
@Override
public void onAdLoadFailed(String str, MaxError maxError) {
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "Failed to precache ad for refresh with error code: " + maxError.getCode());
}
MaxAdViewImpl.this.a(maxError);
}
@Override
public void onAdLoaded(MaxAd maxAd) {
if (!MaxAdViewImpl.this.x) {
C0676o c0676o = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "Successfully precached ad for refresh");
}
if (((Boolean) MaxAdViewImpl.this.sdk.a(AbstractC0536g3.d7)).booleanValue()) {
MaxAdViewImpl.this.b(maxAd);
return;
} else {
MaxAdViewImpl.this.a(maxAd);
return;
}
}
C0676o c0676o2 = MaxAdViewImpl.this.logger;
if (C0676o.a()) {
MaxAdViewImpl maxAdViewImpl2 = MaxAdViewImpl.this;
maxAdViewImpl2.logger.a(maxAdViewImpl2.tag, "Ad with ad unit ID '" + MaxAdViewImpl.this.adUnitId + "' loaded after MaxAdView was destroyed. Destroying the ad.");
}
MaxAdViewImpl.this.sdk.X().destroyAd(maxAd);
}
}
public MaxAdViewImpl(String str, MaxAdFormat maxAdFormat, MaxAdViewConfiguration maxAdViewConfiguration, MaxAdView maxAdView, View view, Context context) {
super(str, maxAdFormat, "MaxAdView", AppLovinSdk.getInstance(context).a());
this.c = UUID.randomUUID().toString().toLowerCase(Locale.US);
this.e = RecyclerView.p1;
this.o = new Object();
this.p = new Object();
this.q = null;
this.r = null;
this.v = new AtomicBoolean();
this.x = false;
this.a = context.getApplicationContext();
this.b = maxAdView;
this.d = view;
this.j = new b();
this.k = new d();
this.l = new C0667f(this.sdk, this);
this.m = new r7(maxAdView, this.sdk);
this.n = new s7(maxAdView, this.sdk, this);
this.i = maxAdViewConfiguration;
this.sdk.j().a(this);
if (maxAdViewConfiguration != null && maxAdViewConfiguration.getAdaptiveType() != MaxAdViewConfiguration.AdaptiveType.NONE) {
setExtraParameter("adaptive_banner", Boolean.toString(true));
setLocalExtraParameter("adaptive_banner_type", maxAdViewConfiguration.getAdaptiveType().toString());
int adaptiveWidth = maxAdViewConfiguration.getAdaptiveWidth();
if (adaptiveWidth > 0) {
setLocalExtraParameter("adaptive_banner_width", Integer.valueOf(adaptiveWidth));
}
int inlineMaximumHeight = maxAdViewConfiguration.getInlineMaximumHeight();
if (inlineMaximumHeight > 0) {
setLocalExtraParameter("inline_adaptive_banner_max_height", Integer.valueOf(inlineMaximumHeight));
}
}
if (C0676o.a()) {
this.logger.a(this.tag, "Created new MaxAdView (" + this + ")");
}
}
@Override
public void destroy() {
if (((Boolean) this.sdk.a(AbstractC0536g3.e7)).booleanValue()) {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public final void run() {
MaxAdViewImpl.this.g();
}
});
} else {
g();
}
}
public MaxAdFormat getAdFormat() {
return this.adFormat;
}
public String getPlacement() {
return this.g;
}
public void loadAd() {
loadAd(EnumC0540h.PUBLISHER_INITIATED);
}
@Override
public void onAdRefresh() {
if (((Boolean) this.sdk.a(AbstractC0536g3.d7)).booleanValue()) {
f();
} else {
e();
}
}
@Override
public void onCreativeIdGenerated(String str, String str2) {
C0655s2 c0655s2 = this.q;
if (c0655s2 != null && c0655s2.O().equalsIgnoreCase(str)) {
this.q.h(str2);
AbstractC0575l2.b(this.adReviewListener, str2, this.q);
return;
}
C0655s2 c0655s22 = this.f;
if (c0655s22 == null || !c0655s22.O().equalsIgnoreCase(str)) {
return;
}
this.f.h(str2);
}
@Override
public void onLogVisibilityImpression() {
a(this.q, this.m.a(this.q));
}
public void onWindowVisibilityChanged(int i) {
if (((Boolean) this.sdk.a(AbstractC0536g3.a7)).booleanValue() && this.l.h()) {
if (q7.b(i)) {
if (C0676o.a()) {
this.logger.a(this.tag, "Ad view visible");
}
this.l.d();
} else {
if (C0676o.a()) {
this.logger.a(this.tag, "Ad view hidden");
}
this.l.c();
}
}
}
public void setCustomData(String str) {
if (this.q != null && C0676o.a()) {
C0676o c0676o = this.logger;
String str2 = this.tag;
StringBuilder a2 = j.l.a("Setting custom data (", str, ") for Ad Unit ID (");
a2.append(this.adUnitId);
a2.append(") after an ad has been loaded already.");
c0676o.k(str2, a2.toString());
}
AbstractC0742z6.b(str, this.tag);
this.h = str;
}
@Override
public void setExtraParameter(String str, String str2) {
super.setExtraParameter(str, str2);
a(str, str2);
}
public void setPlacement(String str) {
if (this.q != null && C0676o.a()) {
C0676o c0676o = this.logger;
String str2 = this.tag;
StringBuilder a2 = j.l.a("Setting placement (", str, ") for Ad Unit ID (");
a2.append(this.adUnitId);
a2.append(") after an ad has been loaded already.");
c0676o.k(str2, a2.toString());
}
this.g = str;
}
public void setPublisherBackgroundColor(int i) {
this.e = i;
}
public void startAutoRefresh() {
this.u = false;
if (!this.l.g()) {
if (C0676o.a()) {
this.logger.a(this.tag, "Ignoring call to startAutoRefresh() - ad refresh is not paused");
return;
}
return;
}
this.l.m();
if (C0676o.a()) {
this.logger.a(this.tag, "Resumed auto-refresh with remaining time: " + this.l.b() + "ms");
}
}
public void stopAutoRefresh() {
if (this.q == null) {
if (this.y || ((Boolean) this.sdk.a(AbstractC0536g3.c7)).booleanValue()) {
this.u = true;
return;
} else {
C0676o.j(this.tag, "Stopping auto-refresh has no effect until after the first ad has been loaded.");
return;
}
}
if (C0676o.a()) {
this.logger.a(this.tag, "Pausing auto-refresh with remaining time: " + this.l.b() + "ms");
}
this.l.j();
}
public String toString() {
StringBuilder sb = new StringBuilder("MaxAdView{adUnitId='");
sb.append(this.adUnitId);
sb.append("', adListener=");
Object obj = this.adListener;
if (obj == this.b) {
obj = "this";
}
sb.append(obj);
sb.append(", isDestroyed=");
return androidx.recyclerview.widget.s.a(sb, a(), '}');
}
public void d(final C0655s2 c0655s2) {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public final void run() {
MaxAdViewImpl.this.b(c0655s2);
}
});
}
private void e() {
this.v.set(false);
if (this.f != null) {
i();
return;
}
if (!b()) {
if (C0676o.a()) {
this.logger.a(this.tag, "Refreshing ad from network...");
}
loadAd(EnumC0540h.REFRESH);
} else if (this.t) {
if (C0676o.a()) {
this.logger.a(this.tag, "Refreshing ad from network due to viewability requirements not met for refresh request...");
}
loadAd(EnumC0540h.REFRESH);
} else {
if (C0676o.a()) {
this.logger.b(this.tag, "Ignoring attempt to refresh ad - either still waiting for precache or did not attempt request due to visibility requirement not met");
}
this.v.set(true);
}
}
private void f() {
boolean z;
boolean z2;
synchronized (this.p) {
try {
z = false;
this.v.set(false);
z2 = this.f != null;
if (!z2) {
if (b()) {
if (!this.t) {
if (C0676o.a()) {
this.logger.b(this.tag, "Ignoring attempt to refresh ad - either still waiting for precache or did not attempt request due to visibility requirement not met");
}
this.v.set(true);
} else if (C0676o.a()) {
this.logger.a(this.tag, "Refreshing ad from network due to viewability requirements not met for refresh request...");
}
} else if (C0676o.a()) {
this.logger.a(this.tag, "Refreshing ad from network...");
}
z = true;
}
} catch (Throwable th) {
throw th;
}
}
if (z2) {
i();
} else if (z) {
loadAd(EnumC0540h.REFRESH);
}
}
public void g() {
h();
if (this.f != null) {
this.sdk.X().destroyAd(this.f);
}
synchronized (this.o) {
this.x = true;
}
this.l.a();
this.sdk.j().b(this);
if (this.sdk.R() != null) {
this.sdk.R().c(this.adUnitId, this.c);
} else {
this.sdk.Q().c(this.adUnitId, this.c);
}
super.destroy();
}
private void h() {
C0655s2 c0655s2;
MaxAdView maxAdView = this.b;
if (maxAdView != null) {
com.applovin.impl.r.a(maxAdView, this.d);
}
this.n.b();
synchronized (this.o) {
c0655s2 = this.q;
}
MaxAd maxAd = this.r;
if (maxAd != null && maxAd.equals(c0655s2)) {
if (C0676o.a()) {
this.logger.a(this.tag, "Collapsing ad manually for removed ad.");
}
AbstractC0575l2.b(this.j, maxAd);
}
if (c0655s2 != null) {
this.sdk.X().destroyAd(c0655s2);
}
}
private void i() {
if (C0676o.a()) {
this.logger.a(this.tag, "Rendering for cached ad: " + this.f + "...");
}
this.j.onAdLoaded(this.f);
this.f = null;
}
public void loadAd(EnumC0540h enumC0540h) {
if (C0676o.a()) {
this.logger.a(this.tag, "" + this + " Loading ad for " + this.adUnitId + "...");
}
boolean z = this.y || ((Boolean) this.sdk.a(AbstractC0536g3.c7)).booleanValue();
if (z && !this.l.g() && this.l.h()) {
C0676o.h(this.tag, "Unable to load a new ad. An ad refresh has already been scheduled in " + TimeUnit.MILLISECONDS.toSeconds(this.l.b()) + " seconds.");
return;
}
if (!z) {
if (C0676o.a()) {
this.logger.a(this.tag, "Loading ad...");
}
a(enumC0540h, this.j);
} else if (this.f != null) {
if (C0676o.a()) {
this.logger.a(this.tag, "Rendering cached ad");
}
i();
} else if (this.w) {
if (C0676o.a()) {
this.logger.a(this.tag, "Waiting for precache ad to load to render");
}
this.v.set(true);
} else {
if (C0676o.a()) {
this.logger.a(this.tag, "Loading ad...");
}
a(enumC0540h, this.j);
}
}
public void b(final C0655s2 c0655s2) {
View y = c0655s2.y();
String str = y == null ? "MaxAdView does not have a loaded ad view" : null;
MaxAdView maxAdView = this.b;
if (maxAdView == null) {
str = "MaxAdView does not have a parent view";
}
if (str != null) {
if (C0676o.a()) {
this.logger.b(this.tag, str);
}
MaxErrorImpl maxErrorImpl = new MaxErrorImpl(-1, str);
if (C0676o.a()) {
C0676o c0676o = this.logger;
String str2 = this.tag;
StringBuilder sb = new StringBuilder("MaxAdListener.onAdDisplayFailed(ad=");
sb.append(c0655s2);
sb.append(", error=");
sb.append(maxErrorImpl);
sb.append("), listener=");
h.a(sb, this.adListener, c0676o, str2);
}
AbstractC0575l2.a(this.adListener, (MaxAd) c0655s2, (MaxError) maxErrorImpl, true);
this.sdk.X().processAdDisplayErrorPostbackForUserError(maxErrorImpl, c0655s2);
return;
}
h();
a((AbstractC0640q2) c0655s2);
if (c0655s2.j0()) {
this.n.a(c0655s2);
}
maxAdView.setDescendantFocusability(393216);
if (c0655s2.l0() != RecyclerView.p1) {
this.d.setBackgroundColor((int) c0655s2.l0());
} else {
long j = this.e;
if (j != RecyclerView.p1) {
this.d.setBackgroundColor((int) j);
} else {
this.d.setBackgroundColor(0);
}
}
maxAdView.addView(y);
a(y, c0655s2);
this.sdk.z().d(c0655s2);
c(c0655s2);
synchronized (this.o) {
this.q = c0655s2;
}
if (C0676o.a()) {
this.logger.a(this.tag, "Scheduling impression for ad manually...");
}
this.sdk.X().processRawAdImpression(c0655s2, this.j);
if (StringUtils.isValidString(this.q.getAdReviewCreativeId())) {
AbstractC0575l2.a(this.adReviewListener, this.q.getAdReviewCreativeId(), (MaxAd) this.q, true);
}
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() {
@Override
public final void run() {
MaxAdViewImpl.this.a(c0655s2);
}
}, c0655s2.n0());
}
private void d() {
if (b()) {
if (C0676o.a()) {
this.logger.a(this.tag, "Scheduling refresh precache request now");
}
this.w = true;
this.sdk.q0().a((AbstractRunnableC0716w4) new C0531f6(this.sdk, "loadMaxAdForPrecacheRequest", new Runnable() {
@Override
public final void run() {
MaxAdViewImpl.this.c();
}
}), C0650r5.b.MEDIATION);
}
}
public void c() {
if (C0676o.a()) {
this.logger.a(this.tag, "Loading ad for precache request...");
}
a(EnumC0540h.SEQUENTIAL_OR_PRECACHE, this.k);
}
private void a(final EnumC0540h enumC0540h, final a.InterfaceC0099a interfaceC0099a) {
if (a()) {
boolean c2 = AbstractC0742z6.c(this.sdk);
this.sdk.E().a(C0729y1.u0, "attemptingToLoadDestroyedAdView", CollectionUtils.hashMap("details", "debug=" + c2));
if (!c2) {
C0676o.h(this.tag, "Failed to load new ad - this instance is already destroyed");
return;
} else {
throw new IllegalStateException("Failed to load new ad - this instance is already destroyed for ad unit ID: " + this.adUnitId);
}
}
AppLovinSdkUtils.runOnUiThread(true, new Runnable() {
@Override
public final void run() {
MaxAdViewImpl.this.a(interfaceC0099a, enumC0540h);
}
});
}
private void c(C0655s2 c0655s2) {
int height = this.b.getHeight();
int width = this.b.getWidth();
if (height > 0 || width > 0) {
int pxToDp = AppLovinSdkUtils.pxToDp(this.a, height);
int pxToDp2 = AppLovinSdkUtils.pxToDp(this.a, width);
MaxAdFormat format = c0655s2.getFormat();
int height2 = (this.D ? format.getAdaptiveSize(pxToDp2, this.b.getContext()) : format.getSize()).getHeight();
int min = Math.min(format.getSize().getWidth(), AbstractC0565k0.b(this.a).x);
if (pxToDp < height2 || pxToDp2 < min) {
StringBuilder a2 = l0.a("\n**************************************************\n`MaxAdView` size ", pxToDp2, "x", pxToDp, " dp smaller than required ");
a2.append(this.D ? "adaptive " : "");
a2.append("size: ");
a2.append(min);
a2.append("x");
String a3 = android.support.v4.media.c.a(a2, height2, " dp\nSome mediated networks (e.g. Google Ad Manager) may not render correctly\n**************************************************\n");
if (C0676o.a()) {
this.logger.b("AppLovinSdk", a3);
}
}
}
}
public void a(a.InterfaceC0099a interfaceC0099a, EnumC0540h enumC0540h) {
int adaptiveWidth;
C0655s2 c0655s2 = this.q;
if (c0655s2 != null) {
long a2 = this.m.a(c0655s2);
this.extraParameters.put("visible_ad_ad_unit_id", this.q.getAdUnitId());
this.extraParameters.put("viewability_flags", Long.valueOf(a2));
} else {
this.extraParameters.remove("visible_ad_ad_unit_id");
this.extraParameters.remove("viewability_flags");
}
int pxToDp = AppLovinSdkUtils.pxToDp(this.b.getContext(), this.b.getWidth());
int pxToDp2 = AppLovinSdkUtils.pxToDp(this.b.getContext(), this.b.getHeight());
this.extraParameters.put("viewport_width", Integer.valueOf(pxToDp));
this.extraParameters.put("viewport_height", Integer.valueOf(pxToDp2));
this.extraParameters.put("auto_refresh_stopped", Boolean.valueOf(this.l.g() || this.u));
this.extraParameters.put("auto_retries_disabled", Boolean.valueOf(this.z));
MaxAdViewConfiguration maxAdViewConfiguration = this.i;
if (maxAdViewConfiguration != null && (adaptiveWidth = maxAdViewConfiguration.getAdaptiveWidth()) > 0 && pxToDp != adaptiveWidth) {
C0676o.j(this.tag, O0.a("The requested adaptive ad view width (", adaptiveWidth, " dp) is different from the MaxAdView width (", pxToDp, " dp)."));
}
if (C0676o.a()) {
this.logger.a(this.tag, "Loading " + this.adFormat.getLabel().toLowerCase(Locale.ENGLISH) + " ad for '" + this.adUnitId + "' and notifying " + interfaceC0099a + "...");
}
this.sdk.X().loadAd(this.adUnitId, this.c, this.adFormat, enumC0540h, this.localExtraParameters, this.extraParameters, this.a, interfaceC0099a);
}
private void a(String str, String str2) {
if ("allow_pause_auto_refresh_immediately".equalsIgnoreCase(str)) {
if (C0676o.a()) {
E.a("Updated allow immediate auto-refresh pause and ad load to: ", str2, this.logger, this.tag);
}
this.y = Boolean.parseBoolean(str2);
return;
}
if ("disable_auto_retries".equalsIgnoreCase(str)) {
if (C0676o.a()) {
E.a("Updated disable auto-retries to: ", str2, this.logger, this.tag);
}
this.z = Boolean.parseBoolean(str2);
return;
}
if ("disable_precache".equalsIgnoreCase(str)) {
if (C0676o.a()) {
E.a("Updated precached disabled to: ", str2, this.logger, this.tag);
}
this.A = Boolean.parseBoolean(str2);
return;
}
if ("should_stop_auto_refresh_on_ad_expand".equals(str)) {
if (C0676o.a()) {
E.a("Updated should stop auto-refresh on ad expand to: ", str2, this.logger, this.tag);
}
this.B = Boolean.parseBoolean(str2);
} else if ("force_precache".equals(str)) {
if (C0676o.a()) {
E.a("Updated force precache to: ", str2, this.logger, this.tag);
}
this.C = Boolean.parseBoolean(str2);
} else if ("adaptive_banner".equalsIgnoreCase(str)) {
if (C0676o.a()) {
E.a("Updated is adaptive banner to: ", str2, this.logger, this.tag);
}
if (this.i == null) {
C0676o.h(this.tag, "You configured adaptive banners incorrectly by setting extra parameters to the MaxAdView! Please configure adaptive banners via MaxAdViewConfiguration instead. Learn more: https://developers.applovin.com/en/max/android/ad-formats/banner-and-mrec-ads#adaptive-banners");
}
this.D = Boolean.parseBoolean(str2);
setLocalExtraParameter(str, str2);
}
}
public void b(MaxAd maxAd) {
boolean compareAndSet;
this.w = false;
synchronized (this.p) {
try {
compareAndSet = this.v.compareAndSet(true, false);
if (!compareAndSet) {
if (C0676o.a()) {
this.logger.a(this.tag, "Saving precache ad...");
}
C0655s2 c0655s2 = (C0655s2) maxAd;
this.f = c0655s2;
c0655s2.g(this.g);
this.f.f(this.h);
}
} catch (Throwable th) {
throw th;
}
}
if (compareAndSet) {
if (C0676o.a()) {
this.logger.a(this.tag, "Rendering precache request ad: " + maxAd.getAdUnitId() + "...");
}
this.j.onAdLoaded(maxAd);
}
}
private boolean b() {
if (this.A) {
return false;
}
return ((Boolean) this.sdk.a(AbstractC0536g3.j7)).booleanValue();
}
public void a(C0655s2 c0655s2) {
long a2 = this.m.a(c0655s2);
if (!c0655s2.j0()) {
a(c0655s2, a2);
}
a(a2);
}
public void a(MaxError maxError) {
if (a()) {
if (C0676o.a()) {
this.logger.a(this.tag, "Ad load failure with ad unit ID '" + this.adUnitId + "' occured after MaxAdView was destroyed.");
return;
}
return;
}
if (this.sdk.c(AbstractC0536g3.W6).contains(String.valueOf(maxError.getCode()))) {
this.sdk.O();
if (C0676o.a()) {
this.sdk.O().a(this.tag, "Ignoring banner ad refresh for error code " + maxError.getCode());
return;
}
return;
}
if (!this.u && !this.l.g()) {
this.t = true;
this.w = false;
long longValue = ((Long) this.sdk.a(AbstractC0536g3.V6)).longValue();
if (longValue >= 0) {
this.sdk.O();
if (C0676o.a()) {
C0676o O = this.sdk.O();
String str = this.tag;
StringBuilder a2 = M.c.a("Scheduling failed banner ad refresh ", longValue, " milliseconds from now for '");
a2.append(this.adUnitId);
a2.append("'...");
O.a(str, a2.toString());
}
this.l.a(longValue);
return;
}
return;
}
if (this.w) {
if (C0676o.a()) {
this.logger.a(this.tag, "Refresh precache failed when auto-refresh is stopped");
}
this.w = false;
}
if (this.v.get()) {
if (C0676o.a()) {
C0676o c0676o = this.logger;
String str2 = this.tag;
StringBuilder sb = new StringBuilder("Refresh precache failed - MaxAdListener.onAdLoadFailed(adUnitId=");
sb.append(this.adUnitId);
sb.append(", error=");
sb.append(maxError);
sb.append("), listener=");
h.a(sb, this.adListener, c0676o, str2);
}
AbstractC0575l2.a(this.adListener, this.adUnitId, maxError, true);
}
}
private void a(View view, C0655s2 c0655s2) {
int o0 = c0655s2.o0();
int m0 = c0655s2.m0();
int dpToPx = o0 == -1 ? -1 : AppLovinSdkUtils.dpToPx(view.getContext(), o0);
int dpToPx2 = m0 != -1 ? AppLovinSdkUtils.dpToPx(view.getContext(), m0) : -1;
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
if (layoutParams == null) {
layoutParams = new RelativeLayout.LayoutParams(dpToPx, dpToPx2);
} else {
layoutParams.width = dpToPx;
layoutParams.height = dpToPx2;
}
if (layoutParams instanceof RelativeLayout.LayoutParams) {
if (C0676o.a()) {
this.logger.a(this.tag, O0.a("Pinning ad view to MAX ad view with width: ", dpToPx, " and height: ", dpToPx2, C1008b6.u));
}
RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) layoutParams;
for (int i : q7.a(this.b.getGravity(), 10, 14)) {
layoutParams2.addRule(i);
}
}
view.setLayoutParams(layoutParams);
}
private void a(C0655s2 c0655s2, long j) {
if (C0676o.a()) {
this.logger.a(this.tag, "Scheduling viewability impression for ad...");
}
this.sdk.X().processViewabilityAdImpressionPostback(c0655s2, j, this.j);
}
private void a(long j) {
if (AbstractC0742z6.a(j, ((Long) this.sdk.a(AbstractC0536g3.i7)).longValue()) && !this.C) {
if (C0676o.a()) {
this.logger.a(this.tag, "Undesired flags matched - current: " + Long.toBinaryString(j) + ", undesired: " + Long.toBinaryString(j));
}
if (C0676o.a()) {
this.logger.a(this.tag, "Waiting for refresh timer to manually fire request");
}
this.t = true;
return;
}
if (C0676o.a()) {
this.logger.a(this.tag, "No undesired viewability flags matched or forcing precache - scheduling viewability");
}
this.t = false;
d();
}
public void a(MaxAd maxAd) {
this.w = false;
if (this.v.compareAndSet(true, false)) {
if (C0676o.a()) {
this.logger.a(this.tag, "Rendering precache request ad: " + maxAd.getAdUnitId() + "...");
}
this.j.onAdLoaded(maxAd);
return;
}
if (C0676o.a()) {
this.logger.a(this.tag, "Saving precache ad...");
}
C0655s2 c0655s2 = (C0655s2) maxAd;
this.f = c0655s2;
c0655s2.g(this.g);
this.f.f(this.h);
}
public boolean a() {
boolean z;
synchronized (this.o) {
z = this.x;
}
return z;
}
}