Remove lots of unused code for identity selection

This commit is contained in:
Torsten Grote
2016-09-01 12:36:14 -03:00
parent 69dd399bd2
commit fe4f71fe0f
9 changed files with 116 additions and 483 deletions

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
@@ -22,6 +23,7 @@
android:src="@drawable/qr_code_intro"/>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
@@ -37,22 +39,6 @@
android:paddingStart="@dimen/margin_activity_horizontal"
android:paddingTop="@dimen/margin_activity_vertical">
<TextView
style="@style/BriarTextBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/your_nickname"
android:visibility="gone"/>
<Spinner
android:id="@+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_medium"
android:background="@drawable/border_spinner"
android:spinnerMode="dropdown"
android:visibility="gone"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -65,7 +51,8 @@
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:padding="@dimen/margin_medium"
android:src="@drawable/qr_code_explanation"/>
android:src="@drawable/qr_code_explanation"
tools:ignore="ContentDescription"/>
<TextView
style="@style/BriarTextBody"

View File

@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:id="@+id/scrollView"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -15,22 +17,6 @@
android:paddingStart="@dimen/margin_activity_horizontal"
android:paddingTop="@dimen/margin_activity_vertical">
<TextView
style="@style/BriarTextBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/your_nickname"
android:visibility="gone"/>
<Spinner
android:id="@+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_medium"
android:background="@drawable/border_spinner"
android:spinnerMode="dropdown"
android:visibility="gone"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
@@ -38,7 +24,8 @@
android:layout_marginTop="@dimen/margin_xlarge"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/qr_code_intro"/>
android:src="@drawable/qr_code_intro"
tools:ignore="ContentDescription"/>
<LinearLayout
android:layout_width="match_parent"

View File

@@ -23,7 +23,7 @@ import org.briarproject.android.introduction.ContactChooserFragment;
import org.briarproject.android.introduction.IntroductionActivity;
import org.briarproject.android.introduction.IntroductionMessageFragment;
import org.briarproject.android.invitation.AddContactActivity;
import org.briarproject.android.keyagreement.ChooseIdentityFragment;
import org.briarproject.android.keyagreement.IntroFragment;
import org.briarproject.android.keyagreement.KeyAgreementActivity;
import org.briarproject.android.keyagreement.ShowQrCodeFragment;
import org.briarproject.android.panic.PanicPreferencesActivity;
@@ -110,7 +110,7 @@ public interface ActivityComponent {
void inject(BlogListFragment fragment);
void inject(FeedFragment fragment);
void inject(MyBlogsFragment fragment);
void inject(ChooseIdentityFragment fragment);
void inject(IntroFragment fragment);
void inject(ShowQrCodeFragment fragment);
void inject(ContactChooserFragment fragment);
void inject(ContactSelectorFragment fragment);

View File

@@ -1,124 +0,0 @@
package org.briarproject.android.identity;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import org.briarproject.R;
import org.briarproject.api.crypto.CryptoComponent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import im.delight.android.identicons.IdenticonDrawable;
import static org.briarproject.android.identity.LocalAuthorItem.ANONYMOUS;
import static org.briarproject.android.identity.LocalAuthorItem.NEW;
public class LocalAuthorSpinnerAdapter extends BaseAdapter
implements SpinnerAdapter {
private final Context ctx;
private final boolean includeAnonymous;
private final List<LocalAuthorItem> list = new ArrayList<LocalAuthorItem>();
public LocalAuthorSpinnerAdapter(Context ctx, boolean includeAnonymous) {
this.ctx = ctx;
this.includeAnonymous = includeAnonymous;
}
public void add(LocalAuthorItem item) {
list.add(item);
notifyDataSetChanged();
}
public void clear() {
list.clear();
notifyDataSetChanged();
}
public int getCount() {
if (list.isEmpty()) return 0;
return includeAnonymous ? list.size() + 2 : list.size() + 1;
}
@Override
public View getDropDownView(int position, View convertView,
ViewGroup parent) {
View view;
if (convertView == null) {
LayoutInflater inflater =
(LayoutInflater) ctx
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.dropdown_author, parent, false);
} else
view = convertView;
TextView name = (TextView) view.findViewById(R.id.nameView);
ImageView avatar =
(ImageView) view.findViewById(R.id.avatarView);
LocalAuthorItem item = getItem(position);
if (item == ANONYMOUS) {
name.setText(R.string.anonymous);
avatar.setVisibility(View.INVISIBLE);
} else if (item == NEW) {
name.setText(R.string.new_identity_item);
avatar.setVisibility(View.INVISIBLE);
} else {
name.setText(item.getLocalAuthor().getName());
avatar.setVisibility(View.VISIBLE);
avatar.setImageDrawable(new IdenticonDrawable(
item.getLocalAuthor().getId().getBytes()));
}
return view;
}
public LocalAuthorItem getItem(int position) {
if (includeAnonymous) {
if (position == list.size()) return ANONYMOUS;
if (position == list.size() + 1) return NEW;
return list.get(position);
} else {
if (position == list.size()) return NEW;
return list.get(position);
}
}
public long getItemId(int position) {
return android.R.layout.simple_spinner_item;
}
public View getView(int position, View convertView, ViewGroup parent) {
View view = getDropDownView(position, convertView, parent);
Drawable d = ctx.getResources()
.getDrawable(R.drawable.ic_expand_more_black_24dp);
if (d != null) {
d.setColorFilter(
ctx.getResources().getColor(R.color.spinner_arrow),
PorterDuff.Mode.SRC_IN);
}
((TextView) view.findViewById(R.id.nameView))
.setCompoundDrawablesWithIntrinsicBounds(null, null, d, null);
return view;
}
@Override
public boolean isEmpty() {
return list.isEmpty();
}
public void sort(Comparator<LocalAuthorItem> comparator) {
Collections.sort(list, comparator);
notifyDataSetChanged();
}
}

View File

@@ -18,7 +18,6 @@ import org.briarproject.api.invitation.InvitationState;
import org.briarproject.api.invitation.InvitationTask;
import org.briarproject.api.invitation.InvitationTaskFactory;
import java.util.Collection;
import java.util.logging.Logger;
import javax.inject.Inject;
@@ -31,10 +30,9 @@ import static org.briarproject.android.invitation.ConfirmationCodeView.Confirmat
import static org.briarproject.android.invitation.ConfirmationCodeView.ConfirmationState.WAIT_FOR_CONTACT;
public class AddContactActivity extends BriarActivity
implements InvitationListener {
implements InvitationListener {
static final int REQUEST_BLUETOOTH = 1;
static final int REQUEST_CREATE_IDENTITY = 2;
private static final Logger LOG =
Logger.getLogger(AddContactActivity.class.getName());
@@ -181,11 +179,6 @@ implements InvitationListener {
public void onActivityResult(int request, int result, Intent data) {
if (request == REQUEST_BLUETOOTH) {
if (result != RESULT_CANCELED) reset(new InvitationCodeView(this));
} else if (request == REQUEST_CREATE_IDENTITY && result == RESULT_OK) {
byte[] b = data.getByteArrayExtra("briar.LOCAL_AUTHOR_ID");
if (b == null) throw new IllegalStateException();
localAuthorId = new AuthorId(b);
setView(new ChooseIdentityView(this));
}
}
@@ -210,17 +203,16 @@ implements InvitationListener {
setView(view);
}
void loadLocalAuthors() {
void loadLocalAuthor() {
runOnDbThread(new Runnable() {
public void run() {
try {
long now = System.currentTimeMillis();
Collection<LocalAuthor> authors =
identityManager.getLocalAuthors();
LocalAuthor author = identityManager.getLocalAuthor();
long duration = System.currentTimeMillis() - now;
if (LOG.isLoggable(INFO))
LOG.info("Loading authors took " + duration + " ms");
displayLocalAuthors(authors);
LOG.info("Loading author took " + duration + " ms");
setLocalAuthorId(author.getId());
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
@@ -229,25 +221,15 @@ implements InvitationListener {
});
}
// FIXME: The interaction between views and the container is horrible
private void displayLocalAuthors(final Collection<LocalAuthor> authors) {
void setLocalAuthorId(final AuthorId localAuthorId) {
runOnUiThread(new Runnable() {
@Override
public void run() {
AddContactView view = AddContactActivity.this.view;
if (view instanceof ChooseIdentityView)
((ChooseIdentityView) view).displayLocalAuthors(authors);
AddContactActivity.this.localAuthorId = localAuthorId;
}
});
}
void setLocalAuthorId(AuthorId localAuthorId) {
this.localAuthorId = localAuthorId;
}
AuthorId getLocalAuthorId() {
return localAuthorId;
}
int getLocalInvitationCode() {
if (localInvitationCode == -1)
localInvitationCode = crypto.generateBTInvitationCode();

View File

@@ -5,32 +5,15 @@ import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Button;
import android.widget.Spinner;
import org.briarproject.R;
import org.briarproject.android.identity.CreateIdentityActivity;
import org.briarproject.android.identity.LocalAuthorItem;
import org.briarproject.android.identity.LocalAuthorItemComparator;
import org.briarproject.android.identity.LocalAuthorSpinnerAdapter;
import org.briarproject.api.identity.AuthorId;
import org.briarproject.api.identity.LocalAuthor;
import java.util.Collection;
import static android.bluetooth.BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE;
import static android.bluetooth.BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION;
import static org.briarproject.android.identity.LocalAuthorItem.NEW;
import static org.briarproject.android.invitation.AddContactActivity.REQUEST_BLUETOOTH;
import static org.briarproject.android.invitation.AddContactActivity.REQUEST_CREATE_IDENTITY;
class ChooseIdentityView extends AddContactView
implements OnItemSelectedListener, OnClickListener {
private LocalAuthorSpinnerAdapter adapter = null;
private Spinner spinner = null;
class ChooseIdentityView extends AddContactView implements OnClickListener {
ChooseIdentityView(Context ctx) {
super(ctx);
@@ -44,50 +27,10 @@ implements OnItemSelectedListener, OnClickListener {
(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.invitation_bluetooth_start, this);
adapter = new LocalAuthorSpinnerAdapter(ctx, false);
spinner = (Spinner) view.findViewById(R.id.spinner);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(this);
Button continueButton = (Button) view.findViewById(R.id.continueButton);
continueButton.setOnClickListener(this);
container.loadLocalAuthors();
}
// FIXME: The interaction between views and the container is horrible
void displayLocalAuthors(Collection<LocalAuthor> authors) {
adapter.clear();
for (LocalAuthor a : authors) adapter.add(new LocalAuthorItem(a));
adapter.sort(LocalAuthorItemComparator.INSTANCE);
// If a local author has been selected, select it again
AuthorId localAuthorId = container.getLocalAuthorId();
if (localAuthorId == null) return;
int count = adapter.getCount();
for (int i = 0; i < count; i++) {
LocalAuthorItem item = adapter.getItem(i);
if (item == NEW) continue;
if (item.getLocalAuthor().getId().equals(localAuthorId)) {
spinner.setSelection(i);
return;
}
}
}
public void onItemSelected(AdapterView<?> parent, View view, int position,
long id) {
LocalAuthorItem item = adapter.getItem(position);
if (item == NEW) {
container.setLocalAuthorId(null);
Intent i = new Intent(container, CreateIdentityActivity.class);
container.startActivityForResult(i, REQUEST_CREATE_IDENTITY);
} else {
container.setLocalAuthorId(item.getLocalAuthor().getId());
}
}
public void onNothingSelected(AdapterView<?> parent) {
container.setLocalAuthorId(null);
container.loadLocalAuthor();
}
public void onClick(View view) {

View File

@@ -1,210 +0,0 @@
package org.briarproject.android.keyagreement;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ScrollView;
import android.widget.Spinner;
import org.briarproject.R;
import org.briarproject.android.ActivityComponent;
import org.briarproject.android.fragment.BaseFragment;
import org.briarproject.android.identity.CreateIdentityActivity;
import org.briarproject.android.identity.LocalAuthorItem;
import org.briarproject.android.identity.LocalAuthorSpinnerAdapter;
import org.briarproject.api.db.DbException;
import org.briarproject.api.identity.AuthorId;
import org.briarproject.api.identity.IdentityManager;
import org.briarproject.api.identity.LocalAuthor;
import java.util.logging.Logger;
import javax.inject.Inject;
import static android.app.Activity.RESULT_OK;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
import static org.briarproject.android.identity.LocalAuthorItem.NEW;
public class ChooseIdentityFragment extends BaseFragment
implements OnItemSelectedListener {
interface IdentitySelectedListener {
void identitySelected(AuthorId localAuthorId);
}
public static final String TAG = "ChooseIdentityFragment";
private static final Logger LOG =
Logger.getLogger(ChooseIdentityFragment.class.getName());
private static final int REQUEST_CREATE_IDENTITY = 1;
private IdentitySelectedListener lsnr;
private LocalAuthorSpinnerAdapter adapter;
private ScrollView scrollView;
private Spinner spinner;
private View button;
private AuthorId localAuthorId;
// Fields that are accessed from background threads must be volatile
@Inject
protected volatile IdentityManager identityManager;
public static ChooseIdentityFragment newInstance() {
Bundle args = new Bundle();
ChooseIdentityFragment fragment = new ChooseIdentityFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void injectFragment(ActivityComponent component) {
component.inject(this);
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
try {
lsnr = (IdentitySelectedListener) context;
} catch (ClassCastException e) {
throw new ClassCastException(
"Using class must implement IdentitySelectedListener");
}
}
@Override
public String getUniqueTag() {
return TAG;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_keyagreement_id, container,
false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
scrollView = (ScrollView) view;
adapter = new LocalAuthorSpinnerAdapter(getActivity(), false);
spinner = (Spinner) view.findViewById(R.id.spinner);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(this);
button = view.findViewById(R.id.continueButton);
button.setEnabled(false);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
lsnr.identitySelected(localAuthorId);
}
});
}
@Override
public void onStart() {
super.onStart();
loadLocalAuthors();
}
private void loadLocalAuthors() {
listener.runOnDbThread(new Runnable() {
@Override
public void run() {
try {
long now = System.currentTimeMillis();
LocalAuthor author = identityManager.getLocalAuthor();
long duration = System.currentTimeMillis() - now;
if (LOG.isLoggable(INFO))
LOG.info("Loading author took " + duration + " ms");
displayLocalAuthor(author);
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
});
}
private void displayLocalAuthor(final LocalAuthor author) {
listener.runOnUiThread(new Runnable() {
@Override
public void run() {
setLocalAuthorId(author.getId());
// TODO remove comment below when supporting multiple identities
/* adapter.clear();
for (LocalAuthor a : authors)
adapter.add(new LocalAuthorItem(a));
adapter.sort(LocalAuthorItemComparator.INSTANCE);
// If a local author has been selected, select it again
if (localAuthorId == null) return;
int count = adapter.getCount();
for (int i = 0; i < count; i++) {
LocalAuthorItem item = adapter.getItem(i);
if (item == NEW) continue;
if (item.getLocalAuthor().getId().equals(localAuthorId)) {
spinner.setSelection(i);
return;
}
}
*/ }
});
}
private void setLocalAuthorId(final AuthorId authorId) {
listener.runOnUiThread(new Runnable() {
@Override
public void run() {
localAuthorId = authorId;
scrollView.fullScroll(View.FOCUS_DOWN);
button.setEnabled(localAuthorId != null);
}
});
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position,
long id) {
LocalAuthorItem item = adapter.getItem(position);
if (item == NEW) {
setLocalAuthorId(null);
Intent i = new Intent(getActivity(), CreateIdentityActivity.class);
startActivityForResult(i, REQUEST_CREATE_IDENTITY);
} else {
setLocalAuthorId(item.getLocalAuthor().getId());
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
setLocalAuthorId(null);
}
@Override
public void onActivityResult(int request, int result, Intent data) {
if (request == REQUEST_CREATE_IDENTITY && result == RESULT_OK) {
byte[] b = data.getByteArrayExtra("briar.LOCAL_AUTHOR_ID");
if (b == null) throw new IllegalStateException();
setLocalAuthorId(new AuthorId(b));
loadLocalAuthors();
} else
super.onActivityResult(request, result, data);
}
}

View File

@@ -0,0 +1,88 @@
package org.briarproject.android.keyagreement;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ScrollView;
import org.briarproject.R;
import org.briarproject.android.ActivityComponent;
import org.briarproject.android.fragment.BaseFragment;
import static android.view.View.FOCUS_DOWN;
public class IntroFragment extends BaseFragment {
interface IntroScreenSeenListener {
void showNextScreen();
}
public static final String TAG = IntroFragment.class.getName();
private IntroScreenSeenListener screenSeenListener;
private ScrollView scrollView;
public static IntroFragment newInstance() {
Bundle args = new Bundle();
IntroFragment fragment = new IntroFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void injectFragment(ActivityComponent component) {
component.inject(this);
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
try {
screenSeenListener = (IntroScreenSeenListener) context;
} catch (ClassCastException e) {
throw new ClassCastException(
"Using class must implement IntroScreenSeenListener");
}
}
@Override
public String getUniqueTag() {
return TAG;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_keyagreement_id, container,
false);
scrollView = (ScrollView) v.findViewById(R.id.scrollView);
View button = v.findViewById(R.id.continueButton);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
screenSeenListener.showNextScreen();
}
});
return v;
}
@Override
public void onStart() {
super.onStart();
scrollView.post(new Runnable() {
@Override
public void run() {
scrollView.fullScroll(FOCUS_DOWN);
}
});
}
}

View File

@@ -11,7 +11,7 @@ import org.briarproject.R;
import org.briarproject.android.ActivityComponent;
import org.briarproject.android.BriarFragmentActivity;
import org.briarproject.android.fragment.BaseFragment.BaseFragmentListener;
import org.briarproject.android.keyagreement.ChooseIdentityFragment.IdentitySelectedListener;
import org.briarproject.android.keyagreement.IntroFragment.IntroScreenSeenListener;
import org.briarproject.android.util.CustomAnimations;
import org.briarproject.api.contact.ContactExchangeListener;
import org.briarproject.api.contact.ContactExchangeTask;
@@ -21,7 +21,6 @@ import org.briarproject.api.event.EventBus;
import org.briarproject.api.event.EventListener;
import org.briarproject.api.event.KeyAgreementFinishedEvent;
import org.briarproject.api.identity.Author;
import org.briarproject.api.identity.AuthorId;
import org.briarproject.api.identity.IdentityManager;
import org.briarproject.api.identity.LocalAuthor;
import org.briarproject.api.keyagreement.KeyAgreementResult;
@@ -34,15 +33,13 @@ import static android.widget.Toast.LENGTH_LONG;
import static java.util.logging.Level.WARNING;
public class KeyAgreementActivity extends BriarFragmentActivity implements
BaseFragmentListener, IdentitySelectedListener, EventListener,
BaseFragmentListener, IntroScreenSeenListener, EventListener,
ContactExchangeListener {
private static final Logger LOG =
Logger.getLogger(KeyAgreementActivity.class.getName());
private static final String LOCAL_AUTHOR_ID = "briar.LOCAL_AUTHOR_ID";
private static final int STEP_ID = 1;
private static final int STEP_INTRO = 1;
private static final int STEP_QR = 2;
@Inject
@@ -52,8 +49,6 @@ public class KeyAgreementActivity extends BriarFragmentActivity implements
private View progressContainer;
private TextView progressTitle;
private AuthorId localAuthorId;
// Fields that are accessed from background threads must be volatile
@Inject
protected volatile ContactExchangeTask contactExchangeTask;
@@ -78,13 +73,8 @@ public class KeyAgreementActivity extends BriarFragmentActivity implements
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (state != null) {
byte[] b = state.getByteArray(LOCAL_AUTHOR_ID);
if (b != null)
localAuthorId = new AuthorId(b);
}
getSupportActionBar().setTitle(R.string.add_contact_title);
showStep(localAuthorId == null ? STEP_ID : STEP_QR);
if (state == null) showStep(STEP_INTRO);
}
private void showStep(int step) {
@@ -92,9 +82,9 @@ public class KeyAgreementActivity extends BriarFragmentActivity implements
case STEP_QR:
startFragment(ShowQrCodeFragment.newInstance(), true);
break;
case STEP_ID:
case STEP_INTRO:
default:
startFragment(ChooseIdentityFragment.newInstance(), true);
startFragment(IntroFragment.newInstance(), true);
break;
}
}
@@ -111,15 +101,6 @@ public class KeyAgreementActivity extends BriarFragmentActivity implements
eventBus.removeListener(this);
}
@Override
public void onSaveInstanceState(Bundle state) {
super.onSaveInstanceState(state);
if (localAuthorId != null) {
byte[] b = localAuthorId.getBytes();
state.putByteArray(LOCAL_AUTHOR_ID, b);
}
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
@@ -156,8 +137,7 @@ public class KeyAgreementActivity extends BriarFragmentActivity implements
}
@Override
public void identitySelected(AuthorId localAuthorId) {
this.localAuthorId = localAuthorId;
public void showNextScreen() {
showStep(STEP_QR);
}
@@ -186,7 +166,7 @@ public class KeyAgreementActivity extends BriarFragmentActivity implements
LocalAuthor localAuthor;
// Load the local pseudonym
try {
localAuthor = identityManager.getLocalAuthor(localAuthorId);
localAuthor = identityManager.getLocalAuthor();
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);