Перенос с маленькими правками

This commit is contained in:
2025-03-30 18:08:41 +03:00
parent 0134f6d689
commit 4b7a924752
544 changed files with 45301 additions and 0 deletions
@@ -0,0 +1,143 @@
package com.ea.ironmonkey;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
/* loaded from: classes.dex */
public class Accelerometer implements SensorEventListener {
private int bufferReadIndex;
private int bufferSize;
private int[] bufferTimesteps;
private float[] bufferValues;
private int bufferWriteIndex;
private long lastTimestamp = 0;
private int naturalOrientation;
private boolean registered;
private float samplesPerSecond;
private Sensor sensor;
private SensorManager sensorManager;
@Override // android.hardware.SensorEventListener
public void onAccuracyChanged(Sensor sensor, int i) {
}
public Accelerometer(SensorManager sensorManager, Sensor sensor, int i) {
this.sensorManager = sensorManager;
this.sensor = sensor;
this.naturalOrientation = i;
setBufferSize(1);
}
public void setFrequency(float f) {
this.samplesPerSecond = f;
register();
}
public float getFrequency() {
return this.samplesPerSecond;
}
public void setBufferSize(int i) {
this.bufferSize = i;
this.bufferTimesteps = new int[i];
this.bufferValues = new float[i * 3];
this.bufferWriteIndex = 0;
this.bufferReadIndex = 0;
}
public void updateOrientation(int i) {
this.naturalOrientation = i;
}
public int getBufferSize() {
return this.bufferSize;
}
public void pause() {
unregister();
}
public void resume() {
register();
}
private int getSensorDelay() {
return this.samplesPerSecond < 20.0f ? 3 : 1;
}
private void register() {
if (!this.registered && this.samplesPerSecond > 0.0f) {
this.sensorManager.registerListener(this, this.sensor, getSensorDelay());
this.registered = true;
} else if (this.registered && this.samplesPerSecond == 0.0f) {
this.sensorManager.unregisterListener(this);
this.registered = false;
}
}
private void unregister() {
if (this.registered) {
this.sensorManager.unregisterListener(this);
this.registered = false;
}
}
public int getSamples(int i, int[] iArr, float[] fArr) {
int i2;
synchronized (this) {
i2 = 0;
while (this.bufferReadIndex != this.bufferWriteIndex) {
if (this.bufferReadIndex >= this.bufferSize) {
this.bufferReadIndex = 0;
}
if (i2 >= i) {
break;
}
iArr[i2] = this.bufferTimesteps[this.bufferReadIndex];
for (int i3 = 0; i3 < 3; i3++) {
fArr[(i2 * 3) + i3] = this.bufferValues[(this.bufferReadIndex * 3) + i3];
}
i2++;
this.bufferReadIndex++;
}
}
return i2;
}
@Override // android.hardware.SensorEventListener
public void onSensorChanged(SensorEvent sensorEvent) {
int i = (int) ((sensorEvent.timestamp - this.lastTimestamp) / 1000000);
this.lastTimestamp = sensorEvent.timestamp;
synchronized (this) {
this.bufferWriteIndex++;
if (this.bufferWriteIndex >= this.bufferSize) {
this.bufferWriteIndex = 0;
}
if (this.bufferWriteIndex == this.bufferReadIndex) {
this.bufferReadIndex++;
}
this.bufferTimesteps[this.bufferWriteIndex] = i;
switch (this.naturalOrientation) {
case 0:
this.bufferValues[(this.bufferWriteIndex * 3) + 0] = -sensorEvent.values[0];
this.bufferValues[(this.bufferWriteIndex * 3) + 1] = sensorEvent.values[1];
break;
case 1:
this.bufferValues[(this.bufferWriteIndex * 3) + 0] = sensorEvent.values[1];
this.bufferValues[(this.bufferWriteIndex * 3) + 1] = -sensorEvent.values[0];
break;
case 2:
this.bufferValues[(this.bufferWriteIndex * 3) + 0] = sensorEvent.values[0];
this.bufferValues[(this.bufferWriteIndex * 3) + 1] = -sensorEvent.values[1];
break;
case 3:
this.bufferValues[(this.bufferWriteIndex * 3) + 0] = -sensorEvent.values[1];
this.bufferValues[(this.bufferWriteIndex * 3) + 1] = sensorEvent.values[0];
break;
}
this.bufferValues[(this.bufferWriteIndex * 3) + 2] = sensorEvent.values[2];
}
}
}
@@ -0,0 +1,61 @@
package com.ea.ironmonkey;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
/* loaded from: classes.dex */
public class BitmapGraphics {
private Bitmap bitmap;
private Canvas canvas = new Canvas();
public BitmapGraphics(int i, int i2) {
this.bitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
this.canvas.setBitmap(this.bitmap);
}
public Bitmap getBitmap() {
return this.bitmap;
}
public Canvas getCanvas() {
return this.canvas;
}
public void clear() {
this.canvas.drawColor(0, PorterDuff.Mode.CLEAR);
}
private static Paint createPaint(Typeface typeface, float f) {
Paint paint = new Paint();
paint.setTypeface(typeface);
paint.setTextSize(f);
paint.setColor(-1);
paint.setAntiAlias(true);
return paint;
}
public static Paint createPaintFromFamilyName(String str, float f) {
return createPaint(Typeface.create(str, 0), f);
}
public static Paint createPaintFromFile(String str, float f) {
return createPaint(internalCreateFromFile(str), f);
}
private static Typeface internalCreateFromFile(String str) {
if (GameActivityMain.instance.useAssetsFileSystem()) {
if (str.startsWith("/")) {
str = str.substring(1);
}
return Typeface.createFromAsset(GameActivityMain.instance.getAssetManager(), str);
}
return Typeface.createFromFile(str);
}
public void drawString(Paint paint, String str, int i, int i2) {
this.canvas.drawText(str, i, i2, paint);
}
}
@@ -0,0 +1,16 @@
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";
}
@@ -0,0 +1,19 @@
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();
}
}
@@ -0,0 +1,19 @@
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();
}
}
}
@@ -0,0 +1,8 @@
package com.ea.ironmonkey;
import javax.microedition.khronos.opengles.GL10;
/* loaded from: classes.dex */
public interface DrawFrameListener {
void onDrawFrame(GL10 gl10);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,223 @@
package com.ea.ironmonkey;
import android.opengl.GLSurfaceView;
import android.os.Build;
import android.view.MotionEvent;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
/* loaded from: classes.dex */
public class GameGLSurfaceView extends GLSurfaceView {
private static final String TAG = "GameGLSurfaceView";
private boolean enableHistoricalEvents;
private boolean kMotionEvent_GetSource;
private GameActivityMain mActivity;
/* JADX INFO: Access modifiers changed from: private */
public native void nativeTouchPadEvent(int i, int i2, float f, float f2);
/* JADX INFO: Access modifiers changed from: private */
public native void nativeTouchScreenEvent(int i, int i2, float f, float f2);
public GameGLSurfaceView(GameActivityMain gameActivityMain) {
super(gameActivityMain);
this.enableHistoricalEvents = false;
this.kMotionEvent_GetSource = false;
this.mActivity = null;
this.mActivity = gameActivityMain;
try {
MotionEvent.class.getMethod("getSource", new Class[0]);
this.kMotionEvent_GetSource = true;
} catch (Exception unused) {
}
setGLESVersion2();
setFocusable(true);
setFocusableInTouchMode(true);
if (Build.VERSION.SDK_INT >= 11) {
try {
Log.i(TAG, "setPreserveEGLContextOnPause");
getClass().getMethod("setPreserveEGLContextOnPause", Boolean.TYPE).invoke(this, false);
Log.e(TAG, "setPreserveEGLContextOnPause(false) success");
} catch (Exception unused2) {
Log.e(TAG, "setPreserveEGLContextOnPause failed");
}
}
}
public void setEnableHistoricalEvents(boolean z) {
this.enableHistoricalEvents = z;
}
private void setGLESVersion2() {
setEGLContextFactory(new GLSurfaceView.EGLContextFactory() { // from class: com.ea.ironmonkey.GameGLSurfaceView.1
private static final int EGL_CONTEXT_CLIENT_VERSION = 12440;
@Override // android.opengl.GLSurfaceView.EGLContextFactory
public EGLContext createContext(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig eGLConfig) {
return egl10.eglCreateContext(eGLDisplay, eGLConfig, EGL10.EGL_NO_CONTEXT, new int[]{EGL_CONTEXT_CLIENT_VERSION, 2, 12344});
}
@Override // android.opengl.GLSurfaceView.EGLContextFactory
public void destroyContext(EGL10 egl10, EGLDisplay eGLDisplay, EGLContext eGLContext) {
egl10.eglDestroyContext(eGLDisplay, eGLContext);
}
});
setEGLConfigChooser(new ConfigChooser(5, 6, 5, 0, 24, 0));
}
@Override // android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
GameActivityMain gameActivityMain = this.mActivity;
int i = GameActivityMain.state;
GameActivityMain gameActivityMain2 = this.mActivity;
if (i != 8) {
return true;
}
motionEvent.getHistorySize();
final int pointerCount = motionEvent.getPointerCount();
final MotionEvent obtain = MotionEvent.obtain(motionEvent);
queueEvent(new Runnable() { // from class: com.ea.ironmonkey.GameGLSurfaceView.2
@Override // java.lang.Runnable
public void run() {
int i2 = 0;
if (GameGLSurfaceView.this.kMotionEvent_GetSource) {
if (obtain.getSource() == 4098) {
if (obtain.getAction() == 2) {
while (i2 < pointerCount) {
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2));
i2++;
}
return;
} else {
int actionIndex = obtain.getActionIndex();
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(actionIndex), obtain.getX(actionIndex), obtain.getY(actionIndex));
return;
}
}
if (obtain.getSource() == 1048584) {
if (obtain.getAction() == 2) {
while (i2 < pointerCount) {
GameGLSurfaceView.this.nativeTouchPadEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2));
i2++;
}
return;
} else {
int actionIndex2 = obtain.getActionIndex();
GameGLSurfaceView.this.nativeTouchPadEvent(obtain.getAction(), obtain.getPointerId(actionIndex2), obtain.getX(actionIndex2), obtain.getY(actionIndex2));
return;
}
}
return;
}
if (obtain.getAction() == 2) {
while (i2 < pointerCount) {
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2));
i2++;
}
} else {
int actionIndex3 = obtain.getActionIndex();
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(actionIndex3), obtain.getX(actionIndex3), obtain.getY(actionIndex3));
}
}
});
return true;
}
private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
private static final int EGL_DEPTH_ENCODING_NONLINEAR_NV = 12515;
private static final int EGL_DEPTH_ENCODING_NV = 12514;
protected int mAlphaSize;
protected int mBlueSize;
protected int mDepthSize;
protected int mGreenSize;
protected int mRedSize;
protected int mStencilSize;
private int[] mValue = new int[1];
public ConfigChooser(int i, int i2, int i3, int i4, int i5, int i6) {
this.mRedSize = i;
this.mGreenSize = i2;
this.mBlueSize = i3;
this.mAlphaSize = i4;
this.mDepthSize = i5;
this.mStencilSize = i6;
}
@Override // android.opengl.GLSurfaceView.EGLConfigChooser
public EGLConfig chooseConfig(EGL10 egl10, EGLDisplay eGLDisplay) {
int[] iArr = {12352, 4, 12324, 4, 12323, 4, 12322, 4, 12344};
int[] iArr2 = new int[1];
egl10.eglChooseConfig(eGLDisplay, iArr, null, 0, iArr2);
int i = iArr2[0];
if (i <= 0) {
throw new IllegalArgumentException("No configs match configSpec");
}
EGLConfig[] eGLConfigArr = new EGLConfig[i];
egl10.eglChooseConfig(eGLDisplay, iArr, eGLConfigArr, i, iArr2);
return chooseConfig(egl10, eGLDisplay, eGLConfigArr);
}
public EGLConfig chooseConfig(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig[] eGLConfigArr) {
EGLConfig eGLConfig = null;
while (true) {
int i = 0;
if (eGLConfig == null) {
int length = eGLConfigArr.length;
while (true) {
if (i >= length) {
break;
}
EGLConfig eGLConfig2 = eGLConfigArr[i];
int findConfigAttrib = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12325, 0);
int findConfigAttrib2 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12326, 0);
if (findConfigAttrib >= this.mDepthSize && findConfigAttrib2 >= this.mStencilSize) {
int findConfigAttrib3 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12324, 0);
int findConfigAttrib4 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12323, 0);
int findConfigAttrib5 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12322, 0);
int findConfigAttrib6 = findConfigAttrib(egl10, eGLDisplay, eGLConfig2, 12321, 0);
if (findConfigAttrib3 == this.mRedSize && findConfigAttrib4 == this.mGreenSize && findConfigAttrib5 == this.mBlueSize && findConfigAttrib6 == this.mAlphaSize) {
if (findConfigAttrib(egl10, eGLDisplay, eGLConfig2, EGL_DEPTH_ENCODING_NV, 0) == 0) {
eGLConfig = eGLConfig2;
break;
}
eGLConfig = eGLConfig2;
}
}
i++;
}
if (eGLConfig == null) {
if (this.mDepthSize <= 0) {
return null;
}
this.mDepthSize -= 8;
}
} else {
StringBuilder sb = new StringBuilder();
sb.append("depth=");
EGLConfig eGLConfig3 = eGLConfig;
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12325, 0));
sb.append(" stencil=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12326, 0));
sb.append(" red=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12324, 0));
sb.append(" green=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12323, 0));
sb.append(" blue=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12322, 0));
sb.append(" alpha=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, 12321, 0));
sb.append(" nonLinear=");
sb.append(findConfigAttrib(egl10, eGLDisplay, eGLConfig3, EGL_DEPTH_ENCODING_NV, 0) == EGL_DEPTH_ENCODING_NONLINEAR_NV);
Log.i(GameGLSurfaceView.TAG, sb.toString());
return eGLConfig;
}
}
}
private int findConfigAttrib(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig eGLConfig, int i, int i2) {
return egl10.eglGetConfigAttrib(eGLDisplay, eGLConfig, i, this.mValue) ? this.mValue[0] : i2;
}
}
}
@@ -0,0 +1,54 @@
package com.ea.ironmonkey;
import android.opengl.GLSurfaceView;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
/* loaded from: classes.dex */
public class GameRenderer implements GLSurfaceView.Renderer {
static GL10 _gl;
private int _height;
private int _width;
private GameActivityMain activity;
private DrawFrameListener drawFrameListener;
public GameRenderer(GameActivityMain gameActivityMain) {
this.activity = gameActivityMain;
}
public void setDrawFrameListener(DrawFrameListener drawFrameListener) {
this.drawFrameListener = drawFrameListener;
}
public int getWidth() {
return this._width;
}
public int getHeight() {
return this._height;
}
@Override // android.opengl.GLSurfaceView.Renderer
public void onSurfaceCreated(GL10 gl10, EGLConfig eGLConfig) {
this.activity.nativeSurfaceCreated(gl10, eGLConfig);
}
@Override // android.opengl.GLSurfaceView.Renderer
public void onSurfaceChanged(GL10 gl10, int i, int i2) {
if (gl10 != _gl) {
this.activity.nativeSurfaceChanged(gl10, i, i2);
_gl = gl10;
}
this._width = i;
this._height = i2;
}
@Override // android.opengl.GLSurfaceView.Renderer
public void onDrawFrame(GL10 gl10) {
if (this.drawFrameListener != null) {
this.drawFrameListener.onDrawFrame(gl10);
} else {
this.activity.getRunLoop().onRunLoopTick();
}
}
}
@@ -0,0 +1,49 @@
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();
}
}
@@ -0,0 +1,46 @@
package com.ea.ironmonkey;
/* loaded from: classes.dex */
public class Log {
private static boolean enable;
public static void setEnable(boolean z) {
enable = z;
}
public static void i(String str, String str2) {
if (enable) {
android.util.Log.i(str, str2);
}
}
public static void e(String str, String str2) {
if (enable) {
android.util.Log.e(str, str2);
}
}
public static void w(String str, String str2) {
if (enable) {
android.util.Log.w(str, str2);
}
}
public static void d(String str, String str2) {
if (enable) {
android.util.Log.d(str, str2);
}
}
public static void v(String str, String str2) {
if (enable) {
android.util.Log.v(str, str2);
}
}
public static void e(String str, String str2, Exception exc) {
if (enable) {
android.util.Log.e(str, str2, exc);
}
}
}
@@ -0,0 +1,30 @@
package com.ea.ironmonkey;
import com.bda.controller.ControllerListener;
import com.bda.controller.KeyEvent;
import com.bda.controller.MotionEvent;
import com.bda.controller.StateEvent;
/* loaded from: classes.dex */
public class MogaController implements ControllerListener {
native void nativeOnKeyEvent(KeyEvent keyEvent);
native void nativeOnMotionEvent(MotionEvent motionEvent);
native void nativeOnStateEvent(StateEvent stateEvent);
@Override // com.bda.controller.ControllerListener
public void onKeyEvent(KeyEvent keyEvent) {
nativeOnKeyEvent(keyEvent);
}
@Override // com.bda.controller.ControllerListener
public void onMotionEvent(MotionEvent motionEvent) {
nativeOnMotionEvent(motionEvent);
}
@Override // com.bda.controller.ControllerListener
public void onStateEvent(StateEvent stateEvent) {
nativeOnStateEvent(stateEvent);
}
}
@@ -0,0 +1,489 @@
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();
}
}
}
@@ -0,0 +1,14 @@
package com.ea.ironmonkey;
import android.content.Context;
import com.google.android.vending.expansion.downloader.Helpers;
/* loaded from: classes.dex */
class ObbHelper {
ObbHelper() {
}
public static String getObbFileName(Context context, int i) {
return Helpers.getExpansionAPKFileName(context, true, i);
}
}
@@ -0,0 +1,132 @@
package com.ea.ironmonkey;
import android.app.Activity;
import android.app.AlertDialog;
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;
/* 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();
}
}
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;
}
}
initActivity();
return;
}
initActivity();
}
@Override // android.app.Activity
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
if (i != 3) {
return;
}
if (iArr.length == 1 && iArr[0] == 0) {
initActivity();
} else {
showPermissionDialog(true);
}
}
private void showPermissionDialog(final boolean z) {
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 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();
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);
}
@Override // android.app.Activity
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
onCreate();
}
@Override // android.app.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) {
initActivity();
return;
} else {
showPermissionDialog(true);
return;
}
}
initActivity();
}
private void initActivity() {
try {
startActivity(new Intent(this, (Class<?>) ObbActivity.class));
finish();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,57 @@
package com.ea.ironmonkey;
import android.opengl.GLSurfaceView;
/* loaded from: classes.dex */
public class RunLoop {
public static final int STATE_RUNNING = 1;
public static final int STATE_STOPPED = 0;
private GLSurfaceView glSurfaceView;
private int state;
private native void nativeOnRunLoopTick();
public RunLoop(GLSurfaceView gLSurfaceView) {
this.glSurfaceView = gLSurfaceView;
updateRenderMode();
}
public int getState() {
return this.state;
}
public void start() {
setState(1);
}
public void stop() {
setState(0);
}
public void join() {
setState(0);
}
private void setState(int i) {
this.state = i;
updateRenderMode();
}
private void updateRenderMode() {
Log.v("RunLoop", "RunLoop.state = " + this.state);
switch (this.state) {
case 0:
this.glSurfaceView.setRenderMode(0);
break;
case 1:
this.glSurfaceView.setRenderMode(1);
break;
}
}
public void onRunLoopTick() {
if (this.state == 1) {
nativeOnRunLoopTick();
}
}
}
@@ -0,0 +1,8 @@
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};
}
@@ -0,0 +1,171 @@
package com.ea.ironmonkey;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLES20;
import android.opengl.GLUtils;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
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;
private int _attTexCoord;
private int _fragmentShader;
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 int[] _textureId = new int[1];
public SplashScreen(Activity activity) {
this._activity = activity;
}
public void init(GL10 gl10, int i, int i2) {
Bitmap bitmap;
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;
try {
bitmap = BitmapFactory.decodeStream(this._activity.getAssets().open("splash.png"), null, options);
} catch (Exception e) {
Log.e(TAG, "loadBitmap ", e);
bitmap = null;
}
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);
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");
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;
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");
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");
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;
}
Log.e(TAG, "LoadShader(" + i + ", " + str + ") - compile shader fail\n");
GLES20.glDeleteShader(glCreateShader);
Log.e(TAG, GLES20.glGetShaderInfoLog(glCreateShader));
return 0;
}
public boolean draw(GL10 gl10, int i, int i2) {
float f;
if (this._textureId[0] == 0) {
return false;
}
float f2 = 0.8f;
if (i > i2) {
f2 = (i2 / i) * 0.8f;
f = 0.8f;
} else {
f = (i / i2) * 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);
return true;
}
public void destroy(GL10 gl10) {
if (this._textureId[0] != 0) {
GLES20.glDeleteTextures(1, this._textureId, 0);
this._textureId[0] = 0;
}
if (this._program != 0) {
GLES20.glDeleteProgram(this._program);
this._program = 0;
}
if (this._vertexShader != 0) {
GLES20.glDeleteShader(this._vertexShader);
this._vertexShader = 0;
}
if (this._fragmentShader != 0) {
GLES20.glDeleteShader(this._fragmentShader);
this._fragmentShader = 0;
}
if (this.vBuffer != null) {
this.vBuffer.clear();
this.vBuffer = null;
}
}
}
@@ -0,0 +1,149 @@
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);
}
}