From 56ada36b83bdab3b46b020fe700bfc6685ef3428 Mon Sep 17 00:00:00 2001 From: Neel Doshi <60827173+neeldoshii@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:24:11 +0530 Subject: [PATCH] Migrated exifInterface to androidx exif.interface (#6013) --- app/build.gradle | 2 +- .../java/fr/free/nrw/commons/edit/EditActivity.kt | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a16fe60af9..14bf5f3b7d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -139,7 +139,7 @@ dependencies { implementation "androidx.browser:browser:1.3.0" implementation "androidx.cardview:cardview:1.0.0" implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation "androidx.exifinterface:exifinterface:1.3.2" + implementation 'androidx.exifinterface:exifinterface:1.3.7' implementation "androidx.core:core-ktx:$CORE_KTX_VERSION" implementation 'com.simplecityapps:recyclerview-fastscroll:2.0.1' diff --git a/app/src/main/java/fr/free/nrw/commons/edit/EditActivity.kt b/app/src/main/java/fr/free/nrw/commons/edit/EditActivity.kt index 4b7a7a40cc..3da98075e4 100644 --- a/app/src/main/java/fr/free/nrw/commons/edit/EditActivity.kt +++ b/app/src/main/java/fr/free/nrw/commons/edit/EditActivity.kt @@ -6,8 +6,6 @@ import android.animation.ValueAnimator import android.content.Intent import android.graphics.BitmapFactory import android.graphics.Matrix -//noinspection ExifInterface TODO Issue : #5994 -import android.media.ExifInterface import android.os.Bundle import android.view.animation.AccelerateDecelerateInterpolator import android.widget.ImageView @@ -16,6 +14,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.graphics.rotationMatrix import androidx.core.graphics.scaleMatrix import androidx.core.net.toUri +import androidx.exifinterface.media.ExifInterface import androidx.lifecycle.ViewModelProvider import fr.free.nrw.commons.databinding.ActivityEditBinding import timber.log.Timber @@ -45,12 +44,10 @@ class EditActivity : AppCompatActivity() { imageUri = intent.getStringExtra("image") ?: "" vm = ViewModelProvider(this)[EditViewModel::class.java] val sourceExif = imageUri.toUri().path?.let { ExifInterface(it) } - //TODO(Deprecation : 'TAG_APERTURE: String' is deprecated. Deprecated in Java) Issue : #6001 - // TODO(Deprecation : 'TAG_ISO: String' is deprecated. Deprecated in Java) Issue : #6001 - @Suppress("DEPRECATION") + val exifTags = arrayOf( - ExifInterface.TAG_APERTURE, + ExifInterface.TAG_F_NUMBER, ExifInterface.TAG_DATETIME, ExifInterface.TAG_EXPOSURE_TIME, ExifInterface.TAG_FLASH, @@ -66,13 +63,13 @@ class EditActivity : AppCompatActivity() { ExifInterface.TAG_GPS_TIMESTAMP, ExifInterface.TAG_IMAGE_LENGTH, ExifInterface.TAG_IMAGE_WIDTH, - ExifInterface.TAG_ISO, + ExifInterface.TAG_PHOTOGRAPHIC_SENSITIVITY, ExifInterface.TAG_MAKE, ExifInterface.TAG_MODEL, ExifInterface.TAG_ORIENTATION, ExifInterface.TAG_WHITE_BALANCE, - ExifInterface.WHITEBALANCE_AUTO, - ExifInterface.WHITEBALANCE_MANUAL, + ExifInterface.WHITE_BALANCE_AUTO, + ExifInterface.WHITE_BALANCE_MANUAL, ) for (tag in exifTags) { val attribute = sourceExif?.getAttribute(tag.toString())