畅玩新葡京 v8.2.8版本的 MD5 值为:1e36e0a7adef719a26e0a466b52c398d
以下内容为反编译后的 AppActivity.java 源代码,内容仅作参考
package org.cocos2dx.javascript;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.exifinterface.media.ExifInterface;
import cc.openshare.sdk.opensharesdk.OpenShare;
import cc.openshare.sdk.opensharesdk.listener.InstallListener;
import cc.openshare.sdk.opensharesdk.model.OSInstall;
import cc.openshare.sdk.opensharesdk.model.OSResponse;
import cn.jpush.android.api.JPushInterface;
import cn.net.shoot.sharetracesdk.ShareTrace;
import cn.net.shoot.sharetracesdk.ShareTraceInstallListener;
import com.alipay.sdk.app.PayTask;
import com.alipay.sdk.sys.a;
import com.alipay.sdk.util.g;
import com.fm.openinstall.OpenInstall;
import com.fm.openinstall.listener.AppInstallAdapter;
import com.fm.openinstall.model.AppData;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.common.BitMatrix;
import com.hwangjr.rxbus.Bus;
import com.hwangjr.rxbus.RxBus;
import com.lahm.library.EasyProtectorLib;
import com.lahm.library.EmulatorCheckCallback;
import com.luck.picture.lib.basic.PictureSelector;
import com.luck.picture.lib.config.PictureMimeType;
import com.luck.picture.lib.config.SelectMimeType;
import com.luck.picture.lib.entity.LocalMedia;
import com.luck.picture.lib.interfaces.OnResultCallbackListener;
import com.luck.picture.lib.permissions.PermissionConfig;
import com.lzy.okgo.cookie.SerializableCookie;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
import com.tencent.mm.opensdk.modelmsg.WXImageObject;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import com.tencent.mm.opensdk.modelmsg.WXWebpageObject;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.open.SocialConstants;
import com.tencent.smtt.sdk.TbsVideoCacheTask;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.Tencent;
import com.tencent.tauth.UiError;
import com.uuzuche.lib_zxing.activity.CodeUtils;
import com.xiongmao.security.xiongmao.android.sdk.XiongMao;
import com.yojsn1111.cocosandroid.R;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import np.C0046;
import np.NPFog;
import org.cocos2dx.javascript.UpLoadImgUtils;
import org.cocos2dx.javascript.bean.ShareBean;
import org.cocos2dx.javascript.kefu.CustomerEvent;
import org.cocos2dx.javascript.kefu.CustomerWebViewHelper;
import org.cocos2dx.javascript.utils.AppDensityUtil;
import org.cocos2dx.javascript.utils.DownListener;
import org.cocos2dx.javascript.utils.FileUtils;
import org.cocos2dx.javascript.utils.KLog;
import org.cocos2dx.javascript.utils.PictureDownUtil;
import org.cocos2dx.javascript.utils.SharedPreferencesUtils;
import org.cocos2dx.javascript.utils.SystemUtil;
import org.cocos2dx.javascript.utils.Utils;
import org.cocos2dx.javascript.views.X5WebView;
import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
import org.cocos2dx.lib.Cocos2dxHelper;
import org.cocos2dx.lib.Cocos2dxJavascriptJavaBridge;
import org.cocos2dx.lib.SoftKeyBoardListener;
import org.eclipse.paho.client.mqttv3.MqttTopic;
import org.json.JSONException;
import org.json.JSONObject;
public class AppActivity extends Cocos2dxActivity implements IUiListener {
private static final int BLACK = -16777216;
public static final String PACKAGE_QQ = "com.tencent.mobileqq";
public static final String PACKAGE_WX = "com.tencent.mm";
private static final int SDK_AUTH_FLAG = 2;
private static final int SDK_PAY_FLAG = 1;
private static final String TAG = "AppActivity";
private static final int WHITE = -1;
public static String WxShareType = "";
public static IWXAPI api = null;
private static AppActivity app = null;
static JSONObject bindDataJo = null;
private static String callbackLuaFunction = "";
public static String code = null;
private static AlertDialog mExitAppDialog = null;
private static Tencent mTencent = null;
private static final String qqAppId = "1108221663";
private static ShareBean.DataBean shareBean = null;
private static String shareQQLocalPath = null;
private static String urlOfQr = null;
public static String wxAppId = "";
private Activity appActivity;
private AlertDialog mPermissionDialog;
private byte[] screenshotData;
private static Map<String, X5WebView> webMap = new HashMap();
private static boolean isRegister = false;
private static String wakeupDataHolder = null;
static ArrayList<String> pictureArrayList = new ArrayList<>();
@SuppressLint({"HandlerLeak"})
private static Handler mHandler = new Handler() {
@Override
public void handleMessage(Message message) {
String str;
StringBuilder sb;
String str2;
if (message.what != 1) {
return;
}
PayResult payResult = new PayResult((Map) message.obj);
payResult.getResult();
String resultStatus = payResult.getResultStatus();
final String str3 = "gg.sdkManager.alipayResultBack(" + resultStatus + ")";
AppActivity.app.runOnGLThread(new Runnable() {
@Override
public void run() {
Cocos2dxJavascriptJavaBridge.evalString(str3);
}
});
if (TextUtils.equals(resultStatus, "9000")) {
str = "alipay";
sb = new StringBuilder();
str2 = "handleMessage:支付结果======= ";
} else {
str = "alipay";
sb = new StringBuilder();
str2 = "handleMessage:失败支付结果======= ";
}
sb.append(str2);
sb.append(payResult);
Log.e(str, sb.toString());
}
};
private static String jsonObjStr = "";
private static int ret = 0;
private float originY = 0.0f;
private Object lock = new Object();
private BaseUiListener mIUiListener = new BaseUiListener();
private boolean isFirst = true;
private final int mRequestCode = 100;
private String[] permissions = {"android.permission.READ_PHONE_STATE", PermissionConfig.WRITE_EXTERNAL_STORAGE};
private List<String> mPermissionList = new ArrayList();
class AnonymousClass48 {
static final int[] a = new int[BackType.values().length];
static {
try {
a[BackType.none.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[BackType.wxShareSuccessed.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[BackType.wxShareFailed.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[BackType.qqShareFailed.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[BackType.qqShareSuccessed.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
a[BackType.fileSaveFailed.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
a[BackType.fileSaveSuccessed.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
a[BackType.openQqFailed.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
a[BackType.openWxFailed.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
a[BackType.savaFileTip.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
try {
a[BackType.qqNotInstall.ordinal()] = 11;
} catch (NoSuchFieldError unused11) {
}
try {
a[BackType.wxNotInstall.ordinal()] = 12;
} catch (NoSuchFieldError unused12) {
}
try {
a[BackType.wxShareTips.ordinal()] = 13;
} catch (NoSuchFieldError unused13) {
}
}
}
public enum BackType {
none,
wxShareSuccessed,
wxShareFailed,
qqShareSuccessed,
qqShareFailed,
fileSaveSuccessed,
fileSaveFailed,
openWxFailed,
openQqFailed,
savaFileTip,
openinstallSuccess,
qqNotInstall,
wxNotInstall,
wxShareTips
}
public enum BarcodeFormat {
AZTEC,
CODABAR,
CODE_39,
CODE_93,
CODE_128,
DATA_MATRIX,
EAN_8,
EAN_13,
ITF,
MAXICODE,
PDF_417,
QR_CODE,
RSS_14,
RSS_EXPANDED,
UPC_A,
UPC_E,
UPC_EAN_EXTENSION
}
class BaseUiListener implements IUiListener {
private BaseUiListener() {
}
@Override
public void onCancel() {
Log.e("cocos", "分享取消:");
AppActivity.callJsFunction(BackType.qqShareFailed);
}
@Override
public void onComplete(Object obj) {
Log.e("cocos", "response:" + obj);
AppActivity.callJsFunction(BackType.qqShareSuccessed);
}
@Override
public void onError(UiError uiError) {
Log.e("cocos", "分享失败----》" + uiError.errorMessage);
AppActivity.callJsFunction(BackType.qqShareFailed);
}
}
public enum EncodeHintType {
ERROR_CORRECTION,
CHARACTER_SET,
MARGIN,
PDF417_COMPACT,
PDF417_COMPACTION,
PDF417_DIMENSIONS
}
public static Bitmap Base64ToBitmap(String str) {
try {
byte[] decode = Base64.decode(str.split(",")[1], 0);
return BitmapFactory.decodeByteArray(decode, 0, decode.length);
} catch (Exception e) {
Log.e("cocos", e.getMessage());
return null;
}
}
public static Bitmap CreateQRCode(String str, int i) {
Log.e("cocos", String.valueOf(380));
try {
Hashtable hashtable = new Hashtable();
hashtable.put(com.google.zxing.EncodeHintType.CHARACTER_SET, "utf-8");
hashtable.put(com.google.zxing.EncodeHintType.MARGIN, "1");
BitMatrix encode = new MultiFormatWriter().encode(str, com.google.zxing.BarcodeFormat.QR_CODE, 380, 380, hashtable);
int width = encode.getWidth();
int height = encode.getHeight();
int[] iArr = new int[width * height];
for (int i2 = 0; i2 < height; i2++) {
for (int i3 = 0; i3 < width; i3++) {
if (encode.get(i3, i2)) {
iArr[(i2 * width) + i3] = -16777216;
} else {
iArr[(i2 * width) + i3] = -1;
}
}
}
Bitmap createBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
createBitmap.setPixels(iArr, 0, width, 0, 0, width, height);
return createBitmap;
} catch (Exception unused) {
Log.e("cocos", "保存图片失败");
return null;
}
}
public static Bitmap MergeBitmap(Bitmap bitmap, Bitmap bitmap2, String str, String str2) {
Bitmap copy = bitmap.copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(copy);
Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
int width = (bitmap.getWidth() / 2) - (bitmap2.getWidth() / 2);
int height = ((bitmap.getHeight() / 2) - (bitmap2.getHeight() / 2)) - 20;
Rect rect2 = new Rect(0, 0, bitmap2.getWidth(), bitmap2.getHeight());
canvas.drawBitmap(bitmap, rect, rect, (Paint) null);
canvas.drawBitmap(bitmap2, rect2, new Rect(width, height, rect2.width() + width, rect2.height() + height), (Paint) null);
Paint paint = new Paint();
paint.setARGB(255, 255, 195, 51);
paint.setAntiAlias(true);
paint.setTextSize(70.0f);
paint.setDither(true);
canvas.drawText(str, (rect.width() / 2) - 5, (rect.height() / 2) + 286, paint);
paint.setTextSize(40.0f);
canvas.drawText(str2, 110.0f, (rect.height() / 2) + TypedValues.CycleType.TYPE_WAVE_PHASE, paint);
return copy;
}
public static void MergeBitmapBy(Bitmap bitmap, Bitmap bitmap2, Hashtable<String, String> hashtable) {
String str = hashtable.get("mergeUrl");
String str2 = hashtable.get("name");
String[] split = hashtable.get("rect").split(",");
int parseInt = Integer.parseInt(split[0]);
int parseInt2 = Integer.parseInt(split[1]);
int parseInt3 = Integer.parseInt(split[2]);
int parseInt4 = Integer.parseInt(split[3]);
String[] split2 = hashtable.get("mergeUrlRect").split(",");
int parseInt5 = Integer.parseInt(split2[0]);
int parseInt6 = Integer.parseInt(split2[1]);
Integer.parseInt(split2[2]);
Integer.parseInt(split2[3]);
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap2, parseInt3, parseInt4, true);
Bitmap copy = bitmap.copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(copy);
Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
Rect rect2 = new Rect(0, 0, createScaledBitmap.getWidth(), createScaledBitmap.getHeight());
canvas.drawBitmap(bitmap, rect, rect, (Paint) null);
canvas.drawBitmap(createScaledBitmap, rect2, new Rect(parseInt, parseInt2, rect2.width() + parseInt, rect2.height() + parseInt2), (Paint) null);
if (str != null && !str.isEmpty()) {
Paint paint = new Paint();
paint.setARGB(255, 255, 195, 51);
paint.setAntiAlias(true);
paint.setDither(true);
paint.setTextSize(40.0f);
canvas.drawText(str, parseInt5, parseInt6, paint);
}
String[] strArr = {PermissionConfig.READ_EXTERNAL_STORAGE, PermissionConfig.WRITE_EXTERNAL_STORAGE};
Log.e("cocos", "进来了0");
int checkSelfPermission = app.checkSelfPermission(PermissionConfig.WRITE_EXTERNAL_STORAGE);
Log.e("cocos", "进来了1");
if (checkSelfPermission != 0) {
app.requestPermissions(strArr, 1);
}
saveImageToGallery(app, copy, str2);
}
public static void SaveImageToGalleryByUrl(final String str, final String str2, final String str3, final String str4, final String str5, final int i, final int i2) {
try {
String[] strArr = {PermissionConfig.READ_EXTERNAL_STORAGE, PermissionConfig.WRITE_EXTERNAL_STORAGE};
Log.e("cocos", "进来了0");
int checkSelfPermission = app.checkSelfPermission(PermissionConfig.WRITE_EXTERNAL_STORAGE);
Log.e("cocos", "进来了1");
if (checkSelfPermission != 0) {
app.requestPermissions(strArr, 1);
}
app.runOnUiThread(new Runnable() {
@Override
public void run() {
Bitmap CreateQRCode = AppActivity.CreateQRCode(str2, i);
Log.e("cocos", "生成二维码");
if (CreateQRCode == null) {
AppActivity unused = AppActivity.app;
AppActivity.callJsFunction(BackType.fileSaveFailed);
Log.e("cocos", "保存失败");
return;
}
Log.e("cocos", "保存来了");
if (i2 == 1) {
CreateQRCode = AppActivity.MergeBitmap(AppActivity.getBitmapByPath(str), CreateQRCode, str4, str5);
}
AppActivity.saveImageToGallery(AppActivity.app, CreateQRCode, str3);
}
});
} catch (Exception unused) {
}
}
public static void SavePicToLocal(String str) {
app.SavePicToLocalReal(str);
}
public static void X5WebViewLoadHtml(final String str, final String str2) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
X5WebView x5WebView = (X5WebView) AppActivity.webMap.get(str);
if (x5WebView != null) {
x5WebView.loadDataWithBaseURL("", str2, "text/html", "uff-8", null);
}
}
});
}
public static void X5WebViewloadUrl(final String str, final String str2) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
X5WebView x5WebView = (X5WebView) AppActivity.webMap.get(str);
if (x5WebView != null) {
x5WebView.loadUrl(str2);
}
}
});
}
public static void aliPay(final String str) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
new Thread(new Runnable() {
@Override
public void run() {
Map<String, String> payV2 = new PayTask(AppActivity.app).payV2(str, true);
Log.e("首次alipay支付结果", payV2.toString());
Message message = new Message();
message.what = 1;
message.obj = payV2;
AppActivity.mHandler.sendMessage(message);
}
}).start();
}
});
}
private static byte[] buildWXReqBitmap(android.graphics.Bitmap r11) {
throw new UnsupportedOperationException("Method not decompiled: org.cocos2dx.javascript.AppActivity.buildWXReqBitmap(android.graphics.Bitmap):byte[]");
}
private static String buildWXReqTrans(String str) {
if (str == null) {
return String.valueOf(System.currentTimeMillis());
}
return String.valueOf(str) + System.currentTimeMillis();
}
public static void callJsFunction(final BackType backType) {
Log.e("cocos", "Enter the callJsFunction");
app.runOnGLThread(new Runnable() {
@Override
public void run() {
String str = "gg.sdkManager.handlerCallBack()";
switch (AnonymousClass48.a[BackType.this.ordinal()]) {
case 2:
str = "gg.sdkManager.wxShareSuccessedCallBack()";
break;
case 3:
str = "gg.sdkManager.wxShareFailedCallBack()";
break;
case 4:
str = "gg.sdkManager.qqShareFailedCallBack()";
break;
case 5:
str = "gg.sdkManager.qqShareSuccessedCallBack()";
break;
case 6:
str = "gg.sdkManager.fileSaveFailedCallBack()";
break;
case 7:
str = "gg.sdkManager.fileSaveSuccessedCallBack()";
break;
case 8:
str = "gg.sdkManager.openQqFailedCallBack()";
break;
case 9:
str = "gg.sdkManager.openWxFailedCallBack()";
break;
case 10:
str = "gg.sdkManager.savaFileTipCallBack()";
break;
case 11:
str = "gg.sdkManager.qqNotInstall()";
break;
case 12:
str = "gg.sdkManager.weixinNotInstall()";
break;
case 13:
str = "gg.sdkManager.wxShareTips()";
break;
}
Log.e("cocos", "enter runOnGLThread");
Log.e("cocos", str);
Cocos2dxJavascriptJavaBridge.evalString(str);
}
});
}
public static boolean checkApp(String str) {
try {
return getContext().getPackageManager().getPackageInfo(str, 0) != null;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return false;
}
}
public static void choosePhotos(final String str, final String str2, final String str3, final String str4) {
pictureArrayList.clear();
app.runOnGLThread(new Runnable() {
@Override
public void run() {
try {
PictureSelector.create(Cocos2dxActivity.getContext()).openGallery(SelectMimeType.ofImage()).setImageEngine(GlideEngine.createGlideEngine()).setImageSpanCount(3).setMaxSelectNum(Integer.parseInt(str2)).forResult(new OnResultCallbackListener<LocalMedia>() {
@Override
public void onCancel() {
}
@Override
public void onResult(final ArrayList<LocalMedia> arrayList) {
if (arrayList == null || arrayList.size() == 0) {
return;
}
Log.e("uploadimag", "run: uploadImgeJson===============" + arrayList.size());
for (int i = 0; i < arrayList.size(); i++) {
LocalMedia localMedia = arrayList.get(i);
String realPath = localMedia.getRealPath();
Log.e("uploadimag", "onAction: 获取的路径是============" + localMedia.getPath());
UpLoadImgUtils.photosImageUpLoad(realPath, str, str3, str4, TbsVideoCacheTask.KEY_VIDEO_CACHE_PARAM_FILENAME, AppActivity.app, new UpLoadImgUtils.MyCallBack() {
@Override
public void Fail(String str5) {
AppActivity.app.runOnGLThread(new Runnable() {
@Override
public void run() {
}
});
}
@Override
public void Success(final String str5) {
AppActivity.app.runOnGLThread(new Runnable() {
@Override
public void run() {
ArrayList<String> arrayList2;
String str6;
try {
if (str5.isEmpty()) {
arrayList2 = AppActivity.pictureArrayList;
str6 = "";
} else {
JSONObject jSONObject = new JSONObject(str5);
if (jSONObject.optInt("status") == 1) {
AppActivity.pictureArrayList.add(jSONObject.optString("data"));
Log.e("uploadImgeJson", "uploadImgeJson============ 000000" + AppActivity.pictureArrayList);
if (AppActivity.pictureArrayList.size() == arrayList.size()) {
ArrayList arrayList3 = new ArrayList();
for (int i2 = 0; i2 < AppActivity.pictureArrayList.size(); i2++) {
String str7 = AppActivity.pictureArrayList.get(i2);
if (!str7.isEmpty()) {
arrayList3.add(str7);
}
}
if (arrayList3.size() == 0) {
Log.e("uploadimag", "uploadImgeJson============ 上传图片失败");
AppActivity.app.runOnGLThread(new Runnable() {
@Override
public void run() {
Log.e("uploadimag", "run: uploadImgeJson===============selectedPhotoFail('faile')");
Cocos2dxJavascriptJavaBridge.evalString("selectedPhotoFail('faile')");
}
});
return;
}
Log.e("uploadimag", "uploadImgeJson============ 11111" + arrayList3);
final String join = TextUtils.join(",", arrayList3);
Log.e("uploadimag", "onAction: 获取的路径是============ 11111" + join);
AppActivity.app.runOnGLThread(new Runnable() {
@Override
public void run() {
String str8 = "selectedPhoto('" + join + "')";
Log.e("uploadimag", "run: uploadImgeJson===============" + str8);
Cocos2dxJavascriptJavaBridge.evalString(str8);
}
});
}
Log.e("uploadimag", "===============" + AppActivity.pictureArrayList);
}
arrayList2 = AppActivity.pictureArrayList;
str6 = "";
}
arrayList2.add(str6);
Log.e("uploadImgeJson", "uploadImgeJson============ 000000" + AppActivity.pictureArrayList);
if (AppActivity.pictureArrayList.size() == arrayList.size()) {
}
Log.e("uploadimag", "===============" + AppActivity.pictureArrayList);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
});
}
}
});
} catch (Exception e) {
Log.e("cocos", e.getMessage());
}
}
});
StringBuilder sb = new StringBuilder();
sb.append("onAction: 获取的路径是============");
AppActivity appActivity = app;
sb.append(pictureArrayList);
Log.e("uploadImgeJson", sb.toString());
}
public static void createCustomerWebView(final String str, final float f, final float f2, final float f3, final float f4) {
Log.i(TAG, "createCustomerWebView: ");
app.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
CustomerWebViewHelper.getInstance().createCustomer(AppActivity.app, str, f4, f3, f, f2);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public static void createX5WebView(final String str, final float f, final float f2, final float f3, final float f4) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
X5WebView x5WebView = new X5WebView(AppActivity.app, null);
x5WebView.setVerticalScrollBarEnabled(false);
x5WebView.setHorizontalScrollBarEnabled(false);
FrameLayout frameLayout = new FrameLayout(AppActivity.app);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
layoutParams.leftMargin = (int) f;
layoutParams.topMargin = (int) f2;
layoutParams.width = (int) f3;
layoutParams.height = (int) f4;
frameLayout.addView(x5WebView);
AppActivity.app.addContentView(frameLayout, layoutParams);
AppActivity.webMap.put(str, x5WebView);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
private static int currentInstallPlatfromType() {
try {
if (String.valueOf(app.getPackageManager().getApplicationInfo(app.getPackageName(), 128).metaData.get("com.openinstall.APP_KEY")).equals(Bus.DEFAULT_IDENTIFIER)) {
return !String.valueOf(app.getPackageManager().getApplicationInfo(app.getPackageName(), 128).metaData.get("com.OpenShareInstall.APP_KEY")).equals(Bus.DEFAULT_IDENTIFIER) ? 2 : 1;
}
return 1;
} catch (Exception unused) {
return 1;
}
}
public static void destoryCustomerWebview() {
Log.i(TAG, "destoryCustomerWebviewIsShow:");
app.runOnUiThread(new Runnable() {
@Override
public void run() {
CustomerWebViewHelper.getInstance().destoryCustomerWebview();
}
});
}
public static void destroyX5WebView(final String str) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
X5WebView x5WebView = (X5WebView) AppActivity.webMap.get(str);
if (x5WebView != null) {
x5WebView.destroy();
AppActivity.webMap.remove(str);
}
}
});
}
public static void easeProtect() {
if (EasyProtectorLib.checkIsRunningInEmulator(app, new EmulatorCheckCallback() {
@Override
public void findEmulator(String str) {
}
})) {
AlertDialog create = new AlertDialog.Builder(app).create();
create.setTitle("检查到您的设备违规,将限制您的所有功能使用!");
create.setButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
AppActivity.app.finish();
}
});
create.setButton2("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
AppActivity.app.finish();
}
});
create.setCanceledOnTouchOutside(false);
create.show();
}
}
public static void forceHV(final String str) {
app.runOnGLThread(new Runnable() {
@Override
@SuppressLint({"SourceLockedOrientationActivity"})
public void run() {
AppActivity appActivity;
int i;
if ("H".equals(str)) {
appActivity = AppActivity.app;
i = 0;
} else {
appActivity = AppActivity.app;
i = 1;
}
appActivity.setRequestedOrientation(i);
}
});
}
public static android.graphics.Bitmap getBitmapByPath(java.lang.String r7) {
throw new UnsupportedOperationException("Method not decompiled: org.cocos2dx.javascript.AppActivity.getBitmapByPath(java.lang.String):android.graphics.Bitmap");
}
public static String getBrand() {
return SystemUtil.getDeviceBrand();
}
private static String getBucketIndex(String str) {
return SharedPreferencesUtils.getString(app, "bucket", "1");
}
public static synchronized String getBundleID() {
String str;
synchronized (AppActivity.class) {
try {
str = app.getPackageManager().getPackageInfo(app.getPackageName(), 0).packageName;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
return str;
}
public static String getInstall(String str) {
String str2 = "";
String str3 = "";
if (str != null) {
str2 = readValueFromUrlStrByParamName(str, "shareName");
str3 = readValueFromUrlStrByParamName(str, "proxyAccount");
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("shareName", str2);
jSONObject.put("proxyAccount", str3);
KLog.e("shareTracejson====" + jSONObject.toString());
return jSONObject.toString();
} catch (Exception unused) {
return "";
}
}
public static void getOpeninstall() {
Log.e("getOpeninstall", "getOpeninstall 调用开始");
try {
int currentInstallPlatfromType = currentInstallPlatfromType();
if (currentInstallPlatfromType == 1) {
useOpenInstall();
Log.e("getOpeninstall", "getOpeninstall使用: openinstall");
}
if (currentInstallPlatfromType == 2) {
useNewOpenShare_method1();
Log.e("getOpeninstall", "getOpeninstall使用: openshare");
}
} catch (Exception e) {
e.printStackTrace();
Log.e("getOpeninstall", "getOpeninstall 调用出错");
}
}
public static String getStatusBarHeight() {
int identifier;
if (app != null && (identifier = app.getResources().getIdentifier("status_bar_height", "dimen", "android")) > 0) {
return app.getResources().getDimensionPixelSize(identifier) + "";
}
return "0";
}
public static String getSystemVersion() {
return SystemUtil.getSystemVersion();
}
public static String getUUID() {
TelephonyManager telephonyManager;
String deviceId;
String str = "";
try {
try {
telephonyManager = (TelephonyManager) getContext().getSystemService("phone");
deviceId = telephonyManager.getDeviceId();
} catch (Throwable unused) {
}
} catch (Exception e) {
e = e;
}
try {
if (TextUtils.isEmpty(deviceId)) {
String subscriberId = telephonyManager.getSubscriberId();
deviceId = TextUtils.isEmpty(subscriberId) ? UUID.randomUUID().toString() : subscriberId;
}
return TextUtils.isEmpty(deviceId) ? "" : deviceId;
} catch (Exception e2) {
e = e2;
e.printStackTrace();
String uuid = UUID.randomUUID().toString();
return TextUtils.isEmpty(uuid) ? "" : uuid;
} catch (Throwable unused2) {
str = deviceId;
return TextUtils.isEmpty(str) ? "" : str;
}
}
public static String getVersionCode() {
try {
PackageInfo packageInfo = app.getPackageManager().getPackageInfo(app.getPackageName(), 0);
return packageInfo.versionCode + "";
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return "1";
}
}
public static String getVersionName() {
try {
return app.getPackageManager().getPackageInfo(app.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return null;
}
}
private android.graphics.Bitmap getWXShareScreenshot(java.lang.String r11) {
throw new UnsupportedOperationException("Method not decompiled: org.cocos2dx.javascript.AppActivity.getWXShareScreenshot(java.lang.String):android.graphics.Bitmap");
}
public static void gotoNativeWebviewGame(String str, String str2, String str3, String str4, String str5, String str6) {
app.goNativeWebviewGame("gg.utils.webViewCallBackHander()", str, str2.equals("1"), str3, str4, str5, str6);
}
public static void gotoNativeWebviewGameWithUPay(String str, String str2, String str3, String str4, String str5, String str6, String str7) {
app.goNativeWebviewGameWithUPay("gg.utils.webViewCallBackHander()", str, str2.equals("1"), str3, str4, str5, str6, str7);
}
public static void hideX5WebView(final String str) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
X5WebView x5WebView = (X5WebView) AppActivity.webMap.get(str);
if (x5WebView != null) {
((ViewGroup) x5WebView.getParent()).setVisibility(8);
}
}
});
}
private void initJPush() {
Log.i(TAG, "initJPush: 初始化");
JPushInterface.setDebugMode(true);
JPushInterface.init(this);
}
public static void initWXappId(String str) {
wxAppId = str;
Log.i("data", str);
if (str != null) {
WXEntryActivity.getAppId(str);
}
}
public static boolean isAliPayInstalled() {
return new Intent("android.intent.action.VIEW", Uri.parse("alipays://platformapi/startApp")).resolveActivity(app.getPackageManager()) != null;
}
private static boolean isFeatures() {
return Build.FINGERPRINT.startsWith("generic") || Build.FINGERPRINT.toLowerCase().contains("vbox") || Build.FINGERPRINT.toLowerCase().contains("test-keys") || Build.MODEL.contains("google_sdk") || Build.MODEL.contains("Emulator") || Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion") || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")) || "google_sdk".equals(Build.PRODUCT);
}
public static boolean isInstallQQ() {
PackageInfo packageInfo;
try {
packageInfo = getContext().getPackageManager().getPackageInfo("com.tencent.mobileqq", 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
packageInfo = null;
}
return packageInfo != null;
}
public static boolean isInstallWX() {
PackageInfo packageInfo;
System.out.print("chackWeiXin");
try {
packageInfo = getContext().getPackageManager().getPackageInfo("com.tencent.mm", 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
packageInfo = null;
}
return packageInfo != null;
}
public static void jsPrint(String str) {
Log.e("cocos", str);
}
public static boolean lunchApp(String str, String str2) {
if (checkApp(str)) {
Intent intent = new Intent("android.intent.action.MAIN");
ComponentName componentName = new ComponentName(str, str2);
intent.addCategory("android.intent.category.LAUNCHER");
intent.addFlags(268435456);
intent.setComponent(componentName);
getContext().startActivity(intent);
return true;
}
return false;
}
public static boolean lunchVX() {
if (isInstallWX()) {
Intent intent = new Intent("android.intent.action.MAIN");
ComponentName componentName = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
intent.addCategory("android.intent.category.LAUNCHER");
intent.addFlags(268435456);
intent.setComponent(componentName);
getContext().startActivity(intent);
return true;
}
return false;
}
public static Bitmap mergeBitmap(Bitmap bitmap) {
Log.e("BITMAP", urlOfQr);
Bitmap createImage = CodeUtils.createImage(urlOfQr, 500, 500, null);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int i = width / 4;
int i2 = height - ((i - 10) * 2);
Bitmap sfBitmap = sfBitmap(createImage, i, i);
Bitmap createBitmap = Bitmap.createBitmap(width, height, bitmap.getConfig());
Canvas canvas = new Canvas(createBitmap);
canvas.drawBitmap(bitmap, new Matrix(), null);
canvas.drawBitmap(sfBitmap, ((width / 2) - (i / 2)) - 3, i2, (Paint) null);
return createBitmap;
}
public static Bitmap mergeBitmap3(Bitmap bitmap, String str, String str2) {
float measureText;
float dip2px = AppDensityUtil.dip2px(getContext(), 44.0f);
float dip2px2 = AppDensityUtil.dip2px(getContext(), 33.0f);
float dip2px3 = AppDensityUtil.dip2px(getContext(), 33.0f);
String str3 = TextUtils.isEmpty(str2) ? "暂无" : str2;
Paint paint = new Paint();
paint.setTextSize(dip2px);
paint.setColor(app.getResources().getColor(NPFog.d(2131035281)));
Bitmap createImage = CodeUtils.createImage(urlOfQr, 500, 500, null);
Bitmap decodeResource = BitmapFactory.decodeResource(app.getResources(), R.drawable.share_qr_bj2);
Bitmap decodeResource2 = BitmapFactory.decodeResource(app.getResources(), R.drawable.share_qr_bj3);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Log.e("mergeBitmap2: width==", width + "");
Log.e("mergeBitmap2: height==", height + "");
int i = width / 2;
int i2 = (i / 2) + i + (height / 25) + (height / 20);
int height2 = (decodeResource2.getHeight() - decodeResource.getHeight()) / 2;
int width2 = (width - decodeResource2.getWidth()) / 2;
paint.measureText(str);
decodeResource.getWidth();
decodeResource.getWidth();
decodeResource.getWidth();
AppDensityUtil.dip2px(getContext(), 8.0f);
Paint.FontMetrics fontMetrics = paint.getFontMetrics();
int i3 = (int) (fontMetrics.descent - fontMetrics.ascent);
int height3 = decodeResource2.getHeight() / 2;
float f = fontMetrics.descent;
int i4 = i3 / 2;
Bitmap sfBitmap = sfBitmap(createImage, i, i);
Bitmap createBitmap = Bitmap.createBitmap(width, height, bitmap.getConfig());
Canvas canvas = new Canvas(createBitmap);
canvas.drawBitmap(bitmap, new Matrix(), null);
canvas.drawBitmap(sfBitmap, (width - i) / 2, (i * 3) / 4, (Paint) null);
if (!TextUtils.isEmpty(str)) {
canvas.drawText(str, (width * 3) / 7, (height * 123) / 160, paint);
}
paint.setTextSize(dip2px2);
paint.setColor(app.getResources().getColor(NPFog.d(2131035495)));
Paint.FontMetrics fontMetrics2 = paint.getFontMetrics();
int i5 = (int) (fontMetrics2.descent - fontMetrics2.ascent);
if (TextUtils.equals(str3, "暂无")) {
measureText = paint.measureText("暂无");
} else {
measureText = paint.measureText("");
}
int i6 = (int) measureText;
int i7 = i6 < width ? (width - i6) / 2 : 0;
int height4 = i2 + decodeResource2.getHeight() + AppDensityUtil.dip2px(getContext(), 15.0f);
float f2 = (height * 11) / 12;
canvas.drawText("", width / 10, f2, paint);
if (TextUtils.equals(str3, "暂无")) {
paint.setTextSize(dip2px2);
paint.setColor(app.getResources().getColor(NPFog.d(2131035281)));
int measureText2 = ((int) paint.measureText("")) + i7;
if (measureText2 >= width) {
measureText2 = 0;
}
Log.e(TAG, "mergeBitmap3: officialX====" + measureText2 + "officialY======" + height4);
} else {
paint.setTextSize(dip2px3);
paint.setColor(app.getResources().getColor(NPFog.d(2131035281)));
Log.e(TAG, "mergeBitmap3: officialX====" + i7 + "officialY======" + (height4 + i5 + AppDensityUtil.dip2px(getContext(), 2.0f)));
}
canvas.drawText(str3, (width * 1) / 10, f2, paint);
return createBitmap;
}
public static void openPhotoWithId(final String str, final String str2, final String str3) {
PictureSelector.create(getContext()).openGallery(SelectMimeType.ofImage()).setImageEngine(GlideEngine.createGlideEngine()).setImageSpanCount(2).setMaxSelectNum(1).forResult(new OnResultCallbackListener<LocalMedia>() {
@Override
public void onCancel() {
}
@Override
public void onResult(ArrayList<LocalMedia> arrayList) {
if (arrayList == null || arrayList.size() == 0) {
return;
}
UpLoadImgUtils.imageUpLoad(arrayList.get(0).getRealPath(), str2, str, str3, TbsVideoCacheTask.KEY_VIDEO_CACHE_PARAM_FILENAME, AppActivity.app, new UpLoadImgUtils.MyCallBack() {
@Override
public void Fail(final String str4) {
AppActivity.app.runOnGLThread(new Runnable() {
@Override
public void run() {
Cocos2dxJavascriptJavaBridge.evalString("chatSendImgCb('" + str4 + "')");
}
});
}
@Override
public void Success(final String str4) {
AppActivity.app.runOnGLThread(new Runnable() {
@Override
public void run() {
String str5 = "chatSendImgCb('" + str4 + "')";
Log.e("uploadImgeJson", "run: uploadImgeJson===============" + str5);
Cocos2dxJavascriptJavaBridge.evalString(str5);
}
});
}
});
}
});
}
public static void openshareInstallback(String str, String str2) {
String string = app.getString(NPFog.d(2131690935));
String string2 = app.getString(NPFog.d(2131690855));
if (!Bus.DEFAULT_IDENTIFIER.equals(string) || !Bus.DEFAULT_IDENTIFIER.equals(string2)) {
str = Bus.DEFAULT_IDENTIFIER.equals(string) ? "" : string;
str2 = Bus.DEFAULT_IDENTIFIER.equals(string2) ? "" : string2;
}
try {
final JSONObject jSONObject = new JSONObject();
jSONObject.put("shareName", str + "");
jSONObject.put("proxyAccount", str2 + "");
app.runOnGLThread(new Runnable() {
@Override
public void run() {
String str3 = "gg.sdkManager.openinstallSuccessBack('" + jSONObject.toString() + "')";
Log.e("openInstall", "run: openinstalldata===============" + str3);
Cocos2dxJavascriptJavaBridge.evalString(str3);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
public static void qqService(final String str) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
AppActivity appActivity;
String str2;
boolean isInstallQQ = AppActivity.isInstallQQ();
if (TextUtils.isEmpty(str)) {
appActivity = AppActivity.app;
str2 = "qq号为空";
} else if (isInstallQQ) {
AppActivity.app.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin=" + str)));
return;
} else {
appActivity = AppActivity.app;
str2 = "请先安装QQ";
}
Toast.makeText(appActivity, str2, 0).show();
}
});
}
public static void qqShare() {
Bundle bundle = new Bundle();
bundle.putInt("req_type", 5);
bundle.putString("title", shareBean.getTitle());
bundle.putString("summary", shareBean.getContent());
bundle.putString("imageLocalUrl", shareQQLocalPath);
mTencent.shareToQQ(app, bundle, app);
}
public static void quitXJTYSDK() {
KLog.e("退出loginUrl");
}
private static String readValueFromUrlStrByParamName(String str, String str2) {
String[] split;
if (str == null || str.length() <= 0) {
return "";
}
int indexOf = str.indexOf("?");
if (indexOf >= 0) {
str = str.substring(indexOf + 1);
}
String str3 = str2 + "=";
for (String str4 : str.split(a.b)) {
if (str4.indexOf(str3) == 0) {
return str4.substring(str3.length());
}
}
return "";
}
public static void requestCode() {
SendAuth.Req req = new SendAuth.Req();
req.scope = "snsapi_userinfo";
req.state = "wechat_sdk_demo_test";
PrintStream printStream = System.out;
printStream.println("req is " + req);
api.sendReq(req);
Log.e("cocos", "发送请求完毕");
Log.e("cocos", "In AppActivity api is" + api);
}
public static String savaPicToAppPath(String str, Bitmap bitmap) {
FileOutputStream fileOutputStream;
String str2 = "/data/user/0/org.cocos2d.helloworld/files/" + str;
FileOutputStream fileOutputStream2 = null;
try {
try {
File file = new File(str2);
if (file.exists()) {
file.delete();
}
fileOutputStream = new FileOutputStream(file.toString());
} catch (Exception e) {
e = e;
}
} catch (Throwable unused) {
}
try {
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fileOutputStream);
try {
fileOutputStream.close();
} catch (IOException e2) {
e2.printStackTrace();
}
return str2;
} catch (Exception e3) {
e = e3;
fileOutputStream2 = fileOutputStream;
e.getStackTrace();
if (fileOutputStream2 != null) {
try {
fileOutputStream2.close();
} catch (IOException e4) {
e4.printStackTrace();
}
}
return str2;
} catch (Throwable unused2) {
fileOutputStream2 = fileOutputStream;
if (fileOutputStream2 != null) {
try {
fileOutputStream2.close();
} catch (IOException e5) {
e5.printStackTrace();
}
}
return str2;
}
}
public static void saveAgentPicToLocal(String str) {
Hashtable hashtable = new Hashtable();
for (String str2 : str.split("\\|")) {
String[] split = str2.split("\\+");
if (split.length == 2) {
hashtable.put(split[0], split[1]);
}
}
SaveImageToGalleryByUrl((String) hashtable.get("bgFile"), (String) hashtable.get("qrData"), "picShare", (String) hashtable.get("qrContentId"), (String) hashtable.get("qrcontentUrl"), Integer.parseInt((String) hashtable.get("qrSize")), 1);
}
public static void saveBitmapToMediaStore(Context context, Bitmap bitmap) {
String str = System.currentTimeMillis() + "wei_xin.jpg";
try {
String str2 = Environment.getExternalStorageDirectory() + "/zupubao/";
File file = new File(str2);
if (!file.exists()) {
file.mkdirs();
}
File file2 = new File(str2, str);
FileOutputStream fileOutputStream = new FileOutputStream(file2);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
Log.e("saveBitMap", "saveBitmap: 图片保存到" + Environment.getExternalStorageDirectory() + "/zupubao/" + str);
fileOutputStream.flush();
fileOutputStream.close();
MediaStore.Images.Media.insertImage(context.getContentResolver(), file2.getAbsolutePath(), str, (String) null);
context.sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(file2)));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
}
}
public static void saveDomain(String str) {
jsonObjStr = str;
}
public static void saveImageToGallery(Context context, Bitmap bitmap, String str) {
FileOutputStream fileOutputStream;
File file;
?? r0 = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DCIM + File.separator + PictureMimeType.CAMERA + File.separator;
FileOutputStream fileOutputStream2 = null;
try {
try {
try {
try {
file = new File((String) r0, str + PictureMimeType.JPG);
try {
str = file.toString();
try {
fileOutputStream = new FileOutputStream(str);
} catch (Exception e) {
e = e;
fileOutputStream = null;
}
} catch (Exception e2) {
e = e2;
str = null;
fileOutputStream = null;
}
} catch (Throwable th) {
th = th;
if (fileOutputStream2 != null) {
try {
fileOutputStream2.close();
} catch (IOException e3) {
e3.printStackTrace();
}
}
throw th;
}
} catch (IOException e4) {
e4.printStackTrace();
}
try {
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
fileOutputStream.close();
} catch (Exception e5) {
e = e5;
e.getStackTrace();
if (fileOutputStream != null) {
fileOutputStream.close();
}
r0 = context.getContentResolver();
MediaStore.Images.Media.insertImage((ContentResolver) r0, (Bitmap) bitmap, str, (String) null);
Intent intent = new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE");
intent.setData(Uri.fromFile(file));
context.sendBroadcast(intent);
Log.e("cocos", "图片保存成功---->" + file);
callJsFunction(BackType.fileSaveSuccessed);
}
} catch (Exception e6) {
e = e6;
str = null;
fileOutputStream = null;
file = null;
}
try {
r0 = context.getContentResolver();
MediaStore.Images.Media.insertImage((ContentResolver) r0, (Bitmap) bitmap, str, (String) null);
Intent intent2 = new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE");
intent2.setData(Uri.fromFile(file));
context.sendBroadcast(intent2);
Log.e("cocos", "图片保存成功---->" + file);
callJsFunction(BackType.fileSaveSuccessed);
} catch (Exception e7) {
e7.printStackTrace();
Log.e("cocos", "图片保存失败");
callJsFunction(BackType.fileSaveFailed);
}
} catch (Throwable th2) {
th = th2;
fileOutputStream2 = r0;
}
}
public static void saveQrCodeToPhoto(String str, final String str2, final String str3) {
Log.i(TAG, "保存二维码方法触发: " + str + "," + str2 + "," + str3);
if (TextUtils.isEmpty(str) || TextUtils.isEmpty("office_url") || TextUtils.isEmpty(str3)) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(AppActivity.app, "二维码保存失败", 0).show();
}
});
return;
}
urlOfQr = str;
Log.i(TAG, "savaPicture: " + str);
app.runOnUiThread(new Runnable() {
@Override
public void run() {
Utils.saveBitmapToMediaStore(Cocos2dxActivity.getContext(), AppActivity.mergeBitmap3(BitmapFactory.decodeResource(AppActivity.app.getResources(), R.drawable.share_qr_bg1), str3, str2));
Toast.makeText(AppActivity.app, "图片已保存相册", 0).show();
}
});
}
public static void saveToLocalByBase64(String str, String str2, String str3, String str4) {
Bitmap Base64ToBitmap = Base64ToBitmap(str);
Bitmap Base64ToBitmap2 = Base64ToBitmap(str2);
if (Base64ToBitmap == null || str2 == null) {
Log.e("cocos", "bg or front param is error pealse check it");
return;
}
String[] split = str3.split(",");
if (split.length != 4) {
Log.e("cocos", "rect param is error pealse check it -->" + str3);
return;
}
int parseInt = Integer.parseInt(split[0]);
int parseInt2 = Integer.parseInt(split[1]);
int parseInt3 = Integer.parseInt(split[2]);
int parseInt4 = Integer.parseInt(split[3]);
Bitmap copy = Base64ToBitmap.copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(copy);
Rect rect = new Rect(0, 0, Base64ToBitmap.getWidth(), Base64ToBitmap.getHeight());
Rect rect2 = new Rect(parseInt, parseInt2, parseInt3, parseInt4);
Rect rect3 = new Rect(0, 0, Base64ToBitmap2.getWidth(), Base64ToBitmap2.getHeight());
canvas.drawBitmap(Base64ToBitmap, rect, rect, (Paint) null);
canvas.drawBitmap(Base64ToBitmap2, rect3, rect2, (Paint) null);
saveImageToGallery(app, copy, str4);
}
public static void saveToLocalByQrUrl(final String str) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
Hashtable hashtable = new Hashtable();
for (String str2 : str.split("\\|")) {
String[] split = str2.split("\\(");
if (split.length == 2) {
hashtable.put(split[0], split[1]);
}
}
PictureDownUtil.donwloadImg(AppActivity.app, (String) hashtable.get("qrUrl"), AppActivity.Base64ToBitmap((String) hashtable.get("bgType")), hashtable, new DownListener() {
@Override
public void OnListener(Bitmap bitmap, Bitmap bitmap2, Hashtable<String, String> hashtable2) {
Log.e("cocos", "bao------------");
AppActivity.MergeBitmapBy(bitmap, bitmap2, hashtable2);
}
});
}
});
}
public static void savewxqrimg(final String str) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
AppActivity appActivity;
String str2;
Log.i(AppActivity.TAG, "savewxqrimg: " + str);
Log.i("------savewxqrimg----", str.toString());
if (TextUtils.isEmpty(str)) {
return;
}
Log.i(AppActivity.TAG, "savewxqrimg: " + str);
Bitmap decodeFile = BitmapFactory.decodeFile(str);
if (decodeFile != null) {
Utils.saveBitmapToMediaStore(Cocos2dxActivity.getContext(), decodeFile);
appActivity = AppActivity.app;
str2 = "图片已保存相册";
} else {
appActivity = AppActivity.app;
str2 = "图片保存失败";
}
Toast.makeText(appActivity, str2, 0).show();
}
});
}
public static void selectedPhotoWithParams(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
try {
JSONObject jSONObject = new JSONObject(str);
String optString = jSONObject.optString("upLoadURL");
String optString2 = jSONObject.optString("maxSize");
String optString3 = jSONObject.optString("maxCount");
String optString4 = jSONObject.optString("hallToken");
Log.e("test", "loopUrl==" + optString);
Log.e("test", "maxSize==" + optString2);
Log.e("test", "maxCount==" + optString3);
Log.e("test", "token==" + optString4);
if (TextUtils.isEmpty(optString)) {
Toast.makeText(app, "loopUrl为空", 1);
} else {
choosePhotos(optString, optString3, optString2, optString4);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void sendMsgToFriend(final String str, final String str2) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
Log.i("-----data----data---", str);
Log.i("-----wxshareurl------", str2);
if (str == null || str2 == null) {
Toast.makeText(AppActivity.app, "分享失败", 0).show();
} else {
WXEntryActivity.start(AppActivity.app, str, str2, 1);
}
} catch (Exception e) {
AppActivity.callJsFunction(BackType.wxShareFailed);
Log.i("微信分享", e.getMessage());
}
}
});
}
public static void sendMsgToTimeLine(final String str, final String str2) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
Log.i("data---", str);
Log.i("data---", str2);
if (str == null || str2 == null) {
Toast.makeText(AppActivity.app, "-------data为空----", 0).show();
} else {
WXEntryActivity.start(AppActivity.app, str, str2, 2);
}
} catch (Exception e) {
AppActivity.callJsFunction(BackType.wxShareFailed);
Log.i("微信朋友圈分享", e.getMessage());
}
}
});
}
public static void sendMsgToWx(String str, String str2, String str3) {
if (!isInstallWX()) {
callJsFunction(BackType.wxNotInstall);
return;
}
shareBean = Utils.parseJSONWithJSONObject(str);
WxShareType = str3;
if ("0".equals(str2)) {
sendMsgToFriend(str, shareBean.getShareUrl());
} else {
sendMsgToTimeLine(str, shareBean.getShareUrl());
}
}
public static void sendQQ(final String str) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
AppActivity unused = AppActivity.app;
if (!AppActivity.mTencent.isQQInstalled(AppActivity.app)) {
AppActivity.callJsFunction(BackType.qqNotInstall);
return;
}
try {
Log.i("-----3------", str);
if (str != null) {
ShareBean.DataBean unused2 = AppActivity.shareBean = Utils.parseJSONWithJSONObject(str);
Log.e("QQ分享shareBean:", "嘿嘿" + AppActivity.shareBean);
String unused3 = AppActivity.urlOfQr = AppActivity.shareBean.getShareUrl();
Log.i(AppActivity.TAG, "urlOfQr: " + AppActivity.urlOfQr);
if (AppActivity.shareBean.getShare() != null) {
Utils.compressImageUrlResultBitmap(AppActivity.app, AppActivity.shareBean.getShare(), new BaseCallBack() {
@Override
public void onFail(int i, String str2) {
}
@Override
public void onSuccess(Object obj, String str2) {
String unused4 = AppActivity.shareQQLocalPath = FileUtils.saveImageToGallery(AppActivity.mergeBitmap((Bitmap) obj));
Log.i(AppActivity.TAG, "shareQQLocalPath: " + AppActivity.shareQQLocalPath);
AppActivity.callJsFunction(BackType.qqShareSuccessed);
AppActivity.app.runOnGLThread(new Runnable() {
@Override
public void run() {
AppActivity.qqShare();
}
});
}
});
}
} else {
Toast.makeText(AppActivity.app, "分享失败", 0).show();
}
} catch (Exception e) {
Log.i("qq分享", e.getMessage());
}
}
});
}
private void setActivityResultListener() {
try {
Log.i(TAG, "setActivityResultListener: 设置监听");
Set<PreferenceManager.OnActivityResultListener> onActivityResultListeners = Cocos2dxHelper.getOnActivityResultListeners();
if (onActivityResultListeners == null || onActivityResultListeners.size() == 0) {
Cocos2dxHelper.addOnActivityResultListener(new PreferenceManager.OnActivityResultListener() {
@Override
public boolean onActivityResult(int i, int i2, Intent intent) {
Log.i(AppActivity.TAG, "onActivityResult: ");
CustomerWebViewHelper.getInstance().onResetView(new CustomerEvent(i, i2, intent));
return false;
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
}
private static void setBucketIndex(String str) {
SharedPreferencesUtils.saveString(app, "bucket", str);
}
public static void setCustomerWebviewIsShow(final boolean z) {
Log.i(TAG, "setCustomerWebviewIsShow:" + z);
app.runOnUiThread(new Runnable() {
@Override
public void run() {
CustomerWebViewHelper.getInstance().setCustomerWebviewVisible(z, AppActivity.app);
}
});
}
private void setKeyboardListener() {
SoftKeyBoardListener.setListener(this.appActivity, new SoftKeyBoardListener.OnSoftKeyBoardChangeListener() {
@Override
public void keyBoardHide(int i) {
Log.i(AppActivity.TAG, "keyBoardHide: ");
}
@Override
public void keyBoardShow(int i) {
}
});
}
public static void setOrientation(String str) {
AppActivity appActivity;
int i;
if (str.equals(ExifInterface.GPS_MEASUREMENT_INTERRUPTED)) {
appActivity = (AppActivity) SDKWrapper.getInstance().getContext();
i = 7;
} else {
appActivity = (AppActivity) SDKWrapper.getInstance().getContext();
i = 6;
}
appActivity.setRequestedOrientation(i);
}
private static Bitmap sfBitmap(Bitmap bitmap, int i, int i2) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(i / width, i2 / height);
return Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
}
private void showPermissionDialog() {
if (this.mPermissionDialog == null) {
this.mPermissionDialog = new AlertDialog.Builder(this).setMessage("已禁用部分应用权限,是否去设置界面手动授予?").setPositiveButton("设置", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
AppActivity.this.mPermissionDialog.cancel();
AppActivity.this.startActivity(new Intent("android.settings.APPLICATION_DETAILS_SETTINGS", Uri.parse("package:" + AppActivity.this.appActivity.getPackageName())));
}
}).setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
AppActivity.this.mPermissionDialog.cancel();
}
}).create();
}
this.mPermissionDialog.show();
}
public static void showTip(final String str, final String str2) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
if (AppActivity.mExitAppDialog == null) {
AlertDialog unused = AppActivity.mExitAppDialog = new AlertDialog.Builder(AppActivity.app).setMessage(str).setPositiveButton(str2, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
System.exit(0);
}
}).create();
}
AppActivity.mExitAppDialog.setCancelable(false);
AppActivity.mExitAppDialog.show();
}
});
}
public static void showX5WebView(final String str) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
X5WebView x5WebView = (X5WebView) AppActivity.webMap.get(str);
if (x5WebView != null) {
((ViewGroup) x5WebView.getParent()).setVisibility(0);
}
}
});
}
public static void start(Context context) {
context.startActivity(new Intent(context, AppActivity.class));
Log.e("weixin", WxShareType);
if (WxShareType.equals("callBack")) {
Log.e("weixin", "callback1");
WxShareType = "";
AppActivity appActivity = app;
callJsFunction(BackType.wxShareSuccessed);
}
if (WxShareType.equals("normal")) {
Log.e("weixin", "normal1");
WxShareType = "";
AppActivity appActivity2 = app;
callJsFunction(BackType.wxShareTips);
}
KLog.e("暂时注释此代码6");
}
public static String startAliyun(String str) {
HashMap hashMap;
StringBuffer stringBuffer;
StringBuffer stringBuffer2;
String optString;
String optString2;
String optString3;
String optString4;
String optString5;
String str2;
try {
hashMap = new HashMap();
stringBuffer = new StringBuffer("");
stringBuffer2 = new StringBuffer("");
JSONObject jSONObject = new JSONObject(str);
optString = jSONObject.optString(a.f);
optString2 = jSONObject.optString("groupname");
optString3 = jSONObject.optString(SerializableCookie.DOMAIN);
optString4 = jSONObject.optString("dport");
optString5 = jSONObject.optString("token");
} catch (Exception e) {
Log.i("test", "start: " + e.getMessage());
jsonObjStr = "1";
}
if (jsonObjStr == "1" || TextUtils.isEmpty(jsonObjStr)) {
if (TextUtils.isEmpty(optString) || TextUtils.isEmpty(optString5)) {
str2 = "1";
} else {
ret = XiongMao.initEx(optString, optString5);
if (ret != 0) {
str2 = "1";
} else if (TextUtils.isEmpty(optString5) || TextUtils.isEmpty(optString2) || TextUtils.isEmpty(optString3) || TextUtils.isEmpty(optString4)) {
str2 = "1";
} else {
ret = XiongMao.getProxyTcpByDomain(optString5, optString2, optString3, optString4, stringBuffer, stringBuffer2);
hashMap.put("ip", new String(stringBuffer).toString());
hashMap.put("port", new String(stringBuffer2).toString());
JSONObject jSONObject2 = new JSONObject(hashMap);
if (ret == 0) {
Log.e("test", "start:成功");
str2 = jSONObject2.toString();
} else {
Log.e("test", "start:失败");
str2 = "1";
}
}
}
jsonObjStr = str2;
return jsonObjStr;
}
return jsonObjStr;
}
@RequiresApi(api = 26)
public static String startMmpactFeedBack() {
Vibrator vibrator = (Vibrator) getContext().getSystemService("vibrator");
VibrationEffect.createOneShot(150L, 255);
if (vibrator != null) {
vibrator.vibrate(60L);
return "";
}
return "";
}
public static void upToNet(String str) {
String string = app.getString(NPFog.d(2131690935));
String string2 = app.getString(NPFog.d(2131690855));
try {
try {
bindDataJo = new JSONObject(str);
if (!Bus.DEFAULT_IDENTIFIER.equals(string)) {
JSONObject jSONObject = bindDataJo;
jSONObject.put("shareName", string + "");
}
if (!Bus.DEFAULT_IDENTIFIER.equals(string2)) {
JSONObject jSONObject2 = bindDataJo;
jSONObject2.put("proxyAccount", string2 + "");
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception unused) {
bindDataJo = new JSONObject();
bindDataJo.put("proxyAccount", "");
bindDataJo.put("shareName", "");
bindDataJo.put("appDataStr", "");
if (!Bus.DEFAULT_IDENTIFIER.equals(string)) {
JSONObject jSONObject3 = bindDataJo;
jSONObject3.put("shareName", string + "");
}
if (!Bus.DEFAULT_IDENTIFIER.equals(string2)) {
JSONObject jSONObject4 = bindDataJo;
jSONObject4.put("proxyAccount", string2 + "");
}
}
try {
app.runOnGLThread(new Runnable() {
@Override
public void run() {
String str2 = "gg.sdkManager.openinstallSuccessBack('" + AppActivity.bindDataJo.toString() + "')";
KLog.e("share", "最终数据===============" + str2);
Cocos2dxJavascriptJavaBridge.evalString(str2);
}
});
} catch (Exception e2) {
KLog.e("getOpeninstall()方法出错");
e2.printStackTrace();
}
}
private static void useNewOpenShare2() {
Log.e("getOpeninstall", "useOpenShare4");
try {
OpenShare.getInstance().setInstallListener(new InstallListener() {
@Override
public void onInstallFinish(OSResponse<OSInstall> oSResponse) {
if (oSResponse == null || !oSResponse.ret.equals("C2")) {
KLog.e("获取useOpenShare链接参数:失败");
if (oSResponse != null) {
KLog.e("获取useOpenShare链接参数:失败" + oSResponse.toString());
}
AppActivity.openshareInstallback("", "");
return;
}
KLog.e("获取useOpenShare链接参数: 成功" + oSResponse.toString());
try {
JSONObject jSONObject = new JSONObject(oSResponse.data.params);
String optString = jSONObject.optString("shareName");
String optString2 = jSONObject.optString("proxyAccount");
KLog.e("9999" + optString);
KLog.e("9999" + optString2);
Log.e("OpenShareInstall 传给后台", optString + "---" + optString2);
AppActivity.openshareInstallback(optString, optString2);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
} catch (Exception e) {
KLog.e("getOpeninstall()方法出错" + e.toString());
e.printStackTrace();
}
}
private static void useNewOpenShare_method1() {
Log.e("getOpeninstall", "useOpenShare1");
app.runOnUiThread(new Runnable() {
@Override
public void run() {
OSResponse<OSInstall> installParams = OpenShare.getInstance().getInstallParams();
if (installParams == null || !installParams.ret.equals("C2")) {
KLog.e("获取useOpenShare链接参数:失败");
if (installParams != null) {
KLog.e("获取useOpenShare链接参数:失败" + installParams.toString());
}
AppActivity.openshareInstallback("", "");
return;
}
KLog.e("获取useOpenShare链接参数: 成功" + installParams.toString());
try {
JSONObject jSONObject = new JSONObject(installParams.data.params);
String optString = jSONObject.optString("shareName");
String optString2 = jSONObject.optString("proxyAccount");
KLog.e("9999" + optString);
KLog.e("9999" + optString2);
Log.e("OpenShareInstall 传给后台", optString + "---" + optString2);
AppActivity.openshareInstallback(optString, optString2);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
private static void useNewOpenShare_method2() {
Log.e("getOpeninstall", "useOpenShare1");
new Thread(new Runnable() {
@Override
public void run() {
OpenShare.getInstance().init(Cocos2dxActivity.getContext());
OSResponse<OSInstall> installParams = OpenShare.getInstance().getInstallParams();
if (installParams == null || !installParams.ret.equals("C2")) {
KLog.e("获取useOpenShare链接参数:失败");
if (installParams != null) {
KLog.e("获取useOpenShare链接参数:失败" + installParams.toString());
}
AppActivity.openshareInstallback("", "");
return;
}
KLog.e("获取useOpenShare链接参数: 成功" + installParams.toString());
try {
JSONObject jSONObject = new JSONObject(installParams.data.params);
String optString = jSONObject.optString("shareName");
String optString2 = jSONObject.optString("proxyAccount");
KLog.e("9999" + optString);
KLog.e("9999" + optString2);
Log.e("OpenShareInstall 传给后台", optString + "---" + optString2);
AppActivity.openshareInstallback(optString, optString2);
} catch (JSONException e) {
e.printStackTrace();
}
}
}).start();
}
private static void useOpenInstall() {
try {
OpenInstall.getInstall(new AppInstallAdapter() {
@Override
public void onInstall(AppData appData) {
String data = appData.getData();
String string = AppActivity.app.getString(NPFog.d(2131690935));
String string2 = AppActivity.app.getString(NPFog.d(2131690855));
Log.e("openInstall", "bindDat======" + data + "取出来的值是==shareName:" + string + " proxyAccount: " + string2);
try {
try {
AppActivity.bindDataJo = new JSONObject(data);
if (!Bus.DEFAULT_IDENTIFIER.equals(string)) {
JSONObject jSONObject = AppActivity.bindDataJo;
jSONObject.put("shareName", string + "");
}
if (!Bus.DEFAULT_IDENTIFIER.equals(string2)) {
JSONObject jSONObject2 = AppActivity.bindDataJo;
jSONObject2.put("proxyAccount", string2 + "");
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception unused) {
AppActivity.bindDataJo = new JSONObject();
AppActivity.bindDataJo.put("proxyAccount", "");
AppActivity.bindDataJo.put("shareName", "");
AppActivity.bindDataJo.put("appDataStr", "");
if (!Bus.DEFAULT_IDENTIFIER.equals(string)) {
JSONObject jSONObject3 = AppActivity.bindDataJo;
jSONObject3.put("shareName", string + "");
}
if (!Bus.DEFAULT_IDENTIFIER.equals(string2)) {
JSONObject jSONObject4 = AppActivity.bindDataJo;
jSONObject4.put("proxyAccount", string2 + "");
}
}
try {
AppActivity.app.runOnGLThread(new Runnable() {
@Override
public void run() {
String str = "gg.sdkManager.openinstallSuccessBack('" + AppActivity.bindDataJo.toString() + "')";
Log.e("openInstall", "run: openinstalldata===============" + str);
Cocos2dxJavascriptJavaBridge.evalString(str);
}
});
} catch (Exception e2) {
e2.printStackTrace();
}
}
}, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
private static void useOpenShare() {
Log.e("getOpeninstall", "useOpenShare");
app.runOnUiThread(new Runnable() {
@Override
public void run() {
String str;
OSResponse<OSInstall> installParams = OpenShare.getInstance().getInstallParams();
if (installParams == null || !installParams.ret.equals("C2")) {
KLog.e("获取useOpenShare链接参数:失败");
} else {
String str2 = installParams.data.params;
KLog.e("获取useOpenShare链接参数:" + str2);
if (!TextUtils.isEmpty(str2)) {
str = "https://www.baidu.com?" + str2.replace("{", "").replace(g.d, "").replace(" ", "").replace(",", a.b);
String install = AppActivity.getInstall(str);
KLog.e("获取useOpenShare链接参数:" + str);
AppActivity.upToNet(install);
}
}
str = null;
String install2 = AppActivity.getInstall(str);
KLog.e("获取useOpenShare链接参数:" + str);
AppActivity.upToNet(install2);
}
});
}
private static void useShareInstall() {
}
private static void useShareTrace() {
KLog.e("使用sharetrace");
app.runOnUiThread(new Runnable() {
@Override
public void run() {
ShareTrace.getInstallTrace(new ShareTraceInstallListener() {
@Override
public void onError(int i, String str) {
KLog.e("shareTrance", "失败Get install trace info error. code=" + i + ",msg=" + str);
AppActivity.upToNet(AppActivity.getInstall(null));
}
@Override
public void onInstall(cn.net.shoot.sharetracesdk.AppData appData) {
KLog.e("shareTrance", "原始数据" + appData.toString());
String paramsData = appData.getParamsData();
AppActivity.upToNet(AppActivity.getInstall("https://www.baidu.com?" + paramsData));
}
});
}
});
}
public static void wxLogin() {
System.out.println("Enter the wxLogin");
if (api.isWXAppInstalled()) {
requestCode();
} else {
Log.e("cocos", "没有安装微信");
}
}
public static void wxShareReq(final String str) {
app.runOnUiThread(new Runnable() {
@Override
public void run() {
if (!AppActivity.api.isWXAppInstalled()) {
Toast.makeText(AppActivity.app, "检查您手机没有安装微信,请安装后使用", 1).show();
return;
}
try {
Hashtable hashtable = new Hashtable();
for (String str2 : str.split("\\|")) {
String[] split = str2.split("\\+");
if (split.length == 2) {
hashtable.put(split[0], split[1]);
}
}
String str3 = (String) hashtable.get("scene");
Log.e("cocos", "进入分享");
int i = (str3 != "0" && str3 == "1") ? 1 : 0;
Bitmap CreateQRCode = AppActivity.CreateQRCode((String) hashtable.get("qrData"), Integer.valueOf(Integer.parseInt((String) hashtable.get("qrSize"))).intValue());
Bitmap bitmapByPath = AppActivity.getBitmapByPath((String) hashtable.get("bgFile"));
Bitmap bitmap = null;
if (bitmapByPath != null) {
bitmap = AppActivity.getBitmapByPath((String) hashtable.get("tumbFile"));
} else {
bitmapByPath = BitmapFactory.decodeResource(AppActivity.app.getResources(), R.mipmap.bg);
}
Bitmap bitmap2 = bitmap;
if (bitmapByPath == null) {
Log.e("cocos", "分享图片为空");
return;
}
String str4 = (String) hashtable.get("qrContentId");
String str5 = (String) hashtable.get("qrcontentUrl");
String str6 = (String) hashtable.get("title");
String str7 = (String) hashtable.get("content");
String str8 = hashtable.containsKey("shareUrl") ? (String) hashtable.get("shareUrl") : "";
Bitmap MergeBitmap = AppActivity.MergeBitmap(bitmapByPath, CreateQRCode, str4, str5);
if (str8 == null || str8.isEmpty()) {
AppActivity.app.sendWXSheardReq(i, str6, str7, MergeBitmap, bitmap2);
} else {
AppActivity.app.wxShare(i, str6, str7, str8, MergeBitmap);
}
} catch (Exception e) {
Log.e("cocos", e.getMessage());
}
}
});
}
protected void OpenQQReal() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (!AppActivity.mTencent.isQQInstalled(AppActivity.app)) {
AppActivity unused = AppActivity.app;
AppActivity.callJsFunction(BackType.openQqFailed);
return;
}
try {
AppActivity.this.startActivity(AppActivity.this.getPackageManager().getLaunchIntentForPackage("com.tencent.mobileqq"));
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(AppActivity.app, "qq打开失败,请检查是否安装qq", 1).show();
}
}
});
}
protected void OpenWxReal() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (!AppActivity.api.isWXAppInstalled()) {
AppActivity unused = AppActivity.app;
AppActivity.callJsFunction(BackType.openWxFailed);
} else if (AppActivity.api.openWXApp()) {
} else {
Toast.makeText(AppActivity.app, "微信打开失败", 1).show();
}
}
});
}
@RequiresApi(api = 23)
protected void SavePicToLocalReal(final String str) {
Log.e("cocos", "进来了");
try {
String[] strArr = {PermissionConfig.READ_EXTERNAL_STORAGE, PermissionConfig.WRITE_EXTERNAL_STORAGE};
Log.e("cocos", "进来了0");
int checkSelfPermission = checkSelfPermission(PermissionConfig.WRITE_EXTERNAL_STORAGE);
Log.e("cocos", "进来了1");
if (checkSelfPermission != 0) {
requestPermissions(strArr, 1);
}
Log.e("cocos", "进来了2");
app.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
Bitmap decodeFile = BitmapFactory.decodeFile(str);
int lastIndexOf = str.lastIndexOf(MqttTopic.TOPIC_LEVEL_SEPARATOR);
AppActivity.saveImageToGallery(AppActivity.app, decodeFile, str.substring(lastIndexOf + 1, str.lastIndexOf(".")));
} catch (Exception unused) {
AppActivity.callJsFunction(BackType.fileSaveFailed);
}
}
});
} catch (Exception e) {
Log.e("cocos", e.getMessage());
}
}
public String getAppMetaDataBoolean() {
try {
return String.valueOf(app.getPackageManager().getApplicationInfo(app.getPackageName(), 128).metaData.get("QQ_ID")).replace("\"", "");
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return "错误或者默认的值";
}
}
public void goNativeWebviewGame(String str, final String str2, final boolean z, final String str3, final String str4, final String str5, final String str6) {
callbackLuaFunction = str;
this.appActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
int i = AppActivity.this.appActivity.getResources().getConfiguration().orientation;
KLog.e("屏幕方向====" + i);
WebGameActivity.start(AppActivity.this.appActivity, str2, z, str3, str4, str5, str6, i);
}
});
}
public void goNativeWebviewGameWithUPay(String str, final String str2, final boolean z, final String str3, final String str4, final String str5, final String str6, final String str7) {
callbackLuaFunction = str;
this.appActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
int i = AppActivity.this.appActivity.getResources().getConfiguration().orientation;
KLog.e("屏幕方向====" + i);
WebGameActivity.startWithUpay(AppActivity.this.appActivity, str2, z, str3, str4, str5, str6, i, str7);
}
});
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
SDKWrapper.getInstance().onActivityResult(i, i2, intent);
}
@Override
public void onBackPressed() {
SDKWrapper.getInstance().onBackPressed();
super.onBackPressed();
}
@Override
public void onCancel() {
Log.i(" qq分享", "qq分享onCancel");
}
@Override
public void onComplete(Object obj) {
Log.i(" qq分享", obj.toString());
}
@Override
public void onConfigurationChanged(Configuration configuration) {
SDKWrapper.getInstance().onConfigurationChanged(configuration);
super.onConfigurationChanged(configuration);
}
@Override
public void onCreate(Bundle bundle) {
C0046.m1029(this);
super.onCreate(bundle);
if (isTaskRoot()) {
new PayTask(this);
this.appActivity = this;
SDKWrapper.getInstance().init(this);
initJPush();
WindowManager.LayoutParams attributes = getWindow().getAttributes();
if (Build.VERSION.SDK_INT >= 28) {
attributes.layoutInDisplayCutoutMode = 1;
}
attributes.systemUiVisibility = 1026;
getWindow().setAttributes(attributes);
app = this;
for (int i = 0; i < this.permissions.length; i++) {
if (ContextCompat.checkSelfPermission(this, this.permissions[i]) != 0) {
this.mPermissionList.add(this.permissions[i]);
}
}
if (this.mPermissionList.size() > 0) {
ActivityCompat.requestPermissions(this, this.permissions, 100);
}
OpenInstall.init(this);
setKeyboardListener();
String appMetaDataBoolean = getAppMetaDataBoolean();
Log.e(TAG, "onCreate获取的值: =================" + appMetaDataBoolean);
mTencent = Tencent.createInstance(appMetaDataBoolean, app);
easeProtect();
RxBus.get().register(this);
CookieHandler.setDefault(new CookieManager());
}
}
@Override
public Cocos2dxGLSurfaceView onCreateView() {
Cocos2dxGLSurfaceView cocos2dxGLSurfaceView = new Cocos2dxGLSurfaceView(this);
cocos2dxGLSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
SDKWrapper.getInstance().setGLSurfaceView(cocos2dxGLSurfaceView, this);
return cocos2dxGLSurfaceView;
}
@Override
public void onDestroy() {
super.onDestroy();
SDKWrapper.getInstance().onDestroy();
RxBus.get().unregister(this);
}
@Override
public void onError(UiError uiError) {
Log.i(" qq分享", uiError.toString());
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
SDKWrapper.getInstance().onNewIntent(intent);
}
@Override
public void onPause() {
super.onPause();
SDKWrapper.getInstance().onPause();
}
@Override
public void onPointerCaptureChanged(boolean z) {
}
@Override
public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
super.onRequestPermissionsResult(i, strArr, iArr);
if (100 == i) {
boolean z = false;
for (int i2 : iArr) {
if (i2 == -1) {
z = true;
}
}
if (z) {
showPermissionDialog();
}
}
}
@Override
protected void onRestart() {
super.onRestart();
SDKWrapper.getInstance().onRestart();
}
@Override
protected void onRestoreInstanceState(Bundle bundle) {
SDKWrapper.getInstance().onRestoreInstanceState(bundle);
super.onRestoreInstanceState(bundle);
}
@Override
public void onResume() {
super.onResume();
KLog.e("暂时注释此代码5");
SDKWrapper.getInstance().onResume();
if (!this.isFirst && !callbackLuaFunction.isEmpty()) {
app.runOnGLThread(new Runnable() {
@Override
public void run() {
try {
Cocos2dxJavascriptJavaBridge.evalString(AppActivity.callbackLuaFunction);
} catch (Exception e) {
Log.e("cocos", e.getMessage());
}
}
});
}
this.isFirst = false;
setActivityResultListener();
}
@Override
protected void onSaveInstanceState(Bundle bundle) {
SDKWrapper.getInstance().onSaveInstanceState(bundle);
super.onSaveInstanceState(bundle);
}
@Override
protected void onStart() {
SDKWrapper.getInstance().onStart();
super.onStart();
}
@Override
protected void onStop() {
super.onStop();
SDKWrapper.getInstance().onStop();
}
public void sendWXSheardReq(int i, String str, String str2, Bitmap bitmap, Bitmap bitmap2) {
SendMessageToWX.Req req = new SendMessageToWX.Req();
WXImageObject wXImageObject = new WXImageObject(bitmap);
WXMediaMessage wXMediaMessage = new WXMediaMessage();
wXMediaMessage.mediaObject = wXImageObject;
wXMediaMessage.title = str;
wXMediaMessage.description = str2;
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap2, 150, 150, true);
bitmap.recycle();
wXMediaMessage.thumbData = buildWXReqBitmap(createScaledBitmap);
req.transaction = buildWXReqTrans(SocialConstants.PARAM_IMG_URL);
req.message = wXMediaMessage;
req.scene = i;
api.sendReq(req);
}
public void setWXShareScreenshot(byte[] bArr) {
this.screenshotData = bArr;
}
public void showStatusBar() {
getWindow().addFlags(AccessibilityNodeInfoCompat.ACTION_PREVIOUS_HTML_ELEMENT);
}
public void wxShare(int i, String str, String str2, String str3, Bitmap bitmap) {
Log.e("cocos", "分享过来了");
SendMessageToWX.Req req = new SendMessageToWX.Req();
WXWebpageObject wXWebpageObject = new WXWebpageObject();
wXWebpageObject.webpageUrl = str3;
WXMediaMessage wXMediaMessage = new WXMediaMessage(wXWebpageObject);
wXMediaMessage.title = str;
wXMediaMessage.description = str2;
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap, 150, 150, true);
bitmap.recycle();
wXMediaMessage.thumbData = buildWXReqBitmap(createScaledBitmap);
req.transaction = buildWXReqTrans("webpage");
req.message = wXMediaMessage;
req.scene = i;
api.sendReq(req);
}
}