Stick Squad 3 v1.2.5.9版本的 MD5 值为:375cf7f77a7075270cd68d1397368279
以下内容为反编译后的 o.java 源代码,内容仅作参考
package com.fusepowered.sa.android.publish.f;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.util.Log;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.facebook.AppEventsConstants;
import com.fusepowered.ads.adapters.StartAppAdAdapter;
import com.fusepowered.l1.AdBrowseWebViewClient;
import com.fusepowered.sa.android.publish.model.AdPreferences;
import com.fusepowered.sa.android.publish.model.MetaData;
import com.fusepowered.sa.android.publish.model.NameValueObject;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.json.JSONException;
import org.json.JSONObject;
public class o {
private static ProgressDialog f369c;
private static Map<Activity, Integer> a = new HashMap();
private static ThreadPoolExecutor b = new ThreadPoolExecutor(1, 4, 0, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
private static boolean d = false;
public static class a extends WebViewClient {
private String a;
private int d;
private ProgressDialog e;
private Runnable f;
private Context h;
private boolean b = false;
private boolean f370c = false;
private boolean g = false;
public a(Context context, int i, ProgressDialog progressDialog, String str, Runnable runnable) {
this.a = "";
this.h = context;
this.d = i;
this.e = progressDialog;
this.a = str;
this.f = runnable;
}
private void a() {
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(a.this.d);
} catch (InterruptedException e) {
}
if (a.this.b) {
return;
}
a.this.g = true;
o.g(a.this.h);
o.c(a.this.h, a.this.a);
if (a.this.f != null) {
a.this.f.run();
}
}
}).start();
}
@Override
public void onPageFinished(WebView webView, String str) {
g.a(2, "MyWebViewClient::onPageFinished - [" + str + "]");
super.onPageFinished(webView, str);
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
g.a(2, "MyWebViewClient::onPageStarted - [" + str + "]");
super.onPageStarted(webView, str, bitmap);
if (this.f370c) {
return;
}
a();
this.f370c = true;
}
@Override
public void onReceivedError(WebView webView, int i, String str, String str2) {
g.a(2, "MyWebViewClient::onReceivedError - [" + str + "], [" + str2 + "]");
super.onReceivedError(webView, i, str, str2);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
String lowerCase;
g.a(2, "MyWebViewClient::shouldOverrideUrlLoading - [" + str + "]");
try {
this.a = str;
lowerCase = str.toLowerCase();
} catch (Exception e) {
g.a(6, "StartAppWall.UtilExcpetion - view to attached to window - Load Progress");
}
if (!(lowerCase.startsWith(AdBrowseWebViewClient.MARKET_SCHEME) || lowerCase.startsWith("http://play.google.com") || lowerCase.startsWith("https://play.google.com"))) {
return false;
}
if (!this.g) {
this.b = true;
o.g(this.h);
o.c(this.h, str);
if (this.f != null) {
this.f.run();
}
}
return true;
}
}
public static int a(Context context, int i) {
return (int) ((context.getResources().getDisplayMetrics().density * i) + 0.5f);
}
public static String a() {
Properties properties = null;
String str = "";
try {
properties = j();
} catch (Exception e) {
str = AppEventsConstants.EVENT_PARAM_VALUE_NO;
}
if (str.compareTo(AppEventsConstants.EVENT_PARAM_VALUE_NO) != 0) {
str = properties.getProperty("inapp.version");
if (str == null || "".equals(str)) {
str = AppEventsConstants.EVENT_PARAM_VALUE_NO;
}
if ("${project.version}".equals(str)) {
str = AppEventsConstants.EVENT_PARAM_VALUE_NO;
}
}
String str2 = str + e();
g.a(3, "SDK version: [" + str2 + "]");
return str2;
}
public static String a(Context context, String str) {
try {
return context.getResources().getString(context.getApplicationInfo().labelRes);
} catch (Resources.NotFoundException e) {
PackageManager packageManager = context.getPackageManager();
ApplicationInfo applicationInfo = null;
try {
applicationInfo = packageManager.getApplicationInfo(context.getApplicationInfo().packageName, 0);
} catch (PackageManager.NameNotFoundException e2) {
}
return (String) (applicationInfo != null ? packageManager.getApplicationLabel(applicationInfo) : str);
}
}
public static String a(String str, String str2, String str3) {
int indexOf;
int indexOf2;
if (str == null || str2 == null || str3 == null || (indexOf = str.indexOf(str2)) == -1 || (indexOf2 = str.indexOf(str3, str2.length() + indexOf)) == -1) {
return null;
}
return str.substring(str2.length() + indexOf, indexOf2);
}
public static void a(Activity activity, int i, boolean z) {
if (z) {
if (!a.containsKey(activity)) {
a.put(activity, Integer.valueOf(activity.getRequestedOrientation()));
}
b.a(activity, i);
} else if (a.containsKey(activity)) {
activity.setRequestedOrientation(a.get(activity).intValue());
a.remove(activity);
}
}
public static void a(Activity activity, boolean z) {
a(activity, activity.getResources().getConfiguration().orientation, z);
}
public static void a(Context context, Intent intent) {
for (ResolveInfo resolveInfo : context.getPackageManager().queryIntentActivities(intent, 0)) {
if (resolveInfo.activityInfo.packageName.equalsIgnoreCase(com.fusepowered.sa.android.publish.b.f353c)) {
intent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name));
}
}
}
public static void a(Context context, AdPreferences adPreferences) {
String a2 = f.a(context, "shared_prefs_devId", (String) null);
String a3 = f.a(context, "shared_prefs_appId", (String) null);
if (adPreferences.getPublisherId() == null) {
if (a2 == null) {
}
adPreferences.setPublisherId(a2);
}
if (adPreferences.getProductId() == null) {
if (a3 == null) {
}
adPreferences.setProductId(a3);
}
if ((adPreferences.getProductId() == null || adPreferences.getPublisherId() == null) && !d) {
d = true;
Log.e(StartAppAdAdapter.name, "Integration Error - Developer ID and/or App ID is missing");
}
}
public static final void a(Context context, String str, int i) {
a(context, str, i, (Runnable) null);
}
public static final void a(Context context, String str, int i, Runnable runnable) {
context.sendBroadcast(new Intent("com.fusepowered.sa.android.OnClickCallback"));
if (context instanceof Activity) {
a((Activity) context, true);
}
final WebView webView = new WebView(context);
if (f369c == null && (context instanceof Activity) && !((Activity) context).isFinishing()) {
f369c = ProgressDialog.show(context, null, "Loading....", false, false, new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
WebView.this.stopLoading();
}
});
f369c.setCancelable(false);
}
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new a(context, i, f369c, str, runnable));
webView.loadUrl(str);
}
public static void a(Context context, String str, String str2) {
f.b(context, "shared_prefs_devId", str.trim());
f.b(context, "shared_prefs_appId", str2.trim());
}
public static void a(Context context, String[] strArr) {
if (strArr != null) {
for (int i = 0; i < strArr.length; i++) {
g.a(3, "Sending Impression: [" + strArr[i] + "]");
b(context, strArr[i]);
}
}
}
public static void a(WebView webView, String str) {
try {
webView.loadDataWithBaseURL("http://www.startappexchange.com", str, "text/html", "utf-8", null);
} catch (Exception e) {
g.a(6, "StartAppWall.UtilError while encoding html");
}
}
public static void a(String str, String str2, String str3, Context context) {
b(context, str3);
Intent launchIntentForPackage = context.getPackageManager().getLaunchIntentForPackage(str);
if (str2 != null) {
try {
JSONObject jSONObject = new JSONObject(str2);
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String valueOf = String.valueOf(keys.next());
launchIntentForPackage.putExtra(valueOf, String.valueOf(jSONObject.get(valueOf)));
}
} catch (JSONException e) {
g.a(6, "Couldn't parse intent details json!", e);
}
}
context.startActivity(launchIntentForPackage);
}
public static void a(List<NameValueObject> list, String str, Object obj, boolean z) {
if (z && obj == null) {
throw new l("Required key: [" + str + "] is missing", null);
}
if (obj != null) {
try {
NameValueObject nameValueObject = new NameValueObject();
nameValueObject.setName(str);
nameValueObject.setValue(URLEncoder.encode(obj.toString(), "UTF-8"));
list.add(nameValueObject);
} catch (UnsupportedEncodingException e) {
if (z) {
throw new l("failed encoding value: [" + obj + "]", e);
}
}
}
}
public static void a(List<NameValueObject> list, String str, Set<String> set, boolean z) {
if (z && set == null) {
throw new l("Required key: [" + str + "] is missing", null);
}
if (set != null) {
NameValueObject nameValueObject = new NameValueObject();
nameValueObject.setName(str);
HashSet hashSet = new HashSet();
Iterator<String> it = set.iterator();
while (it.hasNext()) {
try {
hashSet.add(URLEncoder.encode(it.next(), "UTF-8"));
} catch (UnsupportedEncodingException e) {
}
}
if (z && hashSet.size() == 0) {
throw new l("failed encoding value: [" + set + "]", null);
}
nameValueObject.setValueSet(hashSet);
list.add(nameValueObject);
}
}
public static boolean a(Context context) {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
private static boolean a(String str) {
try {
Class.forName(str);
return true;
} catch (ClassNotFoundException e) {
return false;
} catch (Exception e2) {
return false;
}
}
public static int b() {
int i = -1;
try {
String property = j().getProperty("inapp.sdk.id");
if (property != null && !"".equals(property) && !"${sdk.id}".equals(-1)) {
try {
i = Integer.parseInt(property);
} catch (NumberFormatException e) {
}
}
g.a(3, "SDK ID: [" + i + "]");
} catch (Exception e2) {
g.a(3, "Could not load properties, SDK ID set to: [-1]");
}
return i;
}
public static final void b(Context context) {
g(context);
}
public static void b(final Context context, final String str) {
b.execute(new Runnable() {
@Override
public void run() {
try {
com.fusepowered.sa.android.publish.e.a.a(Context.this, str, null);
} catch (l e) {
e.printStackTrace();
}
}
});
}
public static String c() {
return "&position=" + d();
}
public static void c(Context context) {
f.b(context, "shared_prefs_simple_token", m.a(context));
}
public static void c(Context context, String str) {
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
intent.addFlags(344457216);
a(context, intent);
try {
context.startActivity(intent);
} catch (Exception e) {
g.a(6, "Cannot find activity to handle url: [" + str + "]");
}
}
public static String d() {
StackTraceElement[] stackTrace = new Throwable().getStackTrace();
for (int i = 0; i < 8; i++) {
if (stackTrace[i].getMethodName().compareTo("doHome") == 0) {
return "home";
}
if (stackTrace[i].getMethodName().compareTo("onBackPressed") == 0) {
return "back";
}
}
return "interstitial";
}
public static String d(Context context) {
StringBuffer stringBuffer = new StringBuffer();
if (MetaData.getInstance().getAdInformationConfig().e().a(context)) {
stringBuffer.append(f.a(context, "shared_prefs_simple_token", ""));
}
return stringBuffer.toString();
}
private static String e() {
return h() ? "_Unity" : i() ? "_Cordova" : f() ? "_AdMob" : g() ? "_MoPub" : "";
}
public static String e(Context context) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
ResolveInfo resolveActivity = context.getPackageManager().resolveActivity(intent, 0);
if (resolveActivity == null || resolveActivity.activityInfo == null) {
return "";
}
String str = resolveActivity.activityInfo.packageName;
return str != null ? str.toLowerCase() : str;
}
private static boolean f() {
return a("com.fusepowered.sa.android.mediation.admob.StartAppCustomEvent");
}
public static void g(Context context) {
if (context != null && (context instanceof Activity)) {
a((Activity) context, false);
}
if (f369c != null) {
synchronized (f369c) {
if (f369c != null && f369c.isShowing()) {
f369c.cancel();
f369c = null;
}
}
}
}
private static boolean g() {
return a("com.fusepowered.sa.android.mediation.mopub.StartAppCustomEventInterstitial");
}
private static boolean h() {
return a("com.apperhand.unity.wrapper.InAppWrapper");
}
private static boolean i() {
return a("org.apache.cordova.CordovaPlugin");
}
private static Properties j() {
Properties properties = new Properties();
try {
properties.load(o.class.getClassLoader().getResourceAsStream("startapp.properties"));
} catch (Exception e) {
properties.load(o.class.getClassLoader().getResourceAsStream("assets/startapp.properties"));
}
return properties;
}
}