ShareWithActivity: refactor for java 8

This commit is contained in:
Daniel Gultsch 2018-01-01 11:56:31 +01:00
parent 2906efa004
commit 2c2e77a168

View file

@ -312,23 +312,17 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
return; return;
} }
if (share.uris.size() != 0) { if (share.uris.size() != 0) {
OnPresenceSelected callback = new OnPresenceSelected() { OnPresenceSelected callback = () -> {
@Override
public void onPresenceSelected() {
attachmentCounter.set(share.uris.size()); attachmentCounter.set(share.uris.size());
if (share.image) { if (share.image) {
share.multiple = share.uris.size() > 1; share.multiple = share.uris.size() > 1;
replaceToast(getString(share.multiple ? R.string.preparing_images : R.string.preparing_image)); replaceToast(getString(share.multiple ? R.string.preparing_images : R.string.preparing_image));
for (Iterator<Uri> i = share.uris.iterator(); i.hasNext(); i.remove()) { for (Iterator<Uri> i = share.uris.iterator(); i.hasNext(); i.remove()) {
ShareWithActivity.this.xmppConnectionService xmppConnectionService.attachImageToConversation(conversation, i.next(), attachFileCallback);
.attachImageToConversation(conversation, i.next(),
attachFileCallback);
} }
} else { } else {
replaceToast(getString(R.string.preparing_file)); replaceToast(getString(R.string.preparing_file));
ShareWithActivity.this.xmppConnectionService xmppConnectionService.attachFileToConversation(conversation, share.uris.get(0), attachFileCallback);
.attachFileToConversation(conversation, share.uris.get(0), attachFileCallback);
}
} }
}; };
if (account.httpUploadAvailable() if (account.httpUploadAvailable()