Added option to enable grouping by account category

This commit is contained in:
M66B 2022-01-22 11:12:33 +01:00
parent ce994756ab
commit c7ad6e057a
8 changed files with 33 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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)));

View File

@ -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",

View File

@ -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());

View File

@ -183,6 +183,18 @@
app:layout_constraintTop_toBottomOf="@id/swShadow"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCategory"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_category_header"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swShadowHighlight"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDate"
android:layout_width="0dp"
@ -192,7 +204,7 @@
android:text="@string/title_advanced_date_header"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swShadowHighlight"
app:layout_constraintTop_toBottomOf="@id/swCategory"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

View File

@ -447,6 +447,7 @@
<string name="title_advanced_tabular_background">Use card color as background color when using tabular style</string>
<string name="title_advanced_cards_shadow">Use shadow for unread messages when using card style</string>
<string name="title_advanced_cards_shadow_highlight">Use highlight color instead of accent color</string>
<string name="title_advanced_category_header">Group by account category</string>
<string name="title_advanced_date_header">Group by date</string>
<string name="title_advanced_date_fixed">Show fixed date header at the top</string>
<string name="title_advanced_date_bold">Show date in bold</string>

View File

@ -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