From 04a34acdd575a2bdf2042e6ad34fa42ec0f5777f Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 13 Aug 2023 08:26:13 +0200 Subject: [PATCH] Added option to not zoom message text in message editor --- .../java/eu/faircode/email/FragmentAnswer.java | 3 ++- .../java/eu/faircode/email/FragmentCompose.java | 3 ++- .../eu/faircode/email/FragmentOptionsDisplay.java | 12 +++++++++++- .../main/res/layout/fragment_options_display.xml | 14 +++++++++++++- app/src/main/res/values/strings.xml | 1 + 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentAnswer.java b/app/src/main/java/eu/faircode/email/FragmentAnswer.java index 630a3cccb8..bae32bf1b8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAnswer.java +++ b/app/src/main/java/eu/faircode/email/FragmentAnswer.java @@ -112,7 +112,8 @@ public class FragmentAnswer extends FragmentBase { String compose_font = prefs.getString("compose_font", ""); boolean compact = prefs.getBoolean("compose_compact", false); int zoom = prefs.getInt("compose_zoom", compact ? 0 : 1); - int message_zoom = prefs.getInt("message_zoom", 100); + boolean editor_zoom = prefs.getBoolean("editor_zoom", true); + int message_zoom = (editor_zoom ? prefs.getInt("message_zoom", 100) : 100); setSubtitle(R.string.title_answer_caption); setHasOptionsMenu(true); diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 744fd1e222..971723ee99 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -2174,7 +2174,8 @@ public class FragmentCompose extends FragmentBase { private void setZoom() { final Context context = getContext(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - int message_zoom = prefs.getInt("message_zoom", 100); + boolean editor_zoom = prefs.getBoolean("editor_zoom", true); + int message_zoom = (editor_zoom ? prefs.getInt("message_zoom", 100) : 100); float textSize = Helper.getTextSize(context, zoom); if (textSize != 0) { etBody.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize * message_zoom / 100f); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java index 00f2cac33c..5ad9ac714f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java @@ -164,6 +164,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer private SwitchCompat swHideAttachments; private TextView tvMessageZoom; private SeekBar sbMessageZoom; + private SwitchCompat swEditorZoom; private SwitchCompat swOverviewMode; private SwitchCompat swContrast; @@ -214,7 +215,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer "keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines", "align_header", "addresses", "hide_attachments", - "message_zoom", "overview_mode", + "message_zoom", "editor_zoom", "overview_mode", "hyphenation", "display_font", "contrast", "monospaced_pre", "text_separators", "collapse_quotes", "image_placeholders", "inline_images", "button_extra", @@ -333,6 +334,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swHideAttachments = view.findViewById(R.id.swHideAttachments); tvMessageZoom = view.findViewById(R.id.tvMessageZoom); sbMessageZoom = view.findViewById(R.id.sbMessageZoom); + swEditorZoom = view.findViewById(R.id.swEditorZoom); swOverviewMode = view.findViewById(R.id.swOverviewMode); swContrast = view.findViewById(R.id.swContrast); swHyphenation = view.findViewById(R.id.swHyphenation); @@ -1187,6 +1189,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } }); + swEditorZoom.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("editor_zoom", checked).apply(); + } + }); + swOverviewMode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -1592,6 +1601,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer if (message_zoom >= 50 && message_zoom <= 250) sbMessageZoom.setProgress(message_zoom - 50); + swEditorZoom.setChecked(prefs.getBoolean("editor_zoom", true)); swOverviewMode.setChecked(prefs.getBoolean("overview_mode", false)); swContrast.setChecked(prefs.getBoolean("contrast", false)); diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml index edc0b2d800..d700bc2a7a 100644 --- a/app/src/main/res/layout/fragment_options_display.xml +++ b/app/src/main/res/layout/fragment_options_display.xml @@ -1746,6 +1746,18 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvMessageZoom" /> + + Show attachments after the message text Show image thumbnails after the message text Default message text zoom: %1$s %% + Zoom message text also in the message editor Zoom original messages to fit the screen Use automatic hyphenation Use high contrast for message text