aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java20
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java1
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml/interface_preference.xml7
5 files changed, 33 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
index c5b7f36f..bbbdf950 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
@@ -207,6 +207,10 @@ public abstract class BaseActivity extends AppCompatActivity {
}
public int getNavBarHeight() {
+ if (getSharedPreferences().getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY, false)) {
+ return 0;
+ }
+
Resources resources = getResources();
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
if (navBarResourceId > 0) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java
index 56c65426..c3c21c1c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java
@@ -30,6 +30,7 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
setPreferencesFromResource(R.xml.interface_preference, rootKey);
SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY);
+ SwitchPreference immersiveInterfaceIgnoreNavBarSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY);
SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
SwitchPreference showElapsedTimeSwitch = findPreference(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY);
@@ -37,15 +38,32 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT);
SwitchPreference showAbsoluteNumberOfVotes = findPreference(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES);
- if (immersiveInterfaceSwitch != null) {
+ if (immersiveInterfaceSwitch != null && immersiveInterfaceIgnoreNavBarSwitch != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
immersiveInterfaceSwitch.setVisible(true);
immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ if ((Boolean) newValue) {
+ immersiveInterfaceIgnoreNavBarSwitch.setVisible(true);
+ } else {
+ immersiveInterfaceIgnoreNavBarSwitch.setVisible(false);
+ }
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ return true;
+ });
+
+ if (immersiveInterfaceSwitch.isChecked()) {
+ immersiveInterfaceIgnoreNavBarSwitch.setVisible(true);
+ } else {
+ immersiveInterfaceIgnoreNavBarSwitch.setVisible(false);
+ }
+
+ immersiveInterfaceIgnoreNavBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
return true;
});
} else {
immersiveInterfaceSwitch.setVisible(false);
+ immersiveInterfaceIgnoreNavBarSwitch.setVisible(false);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
index 374a814a..ec523487 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
@@ -31,6 +31,7 @@ public class SharedPreferencesUtils {
public static final String CONTENT_FONT_SIZE_KEY = "content_font_size";
public static final String AMOLED_DARK_KEY = "amoled_dark";
public static final String IMMERSIVE_INTERFACE_KEY = "immersive_interface";
+ public static final String IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY = "immersive_interface_ignore_nav_bar";
public static final String BOTTOM_APP_BAR_KEY = "bottom_app_bar";
public static final String VOTE_BUTTONS_ON_THE_RIGHT_KEY = "vote_buttons_on_the_right";
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2fbdb3c1..6004a940 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -312,6 +312,8 @@
<string name="settings_gestures_and_buttons_title">Gestures &amp; Buttons</string>
<string name="settings_open_link_in_app_title">Open Link In App</string>
<string name="settings_immersive_interface_title">Immersive Interface</string>
+ <string name="settings_immersive_interface_ignore_nav_bar_title">Ignore Navigation Bar in Immersive Interface</string>
+ <string name="settings_immersive_interface_ignore_nav_bar_summary">Prevent the Bottom Navigation Bar Having Extra Padding</string>
<string name="settings_enable_bottom_app_bar_title">Enable Bottom Navigation</string>
<string name="settings_enable_bottom_app_bar_summary">Has No Effect in Anonymous Mode</string>
<string name="settings_vote_buttons_on_the_right_title">Vote Buttons on the Right</string>
diff --git a/app/src/main/res/xml/interface_preference.xml b/app/src/main/res/xml/interface_preference.xml
index c23b977d..8b67a3bc 100644
--- a/app/src/main/res/xml/interface_preference.xml
+++ b/app/src/main/res/xml/interface_preference.xml
@@ -15,6 +15,13 @@
<SwitchPreference
app:defaultValue="false"
+ app:key="immersive_interface_ignore_nav_bar"
+ app:title="@string/settings_immersive_interface_ignore_nav_bar_title"
+ app:summary="@string/settings_immersive_interface_ignore_nav_bar_summary"
+ app:isPreferenceVisible="false" />
+
+ <SwitchPreference
+ app:defaultValue="false"
app:key="bottom_app_bar"
app:title="@string/settings_enable_bottom_app_bar_title"
app:summary="@string/settings_enable_bottom_app_bar_summary" />