First part of BQP UI improvements.

Includes parallel improvements to Bluetooth key exchange UI.
This commit is contained in:
str4d
2016-04-01 03:24:24 +00:00
committed by akwizgran
parent 5f5ceedc29
commit b81a567468
22 changed files with 443 additions and 134 deletions

View File

@@ -36,6 +36,11 @@ implements InvitationListener {
static final int REQUEST_BLUETOOTH = 1;
static final int REQUEST_CREATE_IDENTITY = 2;
private static final int STEP_CHOOSE = 1;
private static final int STEP_INVITE = 2;
private static final int STEP_CONFIRM = 3;
private static final int STEPS = 3;
private static final Logger LOG =
Logger.getLogger(AddContactActivity.class.getName());
@@ -189,10 +194,23 @@ implements InvitationListener {
}
}
@SuppressWarnings("ConstantConditions")
void setView(AddContactView view) {
this.view = view;
view.init(this);
setContentView(view);
int step = 0;
if (view instanceof ChooseIdentityView) step = STEP_CHOOSE;
else if (view instanceof InvitationCodeView) step = STEP_INVITE;
else if (view instanceof ConfirmationCodeView) step = STEP_CONFIRM;
if (step > 0) {
getSupportActionBar().setTitle(
String.format(getString(R.string.add_contact_title_step),
step, STEPS));
} else {
getSupportActionBar().setTitle(R.string.add_contact_title);
}
}
void reset(AddContactView view) {

View File

@@ -9,7 +9,6 @@ import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;
import org.briarproject.R;
import org.briarproject.android.identity.CreateIdentityActivity;
@@ -45,11 +44,6 @@ implements OnItemSelectedListener, OnClickListener {
(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.invitation_bluetooth_start, this);
// current step
// TODO this could go into the ActionBar eventually
TextView step = (TextView) view.findViewById(R.id.stepView);
step.setText(String.format(ctx.getString(R.string.step), 1, 3));
adapter = new LocalAuthorSpinnerAdapter(ctx, false);
spinner = (Spinner) view.findViewById(R.id.spinner);
spinner.setAdapter(adapter);

View File

@@ -15,7 +15,6 @@ import android.widget.TextView;
import org.briarproject.R;
import static android.content.Context.INPUT_METHOD_SERVICE;
import static android.view.inputmethod.InputMethodManager.HIDE_IMPLICIT_ONLY;
class ConfirmationCodeView extends AddContactView {
@@ -40,11 +39,6 @@ class ConfirmationCodeView extends AddContactView {
(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.invitation_bluetooth_confirmation_code, this);
// current step
// TODO this could go into the ActionBar eventually
TextView step = (TextView) view.findViewById(R.id.stepView);
step.setText(String.format(ctx.getString(R.string.step), 3, 3));
// local confirmation code
TextView code = (TextView) view.findViewById(R.id.codeView);
int localCode = container.getLocalConfirmationCode();

View File

@@ -15,7 +15,6 @@ import android.widget.TextView;
import org.briarproject.R;
import static android.content.Context.INPUT_METHOD_SERVICE;
import static android.view.inputmethod.InputMethodManager.HIDE_IMPLICIT_ONLY;
class InvitationCodeView extends AddContactView {
@@ -38,11 +37,6 @@ class InvitationCodeView extends AddContactView {
(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.invitation_bluetooth_invitation_code, this);
// current step
// TODO this could go into the ActionBar eventually
TextView step = (TextView) view.findViewById(R.id.stepView);
step.setText(String.format(ctx.getString(R.string.step), 2, 3));
// local invitation code
TextView code = (TextView) view.findViewById(R.id.codeView);
int localCode = container.getLocalInvitationCode();