fix #1122, show full filename at delete confirmation, if deleting 1 item
This commit is contained in:
parent
ea20c282ab
commit
1bc7616821
3 changed files with 25 additions and 5 deletions
|
@ -936,8 +936,16 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun askConfirmDelete() {
|
private fun askConfirmDelete() {
|
||||||
val message = if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) R.string.are_you_sure_recycle_bin else R.string.are_you_sure_delete
|
val filename = "\"${getCurrentPath().getFilenameFromPath()}\""
|
||||||
DeleteWithRememberDialog(this, getString(message)) {
|
|
||||||
|
val baseString = if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) {
|
||||||
|
R.string.move_to_recycle_bin_confirmation
|
||||||
|
} else {
|
||||||
|
R.string.deletion_confirmation
|
||||||
|
}
|
||||||
|
|
||||||
|
val message = String.format(resources.getString(baseString), filename)
|
||||||
|
DeleteWithRememberDialog(this, message) {
|
||||||
config.tempSkipDeleteConfirmation = it
|
config.tempSkipDeleteConfirmation = it
|
||||||
deleteConfirmed()
|
deleteConfirmed()
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,7 +372,12 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
config.skipDeleteConfirmation -> deleteFolders()
|
config.skipDeleteConfirmation -> deleteFolders()
|
||||||
else -> {
|
else -> {
|
||||||
val itemsCnt = selectedKeys.size
|
val itemsCnt = selectedKeys.size
|
||||||
val items = resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)
|
val items = if (itemsCnt == 1) {
|
||||||
|
"\"${getSelectedPaths().first().getFilenameFromPath()}\""
|
||||||
|
} else {
|
||||||
|
resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)
|
||||||
|
}
|
||||||
|
|
||||||
val fileDirItem = getFirstSelectedItem() ?: return
|
val fileDirItem = getFirstSelectedItem() ?: return
|
||||||
val baseString = if (!config.useRecycleBin || (isOneItemSelected() && fileDirItem.isRecycleBin()) || (isOneItemSelected() && fileDirItem.areFavorites())) {
|
val baseString = if (!config.useRecycleBin || (isOneItemSelected() && fileDirItem.isRecycleBin()) || (isOneItemSelected() && fileDirItem.areFavorites())) {
|
||||||
R.string.deletion_confirmation
|
R.string.deletion_confirmation
|
||||||
|
|
|
@ -372,8 +372,15 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun askConfirmDelete() {
|
private fun askConfirmDelete() {
|
||||||
val items = resources.getQuantityString(R.plurals.delete_items, selectedKeys.size, selectedKeys.size)
|
val itemsCnt = selectedKeys.size
|
||||||
val isRecycleBin = getSelectedPaths().first().startsWith(activity.recycleBinPath)
|
val firstPath = getSelectedPaths().first()
|
||||||
|
val items = if (itemsCnt == 1) {
|
||||||
|
"\"${firstPath.getFilenameFromPath()}\""
|
||||||
|
} else {
|
||||||
|
resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)
|
||||||
|
}
|
||||||
|
|
||||||
|
val isRecycleBin = firstPath.startsWith(activity.recycleBinPath)
|
||||||
val baseString = if (config.useRecycleBin && !isRecycleBin) R.string.move_to_recycle_bin_confirmation else R.string.deletion_confirmation
|
val baseString = if (config.useRecycleBin && !isRecycleBin) R.string.move_to_recycle_bin_confirmation else R.string.deletion_confirmation
|
||||||
val question = String.format(resources.getString(baseString), items)
|
val question = String.format(resources.getString(baseString), items)
|
||||||
DeleteWithRememberDialog(activity, question) {
|
DeleteWithRememberDialog(activity, question) {
|
||||||
|
|
Loading…
Reference in a new issue