fix #913, at fixing the Date Taken value update it at Favorite items too

This commit is contained in:
tibbi 2018-08-14 09:10:21 +02:00
parent f01410bb1e
commit 0ced7023f1
2 changed files with 6 additions and 0 deletions

View file

@ -292,6 +292,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
Thread { Thread {
try { try {
val operations = ArrayList<ContentProviderOperation>() val operations = ArrayList<ContentProviderOperation>()
val mediumDao = activity.galleryDB.MediumDao()
val paths = getSelectedPaths() val paths = getSelectedPaths()
for (path in paths) { for (path in paths) {
val dateTime = ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME) ?: continue val dateTime = ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME) ?: continue
@ -312,6 +313,8 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
activity.contentResolver.applyBatch(MediaStore.AUTHORITY, operations) activity.contentResolver.applyBatch(MediaStore.AUTHORITY, operations)
operations.clear() operations.clear()
} }
mediumDao.updateFavoriteDateTaken(path, timestamp)
} }
activity.contentResolver.applyBatch(MediaStore.AUTHORITY, operations) activity.contentResolver.applyBatch(MediaStore.AUTHORITY, operations)

View file

@ -38,6 +38,9 @@ interface MediumDao {
@Query("UPDATE media SET deleted_ts = :deletedTS WHERE full_path = :path COLLATE NOCASE") @Query("UPDATE media SET deleted_ts = :deletedTS WHERE full_path = :path COLLATE NOCASE")
fun updateDeleted(path: String, deletedTS: Long) fun updateDeleted(path: String, deletedTS: Long)
@Query("UPDATE media SET date_taken = :dateTaken WHERE full_path = :path COLLATE NOCASE")
fun updateFavoriteDateTaken(path: String, dateTaken: Long)
@Query("DELETE FROM media WHERE deleted_ts != 0") @Query("DELETE FROM media WHERE deleted_ts != 0")
fun clearRecycleBin() fun clearRecycleBin()