1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 11:45:36 +00:00

Show image file size

This commit is contained in:
M66B 2022-03-04 08:26:25 +01:00
parent bd3606e727
commit 2c1ce39b78

View file

@ -107,6 +107,8 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
String type = args.getString("type");
int max = args.getInt("max");
args.putLong("size", file.length());
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
@ -140,10 +142,22 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
image instanceof AnimatedImageDrawable)
((AnimatedImageDrawable) image).start();
StringBuilder sb = new StringBuilder();
int width = args.getInt("width");
int height = args.getInt("height");
if (width > 0 && height > 0) {
tvProperties.setText(String.format("%d \u00d7 %d", width, height));
if (width > 0 && height > 0)
sb.append(width).append(" \u00d7 ").append(width);
long size = args.getLong("size");
if (size > 0) {
if (sb.length() > 0)
sb.append(" \u2013 ");
sb.append(Helper.humanReadableByteCount(size));
}
if (sb.length() > 0) {
tvProperties.setText(sb);
tvProperties.setVisibility(View.VISIBLE);
}
}