fixed some glitches with favorites un/marking
This commit is contained in:
parent
50e6b98d09
commit
811d5e88c5
2 changed files with 10 additions and 2 deletions
|
@ -611,8 +611,13 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
val newMedia = it
|
val newMedia = it
|
||||||
try {
|
try {
|
||||||
gotMedia(newMedia, false)
|
gotMedia(newMedia, false)
|
||||||
oldMedia.filter { !newMedia.contains(it) }.mapNotNull { it as? Medium }.filter { !getDoesFilePathExist(it.path) }.forEach {
|
oldMedia.filter { !newMedia.contains(it) }.mapNotNull { it as? Medium }.forEach {
|
||||||
|
if (!getDoesFilePathExist(it.path)) {
|
||||||
mediaDB.deleteMediumPath(it.path)
|
mediaDB.deleteMediumPath(it.path)
|
||||||
|
} else if (mPath == FAVORITES) {
|
||||||
|
favoritesDB.deleteFavoritePath(it.path)
|
||||||
|
mediaDB.updateFavorite(it.path, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,9 @@ interface MediumDao {
|
||||||
@Query("UPDATE media SET date_taken = :dateTaken WHERE full_path = :path COLLATE NOCASE")
|
@Query("UPDATE media SET date_taken = :dateTaken WHERE full_path = :path COLLATE NOCASE")
|
||||||
fun updateFavoriteDateTaken(path: String, dateTaken: Long)
|
fun updateFavoriteDateTaken(path: String, dateTaken: Long)
|
||||||
|
|
||||||
|
@Query("UPDATE media SET is_favorite = :isFavorite WHERE full_path = :path COLLATE NOCASE")
|
||||||
|
fun updateFavorite(path: String, isFavorite: Boolean)
|
||||||
|
|
||||||
@Query("UPDATE media SET is_favorite = 0")
|
@Query("UPDATE media SET is_favorite = 0")
|
||||||
fun clearFavorites()
|
fun clearFavorites()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue