update stored folder items after deleting

This commit is contained in:
tibbi 2018-03-15 21:59:35 +01:00
parent 7ebc110ac8
commit 0552c12d17

View file

@ -235,6 +235,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
media.removeAll(removeMedia) media.removeAll(removeMedia)
listener?.deleteFiles(fileDirItems) listener?.deleteFiles(fileDirItems)
removeSelectedItems() removeSelectedItems()
updateStoredFolderItems()
} }
} }
@ -244,6 +245,14 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
return selectedMedia return selectedMedia
} }
private fun updateStoredFolderItems() {
Thread {
if (media.isNotEmpty()) {
activity.applicationContext.storeFolderItems(media.first().path.getParentPath(), media as ArrayList<Medium>)
}
}.start()
}
fun updateMedia(newMedia: ArrayList<Medium>) { fun updateMedia(newMedia: ArrayList<Medium>) {
if (newMedia.hashCode() != currentMediaHash) { if (newMedia.hashCode() != currentMediaHash) {
currentMediaHash = newMedia.hashCode() currentMediaHash = newMedia.hashCode()