let Camera2 take care of exif fields, just copy it over

This commit is contained in:
tibbi 2018-06-11 12:50:07 +02:00
parent d8f68fe643
commit 8b7185d38c
2 changed files with 3 additions and 13 deletions

View File

@ -45,7 +45,7 @@ ext {
}
dependencies {
implementation 'com.simplemobiletools:commons:4.1.5'
implementation 'com.simplemobiletools:commons:4.1.6'
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"

View File

@ -17,8 +17,6 @@ import java.io.File
import java.io.FileNotFoundException
import java.io.FileOutputStream
import java.io.OutputStream
import java.text.SimpleDateFormat
import java.util.*
class PhotoProcessor(val activity: MainActivity, val saveUri: Uri?, val deviceOrientation: Int, val previewRotation: Int, val isUsingFrontCamera: Boolean) :
AsyncTask<ByteArray, Void, String>() {
@ -107,16 +105,8 @@ class PhotoProcessor(val activity: MainActivity, val saveUri: Uri?, val deviceOr
}
if (activity.config.savePhotoMetadata) {
val dateTimeFormat = SimpleDateFormat("yyyy:MM:dd HH:mm:ss", Locale.getDefault())
val formatted = dateTimeFormat.format(Date())
ExifInterface(path).apply {
setAttribute(ExifInterface.TAG_DATETIME, formatted)
setAttribute(ExifInterface.TAG_DATETIME_DIGITIZED, formatted)
setAttribute(ExifInterface.TAG_DATETIME_ORIGINAL, formatted)
saveAttributes()
tempExif.copyTo(this)
}
val fileExif = ExifInterface(path)
tempExif.copyTo(fileExif)
}
return photoFile.absolutePath