From c7ad6e057a0dc0c56b357b1110b7cca9b12de7cc Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 22 Jan 2022 11:12:33 +0100 Subject: [PATCH] Added option to enable grouping by account category --- CHANGELOG.md | 1 + app/src/main/assets/CHANGELOG.md | 1 + .../java/eu/faircode/email/FragmentMessages.java | 5 ++++- .../java/eu/faircode/email/FragmentOptions.java | 2 +- .../eu/faircode/email/FragmentOptionsDisplay.java | 12 +++++++++++- .../main/res/layout/fragment_options_display.xml | 14 +++++++++++++- app/src/main/res/values/strings.xml | 1 + metadata/en-US/changelogs/1817.txt | 1 + 8 files changed, 33 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 995abdeae2..8162d33859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Next version * Added colors to reply templates +* Added option to group messages by account category (default disabled) * Small improvements and minor bug fixes ### 1.1817 - 2022-01-21 diff --git a/app/src/main/assets/CHANGELOG.md b/app/src/main/assets/CHANGELOG.md index 995abdeae2..8162d33859 100644 --- a/app/src/main/assets/CHANGELOG.md +++ b/app/src/main/assets/CHANGELOG.md @@ -7,6 +7,7 @@ ### Next version * Added colors to reply templates +* Added option to group messages by account category (default disabled) * Small improvements and minor bug fixes ### 1.1817 - 2022-01-21 diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 6b138f837e..b18c67ec32 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -309,6 +309,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. private WebView printWebView = null; private boolean cards; + private boolean category; private boolean date; private boolean date_fixed; private boolean date_bold; @@ -437,6 +438,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. swipenav = prefs.getBoolean("swipenav", true); cards = prefs.getBoolean("cards", true); + category = prefs.getBoolean("group_category", false); date = prefs.getBoolean("date", true); date_fixed = (!date && prefs.getBoolean("date_fixed", false)); date_bold = prefs.getBoolean("date_bold", false); @@ -817,7 +819,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. if (message == null) return null; - boolean ch = (viewType == AdapterMessage.ViewType.UNIFIED && + boolean ch = (category && + viewType == AdapterMessage.ViewType.UNIFIED && (pos == 0 ? message.accountCategory != null : !Objects.equals(prev.accountCategory, message.accountCategory))); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java index 47c049f570..c365ab7e5a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptions.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java @@ -132,7 +132,7 @@ public class FragmentOptions extends FragmentBase { "startup", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight", "portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size", "nav_count", "nav_unseen_drafts", "navbar_colorize", - "indentation", "date", "date_fixed", "date_bold", "threading", "threading_unread", + "indentation", "group_category", "date", "date_fixed", "date_bold", "threading", "threading_unread", "highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide", "avatars", "bimi", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold", "authentication", "authentication_indicator", diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java index 8874fc9884..234fece9e7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java @@ -64,6 +64,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer private SwitchCompat swTabularBackground; private SwitchCompat swShadow; private SwitchCompat swShadowHighlight; + private SwitchCompat swCategory; private SwitchCompat swDate; private SwitchCompat swDateFixed; private SwitchCompat swDateBold; @@ -166,7 +167,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer private final static String[] RESET_OPTIONS = new String[]{ "theme", "startup", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight", - "date", "date_fixed", "date_bold", + "group_category", "date", "date_fixed", "date_bold", "portrait2", "portrait2c", "landscape", "close_pane", "nav_options", "nav_count", "nav_unseen_drafts", "navbar_colorize", "threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color", @@ -202,6 +203,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swTabularBackground = view.findViewById(R.id.swTabularCardBackground); swShadow = view.findViewById(R.id.swShadow); swShadowHighlight = view.findViewById(R.id.swShadowHighlight); + swCategory = view.findViewById(R.id.swCategory); swDate = view.findViewById(R.id.swDate); swDateFixed = view.findViewById(R.id.swDateFixed); swDateBold = view.findViewById(R.id.swDateBold); @@ -369,6 +371,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } }); + swCategory.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("group_category", checked).apply(); + } + }); + swDate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -1148,6 +1157,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swTabularBackground.setEnabled(!swCards.isChecked()); swShadow.setEnabled(swCards.isChecked()); swShadowHighlight.setEnabled(swShadow.isEnabled() && swShadow.isChecked()); + swCategory.setChecked(prefs.getBoolean("group_category", false)); swDate.setChecked(prefs.getBoolean("date", true)); swDateFixed.setChecked(prefs.getBoolean("date_fixed", false)); swDateFixed.setEnabled(!swDate.isChecked()); diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml index f06daf429a..cf9d4215f4 100644 --- a/app/src/main/res/layout/fragment_options_display.xml +++ b/app/src/main/res/layout/fragment_options_display.xml @@ -183,6 +183,18 @@ app:layout_constraintTop_toBottomOf="@id/swShadow" app:switchPadding="12dp" /> + + Use card color as background color when using tabular style Use shadow for unread messages when using card style Use highlight color instead of accent color + Group by account category Group by date Show fixed date header at the top Show date in bold diff --git a/metadata/en-US/changelogs/1817.txt b/metadata/en-US/changelogs/1817.txt index 995abdeae2..8162d33859 100644 --- a/metadata/en-US/changelogs/1817.txt +++ b/metadata/en-US/changelogs/1817.txt @@ -7,6 +7,7 @@ ### Next version * Added colors to reply templates +* Added option to group messages by account category (default disabled) * Small improvements and minor bug fixes ### 1.1817 - 2022-01-21