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 {
val path = it
if (hide) {
if (config.wasHideFolderTooltipShown) {
activity.handleLockedFolderOpening(path) { success ->
if (success) {
hideFolder(path)
}
}
} else {
config.wasHideFolderTooltipShown = true
ConfirmationDialog(activity, activity.getString(R.string.hide_folder_description)) {
activity.handleLockedFolderOpening(path) { success ->
if (success) {
hideFolder(path)
activity.handleLockedFolderOpening(path) { success ->
if (success) {
if (path.containsNoMedia()) {
activity.removeNoMedia(path) {
if (activity.config.shouldShowHidden) {
updateFolderNames()
} else {
activity.runOnUiThread {
listener?.refreshItems()
finishActMode()
}
}
}
} else {
config.addIncludedFolder(path)
activity.runOnUiThread {
listener?.refreshItems()
finishActMode()
}
}
}
} else {
activity.handleLockedFolderOpening(path) { success ->
if (success) {
if (path.containsNoMedia()) {
activity.removeNoMedia(path) {
if (activity.config.shouldShowHidden) {
updateFolderNames()
} else {
activity.runOnUiThread {
listener?.refreshItems()
finishActMode()
}
}
}
} else {
config.addIncludedFolder(path)
activity.runOnUiThread {
listener?.refreshItems()
finishActMode()
}
}
}
}
}
}
private fun hideFolders(paths: ArrayList<String>) {
for (path in paths) {
activity.handleLockedFolderOpening(path) { success ->
if (success) {
hideFolder(path)
}
}
}