diff --git a/app/build.gradle b/app/build.gradle index 8064e50b..20ed0ac0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt b/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt index c77f2f80..5652c075 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/helpers/PhotoProcessor.kt @@ -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() { @@ -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