diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-10-05 21:15:10 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-10-05 21:15:10 +0200 |
commit | e7d59858ae3354ca3945496bd297351e71b3c9d2 (patch) | |
tree | b482525b76d16628acf32d35eb861be4f9dced36 /src | |
parent | f4b2ede7cc5f2bbb7e17ba5d527131b1895251f4 (diff) |
resolve take photo uri for internal use
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 4 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationActivity.java | 7 |
2 files changed, 6 insertions, 5 deletions
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(); |