optimizing the performance at fetching files

This commit is contained in:
tibbi 2020-09-27 11:36:43 +02:00
parent 935119f998
commit 12b96e159d
3 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.30.16'
implementation 'com.simplemobiletools:commons:5.30.18'
implementation 'com.github.Stericson:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6'
implementation 'com.alexvasilkov:gesture-views:2.5.2'

View File

@ -309,7 +309,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
addFileUris(it.uri.toString(), paths)
}
} else {
File(path).listFiles()?.filter { if (shouldShowHidden) true else !it.isHidden }?.forEach {
File(path).listFiles()?.filter { if (shouldShowHidden) true else !it.name.startsWith('.') }?.forEach {
addFileUris(it.absolutePath, paths)
}
}

View File

@ -239,7 +239,8 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
return null
}
val isDirectory = file.isDirectory
var lastModified = lastModifieds.remove(curPath)
val isDirectory = if (lastModified != null) false else file.isDirectory
val children = if (isDirectory) file.getDirectChildrenCount(showHidden) else 0
val size = if (isDirectory) {
if (isSortingBySize) {
@ -251,7 +252,6 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
file.length()
}
var lastModified = lastModifieds.remove(curPath)
if (lastModified == null) {
lastModified = file.lastModified()
}