atsameip v0.1版本的 MD5 值为:28547cf98b0a2d02acb37969dcfb83e9
以下内容为反编译后的 ResultPageActivity.java 源代码,内容仅作参考
package com.appnext.core.result;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.webkit.ConsoleMessage;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import com.appnext.core.Ad;
import com.appnext.core.AppnextAd;
import com.appnext.core.SettingsManager;
import com.appnext.core.f;
import com.appnext.core.g;
import com.appnext.core.h;
import com.appnext.core.k;
import com.appnext.core.n;
import com.appnext.core.p;
import com.appnext.core.webview.AppnextWebView;
import java.net.URL;
import org.json.JSONObject;
public class ResultPageActivity extends Activity {
private boolean aA;
private String ay;
private String bW;
private c eA;
private AppnextAd ex;
private String ey;
private com.appnext.core.result.a ez;
private AppnextAd j;
private String placementID;
private p userAction;
private WebView webView;
@Override
protected void onCreate(Bundle bundle) {
final String str;
Object bVar;
requestWindowFeature(1);
super.onCreate(bundle);
try {
c az = d.ay().az();
this.eA = az;
this.placementID = az.getPlacementId();
this.ey = this.eA.v();
this.aA = getIntent().getExtras().getBoolean("shouldClose");
this.ex = this.eA.getSelectedAd();
this.bW = this.eA.w();
this.ay = this.eA.x();
this.userAction = new p(this, new p.a() {
@Override
public final void report(String str2) {
}
@Override
public final Ad c() {
return ResultPageActivity.this.eA.z();
}
@Override
public final AppnextAd d() {
return ResultPageActivity.this.j;
}
@Override
public final SettingsManager e() {
return ResultPageActivity.this.eA.y();
}
});
this.ez = this.eA.A();
try {
RelativeLayout relativeLayout = new RelativeLayout(this);
setContentView(relativeLayout);
relativeLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
WebView webView = new WebView(getApplicationContext());
this.webView = webView;
relativeLayout.addView(webView);
this.webView.getLayoutParams().height = -1;
this.webView.getLayoutParams().width = -1;
this.webView.getSettings().setJavaScriptEnabled(true);
this.webView.getSettings().setAppCacheEnabled(true);
this.webView.getSettings().setDomStorageEnabled(true);
this.webView.getSettings().setDatabaseEnabled(true);
if (Build.VERSION.SDK_INT >= 21) {
this.webView.getSettings().setMixedContentMode(0);
}
if (Build.VERSION.SDK_INT >= 17) {
this.webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
}
this.webView.setWebChromeClient(new WebChromeClient() {
@Override
public final boolean onConsoleMessage(ConsoleMessage consoleMessage) {
StringBuilder sb = new StringBuilder("[");
sb.append(consoleMessage.messageLevel().name());
sb.append(":CONSOLE(");
sb.append(consoleMessage.lineNumber());
sb.append(")] \"");
sb.append(consoleMessage.message());
sb.append("\", source: ");
sb.append(consoleMessage.sourceId());
sb.append(" (");
sb.append(consoleMessage.lineNumber());
sb.append(")");
return true;
}
});
this.webView.setWebViewClient(getWebViewClient());
if (this.ez != null) {
this.ez.getJSurl();
str = this.ez.getJSurl();
} else {
str = "https://cdn.appnext.com/tools/sdk/banner/2.4.3/result.min.js";
}
AppnextWebView.q(this).a(str, new AppnextWebView.c() {
@Override
public final void f(String str2) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
try {
ResultPageActivity.this.o(str, AppnextWebView.q(ResultPageActivity.this).D(str));
} catch (Throwable th) {
com.appnext.base.a.a("ResultPageActivity$loaded", th);
}
}
});
}
@Override
public final void error(String str2) {
new StringBuilder("error loading script ").append(str2);
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
ResultPageActivity.this.o(str, ResultPageActivity.this.getFallbackScript());
}
});
}
});
WebView webView2 = this.webView;
if (this.ez != null && this.ez.B() != null) {
bVar = this.ez.B();
} else {
bVar = new b();
}
webView2.addJavascriptInterface(bVar, "Appnext");
} catch (Throwable unused) {
}
} catch (Throwable th) {
com.appnext.base.a.a("ResultPageActivity$onCreate", th);
finish();
}
}
public String getFallbackScript() {
com.appnext.core.result.a aVar = this.ez;
if (aVar != null && aVar.getFallbackScript() != null) {
return this.ez.getFallbackScript();
}
return new com.appnext.core.result.b().D();
}
public class b {
public b() {
}
@JavascriptInterface
public final void adClicked(String str, int i) {
try {
ResultPageActivity.this.j = (AppnextAd) ResultPageActivity.this.parseAd(str);
if (ResultPageActivity.this.userAction != null) {
p pVar = ResultPageActivity.this.userAction;
AppnextAd appnextAd = ResultPageActivity.this.j;
pVar.a(appnextAd, ResultPageActivity.this.f(ResultPageActivity.this.j).getAppURL() + "&tem_id=" + ResultPageActivity.this.ey + "1", ResultPageActivity.this.placementID, new f.a() {
@Override
public final void error(String str2) {
}
@Override
public final void onMarket(String str2) {
if (ResultPageActivity.this.aA) {
ResultPageActivity.this.finish();
}
}
});
}
} catch (Throwable th) {
com.appnext.base.a.a("WebInterface$adClicked", th);
}
}
@JavascriptInterface
public final void impression(String str) {
try {
ResultPageActivity.this.userAction.d((AppnextAd) ResultPageActivity.this.parseAd(str));
} catch (Throwable th) {
com.appnext.base.a.a("WebInterface$impression", th);
}
}
@JavascriptInterface
public final void postView(String str) {
try {
AppnextAd appnextAd = (AppnextAd) ResultPageActivity.this.parseAd(str);
p pVar = ResultPageActivity.this.userAction;
pVar.a(appnextAd, ResultPageActivity.this.f(appnextAd).getImpressionURL() + "&tem_id=" + ResultPageActivity.this.ey + "1", null);
} catch (Throwable th) {
com.appnext.base.a.a("WebInterface$postView", th);
}
}
@JavascriptInterface
public final void openLink(String str) {
try {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
intent.addFlags(268435456);
ResultPageActivity.this.startActivity(intent);
} catch (Throwable th) {
com.appnext.base.a.a("WebInterface$openLink", th);
}
}
}
private WebViewClient getWebViewClient() {
try {
if (this.ez != null && this.ez.getWebViewClient() != null) {
return this.ez.getWebViewClient();
}
return new a();
} catch (Throwable unused) {
return new a();
}
}
public class a extends WebViewClient {
public a() {
}
@Override
public final boolean shouldOverrideUrlLoading(WebView webView, String str) {
if (str == null) {
return false;
}
if (str.startsWith("http")) {
webView.loadUrl(str);
return true;
}
return super.shouldOverrideUrlLoading(webView, str);
}
@Override
public final void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
try {
n.aa().a(new Runnable() {
@Override
public final void run() {
final String b = g.b((Context) ResultPageActivity.this, false);
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
try {
ResultPageActivity resultPageActivity = ResultPageActivity.this;
resultPageActivity.loadJS("Appnext.setParams(" + d.ay().az().getConfigParams().put("did", b).toString() + ");");
} catch (Throwable unused) {
}
ResultPageActivity resultPageActivity2 = ResultPageActivity.this;
resultPageActivity2.loadJS("Appnext.load(" + ResultPageActivity.this.f(ResultPageActivity.this.ex).getAdJSON() + "," + ResultPageActivity.this.ay + "," + ResultPageActivity.this.bW + ");");
}
});
}
});
} catch (Throwable th) {
com.appnext.base.a.a("WebInterface$onPageFinished", th);
}
}
}
public h parseAd(String str) {
try {
JSONObject jSONObject = new JSONObject(str);
AppnextAd appnextAd = (AppnextAd) k.a(AppnextAd.class, jSONObject);
if (appnextAd != null) {
f(appnextAd).setAdJSON(jSONObject.toString());
if (TextUtils.isEmpty(appnextAd.getStoreRating())) {
f(appnextAd).setStoreRating("0");
}
}
return appnextAd;
} catch (Throwable th) {
com.appnext.base.a.a("ResultPageActivity$parseAd", th);
return null;
}
}
protected final void loadJS(String str) {
try {
new StringBuilder("loading js ").append(str);
if (this.webView != null) {
WebView webView = this.webView;
webView.loadUrl("javascript:(function() { try { " + str + " } catch(err){ Appnext.jsError(err.message); }})()");
}
} catch (Throwable th) {
com.appnext.base.a.a("ResultPageActivity$loadJS", th);
}
}
protected final void o(String str, String str2) {
try {
URL url = new URL(str);
this.webView.loadDataWithBaseURL(url.getProtocol() + "://" + url.getHost(), "<html><body><script>" + str2 + "</script></body></html>", null, "UTF-8", null);
} catch (Throwable th) {
com.appnext.base.a.a("ResultPageActivity$loadWebview", th);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
try {
if (this.webView != null) {
this.webView.destroy();
this.webView = null;
}
} catch (Throwable th) {
com.appnext.base.a.a("ResultPageActivity$onDestroy", th);
}
try {
this.userAction.destroy();
} catch (Throwable th2) {
com.appnext.base.a.a("ResultPageActivity$onDestroy", th2);
}
}
public CustomAd f(AppnextAd appnextAd) {
return new CustomAd(appnextAd);
}
public class CustomAd extends AppnextAd {
CustomAd(AppnextAd appnextAd) {
super(appnextAd);
}
@Override
public void setAdJSON(String str) {
super.setAdJSON(str);
}
@Override
public String getAdJSON() {
return super.getAdJSON();
}
@Override
public String getAppURL() {
return super.getAppURL();
}
@Override
public void setStoreRating(String str) {
super.setStoreRating(str);
}
@Override
public String getImpressionURL() {
return super.getImpressionURL();
}
}
}