Back button quitting
This commit is contained in:
@@ -52,6 +52,13 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
config.depth = 0;
|
config.depth = 0;
|
||||||
Platform.instance = new Platform(){
|
Platform.instance = new Platform(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide(){
|
||||||
|
ui.showConfirm("$confirm", "$quit.confirm", () -> {
|
||||||
|
AndroidLauncher.this.moveTaskToBack(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openDonations(){
|
public void openDonations(){
|
||||||
showDonations();
|
showDonations();
|
||||||
|
|||||||
@@ -310,6 +310,10 @@ public class Control implements ApplicationListener{
|
|||||||
if(!state.isPaused()){
|
if(!state.isPaused()){
|
||||||
Time.update();
|
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){}
|
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.*/
|
/**Forces the app into landscape mode. Currently Android only.*/
|
||||||
public void beginForceLandscape(){}
|
public void beginForceLandscape(){}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user