Added settings to disable italic preview text

This commit is contained in:
M66B 2019-08-12 08:39:43 +02:00
parent def08a944a
commit 5fe3524f37
4 changed files with 32 additions and 4 deletions

View File

@ -181,6 +181,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean subject_italic;
private boolean flags;
private boolean preview;
private boolean preview_italic;
private boolean attachments_alt;
private boolean contrast;
private boolean monospaced;
@ -719,7 +720,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
// Message text preview
tvPreview.setTextColor(contrast ? textColorPrimary : textColorSecondary);
tvPreview.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT, Typeface.ITALIC);
tvPreview.setTypeface(
monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT,
preview_italic ? Typeface.ITALIC : Typeface.NORMAL);
tvPreview.setText(message.preview);
tvPreview.setVisibility(preview && !TextUtils.isEmpty(message.preview) ? View.VISIBLE : View.GONE);
@ -2982,6 +2985,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.subject_italic = prefs.getBoolean("subject_italic", true);
this.flags = prefs.getBoolean("flags", true);
this.preview = prefs.getBoolean("preview", false);
this.preview_italic = prefs.getBoolean("preview_italic", true);
this.attachments_alt = prefs.getBoolean("attachments_alt", false);
this.contrast = prefs.getBoolean("contrast", false);
this.monospaced = prefs.getBoolean("monospaced", false);

View File

@ -38,7 +38,7 @@ public class FragmentOptions extends FragmentBase {
private PagerAdapter adapter;
static String[] OPTIONS_RESTART = new String[]{
"startup", "date", "threading", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic", "flags", "preview",
"startup", "date", "threading", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic", "flags", "preview", "preview_italic",
"addresses", "attachments_alt", "contrast", "monospaced", "inline_images", "contact_images", "all_images", "collapse_quotes", "autocontent", "actionbar",
"autoscroll", "swipenav", "autoexpand", "autoclose", "onclose",
"subscriptions", "debug",

View File

@ -54,6 +54,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swSubjectItalic;
private SwitchCompat swFlags;
private SwitchCompat swPreview;
private SwitchCompat swPreviewItalic;
private SwitchCompat swAddresses;
private SwitchCompat swAttachmentsAlt;
@ -68,7 +69,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "date", "threading", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic",
"flags", "preview", "addresses", "attachments_alt",
"flags", "preview", "preview_italic", "addresses", "attachments_alt",
"contrast", "monospaced", "inline_images", "contact_images", "all_images", "collapse_quotes", "autocontent", "actionbar",
};
@ -94,6 +95,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swSubjectItalic = view.findViewById(R.id.swSubjectItalic);
swFlags = view.findViewById(R.id.swFlags);
swPreview = view.findViewById(R.id.swPreview);
swPreviewItalic = view.findViewById(R.id.swPreviewItalic);
swAddresses = view.findViewById(R.id.swAddresses);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
swContrast = view.findViewById(R.id.swContrast);
@ -203,6 +205,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("preview", checked).apply();
swPreviewItalic.setEnabled(checked);
}
});
swPreviewItalic.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("preview_italic", checked).apply();
}
});
@ -342,6 +352,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swSubjectItalic.setChecked(prefs.getBoolean("subject_italic", true));
swFlags.setChecked(prefs.getBoolean("flags", true));
swPreview.setChecked(prefs.getBoolean("preview", false));
swPreviewItalic.setChecked(prefs.getBoolean("preview_italic", true));
swPreviewItalic.setEnabled(swPreview.isChecked());
swAddresses.setChecked(prefs.getBoolean("addresses", false));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
swContrast.setChecked(prefs.getBoolean("contrast", false));

View File

@ -204,6 +204,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swPreview" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swPreviewItalic"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_preview_italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPreviewHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAddresses"
android:layout_width="0dp"
@ -212,7 +224,7 @@
android:text="@string/title_advanced_addresses"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPreviewHint"
app:layout_constraintTop_toBottomOf="@id/swPreviewItalic"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat