aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-20 12:45:41 -0700
committerScott Jackson <daneren2005@gmail.com>2015-03-20 12:45:41 -0700
commit2bddf1ed5bdd8dd611c768c6598b49893d9ca481 (patch)
treecf39b9e9c11685652bd2d4ed82d802a00bc77a69 /src
parent34e679f3c63fcda301f3faf654c580721a10c070 (diff)
parente9a4a2839b205c4351cc2ade00f4e4b5efb7dc29 (diff)
downloaddsub-2bddf1ed5bdd8dd611c768c6598b49893d9ca481.tar.gz
dsub-2bddf1ed5bdd8dd611c768c6598b49893d9ca481.tar.bz2
dsub-2bddf1ed5bdd8dd611c768c6598b49893d9ca481.zip
Merge pull request #473 from MarkAdamson/master
Add option to disable 'Press back again to exit' prompt
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java2
-rw-r--r--src/github/daneren2005/dsub/util/Constants.java1
-rw-r--r--src/github/daneren2005/dsub/util/Util.java5
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");