atsameip v0.1版本的 MD5 值为:28547cf98b0a2d02acb37969dcfb83e9
以下内容为反编译后的 Interstitial.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.appnext.ads.AdsError;
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.6.6.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;
@Override
public String getAUID() {
return "600";
}
public String getPageUrl() {
return JS_URL;
}
@Override
public String getTID() {
return TID;
}
@Override
public String getVID() {
return VID;
}
@Override
@Deprecated
public void setOrientation(String str) {
}
public Interstitial(Context context, String str) {
super(context, str);
this.creativeType = TYPE_MANAGED;
this.titleText = "";
this.skipText = "";
this.autoPlay = true;
this.setAutoPlay = false;
this.setCanClose = false;
this.configLoaded = false;
this.calledShow = false;
this.buttonColor = "";
this.language = "";
init();
}
public Interstitial(Context context, String str, InterstitialConfig interstitialConfig) {
super(context, str);
this.creativeType = TYPE_MANAGED;
this.titleText = "";
this.skipText = "";
boolean z = true;
this.autoPlay = true;
this.setAutoPlay = false;
this.setCanClose = false;
this.configLoaded = false;
this.calledShow = false;
this.buttonColor = "";
this.language = "";
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) {
z = false;
}
if (z) {
setMute(interstitialConfig.getMute());
}
setMinVideoLength(interstitialConfig.getMinVideoLength());
setMaxVideoLength(interstitialConfig.getMaxVideoLength());
setLanguage(interstitialConfig.getLanguage());
}
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$Interstitial", th);
}
}
public Interstitial(Interstitial interstitial) {
super(interstitial);
this.creativeType = TYPE_MANAGED;
this.titleText = "";
this.skipText = "";
this.autoPlay = true;
this.setAutoPlay = false;
this.setCanClose = false;
this.configLoaded = false;
this.calledShow = false;
this.buttonColor = "";
this.language = "";
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);
}
}
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);
}
}
@Override
public void loadAd() {
try {
if (getPlacementID().equals("")) {
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 (Interstitial.this.context.checkPermission("android.permission.ACCESS_NETWORK_STATE", Process.myPid(), Process.myUid()) != 0) {
g.a(Interstitial.this.context, "http://www.appnext.com/myid.html", null);
} else {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) Interstitial.this.context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo == null || !activeNetworkInfo.isConnected()) {
return;
}
}
Interstitial.this.getConfig().a(Interstitial.this.context, Interstitial.this.getPlacementID(), new SettingsManager.ConfigCallback() {
@Override
public final void loaded(HashMap<String, Object> hashMap) {
Interstitial.this.load();
}
@Override
public final void error(String str) {
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 load() {
a.C().a(this.context, this, getPlacementID(), new d.a() {
@Override
public final <T> void a(T t) {
try {
AppnextAd a = a.C().a(Interstitial.this.context, (ArrayList) t, Interstitial.this.getCreative(), Interstitial.this);
if (a != null) {
OnAdLoaded onAdLoadedCallback = Interstitial.this.getOnAdLoadedCallback();
if (onAdLoadedCallback != null) {
onAdLoadedCallback.adLoaded(a.getBannerID(), a.getCreativeType());
return;
}
return;
}
OnAdError onAdErrorCallback = Interstitial.this.getOnAdErrorCallback();
if (onAdErrorCallback != null) {
onAdErrorCallback.adError(AppnextError.NO_ADS);
}
}
}
@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());
}
@Override
public void showAd() {
try {
if (getPlacementID().equals("")) {
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 q = g.q(getConfig().t("min_internet_connection"));
int q2 = g.q(g.c(this.context));
if (q2 == -1) {
OnAdError onAdErrorCallback2 = getOnAdErrorCallback();
if (onAdErrorCallback2 != null) {
onAdErrorCallback2.adError(AppnextError.CONNECTION_ERROR);
}
} else if (q2 < q) {
OnAdError onAdErrorCallback3 = getOnAdErrorCallback();
if (onAdErrorCallback3 != null) {
onAdErrorCallback3.adError(AppnextError.SLOW_CONNECTION);
}
} else {
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 t) {
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 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 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 t) {
try {
AppnextAd a = a.C().a(Interstitial.this.context, (ArrayList) t, Interstitial.this.getCreative(), Interstitial.this);
if (a != null) {
onECPMLoaded.ecpm(new ECPM(a.getECPM(), a.getPPR(), a.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);
}
}
public String getCreative() {
int q = g.q(getConfig().t("min_internet_connection"));
int q2 = g.q(getConfig().t("min_internet_connection_video"));
int q3 = g.q(g.c(this.context));
return (q3 < q || q3 >= q2) ? getCreativeType() : "static";
}
protected Intent getActivityIntent() {
Intent intent = new Intent(this.context, 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;
}
@Override
public boolean isAdLoaded() {
try {
if (getPlacementID().equals("")) {
return false;
}
return a.C().f(this);
} catch (Throwable th) {
com.appnext.base.a.a("Interstitial$isAdLoaded", th);
return true;
}
}
protected SettingsManager getConfig() {
return c.E();
}
private void loadConfig() {
getConfig().g("tid", getTID());
getConfig().a(this.context, getPlacementID(), new SettingsManager.ConfigCallback() {
@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);
}
}
@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 void setOnAdErrorCallback(OnAdError onAdError) {
if (onAdError == null) {
return;
}
try {
OnAdError onAdError2 = new OnAdError() {
@Override
public final void adError(String str) {
char c;
String str2;
OnAdError onAdError3;
switch (str.hashCode()) {
case -2026653947:
if (str.equals(AppnextError.INTERNAL_ERROR)) {
c = 1;
break;
}
c = 65535;
break;
case -1958363695:
if (str.equals(AppnextError.NO_ADS)) {
c = 2;
break;
}
c = 65535;
break;
case -1477010874:
if (str.equals(AppnextError.CONNECTION_ERROR)) {
c = 0;
break;
}
c = 65535;
break;
case -507110949:
if (str.equals(AppnextError.NO_MARKET)) {
c = 3;
break;
}
c = 65535;
break;
case 297538105:
if (str.equals(AdsError.AD_NOT_READY)) {
c = 6;
break;
}
c = 65535;
break;
case 350741825:
if (str.equals(AppnextError.TIMEOUT)) {
c = 5;
break;
}
c = 65535;
break;
case 844170097:
if (str.equals(AppnextError.SLOW_CONNECTION)) {
c = 4;
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
switch (c) {
case 0:
str2 = "error_connection_error";
break;
case 1:
str2 = "error_internal_error";
break;
case 2:
str2 = "error_no_ads";
break;
case 3:
str2 = "error_no_market";
break;
case 4:
str2 = "error_slow_connection";
break;
case 5:
str2 = "error_timeout";
break;
case 6:
str2 = "error_ad_not_ready";
break;
default:
str2 = "";
break;
}
g.a(Interstitial.this.context, Interstitial.this.getTID(), Interstitial.this.getVID(), Interstitial.this.getAUID(), Interstitial.this.getPlacementID(), Interstitial.this.getSessionId(), str2, "current_interstitial", "", "");
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
public OnAdError getOnAdErrorCallback() {
return super.getOnAdErrorCallback();
}
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 String getCreativeType() {
return this.creativeType;
}
@Deprecated
public void setBackButtonCanClose(boolean z) {
this.setCanClose = true;
this.canClose = Boolean.valueOf(z);
}
@Deprecated
public boolean isBackButtonCanClose() {
Boolean bool = this.canClose;
if (bool == null) {
return true;
}
return bool.booleanValue();
}
public boolean isAutoPlay() {
return this.autoPlay;
}
public void setAutoPlay(boolean z) {
this.setAutoPlay = true;
this.autoPlay = z;
}
public void setSkipText(String str) {
if (str == null) {
str = "";
}
this.skipText = str;
}
public String getSkipText() {
return this.skipText;
}
public String getButtonColor() {
return this.buttonColor;
}
public void setButtonColor(String str) {
if (str == null || str.equals("")) {
this.buttonColor = "";
return;
}
if (!str.startsWith("#")) {
str = "#" + str;
}
Color.parseColor(str);
this.buttonColor = str;
}
private boolean hasVideo(AppnextAd appnextAd) {
return (appnextAd.getVideoUrl().equals("") && appnextAd.getVideoUrlHigh().equals("") && appnextAd.getVideoUrl30Sec().equals("") && appnextAd.getVideoUrlHigh30Sec().equals("")) ? false : true;
}
public void setParams(String str, String str2) {
getConfig().i(str, str2);
}
public String getLanguage() {
return this.language;
}
public void setLanguage(String str) {
this.language = str;
}
@Override
public String getSessionId() {
return super.getSessionId();
}
public com.appnext.core.webview.a getFallback() {
return new b();
}
@Override
public void destroy() {
super.destroy();
currentAd = null;
}
}