mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
handle Properties and Un/hiding of locked folders
This commit is contained in:
parent
6e01ea3386
commit
6625a3dbb7
1 changed files with 36 additions and 24 deletions
|
@ -159,10 +159,14 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
if (selectedKeys.size <= 1) {
|
if (selectedKeys.size <= 1) {
|
||||||
val path = getFirstSelectedItemPath() ?: return
|
val path = getFirstSelectedItemPath() ?: return
|
||||||
if (path != FAVORITES && path != RECYCLE_BIN) {
|
if (path != FAVORITES && path != RECYCLE_BIN) {
|
||||||
|
activity.handleLockedFolderOpening(path) {
|
||||||
PropertiesDialog(activity, path, config.shouldShowHidden)
|
PropertiesDialog(activity, path, config.shouldShowHidden)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
PropertiesDialog(activity, getSelectedPaths().filter { it != FAVORITES && it != RECYCLE_BIN }.toMutableList(), config.shouldShowHidden)
|
PropertiesDialog(activity, getSelectedPaths().filter {
|
||||||
|
it != FAVORITES && it != RECYCLE_BIN && !activity.config.isFolderProtected(it)
|
||||||
|
}.toMutableList(), config.shouldShowHidden)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,6 +180,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activity.handleLockedFolderOpening(sourcePath) {
|
||||||
RenameItemDialog(activity, dir.absolutePath) {
|
RenameItemDialog(activity, dir.absolutePath) {
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
firstDir.apply {
|
firstDir.apply {
|
||||||
|
@ -190,8 +195,9 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
val paths = getSelectedPaths().filter { !activity.isAStorageRootFolder(it) } as ArrayList<String>
|
val paths = getSelectedPaths().filter { !activity.isAStorageRootFolder(it) && !activity.config.isFolderProtected(it) } as ArrayList<String>
|
||||||
RenameItemsDialog(activity, paths) {
|
RenameItemsDialog(activity, paths) {
|
||||||
listener?.refreshItems()
|
listener?.refreshItems()
|
||||||
}
|
}
|
||||||
|
@ -208,18 +214,23 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedPaths.filter { it != FAVORITES && it != RECYCLE_BIN }.forEach {
|
selectedPaths.filter { it != FAVORITES && it != RECYCLE_BIN && (selectedPaths.size == 1 || !activity.config.isFolderProtected(it)) }.forEach {
|
||||||
val path = it
|
val path = it
|
||||||
if (hide) {
|
if (hide) {
|
||||||
if (config.wasHideFolderTooltipShown) {
|
if (config.wasHideFolderTooltipShown) {
|
||||||
|
activity.handleLockedFolderOpening(path) {
|
||||||
hideFolder(path)
|
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) {
|
||||||
hideFolder(path)
|
hideFolder(path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
activity.handleLockedFolderOpening(path) {
|
||||||
activity.removeNoMedia(path) {
|
activity.removeNoMedia(path) {
|
||||||
if (activity.config.shouldShowHidden) {
|
if (activity.config.shouldShowHidden) {
|
||||||
updateFolderNames()
|
updateFolderNames()
|
||||||
|
@ -233,6 +244,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun tryEmptyRecycleBin(askConfirmation: Boolean) {
|
private fun tryEmptyRecycleBin(askConfirmation: Boolean) {
|
||||||
if (askConfirmation) {
|
if (askConfirmation) {
|
||||||
|
|
Loading…
Reference in a new issue