From 4a09988d665a6f1466368b37453f6a79ea464a67 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 19 Sep 2020 09:21:15 +0200 Subject: [PATCH] Workaround invalid width/heigth specifications (disabled) --- app/src/main/java/eu/faircode/email/ImageHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ImageHelper.java b/app/src/main/java/eu/faircode/email/ImageHelper.java index 49bea8ff2d..0cc6e43b16 100644 --- a/app/src/main/java/eu/faircode/email/ImageHelper.java +++ b/app/src/main/java/eu/faircode/email/ImageHelper.java @@ -502,8 +502,9 @@ class ImageHelper { a.height = Math.round(a.width * h / (float) w); if (a.width != 0 && a.height != 0) { - w = Math.round(Helper.dp2pixels(view.getContext(), a.width) * scale); - h = Math.round(Helper.dp2pixels(view.getContext(), a.height) * scale); + boolean swap = ((w > h) != (a.width > a.height)) && false; + w = Math.round(Helper.dp2pixels(view.getContext(), swap ? a.height : a.width) * scale); + h = Math.round(Helper.dp2pixels(view.getContext(), swap ? a.width : a.height) * scale); } float width = view.getContext().getResources().getDisplayMetrics().widthPixels;