mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 23:59:21 -04:00
[Mod installer] Show dialog on exit
This commit is contained in:
parent
0f429f09d9
commit
9b7adff82b
@ -9,6 +9,8 @@ import java.io.*;
|
|||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.lwjgl.glfw.*;
|
import org.lwjgl.glfw.*;
|
||||||
|
import android.support.v7.app.*;
|
||||||
|
import android.content.*;
|
||||||
|
|
||||||
public class InstallModActivity extends LoggableActivity
|
public class InstallModActivity extends LoggableActivity
|
||||||
{
|
{
|
||||||
@ -80,8 +82,26 @@ public class InstallModActivity extends LoggableActivity
|
|||||||
new Thread(new Runnable(){
|
new Thread(new Runnable(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
launchJavaRuntime(modFile, javaArgs);
|
final int exitCode = launchJavaRuntime(modFile, javaArgs);
|
||||||
|
IS_JRE_RUNNING = false;
|
||||||
|
|
||||||
|
appendlnToLog("Java Exit code: " + exitCode);
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
AlertDialog.Builder dialog = new AlertDialog.Builder(InstallModActivity.this);
|
||||||
|
dialog.setMessage(getString(R.string.mcn_exit_title, exitCode));
|
||||||
|
dialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface p1, int p2){
|
||||||
|
MainActivity.fullyExit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, "JREMainThread").start();
|
}, "JREMainThread").start();
|
||||||
}
|
}
|
||||||
@ -119,7 +139,7 @@ public class InstallModActivity extends LoggableActivity
|
|||||||
// mIsResuming = true;
|
// mIsResuming = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchJavaRuntime(File modFile, String javaArgs) {
|
private int launchJavaRuntime(File modFile, String javaArgs) {
|
||||||
try {
|
try {
|
||||||
JREUtils.relocateLibPath();
|
JREUtils.relocateLibPath();
|
||||||
|
|
||||||
@ -160,9 +180,10 @@ public class InstallModActivity extends LoggableActivity
|
|||||||
JREUtils.initJavaRuntime();
|
JREUtils.initJavaRuntime();
|
||||||
JREUtils.chdir(Tools.MAIN_PATH);
|
JREUtils.chdir(Tools.MAIN_PATH);
|
||||||
|
|
||||||
VMLauncher.launchJVM(javaArgList.toArray(new String[0]));
|
return VMLauncher.launchJVM(javaArgList.toArray(new String[0]));
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
Tools.showError(this, th, true);
|
Tools.showError(this, th, true);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user