From 0552c12d177cef87da5c2973eefc41c5cf3bf692 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Mar 2018 21:59:35 +0100 Subject: [PATCH] update stored folder items after deleting --- .../simplemobiletools/gallery/adapters/MediaAdapter.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index b5c043d9c..6e0c190e6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -235,6 +235,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, media.removeAll(removeMedia) listener?.deleteFiles(fileDirItems) removeSelectedItems() + updateStoredFolderItems() } } @@ -244,6 +245,14 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, return selectedMedia } + private fun updateStoredFolderItems() { + Thread { + if (media.isNotEmpty()) { + activity.applicationContext.storeFolderItems(media.first().path.getParentPath(), media as ArrayList) + } + }.start() + } + fun updateMedia(newMedia: ArrayList) { if (newMedia.hashCode() != currentMediaHash) { currentMediaHash = newMedia.hashCode()