optimize root file size fetching in case we sort by size
This commit is contained in:
parent
955f22ebc8
commit
fa268f16f5
1 changed files with 3 additions and 7 deletions
|
@ -118,12 +118,8 @@ class RootHelpers(val activity: Activity) {
|
||||||
|
|
||||||
private fun getFileSizes(files: ArrayList<FileDirItem>, path: String, callback: (originalPath: String, fileDirItems: ArrayList<FileDirItem>) -> Unit) {
|
private fun getFileSizes(files: ArrayList<FileDirItem>, path: String, callback: (originalPath: String, fileDirItems: ArrayList<FileDirItem>) -> Unit) {
|
||||||
var cmd = ""
|
var cmd = ""
|
||||||
files.forEach {
|
files.filter { !it.isDirectory }.forEach {
|
||||||
cmd += if (it.isDirectory) {
|
cmd += "stat -t ${it.path};"
|
||||||
"echo 0;"
|
|
||||||
} else {
|
|
||||||
"stat -t ${it.path};"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val lines = ArrayList<String>()
|
val lines = ArrayList<String>()
|
||||||
|
@ -134,7 +130,7 @@ class RootHelpers(val activity: Activity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun commandCompleted(id: Int, exitcode: Int) {
|
override fun commandCompleted(id: Int, exitcode: Int) {
|
||||||
files.forEachIndexed { index, fileDirItem ->
|
files.filter { !it.isDirectory }.forEachIndexed { index, fileDirItem ->
|
||||||
var line = lines[index]
|
var line = lines[index]
|
||||||
if (line.isNotEmpty() && line != "0") {
|
if (line.isNotEmpty() && line != "0") {
|
||||||
if (line.length >= fileDirItem.path.length) {
|
if (line.length >= fileDirItem.path.length) {
|
||||||
|
|
Loading…
Reference in a new issue