- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
194 lines
5.5 KiB
Java
194 lines
5.5 KiB
Java
package com.applovin.adview;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Color;
|
|
import android.util.AttributeSet;
|
|
import android.util.DisplayMetrics;
|
|
import android.util.TypedValue;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.core.view.ViewCompat;
|
|
import com.applovin.impl.adview.a;
|
|
import com.applovin.impl.sdk.n;
|
|
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;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class AppLovinAdView extends RelativeLayout {
|
|
public static final String NAMESPACE = "http://schemas.applovin.com/android/1.0";
|
|
private a a;
|
|
|
|
public AppLovinAdView(AppLovinAdSize appLovinAdSize, Context context) {
|
|
this(appLovinAdSize, (String) null, context);
|
|
}
|
|
|
|
private void a(AppLovinAdSize appLovinAdSize, String str, AppLovinSdk appLovinSdk, Context context, AttributeSet attributeSet) {
|
|
if (isInEditMode()) {
|
|
a(attributeSet, context);
|
|
return;
|
|
}
|
|
a aVar = new a();
|
|
this.a = aVar;
|
|
aVar.a(this, context, appLovinAdSize, str, appLovinSdk, attributeSet);
|
|
}
|
|
|
|
public a getController() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.B();
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public String toString() {
|
|
return "AppLovinAdView{zoneId='" + getZoneId() + "\", size=" + getSize() + '}';
|
|
}
|
|
|
|
public AppLovinAdView(AppLovinAdSize appLovinAdSize, String str, Context context) {
|
|
super(context);
|
|
a(appLovinAdSize, str, null, context, null);
|
|
}
|
|
|
|
public void destroy() {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.b();
|
|
}
|
|
}
|
|
|
|
public AppLovinAdSize getSize() {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
return aVar.m();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public String getZoneId() {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
return aVar.n();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public void loadNextAd() {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.v();
|
|
} else {
|
|
n.i("AppLovinSdk", "Unable to load next ad: AppLovinAdView is not initialized.");
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onDetachedFromWindow() {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.C();
|
|
}
|
|
super.onDetachedFromWindow();
|
|
}
|
|
|
|
public void pause() {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.F();
|
|
}
|
|
}
|
|
|
|
public void renderAd(AppLovinAd appLovinAd) {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.c(appLovinAd);
|
|
}
|
|
}
|
|
|
|
public void resume() {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.H();
|
|
}
|
|
}
|
|
|
|
public void setAdClickListener(AppLovinAdClickListener appLovinAdClickListener) {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.a(appLovinAdClickListener);
|
|
}
|
|
}
|
|
|
|
public void setAdDisplayListener(AppLovinAdDisplayListener appLovinAdDisplayListener) {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.a(appLovinAdDisplayListener);
|
|
}
|
|
}
|
|
|
|
public void setAdLoadListener(AppLovinAdLoadListener appLovinAdLoadListener) {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.a(appLovinAdLoadListener);
|
|
}
|
|
}
|
|
|
|
public void setAdViewEventListener(AppLovinAdViewEventListener appLovinAdViewEventListener) {
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.a(appLovinAdViewEventListener);
|
|
}
|
|
}
|
|
|
|
public void setExtraInfo(@NonNull String str, @Nullable Object obj) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("No key specified");
|
|
}
|
|
a aVar = this.a;
|
|
if (aVar != null) {
|
|
aVar.a(str, obj);
|
|
}
|
|
}
|
|
|
|
public AppLovinAdView(AppLovinSdk appLovinSdk, AppLovinAdSize appLovinAdSize, Context context) {
|
|
this(appLovinSdk, appLovinAdSize, null, context);
|
|
}
|
|
|
|
public AppLovinAdView(AppLovinSdk appLovinSdk, AppLovinAdSize appLovinAdSize, String str, Context context) {
|
|
super(context.getApplicationContext());
|
|
a(appLovinAdSize, str, appLovinSdk, context, null);
|
|
}
|
|
|
|
public AppLovinAdView(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, 0);
|
|
}
|
|
|
|
public AppLovinAdView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
a(null, null, null, context, attributeSet);
|
|
}
|
|
|
|
private void a(AttributeSet attributeSet, Context context) {
|
|
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
|
int i = displayMetrics.widthPixels;
|
|
int applyDimension = (int) TypedValue.applyDimension(1, 50.0f, displayMetrics);
|
|
TextView textView = new TextView(context);
|
|
textView.setBackgroundColor(Color.rgb(220, 220, 220));
|
|
textView.setTextColor(ViewCompat.MEASURED_STATE_MASK);
|
|
textView.setText("AppLovin Ad");
|
|
textView.setGravity(17);
|
|
addView(textView, i, applyDimension);
|
|
}
|
|
}
|