Added unread shadow option

pull/194/head
M66B 4 years ago
parent 4e434a399a
commit 0be37baeee

@ -235,7 +235,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean date;
private boolean cards;
private boolean shadow;
private boolean shadow_unread;
private boolean threading;
private boolean threading_unread;
private boolean indentation;
@ -511,7 +511,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ViewHolder(final View itemView, long viewType) {
super(itemView);
if (cards && shadow) {
if (cards && shadow_unread) {
ViewGroup.MarginLayoutParams lparam = (ViewGroup.MarginLayoutParams) itemView.getLayoutParams();
lparam.bottomMargin = dp1;
itemView.setLayoutParams(lparam);
@ -1400,7 +1400,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
private void bindSeen(TupleMessageEx message) {
if (cards && shadow) {
if (cards && shadow_unread) {
int color = (message.unseen > 0 ? colorSeparator : Color.TRANSPARENT);
if (!Objects.equals(itemView.getTag(), color)) {
itemView.setTag(color);
@ -5348,7 +5348,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.date = prefs.getBoolean("date", true);
this.cards = prefs.getBoolean("cards", true);
this.shadow = prefs.getBoolean("experiments", false);
this.shadow_unread = prefs.getBoolean("shadow_unread", false);
this.threading = prefs.getBoolean("threading", true);
this.threading_unread = threading && prefs.getBoolean("threading_unread", false);
this.indentation = prefs.getBoolean("indentation", false);

@ -80,7 +80,8 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"subscriptions",
"portrait2", "landscape", "landscape3", "startup", "cards", "beige", "indentation", "date", "threading", "threading_unread",
"portrait2", "landscape", "landscape3", "startup", "cards", "beige", "shadow_unread",
"indentation", "date", "threading", "threading_unread",
"highlight_unread", "highlight_color", "color_stripe",
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "show_recipients", "authentication",

@ -64,6 +64,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private Spinner spStartup;
private SwitchCompat swCards;
private SwitchCompat swBeige;
private SwitchCompat swShadow;
private SwitchCompat swDate;
private SwitchCompat swNavBarColorize;
private SwitchCompat swPortrait2;
@ -139,7 +140,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", "date", "navbar_colorize", "portrait2", "landscape", "landscape3",
"theme", "startup", "cards", "beige", "shadow_unread",
"date", "navbar_colorize", "portrait2", "landscape", "landscape3",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
"highlight_unread", "highlight_color", "color_stripe",
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
@ -168,6 +170,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
spStartup = view.findViewById(R.id.spStartup);
swCards = view.findViewById(R.id.swCards);
swBeige = view.findViewById(R.id.swBeige);
swShadow = view.findViewById(R.id.swShadow);
swDate = view.findViewById(R.id.swDate);
swNavBarColorize = view.findViewById(R.id.swNavBarColorize);
swPortrait2 = view.findViewById(R.id.swPortrait2);
@ -268,6 +271,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("cards", checked).apply();
swBeige.setEnabled(checked);
swShadow.setEnabled(checked);
swIndentation.setEnabled(checked);
}
});
@ -279,6 +283,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swShadow.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("shadow_unread", checked).apply();
}
});
swDate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -887,7 +898,9 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swCards.setChecked(prefs.getBoolean("cards", true));
swBeige.setChecked(prefs.getBoolean("beige", true));
swShadow.setChecked(prefs.getBoolean("shadow_unread", false));
swBeige.setEnabled(swCards.isChecked());
swShadow.setEnabled(swCards.isChecked());
swDate.setChecked(prefs.getBoolean("date", true));
swNavBarColorize.setChecked(prefs.getBoolean("navbar_colorize", false));
swPortrait2.setChecked(prefs.getBoolean("portrait2", false));

@ -125,6 +125,18 @@
app:layout_constraintTop_toBottomOf="@id/swCards"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swShadow"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_cards_shadow"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBeige"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvBeigeHint"
android:layout_width="0dp"
@ -135,7 +147,7 @@
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBeige" />
app:layout_constraintTop_toBottomOf="@id/swShadow" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDate"

@ -353,6 +353,7 @@
<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</string>
<string name="title_advanced_cards_shadow">Use shadow for unread messages when using card style</string>
<string name="title_advanced_date_header">Group by date</string>
<string name="title_advanced_threading">Conversation threading</string>
<string name="title_advanced_threading_unread">Show number of unread messages in conversations</string>

Loading…
Cancel
Save