pull/94/head
kunfei 5 years ago
parent c2b9433a6d
commit af3c9c2ccc
  1. 8
      app/src/main/java/io/legado/app/ui/filechooser/adapter/PathAdapter.kt

@ -36,9 +36,11 @@ class PathAdapter(context: Context, val callBack: CallBack) :
path1 = path1.replace(sdCardDirectory, "") path1 = path1.replace(sdCardDirectory, "")
paths.clear() paths.clear()
if (path1 != "/" && path1 != "") { if (path1 != "/" && path1 != "") {
val tmps = path1.substring(path1.indexOf("/") + 1).split("/".toRegex()) val subDirs = path1.substring(path1.indexOf("/") + 1)
.dropLastWhile { it.isEmpty() }.toTypedArray() .split("/".toRegex())
Collections.addAll(paths, *tmps) .dropLastWhile { it.isEmpty() }
.toTypedArray()
Collections.addAll(paths, *subDirs)
} }
paths.addFirst(ROOT_HINT) paths.addFirst(ROOT_HINT)
setItems(paths) setItems(paths)

Loading…
Cancel
Save