Removed image size

This commit is contained in:
M66B 2019-05-30 16:47:51 +02:00
parent 50eaabd59e
commit 6024db8670
2 changed files with 1 additions and 18 deletions

View File

@ -59,7 +59,6 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
private ImageView ivImage; private ImageView ivImage;
private TextView tvCaption; private TextView tvCaption;
private TextView tvType; private TextView tvType;
private TextView tvSize;
ViewHolder(View itemView) { ViewHolder(View itemView) {
super(itemView); super(itemView);
@ -68,7 +67,6 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
ivImage = itemView.findViewById(R.id.ivImage); ivImage = itemView.findViewById(R.id.ivImage);
tvCaption = itemView.findViewById(R.id.tvCaption); tvCaption = itemView.findViewById(R.id.tvCaption);
tvType = itemView.findViewById(R.id.tvType); tvType = itemView.findViewById(R.id.tvType);
tvSize = itemView.findViewById(R.id.tvSize);
} }
private void wire() { private void wire() {
@ -80,9 +78,8 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
} }
private void bindTo(EntityAttachment attachment) { private void bindTo(EntityAttachment attachment) {
Bitmap bm = null;
if (attachment.available) { if (attachment.available) {
bm = Helper.decodeImage(attachment.getFile(context), Bitmap bm = Helper.decodeImage(attachment.getFile(context),
context.getResources().getDisplayMetrics().widthPixels); context.getResources().getDisplayMetrics().widthPixels);
if (bm == null) if (bm == null)
ivImage.setImageResource(R.drawable.baseline_broken_image_24); ivImage.setImageResource(R.drawable.baseline_broken_image_24);
@ -93,12 +90,9 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
? R.drawable.baseline_image_24 : R.drawable.baseline_hourglass_empty_24); ? R.drawable.baseline_image_24 : R.drawable.baseline_hourglass_empty_24);
tvCaption.setVisibility(TextUtils.isEmpty(attachment.name) ? View.GONE : View.VISIBLE); tvCaption.setVisibility(TextUtils.isEmpty(attachment.name) ? View.GONE : View.VISIBLE);
tvSize.setVisibility(bm == null ? View.GONE : View.VISIBLE);
tvCaption.setText(attachment.name); tvCaption.setText(attachment.name);
tvType.setText(attachment.type); tvType.setText(attachment.type);
if (bm != null)
tvSize.setText(bm.getWidth() + "x" + bm.getHeight());
} }
@Override @Override

View File

@ -45,16 +45,5 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaption" /> app:layout_constraintTop_toBottomOf="@id/tvCaption" />
<TextView
android:id="@+id/tvSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="160x320"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvType" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout> </FrameLayout>