Added option to disabled last sync time / nav menu

This commit is contained in:
M66B 2023-01-17 21:49:52 +01:00
parent ec407fb1d6
commit 54594c031c
5 changed files with 29 additions and 4 deletions

View File

@ -58,6 +58,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
private LifecycleOwner owner;
private LayoutInflater inflater;
private boolean nav_last_sync;
private boolean nav_count;
private boolean nav_count_pinned;
private boolean nav_unseen_drafts;
@ -167,7 +168,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
tvItem.setVisibility(expanded ? View.VISIBLE : View.GONE);
if (account.folderName == null) {
if (account.last_connected != null && expanded) {
if (account.last_connected != null && expanded && nav_last_sync) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
@ -284,6 +285,7 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
this.inflater = LayoutInflater.from(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
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_drafts = prefs.getBoolean("nav_unseen_drafts", false);

View File

@ -135,7 +135,7 @@ public class FragmentOptions extends FragmentBase {
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers",
"portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size",
"column_width",
"hide_toolbar", "nav_categories", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",
"hide_toolbar", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",
"indentation", "date", "date_week", "date_fixed", "date_bold", "threading", "threading_unread",
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
"avatars", "bimi", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",

View File

@ -90,6 +90,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swHideToolbar;
private SwitchCompat swNavOptions;
private SwitchCompat swNavCategories;
private SwitchCompat swNavLastSync;
private SwitchCompat swNavMessageCount;
private SwitchCompat swNavUnseenDrafts;
private SwitchCompat swNavPinnedCount;
@ -197,7 +198,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"date", "date_week", "date_fixed", "date_bold", "group_category",
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers",
"portrait2", "portrait2c", "landscape", "close_pane", "column_width",
"hide_toolbar", "nav_options", "nav_categories", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",
"hide_toolbar", "nav_options", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color",
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
"avatars", "bimi", "gravatars", "libravatars", "favicons", "favicons_partial", "generated_icons", "identicons",
@ -254,6 +255,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swHideToolbar = view.findViewById(R.id.swHideToolbar);
swNavOptions = view.findViewById(R.id.swNavOptions);
swNavCategories = view.findViewById(R.id.swNavCategories);
swNavLastSync = view.findViewById(R.id.swNavLastSync);
swNavMessageCount = view.findViewById(R.id.swNavMessageCount);
swNavUnseenDrafts = view.findViewById(R.id.swNavUnseenDrafts);
swNavPinnedCount = view.findViewById(R.id.swNavPinnedCount);
@ -612,6 +614,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swNavLastSync.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("nav_last_sync", checked).apply();
}
});
swNavUnseenDrafts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1421,6 +1430,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swHideToolbar.setChecked(prefs.getBoolean("hide_toolbar", true));
swNavOptions.setChecked(prefs.getBoolean("nav_options", true));
swNavCategories.setChecked(prefs.getBoolean("nav_categories", false));
swNavLastSync.setChecked(prefs.getBoolean("nav_last_sync", true));
swNavMessageCount.setChecked(prefs.getBoolean("nav_count", false));
swNavUnseenDrafts.setChecked(prefs.getBoolean("nav_unseen_drafts", false));
swNavPinnedCount.setChecked(prefs.getBoolean("nav_count_pinned", false));

View File

@ -570,6 +570,18 @@
app:layout_constraintTop_toBottomOf="@id/swNavOptions"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNavLastSync"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_nav_last_sync"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNavCategories"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNavMessageCount"
android:layout_width="0dp"
@ -578,7 +590,7 @@
android:text="@string/title_advanced_nav_message_count"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNavCategories"
app:layout_constraintTop_toBottomOf="@id/swNavLastSync"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -517,6 +517,7 @@
<string name="title_advanced_nav_pin">Pin navigation menu</string>
<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_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_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>