diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/PropertiesDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/PropertiesDialog.kt index 91682cdb..ebe209ec 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/PropertiesDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/PropertiesDialog.kt @@ -11,6 +11,7 @@ import com.simplemobiletools.filemanager.extensions.* import kotlinx.android.synthetic.main.item_properties.view.* import kotlinx.android.synthetic.main.property_item.view.* import java.io.File +import java.util.* class PropertiesDialog() { lateinit var mContext: Context @@ -31,7 +32,7 @@ class PropertiesDialog() { val file = File(path) addProperty(R.string.name, file.name) addProperty(R.string.path, file.parent) - addProperty(R.string.size, getItemSize(file)) + addProperty(R.string.size, getItemSize(file).formatSize()) addProperty(R.string.last_modified, file.lastModified().formatLastModified()) if (file.isDirectory) { @@ -60,6 +61,13 @@ class PropertiesDialog() { mResources = mContext.resources mPropertyView = mInflater.inflate(R.layout.item_properties, null) as ViewGroup + val files = ArrayList(paths.size) + paths.forEach { files.add(File(it)) } + + addProperty(R.string.path, files[0].parent) + addProperty(R.string.size, getItemsSize(files).formatSize()) + addProperty(R.string.files_count, mFilesCnt.toString()) + AlertDialog.Builder(context) .setTitle(mResources.getString(R.string.properties)) .setView(mPropertyView) @@ -75,13 +83,20 @@ class PropertiesDialog() { mPropertyView.properties_holder.addView(view) } - private fun getItemSize(file: File): String { + private fun getItemsSize(files: ArrayList): Long { + var size = 0L + files.forEach { size += getItemSize(it) } + return size + } + + private fun getItemSize(file: File): Long { if (file.isDirectory) { mCountHiddenItems = Config.newInstance(mContext).showHidden - return getDirectorySize(File(file.path)).formatSize() + return getDirectorySize(File(file.path)) } - return file.length().formatSize() + mFilesCnt++ + return file.length() } private fun getDirectorySize(dir: File): Long { diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 84e9349a..e0b56600 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -41,7 +41,7 @@ Path Size Last modified - Files inside + Total files count Resolution Duration diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index e47d4f5d..feb9aeac 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -41,7 +41,7 @@ Percorso Dimensione Ultima modifica - File contenuti + Total files count Resolution Duration diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 289e7bbc..ae136818 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -41,7 +41,7 @@ Path Size Last modified - Files inside + Total files count Resolution Duration diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 1d825d4b..6c3a01c2 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -41,7 +41,7 @@ Caminho Tamanho Última modificação - Ficheiros no interior + Total files count Resolution Duration diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 4dea09c3..b28f3f25 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -41,7 +41,7 @@ Path Size Last modified - Files inside + Total files count Resolution Duration diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 99a3ffb8..64b14270 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -41,7 +41,7 @@ Path Size Last modified - Files inside + Total files count Resolution Duration