fixing a couple crashes
This commit is contained in:
parent
ee4b92a2c5
commit
3aaa17a02d
1 changed files with 8 additions and 2 deletions
|
@ -42,6 +42,7 @@ import com.simplemobiletools.gallery.models.Medium
|
||||||
import kotlinx.android.synthetic.main.activity_media.*
|
import kotlinx.android.synthetic.main.activity_media.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
private val LAST_MEDIA_CHECK_PERIOD = 3000L
|
private val LAST_MEDIA_CHECK_PERIOD = 3000L
|
||||||
|
@ -458,7 +459,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
if (!mLoadedInitialPhotos) {
|
if (!mLoadedInitialPhotos) {
|
||||||
getCachedMedia(mPath, mIsGetVideoIntent, mIsGetImageIntent) {
|
getCachedMedia(mPath, mIsGetVideoIntent, mIsGetImageIntent) {
|
||||||
if (it.isEmpty()) {
|
if (it.isEmpty()) {
|
||||||
media_refresh_layout.isRefreshing = true
|
runOnUiThread {
|
||||||
|
media_refresh_layout.isRefreshing = true
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
gotMedia(it, true)
|
gotMedia(it, true)
|
||||||
}
|
}
|
||||||
|
@ -634,7 +637,10 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
mLatestMediaId = getLatestMediaId()
|
mLatestMediaId = getLatestMediaId()
|
||||||
mLatestMediaDateId = getLatestMediaByDateId()
|
mLatestMediaDateId = getLatestMediaByDateId()
|
||||||
if (!isFromCache) {
|
if (!isFromCache) {
|
||||||
galleryDB.MediumDao().insertAll(media)
|
try {
|
||||||
|
galleryDB.MediumDao().insertAll(media)
|
||||||
|
} catch (e: ConcurrentModificationException) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.start()
|
}.start()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue