diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-15 15:19:02 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-15 15:19:02 +0200 |
commit | bdf9770a61facf0e965c6c4c4dd586e8d9c27b18 (patch) | |
tree | 5ababe50f098e7037cbd48c39bcfb1ebb6210610 /src/eu/siacs/conversations/services | |
parent | 513f3c47b2aa710d205a43b63eff3301812969ce (diff) |
made ui with sending images a little smoother
Diffstat (limited to 'src/eu/siacs/conversations/services')
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index df0b287a..54c1c49b 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -401,15 +401,28 @@ public class XmppConnectionService extends Service { return this.fileBackend; } - public Message attachImageToConversation(Conversation conversation, String presence, Uri uri) { - Message message = new Message(conversation, "", Message.ENCRYPTION_NONE); - message.setPresence(presence); - message.setType(Message.TYPE_IMAGE); - File file = this.fileBackend.copyImageToPrivateStorage(message, uri); - conversation.getMessages().add(message); - databaseBackend.createMessage(message); - sendMessage(message, null); - return message; + public void attachImageToConversation(final Conversation conversation, final String presence, final Uri uri) { + new Thread(new Runnable() { + + @Override + public void run() { + Message message = new Message(conversation, "", Message.ENCRYPTION_NONE); + message.setPresence(presence); + message.setType(Message.TYPE_IMAGE); + message.setStatus(Message.STATUS_PREPARING); + conversation.getMessages().add(message); + if (convChangedListener!=null) { + convChangedListener.onConversationListChanged(); + } + getFileBackend().copyImageToPrivateStorage(message, uri); + message.setStatus(Message.STATUS_UNSEND); + databaseBackend.createMessage(message); + if (convChangedListener!=null) { + convChangedListener.onConversationListChanged(); + } + sendMessage(message, null); + } + }).start(); } |