display image resolution at the properties dialog
This commit is contained in:
parent
fd00b26f9b
commit
b45e526fa7
|
@ -41,7 +41,9 @@ class PropertiesDialog : DialogFragment() {
|
||||||
properties_files_count.visibility = View.VISIBLE
|
properties_files_count.visibility = View.VISIBLE
|
||||||
properties_files_count.text = mFilesCnt.toString()
|
properties_files_count.text = mFilesCnt.toString()
|
||||||
} else if (mItem.isImage()) {
|
} else if (mItem.isImage()) {
|
||||||
|
properties_resolution_label.visibility = View.VISIBLE
|
||||||
|
properties_resolution.visibility = View.VISIBLE
|
||||||
|
properties_resolution.text = mItem.resolution
|
||||||
}
|
}
|
||||||
|
|
||||||
val file = File(mItem.path)
|
val file = File(mItem.path)
|
||||||
|
|
|
@ -85,4 +85,21 @@
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/properties_resolution_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/smtfp_activity_margin"
|
||||||
|
android:text="@string/resolution"
|
||||||
|
android:textSize="@dimen/smtfp_details_text_size"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/properties_resolution"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/smtfp_small_margin"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<string name="size">Size</string>
|
<string name="size">Size</string>
|
||||||
<string name="last_modified">Last modified</string>
|
<string name="last_modified">Last modified</string>
|
||||||
<string name="files_count">Files inside</string>
|
<string name="files_count">Files inside</string>
|
||||||
|
<string name="resolution">Resolution</string>
|
||||||
|
|
||||||
<plurals name="items_deleted">
|
<plurals name="items_deleted">
|
||||||
<item quantity="one">1 Datei/Ordner gelöscht</item>
|
<item quantity="one">1 Datei/Ordner gelöscht</item>
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<string name="size">Dimensione</string>
|
<string name="size">Dimensione</string>
|
||||||
<string name="last_modified">Ultima modifica</string>
|
<string name="last_modified">Ultima modifica</string>
|
||||||
<string name="files_count">File contenuti</string>
|
<string name="files_count">File contenuti</string>
|
||||||
|
<string name="resolution">Resolution</string>
|
||||||
|
|
||||||
<plurals name="items_deleted">
|
<plurals name="items_deleted">
|
||||||
<item quantity="one">1 elemento eliminato</item>
|
<item quantity="one">1 elemento eliminato</item>
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<string name="size">Size</string>
|
<string name="size">Size</string>
|
||||||
<string name="last_modified">Last modified</string>
|
<string name="last_modified">Last modified</string>
|
||||||
<string name="files_count">Files inside</string>
|
<string name="files_count">Files inside</string>
|
||||||
|
<string name="resolution">Resolution</string>
|
||||||
|
|
||||||
<plurals name="items_deleted">
|
<plurals name="items_deleted">
|
||||||
<item quantity="one">1 アイテムを削除しました</item>
|
<item quantity="one">1 アイテムを削除しました</item>
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<string name="size">Tamanho</string>
|
<string name="size">Tamanho</string>
|
||||||
<string name="last_modified">Última modificação</string>
|
<string name="last_modified">Última modificação</string>
|
||||||
<string name="files_count">Ficheiros no interior</string>
|
<string name="files_count">Ficheiros no interior</string>
|
||||||
|
<string name="resolution">Resolution</string>
|
||||||
|
|
||||||
<plurals name="items_deleted">
|
<plurals name="items_deleted">
|
||||||
<item quantity="one">1 item eliminado</item>
|
<item quantity="one">1 item eliminado</item>
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<string name="size">Size</string>
|
<string name="size">Size</string>
|
||||||
<string name="last_modified">Last modified</string>
|
<string name="last_modified">Last modified</string>
|
||||||
<string name="files_count">Files inside</string>
|
<string name="files_count">Files inside</string>
|
||||||
|
<string name="resolution">Resolution</string>
|
||||||
|
|
||||||
<plurals name="items_deleted">
|
<plurals name="items_deleted">
|
||||||
<item quantity="one">1 objekt borttagen</item>
|
<item quantity="one">1 objekt borttagen</item>
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<string name="size">Size</string>
|
<string name="size">Size</string>
|
||||||
<string name="last_modified">Last modified</string>
|
<string name="last_modified">Last modified</string>
|
||||||
<string name="files_count">Files inside</string>
|
<string name="files_count">Files inside</string>
|
||||||
|
<string name="resolution">Resolution</string>
|
||||||
|
|
||||||
<plurals name="items_deleted">
|
<plurals name="items_deleted">
|
||||||
<item quantity="one">1 item deleted</item>
|
<item quantity="one">1 item deleted</item>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.simplemobiletools.filepicker.models
|
package com.simplemobiletools.filepicker.models
|
||||||
|
|
||||||
|
import android.graphics.Bitmap
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
|
|
||||||
class FileDirItem(val path: String, val name: String, val isDirectory: Boolean, val children: Int, val size: Long) :
|
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 {
|
fun isImage(): Boolean {
|
||||||
val options = BitmapFactory.Options()
|
val options = BitmapFactory.Options()
|
||||||
options.inJustDecodeBounds = true
|
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}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue