diff --git a/app/src/main/java/org/lineageos/glimpse/flow/AlbumsFlow.kt b/app/src/main/java/org/lineageos/glimpse/flow/AlbumsFlow.kt index 073b4af..6ba0cab 100644 --- a/app/src/main/java/org/lineageos/glimpse/flow/AlbumsFlow.kt +++ b/app/src/main/java/org/lineageos/glimpse/flow/AlbumsFlow.kt @@ -60,6 +60,8 @@ class AlbumsFlow(private val context: Context) : QueryFlow() { val dateAddedIndex = it.getColumnIndex(MediaStore.Files.FileColumns.DATE_ADDED) val dateModifiedIndex = it.getColumnIndex(MediaStore.Files.FileColumns.DATE_MODIFIED) + val widthIndex = it.getColumnIndex(MediaStore.Files.FileColumns.WIDTH) + val heightIndex = it.getColumnIndex(MediaStore.Files.FileColumns.HEIGHT) val orientationIndex = it.getColumnIndex(MediaStore.Files.FileColumns.ORIENTATION) val bucketDisplayNameIndex = @@ -94,6 +96,8 @@ class AlbumsFlow(private val context: Context) : QueryFlow() { val mimeType = it.getString(mimeTypeIndex) val dateAdded = it.getLong(dateAddedIndex) val dateModified = it.getLong(dateModifiedIndex) + val width = it.getInt(widthIndex) + val height = it.getInt(heightIndex) val orientation = it.getInt(orientationIndex) val bucketDisplayName = it.getString(bucketDisplayNameIndex) @@ -120,6 +124,8 @@ class AlbumsFlow(private val context: Context) : QueryFlow() { mimeType, dateAdded, dateModified, + width, + height, orientation, ) ).apply { size += 1 } diff --git a/app/src/main/java/org/lineageos/glimpse/flow/MediaFlow.kt b/app/src/main/java/org/lineageos/glimpse/flow/MediaFlow.kt index b5dc727..c8c7c70 100644 --- a/app/src/main/java/org/lineageos/glimpse/flow/MediaFlow.kt +++ b/app/src/main/java/org/lineageos/glimpse/flow/MediaFlow.kt @@ -77,6 +77,8 @@ class MediaFlow(private val context: Context, private val bucketId: Int?) : Quer val mimeTypeIndex = it.getColumnIndex(MediaStore.Files.FileColumns.MIME_TYPE) val dateAddedIndex = it.getColumnIndex(MediaStore.Files.FileColumns.DATE_ADDED) val dateModifiedIndex = it.getColumnIndex(MediaStore.Files.FileColumns.DATE_MODIFIED) + val widthIndex = it.getColumnIndex(MediaStore.Files.FileColumns.WIDTH) + val heightIndex = it.getColumnIndex(MediaStore.Files.FileColumns.HEIGHT) val orientationIndex = it.getColumnIndex(MediaStore.Files.FileColumns.ORIENTATION) val id = it.getLong(idIndex) @@ -88,6 +90,8 @@ class MediaFlow(private val context: Context, private val bucketId: Int?) : Quer val mimeType = it.getString(mimeTypeIndex) val dateAdded = it.getLong(dateAddedIndex) val dateModified = it.getLong(dateModifiedIndex) + val width = it.getInt(widthIndex) + val height = it.getInt(heightIndex) val orientation = it.getInt(orientationIndex) Media.fromMediaStore( @@ -100,6 +104,8 @@ class MediaFlow(private val context: Context, private val bucketId: Int?) : Quer mimeType, dateAdded, dateModified, + width, + height, orientation, ) } diff --git a/app/src/main/java/org/lineageos/glimpse/models/Media.kt b/app/src/main/java/org/lineageos/glimpse/models/Media.kt index f31022c..bb888b4 100644 --- a/app/src/main/java/org/lineageos/glimpse/models/Media.kt +++ b/app/src/main/java/org/lineageos/glimpse/models/Media.kt @@ -21,6 +21,8 @@ data class Media( val mimeType: String, val dateAdded: Date, val dateModified: Date, + val width: Int, + val height: Int, val orientation: Int, ) : Comparable, Parcelable { val externalContentUri = ContentUris.withAppendedId(mediaType.externalContentUri, id) @@ -40,6 +42,8 @@ data class Media( Date(parcel.readLong()), Date(parcel.readLong()), parcel.readInt(), + parcel.readInt(), + parcel.readInt(), ) override fun equals(other: Any?): Boolean { @@ -59,6 +63,8 @@ data class Media( { it.mimeType }, { it.dateAdded }, { it.dateModified }, + { it.width }, + { it.height }, { it.orientation }, ) @@ -74,6 +80,8 @@ data class Media( dest.writeString(mimeType) dest.writeLong(dateAdded.time) dest.writeLong(dateModified.time) + dest.writeInt(width) + dest.writeInt(height) dest.writeInt(orientation) } @@ -92,6 +100,8 @@ data class Media( mimeType: String, dateAdded: Long, dateModified: Long, + width: Int, + height: Int, orientation: Int, ) = Media( id, @@ -103,6 +113,8 @@ data class Media( mimeType, Date(dateAdded * 1000), Date(dateModified * 1000), + width, + height, orientation, ) } diff --git a/app/src/main/java/org/lineageos/glimpse/query/MediaQuery.kt b/app/src/main/java/org/lineageos/glimpse/query/MediaQuery.kt index 9427d3d..d7920cb 100644 --- a/app/src/main/java/org/lineageos/glimpse/query/MediaQuery.kt +++ b/app/src/main/java/org/lineageos/glimpse/query/MediaQuery.kt @@ -20,6 +20,8 @@ object MediaQuery { MediaStore.Files.FileColumns.MIME_TYPE, MediaStore.Files.FileColumns.DATE_ADDED, MediaStore.Files.FileColumns.DATE_MODIFIED, + MediaStore.Files.FileColumns.WIDTH, + MediaStore.Files.FileColumns.HEIGHT, MediaStore.Files.FileColumns.ORIENTATION, ) val AlbumsProjection = arrayOf(