From 76b399214a7c7e95c91e7b28249731cab20ee86d Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 6 Feb 2022 08:13:31 +0100 Subject: [PATCH] Added tabular dividers option --- CHANGELOG.md | 4 ++++ app/src/main/assets/CHANGELOG.md | 4 ++++ .../java/eu/faircode/email/FragmentAccounts.java | 6 ++++-- .../java/eu/faircode/email/FragmentFolders.java | 6 ++++-- .../eu/faircode/email/FragmentIdentities.java | 6 ++++-- .../java/eu/faircode/email/FragmentMessages.java | 8 +++++--- .../java/eu/faircode/email/FragmentOptions.java | 3 ++- .../eu/faircode/email/FragmentOptionsDisplay.java | 15 ++++++++++++++- .../main/res/layout/fragment_options_display.xml | 15 ++++++++++++++- app/src/main/res/values/strings.xml | 1 + metadata/en-US/changelogs/1832.txt | 4 ++++ 11 files changed, 60 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index acadbc82a9..bd2c56f0c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### [Fulgurotherium](https://en.wikipedia.org/wiki/Fulgurotherium) +### Next version + +* Added option to disable divider lines for tabular layout + ### 1.1832 - 2022-02-05 * Added saving S/MIME public keys diff --git a/app/src/main/assets/CHANGELOG.md b/app/src/main/assets/CHANGELOG.md index acadbc82a9..bd2c56f0c7 100644 --- a/app/src/main/assets/CHANGELOG.md +++ b/app/src/main/assets/CHANGELOG.md @@ -4,6 +4,10 @@ ### [Fulgurotherium](https://en.wikipedia.org/wiki/Fulgurotherium) +### Next version + +* Added option to disable divider lines for tabular layout + ### 1.1832 - 2022-02-05 * Added saving S/MIME public keys diff --git a/app/src/main/java/eu/faircode/email/FragmentAccounts.java b/app/src/main/java/eu/faircode/email/FragmentAccounts.java index f1df655723..091fc20a1e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccounts.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccounts.java @@ -67,6 +67,7 @@ public class FragmentAccounts extends FragmentBase { private boolean settings; private boolean cards; + private boolean dividers; private boolean compact; private ViewGroup view; @@ -93,6 +94,7 @@ public class FragmentAccounts extends FragmentBase { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); cards = prefs.getBoolean("cards", true); + dividers = prefs.getBoolean("dividers", true); compact = prefs.getBoolean("compact_accounts", false) && !settings; } @@ -142,7 +144,7 @@ public class FragmentAccounts extends FragmentBase { LinearLayoutManager llm = new LinearLayoutManager(getContext()); rvAccount.setLayoutManager(llm); - if (!cards) { + if (!cards && dividers) { DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), llm.getOrientation()); itemDecorator.setDrawable(getContext().getDrawable(R.drawable.divider)); rvAccount.addItemDecoration(itemDecorator); @@ -202,7 +204,7 @@ public class FragmentAccounts extends FragmentBase { TextView tvCategory = header.findViewById(R.id.tvCategory); TextView tvDate = header.findViewById(R.id.tvDate); - if (cards) { + if (cards || !dividers) { View vSeparator = header.findViewById(R.id.vSeparator); vSeparator.setVisibility(View.GONE); } diff --git a/app/src/main/java/eu/faircode/email/FragmentFolders.java b/app/src/main/java/eu/faircode/email/FragmentFolders.java index 3e2c280576..da8a5b3efe 100644 --- a/app/src/main/java/eu/faircode/email/FragmentFolders.java +++ b/app/src/main/java/eu/faircode/email/FragmentFolders.java @@ -110,6 +110,7 @@ public class FragmentFolders extends FragmentBase { private FloatingActionButton fabError; private boolean cards; + private boolean dividers; private boolean compact; private long account; @@ -144,6 +145,7 @@ public class FragmentFolders extends FragmentBase { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); cards = prefs.getBoolean("cards", true); + dividers = prefs.getBoolean("dividers", true); compact = prefs.getBoolean("compact_folders", false); show_hidden = false; // prefs.getBoolean("hidden_folders", false); show_flagged = prefs.getBoolean("flagged_folders", false); @@ -212,7 +214,7 @@ public class FragmentFolders extends FragmentBase { LinearLayoutManager llm = new LinearLayoutManager(getContext()); rvFolder.setLayoutManager(llm); - if (!cards) { + if (!cards && dividers) { DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), llm.getOrientation()) { @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { @@ -282,7 +284,7 @@ public class FragmentFolders extends FragmentBase { TextView tvCategory = header.findViewById(R.id.tvCategory); TextView tvDate = header.findViewById(R.id.tvDate); - if (cards) { + if (cards || !dividers) { View vSeparator = header.findViewById(R.id.vSeparator); vSeparator.setVisibility(View.GONE); } diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentities.java b/app/src/main/java/eu/faircode/email/FragmentIdentities.java index f0ada0b2af..b4a3fc5b95 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentities.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentities.java @@ -51,6 +51,7 @@ import java.util.Objects; public class FragmentIdentities extends FragmentBase { private boolean cards; + private boolean dividers; private RecyclerView rvIdentity; private ContentLoadingProgressBar pbWait; @@ -66,6 +67,7 @@ public class FragmentIdentities extends FragmentBase { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); cards = prefs.getBoolean("cards", true); + dividers = prefs.getBoolean("dividers", true); } @Override @@ -87,7 +89,7 @@ public class FragmentIdentities extends FragmentBase { LinearLayoutManager llm = new LinearLayoutManager(getContext()); rvIdentity.setLayoutManager(llm); - if (!cards) { + if (!cards && dividers) { DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), llm.getOrientation()); itemDecorator.setDrawable(getContext().getDrawable(R.drawable.divider)); rvIdentity.addItemDecoration(itemDecorator); @@ -147,7 +149,7 @@ public class FragmentIdentities extends FragmentBase { TextView tvCategory = header.findViewById(R.id.tvCategory); TextView tvDate = header.findViewById(R.id.tvDate); - if (cards) { + if (cards || !dividers) { View vSeparator = header.findViewById(R.id.vSeparator); vSeparator.setVisibility(View.GONE); } diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 0fbb5710bf..36314a33a7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -309,6 +309,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. private WebView printWebView = null; private boolean cards; + private boolean dividers; private boolean category; private boolean date; private boolean date_fixed; @@ -438,6 +439,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. swipenav = prefs.getBoolean("swipenav", true); cards = prefs.getBoolean("cards", true); + dividers = prefs.getBoolean("dividers", true); category = prefs.getBoolean("group_category", false); date = prefs.getBoolean("date", true); date_fixed = (!date && prefs.getBoolean("date_fixed", false)); @@ -669,7 +671,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. }; rvMessage.setLayoutManager(llm); - if (!cards) { + if (!cards && dividers) { DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), llm.getOrientation()) { @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { @@ -780,7 +782,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. if (i == 0 && date_fixed && "time".equals(sort)) { TupleMessageEx top = adapter.getItemAtPosition(pos); tvFixedDate.setVisibility(top == null ? View.INVISIBLE : View.VISIBLE); - if (!cards) + if (!cards && dividers) vFixedSeparator.setVisibility(top == null ? View.INVISIBLE : View.VISIBLE); tvFixedDate.setText(top == null ? null : getRelativeDate(top.received, parent.getContext())); } else { @@ -865,7 +867,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. if (date_bold) tvDate.setTypeface(Typeface.DEFAULT_BOLD); - if (cards) { + if (cards || !dividers) { View vSeparator = header.findViewById(R.id.vSeparator); vSeparator.setVisibility(View.GONE); } diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java index 23e67a31ea..10a5597575 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptions.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java @@ -131,7 +131,8 @@ public class FragmentOptions extends FragmentBase { "subscriptions", "check_authentication", "check_tls", "check_reply_domain", "check_mx", "check_blocklist", "send_pending", - "startup", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight", + "startup", + "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", diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java index b71e6ecb0d..efa4df78fd 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java @@ -64,6 +64,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer private SwitchCompat swTabularBackground; private SwitchCompat swShadow; private SwitchCompat swShadowHighlight; + private SwitchCompat swTabularDividers; private SwitchCompat swCategory; private SwitchCompat swDate; private SwitchCompat swDateFixed; @@ -168,7 +169,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer private NumberFormat NF = NumberFormat.getNumberInstance(); private final static String[] RESET_OPTIONS = new String[]{ - "theme", "startup", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight", + "theme", "startup", + "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", @@ -205,6 +207,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swTabularBackground = view.findViewById(R.id.swTabularCardBackground); swShadow = view.findViewById(R.id.swShadow); swShadowHighlight = view.findViewById(R.id.swShadowHighlight); + swTabularDividers = view.findViewById(R.id.swTabularDividers); swCategory = view.findViewById(R.id.swCategory); swDate = view.findViewById(R.id.swDate); swDateFixed = view.findViewById(R.id.swDateFixed); @@ -341,6 +344,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swTabularBackground.setEnabled(!checked); swShadow.setEnabled(checked); swShadowHighlight.setEnabled(swShadow.isEnabled() && checked); + swTabularDividers.setEnabled(!checked); swIndentation.setEnabled(checked); } }); @@ -375,6 +379,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } }); + swTabularDividers.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("dividers", checked).apply(); + } + }); + swCategory.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -1183,6 +1194,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swTabularBackground.setEnabled(!swCards.isChecked()); swShadow.setEnabled(swCards.isChecked()); swShadowHighlight.setEnabled(swShadow.isEnabled() && swShadow.isChecked()); + swTabularDividers.setChecked(prefs.getBoolean("dividers", true)); + swTabularDividers.setEnabled(!swCards.isChecked()); swCategory.setChecked(prefs.getBoolean("group_category", false)); swDate.setChecked(prefs.getBoolean("date", true)); swDateFixed.setChecked(prefs.getBoolean("date_fixed", false)); diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml index 7d3172f29e..3f48cfdfe0 100644 --- a/app/src/main/res/layout/fragment_options_display.xml +++ b/app/src/main/res/layout/fragment_options_display.xml @@ -183,6 +183,19 @@ app:layout_constraintTop_toBottomOf="@id/swShadow" app:switchPadding="12dp" /> + + Use card color as background color when using tabular style Use shadow for unread messages when using card style Use highlight color instead of accent color + Use divider lines when using tabular style Group by account category Group by date Show fixed date header at the top diff --git a/metadata/en-US/changelogs/1832.txt b/metadata/en-US/changelogs/1832.txt index acadbc82a9..bd2c56f0c7 100644 --- a/metadata/en-US/changelogs/1832.txt +++ b/metadata/en-US/changelogs/1832.txt @@ -4,6 +4,10 @@ ### [Fulgurotherium](https://en.wikipedia.org/wiki/Fulgurotherium) +### Next version + +* Added option to disable divider lines for tabular layout + ### 1.1832 - 2022-02-05 * Added saving S/MIME public keys