mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Prevent Forge process sticking around after exiting on Android devices
This commit is contained in:
@@ -35,6 +35,12 @@ public class Main extends AndroidApplication {
|
||||
return;
|
||||
}
|
||||
|
||||
initialize(Forge.getApp(getClipboard(), assetsDir), true);
|
||||
initialize(Forge.getApp(getClipboard(), assetsDir, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//ensure process doesn't stick around after exiting
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
}
|
||||
}), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import forge.util.Utils;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
new LwjglApplication(Forge.getApp(new LwjglClipboard(), "../forge-gui/"), "Forge", (int)Utils.BASE_WIDTH, (int)Utils.BASE_HEIGHT, true);
|
||||
new LwjglApplication(Forge.getApp(new LwjglClipboard(), "../forge-gui/", null),
|
||||
"Forge", (int)Utils.BASE_WIDTH, (int)Utils.BASE_HEIGHT, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public class Forge implements ApplicationListener {
|
||||
|
||||
private static final ApplicationListener app = new Forge();
|
||||
private static Clipboard clipboard;
|
||||
private static Runnable onExit;
|
||||
private static int screenWidth;
|
||||
private static int screenHeight;
|
||||
private static Graphics graphics;
|
||||
@@ -46,9 +47,10 @@ public class Forge implements ApplicationListener {
|
||||
private static KeyInputAdapter keyInputAdapter;
|
||||
private static final Stack<FScreen> screens = new Stack<FScreen>();
|
||||
|
||||
public static ApplicationListener getApp(Clipboard clipboard0, String assetDir0) {
|
||||
public static ApplicationListener getApp(Clipboard clipboard0, String assetDir0, Runnable onExit0) {
|
||||
if (GuiBase.getInterface() == null) {
|
||||
clipboard = clipboard0;
|
||||
onExit = onExit0;
|
||||
GuiBase.setInterface(new GuiMobile(assetDir0));
|
||||
}
|
||||
return app;
|
||||
@@ -259,7 +261,10 @@ public class Forge implements ApplicationListener {
|
||||
}
|
||||
screens.clear();
|
||||
graphics.dispose();
|
||||
System.exit(0);
|
||||
|
||||
if (onExit != null) {
|
||||
onExit.run();
|
||||
}
|
||||
}
|
||||
|
||||
//log message to Forge.log file
|
||||
|
||||
Reference in New Issue
Block a user