Select newly created identity on return from CreateIdentityActivity.

This partially fixes dev task #40. CreateIdentityActivity is also called
from AddContactActivity, but that's likely to change soon so I'm not
going to fix it now.
This commit is contained in:
akwizgran
2014-01-30 11:06:26 +00:00
parent 0bc479d4f2
commit 85b02eccc7
2 changed files with 31 additions and 13 deletions

View File

@@ -92,7 +92,6 @@ implements OnItemSelectedListener, OnClickListener {
byte[] b = i.getByteArrayExtra("briar.GROUP_ID");
if(b == null) throw new IllegalStateException();
groupId = new GroupId(b);
b = i.getByteArrayExtra("briar.PARENT_ID");
if(b != null) parentId = new MessageId(b);
timestamp = i.getLongExtra("briar.TIMESTAMP", -1);
@@ -218,6 +217,16 @@ implements OnItemSelectedListener, OnClickListener {
}
}
@Override
protected void onActivityResult(int request, int result, Intent data) {
// This is the result of CreateIdentityActivity
if(result == RESULT_CANCELED) return;
byte[] b = data.getByteArrayExtra("briar.LOCAL_AUTHOR_ID");
if(b == null) throw new IllegalStateException();
localAuthorId = new AuthorId(b);
loadAuthorsAndGroup();
}
public void onItemSelected(AdapterView<?> parent, View view, int position,
long id) {
LocalAuthorItem item = adapter.getItem(position);
@@ -227,7 +236,8 @@ implements OnItemSelectedListener, OnClickListener {
} else if(item == LocalAuthorItem.NEW) {
localAuthor = null;
localAuthorId = null;
startActivity(new Intent(this, CreateIdentityActivity.class));
Intent i = new Intent(this, CreateIdentityActivity.class);
startActivityForResult(i, 0);
} else {
localAuthor = item.getLocalAuthor();
localAuthorId = localAuthor.getId();