mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2024-12-25 07:51:26 +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) {
|
||||
val mediaToInsert = media.clone() as ArrayList<Medium>
|
||||
Thread {
|
||||
mLatestMediaId = getLatestMediaId()
|
||||
mLatestMediaDateId = getLatestMediaByDateId()
|
||||
if (!isFromCache) {
|
||||
try {
|
||||
galleryDB.MediumDao().insertAll(media)
|
||||
} catch (e: ConcurrentModificationException) {
|
||||
}
|
||||
galleryDB.MediumDao().insertAll(mediaToInsert)
|
||||
}
|
||||
}.start()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user