diff options
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 7 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationActivity.java | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index 2ffcbb7ec..9253b9796 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -15,9 +15,11 @@ 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; +import android.support.v4.content.FileProvider; import android.system.Os; import android.system.StructStat; import android.util.Base64; @@ -463,10 +465,9 @@ public class FileBackend { pathBuilder.append("Camera"); pathBuilder.append('/'); pathBuilder.append(this.fileDateFormat.format(new Date()) + ".jpg"); - Uri uri = Uri.parse("file://" + pathBuilder.toString()); - File file = new File(uri.toString()); + File file = new File(pathBuilder.toString()); file.getParentFile().mkdirs(); - return uri; + return FileProvider.getUriForFile(mXmppConnectionService,"de.pixart.messenger.files",file); } public Avatar getPepAvatar(Uri image, int size, Bitmap.CompressFormat format) { diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 1a285d76e..00baaa6a4 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -616,6 +616,7 @@ public class ConversationActivity extends XmppActivity break; case ATTACHMENT_CHOICE_TAKE_PHOTO: Uri uri = xmppConnectionService.getFileBackend().getTakePhotoUri(); + intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); mPendingImageUris.clear(); |