Skip to content

Commit bcb927f

Browse files
committed
use the more advanced file renaming if only files are selected
1 parent eabe129 commit bcb927f

File tree

1 file changed

+15
-7
lines changed
  • app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters

1 file changed

+15
-7
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,26 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
178178
}
179179

180180
private fun displayRenameDialog() {
181-
val paths = getSelectedFileDirItems().asSequence().map { it.path }.toMutableList() as ArrayList<String>
182-
if (paths.size == 1) {
183-
val oldPath = paths.first()
184-
RenameItemDialog(activity, oldPath) {
185-
activity.config.moveFavorite(oldPath, it)
181+
val fileDirItems = getSelectedFileDirItems()
182+
val paths = fileDirItems.asSequence().map { it.path }.toMutableList() as ArrayList<String>
183+
when {
184+
paths.size == 1 -> {
185+
val oldPath = paths.first()
186+
RenameItemDialog(activity, oldPath) {
187+
activity.config.moveFavorite(oldPath, it)
188+
activity.runOnUiThread {
189+
listener?.refreshItems()
190+
finishActMode()
191+
}
192+
}
193+
}
194+
fileDirItems.any { it.isDirectory } -> RenameItemsDialog(activity, paths) {
186195
activity.runOnUiThread {
187196
listener?.refreshItems()
188197
finishActMode()
189198
}
190199
}
191-
} else {
192-
RenameItemsDialog(activity, paths) {
200+
else -> RenameItemsPatternDialog(activity, paths) {
193201
activity.runOnUiThread {
194202
listener?.refreshItems()
195203
finishActMode()

0 commit comments

Comments
 (0)