Added option to disable unread shadow border

pull/210/head
M66B 2 years ago
parent 27513de6e5
commit 62b0491473

@ -263,6 +263,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean week;
private boolean cards;
private boolean shadow_unread;
private boolean shadow_border;
private boolean shadow_highlight;
private boolean threading;
private boolean threading_unread;
@ -1825,7 +1826,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
private void bindSeen(TupleMessageEx message) {
if (cards && shadow_unread) {
if (cards && shadow_unread && shadow_border) {
boolean shadow = (message.unseen > 0);
int color = (shadow
? ColorUtils.setAlphaComponent(shadow_highlight ? colorUnreadHighlight : colorAccent, 127)
@ -1901,9 +1902,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean split = (viewType != ViewType.THREAD && properties.getValue("split", message.id));
int color = Color.TRANSPARENT;
if (cards && shadow_unread && message.unseen > 0)
color = ColorUtils.setAlphaComponent(colorCardBackground, 192);
else if (split)
if (cards && shadow_unread && message.unseen > 0) {
if (shadow_border)
color = ColorUtils.setAlphaComponent(colorCardBackground, 192);
else {
int fg = (shadow_highlight ? colorUnreadHighlight : colorAccent);
color = ColorUtils.blendARGB(colorCardBackground, fg, 0.125f);
}
} else if (split)
color = ColorUtils.setAlphaComponent(textColorHighlightInverse, 127);
else if (flags_background && flagged && !expanded)
color = ColorUtils.setAlphaComponent(mcolor, 127);
@ -7325,6 +7331,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.week = prefs.getBoolean("date_week", false);
this.cards = prefs.getBoolean("cards", true);
this.shadow_unread = prefs.getBoolean("shadow_unread", false);
this.shadow_border = prefs.getBoolean("shadow_border", true);
this.shadow_highlight = prefs.getBoolean("shadow_highlight", false);
this.threading = prefs.getBoolean("threading", true);
this.threading_unread = threading && prefs.getBoolean("threading_unread", false);

@ -128,7 +128,7 @@ public class FragmentOptions extends FragmentBase {
"check_authentication", "check_tls", "check_reply_domain", "check_mx", "check_blocklist",
"send_pending",
"startup",
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight", "dividers",
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers",
"portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size",
"column_width",
"nav_categories", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",

@ -76,6 +76,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swBeige;
private SwitchCompat swTabularBackground;
private SwitchCompat swShadow;
private SwitchCompat swShadowBorder;
private SwitchCompat swShadowHighlight;
private SwitchCompat swTabularDividers;
private SwitchCompat swPortrait2;
@ -193,7 +194,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup",
"date", "date_week", "date_fixed", "date_bold", "group_category",
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight", "dividers",
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers",
"portrait2", "portrait2c", "landscape", "close_pane", "column_width",
"nav_options", "nav_categories", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "navbar_colorize",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color",
@ -238,6 +239,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swBeige = view.findViewById(R.id.swBeige);
swTabularBackground = view.findViewById(R.id.swTabularCardBackground);
swShadow = view.findViewById(R.id.swShadow);
swShadowBorder = view.findViewById(R.id.swShadowBorder);
swShadowHighlight = view.findViewById(R.id.swShadowHighlight);
swTabularDividers = view.findViewById(R.id.swTabularDividers);
swPortrait2 = view.findViewById(R.id.swPortrait2);
@ -450,6 +452,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swBeige.setEnabled(checked);
swTabularBackground.setEnabled(!checked);
swShadow.setEnabled(checked);
swShadowBorder.setEnabled(swShadow.isEnabled() && checked);
swShadowHighlight.setEnabled(swShadow.isEnabled() && checked);
swTabularDividers.setEnabled(!checked);
swIndentation.setEnabled(checked);
@ -475,10 +478,18 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("shadow_unread", checked).apply();
swShadowBorder.setEnabled(swShadow.isEnabled() && checked);
swShadowHighlight.setEnabled(swShadow.isEnabled() && checked);
}
});
swShadowBorder.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("shadow_border", checked).apply();
}
});
swShadowHighlight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1378,10 +1389,12 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swBeige.setChecked(prefs.getBoolean("beige", true));
swTabularBackground.setChecked(prefs.getBoolean("tabular_card_bg", false));
swShadow.setChecked(prefs.getBoolean("shadow_unread", false));
swShadowBorder.setChecked(prefs.getBoolean("shadow_border", true));
swShadowHighlight.setChecked(prefs.getBoolean("shadow_highlight", false));
swBeige.setEnabled(swCards.isChecked());
swTabularBackground.setEnabled(!swCards.isChecked());
swShadow.setEnabled(swCards.isChecked());
swShadowBorder.setEnabled(swShadow.isEnabled() && swShadow.isChecked());
swShadowHighlight.setEnabled(swShadow.isEnabled() && swShadow.isChecked());
swTabularDividers.setChecked(prefs.getBoolean("dividers", true));
swTabularDividers.setEnabled(!swCards.isChecked());

@ -254,6 +254,19 @@
app:layout_constraintTop_toBottomOf="@id/swTabularCardBackground"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swShadowBorder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_cards_shadow_border"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swShadow"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swShadowHighlight"
android:layout_width="0dp"
@ -263,7 +276,7 @@
android:text="@string/title_advanced_cards_shadow_highlight"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swShadow"
app:layout_constraintTop_toBottomOf="@id/swShadowBorder"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -518,6 +518,7 @@
<string name="title_advanced_cards_beige">Use beige background when using card style (light themes only)</string>
<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_border">Show border</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_date_header">Group by date</string>

Loading…
Cancel
Save