From e7d59858ae3354ca3945496bd297351e71b3c9d2 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Wed, 5 Oct 2016 21:15:10 +0200 Subject: resolve take photo uri for internal use --- src/main/java/de/pixart/messenger/persistance/FileBackend.java | 4 ++-- src/main/java/de/pixart/messenger/ui/ConversationActivity.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index 1c69eb88d..135f6aef3 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -57,7 +57,7 @@ import de.pixart.messenger.utils.FileUtils; import de.pixart.messenger.xmpp.pep.Avatar; public class FileBackend { - private final SimpleDateFormat fileDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.US); + private static final SimpleDateFormat fileDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.US); private XmppConnectionService mXmppConnectionService; @@ -462,7 +462,7 @@ public class FileBackend { } public Uri getTakePhotoUri() { - File file = new File(getTakePhotoPath()+"IMG_" + this.fileDateFormat.format(new Date()) + ".jpg"); + File file = new File(getTakePhotoPath()+"IMG_" + fileDateFormat.format(new Date()) + ".jpg"); file.getParentFile().mkdirs(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return FileProvider.getUriForFile(mXmppConnectionService,"de.pixart.messenger.files",file); diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 845d174d5..cafd18f00 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -1688,14 +1688,15 @@ public class ConversationActivity extends XmppActivity } } else if (requestCode == ATTACHMENT_CHOICE_TAKE_PHOTO) { if (mPendingPhotoUris.size() == 1) { - Uri uri = mPendingPhotoUris.get(0); - if (xmppConnectionServiceBound) { + Uri uri = FileBackend.getIndexableTakePhotoUri(mPendingPhotoUris.get(0)); + mPendingPhotoUris.set(0, uri); + if (xmppConnectionServiceBound) { Log.d(Config.LOGTAG,"ConversationsActivity.onActivityResult() - attaching photo to conversations. TAKE_PHOTO"); attachPhotoToConversation(getSelectedConversation(), uri); mPendingPhotoUris.clear(); } Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); - intent.setData(FileBackend.getIndexableTakePhotoUri(uri)); + intent.setData(uri); sendBroadcast(intent); } else { mPendingPhotoUris.clear(); -- cgit v1.2.3