mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 23:00:45 -04:00
Error report: added FatalErrorActivity
This commit is contained in:
parent
6986c58853
commit
21eb5c0aa5
@ -27,6 +27,11 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:name=".FatalErrorActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"/>
|
||||
|
||||
<activity
|
||||
android:screenOrientation="sensorLandscape"
|
||||
|
@ -0,0 +1,15 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
import android.support.v7.app.*;
|
||||
import android.os.*;
|
||||
|
||||
public class FatalErrorActivity extends AppCompatActivity
|
||||
{
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Throwable th = (Throwable) getIntent().getExtras().getSerializable("throwable");
|
||||
Tools.showError(this, R.string.error_fatal, th, true);
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ import net.kdt.pojavlaunch.prefs.*;
|
||||
import net.kdt.pojavlaunch.value.customcontrols.*;
|
||||
import android.support.v7.preference.*;
|
||||
import java.io.*;
|
||||
import android.content.*;
|
||||
|
||||
public class PojavApplication extends Application
|
||||
{
|
||||
@ -40,8 +41,10 @@ public class PojavApplication extends Application
|
||||
new File(Tools.CTRLMAP_PATH).mkdirs();
|
||||
new CustomControls(this).save(Tools.CTRLDEF_FILE);
|
||||
|
||||
} catch (Exception e) {
|
||||
Tools.showError(this, e, true);
|
||||
} catch (Throwable th) {
|
||||
Intent ferrorIntent = new Intent(this, FatalErrorActivity.class);
|
||||
ferrorIntent.putExtra("throwable", th);
|
||||
startActivity(ferrorIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,10 +172,15 @@ public final class Tools
|
||||
|
||||
public static void showError(final Context ctx, final Throwable e, final boolean exitIfOk)
|
||||
{
|
||||
showError(ctx, e, exitIfOk, false);
|
||||
showError(ctx, R.string.global_error, e, exitIfOk, false);
|
||||
}
|
||||
|
||||
private static void showError(final Context ctx, final Throwable e, final boolean exitIfOk, final boolean showMore)
|
||||
public static void showError(final Context ctx, final int titleId, final Throwable e, final boolean exitIfOk)
|
||||
{
|
||||
showError(ctx, titleId, e, exitIfOk, false);
|
||||
}
|
||||
|
||||
private static void showError(final Context ctx, final int titleId, final Throwable e, final boolean exitIfOk, final boolean showMore)
|
||||
{
|
||||
Runnable runnable = new Runnable(){
|
||||
|
||||
@ -184,7 +189,7 @@ public final class Tools
|
||||
{
|
||||
final String errMsg = showMore ? Log.getStackTraceString(e): e.getMessage();
|
||||
new AlertDialog.Builder((Context) ctx)
|
||||
.setTitle(R.string.global_error)
|
||||
.setTitle(titleId)
|
||||
.setMessage(errMsg)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){
|
||||
|
||||
@ -205,7 +210,7 @@ public final class Tools
|
||||
@Override
|
||||
public void onClick(DialogInterface p1, int p2)
|
||||
{
|
||||
showError(ctx, e, exitIfOk, !showMore);
|
||||
showError(ctx, titleId, e, exitIfOk, !showMore);
|
||||
}
|
||||
})
|
||||
.setNeutralButton(android.R.string.copy, new DialogInterface.OnClickListener(){
|
||||
|
@ -51,6 +51,7 @@
|
||||
<string name="alerttitle_installoptifine">Select OptiFine jar file</string>
|
||||
|
||||
<!-- Error messages -->
|
||||
<string name="error_fatal">Fatal error</string>
|
||||
<string name="error_checklog">Error! Please check the log below: %s</string>
|
||||
<string name="error_no_version">No version!</string>
|
||||
<string name="error_load_version">Unable to load version %s</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user