mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fix edit button shown when image has no location (#6029)
Changed the commons.filepicker.UploadableFile's hasLocation method to use the existing ImageCoordinates class for detecting the presence of geolocation in an image's exif
This commit is contained in:
parent
c1acdbe31a
commit
235e8cdba2
1 changed files with 2 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ import android.os.Parcelable
|
|||
import androidx.exifinterface.media.ExifInterface
|
||||
|
||||
import fr.free.nrw.commons.upload.FileUtils
|
||||
import fr.free.nrw.commons.upload.ImageCoordinates
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.util.Date
|
||||
|
|
@ -87,9 +88,7 @@ class UploadableFile : Parcelable {
|
|||
fun hasLocation(): Boolean {
|
||||
return try {
|
||||
val exif = ExifInterface(file.absolutePath)
|
||||
val latitude = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE)
|
||||
val longitude = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE)
|
||||
latitude != null && longitude != null
|
||||
ImageCoordinates(exif, null).imageCoordsExists
|
||||
} catch (e: IOException) {
|
||||
Timber.tag("UploadableFile").d(e)
|
||||
false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue