Skip to content

Commit 3badc54

Browse files
committed
display the path, size and total files cnt at multiple items selected
1 parent 592b9c1 commit 3badc54

File tree

7 files changed

+25
-10
lines changed

7 files changed

+25
-10
lines changed

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import com.simplemobiletools.filemanager.extensions.*
1111
import kotlinx.android.synthetic.main.item_properties.view.*
1212
import kotlinx.android.synthetic.main.property_item.view.*
1313
import java.io.File
14+
import java.util.*
1415

1516
class PropertiesDialog() {
1617
lateinit var mContext: Context
@@ -31,7 +32,7 @@ class PropertiesDialog() {
3132
val file = File(path)
3233
addProperty(R.string.name, file.name)
3334
addProperty(R.string.path, file.parent)
34-
addProperty(R.string.size, getItemSize(file))
35+
addProperty(R.string.size, getItemSize(file).formatSize())
3536
addProperty(R.string.last_modified, file.lastModified().formatLastModified())
3637

3738
if (file.isDirectory) {
@@ -60,6 +61,13 @@ class PropertiesDialog() {
6061
mResources = mContext.resources
6162
mPropertyView = mInflater.inflate(R.layout.item_properties, null) as ViewGroup
6263

64+
val files = ArrayList<File>(paths.size)
65+
paths.forEach { files.add(File(it)) }
66+
67+
addProperty(R.string.path, files[0].parent)
68+
addProperty(R.string.size, getItemsSize(files).formatSize())
69+
addProperty(R.string.files_count, mFilesCnt.toString())
70+
6371
AlertDialog.Builder(context)
6472
.setTitle(mResources.getString(R.string.properties))
6573
.setView(mPropertyView)
@@ -75,13 +83,20 @@ class PropertiesDialog() {
7583
mPropertyView.properties_holder.addView(view)
7684
}
7785

78-
private fun getItemSize(file: File): String {
86+
private fun getItemsSize(files: ArrayList<File>): Long {
87+
var size = 0L
88+
files.forEach { size += getItemSize(it) }
89+
return size
90+
}
91+
92+
private fun getItemSize(file: File): Long {
7993
if (file.isDirectory) {
8094
mCountHiddenItems = Config.newInstance(mContext).showHidden
81-
return getDirectorySize(File(file.path)).formatSize()
95+
return getDirectorySize(File(file.path))
8296
}
8397

84-
return file.length().formatSize()
98+
mFilesCnt++
99+
return file.length()
85100
}
86101

87102
private fun getDirectorySize(dir: File): Long {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<string name="path">Path</string>
4242
<string name="size">Size</string>
4343
<string name="last_modified">Last modified</string>
44-
<string name="files_count">Files inside</string>
44+
<string name="files_count">Total files count</string>
4545
<string name="resolution">Resolution</string>
4646
<string name="duration">Duration</string>
4747

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<string name="path">Percorso</string>
4242
<string name="size">Dimensione</string>
4343
<string name="last_modified">Ultima modifica</string>
44-
<string name="files_count">File contenuti</string>
44+
<string name="files_count">Total files count</string>
4545
<string name="resolution">Resolution</string>
4646
<string name="duration">Duration</string>
4747

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<string name="path">Path</string>
4242
<string name="size">Size</string>
4343
<string name="last_modified">Last modified</string>
44-
<string name="files_count">Files inside</string>
44+
<string name="files_count">Total files count</string>
4545
<string name="resolution">Resolution</string>
4646
<string name="duration">Duration</string>
4747

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<string name="path">Caminho</string>
4242
<string name="size">Tamanho</string>
4343
<string name="last_modified">Última modificação</string>
44-
<string name="files_count">Ficheiros no interior</string>
44+
<string name="files_count">Total files count</string>
4545
<string name="resolution">Resolution</string>
4646
<string name="duration">Duration</string>
4747

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<string name="path">Path</string>
4242
<string name="size">Size</string>
4343
<string name="last_modified">Last modified</string>
44-
<string name="files_count">Files inside</string>
44+
<string name="files_count">Total files count</string>
4545
<string name="resolution">Resolution</string>
4646
<string name="duration">Duration</string>
4747

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<string name="path">Path</string>
4242
<string name="size">Size</string>
4343
<string name="last_modified">Last modified</string>
44-
<string name="files_count">Files inside</string>
44+
<string name="files_count">Total files count</string>
4545
<string name="resolution">Resolution</string>
4646
<string name="duration">Duration</string>
4747

0 commit comments

Comments
 (0)