mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
avoid some folder operations on Favorites
This commit is contained in:
parent
cc5bf379c4
commit
283a8254dc
1 changed files with 19 additions and 10 deletions
|
@ -144,11 +144,12 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
|
|
||||||
private fun showProperties() {
|
private fun showProperties() {
|
||||||
if (selectedPositions.size <= 1) {
|
if (selectedPositions.size <= 1) {
|
||||||
PropertiesDialog(activity, dirs[selectedPositions.first()].path, config.shouldShowHidden)
|
val path = dirs[selectedPositions.first()].path
|
||||||
|
if (path != FAVORITES) {
|
||||||
|
PropertiesDialog(activity, dirs[selectedPositions.first()].path, config.shouldShowHidden)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
val paths = ArrayList<String>()
|
PropertiesDialog(activity, getSelectedPaths().filter { it != FAVORITES }.toList(), config.shouldShowHidden)
|
||||||
selectedPositions.forEach { paths.add(dirs[it].path) }
|
|
||||||
PropertiesDialog(activity, paths, config.shouldShowHidden)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +179,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun toggleFoldersVisibility(hide: Boolean) {
|
private fun toggleFoldersVisibility(hide: Boolean) {
|
||||||
getSelectedPaths().forEach {
|
getSelectedPaths().filter { it != FAVORITES }.forEach {
|
||||||
val path = it
|
val path = it
|
||||||
if (hide) {
|
if (hide) {
|
||||||
if (config.wasHideFolderTooltipShown) {
|
if (config.wasHideFolderTooltipShown) {
|
||||||
|
@ -260,13 +261,13 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun tryExcludeFolder() {
|
private fun tryExcludeFolder() {
|
||||||
val paths = getSelectedPaths()
|
val paths = getSelectedPaths().filter { it != PATH }.toSet()
|
||||||
if (paths.size == 1) {
|
if (paths.size == 1) {
|
||||||
ExcludeFolderDialog(activity, paths.toList()) {
|
ExcludeFolderDialog(activity, paths.toList()) {
|
||||||
listener?.refreshItems()
|
listener?.refreshItems()
|
||||||
finishActMode()
|
finishActMode()
|
||||||
}
|
}
|
||||||
} else {
|
} else if (paths.size > 1) {
|
||||||
activity.config.addExcludedFolders(paths)
|
activity.config.addExcludedFolders(paths)
|
||||||
listener?.refreshItems()
|
listener?.refreshItems()
|
||||||
finishActMode()
|
finishActMode()
|
||||||
|
@ -293,7 +294,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
val path = dirs[it].path
|
val path = dirs[it].path
|
||||||
if (path.startsWith(OTG_PATH)) {
|
if (path.startsWith(OTG_PATH)) {
|
||||||
paths.addAll(getOTGFilePaths(path, showHidden))
|
paths.addAll(getOTGFilePaths(path, showHidden))
|
||||||
} else {
|
} else if (path != FAVORITES) {
|
||||||
File(path).listFiles()?.filter {
|
File(path).listFiles()?.filter {
|
||||||
!activity.getIsPathDirectory(it.absolutePath) && it.isImageVideoGif() && (showHidden || !it.name.startsWith('.'))
|
!activity.getIsPathDirectory(it.absolutePath) && it.isImageVideoGif() && (showHidden || !it.name.startsWith('.'))
|
||||||
}?.mapTo(paths) { it.absolutePath }
|
}?.mapTo(paths) { it.absolutePath }
|
||||||
|
@ -355,8 +356,16 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
activity.handleSAFDialog(SAFPath) {
|
activity.handleSAFDialog(SAFPath) {
|
||||||
selectedPositions.sortedDescending().forEach {
|
selectedPositions.sortedDescending().forEach {
|
||||||
val directory = dirs[it]
|
val directory = dirs[it]
|
||||||
folders.add(File(directory.path))
|
if (directory.areFavorites()) {
|
||||||
removeFolders.add(directory)
|
if (selectedPositions.size == 1) {
|
||||||
|
finishActMode()
|
||||||
|
} else {
|
||||||
|
selectedPositions.remove(it)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
folders.add(File(directory.path))
|
||||||
|
removeFolders.add(directory)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dirs.removeAll(removeFolders)
|
dirs.removeAll(removeFolders)
|
||||||
|
|
Loading…
Reference in a new issue