show how many items are going to be deleted on the confirmation dialog
This commit is contained in:
parent
e67517dd4c
commit
ce3ce0bec0
|
@ -46,7 +46,7 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:3.18.17'
|
implementation 'com.simplemobiletools:commons:3.18.21'
|
||||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
|
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
|
||||||
implementation 'com.android.support:multidex:1.0.3'
|
implementation 'com.android.support:multidex:1.0.3'
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
|
|
|
@ -728,7 +728,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun askConfirmDelete() {
|
private fun askConfirmDelete() {
|
||||||
DeleteWithRememberDialog(this) {
|
DeleteWithRememberDialog(this, getString(R.string.proceed_with_deletion)) {
|
||||||
mSkipConfirmationDialog = it
|
mSkipConfirmationDialog = it
|
||||||
deleteConfirmed()
|
deleteConfirmed()
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,7 +301,9 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
if (config.skipDeleteConfirmation) {
|
if (config.skipDeleteConfirmation) {
|
||||||
deleteFiles()
|
deleteFiles()
|
||||||
} else {
|
} else {
|
||||||
ConfirmationDialog(activity) {
|
val items = resources.getQuantityString(R.plurals.delete_items, selectedPositions.size, selectedPositions.size)
|
||||||
|
val question = String.format(resources.getString(R.string.deletion_confirmation), items)
|
||||||
|
ConfirmationDialog(activity, question) {
|
||||||
deleteFiles()
|
deleteFiles()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,9 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun askConfirmDelete() {
|
private fun askConfirmDelete() {
|
||||||
DeleteWithRememberDialog(activity) {
|
val items = resources.getQuantityString(R.plurals.delete_items, selectedPositions.size, selectedPositions.size)
|
||||||
|
val question = String.format(resources.getString(R.string.deletion_confirmation), items)
|
||||||
|
DeleteWithRememberDialog(activity, question) {
|
||||||
skipConfirmationDialog = it
|
skipConfirmationDialog = it
|
||||||
deleteFiles()
|
deleteFiles()
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,12 @@ import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
import com.simplemobiletools.gallery.R
|
import com.simplemobiletools.gallery.R
|
||||||
import kotlinx.android.synthetic.main.dialog_delete_with_remember.view.*
|
import kotlinx.android.synthetic.main.dialog_delete_with_remember.view.*
|
||||||
|
|
||||||
class DeleteWithRememberDialog(val activity: Activity, val callback: (remember: Boolean) -> Unit) {
|
class DeleteWithRememberDialog(val activity: Activity, val message: String, val callback: (remember: Boolean) -> Unit) {
|
||||||
private var dialog: AlertDialog
|
private var dialog: AlertDialog
|
||||||
val view = activity.layoutInflater.inflate(R.layout.dialog_delete_with_remember, null)!!
|
val view = activity.layoutInflater.inflate(R.layout.dialog_delete_with_remember, null)!!
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
view.delete_remember_title.text = message
|
||||||
val builder = AlertDialog.Builder(activity)
|
val builder = AlertDialog.Builder(activity)
|
||||||
.setPositiveButton(R.string.yes, { dialog, which -> dialogConfirmed() })
|
.setPositiveButton(R.string.yes, { dialog, which -> dialogConfirmed() })
|
||||||
.setNegativeButton(R.string.no, null)
|
.setNegativeButton(R.string.no, null)
|
||||||
|
|
Loading…
Reference in New Issue