mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
New option: Disable Immersive Interface in Landscape Mode.
This commit is contained in:
parent
ba75ae1f53
commit
ba546a27e4
@ -89,6 +89,9 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
int systemThemeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
immersiveInterface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
||||
mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true);
|
||||
if (immersiveInterface && config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
immersiveInterface = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMMERSIVE_INTERFACE_IN_LANDSCAPE_MODE, false);
|
||||
}
|
||||
switch (systemThemeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
|
@ -7,8 +7,8 @@ import androidx.preference.SwitchPreference;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent;
|
||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||
|
||||
public class ImmersiveInterfacePreferenceFragment extends PreferenceFragmentCompat {
|
||||
@ -19,8 +19,10 @@ public class ImmersiveInterfacePreferenceFragment extends PreferenceFragmentComp
|
||||
|
||||
SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY);
|
||||
SwitchPreference immersiveInterfaceIgnoreNavBarSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY);
|
||||
SwitchPreference disableImmersiveInterfaceInLandscapeModeSwitch = findPreference(SharedPreferencesUtils.DISABLE_IMMERSIVE_INTERFACE_IN_LANDSCAPE_MODE);
|
||||
|
||||
if (immersiveInterfaceSwitch != null && immersiveInterfaceIgnoreNavBarSwitch != null) {
|
||||
if (immersiveInterfaceSwitch != null && immersiveInterfaceIgnoreNavBarSwitch != null
|
||||
&& disableImmersiveInterfaceInLandscapeModeSwitch != null) {
|
||||
immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
if ((Boolean) newValue) {
|
||||
immersiveInterfaceIgnoreNavBarSwitch.setVisible(true);
|
||||
@ -41,6 +43,11 @@ public class ImmersiveInterfacePreferenceFragment extends PreferenceFragmentComp
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
});
|
||||
|
||||
disableImmersiveInterfaceInLandscapeModeSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -35,6 +35,7 @@ public class SharedPreferencesUtils {
|
||||
public static final String IMMERSIVE_INTERFACE_ENTRY_KEY = "immersive_interface_entry";
|
||||
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 DISABLE_IMMERSIVE_INTERFACE_IN_LANDSCAPE_MODE = "disable_immersive_interface_in_landscape_mode";
|
||||
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";
|
||||
|
||||
|
@ -359,6 +359,7 @@
|
||||
<string name="settings_immersive_interface_summary">Does Not Apply to All Pages</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_disable_immersive_interface_in_landscape_mode">Disable Immersive Interface in Landscape Mode</string>
|
||||
<string name="settings_customize_tabs_in_main_page_title">Customize Tabs in Main Page</string>
|
||||
<string name="only_for_logged_in_user">Only for Logged-in User</string>
|
||||
<string name="settings_enable_bottom_app_bar_title">Enable Bottom Navigation</string>
|
||||
|
@ -13,4 +13,9 @@
|
||||
app:title="@string/settings_immersive_interface_ignore_nav_bar_title"
|
||||
app:summary="@string/settings_immersive_interface_ignore_nav_bar_summary" />
|
||||
|
||||
<SwitchPreference
|
||||
app:defaultValue="false"
|
||||
app:key="disable_immersive_interface_in_landscape_mode"
|
||||
app:title="@string/settings_disable_immersive_interface_in_landscape_mode"/>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user