Permalink
Browse files

Android: require back to be pressed twice to exit on mobile

  • Loading branch information...
zackhow committed Aug 11, 2018
1 parent a2b9766 commit a2f90d39154dfbc45a2d517e2ae5fc88d2e04e4a
@@ -78,6 +78,7 @@
private String mSelectedTitle;
private int mPlatform;
private String mPath;
private boolean backPressedOnce = false;
public static final String EXTRA_SELECTED_GAME = "SelectedGame";
public static final String EXTRA_SELECTED_TITLE = "SelectedTitle";
@@ -329,10 +330,18 @@ public void onBackPressed()
}
else
{
mEmulationFragment.stopEmulation();
exitWithAnimation();
if (backPressedOnce)
{
mEmulationFragment.stopEmulation();
exitWithAnimation();
}
else
{
backPressedOnce = true;
Toast.makeText(this, "Press back again to exit", Toast.LENGTH_LONG).show();
new Handler().postDelayed(() -> backPressedOnce = false, 3000);
}
}
}
@Override

0 comments on commit a2f90d3

Please sign in to comment.