From 2c2e77a168275d5a4837d547a11893c71bce7b62 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 1 Jan 2018 11:56:31 +0100 Subject: [PATCH] ShareWithActivity: refactor for java 8 --- .../conversations/ui/ShareWithActivity.java | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java index 21096a90f..54eaa7ea4 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java @@ -312,23 +312,17 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer return; } if (share.uris.size() != 0) { - OnPresenceSelected callback = new OnPresenceSelected() { - @Override - public void onPresenceSelected() { - attachmentCounter.set(share.uris.size()); - if (share.image) { - share.multiple = share.uris.size() > 1; - replaceToast(getString(share.multiple ? R.string.preparing_images : R.string.preparing_image)); - for (Iterator i = share.uris.iterator(); i.hasNext(); i.remove()) { - ShareWithActivity.this.xmppConnectionService - .attachImageToConversation(conversation, i.next(), - attachFileCallback); - } - } else { - replaceToast(getString(R.string.preparing_file)); - ShareWithActivity.this.xmppConnectionService - .attachFileToConversation(conversation, share.uris.get(0), attachFileCallback); + OnPresenceSelected callback = () -> { + attachmentCounter.set(share.uris.size()); + if (share.image) { + share.multiple = share.uris.size() > 1; + replaceToast(getString(share.multiple ? R.string.preparing_images : R.string.preparing_image)); + for (Iterator i = share.uris.iterator(); i.hasNext(); i.remove()) { + xmppConnectionService.attachImageToConversation(conversation, i.next(), attachFileCallback); } + } else { + replaceToast(getString(R.string.preparing_file)); + xmppConnectionService.attachFileToConversation(conversation, share.uris.get(0), attachFileCallback); } }; if (account.httpUploadAvailable()