check lollipop sd permissions at deleting asap
This commit is contained in:
parent
3a0dbd9d57
commit
099e13ea0c
2 changed files with 22 additions and 0 deletions
|
@ -240,6 +240,16 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
||||||
val paths = ArrayList<String>(selections.size)
|
val paths = ArrayList<String>(selections.size)
|
||||||
val removeDirs = ArrayList<Directory>(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.reverse()
|
||||||
selections.forEach {
|
selections.forEach {
|
||||||
val directory = dirs[it]
|
val directory = dirs[it]
|
||||||
|
@ -249,6 +259,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
||||||
}
|
}
|
||||||
|
|
||||||
dirs.removeAll(removeDirs)
|
dirs.removeAll(removeDirs)
|
||||||
|
markedItems.clear()
|
||||||
listener?.deleteFiles(paths)
|
listener?.deleteFiles(paths)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,16 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
val files = ArrayList<File>(selections.size)
|
val files = ArrayList<File>(selections.size)
|
||||||
val removeMedia = ArrayList<Medium>(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.reverse()
|
||||||
selections.forEach {
|
selections.forEach {
|
||||||
val medium = media[it]
|
val medium = media[it]
|
||||||
|
@ -190,6 +200,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
}
|
}
|
||||||
|
|
||||||
media.removeAll(removeMedia)
|
media.removeAll(removeMedia)
|
||||||
|
markedItems.clear()
|
||||||
listener?.deleteFiles(files)
|
listener?.deleteFiles(files)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue