diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/ExifInterface.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/ExifInterface.kt new file mode 100644 index 000000000..58df36470 --- /dev/null +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/ExifInterface.kt @@ -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) + } + } +}