really clear all Favorites at deleting the given folder

This commit is contained in:
tibbi 2020-01-27 15:05:17 +01:00
parent 7b1dfb7318
commit 9d2239d1c1
2 changed files with 4 additions and 0 deletions

View file

@ -555,6 +555,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
tryEmptyRecycleBin(false) tryEmptyRecycleBin(false)
} else { } else {
ensureBackgroundThread { ensureBackgroundThread {
activity.mediaDB.clearFavorites()
activity.favoritesDB.clearFavorites() activity.favoritesDB.clearFavorites()
listener?.refreshItems() listener?.refreshItems()
} }

View file

@ -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 = 0")
fun clearFavorites()
@Query("DELETE FROM media WHERE deleted_ts != 0") @Query("DELETE FROM media WHERE deleted_ts != 0")
fun clearRecycleBin() fun clearRecycleBin()
} }