Added option to show date header in bold

This commit is contained in:
M66B 2021-05-16 17:17:48 +02:00
parent c5bb884473
commit 46f2214c40
5 changed files with 31 additions and 3 deletions

View File

@ -290,6 +290,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private boolean cards;
private boolean beige;
private boolean date;
private boolean date_bold;
private boolean threading;
private boolean swipenav;
private boolean seekbar;
@ -408,6 +409,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
cards = prefs.getBoolean("cards", true);
beige = prefs.getBoolean("beige", true);
date = prefs.getBoolean("date", true);
date_bold = prefs.getBoolean("date_bold", false);
threading = prefs.getBoolean("threading", true);
seekbar = prefs.getBoolean("seekbar", false);
actionbar = prefs.getBoolean("actionbar", true);
@ -693,6 +695,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
View header = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_message_date, parent, false);
TextView tvDate = header.findViewById(R.id.tvDate);
tvDate.setTextSize(TypedValue.COMPLEX_UNIT_PX, Helper.getTextSize(parent.getContext(), adapter.getZoom()));
if (date_bold)
tvDate.setTypeface(Typeface.DEFAULT_BOLD);
if (cards) {
View vSeparatorDate = header.findViewById(R.id.vSeparatorDate);

View File

@ -84,7 +84,7 @@ public class FragmentOptions extends FragmentBase {
"subscriptions",
"send_pending",
"portrait2", "landscape", "landscape3", "startup", "cards", "beige", "shadow_unread",
"indentation", "date", "threading", "threading_unread",
"indentation", "date", "date_bold", "threading", "threading_unread",
"highlight_unread", "highlight_color", "color_stripe",
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients", "authentication",

View File

@ -66,6 +66,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swBeige;
private SwitchCompat swShadow;
private SwitchCompat swDate;
private SwitchCompat swDateBold;
private SwitchCompat swNavBarColorize;
private SwitchCompat swPortrait2;
private SwitchCompat swLandscape;
@ -143,7 +144,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "beige", "shadow_unread",
"date", "navbar_colorize", "portrait2", "landscape", "landscape3",
"date", "date_bold", "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",
@ -174,6 +175,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swBeige = view.findViewById(R.id.swBeige);
swShadow = view.findViewById(R.id.swShadow);
swDate = view.findViewById(R.id.swDate);
swDateBold = view.findViewById(R.id.swDateBold);
swNavBarColorize = view.findViewById(R.id.swNavBarColorize);
swPortrait2 = view.findViewById(R.id.swPortrait2);
swLandscape = view.findViewById(R.id.swLandscape);
@ -299,6 +301,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("date", checked).apply();
swDateBold.setEnabled(checked);
}
});
swDateBold.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("date_bold", checked).apply();
}
});
@ -918,6 +928,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swBeige.setEnabled(swCards.isChecked());
swShadow.setEnabled(swCards.isChecked());
swDate.setChecked(prefs.getBoolean("date", true));
swDateBold.setChecked(prefs.getBoolean("date_bold", false));
swDateBold.setEnabled(swDate.isChecked());
swNavBarColorize.setChecked(prefs.getBoolean("navbar_colorize", false));
swPortrait2.setChecked(prefs.getBoolean("portrait2", false));
swLandscape.setChecked(prefs.getBoolean("landscape", true));

View File

@ -191,6 +191,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDate" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDateBold"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_date_bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDateHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNavBarColorize"
android:layout_width="0dp"
@ -199,7 +210,7 @@
android:text="@string/title_advanced_navbar_colorize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDateHint"
app:layout_constraintTop_toBottomOf="@id/swDateBold"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

View File

@ -373,6 +373,7 @@
<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_date_bold">Show date in bold</string>
<string name="title_advanced_threading">Conversation threading</string>
<string name="title_advanced_threading_unread">Show number of unread messages in conversations</string>
<string name="title_advanced_indentation">Left/right indent received/sent messages in conversations</string>