- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
970 lines
34 KiB
Java
970 lines
34 KiB
Java
package com.applovin.impl.adview;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.DialogInterface;
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import android.util.AttributeSet;
|
|
import android.util.DisplayMetrics;
|
|
import android.util.TypedValue;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.webkit.WebView;
|
|
import android.widget.RelativeLayout;
|
|
import androidx.browser.customtabs.CustomTabsSession;
|
|
import com.applovin.adview.AppLovinAdView;
|
|
import com.applovin.adview.AppLovinAdViewDisplayErrorCode;
|
|
import com.applovin.adview.AppLovinAdViewEventListener;
|
|
import com.applovin.adview.AppLovinFullscreenActivity;
|
|
import com.applovin.communicator.AppLovinCommunicator;
|
|
import com.applovin.communicator.AppLovinCommunicatorMessage;
|
|
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
|
|
import com.applovin.impl.adview.k;
|
|
import com.applovin.impl.ca;
|
|
import com.applovin.impl.e0;
|
|
import com.applovin.impl.ea;
|
|
import com.applovin.impl.g0;
|
|
import com.applovin.impl.gc;
|
|
import com.applovin.impl.jn;
|
|
import com.applovin.impl.la;
|
|
import com.applovin.impl.mg;
|
|
import com.applovin.impl.og;
|
|
import com.applovin.impl.pi;
|
|
import com.applovin.impl.qb;
|
|
import com.applovin.impl.qc;
|
|
import com.applovin.impl.sdk.AppLovinAdServiceImpl;
|
|
import com.applovin.impl.sdk.ad.b;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import com.applovin.impl.sj;
|
|
import com.applovin.impl.t6;
|
|
import com.applovin.impl.tm;
|
|
import com.applovin.impl.tr;
|
|
import com.applovin.impl.vb;
|
|
import com.applovin.impl.yp;
|
|
import com.applovin.impl.zq;
|
|
import com.applovin.sdk.AppLovinAd;
|
|
import com.applovin.sdk.AppLovinAdClickListener;
|
|
import com.applovin.sdk.AppLovinAdDisplayListener;
|
|
import com.applovin.sdk.AppLovinAdLoadListener;
|
|
import com.applovin.sdk.AppLovinAdSize;
|
|
import com.applovin.sdk.AppLovinSdk;
|
|
import com.applovin.sdk.AppLovinSdkUtils;
|
|
import com.iab.omid.library.applovin.adsession.FriendlyObstructionPurpose;
|
|
import com.tapjoy.TJAdUnitConstants;
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class a implements AppLovinCommunicatorSubscriber {
|
|
private static final AtomicReference H = new AtomicReference();
|
|
private volatile AppLovinAdLoadListener C;
|
|
private volatile AppLovinAdDisplayListener D;
|
|
private volatile AppLovinAdViewEventListener E;
|
|
private volatile AppLovinAdClickListener F;
|
|
private Context a;
|
|
private ViewGroup b;
|
|
private com.applovin.impl.sdk.j c;
|
|
private AppLovinAdServiceImpl d;
|
|
private com.applovin.impl.sdk.n f;
|
|
private AppLovinCommunicator g;
|
|
private b h;
|
|
private AppLovinAdSize j;
|
|
private String k;
|
|
private CustomTabsSession l;
|
|
private com.applovin.impl.adview.c m;
|
|
private e n;
|
|
private com.applovin.impl.adview.b o;
|
|
private WebView p;
|
|
private k q;
|
|
private Runnable r;
|
|
private Runnable s;
|
|
private final Map i = Collections.synchronizedMap(new HashMap());
|
|
private volatile com.applovin.impl.sdk.ad.b t = null;
|
|
private volatile AppLovinAd u = null;
|
|
private f v = null;
|
|
private f w = null;
|
|
private final AtomicReference x = new AtomicReference();
|
|
private final AtomicBoolean y = new AtomicBoolean();
|
|
private volatile boolean z = false;
|
|
private volatile boolean A = false;
|
|
private volatile boolean B = false;
|
|
private volatile g0 G = null;
|
|
|
|
public interface b {
|
|
void a(a aVar);
|
|
}
|
|
|
|
public class c implements Runnable {
|
|
private c() {
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (a.this.o != null) {
|
|
a.this.o.setVisibility(8);
|
|
}
|
|
}
|
|
}
|
|
|
|
public class d implements Runnable {
|
|
|
|
/* renamed from: com.applovin.impl.adview.a$d$a, reason: collision with other inner class name */
|
|
public class C0015a implements k.a {
|
|
public C0015a() {
|
|
}
|
|
|
|
@Override // com.applovin.impl.adview.k.a
|
|
public void a() {
|
|
a.this.o.addView(a.this.q, new ViewGroup.LayoutParams(-1, -1));
|
|
}
|
|
|
|
@Override // com.applovin.impl.adview.k.a
|
|
public void onFailure() {
|
|
com.applovin.impl.sdk.n unused = a.this.f;
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
a.this.f.b("AppLovinAdView", "Watermark failed to render.");
|
|
}
|
|
}
|
|
}
|
|
|
|
private d() {
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (a.this.t != null) {
|
|
if (a.this.o == null) {
|
|
com.applovin.impl.sdk.n.h("AppLovinAdView", "Unable to render advertisement for ad #" + a.this.t.getAdIdNumber() + ". Please make sure you are not calling AppLovinAdView.destroy() prematurely.");
|
|
gc.a(a.this.E, a.this.t, (AppLovinAdView) null, AppLovinAdViewDisplayErrorCode.WEBVIEW_NOT_FOUND);
|
|
return;
|
|
}
|
|
a.this.w();
|
|
com.applovin.impl.sdk.n unused = a.this.f;
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
a.this.f.a("AppLovinAdView", "Rendering advertisement ad for #" + a.this.t.getAdIdNumber() + "...");
|
|
}
|
|
a.b(a.this.o, a.this.t.getSize());
|
|
if (a.this.q != null) {
|
|
zq.c(a.this.q);
|
|
a.this.q = null;
|
|
}
|
|
ea eaVar = new ea(a.this.i, a.this.c);
|
|
if (eaVar.c()) {
|
|
a.this.q = new k(eaVar, a.this.a);
|
|
a.this.q.a(new C0015a());
|
|
}
|
|
a.this.o.setAdHtmlLoaded(false);
|
|
a.this.o.a(a.this.t);
|
|
if (a.this.t.getSize() == AppLovinAdSize.INTERSTITIAL || a.this.A) {
|
|
return;
|
|
}
|
|
a.this.t.setHasShown(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static class e implements AppLovinAdLoadListener {
|
|
private final a a;
|
|
|
|
public e(a aVar, com.applovin.impl.sdk.j jVar) {
|
|
if (aVar == null) {
|
|
throw new IllegalArgumentException("No view specified");
|
|
}
|
|
if (jVar == null) {
|
|
throw new IllegalArgumentException("No sdk specified");
|
|
}
|
|
this.a = aVar;
|
|
}
|
|
|
|
private a a() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // com.applovin.sdk.AppLovinAdLoadListener
|
|
public void adReceived(AppLovinAd appLovinAd) {
|
|
a a = a();
|
|
if (a != null) {
|
|
a.b(appLovinAd);
|
|
} else {
|
|
com.applovin.impl.sdk.n.h("AppLovinAdView", "Ad view has been garbage collected by the time an ad was received");
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.sdk.AppLovinAdLoadListener
|
|
public void failedToReceiveAd(int i) {
|
|
a a = a();
|
|
if (a != null) {
|
|
a.b(i);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void G() {
|
|
com.applovin.impl.adview.b bVar;
|
|
if (this.f != null && com.applovin.impl.sdk.n.a() && com.applovin.impl.sdk.n.a()) {
|
|
this.f.a("AppLovinAdView", "Destroying...");
|
|
}
|
|
if (!((Boolean) this.c.a(sj.I1)).booleanValue() || (bVar = this.o) == null) {
|
|
tr.d(this.o);
|
|
} else {
|
|
tr.a(bVar);
|
|
f().a(this.o, new vb.b() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda1
|
|
@Override // com.applovin.impl.vb.b
|
|
public final void a(Object obj) {
|
|
tr.d((b) obj);
|
|
}
|
|
});
|
|
}
|
|
this.o = null;
|
|
tr.d(this.p);
|
|
this.p = null;
|
|
this.l = null;
|
|
this.C = null;
|
|
this.D = null;
|
|
this.F = null;
|
|
this.E = null;
|
|
this.A = true;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ com.applovin.impl.adview.b o() {
|
|
return new com.applovin.impl.adview.b(this.c, this.a.getApplicationContext());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void p() {
|
|
this.o.loadDataWithBaseURL("/", "<html></html>", "text/html", null, "");
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void q() {
|
|
com.applovin.impl.adview.b bVar;
|
|
d();
|
|
if (this.b == null || (bVar = this.o) == null || bVar.getParent() != null) {
|
|
return;
|
|
}
|
|
this.b.addView(this.o);
|
|
b(this.o, this.t.getSize());
|
|
if (this.t.isOpenMeasurementEnabled()) {
|
|
this.t.getAdEventTracker().a((View) this.o);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void u() {
|
|
g().loadUrl("chrome://crash");
|
|
}
|
|
|
|
private void y() {
|
|
if (this.t.V0()) {
|
|
int a = this.c.n().a();
|
|
if (com.applovin.impl.sdk.f.a(a)) {
|
|
this.o.a("javascript:al_muteSwitchOn();");
|
|
} else if (a == 2) {
|
|
this.o.a("javascript:al_muteSwitchOff();");
|
|
}
|
|
}
|
|
}
|
|
|
|
public void A() {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.f.a("AppLovinAdView", "AdView fully watched...");
|
|
}
|
|
b bVar = this.h;
|
|
if (bVar != null) {
|
|
bVar.a(this);
|
|
}
|
|
}
|
|
|
|
public void B() {
|
|
if (e0.a(this.o)) {
|
|
this.c.D().c(ca.r);
|
|
}
|
|
}
|
|
|
|
public void D() {
|
|
this.B = true;
|
|
}
|
|
|
|
public void E() {
|
|
this.B = false;
|
|
}
|
|
|
|
public void F() {
|
|
if (!this.z || this.A) {
|
|
return;
|
|
}
|
|
this.A = true;
|
|
}
|
|
|
|
public void a(AppLovinAdViewEventListener appLovinAdViewEventListener) {
|
|
this.E = appLovinAdViewEventListener;
|
|
}
|
|
|
|
public void a(b bVar) {
|
|
this.h = bVar;
|
|
}
|
|
|
|
public void a(g0 g0Var) {
|
|
this.G = g0Var;
|
|
}
|
|
|
|
public void a(AppLovinAdClickListener appLovinAdClickListener) {
|
|
this.F = appLovinAdClickListener;
|
|
}
|
|
|
|
public void a(AppLovinAdDisplayListener appLovinAdDisplayListener) {
|
|
this.D = appLovinAdDisplayListener;
|
|
}
|
|
|
|
public void a(AppLovinAdLoadListener appLovinAdLoadListener) {
|
|
this.C = appLovinAdLoadListener;
|
|
}
|
|
|
|
public AppLovinAdViewEventListener e() {
|
|
return this.E;
|
|
}
|
|
|
|
public com.applovin.impl.adview.b g() {
|
|
return this.o;
|
|
}
|
|
|
|
@Override // com.applovin.communicator.AppLovinCommunicatorEntity
|
|
public String getCommunicatorId() {
|
|
return a.class.getSimpleName();
|
|
}
|
|
|
|
public g0 h() {
|
|
return this.G;
|
|
}
|
|
|
|
public com.applovin.impl.sdk.ad.b i() {
|
|
return this.t;
|
|
}
|
|
|
|
public CustomTabsSession j() {
|
|
return this.l;
|
|
}
|
|
|
|
public AppLovinAdView k() {
|
|
return (AppLovinAdView) this.b;
|
|
}
|
|
|
|
public com.applovin.impl.sdk.j l() {
|
|
return this.c;
|
|
}
|
|
|
|
public AppLovinAdSize m() {
|
|
return this.j;
|
|
}
|
|
|
|
public String n() {
|
|
return this.k;
|
|
}
|
|
|
|
@Override // com.applovin.communicator.AppLovinCommunicatorSubscriber
|
|
public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
|
|
if ("crash_applovin_ad_webview".equals(appLovinCommunicatorMessage.getTopic())) {
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda8
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.u();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
public void x() {
|
|
if ((this.a instanceof t6) && this.t != null && this.t.R() == b.EnumC0038b.DISMISS) {
|
|
((t6) this.a).dismiss();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static void b(View view, AppLovinAdSize appLovinAdSize) {
|
|
if (view == null) {
|
|
return;
|
|
}
|
|
DisplayMetrics displayMetrics = view.getResources().getDisplayMetrics();
|
|
String label = appLovinAdSize.getLabel();
|
|
AppLovinAdSize appLovinAdSize2 = AppLovinAdSize.INTERSTITIAL;
|
|
int applyDimension = label.equals(appLovinAdSize2.getLabel()) ? -1 : appLovinAdSize.getWidth() == -1 ? displayMetrics.widthPixels : (int) TypedValue.applyDimension(1, appLovinAdSize.getWidth(), displayMetrics);
|
|
int applyDimension2 = appLovinAdSize.getLabel().equals(appLovinAdSize2.getLabel()) ? -1 : appLovinAdSize.getHeight() == -1 ? displayMetrics.heightPixels : (int) TypedValue.applyDimension(1, appLovinAdSize.getHeight(), displayMetrics);
|
|
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
|
if (layoutParams == null) {
|
|
layoutParams = new RelativeLayout.LayoutParams(-2, -2);
|
|
}
|
|
layoutParams.width = applyDimension;
|
|
layoutParams.height = applyDimension2;
|
|
if (layoutParams instanceof RelativeLayout.LayoutParams) {
|
|
((RelativeLayout.LayoutParams) layoutParams).addRule(13);
|
|
}
|
|
view.setLayoutParams(layoutParams);
|
|
}
|
|
|
|
private void c() {
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.s();
|
|
}
|
|
});
|
|
}
|
|
|
|
private void d() {
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda10
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.t();
|
|
}
|
|
});
|
|
}
|
|
|
|
public static vb f() {
|
|
AtomicReference atomicReference = H;
|
|
Object obj = atomicReference.get();
|
|
if (obj == null) {
|
|
synchronized (atomicReference) {
|
|
try {
|
|
obj = atomicReference.get();
|
|
if (obj == null) {
|
|
obj = new vb.d();
|
|
atomicReference.set(obj);
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
}
|
|
if (obj == atomicReference) {
|
|
obj = null;
|
|
}
|
|
return (vb) obj;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void w() {
|
|
com.applovin.impl.sdk.ad.b bVar = this.t;
|
|
qc qcVar = new qc();
|
|
qcVar.a().a(bVar).a(k());
|
|
if (!yp.a(bVar.getSize())) {
|
|
qcVar.a().a("Fullscreen Ad Properties").b(bVar);
|
|
}
|
|
qcVar.a(this.c);
|
|
qcVar.a();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.f.a("AppLovinAdView", qcVar.toString());
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void r() {
|
|
if (this.o != null && this.v != null) {
|
|
a();
|
|
}
|
|
G();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void s() {
|
|
if (this.v != null) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.f.a("AppLovinAdView", "Detaching expanded ad: " + this.v.b());
|
|
}
|
|
this.w = this.v;
|
|
this.v = null;
|
|
a(this.j);
|
|
}
|
|
}
|
|
|
|
public void C() {
|
|
if (this.z) {
|
|
gc.b(this.D, this.t);
|
|
if (this.t != null && this.t.isOpenMeasurementEnabled() && yp.a(this.t.getSize())) {
|
|
this.t.getAdEventTracker().f();
|
|
}
|
|
if (this.o != null && this.v != null) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.f.a("AppLovinAdView", "onDetachedFromWindowCalled with expanded ad present");
|
|
}
|
|
c();
|
|
} else if (com.applovin.impl.sdk.n.a()) {
|
|
this.f.a("AppLovinAdView", "onDetachedFromWindowCalled without an expanded ad present");
|
|
}
|
|
}
|
|
}
|
|
|
|
public void H() {
|
|
if (this.z) {
|
|
AppLovinAd appLovinAd = (AppLovinAd) this.x.getAndSet(null);
|
|
if (appLovinAd != null) {
|
|
c(appLovinAd);
|
|
}
|
|
this.A = false;
|
|
}
|
|
}
|
|
|
|
public void c(AppLovinAd appLovinAd) {
|
|
a(appLovinAd, (String) null);
|
|
}
|
|
|
|
public void v() {
|
|
if (this.c != null && this.n != null && this.a != null && this.z) {
|
|
this.d.loadNextAd(this.k, this.j, this.n);
|
|
} else {
|
|
com.applovin.impl.sdk.n.i("AppLovinAdView", "Unable to load next ad: AppLovinAdView is not initialized.");
|
|
}
|
|
}
|
|
|
|
public void c(WebView webView) {
|
|
a(webView, (String) null);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void t() {
|
|
com.applovin.impl.sdk.ad.a b2;
|
|
f fVar = this.w;
|
|
if (fVar == null && this.v == null) {
|
|
return;
|
|
}
|
|
if (fVar != null) {
|
|
b2 = fVar.b();
|
|
this.w.dismiss();
|
|
this.w = null;
|
|
} else {
|
|
b2 = this.v.b();
|
|
this.v.dismiss();
|
|
this.v = null;
|
|
}
|
|
gc.a(this.E, b2, (AppLovinAdView) this.b);
|
|
}
|
|
|
|
public void z() {
|
|
if (this.v == null && this.w == null) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.f.a("AppLovinAdView", "Ad: " + this.t + " closed.");
|
|
}
|
|
a(this.s);
|
|
gc.b(this.D, this.t);
|
|
this.t = null;
|
|
return;
|
|
}
|
|
a();
|
|
}
|
|
|
|
public void b() {
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda7
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.r();
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void b(WebView webView) {
|
|
this.t.getAdEventTracker().c(webView);
|
|
k kVar = this.q;
|
|
if (kVar != null && kVar.a()) {
|
|
mg adEventTracker = this.t.getAdEventTracker();
|
|
k kVar2 = this.q;
|
|
adEventTracker.b(webView, Collections.singletonList(new og(kVar2, FriendlyObstructionPurpose.NOT_VISIBLE, kVar2.getIdentifier())));
|
|
} else {
|
|
this.t.getAdEventTracker().a((View) webView);
|
|
}
|
|
this.t.getAdEventTracker().h();
|
|
this.t.getAdEventTracker().g();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void b(MotionEvent motionEvent) {
|
|
if (this.v == null && (this.t instanceof com.applovin.impl.sdk.ad.a) && this.o != null) {
|
|
com.applovin.impl.sdk.ad.a aVar = (com.applovin.impl.sdk.ad.a) this.t;
|
|
Context context = this.a;
|
|
Activity a = context instanceof Activity ? (Activity) context : zq.a(this.o, this.c);
|
|
if (a != null && !a.isFinishing()) {
|
|
ViewGroup viewGroup = this.b;
|
|
if (viewGroup != null) {
|
|
viewGroup.removeView(this.o);
|
|
}
|
|
f fVar = new f(aVar, this.o, a, this.c);
|
|
this.v = fVar;
|
|
fVar.setOnDismissListener(new DialogInterface.OnDismissListener() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda4
|
|
@Override // android.content.DialogInterface.OnDismissListener
|
|
public final void onDismiss(DialogInterface dialogInterface) {
|
|
a.this.a(dialogInterface);
|
|
}
|
|
});
|
|
this.v.show();
|
|
gc.c(this.E, this.t, (AppLovinAdView) this.b);
|
|
if (this.t.isOpenMeasurementEnabled()) {
|
|
this.t.getAdEventTracker().a((View) this.v.c());
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
com.applovin.impl.sdk.n.h("AppLovinAdView", "Unable to expand ad. No Activity found.");
|
|
Uri i = aVar.i();
|
|
if (i != null) {
|
|
this.d.trackAndLaunchClick(aVar, k(), this, i, motionEvent, this.B, null);
|
|
}
|
|
this.o.a("javascript:al_onFailedExpand();");
|
|
}
|
|
}
|
|
|
|
public void b(final AppLovinAd appLovinAd) {
|
|
if (appLovinAd != null) {
|
|
if (!this.A) {
|
|
c(appLovinAd);
|
|
} else {
|
|
this.x.set(appLovinAd);
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.f.a("AppLovinAdView", "Ad view has paused when an ad was received, ad saved for later");
|
|
}
|
|
}
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda3
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.a(appLovinAd);
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.f.b("AppLovinAdView", "No provided when to the view controller");
|
|
}
|
|
b(-1);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void b(final int i) {
|
|
if (!this.A) {
|
|
a(this.s);
|
|
}
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda9
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.a(i);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void b(Uri uri) {
|
|
if (this.t != null && this.t.D0() && this.p == null) {
|
|
String queryParameter = uri.getQueryParameter("tracking_id");
|
|
if (TextUtils.isEmpty(queryParameter)) {
|
|
this.c.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.J().b("AppLovinAdView", "Invalid tracking id. Cannot initialize GA");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
WebView webView = new WebView(this.a);
|
|
this.p = webView;
|
|
webView.setWebViewClient(new pi());
|
|
this.p.getSettings().setJavaScriptEnabled(true);
|
|
this.p.loadDataWithBaseURL((String) this.c.a(sj.M6), "<html><head><link rel=\"icon\" href=\"data:,\"><G-SCRIPT_TAG></head><body></body></html>".replace("<G-SCRIPT_TAG>", "<script src='https://www.googletagmanager.com/gtag/js?id=<G-TRACKING_ID>'></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', '<G-TRACKING_ID>')</script>".replace("<G-TRACKING_ID>", queryParameter)), "text/html", "UTF-8", null);
|
|
}
|
|
}
|
|
|
|
private void a(AppLovinAdView appLovinAdView, com.applovin.impl.sdk.j jVar, AppLovinAdSize appLovinAdSize, String str, Context context) {
|
|
if (appLovinAdView == null) {
|
|
throw new IllegalArgumentException("No parent view specified");
|
|
}
|
|
if (jVar == null) {
|
|
throw new IllegalArgumentException("No sdk specified");
|
|
}
|
|
if (appLovinAdSize != null) {
|
|
this.c = jVar;
|
|
this.d = jVar.i();
|
|
this.f = jVar.J();
|
|
this.g = AppLovinCommunicator.getInstance(context);
|
|
this.j = appLovinAdSize;
|
|
this.k = str;
|
|
if (!(context instanceof AppLovinFullscreenActivity)) {
|
|
context = context.getApplicationContext();
|
|
}
|
|
this.a = context;
|
|
this.b = appLovinAdView;
|
|
this.m = new com.applovin.impl.adview.c(this, jVar);
|
|
this.s = new c();
|
|
this.r = new d();
|
|
this.n = new e(this, jVar);
|
|
a(appLovinAdSize);
|
|
return;
|
|
}
|
|
throw new IllegalArgumentException("No ad size specified");
|
|
}
|
|
|
|
public void a(AppLovinAdSize appLovinAdSize) {
|
|
try {
|
|
if (((Boolean) this.c.a(sj.I1)).booleanValue()) {
|
|
this.o = (com.applovin.impl.adview.b) f().a(new vb.a() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda12
|
|
@Override // com.applovin.impl.vb.a
|
|
public final Object a() {
|
|
b o;
|
|
o = a.this.o();
|
|
return o;
|
|
}
|
|
});
|
|
} else {
|
|
this.o = new com.applovin.impl.adview.b(this.c, this.a);
|
|
}
|
|
this.o.a(this.m);
|
|
this.o.setBackgroundColor(0);
|
|
this.o.setWillNotCacheDrawing(false);
|
|
this.b.setBackgroundColor(0);
|
|
this.b.addView(this.o);
|
|
b(this.o, appLovinAdSize);
|
|
if (!this.z) {
|
|
a(this.s);
|
|
}
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda13
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.p();
|
|
}
|
|
});
|
|
this.z = true;
|
|
} catch (Throwable th) {
|
|
com.applovin.impl.sdk.n.c("AppLovinAdView", "Failed to initialize AdWebView", th);
|
|
this.c.E().a("AppLovinAdView", "initAdWebView", th);
|
|
this.y.set(true);
|
|
}
|
|
}
|
|
|
|
public void a(AppLovinAdView appLovinAdView, Context context, AppLovinAdSize appLovinAdSize, String str, AppLovinSdk appLovinSdk, AttributeSet attributeSet) {
|
|
if (appLovinAdView == null) {
|
|
throw new IllegalArgumentException("No parent view specified");
|
|
}
|
|
if (context == null) {
|
|
com.applovin.impl.sdk.n.h("AppLovinAdView", "Unable to build AppLovinAdView: no context provided. Please use a different constructor for this view.");
|
|
return;
|
|
}
|
|
if (appLovinAdSize == null && (appLovinAdSize = e0.a(attributeSet)) == null) {
|
|
appLovinAdSize = AppLovinAdSize.BANNER;
|
|
}
|
|
AppLovinAdSize appLovinAdSize2 = appLovinAdSize;
|
|
if (appLovinSdk == null) {
|
|
appLovinSdk = AppLovinSdk.getInstance(context);
|
|
}
|
|
if (appLovinSdk != null) {
|
|
a(appLovinAdView, appLovinSdk.a(), appLovinAdSize2, str, context);
|
|
if (e0.b(attributeSet)) {
|
|
v();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void a(String str, Object obj) {
|
|
this.i.put(str, obj);
|
|
}
|
|
|
|
public void a(AppLovinAd appLovinAd, String str) {
|
|
if (appLovinAd != null) {
|
|
yp.b(appLovinAd, this.c);
|
|
if (this.z) {
|
|
com.applovin.impl.sdk.ad.b bVar = (com.applovin.impl.sdk.ad.b) yp.a(appLovinAd, this.c);
|
|
if (bVar == null) {
|
|
com.applovin.impl.sdk.n.h("AppLovinAdView", "Unable to retrieve the loaded ad: " + appLovinAd);
|
|
gc.a(this.D, "Unable to retrieve the loaded ad");
|
|
return;
|
|
}
|
|
if (bVar == this.t) {
|
|
com.applovin.impl.sdk.n.h("AppLovinAdView", "Attempting to show ad again: " + bVar);
|
|
if (((Boolean) this.c.a(sj.a2)).booleanValue()) {
|
|
if (this.D instanceof qb) {
|
|
gc.a(this.D, "Attempting to show ad again");
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Attempting to show ad again");
|
|
}
|
|
return;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.f.a("AppLovinAdView", "Rendering ad #" + bVar.getAdIdNumber() + " (" + bVar.getSize() + ")");
|
|
}
|
|
gc.b(this.D, this.t);
|
|
if (this.t != null && this.t.isOpenMeasurementEnabled()) {
|
|
this.t.getAdEventTracker().f();
|
|
}
|
|
this.x.set(null);
|
|
this.u = null;
|
|
this.t = bVar;
|
|
if (this.t.B0()) {
|
|
this.l = this.c.x().a(this);
|
|
this.c.x().b(this.t.z(), this.l);
|
|
}
|
|
if (!this.A && yp.a(this.j)) {
|
|
this.c.i().trackImpression(bVar);
|
|
}
|
|
if (this.v != null) {
|
|
c();
|
|
}
|
|
a(this.r);
|
|
return;
|
|
}
|
|
com.applovin.impl.sdk.n.i("AppLovinAdView", "Unable to render ad: AppLovinAdView is not initialized.");
|
|
return;
|
|
}
|
|
throw new IllegalArgumentException("No ad specified");
|
|
}
|
|
|
|
public void a(final WebView webView, String str) {
|
|
if (this.t == null) {
|
|
return;
|
|
}
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda5
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
webView.setVisibility(0);
|
|
}
|
|
});
|
|
if (!((Boolean) this.c.a(sj.q6)).booleanValue() || (str != null && str.startsWith(this.t.g()))) {
|
|
try {
|
|
if (this.t != this.u) {
|
|
this.u = this.t;
|
|
y();
|
|
this.o.setAdHtmlLoaded(true);
|
|
if (this.D != null) {
|
|
this.c.w().d(this.t);
|
|
this.c.E().a(la.k, this.t);
|
|
gc.a(this.D, this.t);
|
|
this.o.a("javascript:al_onAdViewRendered();");
|
|
}
|
|
if ((this.t instanceof com.applovin.impl.sdk.ad.a) && this.t.isOpenMeasurementEnabled()) {
|
|
this.c.j0().a(new jn(this.c, "StartOMSDK", new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda6
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.b(webView);
|
|
}
|
|
}), tm.b.OTHER, 500L);
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
com.applovin.impl.sdk.n.c("AppLovinAdView", "Exception while notifying ad display listener", th);
|
|
com.applovin.impl.sdk.j jVar = this.c;
|
|
if (jVar != null) {
|
|
jVar.E().a("AppLovinAdView", "onAdHtmlLoaded", th);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void a(final MotionEvent motionEvent) {
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda11
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.b(motionEvent);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(DialogInterface dialogInterface) {
|
|
a();
|
|
}
|
|
|
|
public void a() {
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda2
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.q();
|
|
}
|
|
});
|
|
}
|
|
|
|
public void a(com.applovin.impl.sdk.ad.b bVar, AppLovinAdView appLovinAdView, Uri uri, MotionEvent motionEvent, Bundle bundle) {
|
|
if (appLovinAdView != null) {
|
|
this.d.trackAndLaunchClick(bVar, appLovinAdView, this, uri, motionEvent, this.B, bundle);
|
|
} else if (com.applovin.impl.sdk.n.a()) {
|
|
this.f.b("AppLovinAdView", "Unable to process ad click - AppLovinAdView destroyed prematurely");
|
|
}
|
|
gc.a(this.F, bVar);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(AppLovinAd appLovinAd) {
|
|
if (this.y.compareAndSet(true, false)) {
|
|
a(this.j);
|
|
}
|
|
try {
|
|
if (this.C != null) {
|
|
this.C.adReceived(appLovinAd);
|
|
}
|
|
} catch (Throwable th) {
|
|
com.applovin.impl.sdk.n.h("AppLovinAdView", "Exception while running ad load callback: " + th.getMessage());
|
|
com.applovin.impl.sdk.j jVar = this.c;
|
|
if (jVar != null) {
|
|
jVar.E().a("AppLovinAdView", "notifyAdLoaded", th);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(int i) {
|
|
try {
|
|
if (this.C != null) {
|
|
this.C.failedToReceiveAd(i);
|
|
}
|
|
} catch (Throwable th) {
|
|
com.applovin.impl.sdk.n.c("AppLovinAdView", "Exception while running app load callback", th);
|
|
com.applovin.impl.sdk.j jVar = this.c;
|
|
if (jVar != null) {
|
|
jVar.E().a("AppLovinAdView", "notifyAdLoadFailed", th);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void a(Runnable runnable) {
|
|
AppLovinSdkUtils.runOnUiThread(runnable);
|
|
}
|
|
|
|
public void a(Uri uri) {
|
|
if (this.t == null || !this.t.D0()) {
|
|
return;
|
|
}
|
|
if (this.p == null) {
|
|
this.c.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.J().a("AppLovinAdView", "GA is not initialized. Cannot fire GA event");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
final String queryParameter = uri.getQueryParameter(TJAdUnitConstants.PARAM_PLACEMENT_NAME);
|
|
final String queryParameter2 = uri.getQueryParameter("event_params_json");
|
|
if (TextUtils.isEmpty(queryParameter)) {
|
|
this.c.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.J().a("AppLovinAdView", "Invalid GA event name. Cannot fire GA event");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
a(new Runnable() { // from class: com.applovin.impl.adview.a$$ExternalSyntheticLambda14
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
a.this.a(queryParameter2, queryParameter);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(String str, String str2) {
|
|
String str3;
|
|
if (StringUtils.isValidString(str)) {
|
|
str3 = "gtag('event', '" + str2 + "', " + str + ");";
|
|
} else {
|
|
str3 = "gtag('event', '" + str2 + "')";
|
|
}
|
|
tr.a(this.p, str3);
|
|
}
|
|
}
|