mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-05-19 15:34:39 -04:00
Error report: added FatalErrorActivity
This commit is contained in:
@@ -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(){
|
||||
|
||||
Reference in New Issue
Block a user