Added settings to disable italic preview text

pull/160/head
M66B 6 years ago
parent def08a944a
commit 5fe3524f37

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

@ -38,7 +38,7 @@ public class FragmentOptions extends FragmentBase {
private PagerAdapter adapter; private PagerAdapter adapter;
static String[] OPTIONS_RESTART = new String[]{ 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", "addresses", "attachments_alt", "contrast", "monospaced", "inline_images", "contact_images", "all_images", "collapse_quotes", "autocontent", "actionbar",
"autoscroll", "swipenav", "autoexpand", "autoclose", "onclose", "autoscroll", "swipenav", "autoexpand", "autoclose", "onclose",
"subscriptions", "debug", "subscriptions", "debug",

@ -54,6 +54,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swSubjectItalic; private SwitchCompat swSubjectItalic;
private SwitchCompat swFlags; private SwitchCompat swFlags;
private SwitchCompat swPreview; private SwitchCompat swPreview;
private SwitchCompat swPreviewItalic;
private SwitchCompat swAddresses; private SwitchCompat swAddresses;
private SwitchCompat swAttachmentsAlt; private SwitchCompat swAttachmentsAlt;
@ -68,7 +69,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{ private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "date", "threading", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic", "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", "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); swSubjectItalic = view.findViewById(R.id.swSubjectItalic);
swFlags = view.findViewById(R.id.swFlags); swFlags = view.findViewById(R.id.swFlags);
swPreview = view.findViewById(R.id.swPreview); swPreview = view.findViewById(R.id.swPreview);
swPreviewItalic = view.findViewById(R.id.swPreviewItalic);
swAddresses = view.findViewById(R.id.swAddresses); swAddresses = view.findViewById(R.id.swAddresses);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt); swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
swContrast = view.findViewById(R.id.swContrast); swContrast = view.findViewById(R.id.swContrast);
@ -203,6 +205,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("preview", checked).apply(); 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)); swSubjectItalic.setChecked(prefs.getBoolean("subject_italic", true));
swFlags.setChecked(prefs.getBoolean("flags", true)); swFlags.setChecked(prefs.getBoolean("flags", true));
swPreview.setChecked(prefs.getBoolean("preview", false)); swPreview.setChecked(prefs.getBoolean("preview", false));
swPreviewItalic.setChecked(prefs.getBoolean("preview_italic", true));
swPreviewItalic.setEnabled(swPreview.isChecked());
swAddresses.setChecked(prefs.getBoolean("addresses", false)); swAddresses.setChecked(prefs.getBoolean("addresses", false));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false)); swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
swContrast.setChecked(prefs.getBoolean("contrast", false)); swContrast.setChecked(prefs.getBoolean("contrast", false));

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

Loading…
Cancel
Save