mirror of https://github.com/M66B/FairEmail.git
Added option for counts / pinned nav menu
This commit is contained in:
parent
a6c0073c8d
commit
df874106ad
|
@ -58,6 +58,8 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
|
|||
private LayoutInflater inflater;
|
||||
|
||||
private boolean nav_count;
|
||||
private boolean nav_count_pinned;
|
||||
|
||||
private int dp6;
|
||||
private int dp12;
|
||||
private int colorUnread;
|
||||
|
@ -144,7 +146,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
|
|||
ivBadge.setVisibility(count == 0 || expanded ? View.GONE : View.VISIBLE);
|
||||
|
||||
tvCount.setText(Helper.formatNumber(count, 99, NF));
|
||||
tvCount.setVisibility(count == 0 || expanded || !nav_count ? View.GONE : View.VISIBLE);
|
||||
tvCount.setVisibility(count == 0 || expanded || !nav_count_pinned ? View.GONE : View.VISIBLE);
|
||||
|
||||
Integer color = (account.folderName == null ? account.color : account.folderColor);
|
||||
if (color == null || !ActivityBilling.isPro(context))
|
||||
|
@ -270,6 +272,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
|
|||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
this.nav_count = prefs.getBoolean("nav_count", false);
|
||||
this.nav_count_pinned = prefs.getBoolean("nav_count_pinned", false);
|
||||
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);
|
||||
int colorHighlight = prefs.getInt("highlight_color", Helper.resolveColor(context, R.attr.colorUnreadHighlight));
|
||||
|
||||
|
|
|
@ -46,7 +46,9 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
|||
private Context context;
|
||||
private LifecycleOwner owner;
|
||||
private LayoutInflater inflater;
|
||||
|
||||
private boolean nav_count;
|
||||
private boolean nav_count_pinned;
|
||||
|
||||
private int colorUnread;
|
||||
private int colorControlNormal;
|
||||
|
@ -103,7 +105,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
|||
? View.GONE : View.VISIBLE);
|
||||
|
||||
tvCount.setText(Helper.formatNumber(count, 99, NF));
|
||||
tvCount.setVisibility(count == null || count == 0 || expanded || !nav_count
|
||||
tvCount.setVisibility(count == null || count == 0 || expanded || !nav_count_pinned
|
||||
? View.GONE : View.VISIBLE);
|
||||
|
||||
if (count == null)
|
||||
|
@ -153,6 +155,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
|||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
this.nav_count = prefs.getBoolean("nav_count", false);
|
||||
this.nav_count_pinned = prefs.getBoolean("nav_count_pinned", 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));
|
||||
|
|
|
@ -49,6 +49,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
|||
private LayoutInflater inflater;
|
||||
|
||||
private boolean nav_count;
|
||||
private boolean nav_count_pinned;
|
||||
private boolean nav_unseen_drafts;
|
||||
private int colorUnread;
|
||||
private int textColorSecondary;
|
||||
|
@ -115,7 +116,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
|||
ivBadge.setVisibility(count == 0 || expanded ? View.GONE : View.VISIBLE);
|
||||
|
||||
tvCount.setText(Helper.formatNumber(count, 99, NF));
|
||||
tvCount.setVisibility(count == 0 || expanded || !nav_count ? View.GONE : View.VISIBLE);
|
||||
tvCount.setVisibility(count == 0 || expanded || !nav_count_pinned ? View.GONE : View.VISIBLE);
|
||||
|
||||
if (count == 0)
|
||||
tvItem.setText(EntityFolder.localizeType(context, folder.type));
|
||||
|
@ -161,6 +162,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_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));
|
||||
|
|
|
@ -135,7 +135,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight", "dividers",
|
||||
"portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size",
|
||||
"column_width",
|
||||
"nav_count", "nav_unseen_drafts", "navbar_colorize",
|
||||
"nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",
|
||||
"indentation", "group_category", "date", "date_fixed", "date_bold", "threading", "threading_unread",
|
||||
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
|
||||
"avatars", "bimi", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
|
|
|
@ -74,7 +74,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swDate;
|
||||
private SwitchCompat swDateFixed;
|
||||
private SwitchCompat swDateBold;
|
||||
private SwitchCompat swNavBarColorize;
|
||||
private SwitchCompat swPortrait2;
|
||||
private SwitchCompat swPortrait2c;
|
||||
private Spinner spPortraitMinSize;
|
||||
|
@ -86,6 +85,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swNavOptions;
|
||||
private SwitchCompat swNavMessageCount;
|
||||
private SwitchCompat swNavUnseenDrafts;
|
||||
private SwitchCompat swNavPinnedCount;
|
||||
private SwitchCompat swNavBarColorize;
|
||||
|
||||
private SwitchCompat swThreading;
|
||||
private SwitchCompat swThreadingUnread;
|
||||
|
@ -180,7 +181,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight", "dividers",
|
||||
"group_category", "date", "date_fixed", "date_bold",
|
||||
"portrait2", "portrait2c", "landscape", "close_pane", "column_width",
|
||||
"nav_options", "nav_count", "nav_unseen_drafts", "navbar_colorize",
|
||||
"nav_options", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",
|
||||
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
|
||||
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
|
||||
"avatars", "bimi", "gravatars", "favicons", "favicons_partial", "generated_icons", "identicons",
|
||||
|
@ -232,6 +233,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swNavOptions = view.findViewById(R.id.swNavOptions);
|
||||
swNavMessageCount = view.findViewById(R.id.swNavMessageCount);
|
||||
swNavUnseenDrafts = view.findViewById(R.id.swNavUnseenDrafts);
|
||||
swNavPinnedCount = view.findViewById(R.id.swNavPinnedCount);
|
||||
swNavBarColorize = view.findViewById(R.id.swNavBarColorize);
|
||||
|
||||
swThreading = view.findViewById(R.id.swThreading);
|
||||
|
@ -543,6 +545,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
}
|
||||
});
|
||||
|
||||
swNavPinnedCount.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("nav_count_pinned", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swNavBarColorize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -1269,6 +1278,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swNavOptions.setChecked(prefs.getBoolean("nav_options", true));
|
||||
swNavMessageCount.setChecked(prefs.getBoolean("nav_count", false));
|
||||
swNavUnseenDrafts.setChecked(prefs.getBoolean("nav_unseen_drafts", false));
|
||||
swNavPinnedCount.setChecked(prefs.getBoolean("nav_count_pinned", false));
|
||||
swNavBarColorize.setChecked(prefs.getBoolean("navbar_colorize", false));
|
||||
|
||||
swThreading.setChecked(prefs.getBoolean("threading", true));
|
||||
|
|
|
@ -502,6 +502,17 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/swNavMessageCount"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNavPinnedCount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_nav_pinned_count"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swNavUnseenDrafts"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNavBarColorize"
|
||||
android:layout_width="0dp"
|
||||
|
@ -510,7 +521,7 @@
|
|||
android:text="@string/title_advanced_navbar_colorize"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swNavUnseenDrafts"
|
||||
app:layout_constraintTop_toBottomOf="@id/swNavPinnedCount"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
|
|
@ -450,6 +450,7 @@
|
|||
<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_nav_pinned_count">Show the number of unread messages in the pinned 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 New Issue