Back button quitting
This commit is contained in:
@@ -52,6 +52,13 @@ public class AndroidLauncher extends AndroidApplication{
|
||||
config.depth = 0;
|
||||
Platform.instance = new Platform(){
|
||||
|
||||
@Override
|
||||
public void hide(){
|
||||
ui.showConfirm("$confirm", "$quit.confirm", () -> {
|
||||
AndroidLauncher.this.moveTaskToBack(true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openDonations(){
|
||||
showDonations();
|
||||
|
||||
@@ -310,6 +310,10 @@ public class Control implements ApplicationListener{
|
||||
if(!state.isPaused()){
|
||||
Time.update();
|
||||
}
|
||||
|
||||
if(!scene.hasDialog() && Core.input.keyTap(KeyCode.BACK)){
|
||||
Platform.instance.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,9 @@ public abstract class Platform {
|
||||
*/
|
||||
public void showFileChooser(String text, String content, Consumer<FileHandle> cons, boolean open, String filetype){}
|
||||
|
||||
/**Hide the app. Android only.*/
|
||||
public void hide(){}
|
||||
|
||||
/**Forces the app into landscape mode. Currently Android only.*/
|
||||
public void beginForceLandscape(){}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user