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:
parent
bd3606e727
commit
2c1ce39b78
1 changed files with 16 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue