diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-10-24 19:30:03 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-10-24 19:30:03 +0200 |
commit | 8fb898541286d737491ac156e8b327b534d4e2a3 (patch) | |
tree | 318b2a0e80d236a159d84a1549d211cd8682fd95 | |
parent | 1ea8feaf2415ff4080ef8cde15ade49c9ec85c1e (diff) |
added message option to download images
Diffstat (limited to '')
-rw-r--r-- | res/menu/message_context.xml | 5 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationFragment.java | 14 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/EditAccountActivity.java | 2 |
3 files changed, 18 insertions, 3 deletions
diff --git a/res/menu/message_context.xml b/res/menu/message_context.xml index 23d5d28d..80d4d196 100644 --- a/res/menu/message_context.xml +++ b/res/menu/message_context.xml @@ -9,9 +9,12 @@ android:title="@string/share_image"/> <item android:id="@+id/copy_url" - android:title="@string/copy_original_url" /> + android:title="@string/copy_original_url"/> <item android:id="@+id/send_again" android:title="@string/send_again"/> + <item + android:id="@+id/download_image" + android:title="@string/download_image"/> </menu>
\ No newline at end of file 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); diff --git a/src/eu/siacs/conversations/ui/EditAccountActivity.java b/src/eu/siacs/conversations/ui/EditAccountActivity.java index 89c06592..58ca49cc 100644 --- a/src/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/eu/siacs/conversations/ui/EditAccountActivity.java @@ -1,8 +1,6 @@ package eu.siacs.conversations.ui; import android.app.PendingIntent; -import android.content.ClipData; -import android.content.ClipboardManager; import android.content.Intent; import android.os.Bundle; import android.text.Editable; |