1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-03-04 02:28:18 +00:00

Skip rendering large SVG media files

This commit is contained in:
M66B 2025-01-03 18:33:47 +01:00
parent 7b38c478bb
commit 03343b49d5

View file

@ -83,6 +83,7 @@ public class AdapterMedia extends RecyclerView.Adapter<AdapterMedia.ViewHolder>
private List<EntityAttachment> items = new ArrayList<>();
private static final int PDF_WIDTH = 120;
private static final int MAX_SVG_FILE_SIZE = 1024 * 1024;
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private final View view;
@ -202,6 +203,8 @@ public class AdapterMedia extends RecyclerView.Adapter<AdapterMedia.ViewHolder>
if ("image/webp".equalsIgnoreCase(type) && !webp)
return context.getDrawable(R.drawable.twotone_image_not_supported_24);
if ("image/svg+xml".equalsIgnoreCase(type) && file.length() > MAX_SVG_FILE_SIZE)
return context.getDrawable(R.drawable.twotone_image_not_supported_24);
try {
BitmapFactory.Options options = new BitmapFactory.Options();