diff options
Diffstat (limited to '')
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationFragment.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 4c8d27e9..147a7a5f 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -355,6 +355,7 @@ public class ConversationFragment extends Fragment { MenuItem shareImage = menu.findItem(R.id.share_image); MenuItem sendAgain = menu.findItem(R.id.send_again); MenuItem copyUrl = menu.findItem(R.id.copy_url); + MenuItem downloadImage = menu.findItem(R.id.download_image); if (this.selectedMessage.getType() != Message.TYPE_TEXT || this.selectedMessage.getDownloadable() != null) { copyText.setVisible(false); @@ -372,6 +373,12 @@ public class ConversationFragment extends Fragment { || this.selectedMessage.getImageParams().url == null) { copyUrl.setVisible(false); } + + if (this.selectedMessage.getType() != Message.TYPE_TEXT + || this.selectedMessage.getDownloadable() != null + || !this.selectedMessage.bodyContainsDownloadable()) { + downloadImage.setVisible(false); + } } } @@ -390,6 +397,8 @@ public class ConversationFragment extends Fragment { case R.id.copy_url: copyUrl(selectedMessage); return true; + case R.id.download_image: + downloadImage(selectedMessage); default: return super.onContextItemSelected(item); } @@ -427,6 +436,11 @@ public class ConversationFragment extends Fragment { } } + private void downloadImage(Message message) { + activity.xmppConnectionService.getHttpConnectionManager() + .createNewConnection(message); + } + protected void privateMessageWith(String counterpart) { this.mEditMessage.setText(""); this.conversation.setNextPresence(counterpart); |