mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
display image resolution at the properties dialog
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package com.simplemobiletools.filepicker.models
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
|
||||
class FileDirItem(val path: String, val name: String, val isDirectory: Boolean, val children: Int, val size: Long) :
|
||||
@ -22,6 +23,16 @@ class FileDirItem(val path: String, val name: String, val isDirectory: Boolean,
|
||||
fun isImage(): Boolean {
|
||||
val options = BitmapFactory.Options()
|
||||
options.inJustDecodeBounds = true
|
||||
return options.outWidth !== -1 && options.outHeight !== -1
|
||||
BitmapFactory.decodeFile(path, options)
|
||||
return options.outWidth != -1 && options.outHeight != -1
|
||||
}
|
||||
|
||||
val resolution: String
|
||||
get () {
|
||||
val bitmap: Bitmap? = BitmapFactory.decodeFile(path)
|
||||
if (bitmap == null)
|
||||
return ""
|
||||
|
||||
return "${bitmap.width} x ${bitmap.height}"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user