do not count hidden items size if we are not showing them
This commit is contained in:
parent
86126e48c2
commit
b4f22ae877
|
@ -16,7 +16,7 @@ import java.util.*
|
||||||
class PropertiesDialog() {
|
class PropertiesDialog() {
|
||||||
lateinit var mContext: Context
|
lateinit var mContext: Context
|
||||||
lateinit var mItem: FileDirItem
|
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
|
private var mFilesCnt = 0
|
||||||
|
|
||||||
constructor(context: Context, item: FileDirItem, countHiddenItems: Boolean = false) : this() {
|
constructor(context: Context, item: FileDirItem, countHiddenItems: Boolean = false) : this() {
|
||||||
|
@ -88,10 +88,9 @@ class PropertiesDialog() {
|
||||||
for (i in files.indices) {
|
for (i in files.indices) {
|
||||||
if (files[i].isDirectory) {
|
if (files[i].isDirectory) {
|
||||||
size += getDirectorySize(files[i])
|
size += getDirectorySize(files[i])
|
||||||
} else {
|
} else if (!files[i].isHidden && !dir.isHidden || mCountHiddenItems) {
|
||||||
|
mFilesCnt++
|
||||||
size += files[i].length()
|
size += files[i].length()
|
||||||
if (!files[i].isHidden && !dir.isHidden || mCountHiddenItems)
|
|
||||||
mFilesCnt++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return size
|
return size
|
||||||
|
|
Loading…
Reference in New Issue