fix #1552, fixing a glitch related to removing multiple folders at once

This commit is contained in:
tibbi 2019-09-03 21:07:53 +02:00
parent e582dd6034
commit e095ee7421

View file

@ -218,47 +218,50 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
} }
} }
if (hide) {
if (config.wasHideFolderTooltipShown) {
hideFolders(selectedPaths)
} else {
config.wasHideFolderTooltipShown = true
ConfirmationDialog(activity, activity.getString(R.string.hide_folder_description)) {
hideFolders(selectedPaths)
}
}
return
}
selectedPaths.filter { it != FAVORITES && it != RECYCLE_BIN && (selectedPaths.size == 1 || !activity.config.isFolderProtected(it)) }.forEach { selectedPaths.filter { it != FAVORITES && it != RECYCLE_BIN && (selectedPaths.size == 1 || !activity.config.isFolderProtected(it)) }.forEach {
val path = it val path = it
if (hide) { activity.handleLockedFolderOpening(path) { success ->
if (config.wasHideFolderTooltipShown) { if (success) {
activity.handleLockedFolderOpening(path) { success -> if (path.containsNoMedia()) {
if (success) { activity.removeNoMedia(path) {
hideFolder(path) if (activity.config.shouldShowHidden) {
} updateFolderNames()
} } else {
} else { activity.runOnUiThread {
config.wasHideFolderTooltipShown = true listener?.refreshItems()
ConfirmationDialog(activity, activity.getString(R.string.hide_folder_description)) { finishActMode()
activity.handleLockedFolderOpening(path) { success -> }
if (success) {
hideFolder(path)
} }
} }
} else {
config.addIncludedFolder(path)
activity.runOnUiThread {
listener?.refreshItems()
finishActMode()
}
} }
} }
} else { }
activity.handleLockedFolderOpening(path) { success -> }
if (success) { }
if (path.containsNoMedia()) {
activity.removeNoMedia(path) { private fun hideFolders(paths: ArrayList<String>) {
if (activity.config.shouldShowHidden) { for (path in paths) {
updateFolderNames() activity.handleLockedFolderOpening(path) { success ->
} else { if (success) {
activity.runOnUiThread { hideFolder(path)
listener?.refreshItems()
finishActMode()
}
}
}
} else {
config.addIncludedFolder(path)
activity.runOnUiThread {
listener?.refreshItems()
finishActMode()
}
}
}
} }
} }
} }