diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java index 105ec10c84..91ad06ebdb 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptions.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java @@ -39,7 +39,7 @@ public class FragmentOptions extends FragmentBase { static String[] OPTIONS_RESTART = new String[]{ "subscriptions", - "landscape", "startup", "cards", "date", "threading", "indentation", "highlight_unread", + "landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold", "name_email", "distinguish_contacts", "authentication", "subject_top", "subject_italic", "subject_ellipsize", diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java index 94db0ad28e..ba6167bf01 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java @@ -88,7 +88,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer private SwitchCompat swActionbar; private final static String[] RESET_OPTIONS = new String[]{ - "theme", "landscape", "startup", "cards", "date", "threading", "indentation", "highlight_unread", + "theme", "landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold", "name_email", "distinguish_contacts", "authentication", "subject_top", "subject_italic", "subject_ellipsize", @@ -111,9 +111,9 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swLandscape = view.findViewById(R.id.swLandscape); spStartup = view.findViewById(R.id.spStartup); swCards = view.findViewById(R.id.swCards); + swIndentation = view.findViewById(R.id.swIndentation); swDate = view.findViewById(R.id.swDate); swThreading = view.findViewById(R.id.swThreading); - swIndentation = view.findViewById(R.id.swIndentation); swHighlightUnread = view.findViewById(R.id.swHighlightUnread); swAvatars = view.findViewById(R.id.swAvatars); swGeneratedIcons = view.findViewById(R.id.swGeneratedIcons); @@ -182,6 +182,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { prefs.edit().putBoolean("cards", checked).apply(); + swIndentation.setEnabled(checked); + } + }); + + swIndentation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("indentation", checked).apply(); } }); @@ -200,13 +208,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } }); - swIndentation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("indentation", checked).apply(); - } - }); - swHighlightUnread.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -511,9 +512,10 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } swCards.setChecked(prefs.getBoolean("cards", true)); + swIndentation.setChecked(prefs.getBoolean("indentation", false)); + swIndentation.setEnabled(swCards.isChecked()); swDate.setChecked(prefs.getBoolean("date", true)); swThreading.setChecked(prefs.getBoolean("threading", true)); - swIndentation.setChecked(prefs.getBoolean("indentation", false)); swHighlightUnread.setChecked(prefs.getBoolean("highlight_unread", false)); swAvatars.setChecked(prefs.getBoolean("avatars", true)); swGeneratedIcons.setChecked(prefs.getBoolean("generated_icons", true)); diff --git a/app/src/main/java/eu/faircode/email/ViewCardOptional.java b/app/src/main/java/eu/faircode/email/ViewCardOptional.java index 352f96a02a..2ce6db815f 100644 --- a/app/src/main/java/eu/faircode/email/ViewCardOptional.java +++ b/app/src/main/java/eu/faircode/email/ViewCardOptional.java @@ -32,9 +32,9 @@ import androidx.preference.PreferenceManager; public class ViewCardOptional extends CardView { private boolean cards; + private boolean indentation; private boolean compact; private boolean threading; - private boolean indentation; private int margin; private int ident; private Integer color = null; @@ -57,9 +57,9 @@ public class ViewCardOptional extends CardView { private void init(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); cards = prefs.getBoolean("cards", true); + indentation = prefs.getBoolean("indentation", false); compact = prefs.getBoolean("compact", false); threading = prefs.getBoolean("threading", true); - indentation = prefs.getBoolean("indentation", false); margin = Helper.dp2pixels(context, compact ? 3 : 6); ident = Helper.dp2pixels(context, 12 + (compact ? 3 : 6)); diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml index 398f80ff39..9644d1ee2e 100644 --- a/app/src/main/res/layout/fragment_options_display.xml +++ b/app/src/main/res/layout/fragment_options_display.xml @@ -80,6 +80,18 @@ app:layout_constraintTop_toBottomOf="@id/spStartup" app:switchPadding="12dp" /> + + - -