Glimpse: Add width and height to media
Change-Id: Id953c37950ef647e9f5d56d364eed91328c0d613
This commit is contained in:
parent
5b74dfead9
commit
3d41b82fc7
|
@ -60,6 +60,8 @@ class AlbumsFlow(private val context: Context) : QueryFlow<Album>() {
|
|||
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<Album>() {
|
|||
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<Album>() {
|
|||
mimeType,
|
||||
dateAdded,
|
||||
dateModified,
|
||||
width,
|
||||
height,
|
||||
orientation,
|
||||
)
|
||||
).apply { size += 1 }
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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<Media>, 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,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue