Update recipient info after adding a contact

Fixes #4074
Closes #4259
This commit is contained in:
Gil 2015-10-16 15:39:27 +02:00 committed by Moxie Marlinspike
parent 57cb68849e
commit b40f0ffeb0
2 changed files with 11 additions and 1 deletions

View File

@ -173,6 +173,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
private static final int PICK_CONTACT_INFO = 4;
private static final int GROUP_EDIT = 5;
private static final int TAKE_PHOTO = 6;
private static final int ADD_CONTACT = 7;
private MasterSecret masterSecret;
protected ComposeText composeText;
@ -343,6 +344,11 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
setMedia(attachmentManager.getCaptureUri(), MediaType.IMAGE);
}
break;
case ADD_CONTACT:
recipients = RecipientFactory.getRecipientsForIds(ConversationActivity.this, recipients.getIds(), true);
recipients.addListener(this);
fragment.reloadList();
break;
}
}
@ -655,7 +661,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
intent.putExtra(ContactsContract.Intents.Insert.PHONE, recipients.getPrimaryRecipient().getNumber());
intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
startActivity(intent);
startActivityForResult(intent, ADD_CONTACT);
}
private void handleAddAttachment() {

View File

@ -152,6 +152,10 @@ public class ConversationFragment extends Fragment
}
}
public void reloadList() {
getLoaderManager().restartLoader(0, null, this);
}
private void initializeResources() {
this.recipients = RecipientFactory.getRecipientsForIds(getActivity(), getActivity().getIntent().getLongArrayExtra("recipients"), true);
this.threadId = this.getActivity().getIntent().getLongExtra("thread_id", -1);