- 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
147 lines
5.4 KiB
Java
147 lines
5.4 KiB
Java
package com.firemint.realracing;
|
|
|
|
import android.app.Activity;
|
|
import android.app.AlertDialog;
|
|
import android.content.DialogInterface;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.os.Environment;
|
|
import android.view.KeyEvent;
|
|
import com.github.anrwatchdog.ANRError;
|
|
import com.github.anrwatchdog.ANRWatchDog;
|
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class UnpackAssetsActivity extends Activity {
|
|
Intent m_startupIntent;
|
|
UnpackAssetsAsyncTask m_unpackTask = null;
|
|
boolean m_displayingStorageError = false;
|
|
|
|
@Override // android.app.Activity
|
|
public void onCreate(Bundle bundle) {
|
|
super.onCreate(bundle);
|
|
new ANRWatchDog().setIgnoreDebugger(true).setANRListener(new ANRWatchDog.ANRListener() { // from class: com.firemint.realracing.UnpackAssetsActivity.1
|
|
@Override // com.github.anrwatchdog.ANRWatchDog.ANRListener
|
|
public void onAppNotResponding(ANRError aNRError) {
|
|
FirebaseCrashlytics.getInstance().recordException(aNRError);
|
|
}
|
|
}).start();
|
|
this.m_startupIntent = getIntent();
|
|
if (CheckStorage()) {
|
|
ExtractAndLaunch();
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onResume() {
|
|
super.onResume();
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onNewIntent(Intent intent) {
|
|
super.onNewIntent(intent);
|
|
this.m_startupIntent = intent;
|
|
}
|
|
|
|
public boolean IsGameRunning() {
|
|
return MainActivity.instance != null;
|
|
}
|
|
|
|
private void SetContentLayout() {
|
|
setContentView(R.layout.unpacking_assets);
|
|
}
|
|
|
|
public boolean CheckStorage() {
|
|
if (IsGameRunning() || IsStorageMounted()) {
|
|
return true;
|
|
}
|
|
if (!this.m_displayingStorageError) {
|
|
DisplayStorageError();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public boolean IsStorageMounted() {
|
|
return Environment.getExternalStorageState().equals("mounted");
|
|
}
|
|
|
|
public void DisplayStorageError() {
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
builder.setCancelable(false);
|
|
builder.setTitle(getString(R.string.STORAGE_ERROR_TITLE));
|
|
builder.setMessage(getString(R.string.STORAGE_ERROR_DESC));
|
|
builder.setNegativeButton(getString(R.string.STORAGE_ERROR_NEG_BTN), new DialogInterface.OnClickListener() { // from class: com.firemint.realracing.UnpackAssetsActivity.2
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
UnpackAssetsActivity.this.finish();
|
|
}
|
|
});
|
|
builder.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.firemint.realracing.UnpackAssetsActivity.3
|
|
@Override // android.content.DialogInterface.OnKeyListener
|
|
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
|
if (i != 4) {
|
|
return false;
|
|
}
|
|
UnpackAssetsActivity.this.finish();
|
|
return true;
|
|
}
|
|
});
|
|
builder.setOnDismissListener(new DialogInterface.OnDismissListener() { // from class: com.firemint.realracing.UnpackAssetsActivity.4
|
|
@Override // android.content.DialogInterface.OnDismissListener
|
|
public void onDismiss(DialogInterface dialogInterface) {
|
|
UnpackAssetsActivity.this.m_displayingStorageError = false;
|
|
}
|
|
});
|
|
builder.show();
|
|
this.m_displayingStorageError = true;
|
|
}
|
|
|
|
public void ExtractAndLaunch() {
|
|
if (IsGameRunning()) {
|
|
TransitionToGameActivity();
|
|
return;
|
|
}
|
|
if (this.m_unpackTask == null) {
|
|
MainActivity.HideSystemKeys(getWindow().getDecorView());
|
|
SetContentLayout();
|
|
String externalStorageDir = Platform.getExternalStorageDir(this);
|
|
if (externalStorageDir != "") {
|
|
UnpackAssetsAsyncTask unpackAssetsAsyncTask = new UnpackAssetsAsyncTask(this, externalStorageDir);
|
|
this.m_unpackTask = unpackAssetsAsyncTask;
|
|
unpackAssetsAsyncTask.execute(new Void[0]);
|
|
return;
|
|
}
|
|
ShowExtractError();
|
|
}
|
|
}
|
|
|
|
public void OnExtractionComplete(Integer num) {
|
|
if (num == UnpackAssetsAsyncTask.AssetExtractSuccess) {
|
|
TransitionToGameActivity();
|
|
} else {
|
|
ShowExtractError();
|
|
}
|
|
}
|
|
|
|
public void ShowExtractError() {
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
builder.setCancelable(false);
|
|
builder.setTitle(getString(R.string.UNPACK_ERROR_TITLE));
|
|
builder.setMessage(getString(R.string.UNPACK_ERROR_MESSAGE));
|
|
builder.setNegativeButton(getString(R.string.BTN_OK), new DialogInterface.OnClickListener() { // from class: com.firemint.realracing.UnpackAssetsActivity.5
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
UnpackAssetsActivity.this.finish();
|
|
}
|
|
});
|
|
builder.show();
|
|
}
|
|
|
|
public void TransitionToGameActivity() {
|
|
this.m_startupIntent.setClass(this, MainActivity.class);
|
|
startActivity(this.m_startupIntent);
|
|
overridePendingTransition(0, 0);
|
|
finish();
|
|
}
|
|
}
|