Adding the orientation parameter of images and videos to the library in android
This commit is contained in:
parent
d2af8d254b
commit
fa6414da13
@ -58,6 +58,7 @@ class PhotoGalleryPlugin : FlutterPlugin, MethodCallHandler {
|
|||||||
MediaStore.Images.Media._ID,
|
MediaStore.Images.Media._ID,
|
||||||
MediaStore.Images.Media.WIDTH,
|
MediaStore.Images.Media.WIDTH,
|
||||||
MediaStore.Images.Media.HEIGHT,
|
MediaStore.Images.Media.HEIGHT,
|
||||||
|
MediaStore.Images.Media.ORIENTATION,
|
||||||
MediaStore.Images.Media.MIME_TYPE,
|
MediaStore.Images.Media.MIME_TYPE,
|
||||||
MediaStore.Images.Media.DATE_TAKEN,
|
MediaStore.Images.Media.DATE_TAKEN,
|
||||||
MediaStore.Images.Media.DATE_MODIFIED
|
MediaStore.Images.Media.DATE_MODIFIED
|
||||||
@ -67,6 +68,7 @@ class PhotoGalleryPlugin : FlutterPlugin, MethodCallHandler {
|
|||||||
MediaStore.Video.Media._ID,
|
MediaStore.Video.Media._ID,
|
||||||
MediaStore.Video.Media.WIDTH,
|
MediaStore.Video.Media.WIDTH,
|
||||||
MediaStore.Video.Media.HEIGHT,
|
MediaStore.Video.Media.HEIGHT,
|
||||||
|
MediaStore.Images.Media.ORIENTATION,
|
||||||
MediaStore.Video.Media.MIME_TYPE,
|
MediaStore.Video.Media.MIME_TYPE,
|
||||||
MediaStore.Video.Media.DURATION,
|
MediaStore.Video.Media.DURATION,
|
||||||
MediaStore.Video.Media.DATE_TAKEN,
|
MediaStore.Video.Media.DATE_TAKEN,
|
||||||
@ -790,6 +792,7 @@ class PhotoGalleryPlugin : FlutterPlugin, MethodCallHandler {
|
|||||||
val idColumn = cursor.getColumnIndex(MediaStore.Images.Media._ID)
|
val idColumn = cursor.getColumnIndex(MediaStore.Images.Media._ID)
|
||||||
val widthColumn = cursor.getColumnIndex(MediaStore.Images.Media.WIDTH)
|
val widthColumn = cursor.getColumnIndex(MediaStore.Images.Media.WIDTH)
|
||||||
val heightColumn = cursor.getColumnIndex(MediaStore.Images.Media.HEIGHT)
|
val heightColumn = cursor.getColumnIndex(MediaStore.Images.Media.HEIGHT)
|
||||||
|
val orientationColumn = cursor.getColumnIndex(MediaStore.Images.Media.ORIENTATION)
|
||||||
val mimeColumn = cursor.getColumnIndex(MediaStore.Images.Media.MIME_TYPE)
|
val mimeColumn = cursor.getColumnIndex(MediaStore.Images.Media.MIME_TYPE)
|
||||||
val dateTakenColumn = cursor.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN)
|
val dateTakenColumn = cursor.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN)
|
||||||
val dateModifiedColumn = cursor.getColumnIndex(MediaStore.Images.Media.DATE_MODIFIED)
|
val dateModifiedColumn = cursor.getColumnIndex(MediaStore.Images.Media.DATE_MODIFIED)
|
||||||
@ -797,6 +800,7 @@ class PhotoGalleryPlugin : FlutterPlugin, MethodCallHandler {
|
|||||||
val id = cursor.getLong(idColumn)
|
val id = cursor.getLong(idColumn)
|
||||||
val width = cursor.getLong(widthColumn)
|
val width = cursor.getLong(widthColumn)
|
||||||
val height = cursor.getLong(heightColumn)
|
val height = cursor.getLong(heightColumn)
|
||||||
|
val orientation = cursor.getLong(orientationColumn)
|
||||||
val mimeType = cursor.getString(mimeColumn)
|
val mimeType = cursor.getString(mimeColumn)
|
||||||
var dateTaken: Long? = null
|
var dateTaken: Long? = null
|
||||||
if (cursor.getType(dateTakenColumn) == FIELD_TYPE_INTEGER) {
|
if (cursor.getType(dateTakenColumn) == FIELD_TYPE_INTEGER) {
|
||||||
@ -812,6 +816,7 @@ class PhotoGalleryPlugin : FlutterPlugin, MethodCallHandler {
|
|||||||
"mediumType" to imageType,
|
"mediumType" to imageType,
|
||||||
"width" to width,
|
"width" to width,
|
||||||
"height" to height,
|
"height" to height,
|
||||||
|
"orientation" to orientation,
|
||||||
"mimeType" to mimeType,
|
"mimeType" to mimeType,
|
||||||
"creationDate" to dateTaken,
|
"creationDate" to dateTaken,
|
||||||
"modifiedDate" to dateModified
|
"modifiedDate" to dateModified
|
||||||
@ -822,6 +827,7 @@ class PhotoGalleryPlugin : FlutterPlugin, MethodCallHandler {
|
|||||||
val idColumn = cursor.getColumnIndex(MediaStore.Video.Media._ID)
|
val idColumn = cursor.getColumnIndex(MediaStore.Video.Media._ID)
|
||||||
val widthColumn = cursor.getColumnIndex(MediaStore.Video.Media.WIDTH)
|
val widthColumn = cursor.getColumnIndex(MediaStore.Video.Media.WIDTH)
|
||||||
val heightColumn = cursor.getColumnIndex(MediaStore.Video.Media.HEIGHT)
|
val heightColumn = cursor.getColumnIndex(MediaStore.Video.Media.HEIGHT)
|
||||||
|
val orientationColumn = cursor.getColumnIndex(MediaStore.Images.Media.ORIENTATION)
|
||||||
val mimeColumn = cursor.getColumnIndex(MediaStore.Video.Media.MIME_TYPE)
|
val mimeColumn = cursor.getColumnIndex(MediaStore.Video.Media.MIME_TYPE)
|
||||||
val durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION)
|
val durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION)
|
||||||
val dateTakenColumn = cursor.getColumnIndex(MediaStore.Video.Media.DATE_TAKEN)
|
val dateTakenColumn = cursor.getColumnIndex(MediaStore.Video.Media.DATE_TAKEN)
|
||||||
@ -830,6 +836,7 @@ class PhotoGalleryPlugin : FlutterPlugin, MethodCallHandler {
|
|||||||
val id = cursor.getLong(idColumn)
|
val id = cursor.getLong(idColumn)
|
||||||
val width = cursor.getLong(widthColumn)
|
val width = cursor.getLong(widthColumn)
|
||||||
val height = cursor.getLong(heightColumn)
|
val height = cursor.getLong(heightColumn)
|
||||||
|
val orientation = cursor.getLong(orientationColumn)
|
||||||
val mimeType = cursor.getString(mimeColumn)
|
val mimeType = cursor.getString(mimeColumn)
|
||||||
val duration = cursor.getLong(durationColumn)
|
val duration = cursor.getLong(durationColumn)
|
||||||
var dateTaken: Long? = null
|
var dateTaken: Long? = null
|
||||||
@ -845,6 +852,7 @@ class PhotoGalleryPlugin : FlutterPlugin, MethodCallHandler {
|
|||||||
"id" to id.toString(),
|
"id" to id.toString(),
|
||||||
"mediumType" to videoType,
|
"mediumType" to videoType,
|
||||||
"width" to width,
|
"width" to width,
|
||||||
|
"orientation" to orientation,
|
||||||
"height" to height,
|
"height" to height,
|
||||||
"mimeType" to mimeType,
|
"mimeType" to mimeType,
|
||||||
"duration" to duration,
|
"duration" to duration,
|
||||||
|
@ -17,6 +17,9 @@ class Medium {
|
|||||||
/// The medium height.
|
/// The medium height.
|
||||||
final int? height;
|
final int? height;
|
||||||
|
|
||||||
|
/// The medium orientation.
|
||||||
|
final int? orientation;
|
||||||
|
|
||||||
/// The medium mimeType.
|
/// The medium mimeType.
|
||||||
final String? mimeType;
|
final String? mimeType;
|
||||||
|
|
||||||
@ -34,6 +37,7 @@ class Medium {
|
|||||||
this.mediumType,
|
this.mediumType,
|
||||||
this.width,
|
this.width,
|
||||||
this.height,
|
this.height,
|
||||||
|
this.orientation = 0,
|
||||||
this.mimeType,
|
this.mimeType,
|
||||||
this.duration = 0,
|
this.duration = 0,
|
||||||
this.creationDate,
|
this.creationDate,
|
||||||
@ -46,6 +50,7 @@ class Medium {
|
|||||||
mediumType = jsonToMediumType(json["mediumType"]),
|
mediumType = jsonToMediumType(json["mediumType"]),
|
||||||
width = json["width"],
|
width = json["width"],
|
||||||
height = json["height"],
|
height = json["height"],
|
||||||
|
orientation = json["orientation"],
|
||||||
mimeType = json["mimeType"],
|
mimeType = json["mimeType"],
|
||||||
duration = json['duration'] ?? 0,
|
duration = json['duration'] ?? 0,
|
||||||
creationDate = json['creationDate'] != null
|
creationDate = json['creationDate'] != null
|
||||||
@ -61,6 +66,7 @@ class Medium {
|
|||||||
mediumType: jsonToMediumType(map['mediumType']),
|
mediumType: jsonToMediumType(map['mediumType']),
|
||||||
width: map['width'],
|
width: map['width'],
|
||||||
height: map['height'],
|
height: map['height'],
|
||||||
|
orientation: map['orientation'],
|
||||||
mimeType: map["mimeType"],
|
mimeType: map["mimeType"],
|
||||||
creationDate: map['creationDate'],
|
creationDate: map['creationDate'],
|
||||||
modifiedDate: map['modifiedDate'],
|
modifiedDate: map['modifiedDate'],
|
||||||
@ -72,6 +78,7 @@ class Medium {
|
|||||||
"id": this.id,
|
"id": this.id,
|
||||||
"mediumType": mediumTypeToJson(this.mediumType),
|
"mediumType": mediumTypeToJson(this.mediumType),
|
||||||
"height": this.height,
|
"height": this.height,
|
||||||
|
"orientation": this.orientation,
|
||||||
"mimeType": this.mimeType,
|
"mimeType": this.mimeType,
|
||||||
"width": this.width,
|
"width": this.width,
|
||||||
"creationDate": this.creationDate,
|
"creationDate": this.creationDate,
|
||||||
@ -111,6 +118,7 @@ class Medium {
|
|||||||
mediumType == other.mediumType &&
|
mediumType == other.mediumType &&
|
||||||
width == other.width &&
|
width == other.width &&
|
||||||
height == other.height &&
|
height == other.height &&
|
||||||
|
orientation == other.orientation &&
|
||||||
mimeType == other.mimeType &&
|
mimeType == other.mimeType &&
|
||||||
creationDate == other.creationDate &&
|
creationDate == other.creationDate &&
|
||||||
modifiedDate == other.modifiedDate;
|
modifiedDate == other.modifiedDate;
|
||||||
@ -121,6 +129,7 @@ class Medium {
|
|||||||
mediumType.hashCode ^
|
mediumType.hashCode ^
|
||||||
width.hashCode ^
|
width.hashCode ^
|
||||||
height.hashCode ^
|
height.hashCode ^
|
||||||
|
orientation.hashCode ^
|
||||||
mimeType.hashCode ^
|
mimeType.hashCode ^
|
||||||
creationDate.hashCode ^
|
creationDate.hashCode ^
|
||||||
modifiedDate.hashCode;
|
modifiedDate.hashCode;
|
||||||
@ -131,6 +140,7 @@ class Medium {
|
|||||||
'mediumType: $mediumType, '
|
'mediumType: $mediumType, '
|
||||||
'width: $width, '
|
'width: $width, '
|
||||||
'height: $height, '
|
'height: $height, '
|
||||||
|
'orientation: $orientation, '
|
||||||
'mimeType: $mimeType, '
|
'mimeType: $mimeType, '
|
||||||
'creationDate: $creationDate, '
|
'creationDate: $creationDate, '
|
||||||
'modifiedDate: $modifiedDate}';
|
'modifiedDate: $modifiedDate}';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user