diff options
author | Mark Adamson <markadamson83@gmail.com> | 2015-03-20 13:57:33 +0000 |
---|---|---|
committer | Mark Adamson <markadamson83@gmail.com> | 2015-03-20 13:57:33 +0000 |
commit | e9a4a2839b205c4351cc2ade00f4e4b5efb7dc29 (patch) | |
tree | cf39b9e9c11685652bd2d4ed82d802a00bc77a69 /src/github/daneren2005 | |
parent | 34e679f3c63fcda301f3faf654c580721a10c070 (diff) | |
download | dsub-e9a4a2839b205c4351cc2ade00f4e4b5efb7dc29.tar.gz dsub-e9a4a2839b205c4351cc2ade00f4e4b5efb7dc29.tar.bz2 dsub-e9a4a2839b205c4351cc2ade00f4e4b5efb7dc29.zip |
Add option to disable 'Press back again to exit' prompt
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java | 2 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/util/Constants.java | 1 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/util/Util.java | 5 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java index 791fa1c6..74329dd0 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java @@ -362,7 +362,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity { @Override
public void onBackPressed() {
if(onBackPressedSupport()) {
- if(lastBackPressTime < (System.currentTimeMillis() - 4000)) {
+ if(!Util.disableExitPrompt(this) && lastBackPressTime < (System.currentTimeMillis() - 4000)) {
lastBackPressTime = System.currentTimeMillis();
Util.toast(this, R.string.main_back_confirm);
} else {
diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java index b0bbfe31..0102aba1 100644 --- a/src/github/daneren2005/dsub/util/Constants.java +++ b/src/github/daneren2005/dsub/util/Constants.java @@ -153,6 +153,7 @@ public final class Constants { public static final String PREFERENCES_KEY_REPLAY_GAIN_TYPE= "replayGainType"; public static final String PREFERENCES_KEY_ALBUMS_PER_FOLDER = "albumsPerFolder"; public static final String PREFERENCES_KEY_CAST_PROXY = "castProxy"; + public static final String PREFERENCES_KEY_DISABLE_EXIT_PROMPT = "disableExitPrompt"; public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount"; public static final String OFFLINE_SCROBBLE_ID = "scrobbleID"; diff --git a/src/github/daneren2005/dsub/util/Util.java b/src/github/daneren2005/dsub/util/Util.java index d23d7300..4d2a9a1a 100644 --- a/src/github/daneren2005/dsub/util/Util.java +++ b/src/github/daneren2005/dsub/util/Util.java @@ -424,6 +424,11 @@ public final class Util { return prefs.getString(Constants.PREFERENCES_KEY_OPEN_TO_TAB, null); } + public static boolean disableExitPrompt(Context context) { + SharedPreferences prefs = getPreferences(context); + return prefs.getBoolean(Constants.PREFERENCES_KEY_DISABLE_EXIT_PROMPT, false); + } + public static String getVideoPlayerType(Context context) { SharedPreferences prefs = getPreferences(context); return prefs.getString(Constants.PREFERENCES_KEY_VIDEO_PLAYER, "raw"); |