mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-09 10:33:41 +02:00
Added option to show number of unseen drafts in nav menu
This commit is contained in:
@@ -50,6 +50,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
||||
private LayoutInflater inflater;
|
||||
|
||||
private boolean nav_count;
|
||||
private boolean nav_unseen_drafts;
|
||||
private int colorUnread;
|
||||
private int textColorSecondary;
|
||||
|
||||
@@ -104,8 +105,8 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
||||
ivItem.clearColorFilter();
|
||||
|
||||
long count;
|
||||
if (EntityFolder.DRAFTS.equals(folder.type) ||
|
||||
EntityFolder.OUTBOX.equals(folder.type))
|
||||
if (EntityFolder.OUTBOX.equals(folder.type) ||
|
||||
(!nav_unseen_drafts && EntityFolder.DRAFTS.equals(folder.type)))
|
||||
count = folder.messages;
|
||||
else
|
||||
count = folder.unseen;
|
||||
@@ -156,6 +157,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
this.nav_count = prefs.getBoolean("nav_count", false);
|
||||
this.nav_unseen_drafts = prefs.getBoolean("nav_unseen_drafts", false);
|
||||
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);
|
||||
int colorHighlight = prefs.getInt("highlight_color", Helper.resolveColor(context, R.attr.colorUnreadHighlight));
|
||||
this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread));
|
||||
|
||||
@@ -126,7 +126,7 @@ public class FragmentOptions extends FragmentBase {
|
||||
"check_authentication", "check_reply_domain", "check_mx", "check_blocklist",
|
||||
"send_pending",
|
||||
"startup", "cards", "beige", "tabular_card_bg", "shadow_unread",
|
||||
"portrait2", "portrait2c", "landscape", "nav_count", "navbar_colorize",
|
||||
"portrait2", "portrait2c", "landscape", "nav_count", "nav_unseen_drafts", "navbar_colorize",
|
||||
"indentation", "date", "date_fixed", "date_bold", "threading", "threading_unread",
|
||||
"highlight_unread", "highlight_color", "color_stripe",
|
||||
"avatars", "bimi", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
|
||||
@@ -72,6 +72,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||
private SwitchCompat swLandscape;
|
||||
private SwitchCompat swNavOptions;
|
||||
private SwitchCompat swNavMessageCount;
|
||||
private SwitchCompat swNavUnseenDrafts;
|
||||
|
||||
private SwitchCompat swThreading;
|
||||
private SwitchCompat swThreadingUnread;
|
||||
@@ -160,7 +161,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",
|
||||
"date", "date_fixed", "date_bold",
|
||||
"portrait2", "portrait2c", "landscape", "nav_options", "nav_count", "navbar_colorize",
|
||||
"portrait2", "portrait2c", "landscape", "nav_options", "nav_count", "nav_unseen_drafts", "navbar_colorize",
|
||||
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
|
||||
"highlight_unread", "highlight_color", "color_stripe",
|
||||
"avatars", "bimi", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
@@ -201,6 +202,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||
swLandscape = view.findViewById(R.id.swLandscape);
|
||||
swNavOptions = view.findViewById(R.id.swNavOptions);
|
||||
swNavMessageCount = view.findViewById(R.id.swNavMessageCount);
|
||||
swNavUnseenDrafts = view.findViewById(R.id.swNavUnseenDrafts);
|
||||
swNavBarColorize = view.findViewById(R.id.swNavBarColorize);
|
||||
|
||||
swThreading = view.findViewById(R.id.swThreading);
|
||||
@@ -404,6 +406,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||
}
|
||||
});
|
||||
|
||||
swNavUnseenDrafts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("nav_unseen_drafts", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swNavBarColorize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -1071,6 +1080,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
||||
swLandscape.setChecked(prefs.getBoolean("landscape", true));
|
||||
swNavOptions.setChecked(prefs.getBoolean("nav_options", true));
|
||||
swNavMessageCount.setChecked(prefs.getBoolean("nav_count", false));
|
||||
swNavUnseenDrafts.setChecked(prefs.getBoolean("nav_unseen_drafts", false));
|
||||
swNavBarColorize.setChecked(prefs.getBoolean("navbar_colorize", false));
|
||||
|
||||
swThreading.setChecked(prefs.getBoolean("threading", true));
|
||||
|
||||
Reference in New Issue
Block a user