avoid reseting favorite items in one more case
This commit is contained in:
parent
08ee4c60ef
commit
6f6449c2b7
1 changed files with 6 additions and 3 deletions
|
@ -325,7 +325,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
|
|
||||||
if (intent.action == "com.android.camera.action.REVIEW") {
|
if (intent.action == "com.android.camera.action.REVIEW") {
|
||||||
Thread {
|
Thread {
|
||||||
if (galleryDB.MediumDao().getMediaFromPath(mPath).isEmpty()) {
|
val mediumDao = galleryDB.MediumDao()
|
||||||
|
if (mediumDao.getMediaFromPath(mPath).isEmpty()) {
|
||||||
val type = when {
|
val type = when {
|
||||||
mPath.isVideoFast() -> TYPE_VIDEOS
|
mPath.isVideoFast() -> TYPE_VIDEOS
|
||||||
mPath.isGif() -> TYPE_GIFS
|
mPath.isGif() -> TYPE_GIFS
|
||||||
|
@ -334,9 +335,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
else -> TYPE_IMAGES
|
else -> TYPE_IMAGES
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val isFavorite = mediumDao.isFavorite(mPath)
|
||||||
val duration = if (type == TYPE_VIDEOS) mPath.getVideoDuration() else 0
|
val duration = if (type == TYPE_VIDEOS) mPath.getVideoDuration() else 0
|
||||||
val medium = Medium(null, mPath.getFilenameFromPath(), mPath, mPath.getParentPath(), System.currentTimeMillis(), System.currentTimeMillis(), File(mPath).length(), type, duration, false, 0)
|
val ts = System.currentTimeMillis()
|
||||||
galleryDB.MediumDao().insert(medium)
|
val medium = Medium(null, mPath.getFilenameFromPath(), mPath, mPath.getParentPath(), ts, ts, File(mPath).length(), type, duration, isFavorite, 0)
|
||||||
|
mediumDao.insert(medium)
|
||||||
}
|
}
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue