Added tabular dividers option

This commit is contained in:
M66B 2022-02-06 08:13:31 +01:00
parent 83b41ae370
commit 76b399214a
11 changed files with 60 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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",

View File

@ -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));

View File

@ -183,6 +183,19 @@
app:layout_constraintTop_toBottomOf="@id/swShadow"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swTabularDividers"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_tabular_dividers"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swShadowHighlight"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCategory"
android:layout_width="0dp"
@ -192,7 +205,7 @@
android:text="@string/title_advanced_category_header"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swShadowHighlight"
app:layout_constraintTop_toBottomOf="@id/swTabularDividers"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -450,6 +450,7 @@
<string name="title_advanced_tabular_background">Use card color as background color when using tabular style</string>
<string name="title_advanced_cards_shadow">Use shadow for unread messages when using card style</string>
<string name="title_advanced_cards_shadow_highlight">Use highlight color instead of accent color</string>
<string name="title_advanced_tabular_dividers">Use divider lines when using tabular style</string>
<string name="title_advanced_category_header">Group by account category</string>
<string name="title_advanced_date_header">Group by date</string>
<string name="title_advanced_date_fixed">Show fixed date header at the top</string>

View File

@ -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