check lollipop sd permissions at deleting asap

This commit is contained in:
tibbi 2017-02-09 21:38:07 +01:00
parent 3a0dbd9d57
commit 099e13ea0c
2 changed files with 22 additions and 0 deletions

View file

@ -240,6 +240,16 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
val paths = ArrayList<String>(selections.size)
val removeDirs = ArrayList<Directory>(selections.size)
var isShowingPermDialog = false
activity.runOnUiThread {
if (activity.isShowingPermDialog(File(dirs[selections[0]].path))) {
isShowingPermDialog = true
}
}
if (isShowingPermDialog)
return
selections.reverse()
selections.forEach {
val directory = dirs[it]
@ -249,6 +259,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
}
dirs.removeAll(removeDirs)
markedItems.clear()
listener?.deleteFiles(paths)
}

View file

@ -181,6 +181,16 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
val files = ArrayList<File>(selections.size)
val removeMedia = ArrayList<Medium>(selections.size)
var isShowingPermDialog = false
activity.runOnUiThread {
if (activity.isShowingPermDialog(File(media[selections[0]].path))) {
isShowingPermDialog = true
}
}
if (isShowingPermDialog)
return
selections.reverse()
selections.forEach {
val medium = media[it]
@ -190,6 +200,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
}
media.removeAll(removeMedia)
markedItems.clear()
listener?.deleteFiles(files)
}