add a confirmation dialog before deleting from folders page and viewpager
This commit is contained in:
parent
701a4c2641
commit
4b5063a1b0
|
@ -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
|
||||
|
|
|
@ -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<Direc
|
|||
true
|
||||
}
|
||||
R.id.cab_delete -> {
|
||||
prepareForDeleting()
|
||||
mode.finish()
|
||||
askConfirmDelete()
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
|
@ -175,6 +175,15 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
})
|
||||
}
|
||||
|
||||
private fun askConfirmDelete() {
|
||||
ConfirmationDialog(activity, listener = object : ConfirmationDialog.OnConfirmedListener {
|
||||
override fun onConfirmed() {
|
||||
actMode?.finish()
|
||||
prepareForDeleting()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun prepareForDeleting() {
|
||||
val selections = multiSelector.selectedPositions
|
||||
val paths = ArrayList<String>()
|
||||
|
|
Loading…
Reference in New Issue