diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 29717ac4e5..a30597c448 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -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() { diff --git a/src/org/thoughtcrime/securesms/ConversationFragment.java b/src/org/thoughtcrime/securesms/ConversationFragment.java index fb3b43c49a..90fcb69846 100644 --- a/src/org/thoughtcrime/securesms/ConversationFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationFragment.java @@ -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);