Added option to disable image thumbnails

pull/183/head
M66B 5 years ago
parent 14371f489b
commit e4457d5b9c

@ -249,6 +249,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean preview_italic;
private int preview_lines;
private boolean attachments_alt;
private boolean thumbnails;
private boolean contrast;
private boolean monospaced;
private boolean inline;
@ -2353,6 +2354,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
});
List<EntityAttachment> images = new ArrayList<>();
if (thumbnails)
for (EntityAttachment attachment : attachments)
if (attachment.isAttachment() && attachment.isImage())
images.add(attachment);
@ -4997,6 +4999,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.preview_italic = prefs.getBoolean("preview_italic", true);
this.preview_lines = prefs.getInt("preview_lines", 2);
this.attachments_alt = prefs.getBoolean("attachments_alt", false);
this.thumbnails = prefs.getBoolean("thumbnails", true);
this.contrast = prefs.getBoolean("contrast", false);
this.monospaced = prefs.getBoolean("monospaced", false);
this.inline = prefs.getBoolean("inline_images", false);

@ -84,7 +84,7 @@ public class FragmentOptions extends FragmentBase {
"name_email", "prefer_contact", "distinguish_contacts", "show_recipients", "authentication",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
"keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
"addresses", "attachments_alt",
"addresses", "attachments_alt", "thumbnails",
"contrast", "monospaced", "text_color", "text_size", "text_font", "text_align",
"inline_images", "collapse_quotes", "seekbar", "actionbar", "actionbar_color", "navbar_colorize",
"autoscroll", "swipenav", "autoexpand", "autoclose", "onclose",

@ -113,6 +113,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swCollapseQuotes;
private SwitchCompat swImagesInline;
private SwitchCompat swAttachmentsAlt;
private SwitchCompat swThumbnails;
private SwitchCompat swParseClasses;
private SwitchCompat swAuthentication;
@ -128,7 +129,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"preview", "preview_italic", "preview_lines",
"addresses",
"contrast", "monospaced", "text_color", "text_size", "text_font", "text_align",
"inline_images", "collapse_quotes", "attachments_alt",
"inline_images", "collapse_quotes", "attachments_alt", "thumbnails",
"parse_classes", "authentication"
};
@ -198,6 +199,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
swImagesInline = view.findViewById(R.id.swImagesInline);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
swThumbnails = view.findViewById(R.id.swThumbnails);
swParseClasses = view.findViewById(R.id.swParseClasses);
swAuthentication = view.findViewById(R.id.swAuthentication);
@ -652,6 +654,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swThumbnails.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("thumbnails", checked).apply();
}
});
swParseClasses.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -812,6 +821,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
swThumbnails.setChecked(prefs.getBoolean("thumbnails", true));
swParseClasses.setChecked(prefs.getBoolean("parse_classes", false));
swAuthentication.setChecked(prefs.getBoolean("authentication", true));

@ -902,6 +902,18 @@
app:layout_constraintTop_toBottomOf="@id/tvImagesInlineHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swThumbnails"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:enabled="true"
android:text="@string/title_advanced_thumbnails"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAttachmentsAlt"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvAdvanced"
android:layout_width="0dp"
@ -912,7 +924,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAttachmentsAlt" />
app:layout_constraintTop_toBottomOf="@id/swThumbnails" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swParseClasses"

@ -355,6 +355,7 @@
<string name="title_advanced_preview_lines">Number of preview lines</string>
<string name="title_advanced_addresses">Expand address details by default</string>
<string name="title_advanced_attachments_alt">Show attachments after the message text</string>
<string name="title_advanced_thumbnails">Show image thumbnails after the message text</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_text_color">Use text colors</string>

Loading…
Cancel
Save