mirror of https://github.com/M66B/FairEmail.git
Added option to override HTML widths
This commit is contained in:
parent
644d36f322
commit
190888e59b
|
@ -2610,7 +2610,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
HtmlHelper.guessSchemes(document);
|
||||
|
||||
boolean overview_mode = prefs.getBoolean("overview_mode", false);
|
||||
boolean override_width = prefs.getBoolean("override_width", false);
|
||||
HtmlHelper.setViewport(document, overview_mode);
|
||||
if (!overview_mode && override_width)
|
||||
HtmlHelper.overrideWidth(document);
|
||||
if (inline || show_images)
|
||||
HtmlHelper.embedInlineImages(context, message.id, document, show_images);
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
"font_size_sender", "sender_ellipsize",
|
||||
"subject_top", "subject_italic", "highlight_subject", "font_size_subject", "subject_ellipsize",
|
||||
"keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
|
||||
"message_zoom", "overview_mode", "addresses", "button_extra", "attachments_alt", "thumbnails",
|
||||
"message_zoom", "overview_mode", "override_width", "addresses", "button_extra", "attachments_alt", "thumbnails",
|
||||
"contrast", "monospaced", "monospaced_pre",
|
||||
"background_color", "text_color", "text_size", "text_font", "text_align", "text_separators",
|
||||
"collapse_quotes", "image_placeholders", "inline_images",
|
||||
|
|
|
@ -135,6 +135,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private TextView tvMessageZoom;
|
||||
private SeekBar sbMessageZoom;
|
||||
private SwitchCompat swOverviewMode;
|
||||
private SwitchCompat swOverrideWidth;
|
||||
|
||||
private SwitchCompat swContrast;
|
||||
private SwitchCompat swMonospaced;
|
||||
|
@ -173,7 +174,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
"keywords_header", "labels_header", "flags", "flags_background",
|
||||
"preview", "preview_italic", "preview_lines",
|
||||
"addresses",
|
||||
"message_zoom", "overview_mode", "contrast", "monospaced", "monospaced_pre",
|
||||
"message_zoom", "overview_mode", "override_width", "contrast", "monospaced", "monospaced_pre",
|
||||
"background_color", "text_color", "text_size", "text_font", "text_align", "text_separators",
|
||||
"collapse_quotes", "image_placeholders", "inline_images", "button_extra", "attachments_alt", "thumbnails",
|
||||
"parse_classes",
|
||||
|
@ -267,6 +268,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
tvMessageZoom = view.findViewById(R.id.tvMessageZoom);
|
||||
sbMessageZoom = view.findViewById(R.id.sbMessageZoom);
|
||||
swOverviewMode = view.findViewById(R.id.swOverviewMode);
|
||||
swOverrideWidth = view.findViewById(R.id.swOverrideWidth);
|
||||
swContrast = view.findViewById(R.id.swContrast);
|
||||
swMonospaced = view.findViewById(R.id.swMonospaced);
|
||||
swMonospacedPre = view.findViewById(R.id.swMonospacedPre);
|
||||
|
@ -898,6 +900,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("overview_mode", checked).apply();
|
||||
swOverrideWidth.setEnabled(!checked);
|
||||
}
|
||||
});
|
||||
|
||||
swOverrideWidth.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("override_width", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1213,6 +1223,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
sbMessageZoom.setProgress(message_zoom - 50);
|
||||
|
||||
swOverviewMode.setChecked(prefs.getBoolean("overview_mode", false));
|
||||
swOverrideWidth.setChecked(prefs.getBoolean("override_width", false));
|
||||
swOverrideWidth.setEnabled(!swOverviewMode.isChecked());
|
||||
|
||||
swContrast.setChecked(prefs.getBoolean("contrast", false));
|
||||
swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
|
||||
|
|
|
@ -2064,6 +2064,13 @@ public class HtmlHelper {
|
|||
Log.i(document.head().html());
|
||||
}
|
||||
|
||||
static void overrideWidth(Document document) {
|
||||
document.select("head")
|
||||
.prepend("<style type=\"text/css\">" +
|
||||
"* {width: auto !important; max-width: none !important;}" +
|
||||
"</style>");
|
||||
}
|
||||
|
||||
static String getLanguage(Context context, String subject, String text) {
|
||||
try {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
|
|
@ -1348,6 +1348,18 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swOverviewMode" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swOverrideWidth"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_override_width"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvOverViewModeHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swContrast"
|
||||
android:layout_width="0dp"
|
||||
|
@ -1356,7 +1368,7 @@
|
|||
android:text="@string/title_advanced_contrast"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvOverViewModeHint"
|
||||
app:layout_constraintTop_toBottomOf="@id/swOverrideWidth"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -490,6 +490,7 @@
|
|||
<string name="title_advanced_thumbnails">Show image thumbnails after the message text</string>
|
||||
<string name="title_advanced_message_text_zoom2">Default message text zoom: %1$s %%</string>
|
||||
<string name="title_advanced_overview_mode">Zoom original messages to fit the screen</string>
|
||||
<string name="title_advanced_override_width">Override widths in original messages</string>
|
||||
<string name="title_advanced_contrast">Use high contrast for message text</string>
|
||||
<string name="title_advanced_monospaced">Use monospaced font for message text by default</string>
|
||||
<string name="title_advanced_monospaced_pre">Use monospaced font for preformatted text</string>
|
||||
|
|
Loading…
Reference in New Issue