正在查看: Cantique de Louanges v12 应用的 Interstitial.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Cantique de Louanges v12 应用的 Interstitial.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.appnext.ads.interstitial;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Handler;
import android.os.Looper;
import android.os.Process;
import com.applovin.mediation.MaxReward;
import com.appnext.core.Ad;
import com.appnext.core.AppnextAd;
import com.appnext.core.AppnextError;
import com.appnext.core.ECPM;
import com.appnext.core.SettingsManager;
import com.appnext.core.callbacks.OnAdError;
import com.appnext.core.callbacks.OnAdLoaded;
import com.appnext.core.callbacks.OnECPMLoaded;
import com.appnext.core.d;
import com.appnext.core.g;
import com.appnext.core.n;
import com.appnext.core.webview.AppnextWebView;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
public class Interstitial extends Ad {
private static final String JS_URL = "https://cdn.appnext.com/tools/sdk/interstitial/v75/script.min.js";
protected static final String TID = "301";
public static final String TYPE_MANAGED = "managed";
public static final String TYPE_STATIC = "static";
public static final String TYPE_VIDEO = "video";
protected static final String VID = "2.7.0.473";
protected static Interstitial currentAd;
private boolean autoPlay;
private String buttonColor;
private boolean calledShow;
private Boolean canClose;
private boolean configLoaded;
private String creativeType;
private OnAdError internalOnAdError;
private String language;
private boolean setAutoPlay;
private boolean setCanClose;
private String skipText;
private String titleText;
private WeakReference<OnAdError> userOnAdErrorWR;
public Interstitial(Context context, String str) {
super(context, str);
this.creativeType = TYPE_MANAGED;
this.titleText = MaxReward.DEFAULT_LABEL;
this.skipText = MaxReward.DEFAULT_LABEL;
this.autoPlay = true;
this.setAutoPlay = false;
this.setCanClose = false;
this.configLoaded = false;
this.calledShow = false;
this.buttonColor = MaxReward.DEFAULT_LABEL;
this.language = MaxReward.DEFAULT_LABEL;
init();
}
public String getCreative() {
int q4 = g.q(getConfig().t("min_internet_connection"));
int q5 = g.q(getConfig().t("min_internet_connection_video"));
int q6 = g.q(g.c(this.context));
return (q6 < q4 || q6 >= q5) ? getCreativeType() : "static";
}
private boolean hasVideo(AppnextAd appnextAd) {
return (appnextAd.getVideoUrl().equals(MaxReward.DEFAULT_LABEL) && appnextAd.getVideoUrlHigh().equals(MaxReward.DEFAULT_LABEL) && appnextAd.getVideoUrl30Sec().equals(MaxReward.DEFAULT_LABEL) && appnextAd.getVideoUrlHigh30Sec().equals(MaxReward.DEFAULT_LABEL)) ? false : true;
}
private void init() {
try {
loadConfig();
AppnextWebView.q(this.context).a(getPageUrl(), (AppnextWebView.c) null);
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$init", th);
}
}
public void load() {
a.C().a(this.context, this, getPlacementID(), new d.a() {
@Override
public final <T> void a(T t4) {
AppnextAd appnextAd;
try {
try {
appnextAd = a.C().a(((Ad) Interstitial.this).context, (ArrayList<AppnextAd>) t4, Interstitial.this.getCreative(), Interstitial.this);
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$load", th);
OnAdError onAdErrorCallback = Interstitial.this.getOnAdErrorCallback();
if (onAdErrorCallback != null) {
onAdErrorCallback.adError(AppnextError.NO_ADS);
}
appnextAd = null;
}
if (appnextAd != null) {
OnAdLoaded onAdLoadedCallback = Interstitial.this.getOnAdLoadedCallback();
if (onAdLoadedCallback != null) {
onAdLoadedCallback.adLoaded(appnextAd.getBannerID(), appnextAd.getCreativeType());
return;
}
return;
}
OnAdError onAdErrorCallback2 = Interstitial.this.getOnAdErrorCallback();
if (onAdErrorCallback2 != null) {
onAdErrorCallback2.adError(AppnextError.NO_ADS);
}
} catch (Throwable th2) {
com.appnext.base.a.a("Interstitial$load", th2);
}
}
@Override
public final void error(String str) {
try {
OnAdError onAdErrorCallback = Interstitial.this.getOnAdErrorCallback();
if (onAdErrorCallback != null) {
onAdErrorCallback.adError(str);
}
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$error", th);
}
}
}, getCreative());
}
private void loadConfig() {
getConfig().g("tid", getTID());
getConfig().a(this.context, getPlacementID(), new SettingsManager.ConfigCallback() {
@Override
public final void error(String str) {
try {
Interstitial.this.configLoaded = true;
if (Interstitial.this.calledShow) {
Interstitial.this.showAd();
}
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$error", th);
}
}
@Override
public final void loaded(HashMap<String, Object> hashMap) {
try {
Interstitial.this.configLoaded = true;
if (Interstitial.this.calledShow) {
Interstitial.this.showAd();
}
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$loadConfig", th);
}
}
});
}
public void startInterstitialActivity() {
try {
Intent activityIntent = getActivityIntent();
if (activityIntent == null) {
throw new IllegalArgumentException("null intent");
}
this.context.startActivity(activityIntent);
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$startInterstitialActivity", th);
}
}
@Override
public void destroy() {
super.destroy();
currentAd = null;
}
@Override
public String getAUID() {
return "600";
}
protected Intent getActivityIntent() {
Intent intent = new Intent(this.context, (Class<?>) InterstitialActivity.class);
try {
intent.setFlags(268435456);
intent.addFlags(67108864);
intent.putExtra("id", getPlacementID());
if (this.setAutoPlay) {
intent.putExtra("auto_play", this.autoPlay);
}
if (this.setCanClose) {
intent.putExtra("can_close", isBackButtonCanClose());
}
if (this.setMute) {
intent.putExtra("mute", getMute());
}
intent.putExtra("cat", getCategories());
intent.putExtra("lockcat", getSpecificCategories());
intent.putExtra("pbk", getPostback());
intent.putExtra("b_color", getButtonColor());
intent.putExtra("skip_title", getSkipText());
intent.putExtra("creative", getCreative());
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$getActivityIntent", th);
}
return intent;
}
public String getButtonColor() {
return this.buttonColor;
}
protected SettingsManager getConfig() {
return c.E();
}
public String getCreativeType() {
return this.creativeType;
}
@Override
public void getECPM(final OnECPMLoaded onECPMLoaded) {
try {
if (onECPMLoaded == null) {
throw new IllegalArgumentException("Callback cannot be null");
}
a.C().a(this.context, (Ad) this, getPlacementID(), new d.a() {
@Override
public final <T> void a(T t4) {
try {
AppnextAd a5 = a.C().a(((Ad) Interstitial.this).context, (ArrayList<AppnextAd>) t4, Interstitial.this.getCreative(), Interstitial.this);
if (a5 != null) {
onECPMLoaded.ecpm(new ECPM(a5.getECPM(), a5.getPPR(), a5.getBannerID()));
} else {
onECPMLoaded.error(AppnextError.NO_ADS);
}
} catch (Throwable unused) {
}
}
@Override
public final void error(String str) {
onECPMLoaded.error(str);
}
}, false);
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$getECPM", th);
}
}
protected com.appnext.core.webview.a getFallback() {
return new b();
}
public String getLanguage() {
return this.language;
}
@Override
public OnAdError getOnAdErrorCallback() {
return super.getOnAdErrorCallback();
}
protected String getPageUrl() {
return JS_URL;
}
@Override
protected String getSessionId() {
return super.getSessionId();
}
public String getSkipText() {
return this.skipText;
}
@Override
public String getTID() {
return TID;
}
@Override
public String getVID() {
return VID;
}
@Override
public boolean isAdLoaded() {
try {
if (getPlacementID().equals(MaxReward.DEFAULT_LABEL)) {
return false;
}
return a.C().f(this);
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$isAdLoaded", th);
return true;
}
}
public boolean isAutoPlay() {
return this.autoPlay;
}
@Deprecated
public boolean isBackButtonCanClose() {
Boolean bool = this.canClose;
if (bool == null) {
return true;
}
return bool.booleanValue();
}
@Override
public void loadAd() {
try {
if (getPlacementID().equals(MaxReward.DEFAULT_LABEL)) {
com.appnext.base.a.a("Interstitial$init", new Throwable("Placement ID cannot be empty"));
}
if (g.c(this.context, "android.permission.INTERNET") && g.g(this.context)) {
n.aa().a(new Runnable() {
@Override
public final void run() {
try {
if (((Ad) Interstitial.this).context.checkPermission("android.permission.ACCESS_NETWORK_STATE", Process.myPid(), Process.myUid()) != 0) {
g.a(((Ad) Interstitial.this).context, "http://www.appnext.com/myid.html", null);
} else {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) ((Ad) Interstitial.this).context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo == null || !activeNetworkInfo.isConnected()) {
return;
}
}
Interstitial.this.getConfig().a(((Ad) Interstitial.this).context, Interstitial.this.getPlacementID(), new SettingsManager.ConfigCallback() {
@Override
public final void error(String str) {
Interstitial.this.load();
}
@Override
public final void loaded(HashMap<String, Object> hashMap) {
Interstitial.this.load();
}
});
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$init", th);
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
OnAdError onAdErrorCallback = Interstitial.this.getOnAdErrorCallback();
if (onAdErrorCallback != null) {
onAdErrorCallback.adError(AppnextError.CONNECTION_ERROR);
}
}
});
}
}
});
return;
}
OnAdError onAdErrorCallback = getOnAdErrorCallback();
if (onAdErrorCallback != null) {
onAdErrorCallback.adError(AppnextError.CONNECTION_ERROR);
}
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$loadAd", th);
}
}
public void setAutoPlay(boolean z4) {
this.setAutoPlay = true;
this.autoPlay = z4;
}
@Deprecated
public void setBackButtonCanClose(boolean z4) {
this.setCanClose = true;
this.canClose = Boolean.valueOf(z4);
}
public void setButtonColor(String str) {
if (str == null || str.equals(MaxReward.DEFAULT_LABEL)) {
this.buttonColor = MaxReward.DEFAULT_LABEL;
return;
}
if (!str.startsWith("#")) {
str = "#" + str;
}
Color.parseColor(str);
this.buttonColor = str;
}
public void setCreativeType(String str) {
try {
if (str == null) {
throw new IllegalArgumentException("Wrong creative type");
}
if (!str.equals(TYPE_MANAGED) && !str.equals("static") && !str.equals("video")) {
throw new IllegalArgumentException("Wrong creative type");
}
this.creativeType = str;
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$setCreativeType", th);
}
}
public void setLanguage(String str) {
this.language = str;
}
@Override
public void setOnAdErrorCallback(OnAdError onAdError) {
if (onAdError == null) {
return;
}
try {
OnAdError onAdError2 = new OnAdError() {
@Override
public final void adError(String str) {
String str2;
OnAdError onAdError3;
str.hashCode();
switch (str) {
case "Internal error":
str2 = "error_internal_error";
break;
case "No Ads":
str2 = "error_no_ads";
break;
case "Connection Error":
str2 = "error_connection_error";
break;
case "No market installed on the device":
str2 = "error_no_market";
break;
case "Ad Not Ready":
str2 = "error_ad_not_ready";
break;
case "Timeout":
str2 = "error_timeout";
break;
case "Too Slow Connection":
str2 = "error_slow_connection";
break;
default:
str2 = MaxReward.DEFAULT_LABEL;
break;
}
g.a(((Ad) Interstitial.this).context, Interstitial.this.getTID(), Interstitial.this.getVID(), Interstitial.this.getAUID(), Interstitial.this.getPlacementID(), Interstitial.this.getSessionId(), str2, "current_interstitial", MaxReward.DEFAULT_LABEL, MaxReward.DEFAULT_LABEL);
if (Interstitial.this.userOnAdErrorWR == null || (onAdError3 = (OnAdError) Interstitial.this.userOnAdErrorWR.get()) == null) {
return;
}
onAdError3.adError(str);
}
};
this.internalOnAdError = onAdError2;
super.setOnAdErrorCallback(onAdError2);
this.userOnAdErrorWR = new WeakReference<>(onAdError);
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$setOnAdErrorCallback", th);
}
}
@Override
@Deprecated
public void setOrientation(String str) {
}
public void setParams(String str, String str2) {
getConfig().i(str, str2);
}
public void setSkipText(String str) {
if (str == null) {
str = MaxReward.DEFAULT_LABEL;
}
this.skipText = str;
}
@Override
public void showAd() {
try {
if (getPlacementID().equals(MaxReward.DEFAULT_LABEL)) {
throw new IllegalArgumentException("Placement ID cannot be empty");
}
if (!g.c(this.context, "android.permission.INTERNET")) {
OnAdError onAdErrorCallback = getOnAdErrorCallback();
if (onAdErrorCallback != null) {
onAdErrorCallback.adError(AppnextError.CONNECTION_ERROR);
return;
}
return;
}
int q4 = g.q(getConfig().t("min_internet_connection"));
int q5 = g.q(g.c(this.context));
if (q5 == -1) {
OnAdError onAdErrorCallback2 = getOnAdErrorCallback();
if (onAdErrorCallback2 != null) {
onAdErrorCallback2.adError(AppnextError.CONNECTION_ERROR);
return;
}
return;
}
if (q5 < q4) {
OnAdError onAdErrorCallback3 = getOnAdErrorCallback();
if (onAdErrorCallback3 != null) {
onAdErrorCallback3.adError(AppnextError.SLOW_CONNECTION);
return;
}
return;
}
currentAd = this;
if (a.C().f(this)) {
startInterstitialActivity();
} else {
a.C().a(this.context, this, getPlacementID(), new d.a() {
@Override
public final <T> void a(T t4) {
Interstitial.this.startInterstitialActivity();
}
@Override
public final void error(final String str) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
try {
OnAdError onAdErrorCallback4 = Interstitial.this.getOnAdErrorCallback();
if (onAdErrorCallback4 != null) {
onAdErrorCallback4.adError(str);
}
} catch (Throwable unused) {
}
}
});
}
}, getCreative());
}
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$showAd", th);
}
}
public Interstitial(Context context, String str, InterstitialConfig interstitialConfig) {
super(context, str);
this.creativeType = TYPE_MANAGED;
this.titleText = MaxReward.DEFAULT_LABEL;
this.skipText = MaxReward.DEFAULT_LABEL;
boolean z4 = true;
this.autoPlay = true;
this.setAutoPlay = false;
this.setCanClose = false;
this.configLoaded = false;
this.calledShow = false;
this.buttonColor = MaxReward.DEFAULT_LABEL;
this.language = MaxReward.DEFAULT_LABEL;
try {
init();
if (interstitialConfig != null) {
setPostback(interstitialConfig.getPostback());
setCategories(interstitialConfig.getCategories());
setSpecificCategories(interstitialConfig.getSpecificCategories());
setButtonColor(interstitialConfig.getButtonColor());
if (interstitialConfig.backButtonCanClose != null) {
setBackButtonCanClose(interstitialConfig.isBackButtonCanClose());
}
setSkipText(interstitialConfig.getSkipText());
if (interstitialConfig.autoPlay != null) {
setAutoPlay(interstitialConfig.isAutoPlay());
}
setCreativeType(interstitialConfig.getCreativeType());
setOrientation(interstitialConfig.getOrientation());
if (interstitialConfig.mute == null) {
z4 = false;
}
if (z4) {
setMute(interstitialConfig.getMute());
}
setMinVideoLength(interstitialConfig.getMinVideoLength());
setMaxVideoLength(interstitialConfig.getMaxVideoLength());
setLanguage(interstitialConfig.getLanguage());
}
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$Interstitial", th);
}
}
protected Interstitial(Interstitial interstitial) {
super(interstitial);
this.creativeType = TYPE_MANAGED;
this.titleText = MaxReward.DEFAULT_LABEL;
this.skipText = MaxReward.DEFAULT_LABEL;
this.autoPlay = true;
this.setAutoPlay = false;
this.setCanClose = false;
this.configLoaded = false;
this.calledShow = false;
this.buttonColor = MaxReward.DEFAULT_LABEL;
this.language = MaxReward.DEFAULT_LABEL;
try {
this.creativeType = interstitial.creativeType;
this.titleText = interstitial.titleText;
this.skipText = interstitial.skipText;
this.autoPlay = interstitial.autoPlay;
this.setAutoPlay = interstitial.setAutoPlay;
this.setCanClose = interstitial.setCanClose;
this.configLoaded = interstitial.configLoaded;
this.calledShow = interstitial.calledShow;
this.canClose = interstitial.canClose;
this.buttonColor = interstitial.buttonColor;
this.language = interstitial.language;
this.userOnAdErrorWR = interstitial.userOnAdErrorWR;
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$Interstitial", th);
}
}
}