Just center images

This commit is contained in:
M66B 2019-03-25 18:02:24 +00:00
parent afa8610b99
commit 5f99823bb3
2 changed files with 4 additions and 9 deletions

View File

@ -51,7 +51,6 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
private Context context;
private LayoutInflater inflater;
private LifecycleOwner owner;
private int dp48;
private List<EntityAttachment> items = new ArrayList<>();
@ -80,18 +79,15 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
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<AdapterImage.ViewHolder>
this.context = context;
this.inflater = LayoutInflater.from(context);
this.owner = owner;
this.dp48 = Helper.dp2pixels(context, 48);
setHasStableIds(true);
}

View File

@ -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"