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,26 +218,20 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
} }
} }
selectedPaths.filter { it != FAVORITES && it != RECYCLE_BIN && (selectedPaths.size == 1 || !activity.config.isFolderProtected(it)) }.forEach {
val path = it
if (hide) { if (hide) {
if (config.wasHideFolderTooltipShown) { if (config.wasHideFolderTooltipShown) {
activity.handleLockedFolderOpening(path) { success -> hideFolders(selectedPaths)
if (success) {
hideFolder(path)
}
}
} else { } else {
config.wasHideFolderTooltipShown = true config.wasHideFolderTooltipShown = true
ConfirmationDialog(activity, activity.getString(R.string.hide_folder_description)) { ConfirmationDialog(activity, activity.getString(R.string.hide_folder_description)) {
activity.handleLockedFolderOpening(path) { success -> hideFolders(selectedPaths)
if (success) {
hideFolder(path)
} }
} }
return
} }
}
} else { selectedPaths.filter { it != FAVORITES && it != RECYCLE_BIN && (selectedPaths.size == 1 || !activity.config.isFolderProtected(it)) }.forEach {
val path = it
activity.handleLockedFolderOpening(path) { success -> activity.handleLockedFolderOpening(path) { success ->
if (success) { if (success) {
if (path.containsNoMedia()) { if (path.containsNoMedia()) {
@ -262,6 +256,15 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
} }
} }
} }
private fun hideFolders(paths: ArrayList<String>) {
for (path in paths) {
activity.handleLockedFolderOpening(path) { success ->
if (success) {
hideFolder(path)
}
}
}
} }
private fun tryEmptyRecycleBin(askConfirmation: Boolean) { private fun tryEmptyRecycleBin(askConfirmation: Boolean) {