mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 06:01:12 +00:00
Show more image data
This commit is contained in:
parent
3fa67067ee
commit
612c252313
2 changed files with 45 additions and 13 deletions
|
@ -56,15 +56,19 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
|
|||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
private View view;
|
||||
private ImageView image;
|
||||
private TextView caption;
|
||||
private ImageView ivImage;
|
||||
private TextView tvCaption;
|
||||
private TextView tvType;
|
||||
private TextView tvSize;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
view = itemView.findViewById(R.id.clItem);
|
||||
image = itemView.findViewById(R.id.image);
|
||||
caption = itemView.findViewById(R.id.caption);
|
||||
ivImage = itemView.findViewById(R.id.ivImage);
|
||||
tvCaption = itemView.findViewById(R.id.tvCaption);
|
||||
tvType = itemView.findViewById(R.id.tvType);
|
||||
tvSize = itemView.findViewById(R.id.tvSize);
|
||||
}
|
||||
|
||||
private void wire() {
|
||||
|
@ -76,18 +80,25 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
|
|||
}
|
||||
|
||||
private void bindTo(EntityAttachment attachment) {
|
||||
Bitmap bm = null;
|
||||
if (attachment.available) {
|
||||
Bitmap bm = Helper.decodeImage(attachment.getFile(context),
|
||||
bm = Helper.decodeImage(attachment.getFile(context),
|
||||
context.getResources().getDisplayMetrics().widthPixels);
|
||||
if (bm == null)
|
||||
image.setImageResource(R.drawable.baseline_broken_image_24);
|
||||
ivImage.setImageResource(R.drawable.baseline_broken_image_24);
|
||||
else
|
||||
image.setImageBitmap(bm);
|
||||
ivImage.setImageBitmap(bm);
|
||||
} else
|
||||
image.setImageResource(attachment.progress == null
|
||||
ivImage.setImageResource(attachment.progress == null
|
||||
? R.drawable.baseline_image_24 : R.drawable.baseline_hourglass_empty_24);
|
||||
|
||||
caption.setText(attachment.name);
|
||||
tvCaption.setVisibility(TextUtils.isEmpty(attachment.name) ? View.GONE : View.VISIBLE);
|
||||
tvSize.setVisibility(bm == null ? View.GONE : View.VISIBLE);
|
||||
|
||||
tvCaption.setText(attachment.name);
|
||||
tvType.setText(attachment.type);
|
||||
if (bm != null)
|
||||
tvSize.setText(bm.getWidth() + "x" + bm.getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -141,7 +152,6 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
|
|||
protected Void onExecute(Context context, Bundle args) {
|
||||
long id = args.getLong("id");
|
||||
long message = args.getLong("message");
|
||||
long sequence = args.getInt("sequence");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
android:padding="6dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:id="@+id/ivImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
|
@ -25,7 +25,7 @@
|
|||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/caption"
|
||||
android:id="@+id/tvCaption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
|
@ -33,6 +33,28 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/image" />
|
||||
app:layout_constraintTop_toBottomOf="@id/ivImage" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="image/jpg"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
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>
|
||||
</FrameLayout>
|
Loading…
Reference in a new issue