- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
1435 lines
56 KiB
Java
1435 lines
56 KiB
Java
package com.firemint.realracing;
|
|
|
|
import android.annotation.TargetApi;
|
|
import android.app.AlertDialog;
|
|
import android.app.UiModeManager;
|
|
import android.content.Context;
|
|
import android.content.DialogInterface;
|
|
import android.content.Intent;
|
|
import android.content.res.Configuration;
|
|
import android.database.ContentObserver;
|
|
import android.media.AudioManager;
|
|
import android.net.Uri;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.Environment;
|
|
import android.os.Handler;
|
|
import android.os.StrictMode;
|
|
import android.provider.Settings;
|
|
import android.util.Log;
|
|
import android.view.DisplayCutout;
|
|
import android.view.KeyEvent;
|
|
import android.view.LayoutInflater;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.WindowInsets;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.TextView;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.core.app.ActivityCompat;
|
|
import androidx.core.content.ContextCompat;
|
|
import com.ea.eadp.pushnotification.forwarding.FCMMessageService;
|
|
import com.ea.nimble.Global;
|
|
import com.firemint.realracing.CheatView;
|
|
import com.firemonkeys.cloudcellapi.CC_Activity;
|
|
import com.firemonkeys.cloudcellapi.CC_Component;
|
|
import com.google.android.gms.tasks.OnCompleteListener;
|
|
import com.google.android.gms.tasks.Task;
|
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
|
import com.google.firebase.installations.FirebaseInstallations;
|
|
import com.google.firebase.installations.InstallationTokenResult;
|
|
import com.google.firebase.perf.FirebasePerformance;
|
|
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
|
|
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class MainActivity extends CC_Activity {
|
|
public static final int ANDROID_ORIENTATION_LANDSCAPE = 2;
|
|
public static final int ANDROID_ORIENTATION_PORTRAIT = 1;
|
|
public static final int ANDROID_ORIENTATION_UNDEFINED = 0;
|
|
public static final int ANDROID_ROTATION_0 = 0;
|
|
public static final int ANDROID_ROTATION_180 = 2;
|
|
public static final int ANDROID_ROTATION_270 = 3;
|
|
public static final int ANDROID_ROTATION_90 = 1;
|
|
public static final String APPLICATION_LIB_NAME = "RealRacing3";
|
|
public static final int ButtonId_NEGATIVE = 1;
|
|
public static final int ButtonId_NEUTRAL = 2;
|
|
public static final int ButtonId_POSITIVE = 0;
|
|
public static final int GAMESTATE_CREATED = 1;
|
|
public static final int GAMESTATE_DESTROYED = 6;
|
|
public static final int GAMESTATE_NONE = 0;
|
|
public static final int GAMESTATE_NOSTORAGE = 5;
|
|
public static final int GAMESTATE_RUNNING = 3;
|
|
public static final int GAMESTATE_STARTED = 2;
|
|
public static final int GAMESTATE_STOPPED = 4;
|
|
public static final String LOG_TAG = "RealRacing3";
|
|
static final int PERMISSIONS_CAMERA_REQUEST = 2;
|
|
static final int PERMISSION_POST_NOTIFICATIONS_REQUEST = 3;
|
|
static final int PERMISSION_STORAGE_REQUEST = 0;
|
|
static final int PICTURE_DIR_REQUEST = 1;
|
|
static final int WIFI_SETTINGS = 329418467;
|
|
public static MainActivity instance;
|
|
public static boolean m_WIFISettingsShown;
|
|
private static boolean m_bIsAmazon;
|
|
private static boolean m_bIsAndroidTv;
|
|
static boolean s_bRunStrictMode;
|
|
public Handler handler;
|
|
private FirebaseAnalytics mFirebaseAnalytics;
|
|
public FirebaseRemoteConfig mFirebaseRemoteConfig;
|
|
public ControllerManager m_controllerManager = null;
|
|
private HeadphoneBroadcastReceiver m_headphoneBroadcastReceiver = null;
|
|
private DisplayCutout m_displayCutout = null;
|
|
private boolean m_paused = false;
|
|
private boolean m_hasFocus = false;
|
|
private boolean m_delayedResumeJNI = false;
|
|
private boolean m_skipOnDestroyJNI = false;
|
|
private String m_sLoadingString = "";
|
|
private View m_splashView = null;
|
|
private View m_loadingView = null;
|
|
private GLView m_glView = null;
|
|
private FrameLayout m_frameLayout = null;
|
|
private PauseRunnable m_pauseRunnable = null;
|
|
private CheatView m_cheatView = null;
|
|
private CheatView m_keyboardView = null;
|
|
private String m_cheatText = "";
|
|
private String m_keyboardText = "";
|
|
private long m_cheatPtr = 0;
|
|
private long m_keyboardPtr = 0;
|
|
private int m_keyboardInputMaxLength = 0;
|
|
private boolean m_keyboardInputUppercaseOnly = false;
|
|
private boolean m_keyboardInputAlphaNumericOnly = false;
|
|
private AudioStreamManager m_audioStreamManager = new AudioStreamManager();
|
|
private NimbleManager m_nimbleManager = new NimbleManager();
|
|
private int m_gameState = 0;
|
|
int oldGameState = 0;
|
|
public Message m_message = null;
|
|
|
|
public static boolean ExactlyAPI(int i) {
|
|
return Build.VERSION.SDK_INT == i;
|
|
}
|
|
|
|
public static boolean IsAtLeastAPI(int i) {
|
|
return Build.VERSION.SDK_INT >= i;
|
|
}
|
|
|
|
public static boolean IsBelowAPI(int i) {
|
|
return Build.VERSION.SDK_INT < i;
|
|
}
|
|
|
|
public static boolean getIsAmazon() {
|
|
return m_bIsAmazon;
|
|
}
|
|
|
|
public static boolean getIsAndroidTv() {
|
|
return m_bIsAndroidTv;
|
|
}
|
|
|
|
private boolean isMenuBackKey(int i) {
|
|
return i == 4 || i == 82;
|
|
}
|
|
|
|
private boolean isVolumeKey(int i) {
|
|
return i == 24 || i == 25;
|
|
}
|
|
|
|
public static void logi(String str) {
|
|
}
|
|
|
|
public native void HandleIntent(Intent intent);
|
|
|
|
public boolean HasDisplayCutout() {
|
|
return this.m_displayCutout != null;
|
|
}
|
|
|
|
public void OnMessageDismissed(Message message) {
|
|
if (message == this.m_message) {
|
|
this.m_message = null;
|
|
}
|
|
}
|
|
|
|
public native void SSExperimentalHoldAndWaitJNI();
|
|
|
|
public native void SetRunningOnAndroidTv(boolean z);
|
|
|
|
public native void alertMessageExecuteCallback(long j);
|
|
|
|
public native boolean checkMemoryJNI();
|
|
|
|
public int getApiLevel() {
|
|
return Build.VERSION.SDK_INT;
|
|
}
|
|
|
|
public FirebaseAnalytics getFirebaseAnalyticsInstance() {
|
|
return this.mFirebaseAnalytics;
|
|
}
|
|
|
|
public FirebaseRemoteConfig getFirebaseRemoteConfigInstance() {
|
|
return this.mFirebaseRemoteConfig;
|
|
}
|
|
|
|
public FrameLayout getFrameLayout() {
|
|
return this.m_frameLayout;
|
|
}
|
|
|
|
public GLView getGLView() {
|
|
return this.m_glView;
|
|
}
|
|
|
|
public boolean getPaused() {
|
|
return this.m_paused;
|
|
}
|
|
|
|
public native boolean isLegalUsageEnabled();
|
|
|
|
public boolean isSystemKey(int i) {
|
|
if (i == 3 || i == 91 || i == 5 || i == 6) {
|
|
return true;
|
|
}
|
|
switch (i) {
|
|
case 24:
|
|
case 25:
|
|
case 26:
|
|
case 27:
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public native void onCheatInputDone(String str, long j);
|
|
|
|
public native void onConfigurationChangedJNI();
|
|
|
|
public native void onCreateJNI();
|
|
|
|
public native void onDestroyJNI();
|
|
|
|
public native void onFirebaseAuthTokenFetched(String str);
|
|
|
|
public native void onFirebaseRemoteConfigFetched(boolean z);
|
|
|
|
public native void onKeyPressed(int i);
|
|
|
|
public native void onKeyReleased(int i);
|
|
|
|
public native void onKeyboardInputDone(String str, long j);
|
|
|
|
public native void onKeyboardInputUpdate(String str, long j);
|
|
|
|
public native void onPauseJNI();
|
|
|
|
public native void onRecievedMemoryWarningJNI();
|
|
|
|
public native void onResumeJNI();
|
|
|
|
public native void onStartJNI();
|
|
|
|
public native void onStopJNI();
|
|
|
|
public native void onTouchBeginJNI(int i, float f, float f2);
|
|
|
|
public native void onTouchCancelJNI();
|
|
|
|
public native void onTouchEndJNI(int i, float f, float f2, boolean z);
|
|
|
|
public native void onTouchMoveJNI(int i, float f, float f2);
|
|
|
|
public native void onViewChangedJNI(int i, int i2, int i3, int i4);
|
|
|
|
public native void onViewCreatedJNI();
|
|
|
|
public native void onViewRenderJNI(int i, int i2);
|
|
|
|
public native void onWindowFocusChangedJNI(boolean z);
|
|
|
|
public native void permissionRequestCompleted(boolean z);
|
|
|
|
public native void setBackgroundLaunchURL(String str, String str2, boolean z);
|
|
|
|
public native void setLaunchURL(String str);
|
|
|
|
public native void setMusicEnabled(boolean z);
|
|
|
|
public native void setSafeArea(int i, int i2);
|
|
|
|
static {
|
|
System.loadLibrary(Global.NIMBLE_ID);
|
|
System.loadLibrary("fmodex");
|
|
System.loadLibrary("RealRacing3");
|
|
instance = null;
|
|
m_bIsAmazon = false;
|
|
m_bIsAndroidTv = false;
|
|
s_bRunStrictMode = false;
|
|
m_WIFISettingsShown = false;
|
|
}
|
|
|
|
public void RunOnGlThread(Runnable runnable) {
|
|
getGLView().queueEvent(runnable);
|
|
}
|
|
|
|
public void showLoadingSplash(String str) {
|
|
this.m_sLoadingString = str;
|
|
runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (MainActivity.this.m_frameLayout == null || MainActivity.this.m_frameLayout.indexOfChild(MainActivity.this.m_splashView) >= 0) {
|
|
return;
|
|
}
|
|
MainActivity.this.m_frameLayout.addView(MainActivity.this.m_splashView);
|
|
MainActivity mainActivity = MainActivity.this;
|
|
mainActivity.m_loadingView = mainActivity.createLoadingView(mainActivity.m_sLoadingString);
|
|
MainActivity.this.m_frameLayout.addView(MainActivity.this.m_loadingView);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void hideLoadingSplash() {
|
|
runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.2
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (MainActivity.this.m_frameLayout == null || MainActivity.this.m_frameLayout.indexOfChild(MainActivity.this.m_splashView) < 0) {
|
|
return;
|
|
}
|
|
MainActivity.this.m_frameLayout.removeView(MainActivity.this.m_splashView);
|
|
MainActivity.this.m_frameLayout.removeView(MainActivity.this.m_loadingView);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void showSplash() {
|
|
runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.3
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (MainActivity.this.m_frameLayout == null || MainActivity.this.m_frameLayout.indexOfChild(MainActivity.this.m_splashView) >= 0) {
|
|
return;
|
|
}
|
|
MainActivity.this.m_frameLayout.addView(MainActivity.this.m_splashView);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void hideSplash() {
|
|
runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.4
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (MainActivity.this.m_frameLayout == null || MainActivity.this.m_frameLayout.indexOfChild(MainActivity.this.m_splashView) < 0) {
|
|
return;
|
|
}
|
|
MainActivity.this.m_frameLayout.removeView(MainActivity.this.m_splashView);
|
|
}
|
|
});
|
|
}
|
|
|
|
public static int getGameState() {
|
|
MainActivity mainActivity = instance;
|
|
if (mainActivity == null) {
|
|
return 0;
|
|
}
|
|
return mainActivity.m_gameState;
|
|
}
|
|
|
|
public static boolean setGameState(int i) {
|
|
if (instance == null) {
|
|
return false;
|
|
}
|
|
logi("setGameState(" + i + ")");
|
|
instance.m_gameState = i;
|
|
return true;
|
|
}
|
|
|
|
public boolean checkStorage(boolean z) {
|
|
if (this.m_gameState == 5 && !z) {
|
|
return false;
|
|
}
|
|
logi("checkStorage(): storage state = " + Environment.getExternalStorageState());
|
|
if (Environment.getExternalStorageState().equals("mounted") || Environment.getExternalStorageState().equals("mounted_ro")) {
|
|
return true;
|
|
}
|
|
int i = this.m_gameState;
|
|
if (i != 5) {
|
|
this.oldGameState = i;
|
|
}
|
|
setGameState(5);
|
|
logi("checkStorage(): game state = " + this.m_gameState + " old state=" + this.oldGameState);
|
|
if (this.oldGameState <= 1 && checkMemoryJNI()) {
|
|
new Message(getString(R.string.STORAGE_ERROR_TITLE), getString(R.string.STORAGE_ERROR_DESC), getString(R.string.STORAGE_ERROR_POS_BTN), getString(R.string.STORAGE_ERROR_NEG_BTN), null, new MessageCallback() { // from class: com.firemint.realracing.MainActivity.5
|
|
@Override // com.firemint.realracing.MessageCallback
|
|
public void onMessage(int i2) {
|
|
if (i2 == 0) {
|
|
MainActivity.instance.onContinueLowMemory();
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
new Message(getString(R.string.STORAGE_ERROR_TITLE), getString(R.string.STORAGE_ERROR_DESC), null, getString(R.string.STORAGE_ERROR_NEG_BTN), null, null);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void onContinueLowMemory() {
|
|
if (checkStorage(true)) {
|
|
onCreateJNI();
|
|
onStartJNI();
|
|
if (this.m_hasFocus) {
|
|
onDelayedResume();
|
|
}
|
|
this.m_paused = false;
|
|
this.oldGameState = 3;
|
|
setGameState(3);
|
|
}
|
|
}
|
|
|
|
@Override // com.firemonkeys.cloudcellapi.CC_Activity, android.app.Activity
|
|
public void onCreate(Bundle bundle) {
|
|
logi("onCreate(): start");
|
|
if (s_bRunStrictMode) {
|
|
logi("enabling strict mode settings");
|
|
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().permitDiskReads().permitDiskWrites().penaltyLog().penaltyDeath().build());
|
|
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectActivityLeaks().detectFileUriExposure().detectLeakedRegistrationObjects().penaltyLog().penaltyDeath().build());
|
|
}
|
|
AppProxy.SetActivity(this);
|
|
m_bIsAmazon = getApplication().getPackageName().contains("_azn");
|
|
m_bIsAndroidTv = ((UiModeManager) getSystemService("uimode")).getCurrentModeType() == 4;
|
|
SetRunningOnAndroidTv(getIsAndroidTv());
|
|
this.m_headphoneBroadcastReceiver = new HeadphoneBroadcastReceiver(this);
|
|
SetupDisplayCutoutCallback();
|
|
super.onCreate(bundle);
|
|
new NotificationChannelHelper(this);
|
|
this.handler = new Handler();
|
|
HandleLaunchURL(getIntent());
|
|
int i = this.m_gameState;
|
|
if (i == 6) {
|
|
finish();
|
|
return;
|
|
}
|
|
if (i >= 1) {
|
|
return;
|
|
}
|
|
instance = this;
|
|
setGameState(1);
|
|
getContentResolver().registerContentObserver(Settings.System.CONTENT_URI, true, new ContentObserver(new Handler()) { // from class: com.firemint.realracing.MainActivity.6
|
|
@Override // android.database.ContentObserver
|
|
public void onChange(boolean z) {
|
|
onChange(z, null);
|
|
}
|
|
|
|
@Override // android.database.ContentObserver
|
|
public void onChange(boolean z, Uri uri) {
|
|
MainActivity.logi("contentchange");
|
|
MainActivity.this.updateScreenOrientationConfiguration();
|
|
}
|
|
});
|
|
updateScreenOrientationConfiguration();
|
|
this.m_audioStreamManager.setAudioManager((AudioManager) getSystemService("audio"));
|
|
getWindow().requestFeature(1);
|
|
getWindow().addFlags(1152);
|
|
this.m_splashView = createSplashView(this);
|
|
this.m_glView = new GLView(getApplication());
|
|
SetupSystemUiVisibility();
|
|
HideSystemKeys(getWindow().getDecorView());
|
|
CC_Component.setIsUsingImmersiveMode(true);
|
|
FrameLayout frameLayout = new FrameLayout(this);
|
|
this.m_frameLayout = frameLayout;
|
|
frameLayout.addView(this.m_glView);
|
|
this.m_frameLayout.addView(this.m_splashView);
|
|
setContentView(this.m_frameLayout);
|
|
super.setInstances(this.m_glView, this.m_frameLayout);
|
|
MoviePlayer.startup(this, this.m_frameLayout, this.handler);
|
|
this.m_nimbleManager.initialise(this);
|
|
this.m_nimbleManager.onCreate(bundle);
|
|
if (checkStorage(false)) {
|
|
onCreateJNI();
|
|
}
|
|
CheckInitialiseCrashlytics(isLegalUsageEnabled());
|
|
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
|
this.mFirebaseAnalytics = firebaseAnalytics;
|
|
firebaseAnalytics.setAnalyticsCollectionEnabled(isLegalUsageEnabled());
|
|
FirebasePerformance.getInstance().setPerformanceCollectionEnabled(isLegalUsageEnabled());
|
|
this.mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
|
|
this.mFirebaseRemoteConfig.setConfigSettingsAsync(new FirebaseRemoteConfigSettings.Builder().setMinimumFetchIntervalInSeconds(3600L).build());
|
|
this.mFirebaseRemoteConfig.fetchAndActivate().addOnCompleteListener(this, new OnCompleteListener<Boolean>() { // from class: com.firemint.realracing.MainActivity.7
|
|
@Override // com.google.android.gms.tasks.OnCompleteListener
|
|
public void onComplete(@NonNull Task<Boolean> task) {
|
|
if (task.isSuccessful()) {
|
|
MainActivity.this.onFirebaseRemoteConfigFetched(true);
|
|
} else {
|
|
MainActivity.this.onFirebaseRemoteConfigFetched(false);
|
|
}
|
|
}
|
|
});
|
|
FirebaseInstallations.getInstance().getToken(true).addOnCompleteListener(new OnCompleteListener<InstallationTokenResult>() { // from class: com.firemint.realracing.MainActivity.8
|
|
@Override // com.google.android.gms.tasks.OnCompleteListener
|
|
public void onComplete(@NonNull Task<InstallationTokenResult> task) {
|
|
if (task.isSuccessful() && task.getResult() != null) {
|
|
MainActivity.this.onFirebaseAuthTokenFetched(task.getResult().getToken().toString());
|
|
} else {
|
|
MainActivity.this.onFirebaseAuthTokenFetched("");
|
|
}
|
|
}
|
|
});
|
|
logi("onCreate(): finish");
|
|
}
|
|
|
|
public void OnLegalOptOutChanged(boolean z) {
|
|
logi("MainActivity::OnLegalOptOutChanged: " + z);
|
|
CheckInitialiseCrashlytics(z);
|
|
this.mFirebaseAnalytics.setAnalyticsCollectionEnabled(z);
|
|
FirebasePerformance.getInstance().setPerformanceCollectionEnabled(z);
|
|
}
|
|
|
|
public void CheckInitialiseCrashlytics(boolean z) {
|
|
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(z);
|
|
}
|
|
|
|
@TargetApi(28)
|
|
public int GetCutoutLeft() {
|
|
int safeInsetLeft;
|
|
DisplayCutout displayCutout = this.m_displayCutout;
|
|
if (displayCutout == null) {
|
|
return 0;
|
|
}
|
|
safeInsetLeft = displayCutout.getSafeInsetLeft();
|
|
return safeInsetLeft;
|
|
}
|
|
|
|
@TargetApi(28)
|
|
public int GetCutoutRight() {
|
|
int safeInsetRight;
|
|
DisplayCutout displayCutout = this.m_displayCutout;
|
|
if (displayCutout == null) {
|
|
return 0;
|
|
}
|
|
safeInsetRight = displayCutout.getSafeInsetRight();
|
|
return safeInsetRight;
|
|
}
|
|
|
|
public boolean ShouldUseDefaultDisplayCutout() {
|
|
if (HasDisplayCutout()) {
|
|
return false;
|
|
}
|
|
String str = Build.MODEL;
|
|
return (str.toUpperCase().contains("SM-M205") && Build.VERSION.SDK_INT < 28) || str.toLowerCase().contains("vivo 1818") || str.toUpperCase().contains("CPH1969") || str.toUpperCase().contains("CPH1909") || str.toUpperCase().contains("PIXEL 4") || str.toUpperCase().contains("PIXEL 4 XL") || str.toUpperCase().contains("PIXEL 3") || str.toUpperCase().contains("GM1913");
|
|
}
|
|
|
|
private void SetupDisplayCutoutCallback() {
|
|
try {
|
|
if (IsAtLeastAPI(28)) {
|
|
getWindow().getDecorView().setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { // from class: com.firemint.realracing.MainActivity.9
|
|
@Override // android.view.View.OnApplyWindowInsetsListener
|
|
public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
|
|
DisplayCutout displayCutout;
|
|
final int safeInsetLeft;
|
|
final int safeInsetRight;
|
|
MainActivity mainActivity = MainActivity.this;
|
|
displayCutout = windowInsets.getDisplayCutout();
|
|
mainActivity.m_displayCutout = displayCutout;
|
|
if (MainActivity.this.m_displayCutout != null && MainActivity.this.getGLView() != null) {
|
|
safeInsetLeft = MainActivity.this.m_displayCutout.getSafeInsetLeft();
|
|
safeInsetRight = MainActivity.this.m_displayCutout.getSafeInsetRight();
|
|
MainActivity.this.RunOnGlThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.9.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.this.setSafeArea(safeInsetLeft, safeInsetRight);
|
|
}
|
|
});
|
|
}
|
|
return windowInsets;
|
|
}
|
|
});
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
|
|
int i2;
|
|
final boolean z = false;
|
|
if (i == 0) {
|
|
i2 = (iArr == null || iArr.length <= 0) ? -1 : iArr[0];
|
|
Platform.StoragePermissionUpdated(i2, null);
|
|
} else {
|
|
if (i == 3 && iArr != null && iArr.length > 0) {
|
|
i2 = iArr[0];
|
|
}
|
|
RunOnGlThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.10
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.this.permissionRequestCompleted(z);
|
|
}
|
|
});
|
|
super.onRequestPermissionsResult(i, strArr, iArr);
|
|
}
|
|
if (i2 == 0) {
|
|
z = true;
|
|
}
|
|
RunOnGlThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.10
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.this.permissionRequestCompleted(z);
|
|
}
|
|
});
|
|
super.onRequestPermissionsResult(i, strArr, iArr);
|
|
}
|
|
|
|
public boolean IsPermissionGranted(String str) {
|
|
return ContextCompat.checkSelfPermission(this, str) == 0;
|
|
}
|
|
|
|
public void RequestPermission(String str, int i) {
|
|
ActivityCompat.requestPermissions(this, new String[]{str}, i);
|
|
}
|
|
|
|
public void HandleLaunchURL(Intent intent) {
|
|
if (intent != null) {
|
|
String stringExtra = intent.getStringExtra("deepLinkUrl");
|
|
String stringExtra2 = intent.getStringExtra(FCMMessageService.PushIntentExtraKeys.ALERT);
|
|
if (stringExtra == null || stringExtra.length() == 0) {
|
|
stringExtra = intent.getStringExtra(com.firemonkeys.cloudcellapi.LocalNotificationsCenter.EXTRA_LAUNCH_URL);
|
|
}
|
|
if (stringExtra == null || stringExtra.length() == 0) {
|
|
stringExtra = intent.getDataString();
|
|
}
|
|
if (stringExtra == null || stringExtra.length() <= 0) {
|
|
return;
|
|
}
|
|
HandleDeepLink(stringExtra2, stringExtra);
|
|
}
|
|
}
|
|
|
|
public void HandleDeepLink(final String str, final String str2) {
|
|
Runnable runnable = new Runnable() { // from class: com.firemint.realracing.MainActivity.11
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
boolean IsInForeground = Platform.IsInForeground();
|
|
MainActivity mainActivity = MainActivity.this;
|
|
String str3 = str;
|
|
if (str3 == null) {
|
|
str3 = "";
|
|
}
|
|
mainActivity.setBackgroundLaunchURL(str3, str2, IsInForeground);
|
|
}
|
|
};
|
|
if (getGLView() != null) {
|
|
RunOnGlThread(runnable);
|
|
} else {
|
|
runnable.run();
|
|
}
|
|
}
|
|
|
|
public boolean areHeadphonesConnected() {
|
|
return this.m_headphoneBroadcastReceiver.AreHeadphonesConnected();
|
|
}
|
|
|
|
@TargetApi(14)
|
|
private void SetupSystemUiVisibility() {
|
|
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { // from class: com.firemint.realracing.MainActivity.12
|
|
@Override // android.view.View.OnSystemUiVisibilityChangeListener
|
|
public void onSystemUiVisibilityChange(int i) {
|
|
if (MainActivity.this.m_hasFocus) {
|
|
MainActivity.this.OnSystemUiVisibilityChanged();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // android.app.Activity, android.content.ComponentCallbacks2
|
|
public void onTrimMemory(int i) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("OnTrimMemory(");
|
|
sb.append(i);
|
|
sb.append(")");
|
|
if (i == 15) {
|
|
Log.e("RealRacing3", "Received memory warning: TRIM_MEMORY_RUNNING_CRITICAL)");
|
|
}
|
|
this.m_glView.queueEvent(new Runnable() { // from class: com.firemint.realracing.MainActivity.13
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.this.onRecievedMemoryWarningJNI();
|
|
}
|
|
});
|
|
}
|
|
|
|
public void createControllerManager() {
|
|
this.m_controllerManager = new ControllerManager(this);
|
|
}
|
|
|
|
/* renamed from: com.firemint.realracing.MainActivity$14, reason: invalid class name */
|
|
public class AnonymousClass14 implements Runnable {
|
|
public AnonymousClass14() {
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (MainActivity.this.m_cheatView == null) {
|
|
CheatView.CheatListener cheatListener = new CheatView.CheatListener() { // from class: com.firemint.realracing.MainActivity.14.1
|
|
@Override // com.firemint.realracing.CheatView.CheatListener
|
|
public CharSequence onInputUpdate(boolean z, CharSequence charSequence) {
|
|
return charSequence;
|
|
}
|
|
|
|
@Override // com.firemint.realracing.CheatView.CheatListener
|
|
public void onInputDone(boolean z, CharSequence charSequence) {
|
|
MainActivity.this.m_cheatText = charSequence.toString();
|
|
MainActivity.this.hideCheatInput();
|
|
MainActivity.this.m_glView.queueEvent(new Runnable() { // from class: com.firemint.realracing.MainActivity.14.1.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity mainActivity = MainActivity.this;
|
|
mainActivity.onCheatInputDone(mainActivity.m_cheatText, MainActivity.this.m_cheatPtr);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
MainActivity.this.m_cheatView = new CheatView(MainActivity.instance, cheatListener, true);
|
|
}
|
|
if (MainActivity.this.m_cheatView.getParent() == null) {
|
|
MainActivity.this.m_frameLayout.addView(MainActivity.this.m_cheatView);
|
|
}
|
|
MainActivity.this.m_cheatView.begin("");
|
|
}
|
|
}
|
|
|
|
public void showCheatInput(long j) {
|
|
this.m_cheatPtr = j;
|
|
this.m_cheatText = "";
|
|
runOnUiThread(new AnonymousClass14());
|
|
}
|
|
|
|
public void hideCheatInput() {
|
|
runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.15
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (MainActivity.this.m_cheatView != null) {
|
|
MainActivity.this.m_cheatView.end();
|
|
if (MainActivity.this.m_cheatView.getParent() != null) {
|
|
MainActivity.this.m_frameLayout.removeView(MainActivity.this.m_cheatView);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public boolean isCheatInputShown() {
|
|
CheatView cheatView = this.m_cheatView;
|
|
return (cheatView == null || cheatView.getParent() == null) ? false : true;
|
|
}
|
|
|
|
/* renamed from: com.firemint.realracing.MainActivity$16, reason: invalid class name */
|
|
public class AnonymousClass16 implements Runnable {
|
|
final /* synthetic */ boolean val$bPassword;
|
|
final /* synthetic */ String val$text;
|
|
|
|
public AnonymousClass16(boolean z, String str) {
|
|
this.val$bPassword = z;
|
|
this.val$text = str;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (MainActivity.this.m_keyboardView == null) {
|
|
CheatView.CheatListener cheatListener = new CheatView.CheatListener() { // from class: com.firemint.realracing.MainActivity.16.1
|
|
@Override // com.firemint.realracing.CheatView.CheatListener
|
|
public void onInputDone(boolean z, CharSequence charSequence) {
|
|
MainActivity.this.m_keyboardText = charSequence.toString();
|
|
MainActivity.this.hideKeyboardInput();
|
|
MainActivity.this.m_glView.queueEvent(new Runnable() { // from class: com.firemint.realracing.MainActivity.16.1.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity mainActivity = MainActivity.this;
|
|
mainActivity.onKeyboardInputDone(mainActivity.m_keyboardText, MainActivity.this.m_keyboardPtr);
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // com.firemint.realracing.CheatView.CheatListener
|
|
public CharSequence onInputUpdate(boolean z, CharSequence charSequence) {
|
|
MainActivity.this.m_keyboardText = charSequence.toString();
|
|
if (MainActivity.this.m_keyboardInputAlphaNumericOnly) {
|
|
MainActivity mainActivity = MainActivity.this;
|
|
mainActivity.m_keyboardText = mainActivity.m_keyboardText.replaceAll("[^a-zA-Z0-9]", "");
|
|
}
|
|
AnonymousClass16 anonymousClass16 = AnonymousClass16.this;
|
|
if (anonymousClass16.val$bPassword) {
|
|
MainActivity mainActivity2 = MainActivity.this;
|
|
mainActivity2.m_keyboardText = mainActivity2.m_keyboardText.replaceAll("[^a-zA-Z0-9\\s]", "");
|
|
}
|
|
try {
|
|
Matcher matcher = Pattern.compile("[^\\u0000-\\u1FFF\\u2C00-\\uD7FF\\uF900-\\uFAFF]", 66).matcher(MainActivity.this.m_keyboardText);
|
|
MainActivity.this.m_keyboardText = matcher.replaceAll("");
|
|
} catch (Exception e) {
|
|
Log.e("RR3IME", e.toString());
|
|
}
|
|
if (MainActivity.this.m_keyboardInputUppercaseOnly) {
|
|
MainActivity mainActivity3 = MainActivity.this;
|
|
mainActivity3.m_keyboardText = mainActivity3.m_keyboardText.toUpperCase();
|
|
}
|
|
int i = MainActivity.this.m_keyboardInputMaxLength;
|
|
if (MainActivity.this.m_keyboardText.length() < i) {
|
|
i = MainActivity.this.m_keyboardText.length();
|
|
}
|
|
if (i > 0) {
|
|
MainActivity mainActivity4 = MainActivity.this;
|
|
mainActivity4.m_keyboardText = mainActivity4.m_keyboardText.substring(0, i);
|
|
}
|
|
MainActivity.this.m_glView.queueEvent(new Runnable() { // from class: com.firemint.realracing.MainActivity.16.1.2
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity mainActivity5 = MainActivity.this;
|
|
mainActivity5.onKeyboardInputUpdate(mainActivity5.m_keyboardText, MainActivity.this.m_keyboardPtr);
|
|
}
|
|
});
|
|
return MainActivity.this.m_keyboardText;
|
|
}
|
|
};
|
|
MainActivity.this.m_keyboardView = new CheatView(MainActivity.instance, cheatListener, this.val$bPassword);
|
|
}
|
|
if (MainActivity.this.m_keyboardView.getParent() == null) {
|
|
MainActivity.this.m_frameLayout.addView(MainActivity.this.m_keyboardView);
|
|
}
|
|
MainActivity.this.m_keyboardView.begin(this.val$text);
|
|
MainActivity.this.m_keyboardView.touchOffToClose = false;
|
|
}
|
|
}
|
|
|
|
public void showKeyboardInput(long j, int i, boolean z, boolean z2, boolean z3, String str) {
|
|
this.m_keyboardPtr = j;
|
|
this.m_keyboardText = str;
|
|
this.m_keyboardInputMaxLength = i;
|
|
this.m_keyboardInputUppercaseOnly = z;
|
|
this.m_keyboardInputAlphaNumericOnly = z2;
|
|
runOnUiThread(new AnonymousClass16(z3, str));
|
|
}
|
|
|
|
public void hideKeyboardInput() {
|
|
runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.17
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (MainActivity.this.m_keyboardView != null) {
|
|
MainActivity.this.m_keyboardView.end();
|
|
if (MainActivity.this.m_keyboardView.getParent() != null) {
|
|
MainActivity.this.m_frameLayout.removeView(MainActivity.this.m_keyboardView);
|
|
}
|
|
MainActivity.this.OnSystemUiVisibilityChanged();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public boolean isKeyboardInputShown() {
|
|
CheatView cheatView = this.m_keyboardView;
|
|
return (cheatView == null || cheatView.getParent() == null) ? false : true;
|
|
}
|
|
|
|
public TextField createTextField(long j, String str) {
|
|
logi("createTextField(): " + str);
|
|
final TextField textField = new TextField(instance, j, str);
|
|
runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.18
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.logi("Attached text field");
|
|
MainActivity.this.m_frameLayout.addView(textField);
|
|
}
|
|
});
|
|
return textField;
|
|
}
|
|
|
|
public void removeTextField(final TextField textField) {
|
|
runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.19
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
TextField textField2 = textField;
|
|
if (textField2 != null && textField2.getParent() != null) {
|
|
MainActivity.logi("Destroying text field");
|
|
MainActivity.this.m_frameLayout.removeView(textField);
|
|
} else {
|
|
MainActivity.logi("Attempting to destroy null text field");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public View createLoadingView(String str) {
|
|
Platform.getScreenWidth();
|
|
int screenHeight = Platform.getScreenHeight();
|
|
TextView textView = new TextView(this);
|
|
textView.setText(str);
|
|
textView.setTextColor(-1);
|
|
textView.setTextSize(32.0f);
|
|
textView.setVisibility(0);
|
|
textView.setGravity(1);
|
|
textView.setPadding(0, screenHeight - (screenHeight / 7), 0, 0);
|
|
return textView;
|
|
}
|
|
|
|
public static View createSplashView(Context context) {
|
|
return LayoutInflater.from(context).inflate(R.layout.unpacking_assets, (ViewGroup) null);
|
|
}
|
|
|
|
public void OnViewChanged(int i, int i2, int i3, int i4) {
|
|
runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.20
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
boolean z;
|
|
try {
|
|
if (MainActivity.this.m_splashView == null || MainActivity.this.m_frameLayout.indexOfChild(MainActivity.this.m_splashView) < 0) {
|
|
z = false;
|
|
} else {
|
|
MainActivity.this.m_frameLayout.removeView(MainActivity.this.m_splashView);
|
|
z = true;
|
|
}
|
|
MainActivity mainActivity = MainActivity.this;
|
|
mainActivity.m_splashView = MainActivity.createSplashView(mainActivity);
|
|
if (z) {
|
|
MainActivity.this.m_frameLayout.addView(MainActivity.this.m_splashView);
|
|
}
|
|
} catch (Exception e) {
|
|
Log.e("RealRacing3", "Exception when attempting to recreate the splash view: " + e.getMessage());
|
|
}
|
|
}
|
|
});
|
|
onViewChangedJNI(i, i2, i3, i4);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onRestart() {
|
|
logi("onRestart(): start");
|
|
super.onRestart();
|
|
this.m_nimbleManager.onRestart();
|
|
logi("onRestart(): finish");
|
|
}
|
|
|
|
@Override // com.firemonkeys.cloudcellapi.CC_Activity, android.app.Activity
|
|
public void onStart() {
|
|
logi("IANU>> onStart(): start");
|
|
super.onStart();
|
|
if (checkStorage(false)) {
|
|
int i = this.m_gameState;
|
|
if (i < 2 || i >= 4) {
|
|
setGameState(2);
|
|
onStartJNI();
|
|
this.m_nimbleManager.onStart();
|
|
logi("IANU>> onStart(): finish");
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onNewIntent(Intent intent) {
|
|
logi("onNewIntent");
|
|
super.onNewIntent(intent);
|
|
HandleLaunchURL(intent);
|
|
HandleIntent(intent);
|
|
}
|
|
|
|
@Override // com.firemonkeys.cloudcellapi.CC_Activity, android.app.Activity
|
|
public void onResume() {
|
|
logi("IANU>> onResume(): start");
|
|
this.m_delayedResumeJNI = true;
|
|
super.onResume();
|
|
this.m_glView.onResume();
|
|
this.m_nimbleManager.onResume();
|
|
this.m_headphoneBroadcastReceiver.onResume();
|
|
int i = this.m_gameState;
|
|
if (i != 5 && i != 3) {
|
|
setGameState(3);
|
|
this.m_delayedResumeJNI = false;
|
|
this.m_glView.queueEvent(new Runnable() { // from class: com.firemint.realracing.MainActivity.21
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.this.onResumeJNI();
|
|
}
|
|
});
|
|
this.m_paused = false;
|
|
}
|
|
if (isKeyboardInputShown()) {
|
|
this.m_keyboardView.onResume();
|
|
}
|
|
if (isCheatInputShown()) {
|
|
this.m_cheatView.onResume();
|
|
}
|
|
MoviePlayer.resume();
|
|
ControllerManager controllerManager = this.m_controllerManager;
|
|
if (controllerManager != null) {
|
|
controllerManager.onResume();
|
|
}
|
|
logi("IANU>> onResume(): finish");
|
|
}
|
|
|
|
public void onDelayedResume() {
|
|
if (this.m_delayedResumeJNI) {
|
|
this.m_delayedResumeJNI = false;
|
|
this.m_glView.queueEvent(new Runnable() { // from class: com.firemint.realracing.MainActivity.22
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.this.onResumeJNI();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.Window.Callback
|
|
public void onWindowFocusChanged(boolean z) {
|
|
logi("onWindowFocusChanged(" + z + "): start");
|
|
this.m_hasFocus = z;
|
|
super.onWindowFocusChanged(z);
|
|
this.m_glView.queueEvent(new Runnable() { // from class: com.firemint.realracing.MainActivity.23
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity mainActivity = MainActivity.this;
|
|
mainActivity.onWindowFocusChangedJNI(mainActivity.m_hasFocus);
|
|
}
|
|
});
|
|
if (this.m_hasFocus) {
|
|
if (!this.m_paused) {
|
|
onDelayedResume();
|
|
}
|
|
OnSystemUiVisibilityChanged();
|
|
}
|
|
this.m_nimbleManager.onWindowFocusChanged(z);
|
|
logi("onWindowFocusChanged(" + this.m_hasFocus + "): finish");
|
|
}
|
|
|
|
@Override // com.firemonkeys.cloudcellapi.CC_Activity, android.app.Activity
|
|
public void onPause() {
|
|
logi("onPause(): start");
|
|
this.m_delayedResumeJNI = false;
|
|
super.onPause();
|
|
showSplash();
|
|
logi("onPause(): glPause");
|
|
this.m_glView.onPause();
|
|
this.m_nimbleManager.onPause();
|
|
this.m_headphoneBroadcastReceiver.onPause();
|
|
MoviePlayer.pause();
|
|
ControllerManager controllerManager = this.m_controllerManager;
|
|
if (controllerManager != null) {
|
|
controllerManager.onPause();
|
|
}
|
|
if (this.m_gameState == 3) {
|
|
logi("onPause(): pauseJNI");
|
|
setGameState(2);
|
|
this.m_paused = true;
|
|
PauseRunnable pauseRunnable = new PauseRunnable(this);
|
|
this.m_pauseRunnable = pauseRunnable;
|
|
this.m_glView.queueEvent(pauseRunnable);
|
|
}
|
|
if (isKeyboardInputShown()) {
|
|
this.m_keyboardView.onPause();
|
|
}
|
|
if (isCheatInputShown()) {
|
|
this.m_cheatView.onPause();
|
|
}
|
|
logi("onPause(): finish");
|
|
}
|
|
|
|
@Override // com.firemonkeys.cloudcellapi.CC_Activity, android.app.Activity
|
|
public void onStop() {
|
|
logi("onStop(): start");
|
|
PauseRunnable.waitUntilFinished(this.m_pauseRunnable);
|
|
super.onStop();
|
|
int i = this.m_gameState;
|
|
if (i != 5 && i < 4) {
|
|
setGameState(4);
|
|
onStopJNI();
|
|
}
|
|
this.m_nimbleManager.onStop();
|
|
logi("onStop(): finish");
|
|
}
|
|
|
|
@Override // com.firemonkeys.cloudcellapi.CC_Activity, android.app.Activity
|
|
public void onDestroy() {
|
|
logi("onDestroy(): start");
|
|
ControllerManager controllerManager = this.m_controllerManager;
|
|
if (controllerManager != null) {
|
|
controllerManager.onDestroy();
|
|
}
|
|
if (this.m_gameState < 6) {
|
|
setGameState(6);
|
|
if (!this.m_skipOnDestroyJNI) {
|
|
onDestroyJNI();
|
|
}
|
|
}
|
|
super.onDestroy();
|
|
super.clearInstances();
|
|
this.m_nimbleManager.onDestroy();
|
|
this.m_glView = null;
|
|
this.m_splashView = null;
|
|
this.m_cheatView = null;
|
|
this.m_frameLayout = null;
|
|
instance = null;
|
|
AppProxy.SetActivity(null);
|
|
logi("onDestroy(): exit");
|
|
System.exit(0);
|
|
logi("onDestroy(): finish");
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onRestoreInstanceState(Bundle bundle) {
|
|
this.m_nimbleManager.onRestoreInstanceState(bundle);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onSaveInstanceState(Bundle bundle) {
|
|
this.m_nimbleManager.onSaveInstanceState(bundle);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void OnSystemUiVisibilityChanged() {
|
|
if (isKeyboardInputShown()) {
|
|
return;
|
|
}
|
|
if (!getIsAmazon() || IsAtLeastAPI(21)) {
|
|
getGLView().postDelayed(new Runnable() { // from class: com.firemint.realracing.MainActivity.24
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.HideSystemKeys(MainActivity.this.getWindow().getDecorView());
|
|
}
|
|
}, 1000L);
|
|
}
|
|
}
|
|
|
|
@TargetApi(19)
|
|
public static void HideSystemKeys(View view) {
|
|
if (IsAtLeastAPI(19)) {
|
|
view.setSystemUiVisibility(4614);
|
|
} else {
|
|
if (!IsAtLeastAPI(14) || (view.getSystemUiVisibility() & 1) == 1) {
|
|
return;
|
|
}
|
|
view.setSystemUiVisibility(1);
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onBackPressed() {
|
|
if (this.m_nimbleManager.onBackPressed()) {
|
|
super.onBackPressed();
|
|
}
|
|
}
|
|
|
|
public void finishActivity() {
|
|
finish();
|
|
}
|
|
|
|
public void setSkipOnDestroyJNI(boolean z) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Setting skipOnDestroyJNI: ");
|
|
sb.append(z ? "true" : "false");
|
|
logi(sb.toString());
|
|
this.m_skipOnDestroyJNI = z;
|
|
}
|
|
|
|
public void updateScreenOrientationConfiguration() {
|
|
if (Settings.System.getInt(getContentResolver(), "accelerometer_rotation", 1) == 0) {
|
|
logi("setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)");
|
|
setRequestedOrientation(0);
|
|
} else {
|
|
logi("setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE)");
|
|
setRequestedOrientation(6);
|
|
}
|
|
}
|
|
|
|
public int getScreenOrientation() {
|
|
int i = getResources().getConfiguration().orientation;
|
|
int i2 = 1;
|
|
if (i != 1) {
|
|
i2 = 2;
|
|
if (i != 2) {
|
|
return 0;
|
|
}
|
|
}
|
|
return i2;
|
|
}
|
|
|
|
public int getScreenRotation() {
|
|
int rotation = getWindowManager().getDefaultDisplay().getRotation();
|
|
if (rotation == 0) {
|
|
return 0;
|
|
}
|
|
int i = 1;
|
|
if (rotation != 1) {
|
|
i = 2;
|
|
if (rotation != 2) {
|
|
return 3;
|
|
}
|
|
}
|
|
return i;
|
|
}
|
|
|
|
@Override // android.app.Activity, android.content.ComponentCallbacks
|
|
public void onConfigurationChanged(Configuration configuration) {
|
|
super.onConfigurationChanged(configuration);
|
|
}
|
|
|
|
@Override // com.firemonkeys.cloudcellapi.CC_Activity, android.app.Activity
|
|
public void onActivityResult(int i, int i2, Intent intent) {
|
|
super.onActivityResult(i, i2, intent);
|
|
int i3 = 0;
|
|
if (i == WIFI_SETTINGS) {
|
|
m_WIFISettingsShown = false;
|
|
} else if (i == 1) {
|
|
if (i2 == -1) {
|
|
getContentResolver().takePersistableUriPermission(intent.getData(), 3);
|
|
} else {
|
|
i3 = -1;
|
|
}
|
|
Platform.StoragePermissionUpdated(i3, intent);
|
|
}
|
|
this.m_nimbleManager.onActivityResult(i, i2, intent);
|
|
}
|
|
|
|
public void SSExperimental_SimulateDeadlock() {
|
|
this.m_glView.queueEvent(new Runnable() { // from class: com.firemint.realracing.MainActivity.25
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.this.runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.25.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
try {
|
|
MainActivity.loge("UI thread sleeping...");
|
|
Thread.sleep(3000L);
|
|
MainActivity.loge("UI thread waking...");
|
|
MainActivity.instance.SSExperimentalHoldAndWaitJNI();
|
|
} catch (InterruptedException unused) {
|
|
}
|
|
}
|
|
});
|
|
MainActivity.instance.SSExperimentalHoldAndWaitJNI();
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.Window.Callback
|
|
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
|
ControllerManager controllerManager;
|
|
if (isCheatInputShown() || isKeyboardInputShown() || (controllerManager = this.m_controllerManager) == null || !controllerManager.HandleKeyEvents(keyEvent)) {
|
|
return super.dispatchKeyEvent(keyEvent);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.KeyEvent.Callback
|
|
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
|
if (handleKeyEvent(i, keyEvent)) {
|
|
return true;
|
|
}
|
|
return super.onKeyDown(i, keyEvent);
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.KeyEvent.Callback
|
|
public boolean onKeyUp(int i, KeyEvent keyEvent) {
|
|
if (handleKeyEvent(i, keyEvent)) {
|
|
return true;
|
|
}
|
|
return super.onKeyUp(i, keyEvent);
|
|
}
|
|
|
|
public boolean handleKeyEvent(int i, KeyEvent keyEvent) {
|
|
if (isMenuBackKey(i) && keyEvent.getRepeatCount() == 0) {
|
|
this.m_glView.queueEvent(new KeyEventRunnable(i, keyEvent.getAction()));
|
|
return true;
|
|
}
|
|
if (!isVolumeKey(i)) {
|
|
return false;
|
|
}
|
|
this.m_glView.queueEvent(new KeyEventRunnable(i, keyEvent.getAction()));
|
|
return false;
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public boolean onGenericMotionEvent(MotionEvent motionEvent) {
|
|
ControllerManager controllerManager;
|
|
if (!isCheatInputShown() && !isKeyboardInputShown() && (controllerManager = this.m_controllerManager) != null) {
|
|
if (controllerManager.HandleMotionEvents(motionEvent)) {
|
|
return true;
|
|
}
|
|
this.m_controllerManager.Log("Not controller motion event");
|
|
}
|
|
return super.onGenericMotionEvent(motionEvent);
|
|
}
|
|
|
|
public class KeyEventRunnable implements Runnable {
|
|
int m_keyCode;
|
|
int m_nAction;
|
|
|
|
public KeyEventRunnable(int i, int i2) {
|
|
this.m_keyCode = i;
|
|
this.m_nAction = i2;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
try {
|
|
int i = this.m_nAction;
|
|
if (i == 0) {
|
|
MainActivity.instance.onKeyPressed(this.m_keyCode);
|
|
} else if (i == 1) {
|
|
MainActivity.instance.onKeyReleased(this.m_keyCode);
|
|
}
|
|
} catch (UnsatisfiedLinkError e) {
|
|
Log.e("RealRacing3", "UnsatisfiedLinkError when processing key event: " + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
|
|
public class MessageExecuteCallback implements Runnable {
|
|
long messageId;
|
|
|
|
public MessageExecuteCallback(long j) {
|
|
this.messageId = j;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
MainActivity.instance.alertMessageExecuteCallback(this.messageId);
|
|
}
|
|
}
|
|
|
|
public class Message {
|
|
AlertDialog.Builder mAd;
|
|
private String TAG = "Message";
|
|
AlertDialog mDialog = null;
|
|
boolean mCancelled = false;
|
|
|
|
public AlertDialog GetDialog() {
|
|
return this.mDialog;
|
|
}
|
|
|
|
public Message(String str, String str2, String str3, String str4, String str5, final MessageCallback messageCallback) {
|
|
this.mAd = null;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Message(");
|
|
sb.append(str);
|
|
sb.append(", ");
|
|
sb.append(str2);
|
|
sb.append(", ");
|
|
sb.append(str3);
|
|
sb.append(", ");
|
|
sb.append(str4);
|
|
sb.append(")");
|
|
this.mAd = new AlertDialog.Builder(MainActivity.instance);
|
|
if (str != null && !str.isEmpty()) {
|
|
this.mAd.setTitle(str);
|
|
}
|
|
if (str2 != null && !str2.isEmpty()) {
|
|
this.mAd.setMessage(str2);
|
|
}
|
|
this.mAd.setCancelable(false);
|
|
if (str3 != null && !str3.isEmpty()) {
|
|
this.mAd.setPositiveButton(str3, new DialogInterface.OnClickListener() { // from class: com.firemint.realracing.MainActivity.Message.1
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
MessageCallback messageCallback2 = messageCallback;
|
|
if (messageCallback2 != null) {
|
|
messageCallback2.onMessage(0);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
if (str4 != null && !str4.isEmpty()) {
|
|
this.mAd.setNegativeButton(str4, new DialogInterface.OnClickListener() { // from class: com.firemint.realracing.MainActivity.Message.2
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
MessageCallback messageCallback2 = messageCallback;
|
|
if (messageCallback2 != null) {
|
|
messageCallback2.onMessage(1);
|
|
}
|
|
}
|
|
});
|
|
this.mAd.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.firemint.realracing.MainActivity.Message.3
|
|
@Override // android.content.DialogInterface.OnKeyListener
|
|
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
if (i != 4) {
|
|
return false;
|
|
}
|
|
MessageCallback messageCallback2 = messageCallback;
|
|
if (messageCallback2 != null) {
|
|
messageCallback2.onMessage(1);
|
|
}
|
|
return true;
|
|
}
|
|
});
|
|
}
|
|
if (str5 != null && !str5.isEmpty()) {
|
|
this.mAd.setNeutralButton(str5, new DialogInterface.OnClickListener() { // from class: com.firemint.realracing.MainActivity.Message.4
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
MessageCallback messageCallback2 = messageCallback;
|
|
if (messageCallback2 != null) {
|
|
messageCallback2.onMessage(2);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
MainActivity.this.runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.Message.5
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
Message message = Message.this;
|
|
if (message.mCancelled) {
|
|
return;
|
|
}
|
|
message.mDialog = message.mAd.show();
|
|
Message.this.mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { // from class: com.firemint.realracing.MainActivity.Message.5.1
|
|
@Override // android.content.DialogInterface.OnDismissListener
|
|
public void onDismiss(DialogInterface dialogInterface) {
|
|
MainActivity.instance.OnMessageDismissed(this);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
public void Cancel() {
|
|
this.mCancelled = true;
|
|
AlertDialog alertDialog = this.mDialog;
|
|
if (alertDialog != null) {
|
|
alertDialog.dismiss();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void showMessage(String str, String str2, String str3, String str4, String str5, final long j, final long j2, final long j3) {
|
|
showMessage(str, str2, str3, str4, str5, new MessageCallback() { // from class: com.firemint.realracing.MainActivity.26
|
|
@Override // com.firemint.realracing.MessageCallback
|
|
public void onMessage(int i) {
|
|
if (i == 0) {
|
|
MainActivity.instance.getGLView().queueEvent(MainActivity.this.new MessageExecuteCallback(j));
|
|
} else if (i == 1) {
|
|
MainActivity.instance.getGLView().queueEvent(MainActivity.this.new MessageExecuteCallback(j2));
|
|
} else if (i == 2) {
|
|
MainActivity.instance.getGLView().queueEvent(MainActivity.this.new MessageExecuteCallback(j3));
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public void showMessage(String str, String str2, String str3, String str4, String str5, MessageCallback messageCallback) {
|
|
this.m_message = new Message(str, str2, str3, str4, str5, messageCallback);
|
|
}
|
|
|
|
public void dismissMessage() {
|
|
runOnUiThread(new Runnable() { // from class: com.firemint.realracing.MainActivity.27
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
Message message = MainActivity.this.m_message;
|
|
if (message != null) {
|
|
message.Cancel();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public static void logw(String str) {
|
|
Log.w("RealRacing3", str);
|
|
}
|
|
|
|
public static void loge(String str) {
|
|
Log.e("RealRacing3", str);
|
|
}
|
|
}
|