@@ -11,6 +11,7 @@ import com.simplemobiletools.filemanager.extensions.*
1111import kotlinx.android.synthetic.main.item_properties.view.*
1212import kotlinx.android.synthetic.main.property_item.view.*
1313import java.io.File
14+ import java.util.*
1415
1516class 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 {
0 commit comments