mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-29 11:15:51 +00:00
Added option to show number of unseen drafts in nav menu
This commit is contained in:
parent
648728d1fa
commit
eb733656a3
5 changed files with 29 additions and 5 deletions
|
@ -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));
|
||||
|
|
|
@ -344,6 +344,17 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/swNavOptions"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNavUnseenDrafts"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_nav_unseen_drafts"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swNavMessageCount"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNavBarColorize"
|
||||
android:layout_width="0dp"
|
||||
|
@ -352,7 +363,7 @@
|
|||
android:text="@string/title_advanced_navbar_colorize"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swNavMessageCount"
|
||||
app:layout_constraintTop_toBottomOf="@id/swNavUnseenDrafts"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
|
|
@ -421,6 +421,7 @@
|
|||
<string name="title_advanced_nav_hide_title">Hide navigation menu options?</string>
|
||||
<string name="title_advanced_nav_hide_message">You can enable the options again in the display settings</string>
|
||||
<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_startup">Show on start screen</string>
|
||||
<string name="title_advanced_cards">Use card style instead of tabular style</string>
|
||||
<string name="title_advanced_cards_beige">Use beige background when using card style (light themes only)</string>
|
||||
|
|
Loading…
Reference in a new issue