compose: small fixes for alternate recipient adapter

this slightly alters behavior when a non-contact address is picked, to
make sure a crypto status is shown in the alternate dropdown.
This commit is contained in:
Vincent Breitmoser 2016-08-09 13:35:24 +02:00
parent ecb0044cc4
commit a2674efff1
2 changed files with 6 additions and 3 deletions

View file

@ -49,6 +49,10 @@ public class AlternateRecipientAdapter extends BaseAdapter {
public void setAlternateRecipientInfo(List<Recipient> recipients) {
this.recipients = recipients;
int indexOfCurrentRecipient = recipients.indexOf(currentRecipient);
if (indexOfCurrentRecipient >= 0) {
currentRecipient = recipients.get(indexOfCurrentRecipient);
}
recipients.remove(currentRecipient);
notifyDataSetChanged();
}

View file

@ -334,8 +334,7 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
if (contactLookupUri != null) {
return new RecipientLoader(getContext(), cryptoProvider, contactLookupUri, true);
} else {
String address = alternatesPopupRecipient.address.getAddress();
return new RecipientLoader(getContext(), cryptoProvider, address);
return new RecipientLoader(getContext(), cryptoProvider, alternatesPopupRecipient.address);
}
}
}
@ -451,7 +450,7 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
RecipientTokenSpan[] recipientSpans = text.getSpans(0, text.length(), RecipientTokenSpan.class);
for (RecipientTokenSpan recipientSpan : recipientSpans) {
if (recipientSpan.getToken() == currentRecipient) {
if (recipientSpan.getToken().equals(currentRecipient)) {
return recipientSpan.view;
}
}