diff --git a/briar-android/res/values/strings.xml b/briar-android/res/values/strings.xml index 2c6debaf45db035fd5d62bd30e3e7c6ad7c406a4..ad0ea3bfc5987966e179e13c81762782ea613b5d 100644 --- a/briar-android/res/values/strings.xml +++ b/briar-android/res/values/strings.xml @@ -42,9 +42,11 @@ <string name="check_same_network">Please check that you are both using the same network</string> <string name="try_again_button">Try again</string> <string name="connected_to_contact">Connected to contact</string> + <string name="calculating_confirmation_code">Calculating confirmation code\u2026</string> <string name="your_confirmation_code">Your confirmation code is</string> <string name="enter_confirmation_code">Please enter your contact\'s confirmation code:</string> <string name="waiting_for_contact">Waiting for contact\u2026</string> + <string name="exchanging_contact_details">Exchanging contact details\u2026</string> <string name="codes_do_not_match">Codes do not match</string> <string name="interfering">This could mean that someone is trying to interfere with your connection</string> <string name="contact_added">Contact added</string> diff --git a/briar-android/src/net/sf/briar/android/invitation/AddContactActivity.java b/briar-android/src/net/sf/briar/android/invitation/AddContactActivity.java index 19a218240455ccc0b986b367a4a5d059ad9ad062..14798d6255b02578d4b9a48c4796301b3b9eb1ba 100644 --- a/briar-android/src/net/sf/briar/android/invitation/AddContactActivity.java +++ b/briar-android/src/net/sf/briar/android/invitation/AddContactActivity.java @@ -133,7 +133,7 @@ implements InvitationListener { setView(new WaitForContactView(this)); } else if(localMatched && remoteMatched) { if(contactName == null) - setView(new WaitForContactView(this)); + setView(new ContactDetailsView(this)); else setView(new ContactAddedView(this)); } else { setView(new CodesDoNotMatchView(this)); @@ -287,7 +287,8 @@ implements InvitationListener { localCompared = true; if(code == remoteConfirmationCode) { localMatched = true; - setView(new WaitForContactView(this)); + if(remoteMatched) setView(new ContactDetailsView(this)); + else setView(new WaitForContactView(this)); task.localConfirmationSucceeded(); } else { setView(new CodesDoNotMatchView(this)); @@ -342,6 +343,8 @@ implements InvitationListener { public void run() { remoteCompared = true; remoteMatched = true; + if(localMatched) + setView(new ContactDetailsView(AddContactActivity.this)); } }); } diff --git a/briar-android/src/net/sf/briar/android/invitation/ConnectedView.java b/briar-android/src/net/sf/briar/android/invitation/ConnectedView.java index 17c56ee8dc49300ad50f31783ab972ec21c8146f..2eead7a0c9738c9ace75b85a18d20d5c3b970ec2 100644 --- a/briar-android/src/net/sf/briar/android/invitation/ConnectedView.java +++ b/briar-android/src/net/sf/briar/android/invitation/ConnectedView.java @@ -5,6 +5,7 @@ import net.sf.briar.R; import android.content.Context; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.ProgressBar; import android.widget.TextView; class ConnectedView extends AddContactView { @@ -30,5 +31,19 @@ class ConnectedView extends AddContactView { connected.setText(R.string.connected_to_contact); innerLayout.addView(connected); addView(innerLayout); + + innerLayout = new LinearLayout(ctx); + innerLayout.setOrientation(HORIZONTAL); + innerLayout.setGravity(CENTER); + + ProgressBar progress = new ProgressBar(ctx); + progress.setIndeterminate(true); + progress.setPadding(10, 10, 10, 10); + innerLayout.addView(progress); + + TextView connecting = new TextView(ctx); + connecting.setText(R.string.calculating_confirmation_code); + innerLayout.addView(connecting); + addView(innerLayout); } } diff --git a/briar-android/src/net/sf/briar/android/invitation/ContactDetailsView.java b/briar-android/src/net/sf/briar/android/invitation/ContactDetailsView.java new file mode 100644 index 0000000000000000000000000000000000000000..b3743ba44bd49159faddbaa93c5e21d51b2da77e --- /dev/null +++ b/briar-android/src/net/sf/briar/android/invitation/ContactDetailsView.java @@ -0,0 +1,65 @@ +package net.sf.briar.android.invitation; + +import static android.view.Gravity.CENTER; +import static android.view.Gravity.CENTER_HORIZONTAL; +import net.sf.briar.R; +import android.content.Context; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.TextView; + +class ContactDetailsView extends AddContactView { + + ContactDetailsView(Context ctx) { + super(ctx); + } + + void populate() { + removeAllViews(); + Context ctx = getContext(); + LinearLayout innerLayout = new LinearLayout(ctx); + innerLayout.setOrientation(HORIZONTAL); + innerLayout.setGravity(CENTER); + + ImageView icon = new ImageView(ctx); + icon.setImageResource(R.drawable.navigation_accept); + innerLayout.addView(icon); + + TextView connected = new TextView(ctx); + connected.setTextSize(22); + connected.setPadding(10, 10, 10, 10); + connected.setText(R.string.connected_to_contact); + innerLayout.addView(connected); + addView(innerLayout); + + TextView yourCode = new TextView(ctx); + yourCode.setGravity(CENTER_HORIZONTAL); + yourCode.setTextSize(14); + yourCode.setPadding(10, 0, 10, 10); + yourCode.setText(R.string.your_confirmation_code); + addView(yourCode); + + TextView code = new TextView(ctx); + code.setGravity(CENTER_HORIZONTAL); + code.setTextSize(50); + code.setPadding(10, 0, 10, 10); + int localCode = container.getLocalConfirmationCode(); + code.setText(String.format("%06d", localCode)); + addView(code); + + innerLayout = new LinearLayout(ctx); + innerLayout.setOrientation(HORIZONTAL); + innerLayout.setGravity(CENTER); + + ProgressBar progress = new ProgressBar(ctx); + progress.setIndeterminate(true); + progress.setPadding(10, 10, 10, 10); + innerLayout.addView(progress); + + TextView connecting = new TextView(ctx); + connecting.setText(R.string.exchanging_contact_details); + innerLayout.addView(connecting); + addView(innerLayout); + } +}