aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-08-25 22:41:33 +0200
committerChristian Schneppe <christian@pix-art.de>2016-08-26 22:28:58 +0200
commitda12042acdb4fc94e542ff098e72fdc2618cc6b4 (patch)
treef98ea91cb1b16ac5e1e825839ec07422d22f7143 /src/main/java/de
parent1fb9dcb42760d4fd8a94ffa0813eff38be91dd5b (diff)
add file provider to share files on android n
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java1
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java5
2 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index d074bf1fe..d49d1f68b 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -697,6 +697,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/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index 4efdf6701..9b0f02696 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -12,6 +12,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;
@@ -804,7 +805,9 @@ public class MessageAdapter extends ArrayAdapter<Message> {
if (mime == null) {
mime = "*/*";
}
- openIntent.setDataAndType(Uri.fromFile(file), mime);
+ Uri uri = FileProvider.getUriForFile(activity,"de.pixart.messenger.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) {