diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 7 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ShareWithActivity.java | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 8fab4031f..24bc9163f 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -625,14 +625,14 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke }); } - private void attachFileToConversation(Conversation conversation, Uri uri) { + private void attachFileToConversation(Conversation conversation, Uri uri, String type) { if (conversation == null) { return; } final Toast prepareFileToast = Toast.makeText(getActivity(), getText(R.string.preparing_file), Toast.LENGTH_LONG); prepareFileToast.show(); activity.delegateUriPermissionsToService(uri); - activity.xmppConnectionService.attachFileToConversation(conversation, uri, new UiInformableCallback<Message>() { + activity.xmppConnectionService.attachFileToConversation(conversation, uri, type, new UiInformableCallback<Message>() { @Override public void inform(final String text) { hidePrepareFileToast(prepareFileToast); @@ -970,10 +970,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke case ATTACHMENT_CHOICE_CHOOSE_FILE: case ATTACHMENT_CHOICE_RECORD_VOICE: final List<Uri> fileUris = AttachmentTool.extractUriFromIntent(data); + String type = data.getType(); final PresenceSelector.OnPresenceSelected callback = () -> { for (Iterator<Uri> i = fileUris.iterator(); i.hasNext(); i.remove()) { Log.d(Config.LOGTAG, "ConversationsActivity.onActivityResult() - attaching file to conversations. CHOOSE_FILE/RECORD_VOICE"); - attachFileToConversation(conversation, i.next()); + attachFileToConversation(conversation, i.next(), type); } }; if (conversation == null || conversation.getMode() == Conversation.MODE_MULTI || FileBackend.allFilesUnderSize(getActivity(), fileUris, getMaxHttpUploadSize(conversation))) { diff --git a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java index 2d72d3a26..ad0ed109d 100644 --- a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java @@ -57,6 +57,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer public String text; public String uuid; public boolean multiple = false; + public String type; } private Share share; @@ -229,6 +230,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer this.share.uris.clear(); this.share.uris.add(uri); this.share.image = type.startsWith("image/") || isImage(uri); + this.share.type = type; } else { if (subject != null) { this.share.text = format("[%s]%n%s", subject, text); @@ -348,7 +350,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer replaceToast(getString(R.string.preparing_file)); final Uri uri = share.uris.get(0); delegateUriPermissionsToService(uri); - xmppConnectionService.attachFileToConversation(conversation, uri, attachFileCallback); + xmppConnectionService.attachFileToConversation(conversation, uri, share.type, attachFileCallback); finish(); } }; |