fix broken referencing of recipient token in RecipientSelectView
Passing through the actual recipient object was broken in
I changed the code to no
longer rely on the actual object being passed through correctly, but
just one that fulfills `equals`.
@@ -396,9 +396,17 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
}
@Override
- public void onRecipientChange(Recipient currentRecipient, Recipient alternateAddress) {
+ public void onRecipientChange(Recipient recipientToReplace, Recipient alternateAddress) {
alternatesPopup.dismiss();
+ List<Recipient> currentRecipients = getObjects();
+ int indexOfRecipient = currentRecipients.indexOf(recipientToReplace);
+ if (indexOfRecipient == -1) {
+ Log.e(K9.LOG_TAG, "Tried to refresh invalid view token!");
+ return;
+ }
+ Recipient currentRecipient = currentRecipients.get(indexOfRecipient);
+
currentRecipient.address = alternateAddress.address;
currentRecipient.addressLabel = alternateAddress.addressLabel;
currentRecipient.cryptoStatus = alternateAddress.cryptoStatus;
