Merge pull request #75 from rsnitsch/improve_get_children_performance
Speed up directory listing by factor 4-5 by improving getChildren function
This commit is contained in:
commit
2c4ef37f15
|
@ -162,14 +162,15 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener {
|
|||
}
|
||||
|
||||
private fun getChildren(file: File): Int {
|
||||
if (file.listFiles() == null)
|
||||
var fileList = file.list()
|
||||
if (fileList == null)
|
||||
return 0
|
||||
|
||||
if (file.isDirectory) {
|
||||
return if (mShowHidden) {
|
||||
file.listFiles()?.size ?: 0
|
||||
fileList.size
|
||||
} else {
|
||||
file.listFiles { file -> !file.isHidden }?.size ?: 0
|
||||
fileList.count { fileName -> fileName[0] != '.' }
|
||||
}
|
||||
}
|
||||
return 0
|
||||
|
|
Loading…
Reference in New Issue