diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-10-03 18:26:11 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-10-03 18:26:11 +0200 |
commit | cea52b0722bc352815e3c3e1c1982ddd13f54984 (patch) | |
tree | 31dc934a9a8a87103b58715c6e2964dff26d57e8 /src/main/java | |
parent | f4a883848cc68f2e5fad6038e4db809af723955e (diff) |
resolve take photo uri for internal use
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/persistance/FileBackend.java | 5 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationActivity.java | 5 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index cff6e5bf..32d38c1f 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -14,7 +14,6 @@ import android.media.MediaMetadataRetriever; import android.net.Uri; import android.os.Build; import android.os.Environment; -import android.os.FileObserver; import android.os.ParcelFileDescriptor; import android.provider.MediaStore; import android.provider.OpenableColumns; @@ -58,7 +57,7 @@ import eu.siacs.conversations.utils.FileUtils; import eu.siacs.conversations.xmpp.pep.Avatar; public class FileBackend { - private final SimpleDateFormat imageDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.US); + private static final SimpleDateFormat IMAGE_DATE_FORMAT = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US); private XmppConnectionService mXmppConnectionService; @@ -437,7 +436,7 @@ public class FileBackend { } public Uri getTakePhotoUri() { - File file = new File(getTakePhotoPath()+"IMG_" + this.imageDateFormat.format(new Date()) + ".jpg"); + File file = new File(getTakePhotoPath()+"IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); file.getParentFile().mkdirs(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return FileProvider.getUriForFile(mXmppConnectionService, "eu.siacs.conversations.files", file); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 0802da3b..b45d9d70 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1404,14 +1404,15 @@ public class ConversationActivity extends XmppActivity } } else if (requestCode == ATTACHMENT_CHOICE_TAKE_PHOTO) { if (mPendingImageUris.size() == 1) { - Uri uri = mPendingImageUris.get(0); + Uri uri = FileBackend.getIndexableTakePhotoUri(mPendingImageUris.get(0)); + mPendingImageUris.set(0, uri); if (xmppConnectionServiceBound) { Log.d(Config.LOGTAG,"ConversationsActivity.onActivityResult() - attaching image to conversations. TAKE_PHOTO"); attachImageToConversation(getSelectedConversation(), uri); mPendingImageUris.clear(); } Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); - intent.setData(FileBackend.getIndexableTakePhotoUri(uri)); + intent.setData(uri); sendBroadcast(intent); } else { mPendingImageUris.clear(); |