From 91492c3068bda0684fd33b278f7ad78ab8fa2743 Mon Sep 17 00:00:00 2001 From: Torsten Grote <t@grobox.de> Date: Mon, 27 Jun 2016 14:24:48 -0300 Subject: [PATCH] Improve Account Setup Screen * Explain what "account creation" means on first run * Use hints instead of dedicated text views * Move password strength meter up into the user's view * Always move user's view to current input field * Improve "Forgot Password" dialog Closes #151 --- briar-android/AndroidManifest.xml | 3 +- briar-android/res/layout/activity_setup.xml | 70 ++++++++----------- briar-android/res/values/strings.xml | 9 +-- .../android/PasswordActivity.java | 4 +- .../briarproject/android/SetupActivity.java | 3 +- 5 files changed, 39 insertions(+), 50 deletions(-) diff --git a/briar-android/AndroidManifest.xml b/briar-android/AndroidManifest.xml index 2d8dc0223d..ea3126ed0c 100644 --- a/briar-android/AndroidManifest.xml +++ b/briar-android/AndroidManifest.xml @@ -67,7 +67,8 @@ <activity android:name=".android.SetupActivity" - android:label="@string/setup_title"> + android:label="@string/setup_title" + android:windowSoftInputMode="adjustResize"> </activity> <activity diff --git a/briar-android/res/layout/activity_setup.xml b/briar-android/res/layout/activity_setup.xml index be95d79fcd..fe77e491df 100644 --- a/briar-android/res/layout/activity_setup.xml +++ b/briar-android/res/layout/activity_setup.xml @@ -2,8 +2,10 @@ <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + tools:context=".android.SetupActivity"> <RelativeLayout android:layout_width="match_parent" @@ -17,109 +19,93 @@ android:paddingTop="@dimen/margin_activity_vertical"> <TextView - android:id="@+id/nickname_title" - style="@style/BriarTextTitle" - android:layout_width="wrap_content" + android:id="@+id/setup_explanation" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_centerHorizontal="true" - android:text="@string/choose_nickname" - android:textSize="@dimen/text_size_medium"/> + android:text="@string/setup_explanation"/> <android.support.design.widget.TextInputLayout android:id="@+id/nickname_entry_wrapper" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_below="@+id/setup_explanation" android:layout_centerHorizontal="true" - android:layout_below="@id/nickname_title" + android:layout_marginTop="@dimen/margin_medium" app:errorEnabled="true"> - <EditText + <android.support.design.widget.TextInputEditText android:id="@+id/nickname_entry" android:layout_width="match_parent" android:layout_height="wrap_content" + android:hint="@string/choose_nickname" + android:imeOptions="actionNext" android:inputType="text|textCapWords" android:maxLines="1"/> </android.support.design.widget.TextInputLayout> - <TextView - android:id="@+id/password_title" - style="@style/BriarTextTitle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_centerHorizontal="true" - android:layout_below="@id/nickname_entry_wrapper" - android:text="@string/choose_password" - android:textSize="@dimen/text_size_medium"/> - <android.support.design.widget.TextInputLayout android:id="@+id/password_entry_wrapper" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_below="@+id/nickname_entry_wrapper" android:layout_centerHorizontal="true" - android:layout_below="@id/password_title" app:errorEnabled="true"> - <EditText + <android.support.design.widget.TextInputEditText android:id="@+id/password_entry" android:layout_width="match_parent" android:layout_height="wrap_content" + android:hint="@string/choose_password" + android:imeOptions="actionNext" android:inputType="textPassword" android:maxLines="1"/> </android.support.design.widget.TextInputLayout> - <TextView - android:id="@+id/password_confirm_title" - style="@style/BriarTextTitle" - android:layout_width="wrap_content" + <org.briarproject.android.util.StrengthMeter + android:id="@+id/strength_meter" + android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_below="@+id/password_entry_wrapper" android:layout_centerHorizontal="true" - android:layout_below="@id/password_entry_wrapper" - android:text="@string/confirm_password" - android:textSize="@dimen/text_size_medium"/> + android:layout_marginBottom="@dimen/margin_medium" + android:visibility="gone"/> <android.support.design.widget.TextInputLayout android:id="@+id/password_confirm_wrapper" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_below="@+id/strength_meter" android:layout_centerHorizontal="true" - android:layout_below="@id/password_confirm_title" app:errorEnabled="true"> - <EditText + <android.support.design.widget.TextInputEditText android:id="@+id/password_confirm" android:layout_width="match_parent" android:layout_height="wrap_content" - android:inputType="textPassword" + android:hint="@string/confirm_password" android:imeOptions="actionDone" + android:inputType="textPassword" android:maxLines="1"/> </android.support.design.widget.TextInputLayout> - <org.briarproject.android.util.StrengthMeter - android:id="@+id/strength_meter" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_centerHorizontal="true" - android:layout_below="@id/password_confirm_wrapper" - android:visibility="invisible"/> - <Button android:id="@+id/create_account" style="@style/BriarButton.Default" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_below="@+id/password_confirm_wrapper" android:layout_centerHorizontal="true" - android:layout_below="@id/strength_meter" - android:layout_marginTop="@dimen/margin_medium" android:enabled="false" android:text="@string/create_account_button"/> <ProgressBar android:id="@+id/progress_wheel" + style="?android:attr/progressBarStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@id/create_account" android:layout_centerHorizontal="true" - android:visibility="invisible" /> + android:visibility="invisible"/> </RelativeLayout> diff --git a/briar-android/res/values/strings.xml b/briar-android/res/values/strings.xml index b1fc55713e..5dfab8627c 100644 --- a/briar-android/res/values/strings.xml +++ b/briar-android/res/values/strings.xml @@ -14,9 +14,10 @@ <string name="ongoing_notification_title">Signed into Briar</string> <string name="ongoing_notification_text">Touch to open Briar.</string> <string name="setup_title">Briar Setup</string> - <string name="choose_nickname">Choose your nickname:</string> - <string name="choose_password">Choose your password:</string> - <string name="confirm_password">Confirm your password:</string> + <string name="setup_explanation">Your Briar account is stored encrypted on your device, not in the cloud. If you uninstall Briar or forget your password, there\'s no way to recover your account and your data.</string> + <string name="choose_nickname">Choose your nickname</string> + <string name="choose_password">Choose your password</string> + <string name="confirm_password">Confirm your password</string> <string name="name_too_long">Name is too long</string> <string name="password_too_weak">Password is too weak</string> <string name="passwords_do_not_match">Passwords do not match</string> @@ -222,7 +223,7 @@ <!-- Dialogs --> <string name="dialog_title_lost_password">Lost Password</string> - <string name="dialog_message_lost_password">Password recovery is not possible. Do you want to delete your account?\n\nCaution: This will permanently delete your identities, contacts and messages</string> + <string name="dialog_message_lost_password">Your Briar account is stored encrypted on your device, not in the cloud, so we can\'t reset your password. Would you like to delete your account and start again?\n\nCaution: Your identities, contacts and messages will be permanently lost.</string> <string name="dialog_title_delete_contact">Confirm Contact Deletion</string> <string name="dialog_message_delete_contact">Are you sure that you want to remove this contact and all messages exchanged with this contact?</string> <string name="dialog_title_connect_panic_app">Confirm Panic App</string> diff --git a/briar-android/src/org/briarproject/android/PasswordActivity.java b/briar-android/src/org/briarproject/android/PasswordActivity.java index 5fa6eebf52..321f6c4a1b 100644 --- a/briar-android/src/org/briarproject/android/PasswordActivity.java +++ b/briar-android/src/org/briarproject/android/PasswordActivity.java @@ -109,8 +109,8 @@ public class PasswordActivity extends BaseActivity { R.style.BriarDialogTheme); builder.setTitle(R.string.dialog_title_lost_password); builder.setMessage(R.string.dialog_message_lost_password); - builder.setNegativeButton(R.string.cancel_button, null); - builder.setPositiveButton(R.string.delete_button, + builder.setPositiveButton(R.string.cancel_button, null); + builder.setNegativeButton(R.string.delete_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { diff --git a/briar-android/src/org/briarproject/android/SetupActivity.java b/briar-android/src/org/briarproject/android/SetupActivity.java index 9080e1722f..db57956c50 100644 --- a/briar-android/src/org/briarproject/android/SetupActivity.java +++ b/briar-android/src/org/briarproject/android/SetupActivity.java @@ -25,6 +25,7 @@ import org.briarproject.util.StringUtils; import javax.inject.Inject; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; +import static android.view.View.GONE; import static android.view.View.INVISIBLE; import static android.view.View.VISIBLE; import static org.briarproject.api.crypto.PasswordStrengthEstimator.WEAK; @@ -98,7 +99,7 @@ public class SetupActivity extends BaseActivity implements OnClickListener, if (progress == null) return; // Not created yet if (passwordEntry.getText().length() > 0 && passwordEntry.hasFocus()) strengthMeter.setVisibility(VISIBLE); - else strengthMeter.setVisibility(INVISIBLE); + else strengthMeter.setVisibility(GONE); String nickname = nicknameEntry.getText().toString(); int nicknameLength = StringUtils.toUtf8(nickname).length; String firstPassword = passwordEntry.getText().toString(); -- GitLab