diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-08-25 22:41:33 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-08-25 22:41:33 +0200 |
commit | 910b38ec13f2e3f7fa648920e8fc62ff81669ef9 (patch) | |
tree | f67c99ac301044ab399f2d55230737ae92dbb616 /src/main/java/eu | |
parent | b0cdc2745c56c16c1de7d411fc2e1d1d2812ac90 (diff) |
add file provider to share files on android n
Diffstat (limited to 'src/main/java/eu')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 1 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index d57176e4..9d2796e1 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -699,6 +699,7 @@ public class XmppConnectionService extends Service { private void directReply(Conversation conversation, String body) { Message message = new Message(conversation,body,conversation.getNextEncryption()); + message.markUnread(); if (message.getEncryption() == Message.ENCRYPTION_PGP) { getPgpEngine().encrypt(message, new UiCallback<Message>() { @Override diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 6763f3f5..bc706cda 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -11,6 +11,7 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; +import android.support.v4.content.FileProvider; import android.text.Spannable; import android.text.SpannableString; import android.text.Spanned; @@ -715,7 +716,9 @@ public class MessageAdapter extends ArrayAdapter<Message> { if (mime == null) { mime = "*/*"; } - openIntent.setDataAndType(Uri.fromFile(file), mime); + Uri uri = FileProvider.getUriForFile(activity,"eu.siacs.conversations.files",file); + openIntent.setDataAndType(uri, mime); + openIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); PackageManager manager = activity.getPackageManager(); List<ResolveInfo> infos = manager.queryIntentActivities(openIntent, 0); if (infos.size() == 0) { |