diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 0aad35229..c3b7b039f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -14,6 +14,7 @@ import android.view.View import android.webkit.MimeTypeMap import android.widget.RelativeLayout import com.simplemobiletools.filepicker.asynctasks.CopyMoveTask +import com.simplemobiletools.filepicker.dialogs.ConfirmationDialog import com.simplemobiletools.filepicker.extensions.* import com.simplemobiletools.fileproperties.dialogs.PropertiesDialog import com.simplemobiletools.gallery.Constants @@ -145,7 +146,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View true } R.id.menu_delete -> { - notifyDeletion() + askConfirmDelete() true } R.id.menu_rename -> { @@ -257,6 +258,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View Utils.shareMedium(getCurrentMedium(), this) } + private fun askConfirmDelete() { + ConfirmationDialog(this, listener = object : ConfirmationDialog.OnConfirmedListener { + override fun onConfirmed() { + notifyDeletion() + } + }) + } + private fun notifyDeletion() { if (isShowingPermDialog(File(mPath))) return diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 757752d8a..41149c769 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -11,6 +11,7 @@ import com.bumptech.glide.Glide import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.signature.StringSignature import com.simplemobiletools.filepicker.asynctasks.CopyMoveTask +import com.simplemobiletools.filepicker.dialogs.ConfirmationDialog import com.simplemobiletools.filepicker.extensions.isAStorageRootFolder import com.simplemobiletools.filepicker.extensions.scanPaths import com.simplemobiletools.filepicker.extensions.toast @@ -70,8 +71,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList { - prepareForDeleting() - mode.finish() + askConfirmDelete() true } else -> false @@ -175,6 +175,15 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList()