summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2023-02-28 20:42:46 +0100
committerGitHub <noreply@github.com>2023-02-28 20:42:46 +0100
commit5e75c968ad146c6969db98d53be126c7bb74d5e3 (patch)
treec1b08dbf3ec9ac4be2c569868aa24824b5d60eb7
parentebcb5e2a7c83c16560b0b9851dda01b2d7717d16 (diff)
downloadAntennaPod-5e75c968ad146c6969db98d53be126c7bb74d5e3.zip
Re-add setting to open drawer when pressing back (#6355)
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java6
-rw-r--r--app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java5
-rw-r--r--app/src/main/res/xml/preferences_user_interface.xml5
-rw-r--r--storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java5
-rw-r--r--ui/i18n/src/main/res/values/strings.xml2
5 files changed, 22 insertions, 1 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
index 6b2267926..6782e9274 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
@@ -493,7 +493,11 @@ public class MainActivity extends CastEnabledActivity {
String toPage = UserPreferences.getDefaultPage();
if (NavDrawerFragment.getLastNavFragment(this).equals(toPage)
|| UserPreferences.DEFAULT_PAGE_REMEMBER.equals(toPage)) {
- super.onBackPressed();
+ if (UserPreferences.backButtonOpensDrawer() && drawerLayout != null) {
+ drawerLayout.openDrawer(navDrawer);
+ } else {
+ super.onBackPressed();
+ }
} else {
loadFragment(toPage, null);
}
diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java
index e093c067d..f6bb286f9 100644
--- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java
+++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java
@@ -133,5 +133,10 @@ public class PreferenceUpgrader {
"" + UserPreferences.EPISODE_CACHE_SIZE_UNLIMITED).apply();
}
}
+ if (oldVersion < 3000007) {
+ if (prefs.getString("prefBackButtonBehavior", "").equals("drawer")) {
+ prefs.edit().putBoolean(UserPreferences.PREF_BACK_OPENS_DRAWER, true).apply();
+ }
+ }
}
}
diff --git a/app/src/main/res/xml/preferences_user_interface.xml b/app/src/main/res/xml/preferences_user_interface.xml
index f11b89be7..66b971089 100644
--- a/app/src/main/res/xml/preferences_user_interface.xml
+++ b/app/src/main/res/xml/preferences_user_interface.xml
@@ -88,6 +88,11 @@
android:title="@string/pref_default_page"
android:summary="@string/pref_default_page_sum"
android:defaultValue="HomeFragment"/>
+ <SwitchPreferenceCompat
+ android:key="prefBackButtonOpensDrawer"
+ android:title="@string/pref_back_button_opens_drawer"
+ android:summary="@string/pref_back_button_opens_drawer_summary"
+ android:defaultValue="false"/>
<Preference
android:key="prefSwipe"
android:summary="@string/swipeactions_summary"
diff --git a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java
index 895d0ab6f..4d2e7394f 100644
--- a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java
+++ b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java
@@ -63,6 +63,7 @@ public class UserPreferences {
public static final String PREF_DEFAULT_PAGE = "prefDefaultPage";
public static final String PREF_FILTER_FEED = "prefSubscriptionsFilter";
public static final String PREF_SUBSCRIPTION_TITLE = "prefSubscriptionTitle";
+ public static final String PREF_BACK_OPENS_DRAWER = "prefBackButtonOpensDrawer";
public static final String PREF_QUEUE_KEEP_SORTED = "prefQueueKeepSorted";
public static final String PREF_QUEUE_KEEP_SORTED_ORDER = "prefQueueKeepSortedOrder";
@@ -869,6 +870,10 @@ public class UserPreferences {
prefs.edit().putString(PREF_DEFAULT_PAGE, defaultPage).apply();
}
+ public static boolean backButtonOpensDrawer() {
+ return prefs.getBoolean(PREF_BACK_OPENS_DRAWER, false);
+ }
+
public static boolean timeRespectsSpeed() {
return prefs.getBoolean(PREF_TIME_RESPECTS_SPEED, false);
}
diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml
index 4943f5a1e..71582087a 100644
--- a/ui/i18n/src/main/res/values/strings.xml
+++ b/ui/i18n/src/main/res/values/strings.xml
@@ -514,6 +514,8 @@
<string name="behavior">Behavior</string>
<string name="pref_default_page">Default Page</string>
<string name="pref_default_page_sum">Screen that is opened when starting AntennaPod.</string>
+ <string name="pref_back_button_opens_drawer">Back button opens drawer</string>
+ <string name="pref_back_button_opens_drawer_summary">Pressing the back button on the default page opens the navigation drawer</string>
<string name="remember_last_page">Remember last page</string>
<string name="pref_delete_removes_from_queue_title">Delete removes from Queue</string>
<string name="pref_delete_removes_from_queue_sum">Automatically remove an episode from the queue when it is deleted.</string>