ShareWithActivity: refactor for java 8

This commit is contained in:
Daniel Gultsch 2018-01-01 11:56:31 +01:00
parent 2906efa004
commit 2c2e77a168
1 changed files with 10 additions and 16 deletions

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 attachmentCounter.set(share.uris.size());
public void onPresenceSelected() { if (share.image) {
attachmentCounter.set(share.uris.size()); share.multiple = share.uris.size() > 1;
if (share.image) { replaceToast(getString(share.multiple ? R.string.preparing_images : R.string.preparing_image));
share.multiple = share.uris.size() > 1; for (Iterator<Uri> i = share.uris.iterator(); i.hasNext(); i.remove()) {
replaceToast(getString(share.multiple ? R.string.preparing_images : R.string.preparing_image)); xmppConnectionService.attachImageToConversation(conversation, i.next(), attachFileCallback);
for (Iterator<Uri> 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);
} }
} else {
replaceToast(getString(R.string.preparing_file));
xmppConnectionService.attachFileToConversation(conversation, share.uris.get(0), attachFileCallback);
} }
}; };
if (account.httpUploadAvailable() if (account.httpUploadAvailable()