mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
More frequent UI feedback during invitation process.
Fixes issue #3611924.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user