aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/adapter
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-01 23:48:26 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-01 23:48:26 +0200
commit8d414c244241f7a37f4add78dc55ef197efe3395 (patch)
treeb19e956f61d5e5f523cdff5315cef8bdd164750b /src/main/java/de/pixart/messenger/ui/adapter
parentda707773ede9ff7caa03301c09d70c98947f4b4d (diff)
request storage permission when opening message
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/adapter')
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java7
1 files changed, 7 insertions, 0 deletions
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 436f0f219..37dd32b4c 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -1,5 +1,6 @@
package de.pixart.messenger.ui.adapter;
+import android.Manifest;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -15,6 +16,7 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.support.annotation.ColorInt;
+import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.text.Spannable;
import android.text.SpannableString;
@@ -1057,6 +1059,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
public void openDownloadable(Message message) {
+ if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+ ConversationFragment.registerPendingMessage(activity, message);
+ ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, ConversationActivity.REQUEST_OPEN_MESSAGE);
+ return;
+ }
DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
if (!file.exists()) {
Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();