Рабочий первый рабочий коммит
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class C2DMConstants {
|
||||
public static final String ACTION_ERROR = "com.ea.ironmonkey.ERROR";
|
||||
public static final String ACTION_MESSAGE = "com.ea.ironmonkey.MESSAGE";
|
||||
public static final String ACTION_REGISTER = "com.ea.ironmonkey.REGISTER";
|
||||
public static final String ACTION_UNREGISTER = "com.ea.ironmonkey.UNREGISTER";
|
||||
public static final String EXTRA_ERROR_ID = "ERROR_ID";
|
||||
public static final String EXTRA_REGISTRATION_ID = "REGISTRATION_ID";
|
||||
public static final String LAUNCH_TYPE_TAG = "app_launch";
|
||||
public static final String SENDER_EMAIL = "927779459434";
|
||||
public static final String SYSTEM_MSG_CLASS_RECIPIENT = "com.ea.ironmonkey.GameActivityMain";
|
||||
public static final String SYSTEM_MSG_PACKAGE_RECIPIENT = "com.ea.games.nfs13_row";
|
||||
public static final String SYSTEM_MSG_TITLE = "NFS Most Wanted";
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DownloaderService extends com.google.android.vending.expansion.downloader.impl.DownloaderService {
|
||||
@Override // com.google.android.vending.expansion.downloader.impl.DownloaderService
|
||||
public String getPublicKey() {
|
||||
return getPackageName().endsWith("_row") ? SkuConfig.ROW_BASE64_PUBLIC_KEY : SkuConfig.NA_BASE64_PUBLIC_KEY;
|
||||
}
|
||||
|
||||
@Override // com.google.android.vending.expansion.downloader.impl.DownloaderService
|
||||
public byte[] getSALT() {
|
||||
return SkuConfig.SALT;
|
||||
}
|
||||
|
||||
@Override // com.google.android.vending.expansion.downloader.impl.DownloaderService
|
||||
public String getAlarmReceiverClassName() {
|
||||
return DownloaderServiceBroadcastReceiver.class.getName();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DownloaderServiceBroadcastReceiver extends BroadcastReceiver {
|
||||
@Override // android.content.BroadcastReceiver
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
DownloaderClientMarshaller.startDownloadServiceIfRequired(context, intent, (Class<?>) DownloaderService.class);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Configuration;
|
||||
@@ -17,11 +20,11 @@ import android.net.Uri;
|
||||
import android.opengl.GLES20;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.Process;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.media.session.PlaybackStateCompat;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
import android.view.DisplayCutout;
|
||||
@@ -29,24 +32,29 @@ import android.view.KeyEvent;
|
||||
import android.view.OrientationEventListener;
|
||||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ComponentActivity;
|
||||
|
||||
import com.ea.EAIO.EAIO;
|
||||
import com.ea.EAMIO.StorageDirectory;
|
||||
import com.ea.nimble.ApplicationLifecycle;
|
||||
import com.ea.nimble.Global;
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.google.android.vending.expansion.downloader.Constants;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -61,7 +69,7 @@ import javax.microedition.khronos.opengles.GL10;
|
||||
import org.fmod.FMODAudioDevice;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
public class GameActivityMain extends AppCompatActivity implements DrawFrameListener {
|
||||
private static final String DOWNLOAD_PROPERTIES = "downloadcontent/config.properties";
|
||||
public static final int LIFECYCLE_CREATED = 1;
|
||||
public static final int LIFECYCLE_DESTROYED = 5;
|
||||
@@ -90,7 +98,6 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
private Accelerometer accelerometer;
|
||||
private GameGLSurfaceView gameGLSurfaceView;
|
||||
private GameRenderer gameRenderer;
|
||||
private GoogleDrm googleDrm;
|
||||
private Handler handler;
|
||||
private int laststate;
|
||||
private int lifecycle;
|
||||
@@ -98,7 +105,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
private FMODAudioDevice mFMODAudioDevice;
|
||||
private FrameLayout mFrameLayout;
|
||||
private OrientationEventListener mOrientationListener;
|
||||
private Map<String, Map<String, FSNode>> mResources;
|
||||
private Map mResources;
|
||||
private PowerManager.WakeLock mWakeLock;
|
||||
public int naturalOrientation;
|
||||
private RunLoop runLoop;
|
||||
@@ -112,6 +119,14 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
private AssetLocationType mAssetLocationType = AssetLocationType.EXTERNAL;
|
||||
private String[] lifecycleNames = {"LIFECYCLE_NONE", "LIFECYCLE_CREATED", "LIFECYCLE_STARTED", "LIFECYCLE_RUNNING", "LIFECYCLE_STOPPED", "LIFECYCLE_DESTROYED"};
|
||||
|
||||
public File getSave() {
|
||||
return save;
|
||||
}
|
||||
|
||||
public void setSave(File save) {
|
||||
this.save = save;
|
||||
}
|
||||
|
||||
enum AssetLocationType {
|
||||
EXTERNAL,
|
||||
ASSETS,
|
||||
@@ -176,6 +191,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onCreate(Bundle bundle) {
|
||||
restoreSave();
|
||||
Log.setEnable(true);
|
||||
Log.i(TAG, "onCreate");
|
||||
super.onCreate(bundle);
|
||||
@@ -200,11 +216,11 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
Log.d(TAG, "It's Amazon dev");
|
||||
isAmazonDev = true;
|
||||
}
|
||||
if (!isAtLeastAPI(18) && getRequestedOrientation() != 6) {
|
||||
setRequestedOrientation(6);
|
||||
if (!isAtLeastAPI(18) && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||
}
|
||||
if (isAtLeastAPI(28)) {
|
||||
getWindow().getAttributes().layoutInDisplayCutoutMode = 1;
|
||||
getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
getWindow().addFlags(67108864);
|
||||
}
|
||||
getWindow().setFlags(1024, 1024);
|
||||
@@ -229,7 +245,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
if (this.mOrientationListener.canDetectOrientation()) {
|
||||
this.mOrientationListener.enable();
|
||||
}
|
||||
mAudioManager = (AudioManager) getSystemService("audio");
|
||||
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
sIsOtherMusicPlaying = mAudioManager.isMusicActive();
|
||||
Log.i(TAG, "onCreate() isMusicActive = " + Boolean.toString(sIsOtherMusicPlaying));
|
||||
this.mFMODAudioDevice = new FMODAudioDevice();
|
||||
@@ -237,7 +253,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
try {
|
||||
Log.d(TAG, "onCreate open resources.json");
|
||||
InputStream open = getAssetManager().open("resources.json");
|
||||
this.mResources = (Map) new Gson().fromJson(new InputStreamReader(open), new TypeToken<Map<String, Map<String, FSNode>>>() { // from class: com.ea.ironmonkey.GameActivityMain.2
|
||||
this.mResources = new Gson().fromJson(new InputStreamReader(open), new TypeToken<Map<String, Map<String, FSNode>>>() { // from class: com.ea.ironmonkey.GameActivityMain.2
|
||||
}.getType());
|
||||
Log.d(TAG, "onCreate resources.json contains " + Integer.toString(this.mResources.size()) + " items");
|
||||
open.close();
|
||||
@@ -259,7 +275,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
Log.e(TAG, e2.getMessage());
|
||||
}
|
||||
}
|
||||
SensorManager sensorManager = (SensorManager) getSystemService("sensor");
|
||||
SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
||||
Sensor defaultSensor = sensorManager.getDefaultSensor(1);
|
||||
int rotation = getWindow().getWindowManager().getDefaultDisplay().getRotation();
|
||||
switch (rotation) {
|
||||
@@ -289,13 +305,11 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
this.mFrameLayout = new FrameLayout(this);
|
||||
this.mFrameLayout.addView(this.gameGLSurfaceView);
|
||||
setContentView(this.mFrameLayout);
|
||||
this.googleDrm = new GoogleDrm(this);
|
||||
System.loadLibrary("fmodex");
|
||||
System.loadLibrary("fmodevent");
|
||||
System.loadLibrary("c++_shared");
|
||||
System.loadLibrary(Global.NIMBLE_ID);
|
||||
System.loadLibrary("app");
|
||||
FacebookSdk.sdkInitialize(this);
|
||||
Log.d(TAG, "Init EAIO/EAMIO");
|
||||
EAIO.Startup(this);
|
||||
StorageDirectory.Startup(this);
|
||||
@@ -304,14 +318,8 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
nativeOnCreate();
|
||||
}
|
||||
|
||||
public String[] forEach(String str) {
|
||||
Log.d(TAG, "forEach path = " + str);
|
||||
if (this.mResources.containsKey(str)) {
|
||||
Log.d(TAG, "forEach mResources contains " + str);
|
||||
return (String[]) this.mResources.get(str).keySet().toArray(new String[0]);
|
||||
}
|
||||
Log.d(TAG, "forEach mResources not contains " + str);
|
||||
return new String[0];
|
||||
public String[] forEach(String input) {
|
||||
return new String[] { input };
|
||||
}
|
||||
|
||||
public int getAssetSize(String str) {
|
||||
@@ -328,7 +336,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
Log.d(TAG, "getAssetSize path = " + parent);
|
||||
if (this.mResources.containsKey(parent)) {
|
||||
Log.d(TAG, "getAssetSize mResources contains " + parent);
|
||||
Map<String, FSNode> map = this.mResources.get(parent);
|
||||
Map<String, FSNode> map = (Map<String, FSNode>) this.mResources.get(parent);
|
||||
String name = file.getName();
|
||||
Log.d(TAG, "getAssetSize name = " + name);
|
||||
if (map.containsKey(name)) {
|
||||
@@ -368,6 +376,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
}
|
||||
|
||||
public String getObbFullPath() {
|
||||
Log.i(this.getClass().getName(), getObbDir() + "/" + ObbHelper.getObbFileName(this, getVersionCode()));
|
||||
return getObbDir() + "/" + ObbHelper.getObbFileName(this, getVersionCode());
|
||||
}
|
||||
|
||||
@@ -409,13 +418,6 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void getC2DMRegistrationId() {
|
||||
Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
|
||||
intent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));
|
||||
intent.putExtra("sender", C2DMConstants.SENDER_EMAIL);
|
||||
startService(intent);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onStart() {
|
||||
CallGC();
|
||||
@@ -447,6 +449,62 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
ApplicationLifecycle.onActivityStart(this);
|
||||
}
|
||||
|
||||
// Методы для воостановления сейва и его сохранения чтобы всегда использовать внешний сейв
|
||||
|
||||
private String saveFileName = "nfstr_save.sb";
|
||||
private File save = null;
|
||||
private File externalSave = new File(Environment.getStorageDirectory(),"games/nfsmw/nfstr_save.sb");
|
||||
|
||||
// Сохранить
|
||||
private void storeSave() {
|
||||
try {
|
||||
save = new File(getFilesDir(), "var/nfstr_save.sb");
|
||||
|
||||
// Создаем директории, если они не существуют
|
||||
externalSave.getParentFile().mkdirs();
|
||||
|
||||
// Копируем файл из внутреннего хранилища во внешнее
|
||||
try (InputStream in = new FileInputStream(save);
|
||||
OutputStream out = new FileOutputStream(externalSave)) {
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// Обработка ошибки сохранения
|
||||
}
|
||||
}
|
||||
|
||||
// Восстановить
|
||||
private void restoreSave() {
|
||||
try {
|
||||
save = new File(getFilesDir(), "var/nfstr_save.sb");
|
||||
// Проверяем, существует ли внешний файл
|
||||
if (!externalSave.exists()) {
|
||||
return; // ничего не делаем, если файла нет
|
||||
}
|
||||
|
||||
// Создаем директории для внутреннего файла, если нужно
|
||||
save.getParentFile().mkdirs();
|
||||
|
||||
// Копируем файл из внешнего хранилища во внутреннее
|
||||
try (InputStream in = new FileInputStream(externalSave);
|
||||
OutputStream out = new FileOutputStream(save)) {
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// Обработка ошибки восстановления
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onRestart() {
|
||||
Log.i(TAG, "onRestart");
|
||||
@@ -477,7 +535,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
private void ForceHideVirtualKeyboard() {
|
||||
View currentFocus = getCurrentFocus();
|
||||
if (currentFocus != null) {
|
||||
((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
|
||||
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
|
||||
}
|
||||
getWindow().setSoftInputMode(3);
|
||||
}
|
||||
@@ -529,9 +587,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
return;
|
||||
}
|
||||
setLifecycle(5);
|
||||
if (this.googleDrm.isEnable()) {
|
||||
this.googleDrm.destroy();
|
||||
}
|
||||
storeSave();
|
||||
if (state == 8) {
|
||||
ApplicationLifecycle.onActivityDestroy(this);
|
||||
nativeOnDestroy();
|
||||
@@ -541,12 +597,13 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
@SuppressLint("InvalidWakeLockTag")
|
||||
public void wakeLockAcquire() {
|
||||
if (this.isSleepModeEnabled) {
|
||||
return;
|
||||
}
|
||||
if (this.mWakeLock == null) {
|
||||
this.mWakeLock = ((PowerManager) getSystemService("power")).newWakeLock(10, TAG);
|
||||
this.mWakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)).newWakeLock(10, TAG);
|
||||
}
|
||||
if (this.mWakeLock.isHeld()) {
|
||||
return;
|
||||
@@ -621,6 +678,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onBackPressed() {
|
||||
//super.onBackPressed();
|
||||
if (state == 1 || state == 0 || state == 7) {
|
||||
finish();
|
||||
}
|
||||
@@ -763,18 +821,9 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
|
||||
@Override // android.app.Activity, android.content.ComponentCallbacks
|
||||
public void onLowMemory() {
|
||||
ActivityManager activityManager = (ActivityManager) getSystemService("activity");
|
||||
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
||||
activityManager.getMemoryInfo(memoryInfo);
|
||||
Log.i(TAG, "Available memory: " + ((memoryInfo.availMem / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) + "MB\n");
|
||||
Log.i(TAG, "Threshold: " + ((memoryInfo.threshold / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) + "MB\n");
|
||||
List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = activityManager.getRunningAppProcesses();
|
||||
new TreeMap();
|
||||
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : runningAppProcesses) {
|
||||
if (runningAppProcessInfo.processName.indexOf("nfs13") != -1) {
|
||||
Log.i(TAG, "Total memory: " + (activityManager.getProcessMemoryInfo(new int[]{runningAppProcessInfo.pid})[0].getTotalPss() / 1024) + "MB\n");
|
||||
}
|
||||
}
|
||||
super.onLowMemory();
|
||||
}
|
||||
|
||||
@@ -866,18 +915,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
case 0:
|
||||
this.splash = new SplashScreen(this);
|
||||
this.splash.init(gl10, this.gameRenderer.getWidth(), this.gameRenderer.getHeight());
|
||||
if (this.googleDrm.isEnable()) {
|
||||
Log.i(TAG, "Begin DRM Check...");
|
||||
this.handler.postDelayed(new Runnable() { // from class: com.ea.ironmonkey.GameActivityMain.7
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
GameActivityMain.this.googleDrm.start();
|
||||
}
|
||||
}, 20L);
|
||||
state = 2;
|
||||
} else {
|
||||
state = 1;
|
||||
}
|
||||
state = 1;
|
||||
this.splashCounter = 3;
|
||||
break;
|
||||
case 1:
|
||||
@@ -961,16 +999,6 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
|
||||
public void onResult(String str, int i) {
|
||||
Log.w(TAG, "onResult(" + str + "," + i + ")");
|
||||
if (str.equals("GOOGL_DRM")) {
|
||||
if (i == -1) {
|
||||
state = 1;
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "No Google account!!!!");
|
||||
finish();
|
||||
Process.killProcess(Process.myPid());
|
||||
return;
|
||||
}
|
||||
if (i == -1) {
|
||||
File file = new File(new File(str).getParent() + "/.nomedia");
|
||||
if (!file.exists()) {
|
||||
@@ -998,116 +1026,8 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
Process.killProcess(Process.myPid());
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:11:0x004a, code lost:
|
||||
|
||||
r3 = r3[1].trim().split(" ");
|
||||
com.ea.ironmonkey.Log.d("mem", r3[0]);
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:13:0x005d, code lost:
|
||||
|
||||
r3 = java.lang.Integer.parseInt(r3[0].trim()) / 1024;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:22:0x006a, code lost:
|
||||
|
||||
r3 = move-exception;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:23:0x006b, code lost:
|
||||
|
||||
com.ea.ironmonkey.Log.d("mem", r3.toString());
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public int getTotalMemory() {
|
||||
/*
|
||||
r9 = this;
|
||||
java.io.File r0 = new java.io.File
|
||||
java.lang.String r1 = "/proc/meminfo"
|
||||
r0.<init>(r1)
|
||||
boolean r1 = r0.exists()
|
||||
r2 = 0
|
||||
if (r1 == 0) goto L9c
|
||||
r1 = 1
|
||||
java.io.FileReader r3 = new java.io.FileReader // Catch: java.lang.Exception -> L7f
|
||||
r3.<init>(r0) // Catch: java.lang.Exception -> L7f
|
||||
java.io.BufferedReader r4 = new java.io.BufferedReader // Catch: java.lang.Exception -> L7f
|
||||
r4.<init>(r3) // Catch: java.lang.Exception -> L7f
|
||||
L19:
|
||||
java.lang.String r3 = r4.readLine() // Catch: java.lang.Exception -> L7f
|
||||
if (r3 == 0) goto L74
|
||||
java.lang.String r5 = "mem"
|
||||
com.ea.ironmonkey.Log.d(r5, r3) // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = ":"
|
||||
java.lang.String[] r3 = r3.split(r5) // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = "mem"
|
||||
r6 = r3[r2] // Catch: java.lang.Exception -> L7f
|
||||
com.ea.ironmonkey.Log.d(r5, r6) // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = "mem"
|
||||
r6 = r3[r1] // Catch: java.lang.Exception -> L7f
|
||||
com.ea.ironmonkey.Log.d(r5, r6) // Catch: java.lang.Exception -> L7f
|
||||
r5 = r3[r2] // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = r5.trim() // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = r5.toLowerCase() // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r6 = "memtotal"
|
||||
boolean r5 = r5.equals(r6) // Catch: java.lang.Exception -> L7f
|
||||
if (r5 == 0) goto L19
|
||||
r3 = r3[r1] // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r3 = r3.trim() // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = " "
|
||||
java.lang.String[] r3 = r3.split(r5) // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = "mem"
|
||||
r6 = r3[r2] // Catch: java.lang.Exception -> L7f
|
||||
com.ea.ironmonkey.Log.d(r5, r6) // Catch: java.lang.Exception -> L7f
|
||||
r3 = r3[r2] // Catch: java.lang.NumberFormatException -> L6a java.lang.Exception -> L7f
|
||||
java.lang.String r3 = r3.trim() // Catch: java.lang.NumberFormatException -> L6a java.lang.Exception -> L7f
|
||||
int r3 = java.lang.Integer.parseInt(r3) // Catch: java.lang.NumberFormatException -> L6a java.lang.Exception -> L7f
|
||||
int r3 = r3 / 1024
|
||||
goto L75
|
||||
L6a:
|
||||
r3 = move-exception
|
||||
java.lang.String r5 = "mem"
|
||||
java.lang.String r3 = r3.toString() // Catch: java.lang.Exception -> L7f
|
||||
com.ea.ironmonkey.Log.d(r5, r3) // Catch: java.lang.Exception -> L7f
|
||||
L74:
|
||||
r3 = 0
|
||||
L75:
|
||||
r4.close() // Catch: java.lang.Exception -> L7a
|
||||
r2 = r3
|
||||
goto L9c
|
||||
L7a:
|
||||
r4 = move-exception
|
||||
r8 = r4
|
||||
r4 = r3
|
||||
r3 = r8
|
||||
goto L81
|
||||
L7f:
|
||||
r3 = move-exception
|
||||
r4 = 0
|
||||
L81:
|
||||
java.lang.String r5 = "GameActivityMain"
|
||||
java.lang.String r6 = "Error reading system file: %s (%s)"
|
||||
r7 = 2
|
||||
java.lang.Object[] r7 = new java.lang.Object[r7]
|
||||
java.lang.String r0 = r0.getAbsolutePath()
|
||||
r7[r2] = r0
|
||||
java.lang.String r0 = r3.getMessage()
|
||||
r7[r1] = r0
|
||||
java.lang.String r0 = java.lang.String.format(r6, r7)
|
||||
com.ea.ironmonkey.Log.e(r5, r0)
|
||||
r2 = r4
|
||||
L9c:
|
||||
java.lang.String r0 = "mem"
|
||||
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
||||
r1.<init>()
|
||||
java.lang.String r3 = "totalmemory="
|
||||
r1.append(r3)
|
||||
r1.append(r2)
|
||||
java.lang.String r1 = r1.toString()
|
||||
com.ea.ironmonkey.Log.d(r0, r1)
|
||||
return r2
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ea.ironmonkey.GameActivityMain.getTotalMemory():int");
|
||||
return 40000;
|
||||
}
|
||||
|
||||
public void openURL(String str) {
|
||||
@@ -1125,87 +1045,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
}
|
||||
|
||||
public float getPerformanceScore() {
|
||||
String readCpuFile = readCpuFile("present");
|
||||
int i = 0;
|
||||
float f = 0.0f;
|
||||
if (readCpuFile.length() > 0) {
|
||||
List<Integer> parseCpuList = parseCpuList(readCpuFile);
|
||||
Iterator<Integer> it = parseCpuList.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
if (readCpuFile(String.format("cpu%d/cpufreq/cpuinfo_max_freq", Integer.valueOf(it.next().intValue()))).length() > 0) {
|
||||
try {
|
||||
f = Integer.parseInt(r4) * 0.001f;
|
||||
break;
|
||||
} catch (NumberFormatException unused) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = parseCpuList.size();
|
||||
}
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
return calcPerformanceScore(f, i, displayMetrics.widthPixels, displayMetrics.heightPixels);
|
||||
}
|
||||
|
||||
public List<Integer> parseCpuList(String str) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (String str2 : str.split(",")) {
|
||||
if (str2.contains(Constants.FILENAME_SEQUENCE_SEPARATOR)) {
|
||||
String[] split = str2.split(Constants.FILENAME_SEQUENCE_SEPARATOR);
|
||||
if (split.length >= 2) {
|
||||
try {
|
||||
int parseInt = Integer.parseInt(split[1]);
|
||||
for (int parseInt2 = Integer.parseInt(split[0]); parseInt2 <= parseInt; parseInt2++) {
|
||||
arrayList.add(Integer.valueOf(parseInt2));
|
||||
}
|
||||
} catch (NumberFormatException unused) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
arrayList.add(Integer.valueOf(Integer.parseInt(str2)));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public String readCpuFile(String str) {
|
||||
File file = new File("/sys/devices/system/cpu", str);
|
||||
if (!file.exists()) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
|
||||
String readLine = bufferedReader.readLine();
|
||||
bufferedReader.close();
|
||||
return readLine;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, String.format("Error reading system file: %s (%s)", file.getAbsolutePath(), e.getMessage()));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public float calcPerformanceScore(float f, int i, int i2, int i3) {
|
||||
Log.i(TAG, "calcPerformanceScore(" + f + ", " + i + ", " + i2 + ", " + i3 + ")");
|
||||
float f2 = f * 0.001f;
|
||||
float f3 = (3.0f * f2) + 0.0f;
|
||||
if (i > 1) {
|
||||
f3 += f2 * (Math.min(i, 4) - 1) * 0.5f;
|
||||
}
|
||||
double d = 0.0f;
|
||||
double sqrt = Math.sqrt(i2 * i3) * 0.0010000000474974513d * 0.5d;
|
||||
Double.isNaN(d);
|
||||
float f4 = (float) (d + sqrt);
|
||||
try {
|
||||
Log.i(TAG, new BufferedReader(new FileReader(new File("/proc/cpuinfo"))).readLine());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.i(TAG, Build.MODEL);
|
||||
return ((f3 + 1.0f) / (f4 + 1.0f)) * 0.33333334f;
|
||||
return 6.6f;
|
||||
}
|
||||
|
||||
public boolean needInstallWallpaper() {
|
||||
@@ -1213,145 +1053,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:15:0x0068, code lost:
|
||||
|
||||
if (r3 != null) goto L13;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:16:0x006a, code lost:
|
||||
|
||||
r3.close();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:27:0x0099, code lost:
|
||||
|
||||
if (r3 != null) goto L13;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public void installWallpaper() {
|
||||
/*
|
||||
r12 = this;
|
||||
android.content.Intent r0 = new android.content.Intent
|
||||
java.lang.String r1 = "android.intent.action.VIEW"
|
||||
r0.<init>(r1)
|
||||
java.lang.String r1 = new java.lang.String
|
||||
java.lang.StringBuilder r2 = new java.lang.StringBuilder
|
||||
r2.<init>()
|
||||
java.io.File r3 = android.os.Environment.getExternalStorageDirectory()
|
||||
java.lang.String r3 = r3.getAbsolutePath()
|
||||
r2.append(r3)
|
||||
java.lang.String r3 = "/published/wallpaper/"
|
||||
r2.append(r3)
|
||||
java.lang.String r2 = r2.toString()
|
||||
r1.<init>(r2)
|
||||
r2 = 0
|
||||
java.io.File r3 = new java.io.File // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
|
||||
r3.<init>(r1) // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
|
||||
r3.mkdirs() // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
|
||||
android.content.res.Resources r3 = r12.getResources() // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
|
||||
r4 = 2131427328(0x7f0b0000, float:1.847627E38)
|
||||
android.content.res.AssetFileDescriptor r3 = r3.openRawResourceFd(r4) // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
|
||||
java.io.File r4 = new java.io.File // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
|
||||
java.lang.String r5 = "wallpaper.apk"
|
||||
r4.<init>(r1, r5) // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
|
||||
r4.createNewFile() // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
|
||||
java.io.FileInputStream r5 = r3.createInputStream() // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
|
||||
java.nio.channels.FileChannel r5 = r5.getChannel() // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
|
||||
java.io.FileOutputStream r6 = new java.io.FileOutputStream // Catch: java.lang.Throwable -> L73 java.io.IOException -> L8f
|
||||
r6.<init>(r4) // Catch: java.lang.Throwable -> L73 java.io.IOException -> L8f
|
||||
java.nio.channels.FileChannel r4 = r6.getChannel() // Catch: java.lang.Throwable -> L73 java.io.IOException -> L8f
|
||||
r8 = 0
|
||||
long r10 = r3.getLength() // Catch: java.lang.Throwable -> L6e java.io.IOException -> L71
|
||||
r6 = r4
|
||||
r7 = r5
|
||||
r6.transferFrom(r7, r8, r10) // Catch: java.lang.Throwable -> L6e java.io.IOException -> L71
|
||||
if (r4 == 0) goto L63
|
||||
r4.close() // Catch: java.io.IOException -> L9c
|
||||
L63:
|
||||
if (r5 == 0) goto L68
|
||||
r5.close() // Catch: java.io.IOException -> L9c
|
||||
L68:
|
||||
if (r3 == 0) goto L9c
|
||||
L6a:
|
||||
r3.close() // Catch: java.io.IOException -> L9c
|
||||
goto L9c
|
||||
L6e:
|
||||
r0 = move-exception
|
||||
r2 = r4
|
||||
goto L7d
|
||||
L71:
|
||||
r2 = r4
|
||||
goto L8f
|
||||
L73:
|
||||
r0 = move-exception
|
||||
goto L7d
|
||||
L75:
|
||||
r0 = move-exception
|
||||
r5 = r2
|
||||
goto L7d
|
||||
L78:
|
||||
r5 = r2
|
||||
goto L8f
|
||||
L7a:
|
||||
r0 = move-exception
|
||||
r3 = r2
|
||||
r5 = r3
|
||||
L7d:
|
||||
if (r2 == 0) goto L82
|
||||
r2.close() // Catch: java.io.IOException -> L8c
|
||||
L82:
|
||||
if (r5 == 0) goto L87
|
||||
r5.close() // Catch: java.io.IOException -> L8c
|
||||
L87:
|
||||
if (r3 == 0) goto L8c
|
||||
r3.close() // Catch: java.io.IOException -> L8c
|
||||
L8c:
|
||||
throw r0
|
||||
L8d:
|
||||
r3 = r2
|
||||
r5 = r3
|
||||
L8f:
|
||||
if (r2 == 0) goto L94
|
||||
r2.close() // Catch: java.io.IOException -> L9c
|
||||
L94:
|
||||
if (r5 == 0) goto L99
|
||||
r5.close() // Catch: java.io.IOException -> L9c
|
||||
L99:
|
||||
if (r3 == 0) goto L9c
|
||||
goto L6a
|
||||
L9c:
|
||||
java.io.File r2 = new java.io.File
|
||||
java.lang.StringBuilder r3 = new java.lang.StringBuilder
|
||||
r3.<init>()
|
||||
r3.append(r1)
|
||||
java.lang.String r1 = "wallpaper.apk"
|
||||
r3.append(r1)
|
||||
java.lang.String r1 = r3.toString()
|
||||
r2.<init>(r1)
|
||||
android.net.Uri r1 = android.net.Uri.fromFile(r2)
|
||||
java.lang.String r2 = "application/vnd.android.package-archive"
|
||||
r0.setDataAndType(r1, r2)
|
||||
r12.startActivity(r0)
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ea.ironmonkey.GameActivityMain.installWallpaper():void");
|
||||
}
|
||||
|
||||
public void onDownloadEvent(int i) {
|
||||
String str = getApplicationInfo().dataDir + "/files/var1/adcEvents";
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
Log.i(TAG, "GetADCTelemetry: eventId= " + i + " eventTime=" + currentTimeMillis + " fileName=" + str);
|
||||
byte[] bArr = {(byte) ((i >> 24) & 255), (byte) ((i >> 16) & 255), (byte) ((i >> 8) & 255), (byte) (i & 255), (byte) ((int) ((currentTimeMillis >> 56) & 255)), (byte) ((int) ((currentTimeMillis >> 48) & 255)), (byte) ((int) ((currentTimeMillis >> 40) & 255)), (byte) ((int) ((currentTimeMillis >> 32) & 255)), (byte) ((int) ((currentTimeMillis >> 24) & 255)), (byte) ((int) ((currentTimeMillis >> 16) & 255)), (byte) ((int) ((currentTimeMillis >> 8) & 255)), (byte) ((int) (currentTimeMillis & 255))};
|
||||
Log.i(TAG, "Write adcEvents file");
|
||||
try {
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(new File(str), true);
|
||||
fileOutputStream.write(bArr, 0, 12);
|
||||
fileOutputStream.close();
|
||||
} catch (Exception unused) {
|
||||
Log.i(TAG, "Can't save adcEvents file");
|
||||
}
|
||||
}
|
||||
public void installWallpaper() {}
|
||||
|
||||
public long getUtcTime() {
|
||||
return TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis());
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
import android.provider.Settings;
|
||||
import com.eamobile.licensing.ILicenseServerActivityCallback;
|
||||
import com.eamobile.licensing.LicenseServerActivity;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class GoogleDrm implements ILicenseServerActivityCallback {
|
||||
private GameActivityMain _activity;
|
||||
private String publicKey;
|
||||
|
||||
public boolean isEnable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public GoogleDrm(GameActivityMain gameActivityMain) {
|
||||
this._activity = gameActivityMain;
|
||||
this.publicKey = SkuConfig.NA_BASE64_PUBLIC_KEY;
|
||||
if (this._activity.getPackageName().endsWith("_row")) {
|
||||
this.publicKey = SkuConfig.ROW_BASE64_PUBLIC_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
public void start() {
|
||||
LicenseServerActivity.getInstance().initLicenseServerActivity(this._activity, this, this._activity, SkuConfig.SALT, this._activity.getPackageName(), this.publicKey, Settings.Secure.getString(this._activity.getContentResolver(), "android_id"));
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
LicenseServerActivity.getInstance().destroyLicenseServerActvity();
|
||||
}
|
||||
|
||||
/* JADX WARN: Unreachable blocks removed: 1, instructions: 2 */
|
||||
@Override // com.eamobile.licensing.ILicenseServerActivityCallback
|
||||
public void onLicenseResultStart() {
|
||||
GameActivityMain gameActivityMain = this._activity;
|
||||
LicenseServerActivity.getInstance().LastCheckPointCheck();
|
||||
GameActivityMain gameActivityMain2 = this._activity;
|
||||
gameActivityMain.onResult("GOOGL_DRM", -1);
|
||||
LicenseServerActivity.getInstance().destroyLicenseServerActvity();
|
||||
}
|
||||
|
||||
@Override // com.eamobile.licensing.ILicenseServerActivityCallback
|
||||
public void onLicenseResultEnd() {
|
||||
GameActivityMain gameActivityMain = this._activity;
|
||||
GameActivityMain gameActivityMain2 = this._activity;
|
||||
gameActivityMain.onResult("GOOGL_DRM", 0);
|
||||
LicenseServerActivity.getInstance().destroyLicenseServerActvity();
|
||||
}
|
||||
}
|
||||
@@ -1,489 +0,0 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Messenger;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import com.ea.games.nfs13_row.R;
|
||||
import com.google.android.vending.expansion.downloader.DownloadProgressInfo;
|
||||
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller;
|
||||
import com.google.android.vending.expansion.downloader.DownloaderServiceMarshaller;
|
||||
import com.google.android.vending.expansion.downloader.Helpers;
|
||||
import com.google.android.vending.expansion.downloader.IDownloaderClient;
|
||||
import com.google.android.vending.expansion.downloader.IDownloaderService;
|
||||
import com.google.android.vending.expansion.downloader.IStub;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ObbActivity extends Activity implements IDownloaderClient {
|
||||
static final String LOGTAG = "ObbActivity";
|
||||
static final int NOTIFICATION_ID = LOGTAG.hashCode();
|
||||
public static String PACKAGE_NAME;
|
||||
private View RLayout;
|
||||
private Button mCancel;
|
||||
private IStub mDownloaderClientStub;
|
||||
private TextView mMessageText;
|
||||
private View mMessageView;
|
||||
private Button mOK;
|
||||
private Button mPause;
|
||||
private TextView mProgressText;
|
||||
private TextView mProgressTextSmall;
|
||||
private View mProgressView;
|
||||
private IDownloaderService mRemoteService;
|
||||
private boolean mShowingMessage;
|
||||
private int mState;
|
||||
Bundle m_savedInstanceState;
|
||||
NotificationManager myNotificationManager;
|
||||
private boolean isFirstTime3GCheck = true;
|
||||
private boolean pausedFor3GCheck = false;
|
||||
private ProgressBar mProgressBar = null;
|
||||
private long m_TotalDownloadSize = 0;
|
||||
private boolean mIsDownloading = false;
|
||||
public ObbActivity mInstance = null;
|
||||
private boolean mhasFocus = false;
|
||||
private boolean ENABLE_LOG = true;
|
||||
private final Runnable HideSystemKeys = new Runnable() { // from class: com.ea.ironmonkey.ObbActivity.6
|
||||
@Override // java.lang.Runnable
|
||||
@TargetApi(18)
|
||||
public void run() {
|
||||
if (ObbActivity.this.isAtLeastAPI(19)) {
|
||||
ObbActivity.this.getWindow().getDecorView().setSystemUiVisibility(5894);
|
||||
} else {
|
||||
if (!ObbActivity.this.isAtLeastAPI(14) || (ObbActivity.this.getWindow().getDecorView().getSystemUiVisibility() & 1) == 1) {
|
||||
return;
|
||||
}
|
||||
ObbActivity.this.getWindow().getDecorView().setSystemUiVisibility(1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void setUpNotification() {
|
||||
}
|
||||
|
||||
public void startGameActivity() {
|
||||
try {
|
||||
startActivity(new Intent(this, (Class<?>) GameActivityMain.class));
|
||||
finish();
|
||||
} catch (Exception e) {
|
||||
logError(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void log(String str) {
|
||||
if (this.ENABLE_LOG) {
|
||||
android.util.Log.d(LOGTAG, str);
|
||||
}
|
||||
}
|
||||
|
||||
private void logError(String str) {
|
||||
if (this.ENABLE_LOG) {
|
||||
android.util.Log.e(LOGTAG, str);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
requestWindowFeature(1);
|
||||
super.onCreate(bundle);
|
||||
log("................onCreate of ObbActivity .............");
|
||||
getWindow().setFlags(1024, 1024);
|
||||
getWindow().addFlags(128);
|
||||
this.mInstance = this;
|
||||
setupUI();
|
||||
checkAndDownloadFilesIfNeeded();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onStart() {
|
||||
log("obbactivity onStart called ");
|
||||
super.onStart();
|
||||
if (this.mDownloaderClientStub != null) {
|
||||
this.mDownloaderClientStub.connect(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
log("obbactivity onResume called ");
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
log("obbactivity on Pause called");
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onStop() {
|
||||
log("obbactivity onStop called");
|
||||
if (this.mDownloaderClientStub != null) {
|
||||
log("..... disconnected the client stub .....");
|
||||
this.mDownloaderClientStub.disconnect(this);
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
log("obbactivity on Destroy called ");
|
||||
}
|
||||
|
||||
private void doTerminate(String str) {
|
||||
new AlertDialog.Builder(this.mInstance).setMessage(str).setPositiveButton("Ok", new DialogInterface.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.1
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
ObbActivity.this.mInstance.finish();
|
||||
System.exit(0);
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
public void checkAndDownloadFilesIfNeeded() {
|
||||
log("obbactivity checkAndDownloadFilesIfNeeded called ");
|
||||
if (expansionFilesDelivered(true)) {
|
||||
log("................Main.obb present and hence launching Game Activity................");
|
||||
startGameActivity();
|
||||
return;
|
||||
}
|
||||
log("................ Expansion files were not delivered ................");
|
||||
this.mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this, DownloaderService.class);
|
||||
startDownload();
|
||||
if (this.mIsDownloading) {
|
||||
return;
|
||||
}
|
||||
startGameActivity();
|
||||
}
|
||||
|
||||
public void setupUI() {
|
||||
setContentView(R.layout.downloader);
|
||||
this.mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
|
||||
this.mProgressText = (TextView) findViewById(R.id.statusText);
|
||||
this.mProgressTextSmall = (TextView) findViewById(R.id.progressText);
|
||||
this.mMessageText = (TextView) findViewById(R.id.messageText);
|
||||
this.mMessageView = findViewById(R.id.messageView);
|
||||
this.mProgressView = findViewById(R.id.progressView);
|
||||
this.mPause = (Button) findViewById(R.id.pauseButton);
|
||||
this.mOK = (Button) findViewById(R.id.okButton);
|
||||
this.mCancel = (Button) findViewById(R.id.cancelButton);
|
||||
this.mOK.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.2
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (ObbActivity.this.mState == 9 || ObbActivity.this.mState == 8) {
|
||||
ObbActivity.this.mRemoteService.setDownloadFlags(1);
|
||||
}
|
||||
if (ObbActivity.this.mRemoteService != null) {
|
||||
ObbActivity.this.mRemoteService.requestContinueDownload();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.mPause.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.3
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (ObbActivity.this.mRemoteService == null) {
|
||||
return;
|
||||
}
|
||||
if (7 == ObbActivity.this.mState) {
|
||||
ObbActivity.this.mRemoteService.requestContinueDownload();
|
||||
ObbActivity.this.mPause.setText(R.string.downloader_Pause);
|
||||
} else {
|
||||
ObbActivity.this.mRemoteService.requestPauseDownload();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.mCancel.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.ObbActivity.4
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (ObbActivity.this.mRemoteService != null) {
|
||||
ObbActivity.this.mRemoteService.requestAbortDownload();
|
||||
}
|
||||
ObbActivity.this.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.google.android.vending.expansion.downloader.IDownloaderClient
|
||||
public void onDownloadProgress(DownloadProgressInfo downloadProgressInfo) {
|
||||
log("Download Progress ...........!");
|
||||
if (this.isFirstTime3GCheck) {
|
||||
try {
|
||||
if (((ConnectivityManager) getSystemService("connectivity")).getNetworkInfo(0).isConnectedOrConnecting()) {
|
||||
this.isFirstTime3GCheck = false;
|
||||
if (this.mRemoteService != null) {
|
||||
this.pausedFor3GCheck = true;
|
||||
this.mRemoteService.requestPauseDownload();
|
||||
showMessage(getString(R.string.downloader_Confirm3GNetwork), R.string.downloader_Continue, R.string.downloader_Quit);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (Exception unused) {
|
||||
logError(".............................error at 3G check.............................");
|
||||
this.isFirstTime3GCheck = false;
|
||||
this.pausedFor3GCheck = false;
|
||||
}
|
||||
}
|
||||
if (this.m_TotalDownloadSize == 0) {
|
||||
this.m_TotalDownloadSize = downloadProgressInfo.mOverallTotal / 1048576;
|
||||
}
|
||||
this.mProgressBar.setMax((int) (downloadProgressInfo.mOverallTotal >> 8));
|
||||
this.mProgressBar.setProgress((int) (downloadProgressInfo.mOverallProgress >> 8));
|
||||
this.mProgressTextSmall.setText((downloadProgressInfo.mOverallProgress / 1048576) + " MB/ " + this.m_TotalDownloadSize + " MB");
|
||||
int parseInt = Integer.parseInt(Helpers.getDownloadProgressPercent(downloadProgressInfo.mOverallProgress, downloadProgressInfo.mOverallTotal).replaceAll("[\\D]", ""));
|
||||
if (parseInt >= 0 && parseInt < 25) {
|
||||
log("Download Progress 0 .. 25");
|
||||
this.mProgressText.setText(R.string.text_0_24);
|
||||
return;
|
||||
}
|
||||
if (parseInt >= 25 && parseInt < 50) {
|
||||
log("Download Progress 25 .. 49");
|
||||
this.mProgressText.setText(R.string.text_25_49);
|
||||
return;
|
||||
}
|
||||
if (parseInt >= 50 && parseInt < 75) {
|
||||
log("Download Progress 50 .. 75");
|
||||
this.mProgressText.setText(R.string.text_50_74);
|
||||
} else if (parseInt >= 75 && parseInt < 95) {
|
||||
log("Download Progress 75 .. 95");
|
||||
this.mProgressText.setText(R.string.text_75_99);
|
||||
} else {
|
||||
log("Download Progress 100 !");
|
||||
this.mProgressText.setText(R.string.text_100);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.android.vending.expansion.downloader.IDownloaderClient
|
||||
public void onDownloadStateChanged(int i) {
|
||||
if (this.mState != i) {
|
||||
log("onDownloadStateChanged newstate = " + i);
|
||||
this.mState = i;
|
||||
this.mProgressText.setText(Helpers.getDownloaderStringResourceIDFromState(i));
|
||||
boolean z = false;
|
||||
switch (i) {
|
||||
case 1:
|
||||
log(".............................STATE_IDLE.............................");
|
||||
hideMessage();
|
||||
z = true;
|
||||
this.mProgressBar.setIndeterminate(z);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
log(".............................STATE_CONNECTING/STATE_FETCHING_URL.............................");
|
||||
hideMessage();
|
||||
z = true;
|
||||
this.mProgressBar.setIndeterminate(z);
|
||||
break;
|
||||
case 4:
|
||||
log(".............................STATE_DOWNLOADING.............................");
|
||||
hideMessage();
|
||||
this.mProgressBar.setIndeterminate(z);
|
||||
break;
|
||||
case 5:
|
||||
log(".............................STATE_COMPLETED.............................");
|
||||
setUpNotification();
|
||||
this.mProgressTextSmall.setText(this.m_TotalDownloadSize + "/" + this.m_TotalDownloadSize + " MBs");
|
||||
this.mProgressText.setText(R.string.text_100);
|
||||
this.mProgressBar.setMax(1);
|
||||
this.mProgressBar.setProgress(1);
|
||||
disablePauseButton();
|
||||
hideMessage();
|
||||
this.mIsDownloading = false;
|
||||
startGameActivity();
|
||||
break;
|
||||
case 6:
|
||||
case 10:
|
||||
case 11:
|
||||
case 13:
|
||||
case 17:
|
||||
default:
|
||||
hideMessage();
|
||||
z = true;
|
||||
this.mProgressBar.setIndeterminate(z);
|
||||
break;
|
||||
case 7:
|
||||
log(".............................STATE_PAUSED_BY_REQUEST.............................");
|
||||
this.mPause.setText(R.string.downloader_Resume);
|
||||
if (!this.pausedFor3GCheck) {
|
||||
hideMessage();
|
||||
} else {
|
||||
this.pausedFor3GCheck = false;
|
||||
}
|
||||
this.mProgressBar.setIndeterminate(z);
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
log(".............................STATE_PAUSED_WIFI_DISABLED_NEED_CELLULAR_PERMISSION.............................");
|
||||
try {
|
||||
if (((ConnectivityManager) getSystemService("connectivity")).getNetworkInfo(0).isConnectedOrConnecting()) {
|
||||
this.isFirstTime3GCheck = false;
|
||||
if (this.mRemoteService != null) {
|
||||
showMessage(getString(R.string.downloader_Confirm3GNetwork), R.string.downloader_Continue, R.string.downloader_Quit);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit);
|
||||
}
|
||||
} catch (Exception unused) {
|
||||
this.isFirstTime3GCheck = false;
|
||||
logError(".............................error at 3G check.............................");
|
||||
showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit);
|
||||
}
|
||||
this.mProgressBar.setIndeterminate(z);
|
||||
break;
|
||||
case 12:
|
||||
case 14:
|
||||
log("............................STATE_PAUSED_ROAMING/STATE_PAUSED_SDCARD_UNAVAILABLE..............................");
|
||||
showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit);
|
||||
this.mProgressBar.setIndeterminate(z);
|
||||
break;
|
||||
case 15:
|
||||
log(".............................License check failed.............................");
|
||||
showMessage(getString(R.string.license_failed), R.string.downloader_Retry, R.string.downloader_Quit);
|
||||
this.mProgressBar.setIndeterminate(z);
|
||||
break;
|
||||
case 16:
|
||||
case 18:
|
||||
case 19:
|
||||
log(".............................STATE_FAILED.............................");
|
||||
showMessage(getString(Helpers.getDownloaderStringResourceIDFromState(i)), R.string.downloader_Retry, R.string.downloader_Quit);
|
||||
this.mProgressBar.setIndeterminate(z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.android.vending.expansion.downloader.IDownloaderClient
|
||||
public void onServiceConnected(Messenger messenger) {
|
||||
this.mRemoteService = DownloaderServiceMarshaller.CreateProxy(messenger);
|
||||
this.mRemoteService.onClientUpdated(this.mDownloaderClientStub.getMessenger());
|
||||
log("............................. onServiceConnected! .............................");
|
||||
}
|
||||
|
||||
boolean expansionFilesDelivered(boolean z) {
|
||||
String expansionAPKFileName = Helpers.getExpansionAPKFileName(this, z, getVersionCode());
|
||||
log("expansionFilesDelivered ... " + expansionAPKFileName + ".............................");
|
||||
long j = 0;
|
||||
try {
|
||||
InputStream open = getResources().getAssets().open("obb.size");
|
||||
if (open != null) {
|
||||
try {
|
||||
j = Long.parseLong(new BufferedReader(new InputStreamReader(open)).readLine());
|
||||
} catch (NumberFormatException e) {
|
||||
logError(e.getMessage());
|
||||
}
|
||||
open.close();
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
logError(e2.getMessage());
|
||||
}
|
||||
log("checking file " + expansionAPKFileName + " of expected size bytes " + Long.toString(j));
|
||||
if (!Helpers.doesFileExist(this, expansionAPKFileName, j, false)) {
|
||||
log("file " + expansionAPKFileName + "of expected size bytes " + j + "was NOT FOUND");
|
||||
return false;
|
||||
}
|
||||
log("EXPANSION FILE DELIVERED!");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void startDownload() {
|
||||
try {
|
||||
Intent intent = new Intent(this, (Class<?>) ObbActivity.class);
|
||||
intent.setFlags(335544320);
|
||||
if (DownloaderClientMarshaller.startDownloadServiceIfRequired(this, PendingIntent.getActivity(this, 0, intent, 134217728), (Class<?>) DownloaderService.class) != 0) {
|
||||
log(".............................Should start downloading!.............................");
|
||||
this.mIsDownloading = true;
|
||||
setRequestedOrientation(0);
|
||||
return;
|
||||
}
|
||||
log(".............................No download required!.............................");
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
logError(".............................Cannot find package " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void showMessage(String str, int i, int i2) {
|
||||
if (!this.mShowingMessage) {
|
||||
this.mMessageView.setVisibility(0);
|
||||
this.mProgressView.setVisibility(8);
|
||||
log("SHOW MESSAGE " + str + " b1: " + i + " b2: " + i2);
|
||||
this.mShowingMessage = true;
|
||||
}
|
||||
this.mMessageText.setText(str);
|
||||
this.mOK.setText(i);
|
||||
this.mCancel.setText(i2);
|
||||
}
|
||||
|
||||
public void hideMessage() {
|
||||
if (this.mShowingMessage) {
|
||||
this.mMessageView.setVisibility(8);
|
||||
this.mProgressView.setVisibility(0);
|
||||
this.mShowingMessage = false;
|
||||
}
|
||||
}
|
||||
|
||||
public int getVersionCode() {
|
||||
try {
|
||||
return getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||
} catch (PackageManager.NameNotFoundException unused) {
|
||||
logError(".............................Cannot read value in manifest. Expected android:versionCode.............................");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void disablePauseButton() {
|
||||
this.mPause.setClickable(false);
|
||||
}
|
||||
|
||||
@TargetApi(18)
|
||||
private void setupSystemUiVisibility() {
|
||||
if (isAtLeastAPI(19)) {
|
||||
getWindow().addFlags(33554432);
|
||||
getWindow().addFlags(134217728);
|
||||
}
|
||||
if (isAtLeastAPI(14)) {
|
||||
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { // from class: com.ea.ironmonkey.ObbActivity.5
|
||||
@Override // android.view.View.OnSystemUiVisibilityChangeListener
|
||||
public void onSystemUiVisibilityChange(int i) {
|
||||
if (ObbActivity.this.mhasFocus) {
|
||||
ObbActivity.this.onSystemUiVisibilityChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void onSystemUiVisibilityChanged() {
|
||||
((LinearLayout) findViewById(R.id.OBBLayout)).postDelayed(this.HideSystemKeys, 1000L);
|
||||
}
|
||||
|
||||
public boolean isAtLeastAPI(int i) {
|
||||
return Build.VERSION.SDK_INT >= i;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.Window.Callback
|
||||
public void onWindowFocusChanged(boolean z) {
|
||||
log("................onWindowFocusChanged to ............." + z);
|
||||
super.onWindowFocusChanged(z);
|
||||
this.mhasFocus = z;
|
||||
if (this.mhasFocus) {
|
||||
onSystemUiVisibilityChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
import android.content.Context;
|
||||
import com.google.android.vending.expansion.downloader.Helpers;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ObbHelper {
|
||||
@@ -9,6 +8,6 @@ class ObbHelper {
|
||||
}
|
||||
|
||||
public static String getObbFileName(Context context, int i) {
|
||||
return Helpers.getExpansionAPKFileName(context, true, i);
|
||||
return "main." + i + "." + context.getPackageName() + ".obb";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,39 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
import static android.os.Build.VERSION_CODES.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.KeyEvent;
|
||||
import com.ea.games.nfs13_row.R;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PermissionsActivity extends Activity {
|
||||
private static final int PERMISSIONS_REQUEST = 3;
|
||||
|
||||
protected void onCreate() {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
checkPermissions();
|
||||
} else {
|
||||
initActivity();
|
||||
}
|
||||
checkPermissions();
|
||||
}
|
||||
|
||||
public void checkPermissions() {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale(this, "android.permission.WRITE_EXTERNAL_STORAGE")) {
|
||||
showPermissionDialog(false);
|
||||
return;
|
||||
} else {
|
||||
requestSecurityPermissions();
|
||||
return;
|
||||
}
|
||||
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale(this, "android.permission.WRITE_EXTERNAL_STORAGE")) {
|
||||
showPermissionDialog(false);
|
||||
} else {
|
||||
requestSecurityPermissions();
|
||||
}
|
||||
initActivity();
|
||||
return;
|
||||
}
|
||||
initActivity();
|
||||
return;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
@@ -54,50 +49,41 @@ public class PermissionsActivity extends Activity {
|
||||
}
|
||||
|
||||
private void showPermissionDialog(final boolean z) {
|
||||
Context context = this;
|
||||
runOnUiThread(new Runnable() { // from class: com.ea.ironmonkey.PermissionsActivity.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(R.string.STR_PERMISSION_TEXT);
|
||||
builder.setPositiveButton(R.string.STR_PERMISSION_OK, new DialogInterface.OnClickListener() { // from class: com.ea.ironmonkey.PermissionsActivity.1.1
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if (!z) {
|
||||
PermissionsActivity.this.requestSecurityPermissions();
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS", Uri.parse("package:" + PermissionsActivity.this.getPackageName()));
|
||||
intent.addFlags(8388608);
|
||||
PermissionsActivity.this.startActivityForResult(intent, 3);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.STR_PERMISSION_CANCEL, new DialogInterface.OnClickListener() { // from class: com.ea.ironmonkey.PermissionsActivity.1.2
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
PermissionsActivity.this.finish();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setMessage("DIALOG");
|
||||
builder.setPositiveButton("OK", (dialogInterface, i) -> {
|
||||
if (!z) {
|
||||
PermissionsActivity.this.requestSecurityPermissions();
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS", Uri.parse("package:" + PermissionsActivity.this.getPackageName()));
|
||||
|
||||
PermissionsActivity.this.startActivityForResult(intent, 3);
|
||||
});
|
||||
|
||||
builder.setNegativeButton("DIALOG", (dialogInterface, i) -> PermissionsActivity.this.finish());
|
||||
AlertDialog create = builder.create();
|
||||
create.setCanceledOnTouchOutside(false);
|
||||
create.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.ea.ironmonkey.PermissionsActivity.1.3
|
||||
@Override // android.content.DialogInterface.OnKeyListener
|
||||
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
||||
if (i != 4) {
|
||||
return true;
|
||||
}
|
||||
PermissionsActivity.this.finish();
|
||||
dialogInterface.dismiss();
|
||||
create.setOnKeyListener((dialogInterface, i, keyEvent) -> {
|
||||
if (i != 4) {
|
||||
return true;
|
||||
}
|
||||
PermissionsActivity.this.finish();
|
||||
dialogInterface.dismiss();
|
||||
return true;
|
||||
});
|
||||
create.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void requestSecurityPermissions() {
|
||||
ActivityCompat.requestPermissions(this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 3);
|
||||
ActivityCompat.requestPermissions(this, new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 3);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
@@ -110,7 +96,9 @@ public class PermissionsActivity extends Activity {
|
||||
public void onActivityResult(int i, int i2, Intent intent) {
|
||||
super.onActivityResult(i, i2, intent);
|
||||
if (i == 3) {
|
||||
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") == 0) {
|
||||
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") == 0
|
||||
&& ContextCompat.checkSelfPermission(this, "android.permission.READ_EXTERNAL_STORAGE") == 0
|
||||
) {
|
||||
initActivity();
|
||||
return;
|
||||
} else {
|
||||
@@ -123,7 +111,7 @@ public class PermissionsActivity extends Activity {
|
||||
|
||||
private void initActivity() {
|
||||
try {
|
||||
startActivity(new Intent(this, (Class<?>) ObbActivity.class));
|
||||
startActivity(new Intent(this, GameActivityMain.class));
|
||||
finish();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SkuConfig {
|
||||
public static final String NA_BASE64_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsPSqZyfa7iZ9DOslXqDVPiyjsIjCCCDsp1x4pcuH9gFiivyVWhIAHrfMdLlg+6UmlbUoSyKwNRUKJA+H5N/L792/PewpOe2yXSvsqtdROJ12O34q8DPC2D7ezL8M/Io3bp9x18u/D5lf2PEQq4uBNEV1W1iK3PtsdWdpmNKMvnPDQXT3vciWdKa1R0g2xRHCXEK2Ft1Tlkx38ejAAmYvpvoP2e8IqnlwH2fz89G5nxnKdmGop1mz4KTZ8REmBCnmTb07fRkSd4N7S64W2zu8lktMUUbGvCmRbt4zE48AzXEWmyHNW+mqx+IUKyK5wHObnDM9RSwKLWsDe++rrGgROQIDAQAB";
|
||||
public static final String ROW_BASE64_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjDe1oWKcLp/Rtm1ezKa9G+fHdqKvWExNR1aYuudU5VGX9gTby6w8UPKLHXeWxuOq2mS2hWxjIXVsOanspXWJbnBaqydpXmNz+0qZ0K6VlEiL7YvVL9KHNpVAck1bz4toLrmrjM6E/RyphBl+3W5+XSGOJ4Z3dabuz/TQdgNlYAr9nd1NlLg8S2Pu1FsFygy79kpwKBDZFUiCTDwzmGgLSetFnOfr0NwC+NnF/bEB6gE3REcdtT0zyFj0SR8ZWIKRvRPu5BYXe9nKguLN0AUvshXm/MjhrxKmRWTjTTKZkax+f3zFut/yq8UDxMwGA15Ex60xkCcELgCcNPBrWdFDtQIDAQAB";
|
||||
public static final byte[] SALT = {13, -1, 23, -45, 11, -28, 56, -1, -14, 24, -12, 98, -13, 49, 11, 15, -27, 93, 86, -24};
|
||||
}
|
||||
@@ -5,6 +5,9 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
@@ -14,7 +17,6 @@ import javax.microedition.khronos.opengles.GL10;
|
||||
/* loaded from: classes.dex */
|
||||
public class SplashScreen {
|
||||
private static final String TAG = "SplashScreen";
|
||||
private static final int floatSize = 4;
|
||||
private Activity _activity;
|
||||
private int _attPosition;
|
||||
private int _attSampler;
|
||||
@@ -23,149 +25,231 @@ public class SplashScreen {
|
||||
private int _program;
|
||||
private int _vertexShader;
|
||||
private FloatBuffer vBuffer;
|
||||
private final String vShaderStr = "attribute vec4 a_position; \nattribute vec4 a_texCoord; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position = a_position; \n v_texCoord = a_texCoord.xy; \n} \n";
|
||||
private final String fShaderStr = "precision highp float; \nvarying vec2 v_texCoord; \nuniform sampler2D s_texture; \nvoid main() \n{ \n gl_FragColor = texture2D( s_texture, v_texCoord );\n} \n";
|
||||
|
||||
// Вершинный шейдер
|
||||
private final String vShaderStr =
|
||||
"attribute vec4 a_position; \n" +
|
||||
"attribute vec2 a_texCoord; \n" +
|
||||
"varying vec2 v_texCoord; \n" +
|
||||
"void main() { \n" +
|
||||
" gl_Position = a_position; \n" +
|
||||
" v_texCoord = a_texCoord; \n" +
|
||||
"} \n";
|
||||
|
||||
// Фрагментный шейдер
|
||||
private final String fShaderStr =
|
||||
"precision mediump float; \n" +
|
||||
"varying vec2 v_texCoord; \n" +
|
||||
"uniform sampler2D s_texture; \n" +
|
||||
"void main() { \n" +
|
||||
" gl_FragColor = texture2D(s_texture, v_texCoord); \n" +
|
||||
"} \n";
|
||||
|
||||
private int[] _textureId = new int[1];
|
||||
|
||||
public SplashScreen(Activity activity) {
|
||||
this._activity = activity;
|
||||
}
|
||||
|
||||
public void init(GL10 gl10, int i, int i2) {
|
||||
Bitmap bitmap;
|
||||
public void init(GL10 gl10, int width, int height) {
|
||||
if (!initRenderer()) {
|
||||
destroy(gl10);
|
||||
return;
|
||||
}
|
||||
GLES20.glGetError();
|
||||
GLES20.glGenTextures(1, this._textureId, 0);
|
||||
GLES20.glBindTexture(3553, this._textureId[0]);
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inPreferredConfig = Bitmap.Config.ARGB_4444;
|
||||
|
||||
// Загрузка текстуры
|
||||
GLES20.glGenTextures(1, _textureId, 0);
|
||||
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, _textureId[0]);
|
||||
|
||||
// Установка параметров текстуры
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
||||
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
|
||||
|
||||
// Загрузка изображения
|
||||
Bitmap bitmap = null;
|
||||
try {
|
||||
bitmap = BitmapFactory.decodeStream(this._activity.getAssets().open("splash.png"), null, options);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "loadBitmap ", e);
|
||||
bitmap = null;
|
||||
InputStream is = _activity.getAssets().open("splash.png");
|
||||
bitmap = BitmapFactory.decodeStream(is);
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Could not load bitmap", e);
|
||||
}
|
||||
GLUtils.texImage2D(3553, 0, bitmap, 0);
|
||||
GLES20.glTexParameterf(3553, 10241, 9729.0f);
|
||||
GLES20.glTexParameterf(3553, 10240, 9729.0f);
|
||||
GLES20.glTexParameterf(3553, 10242, 33071.0f);
|
||||
GLES20.glTexParameterf(3553, 10243, 33071.0f);
|
||||
bitmap.recycle();
|
||||
int glGetError = GLES20.glGetError();
|
||||
if (glGetError != 0) {
|
||||
Log.e(TAG, "Texture Load GLError: " + glGetError);
|
||||
|
||||
if (bitmap != null) {
|
||||
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
|
||||
bitmap.recycle();
|
||||
} else {
|
||||
Log.e(TAG, "Failed to load bitmap");
|
||||
destroy(gl10);
|
||||
return;
|
||||
}
|
||||
|
||||
// Проверка ошибок
|
||||
int error = GLES20.glGetError();
|
||||
if (error != GLES20.GL_NO_ERROR) {
|
||||
Log.e(TAG, "Texture Load GLError: " + error);
|
||||
destroy(gl10);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean initRenderer() {
|
||||
this._vertexShader = LoadShader(35633, "attribute vec4 a_position; \nattribute vec4 a_texCoord; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position = a_position; \n v_texCoord = a_texCoord.xy; \n} \n");
|
||||
this._fragmentShader = LoadShader(35632, "precision highp float; \nvarying vec2 v_texCoord; \nuniform sampler2D s_texture; \nvoid main() \n{ \n gl_FragColor = texture2D( s_texture, v_texCoord );\n} \n");
|
||||
this._program = GLES20.glCreateProgram();
|
||||
if (this._program == 0 || this._vertexShader == 0 || this._fragmentShader == 0) {
|
||||
Log.e(TAG, "InitRender() - fail\n");
|
||||
// Загрузка шейдеров
|
||||
_vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vShaderStr);
|
||||
_fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fShaderStr);
|
||||
|
||||
// Создание программы
|
||||
_program = GLES20.glCreateProgram();
|
||||
if (_program == 0) {
|
||||
Log.e(TAG, "Failed to create program");
|
||||
return false;
|
||||
}
|
||||
GLES20.glAttachShader(this._program, this._vertexShader);
|
||||
GLES20.glAttachShader(this._program, this._fragmentShader);
|
||||
GLES20.glLinkProgram(this._program);
|
||||
int[] iArr = new int[1];
|
||||
GLES20.glGetProgramiv(this._program, 35714, iArr, 0);
|
||||
if (iArr[0] == 0) {
|
||||
Log.e(TAG, "InitRender() - fail link program");
|
||||
Log.e(TAG, GLES20.glGetProgramInfoLog(this._program));
|
||||
GLES20.glDeleteProgram(this._program);
|
||||
this._program = 0;
|
||||
|
||||
// Прикрепление шейдеров
|
||||
GLES20.glAttachShader(_program, _vertexShader);
|
||||
GLES20.glAttachShader(_program, _fragmentShader);
|
||||
|
||||
// Линковка программы
|
||||
GLES20.glLinkProgram(_program);
|
||||
|
||||
// Проверка статуса линковки
|
||||
int[] linkStatus = new int[1];
|
||||
GLES20.glGetProgramiv(_program, GLES20.GL_LINK_STATUS, linkStatus, 0);
|
||||
if (linkStatus[0] != GLES20.GL_TRUE) {
|
||||
Log.e(TAG, "Could not link program: " + GLES20.glGetProgramInfoLog(_program));
|
||||
GLES20.glDeleteProgram(_program);
|
||||
_program = 0;
|
||||
return false;
|
||||
}
|
||||
this._attPosition = GLES20.glGetAttribLocation(this._program, "a_position");
|
||||
this._attTexCoord = GLES20.glGetAttribLocation(this._program, "a_texCoord");
|
||||
this._attSampler = GLES20.glGetAttribLocation(this._program, "s_texture");
|
||||
|
||||
// Получение атрибутов
|
||||
_attPosition = GLES20.glGetAttribLocation(_program, "a_position");
|
||||
_attTexCoord = GLES20.glGetAttribLocation(_program, "a_texCoord");
|
||||
_attSampler = GLES20.glGetUniformLocation(_program, "s_texture");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private int LoadShader(int i, String str) {
|
||||
int glCreateShader = GLES20.glCreateShader(i);
|
||||
if (glCreateShader == 0) {
|
||||
Log.e(TAG, "LoadShader(" + i + ", " + str + " - create shader fail\n");
|
||||
private int loadShader(int type, String shaderCode) {
|
||||
int shader = GLES20.glCreateShader(type);
|
||||
if (shader == 0) {
|
||||
Log.e(TAG, "Failed to create shader");
|
||||
return 0;
|
||||
}
|
||||
GLES20.glShaderSource(glCreateShader, str);
|
||||
GLES20.glCompileShader(glCreateShader);
|
||||
int[] iArr = new int[1];
|
||||
GLES20.glGetShaderiv(glCreateShader, 35713, iArr, 0);
|
||||
if (iArr[0] != 0) {
|
||||
return glCreateShader;
|
||||
|
||||
GLES20.glShaderSource(shader, shaderCode);
|
||||
GLES20.glCompileShader(shader);
|
||||
|
||||
// Проверка статуса компиляции
|
||||
int[] compiled = new int[1];
|
||||
GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
|
||||
if (compiled[0] == 0) {
|
||||
Log.e(TAG, "Could not compile shader: " + GLES20.glGetShaderInfoLog(shader));
|
||||
GLES20.glDeleteShader(shader);
|
||||
return 0;
|
||||
}
|
||||
Log.e(TAG, "LoadShader(" + i + ", " + str + ") - compile shader fail\n");
|
||||
GLES20.glDeleteShader(glCreateShader);
|
||||
Log.e(TAG, GLES20.glGetShaderInfoLog(glCreateShader));
|
||||
return 0;
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
public boolean draw(GL10 gl10, int i, int i2) {
|
||||
float f;
|
||||
if (this._textureId[0] == 0) {
|
||||
public boolean draw(GL10 gl10, int width, int height) {
|
||||
if (_textureId[0] == 0 || _program == 0) {
|
||||
return false;
|
||||
}
|
||||
float f2 = 0.8f;
|
||||
if (i > i2) {
|
||||
f2 = (i2 / i) * 0.8f;
|
||||
f = 0.8f;
|
||||
|
||||
// Расчет координат с уменьшением на 20%
|
||||
float ratio = (float) width / height;
|
||||
float imageRatio = 1.0f; // Предполагаем квадратное изображение
|
||||
|
||||
float scaleX, scaleY;
|
||||
if (ratio > imageRatio) {
|
||||
// Шире, чем изображение
|
||||
scaleY = 0.8f; // Уменьшаем на 20%
|
||||
scaleX = imageRatio / ratio * 0.8f;
|
||||
} else {
|
||||
f = (i / i2) * 0.8f;
|
||||
// Уже, чем изображение
|
||||
scaleX = 0.8f; // Уменьшаем на 20%
|
||||
scaleY = ratio / imageRatio * 0.8f;
|
||||
}
|
||||
float f3 = -f2;
|
||||
float f4 = -f;
|
||||
float[][] fArr = {new float[]{f3, f4, 0.0f, 1.0f, f2, f4, 1.0f, 1.0f, f3, f, 0.0f, 0.0f, f2, f, 1.0f, 0.0f}, new float[]{f3, f4, 1.0f, 1.0f, f2, f4, 1.0f, 0.0f, f3, f, 0.0f, 1.0f, f2, f, 0.0f, 0.0f}};
|
||||
this.vBuffer = ByteBuffer.allocateDirect(fArr[0].length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
||||
if (i < i2) {
|
||||
this.vBuffer.put(fArr[1]);
|
||||
} else {
|
||||
this.vBuffer.put(fArr[0]);
|
||||
}
|
||||
GLES20.glViewport(0, 0, i, i2);
|
||||
GLES20.glUseProgram(this._program);
|
||||
GLES20.glEnable(3553);
|
||||
GLES20.glActiveTexture(33984);
|
||||
GLES20.glBindTexture(3553, this._textureId[0]);
|
||||
GLES20.glUniform1i(this._attSampler, 0);
|
||||
this.vBuffer.position(0);
|
||||
GLES20.glVertexAttribPointer(this._attPosition, 2, 5126, false, 16, (Buffer) this.vBuffer);
|
||||
GLES20.glEnableVertexAttribArray(this._attPosition);
|
||||
this.vBuffer.position(2);
|
||||
GLES20.glVertexAttribPointer(this._attTexCoord, 2, 5126, false, 16, (Buffer) this.vBuffer);
|
||||
GLES20.glEnableVertexAttribArray(this._attTexCoord);
|
||||
GLES20.glDrawArrays(5, 0, 4);
|
||||
GLES20.glDisableVertexAttribArray(this._attPosition);
|
||||
GLES20.glDisableVertexAttribArray(this._attTexCoord);
|
||||
GLES20.glUseProgram(0);
|
||||
|
||||
// Координаты вершин и текстур
|
||||
float[] vertices = {
|
||||
-scaleX, -scaleY, 0.0f, // нижний левый
|
||||
scaleX, -scaleY, 0.0f, // нижний правый
|
||||
-scaleX, scaleY, 0.0f, // верхний левый
|
||||
scaleX, scaleY, 0.0f // верхний правый
|
||||
};
|
||||
|
||||
float[] texCoords = {
|
||||
0.0f, 1.0f, // нижний левый
|
||||
1.0f, 1.0f, // нижний правый
|
||||
0.0f, 0.0f, // верхний левый
|
||||
1.0f, 0.0f // верхний правый
|
||||
};
|
||||
|
||||
// Создание буферов
|
||||
ByteBuffer bb = ByteBuffer.allocateDirect(vertices.length * 4);
|
||||
bb.order(ByteOrder.nativeOrder());
|
||||
FloatBuffer vertexBuffer = bb.asFloatBuffer();
|
||||
vertexBuffer.put(vertices);
|
||||
vertexBuffer.position(0);
|
||||
|
||||
bb = ByteBuffer.allocateDirect(texCoords.length * 4);
|
||||
bb.order(ByteOrder.nativeOrder());
|
||||
FloatBuffer texBuffer = bb.asFloatBuffer();
|
||||
texBuffer.put(texCoords);
|
||||
texBuffer.position(0);
|
||||
|
||||
// Отрисовка с белым фоном
|
||||
GLES20.glViewport(0, 0, width, height);
|
||||
GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // Белый цвет
|
||||
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
GLES20.glUseProgram(_program);
|
||||
|
||||
// Передача вершин
|
||||
GLES20.glVertexAttribPointer(_attPosition, 3, GLES20.GL_FLOAT, false, 0, vertexBuffer);
|
||||
GLES20.glEnableVertexAttribArray(_attPosition);
|
||||
|
||||
// Передача текстурных координат
|
||||
GLES20.glVertexAttribPointer(_attTexCoord, 2, GLES20.GL_FLOAT, false, 0, texBuffer);
|
||||
GLES20.glEnableVertexAttribArray(_attTexCoord);
|
||||
|
||||
// Активация текстуры
|
||||
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
||||
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, _textureId[0]);
|
||||
GLES20.glUniform1i(_attSampler, 0);
|
||||
|
||||
// Отрисовка
|
||||
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
// Отключение атрибутов
|
||||
GLES20.glDisableVertexAttribArray(_attPosition);
|
||||
GLES20.glDisableVertexAttribArray(_attTexCoord);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void destroy(GL10 gl10) {
|
||||
if (this._textureId[0] != 0) {
|
||||
GLES20.glDeleteTextures(1, this._textureId, 0);
|
||||
this._textureId[0] = 0;
|
||||
if (_textureId[0] != 0) {
|
||||
GLES20.glDeleteTextures(1, _textureId, 0);
|
||||
_textureId[0] = 0;
|
||||
}
|
||||
if (this._program != 0) {
|
||||
GLES20.glDeleteProgram(this._program);
|
||||
this._program = 0;
|
||||
if (_program != 0) {
|
||||
GLES20.glDeleteProgram(_program);
|
||||
_program = 0;
|
||||
}
|
||||
if (this._vertexShader != 0) {
|
||||
GLES20.glDeleteShader(this._vertexShader);
|
||||
this._vertexShader = 0;
|
||||
if (_vertexShader != 0) {
|
||||
GLES20.glDeleteShader(_vertexShader);
|
||||
_vertexShader = 0;
|
||||
}
|
||||
if (this._fragmentShader != 0) {
|
||||
GLES20.glDeleteShader(this._fragmentShader);
|
||||
this._fragmentShader = 0;
|
||||
if (_fragmentShader != 0) {
|
||||
GLES20.glDeleteShader(_fragmentShader);
|
||||
_fragmentShader = 0;
|
||||
}
|
||||
if (this.vBuffer != null) {
|
||||
this.vBuffer.clear();
|
||||
this.vBuffer = null;
|
||||
if (vBuffer != null) {
|
||||
vBuffer.clear();
|
||||
vBuffer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.ea.games.nfs13_row.R;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class WebActivity extends Activity {
|
||||
public static String m_Language;
|
||||
private static volatile Runnable m_RunnableBuildAndShowHTML;
|
||||
public static String m_URL;
|
||||
public static boolean m_bWorkingState;
|
||||
private Bitmap backButton;
|
||||
private Bitmap backButtonPressed;
|
||||
private ImageView backImage;
|
||||
private String m_PageURL = null;
|
||||
private ProgressBar m_progressBar = null;
|
||||
final Handler progressHandler = new Handler() { // from class: com.ea.ironmonkey.WebActivity.1
|
||||
@Override // android.os.Handler
|
||||
public void handleMessage(Message message) {
|
||||
WebActivity.this.setProgress(message.arg1);
|
||||
WebActivity.this.m_progressBar.setProgress(message.arg1);
|
||||
}
|
||||
};
|
||||
private WebView webview;
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onCreate(Bundle bundle) {
|
||||
m_bWorkingState = true;
|
||||
super.onCreate(bundle);
|
||||
requestWindowFeature(2);
|
||||
getWindow().setFlags(1024, 1024);
|
||||
setRequestedOrientation(0);
|
||||
requestWindowFeature(1);
|
||||
setProgressBarVisibility(true);
|
||||
setContentView(R.layout.webview);
|
||||
this.webview = (WebView) findViewById(R.id.mainWebView);
|
||||
this.webview.getSettings().setJavaScriptEnabled(true);
|
||||
this.m_progressBar = (ProgressBar) findViewById(R.id.progressBarWeb);
|
||||
this.backButton = BitmapFactory.decodeResource(getResources(), R.drawable.btn_back);
|
||||
this.backButtonPressed = BitmapFactory.decodeResource(getResources(), R.drawable.btn_back_pressed);
|
||||
this.backImage = (ImageView) findViewById(R.id.backButton);
|
||||
this.backImage.setOnTouchListener(new View.OnTouchListener() { // from class: com.ea.ironmonkey.WebActivity.2
|
||||
@Override // android.view.View.OnTouchListener
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
if (motionEvent.getAction() == 0) {
|
||||
WebActivity.this.backImage.setImageBitmap(WebActivity.this.backButtonPressed);
|
||||
return false;
|
||||
}
|
||||
if (motionEvent.getAction() != 1) {
|
||||
return false;
|
||||
}
|
||||
WebActivity.this.backImage.setImageBitmap(WebActivity.this.backButton);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
this.backImage.setOnClickListener(new View.OnClickListener() { // from class: com.ea.ironmonkey.WebActivity.3
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
WebActivity.m_bWorkingState = false;
|
||||
WebActivity.this.finish();
|
||||
}
|
||||
});
|
||||
Bundle extras = getIntent().getExtras();
|
||||
String string = extras.getString("URL");
|
||||
this.m_PageURL = string;
|
||||
m_URL = string;
|
||||
String string2 = extras.getString("Language");
|
||||
m_Language = string2;
|
||||
if (string2 != null) {
|
||||
try {
|
||||
Configuration configuration = new Configuration(getResources().getConfiguration());
|
||||
configuration.locale = new Locale(string2);
|
||||
((TextView) findViewById(R.id.appName)).setText(new Resources(getResources().getAssets(), getResources().getDisplayMetrics(), configuration).getString(R.string.app_full_name));
|
||||
} catch (Throwable unused) {
|
||||
}
|
||||
}
|
||||
this.webview.setWebChromeClient(new WebChromeClient() { // from class: com.ea.ironmonkey.WebActivity.4
|
||||
@Override // android.webkit.WebChromeClient
|
||||
public void onProgressChanged(WebView webView, int i) {
|
||||
Message obtainMessage = WebActivity.this.progressHandler.obtainMessage();
|
||||
obtainMessage.arg1 = i;
|
||||
WebActivity.this.progressHandler.sendMessage(obtainMessage);
|
||||
}
|
||||
});
|
||||
this.webview.setWebViewClient(new WebViewClient() { // from class: com.ea.ironmonkey.WebActivity.5
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onPageFinished(WebView webView, String str) {
|
||||
WebActivity.this.m_progressBar.setVisibility(8);
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onReceivedError(WebView webView, int i, String str, String str2) {
|
||||
Toast.makeText(WebActivity.this, "Error ! " + str, 0).show();
|
||||
}
|
||||
});
|
||||
m_RunnableBuildAndShowHTML = new Runnable() { // from class: com.ea.ironmonkey.WebActivity.6
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
WebActivity.this.BuildAndShowHTML();
|
||||
}
|
||||
};
|
||||
runOnUiThread(m_RunnableBuildAndShowHTML);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void BuildAndShowHTML() {
|
||||
if (this.m_PageURL != null) {
|
||||
this.webview.loadUrl(this.m_PageURL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (i == 4) {
|
||||
this.backImage.setImageBitmap(this.backButtonPressed);
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyUp(int i, KeyEvent keyEvent) {
|
||||
if (i == 4) {
|
||||
this.backImage.setImageBitmap(this.backButton);
|
||||
m_bWorkingState = false;
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onKeyUp(i, keyEvent);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user