Permalink
Browse files

Merge pull request #7319 from zackhow/exit-double

Android: require back to be pressed twice to exit on mobile
  • Loading branch information...
delroth committed Aug 12, 2018
2 parents a2b9766 + a2f90d3 commit 3bf92e76e56d8a28cd4e9dda4894655673258528
@@ -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 3bf92e7

Please sign in to comment.