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