properly handle Recycle bin and Favorites at grouping direct subfolders

This commit is contained in:
tibbi 2018-12-17 11:18:41 +01:00
parent 84b0c9c88b
commit 7ba0be43a9

View file

@ -938,7 +938,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
val currentPaths = LinkedHashSet<String>()
folders.forEach {
val path = it
if (!path.equals(internalPath, true) && !path.equals(sdPath, true)) {
if (!path.equals(internalPath, true) && !path.equals(sdPath, true) && path != RECYCLE_BIN && path != FAVORITES) {
if (mCurrentPathPrefix.isNotEmpty()) {
if (File(path).parent.equals(mCurrentPathPrefix, true) || path == mCurrentPathPrefix) {
currentPaths.add(path)
@ -956,12 +956,20 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
currentPaths.forEach {
val path = it
currentPaths.forEach {
if (!it.equals(path) && File(it).parent.equals(path)) {
if (!it.equals(path) && File(it).parent?.equals(path) == true) {
areDirectSubfoldersAvailable = true
}
}
}
if (mCurrentPathPrefix.isEmpty() && folders.contains(RECYCLE_BIN)) {
currentPaths.add(RECYCLE_BIN)
}
if (mCurrentPathPrefix.isEmpty() && folders.contains(FAVORITES)) {
currentPaths.add(FAVORITES)
}
if (folders.size == currentPaths.size) {
return currentPaths
}