handle Properties and Un/hiding of locked folders

This commit is contained in:
tibbi 2019-07-02 21:15:17 +02:00
parent 6e01ea3386
commit 6625a3dbb7

View file

@ -159,10 +159,14 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
if (selectedKeys.size <= 1) {
val path = getFirstSelectedItemPath() ?: return
if (path != FAVORITES && path != RECYCLE_BIN) {
activity.handleLockedFolderOpening(path) {
PropertiesDialog(activity, path, config.shouldShowHidden)
}
}
} 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
}
activity.handleLockedFolderOpening(sourcePath) {
RenameItemDialog(activity, dir.absolutePath) {
activity.runOnUiThread {
firstDir.apply {
@ -190,8 +195,9 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
}
}
}
}
} 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) {
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
if (hide) {
if (config.wasHideFolderTooltipShown) {
activity.handleLockedFolderOpening(path) {
hideFolder(path)
}
} else {
config.wasHideFolderTooltipShown = true
ConfirmationDialog(activity, activity.getString(R.string.hide_folder_description)) {
activity.handleLockedFolderOpening(path) {
hideFolder(path)
}
}
}
} else {
activity.handleLockedFolderOpening(path) {
activity.removeNoMedia(path) {
if (activity.config.shouldShowHidden) {
updateFolderNames()
@ -233,6 +244,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
}
}
}
}
private fun tryEmptyRecycleBin(askConfirmation: Boolean) {
if (askConfirmation) {