do not count hidden items size if we are not showing them

This commit is contained in:
tibbi 2016-10-16 20:20:58 +02:00
parent 86126e48c2
commit b4f22ae877
1 changed files with 3 additions and 4 deletions

View File

@ -16,7 +16,7 @@ import java.util.*
class PropertiesDialog() {
lateinit var mContext: Context
lateinit var mItem: FileDirItem
private var mCountHiddenItems = false // we always include the hidden item's size, counting items themselves is the optional thing
private var mCountHiddenItems = false
private var mFilesCnt = 0
constructor(context: Context, item: FileDirItem, countHiddenItems: Boolean = false) : this() {
@ -88,10 +88,9 @@ class PropertiesDialog() {
for (i in files.indices) {
if (files[i].isDirectory) {
size += getDirectorySize(files[i])
} else {
} else if (!files[i].isHidden && !dir.isHidden || mCountHiddenItems) {
mFilesCnt++
size += files[i].length()
if (!files[i].isHidden && !dir.isHidden || mCountHiddenItems)
mFilesCnt++
}
}
return size