add an exifinterface extension for copying exifinterfaces
This commit is contained in:
parent
1b8547fe21
commit
56d11a6444
1 changed files with 33 additions and 0 deletions
|
@ -0,0 +1,33 @@
|
|||
package com.simplemobiletools.commons.extensions
|
||||
|
||||
import android.media.ExifInterface
|
||||
|
||||
fun ExifInterface.copyTo(destination: ExifInterface) {
|
||||
val attributes = arrayOf(
|
||||
ExifInterface.TAG_APERTURE,
|
||||
ExifInterface.TAG_DATETIME,
|
||||
ExifInterface.TAG_EXPOSURE_TIME,
|
||||
ExifInterface.TAG_FLASH,
|
||||
ExifInterface.TAG_FOCAL_LENGTH,
|
||||
ExifInterface.TAG_GPS_ALTITUDE,
|
||||
ExifInterface.TAG_GPS_ALTITUDE_REF,
|
||||
ExifInterface.TAG_GPS_DATESTAMP,
|
||||
ExifInterface.TAG_GPS_LATITUDE,
|
||||
ExifInterface.TAG_GPS_LATITUDE_REF,
|
||||
ExifInterface.TAG_GPS_LONGITUDE,
|
||||
ExifInterface.TAG_GPS_LONGITUDE_REF,
|
||||
ExifInterface.TAG_GPS_PROCESSING_METHOD,
|
||||
ExifInterface.TAG_GPS_TIMESTAMP,
|
||||
ExifInterface.TAG_ISO_SPEED_RATINGS,
|
||||
ExifInterface.TAG_MAKE,
|
||||
ExifInterface.TAG_MODEL,
|
||||
ExifInterface.TAG_ORIENTATION,
|
||||
ExifInterface.TAG_WHITE_BALANCE)
|
||||
|
||||
attributes.forEach {
|
||||
val value = getAttribute(it)
|
||||
if (value != null) {
|
||||
destination.setAttribute(it, value)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue