adding an initial implementation of batch renaming, multiple items at once
This commit is contained in:
parent
6bce8b7c25
commit
fc47d41c40
|
@ -58,7 +58,6 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
||||||
|
|
||||||
override fun prepareActionMode(menu: Menu) {
|
override fun prepareActionMode(menu: Menu) {
|
||||||
menu.apply {
|
menu.apply {
|
||||||
findItem(R.id.cab_rename).isVisible = isOneItemSelected()
|
|
||||||
findItem(R.id.cab_decompress).isVisible = getSelectedFileDirItems().map { it.path }.any { it.isZipFile() }
|
findItem(R.id.cab_decompress).isVisible = getSelectedFileDirItems().map { it.path }.any { it.isZipFile() }
|
||||||
findItem(R.id.cab_confirm_selection).isVisible = isPickMultipleIntent
|
findItem(R.id.cab_confirm_selection).isVisible = isPickMultipleIntent
|
||||||
findItem(R.id.cab_copy_path).isVisible = isOneItemSelected()
|
findItem(R.id.cab_copy_path).isVisible = isOneItemSelected()
|
||||||
|
@ -153,12 +152,22 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayRenameDialog() {
|
private fun displayRenameDialog() {
|
||||||
val oldPath = getFirstSelectedItemPath()
|
val paths = getSelectedFileDirItems().asSequence().map { it.path }.toMutableList() as ArrayList<String>
|
||||||
RenameItemDialog(activity, oldPath) {
|
if (paths.size == 1) {
|
||||||
activity.config.moveFavorite(oldPath, it)
|
val oldPath = paths.first()
|
||||||
activity.runOnUiThread {
|
RenameItemDialog(activity, oldPath) {
|
||||||
listener?.refreshItems()
|
activity.config.moveFavorite(oldPath, it)
|
||||||
finishActMode()
|
activity.runOnUiThread {
|
||||||
|
listener?.refreshItems()
|
||||||
|
finishActMode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
RenameItemsDialog(activity, paths) {
|
||||||
|
activity.runOnUiThread {
|
||||||
|
listener?.refreshItems()
|
||||||
|
finishActMode()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue