From d0e366a336fcbd8841a424a87292b5b11e4013ef Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 22 Mar 2020 18:43:22 +0100 Subject: [PATCH] Added option to highlight subject --- .../eu/faircode/email/AdapterMessage.java | 5 ++- .../eu/faircode/email/FragmentOptions.java | 7 ++-- .../email/FragmentOptionsDisplay.java | 36 +++++++++++------- .../res/layout/fragment_options_display.xml | 37 ++++++++++++------- app/src/main/res/values/strings.xml | 1 + 5 files changed, 56 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index b35658fb1c..61717fb880 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -210,6 +210,7 @@ public class AdapterMessage extends RecyclerView.Adapter adapterView, View view, int position, long id) { @@ -537,13 +546,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } }); - swAttachmentsAlt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("attachments_alt", checked).apply(); - } - }); - swContrast.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -586,6 +588,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } }); + swAttachmentsAlt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("attachments_alt", checked).apply(); + } + }); + PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this); return view; @@ -700,6 +709,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } swSubjectItalic.setChecked(prefs.getBoolean("subject_italic", true)); + swHighlightSubject.setChecked(prefs.getBoolean("highlight_subject", false)); String subject_ellipsize = prefs.getString("subject_ellipsize", "middle"); String[] ellipsizeValues = getResources().getStringArray(R.array.ellipsizeValues); @@ -718,13 +728,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer spPreviewLines.setSelection(prefs.getInt("preview_lines", 2) - 1); spPreviewLines.setEnabled(swPreview.isChecked()); swAddresses.setChecked(prefs.getBoolean("addresses", false)); - swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false)); swContrast.setChecked(prefs.getBoolean("contrast", false)); swMonospaced.setChecked(prefs.getBoolean("monospaced", false)); swTextColor.setChecked(prefs.getBoolean("text_color", true)); swTextSize.setChecked(prefs.getBoolean("text_size", true)); swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false)); swImagesInline.setChecked(prefs.getBoolean("inline_images", false)); + swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false)); updateColor(); } diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml index 30f3266980..549205098c 100644 --- a/app/src/main/res/layout/fragment_options_display.xml +++ b/app/src/main/res/layout/fragment_options_display.xml @@ -587,6 +587,17 @@ app:layout_constraintTop_toBottomOf="@id/spFontSizeSubject" app:switchPadding="12dp" /> + + + app:layout_constraintTop_toBottomOf="@id/swHighlightSubject" /> - - + app:layout_constraintTop_toBottomOf="@+id/swAddresses" /> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8c4a05dbd8..b97993a48c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -315,6 +315,7 @@ Conversation threading Left/right indent received/sent messages in conversations Highlight unread messages + Highlight subject Show color stripe Show contact photos Show Gravatars