diff --git a/app/src/main/java/eu/faircode/email/AdapterImage.java b/app/src/main/java/eu/faircode/email/AdapterImage.java index 65870f8770..4a9b1e1b49 100644 --- a/app/src/main/java/eu/faircode/email/AdapterImage.java +++ b/app/src/main/java/eu/faircode/email/AdapterImage.java @@ -51,7 +51,6 @@ public class AdapterImage extends RecyclerView.Adapter private Context context; private LayoutInflater inflater; private LifecycleOwner owner; - private int dp48; private List items = new ArrayList<>(); @@ -80,18 +79,15 @@ public class AdapterImage extends RecyclerView.Adapter if (attachment.available) { Bitmap bm = Helper.decodeImage(attachment.getFile(context), context.getResources().getDisplayMetrics().widthPixels / 2); - if (bm == null) { - image.setPadding(dp48, dp48, dp48, dp48); + if (bm == null) image.setImageResource(R.drawable.baseline_broken_image_24); - } else { + else { image.setPadding(0, 0, 0, 0); image.setImageBitmap(bm); } - } else { - image.setPadding(dp48, dp48, dp48, dp48); + } else image.setImageResource(attachment.progress == null ? R.drawable.baseline_image_24 : R.drawable.baseline_hourglass_empty_24); - } caption.setText(attachment.name); } @@ -180,7 +176,6 @@ public class AdapterImage extends RecyclerView.Adapter this.context = context; this.inflater = LayoutInflater.from(context); this.owner = owner; - this.dp48 = Helper.dp2pixels(context, 48); setHasStableIds(true); } diff --git a/app/src/main/res/layout/item_image.xml b/app/src/main/res/layout/item_image.xml index afbdc9fd34..ed1bf0f01e 100644 --- a/app/src/main/res/layout/item_image.xml +++ b/app/src/main/res/layout/item_image.xml @@ -17,7 +17,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" - android:scaleType="centerCrop" + android:scaleType="centerInside" android:src="@mipmap/ic_launcher" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"