Added debug option to enable/disable SVG

pull/217/head
M66B 9 months ago
parent ad7cbe70f1
commit a1c481786e

@ -197,12 +197,8 @@ public class AdapterMedia extends RecyclerView.Adapter<AdapterMedia.ViewHolder>
}
} else {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean webp = prefs.getBoolean("webp", true);
boolean barcode_preview = prefs.getBoolean("barcode_preview", true);
if ("image/webp".equalsIgnoreCase(type) && !webp)
return context.getDrawable(R.drawable.twotone_image_not_supported_24);
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;

@ -3750,6 +3750,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean hide_attachments = properties.getValue("hide_attachments", message.id, hide_attachments_default);
boolean show_inline = properties.getValue("inline", message.id);
boolean svg = prefs.getBoolean("svg", !Helper.isPlayStoreInstall());
boolean webp = prefs.getBoolean("webp", true);
Log.i("Hide attachments=" + hide_attachments + " Show inline=" + show_inline);
int available = 0;
@ -3823,18 +3826,20 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
int iavailable = 0;
List<EntityAttachment> media = new ArrayList<>();
if (thumbnails && !EntityFolder.JUNK.equals(message.folderType) && bind_extras) {
for (EntityAttachment attachment : attachments)
for (EntityAttachment attachment : attachments) {
String type = attachment.getMimeType();
if ((pdf_preview && attachment.isPDF()) ||
(video_preview && attachment.isVideo()) ||
(audio_preview && attachment.isAudio()) ||
(attachment.isAttachment() && attachment.isImage() &&
(!Helper.isPlayStoreInstall() ||
!"image/svg+xml".equalsIgnoreCase(attachment.getMimeType())))) {
(!"image/svg+xml".equalsIgnoreCase(type) || svg) &&
(!"image/webp".equalsIgnoreCase(type) || webp))) {
media.add(attachment);
if (attachment.available &&
attachment.isAttachment() && attachment.isImage())
iavailable++;
}
}
}
adapterMedia.set(media);
grpMedia.setVisibility(media.size() > 0 ? View.VISIBLE : View.GONE);

@ -226,6 +226,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swNativeArc;
private EditText etNativeArcWhitelist;
private SwitchCompat swStrictAlignment;
private SwitchCompat swSvg;
private SwitchCompat swWebp;
private SwitchCompat swAnimate;
private SwitchCompat swPreviewHidden;
@ -311,7 +312,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"max_backoff_power", "logarithmic_backoff",
"exact_alarms",
"native_dkim", "native_arc", "native_arc_whitelist", "strict_alignment",
"webp", "animate_images",
"svg", "webp", "animate_images",
"preview_hidden", "preview_quotes",
"easy_correct", "paste_plain", "paste_quote", "favicon_uri", "email_junk", "infra", "tld_flags", "json_ld", "dup_msgids", "thread_byref", "save_user_flags", "mdn",
"app_chooser", "app_chooser_share", "share_task",
@ -495,6 +496,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swNativeArc = view.findViewById(R.id.swNativeArc);
etNativeArcWhitelist = view.findViewById(R.id.etNativeArcWhitelist);
swStrictAlignment = view.findViewById(R.id.swStrictAlignment);
swSvg = view.findViewById(R.id.swSvg);
swWebp = view.findViewById(R.id.swWebp);
swAnimate = view.findViewById(R.id.swAnimate);
swPreviewHidden = view.findViewById(R.id.swPreviewHidden);
@ -1668,6 +1670,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swSvg.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("svg", checked).apply();
}
});
swWebp.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -2607,6 +2616,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
etNativeArcWhitelist.setText(prefs.getString("native_arc_whitelist", null));
swStrictAlignment.setEnabled(swNativeDkim.isEnabled() && swNativeDkim.isChecked());
swStrictAlignment.setChecked(prefs.getBoolean("strict_alignment", false));
swSvg.setChecked(prefs.getBoolean("svg", !Helper.isPlayStoreInstall()));
swWebp.setChecked(prefs.getBoolean("webp", true));
swAnimate.setChecked(prefs.getBoolean("animate_images", true));
swPreviewHidden.setChecked(prefs.getBoolean("preview_hidden", true));

@ -1712,6 +1712,17 @@
app:layout_constraintTop_toBottomOf="@id/etNativeArcWhitelist"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSvg"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_svg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swStrictAlignment"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swWebp"
android:layout_width="0dp"
@ -1720,7 +1731,7 @@
android:text="@string/title_advanced_webp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swStrictAlignment"
app:layout_constraintTop_toBottomOf="@id/swSvg"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -998,6 +998,7 @@
<string name="title_advanced_native_dkim" translatable="false">Native DKIM verification</string>
<string name="title_advanced_native_arc" translatable="false">Native ARC verification</string>
<string name="title_advanced_strict_alignment" translatable="false">Strict alignment</string>
<string name="title_advanced_svg" translatable="false">SVG</string>
<string name="title_advanced_webp" translatable="false">WebP</string>
<string name="title_advanced_animate" translatable="false">Animate images (GIF, etc.)</string>
<string name="title_advanced_preview_hidden" translatable="false">Preview hidden</string>

Loading…
Cancel
Save