diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 3aa53d7bc8..d3f431ea3c 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -195,6 +195,8 @@ public class AdapterMessage extends RecyclerView.Adapter 0 ? 1.1f : 1f)); - tvSubject.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize * 0.9f); + float fz_sender = (font_size_sender == null ? textSize : font_size_sender) * (message.unseen > 0 ? 1.1f : 1f); + float fz_subject = (font_size_subject == null ? textSize : font_size_subject) * 0.9f; + tvFrom.setTextSize(TypedValue.COMPLEX_UNIT_PX, fz_sender); + tvSubject.setTextSize(TypedValue.COMPLEX_UNIT_PX, fz_subject); tvFolder.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize * 0.9f); tvPreview.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize * 0.9f); - int px = Math.round( - textSize * (message.unseen > 0 ? 1.1f : 1f) + - textSize * 0.9f + - (compact ? 0 : textSize * 0.9f)); + int px = Math.round(fz_sender + fz_subject + (compact ? 0 : textSize * 0.9f)); ViewGroup.LayoutParams lparams = ibAvatar.getLayoutParams(); if (lparams.height != px) { lparams.width = px; @@ -3634,6 +3635,15 @@ public class AdapterMessage extends RecyclerView.Adapter= 0) + font_size_sender = Helper.getTextSize(context, fz_sender); + + int fz_subject = prefs.getInt("font_size_subject", -1); + if (fz_subject >= 0) + font_size_subject = Helper.getTextSize(context, fz_subject); + this.subject_top = prefs.getBoolean("subject_top", false); this.subject_italic = prefs.getBoolean("subject_italic", true); this.subject_ellipsize = prefs.getString("subject_ellipsize", "middle"); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java index e58a29162b..7956c4d00f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptions.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java @@ -41,6 +41,7 @@ public class FragmentOptions extends FragmentBase { "subscriptions", "landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold", + "font_size_sender", "font_size_subject", "name_email", "distinguish_contacts", "authentication", "subject_top", "subject_italic", "subject_ellipsize", "flags", "flags_background", "preview", "preview_italic", "preview_lines", diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java index 4cc423ebd3..1bc134073e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java @@ -69,6 +69,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer private SwitchCompat swNameEmail; private SwitchCompat swDistinguishContacts; private SwitchCompat swAuthentication; + private Spinner spFontSizeSender; + private Spinner spFontSizeSubject; private SwitchCompat swSubjectTop; private SwitchCompat swSubjectItalic; private Spinner spSubjectEllipsize; @@ -92,6 +94,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer "theme", "landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold", "name_email", "distinguish_contacts", "authentication", + "font_size_sender", "font_size_subject", "subject_top", "subject_italic", "subject_ellipsize", "flags", "flags_background", "preview", "preview_italic", "preview_lines", "addresses", "attachments_alt", "contrast", "monospaced", "text_color", @@ -129,6 +132,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swNameEmail = view.findViewById(R.id.swNameEmail); swDistinguishContacts = view.findViewById(R.id.swDistinguishContacts); swAuthentication = view.findViewById(R.id.swAuthentication); + spFontSizeSender = view.findViewById(R.id.spFontSizeSender); + spFontSizeSubject = view.findViewById(R.id.spFontSizeSubject); swSubjectTop = view.findViewById(R.id.swSubjectTop); swSubjectItalic = view.findViewById(R.id.swSubjectItalic); spSubjectEllipsize = view.findViewById(R.id.spSubjectEllipsize); @@ -332,6 +337,32 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer } }); + spFontSizeSender.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int position, long id) { + int[] values = getResources().getIntArray(R.array.fontSizeValues); + prefs.edit().putInt("font_size_sender", values[position]).apply(); + } + + @Override + public void onNothingSelected(AdapterView parent) { + prefs.edit().remove("font_size_sender").apply(); + } + }); + + spFontSizeSubject.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int position, long id) { + int[] values = getResources().getIntArray(R.array.fontSizeValues); + prefs.edit().putInt("font_size_subject", values[position]).apply(); + } + + @Override + public void onNothingSelected(AdapterView parent) { + prefs.edit().remove("font_size_subject").apply(); + } + }); + swSubjectTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -548,6 +579,23 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer swNameEmail.setChecked(prefs.getBoolean("name_email", false)); swDistinguishContacts.setChecked(prefs.getBoolean("distinguish_contacts", false)); swAuthentication.setChecked(prefs.getBoolean("authentication", true)); + + int[] fontSizeValues = getResources().getIntArray(R.array.fontSizeValues); + + int font_size_sender = prefs.getInt("font_size_sender", -1); + for (int pos = 0; pos < fontSizeValues.length; pos++) + if (fontSizeValues[pos] == font_size_sender) { + spFontSizeSender.setSelection(pos); + break; + } + + int font_size_subject = prefs.getInt("font_size_subject", -1); + for (int pos = 0; pos < fontSizeValues.length; pos++) + if (fontSizeValues[pos] == font_size_subject) { + spFontSizeSubject.setSelection(pos); + break; + } + swSubjectTop.setChecked(prefs.getBoolean("subject_top", false)); swSubjectItalic.setChecked(prefs.getBoolean("subject_italic", true)); diff --git a/app/src/main/res/layout/fragment_options_display.xml b/app/src/main/res/layout/fragment_options_display.xml index 668f2c3e6d..eee0666d54 100644 --- a/app/src/main/res/layout/fragment_options_display.xml +++ b/app/src/main/res/layout/fragment_options_display.xml @@ -65,6 +65,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="12dp" + android:layout_marginEnd="48dp" android:text="@string/title_advanced_startup" android:textAppearance="@style/Base.TextAppearance.AppCompat.Small" android:textColor="?android:attr/textColorPrimary" @@ -370,6 +371,50 @@ app:layout_constraintTop_toBottomOf="@id/swDistinguishContacts" app:switchPadding="12dp" /> + + + + + + + + Threshold letter color Show names and email addresses Show a warning when the receiving server could not authenticate the message + Font size sender + Font size subject Show subject above sender Show subject in italics When needed, shorten the subject @@ -1130,6 +1132,20 @@ 4 + + -1 + 0 + 1 + 2 + + + + Default + Small + Medium + Large + + 17BA15C1AF55D925F98B99CEA4375D4CDF4C174B MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtFbxEbzL8u5accPGgBw/XdyiSS5BBE6ZQ9ELpKyJ/OQN+kdYniCAOw3lsQ/GuJScy4Y2HobqbBgLL8GLHG+Yu2EHC9dLjA3v2Mc25vvnfn86BsrpQvz1poN2n+roTBdq09FWbtebJ8m0hDBVmtfRi7RhTKIL4No3kodLhksdnucKjcFheubebWKgpmvbmw7NwuELhaZmyhw8WTtnQ4rZPMhjY1JJZgzwNExXgD7zzg4pJPkuQlfkuRkkvBpHpi3C7VDnYjrBlLHngI4wv3wxQBVwJqlvAT9PmX8dOVnTsWWdJdLQBZVWphuqVY54kjBIovN+o8w03WjsV9QiOQq+XwIDAQAB