1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 12:44:42 +00:00

Added setting to display number of unread messages in a conversation

This commit is contained in:
M66B 2020-06-04 16:10:38 +02:00
parent 4bb5e13877
commit 3f62dcaeca
5 changed files with 34 additions and 5 deletions

View file

@ -224,6 +224,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean date;
private boolean threading;
private boolean threading_unread;
private boolean avatars;
private boolean color_stripe;
private boolean name_email;
@ -1043,8 +1044,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvCount.setVisibility(threading ? View.VISIBLE : View.GONE);
ivThread.setVisibility(View.VISIBLE);
if (BuildConfig.DEBUG)
tvCount.setText(NF.format(message.visible_unseen) + "/" + NF.format(message.visible));
if (threading_unread)
tvCount.setText(context.getString(R.string.title_of,
NF.format(message.visible_unseen),
NF.format(message.visible)));
else
tvCount.setText(NF.format(message.visible));
@ -4783,6 +4786,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.date = prefs.getBoolean("date", true);
this.threading = prefs.getBoolean("threading", true);
this.threading_unread = threading && prefs.getBoolean("threading_unread", false);
this.avatars = (contacts && avatars) || generated;
this.color_stripe = prefs.getBoolean("color_stripe", true);
this.name_email = prefs.getBoolean("name_email", false);

View file

@ -54,7 +54,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"subscriptions",
"landscape", "landscape3", "startup", "cards", "indentation", "date", "threading",
"landscape", "landscape3", "startup", "cards", "indentation", "date", "threading", "threading_unread",
"highlight_unread", "color_stripe",
"avatars", "gravatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "show_recipients", "authentication",

View file

@ -64,6 +64,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swLandscape3;
private SwitchCompat swThreading;
private SwitchCompat swThreadingUnread;
private SwitchCompat swIndentation;
private SwitchCompat swSeekbar;
private SwitchCompat swActionbar;
@ -118,7 +119,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "date", "navbar_colorize", "landscape", "landscape3",
"threading", "indentation", "seekbar", "actionbar", "actionbar_color",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
"highlight_unread", "color_stripe",
"avatars", "gravatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "show_recipients",
@ -150,6 +151,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swLandscape3 = view.findViewById(R.id.swLandscape3);
swThreading = view.findViewById(R.id.swThreading);
swThreadingUnread = view.findViewById(R.id.swThreadingUnread);
swIndentation = view.findViewById(R.id.swIndentation);
swSeekbar = view.findViewById(R.id.swSeekbar);
swActionbar = view.findViewById(R.id.swActionbar);
@ -268,10 +270,18 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("threading", checked).apply();
swThreadingUnread.setEnabled(checked);
WidgetUnified.updateData(getContext());
}
});
swThreadingUnread.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("threading_unread", checked).apply();
}
});
swIndentation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -725,6 +735,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swLandscape3.setEnabled(normal && swLandscape.isChecked());
swThreading.setChecked(prefs.getBoolean("threading", true));
swThreadingUnread.setChecked(prefs.getBoolean("threading_unread", false));
swThreadingUnread.setEnabled(swThreading.isChecked());
swIndentation.setChecked(prefs.getBoolean("indentation", false));
swIndentation.setEnabled(swCards.isChecked());
swSeekbar.setChecked(prefs.getBoolean("seekbar", false));

View file

@ -205,6 +205,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swThreading" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swThreadingUnread"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_threading_unread"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvThreadingHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swIndentation"
android:layout_width="0dp"
@ -214,7 +225,7 @@
android:text="@string/title_advanced_indentation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvThreadingHint"
app:layout_constraintTop_toBottomOf="@id/swThreadingUnread"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View file

@ -99,6 +99,7 @@
<string name="title_notification_failed">\'%1$s\' failed</string>
<string name="title_notification_alert">\'%1$s\' server alert</string>
<string name="title_of">%1$s/%2$s</string>
<string name="title_name_count">%1$s (%2$s)</string>
<string name="title_name_plus">%1$s +%2$d</string>
<string name="title_from_to">%1$s ➤ %2$s</string>
@ -316,6 +317,7 @@
<string name="title_advanced_cards">Use card style instead of tabular style</string>
<string name="title_advanced_date_header">Group by date</string>
<string name="title_advanced_threading">Conversation threading</string>
<string name="title_advanced_threading_unread">Show number of unread messages in conversations</string>
<string name="title_advanced_indentation">Left/right indent received/sent messages in conversations</string>
<string name="title_advanced_highlight_unread">Highlight unread messages</string>
<string name="title_advanced_highlight_subject">Highlight subject</string>