mirror of https://github.com/M66B/FairEmail.git
Added option to show number of messages in nav menu
This commit is contained in:
parent
aaacabe593
commit
6e61c71d48
|
@ -49,7 +49,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
|
|||
private LifecycleOwner owner;
|
||||
private LayoutInflater inflater;
|
||||
|
||||
private boolean debug;
|
||||
private boolean nav_count;
|
||||
private int colorUnread;
|
||||
private int textColorSecondary;
|
||||
|
||||
|
@ -127,8 +127,8 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
|
|||
tvItem.setTextColor(count == 0 ? textColorSecondary : colorUnread);
|
||||
tvItem.setTypeface(count == 0 ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD);
|
||||
|
||||
tvItemExtra.setText(folder.last_sync == null ? null : TF.format(folder.last_sync));
|
||||
tvItemExtra.setVisibility(debug ? View.VISIBLE : View.GONE);
|
||||
tvItemExtra.setText(NF.format(folder.messages));
|
||||
tvItemExtra.setVisibility(nav_count ? View.VISIBLE : View.GONE);
|
||||
|
||||
ivExternal.setVisibility(View.GONE);
|
||||
ivWarning.setVisibility(folder.error == null ? View.GONE : View.VISIBLE);
|
||||
|
@ -159,8 +159,8 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
|
|||
this.inflater = LayoutInflater.from(context);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
this.nav_count = prefs.getBoolean("nav_count", false);
|
||||
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);
|
||||
this.debug = prefs.getBoolean("debug", false);
|
||||
int colorHighlight = prefs.getInt("highlight_color", Helper.resolveColor(context, R.attr.colorUnreadHighlight));
|
||||
this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread));
|
||||
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
|
||||
|
|
|
@ -48,6 +48,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
|||
private LifecycleOwner owner;
|
||||
private LayoutInflater inflater;
|
||||
|
||||
private boolean nav_count;
|
||||
private int colorUnread;
|
||||
private int textColorSecondary;
|
||||
|
||||
|
@ -103,7 +104,9 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
|||
tvItem.setTextColor(count == 0 ? textColorSecondary : colorUnread);
|
||||
tvItem.setTypeface(count == 0 ? Typeface.DEFAULT : Typeface.DEFAULT_BOLD);
|
||||
|
||||
tvItemExtra.setVisibility(View.GONE);
|
||||
tvItemExtra.setText(NF.format(folder.messages));
|
||||
tvItemExtra.setVisibility(nav_count ? View.VISIBLE : View.GONE);
|
||||
|
||||
ivExternal.setVisibility(View.GONE);
|
||||
ivWarning.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -131,6 +134,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
|||
this.inflater = LayoutInflater.from(context);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
this.nav_count = prefs.getBoolean("nav_count", 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));
|
||||
|
|
|
@ -108,7 +108,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
"subscriptions",
|
||||
"check_authentication", "check_reply_domain", "check_mx", "check_blocklist",
|
||||
"send_pending",
|
||||
"portrait2", "landscape", "landscape3", "startup",
|
||||
"portrait2", "landscape", "landscape3", "nav_count", "startup",
|
||||
"cards", "beige", "tabular_card_bg", "shadow_unread",
|
||||
"indentation", "date", "date_bold", "threading", "threading_unread",
|
||||
"highlight_unread", "highlight_color", "color_stripe",
|
||||
|
|
|
@ -73,6 +73,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swPortrait2;
|
||||
private SwitchCompat swLandscape;
|
||||
private SwitchCompat swLandscape3;
|
||||
private SwitchCompat swNavMessageCount;
|
||||
|
||||
private SwitchCompat swThreading;
|
||||
private SwitchCompat swThreadingUnread;
|
||||
|
@ -155,7 +156,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_bold", "navbar_colorize", "portrait2", "landscape", "landscape3",
|
||||
"date", "date_bold", "navbar_colorize", "portrait2", "landscape", "landscape3", "nav_count",
|
||||
"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",
|
||||
|
@ -193,6 +194,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swPortrait2 = view.findViewById(R.id.swPortrait2);
|
||||
swLandscape = view.findViewById(R.id.swLandscape);
|
||||
swLandscape3 = view.findViewById(R.id.swLandscape3);
|
||||
swNavMessageCount = view.findViewById(R.id.swNavMessageCount);
|
||||
|
||||
swThreading = view.findViewById(R.id.swThreading);
|
||||
swThreadingUnread = view.findViewById(R.id.swThreadingUnread);
|
||||
|
@ -372,6 +374,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
}
|
||||
});
|
||||
|
||||
swNavMessageCount.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("nav_count", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swThreading.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -1022,6 +1031,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swLandscape.setEnabled(normal);
|
||||
swLandscape3.setChecked(prefs.getBoolean("landscape3", true));
|
||||
swLandscape3.setEnabled(normal);
|
||||
swNavMessageCount.setChecked(prefs.getBoolean("nav_count", false));
|
||||
|
||||
swThreading.setChecked(prefs.getBoolean("threading", true));
|
||||
swThreadingUnread.setChecked(prefs.getBoolean("threading_unread", false));
|
||||
|
|
|
@ -289,6 +289,17 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvLandscapeHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNavMessageCount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_nav_message_count"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swLandscape3"
|
||||
app:switchPadding="12dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
|
|
@ -394,6 +394,7 @@
|
|||
<string name="title_advanced_portrait2">Use two rows in portrait mode</string>
|
||||
<string name="title_advanced_landscape">Use two columns in landscape mode</string>
|
||||
<string name="title_advanced_landscape3">Show navigation menu in landscape mode by default</string>
|
||||
<string name="title_advanced_nav_message_count">Show number of locally stored messages 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 New Issue