fix #98, properly set some date/time related exif values when appropriate
This commit is contained in:
parent
368a9c109d
commit
d8f68fe643
|
@ -45,7 +45,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:4.1.4'
|
||||
implementation 'com.simplemobiletools:commons:4.1.5'
|
||||
|
||||
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
|
||||
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
|
||||
|
|
|
@ -17,6 +17,8 @@ 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>() {
|
||||
|
@ -105,8 +107,16 @@ class PhotoProcessor(val activity: MainActivity, val saveUri: Uri?, val deviceOr
|
|||
}
|
||||
|
||||
if (activity.config.savePhotoMetadata) {
|
||||
val fileExif = ExifInterface(path)
|
||||
tempExif.copyTo(fileExif)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
return photoFile.absolutePath
|
||||
|
|
Loading…
Reference in New Issue