mirror of https://github.com/M66B/FairEmail.git
Added setting for fixed nav menu landscape mode
This commit is contained in:
parent
21221e54bd
commit
f1e09b3385
|
@ -20,6 +20,7 @@ package eu.faircode.email;
|
|||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.os.Parcelable;
|
||||
|
@ -32,6 +33,7 @@ import android.view.ViewGroup;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
public class DrawerLayoutEx extends DrawerLayout {
|
||||
private boolean locked = false;
|
||||
|
@ -51,7 +53,9 @@ public class DrawerLayoutEx extends DrawerLayout {
|
|||
void setup(Configuration config, View drawerContainer) {
|
||||
setScrimColor(Helper.resolveColor(getContext(), R.attr.colorDrawerScrim));
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean landscape3 = prefs.getBoolean("landscape3", false);
|
||||
if (landscape3) {
|
||||
ViewGroup childContent = (ViewGroup) getChildAt(0);
|
||||
ViewGroup childDrawer = (ViewGroup) getChildAt(1);
|
||||
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
|
|
|
@ -39,7 +39,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
|
||||
static String[] OPTIONS_RESTART = new String[]{
|
||||
"subscriptions",
|
||||
"landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "color_stripe",
|
||||
"landscape", "landscape3", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "color_stripe",
|
||||
"avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
"name_email", "distinguish_contacts", "authentication",
|
||||
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize",
|
||||
|
|
|
@ -53,6 +53,7 @@ import androidx.preference.PreferenceManager;
|
|||
public class FragmentOptionsDisplay extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private Button btnTheme;
|
||||
private SwitchCompat swLandscape;
|
||||
private SwitchCompat swLandscape3;
|
||||
private Spinner spStartup;
|
||||
private SwitchCompat swCards;
|
||||
private SwitchCompat swDate;
|
||||
|
@ -95,7 +96,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swActionbar;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"theme", "landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "color_stripe",
|
||||
"theme", "landscape", "landscape3", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "color_stripe",
|
||||
"avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
"name_email", "distinguish_contacts", "authentication",
|
||||
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize",
|
||||
|
@ -116,6 +117,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
|
||||
btnTheme = view.findViewById(R.id.btnTheme);
|
||||
swLandscape = view.findViewById(R.id.swLandscape);
|
||||
swLandscape3 = view.findViewById(R.id.swLandscape3);
|
||||
spStartup = view.findViewById(R.id.spStartup);
|
||||
swCards = view.findViewById(R.id.swCards);
|
||||
swIndentation = view.findViewById(R.id.swIndentation);
|
||||
|
@ -173,6 +175,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("landscape", checked).apply();
|
||||
swLandscape3.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
|
||||
swLandscape3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("landscape3", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -559,6 +569,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
|
||||
swLandscape.setChecked(prefs.getBoolean("landscape", true));
|
||||
swLandscape.setEnabled(normal);
|
||||
swLandscape3.setChecked(prefs.getBoolean("landscape3", false));
|
||||
swLandscape3.setEnabled(normal && swLandscape.isChecked());
|
||||
|
||||
String startup = prefs.getString("startup", "unified");
|
||||
String[] startupValues = getResources().getStringArray(R.array.startupValues);
|
||||
|
|
|
@ -60,6 +60,18 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/btnTheme"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swLandscape3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_landscape3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swLandscape"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStartup"
|
||||
android:layout_width="0dp"
|
||||
|
@ -71,7 +83,7 @@
|
|||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swLandscape" />
|
||||
app:layout_constraintTop_toBottomOf="@id/swLandscape3" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spStartup"
|
||||
|
|
|
@ -263,6 +263,7 @@
|
|||
<string name="title_advanced_manage_connectivity">Manage connectivity</string>
|
||||
|
||||
<string name="title_advanced_landscape">Use two columns in landscape mode</string>
|
||||
<string name="title_advanced_landscape3">Always show navigation menu in landscape mode</string>
|
||||
<string name="title_advanced_startup">Show on start screen</string>
|
||||
<string name="title_advanced_cards">Show cards</string>
|
||||
<string name="title_advanced_date_header">Group by date</string>
|
||||
|
|
Loading…
Reference in New Issue