mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2024-12-26 00:05:18 +01:00
fix media inserting ConcurrentModificationException in a proper way
This commit is contained in:
parent
3aaa17a02d
commit
4f724786b2
@ -633,14 +633,12 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun gotMedia(media: ArrayList<Medium>, isFromCache: Boolean = false) {
|
private fun gotMedia(media: ArrayList<Medium>, isFromCache: Boolean = false) {
|
||||||
|
val mediaToInsert = media.clone() as ArrayList<Medium>
|
||||||
Thread {
|
Thread {
|
||||||
mLatestMediaId = getLatestMediaId()
|
mLatestMediaId = getLatestMediaId()
|
||||||
mLatestMediaDateId = getLatestMediaByDateId()
|
mLatestMediaDateId = getLatestMediaByDateId()
|
||||||
if (!isFromCache) {
|
if (!isFromCache) {
|
||||||
try {
|
galleryDB.MediumDao().insertAll(mediaToInsert)
|
||||||
galleryDB.MediumDao().insertAll(media)
|
|
||||||
} catch (e: ConcurrentModificationException) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}.start()
|
}.start()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user