diff options
author | Petar Kukolj <petarkukolj3@yahoo.com> | 2018-11-17 20:13:35 +0100 |
---|---|---|
committer | Petar Kukolj <petarkukolj3@yahoo.com> | 2018-11-17 20:13:35 +0100 |
commit | 0d1b9c4c55436ae77bbd3067f4eb839a71c20934 (patch) | |
tree | 40cba39fe055a734ebc728701f8448599a837544 /core | |
parent | c2f543ffe4a8f0ceae9ab0b832f055ee023e9637 (diff) | |
download | AntennaPod-0d1b9c4c55436ae77bbd3067f4eb839a71c20934.zip |
Use fragment tags instead of position indexes for saving chosen fragment
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java index f964fd23a..c44999c88 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java @@ -813,7 +813,7 @@ public class UserPreferences { } public enum BackButtonBehavior { - DEFAULT, OPEN_DRAWER, DOUBLE_TAP, SHOW_PROMPT, GO_TO_QUEUE, GO_TO_EPISODES, GO_TO_SUBSCRIPTIONS + DEFAULT, OPEN_DRAWER, DOUBLE_TAP, SHOW_PROMPT, GO_TO_PAGE } public static BackButtonBehavior getBackButtonBehavior() { @@ -822,24 +822,18 @@ public class UserPreferences { case "drawer": return BackButtonBehavior.OPEN_DRAWER; case "doubletap": return BackButtonBehavior.DOUBLE_TAP; case "prompt": return BackButtonBehavior.SHOW_PROMPT; - case "page": - switch (UserPreferences.getBackButtonGoToPage()) { - case 0: return BackButtonBehavior.GO_TO_QUEUE; - case 1: return BackButtonBehavior.GO_TO_EPISODES; - case 2: return BackButtonBehavior.GO_TO_SUBSCRIPTIONS; - default: return BackButtonBehavior.GO_TO_QUEUE; - } + case "page": return BackButtonBehavior.GO_TO_PAGE; default: return BackButtonBehavior.DEFAULT; } } - public static int getBackButtonGoToPage() { - return prefs.getInt(PREF_BACK_BUTTON_GO_TO_PAGE, 0); + public static String getBackButtonGoToPage() { + return prefs.getString(PREF_BACK_BUTTON_GO_TO_PAGE, "QueueFragment"); } - public static void setBackButtonGoToPage(int page) { + public static void setBackButtonGoToPage(String tag) { prefs.edit() - .putInt(PREF_BACK_BUTTON_GO_TO_PAGE, page) + .putString(PREF_BACK_BUTTON_GO_TO_PAGE, tag) .apply(); } } |