aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-04-27 20:00:29 -0700
committerScott Jackson <daneren2005@gmail.com>2013-04-27 20:00:29 -0700
commit47dd3bb22d39a31215a59b7e3fc1caea51033e3c (patch)
treef927cbc532ecd6d6b52a66d976198f11e71e40d7 /subsonic-android/src/github
parentde312e05db9d9c73217a91bbdee1794f5e0d8730 (diff)
downloaddsub-47dd3bb22d39a31215a59b7e3fc1caea51033e3c.tar.gz
dsub-47dd3bb22d39a31215a59b7e3fc1caea51033e3c.tar.bz2
dsub-47dd3bb22d39a31215a59b7e3fc1caea51033e3c.zip
Change from menu exit to double back press
Diffstat (limited to 'subsonic-android/src/github')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
index 5342f367..9930d2b0 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
@@ -37,6 +37,7 @@ public class MainActivity extends SubsonicActivity {
private TextView trackView;
private TextView artistView;
private ImageButton startButton;
+ private long lastBackPressTime = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -184,17 +185,12 @@ public class MainActivity extends SubsonicActivity {
@Override
public void onBackPressed() {
if(pagerAdapter.onBackPressed()) {
- AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
- builder.setTitle(R.string.menu_exit)
- .setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- MainActivity.super.onBackPressed();
- }
- })
- .setNegativeButton(R.string.common_cancel, null);
- AlertDialog dialog = builder.create();
- dialog.show();
+ if(lastBackPressTime < (System.currentTimeMillis() - 4000)) {
+ lastBackPressTime = System.currentTimeMillis();
+ Util.toast(this, R.string.main_back_confirm);
+ } else {
+ super.onBackPressed();
+ }
}
}