Optionally indicate unexposed messages

This commit is contained in:
M66B 2024-03-03 10:26:09 +01:00
parent a2aee58f4a
commit 6413440692
7 changed files with 63 additions and 13 deletions

View File

@ -91,6 +91,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
private int colorUnread;
private int textColorSecondary;
private int textColorTertiary;
private boolean show_unexposed;
private boolean debug;
private List<TupleAccountFolder> all = new ArrayList<>();
@ -225,9 +226,15 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
tvName.setTextColor(account.protocol == EntityAccount.TYPE_IMAP
? textColorSecondary : colorWarning);
} else {
if (account.unseen > 0)
tvName.setText(context.getString(R.string.title_name_count, account.name, NF.format(account.unseen)));
else
int unexposed = (show_unexposed ? account.unexposed : 0);
if (account.unseen > 0 || unexposed > 0) {
StringBuilder sb = new StringBuilder();
if (account.unseen > 0)
sb.append(NF.format(account.unseen));
if (unexposed > 0)
sb.append('\u207A');
tvName.setText(context.getString(R.string.title_name_count, account.name, sb));
} else
tvName.setText(account.name);
tvName.setTypeface(account.unseen > 0 ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
@ -881,6 +888,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread));
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
this.textColorTertiary = Helper.resolveColor(context, android.R.attr.textColorTertiary);
this.show_unexposed = prefs.getBoolean("show_unexposed", false);
this.debug = prefs.getBoolean("debug", false);
this.DTF = Helper.getDateTimeInstance(context, DateFormat.SHORT, DateFormat.MEDIUM);

View File

@ -109,6 +109,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
private int colorUnread;
private int colorControlNormal;
private int colorSeparator;
private boolean show_unexposed;
private boolean debug;
private String search = null;
@ -345,11 +346,20 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
int cunseen = (folder.collapsed ? folder.childs_unseen : 0);
int unseen = folder.unseen + cunseen;
if (unseen > 0)
int unexposed = (show_unexposed ? folder.unexposed : 0);
if (unseen > 0 || unexposed > 0) {
StringBuilder sb = new StringBuilder();
if (unseen > 0) {
if (cunseen > 0)
sb.append('\u25BE');
sb.append(NF.format(unseen));
}
if (unexposed > 0)
sb.append('\u207A');
tvName.setText(context.getString(R.string.title_name_count,
folder.getDisplayName(context, folder.parent_ref == null ? null : folder.parent_ref),
(cunseen > 0 ? "" : "") + NF.format(unseen)));
else
folder.getDisplayName(context, folder.parent_ref), sb));
} else
tvName.setText(folder.getDisplayName(context, folder.parent_ref));
tvName.setTypeface(unseen > 0 ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
@ -1463,6 +1473,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread));
this.colorControlNormal = Helper.resolveColor(context, androidx.appcompat.R.attr.colorControlNormal);
this.colorSeparator = Helper.resolveColor(context, R.attr.colorSeparator);
this.show_unexposed = prefs.getBoolean("show_unexposed", false);
this.debug = prefs.getBoolean("debug", false);
setHasStableIds(true);

View File

@ -60,6 +60,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
private boolean nav_count_pinned;
private boolean nav_unseen_drafts;
private boolean nav_categories;
private boolean show_unexposed;
private int dp6;
private int dp12;
@ -155,10 +156,17 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
ivItem.setColorFilter(color);
String name = account.getName(context);
if (count == 0)
int unexposed = (show_unexposed ? account.unexposed : 0);
if (count == 0 && unexposed == 0)
tvItem.setText(name);
else
tvItem.setText(context.getString(R.string.title_name_count, name, NF.format(count)));
else {
StringBuilder sb = new StringBuilder();
if (count > 0)
sb.append(NF.format(count));
if (unexposed > 0)
sb.append('\u207A');
tvItem.setText(context.getString(R.string.title_name_count, name, sb));
}
tvItem.setTextColor(count == 0 ? textColorSecondary : colorUnread);
tvItem.setTypeface(count == 0 ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD);
@ -287,6 +295,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
this.nav_count_pinned = prefs.getBoolean("nav_count_pinned", false);
this.nav_unseen_drafts = prefs.getBoolean("nav_unseen_drafts", false);
this.nav_categories = prefs.getBoolean("nav_categories", false);
this.show_unexposed = prefs.getBoolean("show_unexposed", false);
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);
int colorHighlight = prefs.getInt("highlight_color", Helper.resolveColor(context, R.attr.colorUnreadHighlight));

View File

@ -143,7 +143,7 @@ public class FragmentOptions extends FragmentBase {
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers", "tabular_unread_bg",
"portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size",
"column_width",
"hide_toolbar", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",
"hide_toolbar", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed", "navbar_colorize",
"indentation", "date", "date_week", "date_fixed", "date_bold", "date_time", "threading", "threading_unread",
"show_filtered",
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",

View File

@ -99,6 +99,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swNavMessageCount;
private SwitchCompat swNavUnseenDrafts;
private SwitchCompat swNavPinnedCount;
private SwitchCompat swShowUnexposed;
private SwitchCompat swNavBarColorize;
private SwitchCompat swThreading;
@ -213,7 +214,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"date", "date_week", "date_fixed", "date_bold", "date_time", "group_category",
"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",
"hide_toolbar", "nav_options", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed", "navbar_colorize",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color",
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
"avatars", "bimi", "gravatars", "libravatars", "favicons", "favicons_partial", "favicons_manifest", "generated_icons", "identicons",
@ -277,6 +278,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swNavMessageCount = view.findViewById(R.id.swNavMessageCount);
swNavUnseenDrafts = view.findViewById(R.id.swNavUnseenDrafts);
swNavPinnedCount = view.findViewById(R.id.swNavPinnedCount);
swShowUnexposed = view.findViewById(R.id.swShowUnexposed);
swNavBarColorize = view.findViewById(R.id.swNavBarColorize);
swThreading = view.findViewById(R.id.swThreading);
@ -686,6 +688,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swShowUnexposed.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("show_unexposed", checked).apply();
}
});
swNavBarColorize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1574,6 +1583,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swNavMessageCount.setChecked(prefs.getBoolean("nav_count", false));
swNavUnseenDrafts.setChecked(prefs.getBoolean("nav_unseen_drafts", false));
swNavPinnedCount.setChecked(prefs.getBoolean("nav_count_pinned", false));
swShowUnexposed.setChecked(prefs.getBoolean("show_unexposed", false));
swNavBarColorize.setChecked(prefs.getBoolean("navbar_colorize", false));
swThreading.setChecked(prefs.getBoolean("threading", true));

View File

@ -664,6 +664,17 @@
app:layout_constraintTop_toBottomOf="@id/swNavUnseenDrafts"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swShowUnexposed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_show_unexposed"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNavPinnedCount"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNavBarColorize"
android:layout_width="0dp"
@ -672,7 +683,7 @@
android:text="@string/title_advanced_navbar_colorize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNavPinnedCount"
app:layout_constraintTop_toBottomOf="@id/swShowUnexposed"
app:switchPadding="12dp" />
<TextView

View File

@ -571,6 +571,7 @@
<string name="title_advanced_nav_message_count">Show number of locally stored messages in the navigation menu</string>
<string name="title_advanced_nav_unseen_drafts">Show number of unread drafts in the navigation menu</string>
<string name="title_advanced_nav_pinned_count">Show the number of unread messages in the pinned navigation menu</string>
<string name="title_advanced_show_unexposed">Show a small plus sign for accounts/folders with unseen messages</string>
<string name="title_advanced_startup">Show on start screen</string>
<string name="title_advanced_cards">Use card style instead of tabular style</string>
<string name="title_advanced_category">The account category can be configured in the advanced account options via the main settings screen</string>