From bfa7bcdb85bf0a7be43400f593263d7060996e38 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 20 Oct 2019 19:35:31 +0200 Subject: [PATCH] Added setting for number of preview lines --- .../eu/faircode/email/AdapterMessage.java | 3 +++ .../eu/faircode/email/FragmentOptions.java | 2 +- .../email/FragmentOptionsDisplay.java | 19 ++++++++++++++- .../java/eu/faircode/email/HtmlHelper.java | 2 +- .../res/layout/fragment_options_display.xml | 23 ++++++++++++++++++- app/src/main/res/values/strings.xml | 8 +++++++ 6 files changed, 53 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 700a597101..320e6d3c0e 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -200,6 +200,7 @@ public class AdapterMessage extends RecyclerView.Adapter adapterView, View view, int position, long id) { + prefs.edit().putInt("preview_lines", position + 1).apply(); + } + + @Override + public void onNothingSelected(AdapterView parent) { + prefs.edit().remove("preview_lines").apply(); + } + }); + swAddresses.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -549,6 +564,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swPreview.setChecked(prefs.getBoolean("preview", false)); swPreviewItalic.setChecked(prefs.getBoolean("preview_italic", true)); swPreviewItalic.setEnabled(swPreview.isChecked()); + 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)); diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index 5377e72b29..6307cdff48 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -68,7 +68,7 @@ import static androidx.core.text.HtmlCompat.FROM_HTML_SEPARATOR_LINE_BREAK_LIST_ import static androidx.core.text.HtmlCompat.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE; public class HtmlHelper { - private static final int PREVIEW_SIZE = 250; // characters + private static final int PREVIEW_SIZE = 500; // characters private static final float MIN_LUMINANCE = 0.5f; private static final int MAX_AUTO_LINK = 250; diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml index 9644d1ee2e..88ea4e8a71 100644 --- a/app/src/main/res/layout/fragment_options_display.xml +++ b/app/src/main/res/layout/fragment_options_display.xml @@ -460,6 +460,27 @@ app:layout_constraintTop_toBottomOf="@id/tvPreviewHint" app:switchPadding="12dp" /> + + + + Show colored background instead of colored stars Show message preview Show message preview in italics + Number of preview lines Show address details by default Show attachments after the message text Use high contrast for message text @@ -1076,6 +1077,13 @@ High + + 1 + 2 + 3 + 4 + + 17BA15C1AF55D925F98B99CEA4375D4CDF4C174B MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtFbxEbzL8u5accPGgBw/XdyiSS5BBE6ZQ9ELpKyJ/OQN+kdYniCAOw3lsQ/GuJScy4Y2HobqbBgLL8GLHG+Yu2EHC9dLjA3v2Mc25vvnfn86BsrpQvz1poN2n+roTBdq09FWbtebJ8m0hDBVmtfRi7RhTKIL4No3kodLhksdnucKjcFheubebWKgpmvbmw7NwuELhaZmyhw8WTtnQ4rZPMhjY1JJZgzwNExXgD7zzg4pJPkuQlfkuRkkvBpHpi3C7VDnYjrBlLHngI4wv3wxQBVwJqlvAT9PmX8dOVnTsWWdJdLQBZVWphuqVY54kjBIovN+o8w03WjsV9QiOQq+XwIDAQAB