From f3b9214702785b6e6c21becd7ad4e353dafce14f Mon Sep 17 00:00:00 2001
From: Torsten Grote <t@grobox.de>
Date: Wed, 2 Nov 2016 12:43:41 -0200
Subject: [PATCH] Improve QR code workflow slightly

* Improve wording so contacts know they need meet up to scan
  and scan each other's codes
* Use consistent progress bar styles
---
 .../res/layout/fragment_keyagreement_id.xml   |  4 ++--
 .../res/layout/fragment_keyagreement_qr.xml   | 23 ++++++++++---------
 briar-android/res/values/strings.xml          |  3 ++-
 .../keyagreement/ShowQrCodeFragment.java      |  2 +-
 4 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/briar-android/res/layout/fragment_keyagreement_id.xml b/briar-android/res/layout/fragment_keyagreement_id.xml
index 73364e5c08..61041ef2f4 100644
--- a/briar-android/res/layout/fragment_keyagreement_id.xml
+++ b/briar-android/res/layout/fragment_keyagreement_id.xml
@@ -21,7 +21,6 @@
 			android:id="@+id/imageView"
 			android:layout_width="match_parent"
 			android:layout_height="wrap_content"
-			android:layout_marginTop="@dimen/margin_xlarge"
 			android:adjustViewBounds="true"
 			android:scaleType="fitCenter"
 			android:src="@drawable/qr_code_intro"
@@ -42,7 +41,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"
+				android:contentDescription="@string/face_to_face"/>
 
 			<TextView
 				style="@style/BriarTextBody"
diff --git a/briar-android/res/layout/fragment_keyagreement_qr.xml b/briar-android/res/layout/fragment_keyagreement_qr.xml
index ec308624b2..c83c2f3b5f 100644
--- a/briar-android/res/layout/fragment_keyagreement_qr.xml
+++ b/briar-android/res/layout/fragment_keyagreement_qr.xml
@@ -33,9 +33,9 @@
 				android:visibility="invisible">
 
 				<ProgressBar
+					style="?android:attr/progressBarStyleLarge"
 					android:layout_width="wrap_content"
-					android:layout_height="wrap_content"
-					android:paddingTop="@dimen/margin_large"/>
+					android:layout_height="wrap_content"/>
 
 				<TextView
 					android:id="@+id/connect_status"
@@ -47,24 +47,25 @@
 			</LinearLayout>
 		</FrameLayout>
 
-		<RelativeLayout
+		<FrameLayout
 			android:layout_width="match_parent"
 			android:layout_height="0dp"
 			android:layout_weight="1"
 			android:background="@android:color/white">
 
 			<ProgressBar
+				style="?android:attr/progressBarStyleLarge"
 				android:layout_width="wrap_content"
 				android:layout_height="wrap_content"
-				android:layout_centerInParent="true"
-				android:paddingTop="@dimen/margin_large"/>
+				android:layout_gravity="center"/>
 
 			<ImageView
 				android:id="@+id/qr_code"
 				android:layout_width="match_parent"
 				android:layout_height="match_parent"
-				android:scaleType="fitCenter"/>
-		</RelativeLayout>
+				android:scaleType="fitCenter"
+				android:layout_gravity="center"/>
+		</FrameLayout>
 	</LinearLayout>
 
 	<RelativeLayout
@@ -79,17 +80,17 @@
 			style="?android:attr/progressBarStyleLarge"
 			android:layout_width="wrap_content"
 			android:layout_height="wrap_content"
-			android:layout_centerInParent="true"/>
+			android:layout_above="@+id/title_progress_bar"
+			android:layout_centerHorizontal="true"/>
 
 		<TextView
 			android:id="@+id/title_progress_bar"
 			android:layout_width="match_parent"
 			android:layout_height="wrap_content"
-			android:layout_below="@id/progress_bar"
+			android:layout_centerInParent="true"
 			android:gravity="center"
 			android:paddingTop="@dimen/margin_large"
-			tools:text="progress bar title"
-			/>
+			tools:text="@string/waiting_for_contact_to_scan"/>
 	</RelativeLayout>
 
 </FrameLayout>
diff --git a/briar-android/res/values/strings.xml b/briar-android/res/values/strings.xml
index 73046ee630..d1c7834abb 100644
--- a/briar-android/res/values/strings.xml
+++ b/briar-android/res/values/strings.xml
@@ -90,7 +90,7 @@
 	<!-- Adding Contacts -->
 	<string name="add_contact_title">Add a Contact</string>
 	<string name="your_nickname">Choose the identity you want to use:</string>
-	<string name="face_to_face">You must be face-to-face with the person you want to add as a contact. This will prevent anyone from impersonating you or reading your messages in future.</string>
+	<string name="face_to_face">You must meet up with the person you want to add as a contact.\n\nThis will prevent anyone from impersonating you or reading your messages in future.</string>
 	<string name="continue_button">Continue</string>
 	<string name="your_invitation_code">Your invitation code is</string>
 	<string name="enter_invitation_code">Please enter your contact\'s invitation code:</string>
@@ -104,6 +104,7 @@
 	<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="waiting_for_contact_to_scan">Waiting for contact to scan and connect\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>
diff --git a/briar-android/src/org/briarproject/android/keyagreement/ShowQrCodeFragment.java b/briar-android/src/org/briarproject/android/keyagreement/ShowQrCodeFragment.java
index fc5d286b0d..0f4704ca9c 100644
--- a/briar-android/src/org/briarproject/android/keyagreement/ShowQrCodeFragment.java
+++ b/briar-android/src/org/briarproject/android/keyagreement/ShowQrCodeFragment.java
@@ -337,7 +337,7 @@ public class ShowQrCodeFragment extends BaseEventFragment
 		listener.runOnUiThreadUnlessDestroyed(new Runnable() {
 			@Override
 			public void run() {
-				status.setText(R.string.waiting_for_contact);
+				status.setText(R.string.waiting_for_contact_to_scan);
 			}
 		});
 	}
-- 
GitLab