Skip to content

Commit b45e526

Browse files
committed
display image resolution at the properties dialog
1 parent fd00b26 commit b45e526

File tree

9 files changed

+38
-2
lines changed

9 files changed

+38
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/PropertiesDialog.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ class PropertiesDialog : DialogFragment() {
4141
properties_files_count.visibility = View.VISIBLE
4242
properties_files_count.text = mFilesCnt.toString()
4343
} else if (mItem.isImage()) {
44-
44+
properties_resolution_label.visibility = View.VISIBLE
45+
properties_resolution.visibility = View.VISIBLE
46+
properties_resolution.text = mItem.resolution
4547
}
4648

4749
val file = File(mItem.path)

app/src/main/res/layout/item_properties.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,21 @@
8585
android:textColor="@android:color/black"
8686
android:visibility="gone"/>
8787

88+
<TextView
89+
android:id="@+id/properties_resolution_label"
90+
android:layout_width="match_parent"
91+
android:layout_height="wrap_content"
92+
android:layout_marginTop="@dimen/smtfp_activity_margin"
93+
android:text="@string/resolution"
94+
android:textSize="@dimen/smtfp_details_text_size"
95+
android:visibility="gone"/>
96+
97+
<TextView
98+
android:id="@+id/properties_resolution"
99+
android:layout_width="match_parent"
100+
android:layout_height="wrap_content"
101+
android:padding="@dimen/smtfp_small_margin"
102+
android:textColor="@android:color/black"
103+
android:visibility="gone"/>
104+
88105
</LinearLayout>

app/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<string name="size">Size</string>
4545
<string name="last_modified">Last modified</string>
4646
<string name="files_count">Files inside</string>
47+
<string name="resolution">Resolution</string>
4748

4849
<plurals name="items_deleted">
4950
<item quantity="one">1 Datei/Ordner gelöscht</item>

app/src/main/res/values-it/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<string name="size">Dimensione</string>
4545
<string name="last_modified">Ultima modifica</string>
4646
<string name="files_count">File contenuti</string>
47+
<string name="resolution">Resolution</string>
4748

4849
<plurals name="items_deleted">
4950
<item quantity="one">1 elemento eliminato</item>

app/src/main/res/values-ja/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<string name="size">Size</string>
4545
<string name="last_modified">Last modified</string>
4646
<string name="files_count">Files inside</string>
47+
<string name="resolution">Resolution</string>
4748

4849
<plurals name="items_deleted">
4950
<item quantity="one">1 アイテムを削除しました</item>

app/src/main/res/values-pt-rPT/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<string name="size">Tamanho</string>
4545
<string name="last_modified">Última modificação</string>
4646
<string name="files_count">Ficheiros no interior</string>
47+
<string name="resolution">Resolution</string>
4748

4849
<plurals name="items_deleted">
4950
<item quantity="one">1 item eliminado</item>

app/src/main/res/values-sv/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<string name="size">Size</string>
4545
<string name="last_modified">Last modified</string>
4646
<string name="files_count">Files inside</string>
47+
<string name="resolution">Resolution</string>
4748

4849
<plurals name="items_deleted">
4950
<item quantity="one">1 objekt borttagen</item>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<string name="size">Size</string>
4545
<string name="last_modified">Last modified</string>
4646
<string name="files_count">Files inside</string>
47+
<string name="resolution">Resolution</string>
4748

4849
<plurals name="items_deleted">
4950
<item quantity="one">1 item deleted</item>

library/src/main/kotlin/com/simplemobiletools/filepicker/models/FileDirItem.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.simplemobiletools.filepicker.models
22

3+
import android.graphics.Bitmap
34
import android.graphics.BitmapFactory
45

56
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,
2223
fun isImage(): Boolean {
2324
val options = BitmapFactory.Options()
2425
options.inJustDecodeBounds = true
25-
return options.outWidth !== -1 && options.outHeight !== -1
26+
BitmapFactory.decodeFile(path, options)
27+
return options.outWidth != -1 && options.outHeight != -1
2628
}
29+
30+
val resolution: String
31+
get () {
32+
val bitmap: Bitmap? = BitmapFactory.decodeFile(path)
33+
if (bitmap == null)
34+
return ""
35+
36+
return "${bitmap.width} x ${bitmap.height}"
37+
}
2738
}

0 commit comments

Comments
 (0)