Added option to not shown unread in nav menu

pull/217/head
M66B 7 months ago
parent 5085ecf619
commit e0e3f5819d

@ -58,6 +58,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
private boolean nav_last_sync;
private boolean nav_count;
private boolean nav_count_pinned;
private boolean nav_unseen;
private boolean nav_unseen_drafts;
private boolean nav_categories;
private boolean show_unexposed;
@ -139,7 +140,9 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
}
int count;
if ((!nav_unseen_drafts && EntityFolder.DRAFTS.equals(account.folderType)))
if (!nav_unseen)
count = 0;
else if ((!nav_unseen_drafts && EntityFolder.DRAFTS.equals(account.folderType)))
count = account.messages;
else
count = account.unseen;
@ -293,6 +296,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
this.nav_last_sync = prefs.getBoolean("nav_last_sync", true);
this.nav_count = prefs.getBoolean("nav_count", false);
this.nav_count_pinned = prefs.getBoolean("nav_count_pinned", false);
this.nav_unseen = prefs.getBoolean("nav_unseen", true);
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);

@ -58,6 +58,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
private int dp12;
private boolean nav_count;
private boolean nav_count_pinned;
private boolean nav_unseen;
private boolean nav_unseen_drafts;
private boolean nav_categories;
private int colorUnread;
@ -124,8 +125,11 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
ivItem.clearColorFilter();
int count;
if (EntityFolder.OUTBOX.equals(folder.type) ||
(!nav_unseen_drafts && EntityFolder.DRAFTS.equals(folder.type)))
if (EntityFolder.OUTBOX.equals(folder.type))
count = folder.messages;
else if (!nav_unseen)
count = 0;
else if (!nav_unseen_drafts && EntityFolder.DRAFTS.equals(folder.type))
count = folder.messages;
else
count = folder.unseen;
@ -240,6 +244,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
this.nav_count = prefs.getBoolean("nav_count", false);
this.nav_count_pinned = prefs.getBoolean("nav_count_pinned", false);
this.nav_unseen = prefs.getBoolean("nav_unseen", true);
this.nav_unseen_drafts = prefs.getBoolean("nav_unseen_drafts", false);
this.nav_categories = prefs.getBoolean("nav_categories", false);
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);

@ -146,7 +146,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", "edge_to_edge", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed",
"hide_toolbar", "edge_to_edge", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed",
"indentation", "date", "date_week", "date_fixed", "date_bold", "date_time", "threading", "threading_unread",
"show_filtered",
"highlight_unread", "highlight_color", "account_color", "color_stripe_wide",

@ -97,6 +97,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swNavCategories;
private SwitchCompat swNavLastSync;
private SwitchCompat swNavMessageCount;
private SwitchCompat swNavUnseen;
private SwitchCompat swNavUnseenDrafts;
private SwitchCompat swNavPinnedCount;
private SwitchCompat swShowUnexposed;
@ -218,7 +219,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", "column_width",
"hide_toolbar", "edge_to_edge", "nav_options", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed",
"hide_toolbar", "edge_to_edge", "nav_options", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color",
"highlight_unread", "highlight_color", "account_color", "color_stripe_wide",
"avatars", "bimi", "bimi_vmc", "gravatars", "libravatars", "favicons", "favicons_partial", "favicons_manifest", "ddg_icons", "favicons_dmarc", "generated_icons", "identicons",
@ -280,6 +281,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swNavCategories = view.findViewById(R.id.swNavCategories);
swNavLastSync = view.findViewById(R.id.swNavLastSync);
swNavMessageCount = view.findViewById(R.id.swNavMessageCount);
swNavUnseen = view.findViewById(R.id.swNavUnseen);
swNavUnseenDrafts = view.findViewById(R.id.swNavUnseenDrafts);
swNavPinnedCount = view.findViewById(R.id.swNavPinnedCount);
swShowUnexposed = view.findViewById(R.id.swShowUnexposed);
@ -682,6 +684,15 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swNavUnseen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("nav_unseen", checked).apply();
swNavUnseenDrafts.setEnabled(checked);
swNavPinnedCount.setEnabled(checked);
}
});
swNavUnseenDrafts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1624,8 +1635,11 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swNavCategories.setChecked(prefs.getBoolean("nav_categories", false));
swNavLastSync.setChecked(prefs.getBoolean("nav_last_sync", true));
swNavMessageCount.setChecked(prefs.getBoolean("nav_count", false));
swNavUnseen.setChecked(prefs.getBoolean("nav_unseen", true));
swNavUnseenDrafts.setChecked(prefs.getBoolean("nav_unseen_drafts", false));
swNavUnseenDrafts.setEnabled(swNavUnseen.isChecked());
swNavPinnedCount.setChecked(prefs.getBoolean("nav_count_pinned", false));
swNavPinnedCount.setEnabled(swNavUnseen.isChecked());
swShowUnexposed.setChecked(prefs.getBoolean("show_unexposed", false));
swThreading.setChecked(prefs.getBoolean("threading", true));

@ -640,21 +640,34 @@
app:layout_constraintTop_toBottomOf="@id/swNavLastSync"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNavUnseen"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_nav_unseen"
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/swNavUnseenDrafts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
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:layout_constraintTop_toBottomOf="@id/swNavUnseen"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNavPinnedCount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_nav_pinned_count"
app:layout_constraintEnd_toEndOf="parent"

@ -597,6 +597,7 @@
<string name="title_advanced_nav_hide_message">You can enable the options again in the display settings</string>
<string name="title_advanced_nav_last_sync">Show the last sync time in the navigation menu</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">Show number of unread 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 star for accounts/folders with newly received unread messages</string>

Loading…
Cancel
Save