use the more advanced file renaming if only files are selected

This commit is contained in:
tibbi 2019-06-14 14:50:54 +02:00
parent eabe129edf
commit bcb927febb

View file

@ -178,18 +178,26 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
} }
private fun displayRenameDialog() { private fun displayRenameDialog() {
val paths = getSelectedFileDirItems().asSequence().map { it.path }.toMutableList() as ArrayList<String> val fileDirItems = getSelectedFileDirItems()
if (paths.size == 1) { val paths = fileDirItems.asSequence().map { it.path }.toMutableList() as ArrayList<String>
val oldPath = paths.first() when {
RenameItemDialog(activity, oldPath) { paths.size == 1 -> {
activity.config.moveFavorite(oldPath, it) val oldPath = paths.first()
RenameItemDialog(activity, oldPath) {
activity.config.moveFavorite(oldPath, it)
activity.runOnUiThread {
listener?.refreshItems()
finishActMode()
}
}
}
fileDirItems.any { it.isDirectory } -> RenameItemsDialog(activity, paths) {
activity.runOnUiThread { activity.runOnUiThread {
listener?.refreshItems() listener?.refreshItems()
finishActMode() finishActMode()
} }
} }
} else { else -> RenameItemsPatternDialog(activity, paths) {
RenameItemsDialog(activity, paths) {
activity.runOnUiThread { activity.runOnUiThread {
listener?.refreshItems() listener?.refreshItems()
finishActMode() finishActMode()