diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt index b0796a4ad..5e1bc40e8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt @@ -439,7 +439,7 @@ class MediaFetcher(val context: Context) { val filename = cursor.getStringValue(Images.Media.DISPLAY_NAME) val path = cursor.getStringValue(Images.Media.DATA) val lastModified = cursor.getLongValue(Images.Media.DATE_MODIFIED) * 1000 - val dateTaken = cursor.getLongValue(Images.Media.DATE_TAKEN) + var dateTaken = cursor.getLongValue(Images.Media.DATE_TAKEN) val size = cursor.getLongValue(Images.Media.SIZE) val videoDuration = Math.round(cursor.getIntValue(MediaStore.MediaColumns.DURATION) / 1000.toDouble()).toInt() @@ -485,6 +485,10 @@ class MediaFetcher(val context: Context) { else -> TYPE_IMAGES } + if (dateTaken == 0L) { + dateTaken = lastModified + } + val isFavorite = favoritePaths.contains(path) val medium = Medium(null, filename, path, path.getParentPath(), lastModified, dateTaken, size, type, videoDuration, isFavorite, 0L, mediaStoreId)