From 4f8d78d38769c3b4886596a960ba0495eb05abd5 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 20 Feb 2024 19:13:36 +0100 Subject: [PATCH] Added option for grey background color unread messages / tabular view --- .../java/eu/faircode/email/AdapterMessage.java | 6 +++++- .../java/eu/faircode/email/FragmentOptions.java | 2 +- .../eu/faircode/email/FragmentOptionsDisplay.java | 14 +++++++++++++- .../main/res/layout/fragment_options_display.xml | 15 ++++++++++++++- app/src/main/res/values/strings.xml | 1 + 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 82afd9630c..fc6804c418 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -262,6 +262,7 @@ public class AdapterMessage extends RecyclerView.Adapter 0) + color = ColorUtils.setAlphaComponent(colorSeparator, 127); + else if (split) color = ColorUtils.setAlphaComponent(textColorHighlightInverse, 127); else if (flags_background && flagged && !expanded) color = ColorUtils.setAlphaComponent(mcolor, 127); @@ -8038,6 +8041,7 @@ public class AdapterMessage extends RecyclerView.Adapter RESET_OPTIONS = Collections.unmodifiableList(Arrays.asList( "theme", "startup", "date", "date_week", "date_fixed", "date_bold", "date_time", "group_category", - "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers", + "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers", "tabular_unread_bg", "portrait2", "portrait2c", "landscape", "close_pane", "open_pane", "column_width", "hide_toolbar", "nav_options", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize", "threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color", @@ -259,6 +260,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swShadowBorder = view.findViewById(R.id.swShadowBorder); swShadowHighlight = view.findViewById(R.id.swShadowHighlight); swTabularDividers = view.findViewById(R.id.swTabularDividers); + swTabularUnreadBg = view.findViewById(R.id.swTabularUnreadBg); swPortrait2 = view.findViewById(R.id.swPortrait2); swPortrait2c = view.findViewById(R.id.swPortrait2c); spPortraitMinSize = view.findViewById(R.id.spPortraitMinSize); @@ -492,6 +494,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swShadowBorder.setEnabled(swShadow.isEnabled() && checked); swShadowHighlight.setEnabled(swShadow.isEnabled() && checked); swTabularDividers.setEnabled(!checked); + swTabularUnreadBg.setEnabled(!checked); swIndentation.setEnabled(checked); } }); @@ -541,6 +544,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } }); + swTabularUnreadBg.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("tabular_unread_bg", checked).apply(); + } + }); + swPortrait2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -1542,6 +1552,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swShadowHighlight.setEnabled(swShadow.isEnabled() && swShadow.isChecked()); swTabularDividers.setChecked(prefs.getBoolean("dividers", true)); swTabularDividers.setEnabled(!swCards.isChecked()); + swTabularUnreadBg.setChecked(prefs.getBoolean("tabular_unread_bg", false)); + swTabularUnreadBg.setEnabled(!swCards.isChecked()); swPortrait2.setChecked(prefs.getBoolean("portrait2", false)); swPortrait2c.setChecked(prefs.getBoolean("portrait2c", false) && !swPortrait2.isChecked()); spPortraitMinSize.setSelection(prefs.getInt("portrait_min_size", 0)); diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml index 2ecdbee335..3f33c1dfd2 100644 --- a/app/src/main/res/layout/fragment_options_display.xml +++ b/app/src/main/res/layout/fragment_options_display.xml @@ -315,6 +315,19 @@ app:layout_constraintTop_toBottomOf="@id/swShadowHighlight" app:switchPadding="12dp" /> + + + app:layout_constraintTop_toBottomOf="@id/swTabularUnreadBg" /> Show border Use highlight color instead of accent color Use divider lines when using tabular style + Use a gray background color for unread messages when using table style Group by date Group by week instead of day Show fixed date header at the top