From 8c80da783ff8e3ee97e597c7e0ac1f80f8a320b7 Mon Sep 17 00:00:00 2001 From: Craig Russell Date: Tue, 31 Oct 2023 20:44:09 +0000 Subject: [PATCH] Apply max-width constraints to autofill dialogs' contents (#3773) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task/Issue URL: https://app.asana.com/0/0/1205495150811754/f ### Description We want to apply a max-width constraint to the contents of the autofill dialogs. Some of the autofill dialogs had different ways of constraining content before, and others had none; this PR consolidates them all into using this approach: - Guideline left set to 10% from left edge of dialog, guideline right set to 10% from right edge of dialog - Autofill dialog content can use the remaining 80% of dialog width, up to max of `480dp` ℹ️ Note for reviewing the PR: - a lot of the _changes_ are caused by indentation as views are now inside another view group - tip: hide whitespace differences to see only what's actually changed, ignoring the change indentation Screenshot 2023-10-31 at 12 34 27 ### Steps to test this PR _Save login prompt_ - [x] Visit https://fill.dev/form/login-simple and enter username [`abcd`] and password (>= 4 chars) - [x] Verify save prompt looks ok _Select login prompt_ - [x] Visit https://fill.dev/form/login-simple again - [x] verify prompt to login with saved credential looks ok _Update login prompt_ - [x] Visit https://fill.dev/form/login-simple again and dismiss any prompts to use a saved login - [x] Instead, enter same username as before `abcd` and a new password - [x] Verify the update login prompt looks ok _Generate password prompt_ - [x] Visit https://fill.dev/form/registration-email and tap on password field - [x] Verify generate password prompts looks ok _Email protection in-context signup_ - [x] Visit https://fill.dev/form/registration-email when you're **not** signed into email protection (requires device to be in English locale) - [x] Tap on grey Dax in email field; verify the prompt to sign up for email protection looks ok _Email protection, signed in state_ - [x] Sign into email protection (doesn't matter how you sign in, in-context or normal approach from settings) - [x] Visit https://fill.dev/form/registration-email again, and tap on email field - [x] Verify the prompt to use Email Protection looks ok ### UI changes Screenshots available [here](https://app.asana.com/0/0/1205842983551006/f) for phones and tablets, portrait and landscape --- ...tent_autofill_generate_password_dialog.xml | 163 +++++++++------- .../content_autofill_save_new_credentials.xml | 179 +++++++++--------- ...nt_autofill_select_credentials_tooltip.xml | 116 +++++++----- ...t_autofill_update_existing_credentials.xml | 154 ++++++++------- .../dialog_email_protection_choose_email.xml | 95 ++++++---- ...og_email_protection_in_context_sign_up.xml | 166 ++++++++-------- .../res/values/autofill-impl-dimensions.xml | 1 + .../src/main/res/values/styles.xml | 14 ++ 8 files changed, 483 insertions(+), 405 deletions(-) diff --git a/autofill/autofill-impl/src/main/res/layout/content_autofill_generate_password_dialog.xml b/autofill/autofill-impl/src/main/res/layout/content_autofill_generate_password_dialog.xml index 6e5ad8642f74..74d9171baaa0 100644 --- a/autofill/autofill-impl/src/main/res/layout/content_autofill_generate_password_dialog.xml +++ b/autofill/autofill-impl/src/main/res/layout/content_autofill_generate_password_dialog.xml @@ -28,86 +28,105 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + + + + + app:layout_constraintWidth_max="@dimen/autofillBottomSheetContentMaxWidth" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="@id/guidelineStart" + app:layout_constraintEnd_toEndOf="@id/guidelineEnd"> - + - + - + - + - + + + + + \ No newline at end of file diff --git a/autofill/autofill-impl/src/main/res/layout/content_autofill_save_new_credentials.xml b/autofill/autofill-impl/src/main/res/layout/content_autofill_save_new_credentials.xml index 6d4b99231e65..84995b19201e 100644 --- a/autofill/autofill-impl/src/main/res/layout/content_autofill_save_new_credentials.xml +++ b/autofill/autofill-impl/src/main/res/layout/content_autofill_save_new_credentials.xml @@ -14,117 +14,114 @@ ~ limitations under the License. --> - - + + + + style="@style/AutofillDialogContentGuidelineStart" /> - - + style="@style/AutofillDialogContentGuidelineEnd" /> - + app:layout_constraintEnd_toEndOf="@id/guidelineEnd"> - + + + + + + + - - - - - - - - - - - + android:id="@+id/dialogTitle" + android:breakStrategy="balanced" + android:text="@string/saveLoginDialogTitle" + android:layout_marginTop="@dimen/keyline_5" + android:gravity="center_horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/siteDetailsContainer" + app:typography="h2" /> + + + + + + + + diff --git a/autofill/autofill-impl/src/main/res/layout/content_autofill_select_credentials_tooltip.xml b/autofill/autofill-impl/src/main/res/layout/content_autofill_select_credentials_tooltip.xml index b6979e2d7e1e..93e4beafa158 100644 --- a/autofill/autofill-impl/src/main/res/layout/content_autofill_select_credentials_tooltip.xml +++ b/autofill/autofill-impl/src/main/res/layout/content_autofill_select_credentials_tooltip.xml @@ -14,8 +14,7 @@ ~ limitations under the License. --> - @@ -26,59 +25,76 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + - + - + + + android:layout_marginTop="40dp" + android:gravity="center" + android:orientation="horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + - + - + + + + + + \ No newline at end of file diff --git a/autofill/autofill-impl/src/main/res/layout/content_autofill_update_existing_credentials.xml b/autofill/autofill-impl/src/main/res/layout/content_autofill_update_existing_credentials.xml index b197fc23f5f8..fd416aec0507 100644 --- a/autofill/autofill-impl/src/main/res/layout/content_autofill_update_existing_credentials.xml +++ b/autofill/autofill-impl/src/main/res/layout/content_autofill_update_existing_credentials.xml @@ -28,82 +28,100 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + - + - + + + android:layout_marginTop="40dp" + android:gravity="center" + android:orientation="horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + - + - + - + - + + + + + + \ No newline at end of file diff --git a/autofill/autofill-impl/src/main/res/layout/dialog_email_protection_choose_email.xml b/autofill/autofill-impl/src/main/res/layout/dialog_email_protection_choose_email.xml index d0a2c2f7438d..9199cef495e9 100644 --- a/autofill/autofill-impl/src/main/res/layout/dialog_email_protection_choose_email.xml +++ b/autofill/autofill-impl/src/main/res/layout/dialog_email_protection_choose_email.xml @@ -30,52 +30,65 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + + + + + app:layout_constraintWidth_max="@dimen/autofillBottomSheetContentMaxWidth" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="@id/guidelineStart" + app:layout_constraintEnd_toEndOf="@id/guidelineEnd"> - + - + + + + diff --git a/autofill/autofill-impl/src/main/res/layout/dialog_email_protection_in_context_sign_up.xml b/autofill/autofill-impl/src/main/res/layout/dialog_email_protection_in_context_sign_up.xml index f9e1fb1d9cf1..fe23a14692fd 100644 --- a/autofill/autofill-impl/src/main/res/layout/dialog_email_protection_in_context_sign_up.xml +++ b/autofill/autofill-impl/src/main/res/layout/dialog_email_protection_in_context_sign_up.xml @@ -16,110 +16,110 @@ - - - - - + + + + + app:layout_constraintEnd_toEndOf="@id/guidelineEnd"> - + + + + + + + - - + android:id="@+id/dialogTitle" + android:breakStrategy="balanced" + android:text="@string/autofillEmailProtectionInContextSignUpDialogTitle" + android:layout_marginTop="@dimen/keyline_5" + android:gravity="center_horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/siteDetailsContainer" + app:typography="h2" /> - - - - - - - + + + + + + diff --git a/autofill/autofill-impl/src/main/res/values/autofill-impl-dimensions.xml b/autofill/autofill-impl/src/main/res/values/autofill-impl-dimensions.xml index a7a3c1359e3d..8d1305db35b8 100644 --- a/autofill/autofill-impl/src/main/res/values/autofill-impl-dimensions.xml +++ b/autofill/autofill-impl/src/main/res/values/autofill-impl-dimensions.xml @@ -17,4 +17,5 @@ 200dp 30dp + 480dp \ No newline at end of file diff --git a/autofill/autofill-impl/src/main/res/values/styles.xml b/autofill/autofill-impl/src/main/res/values/styles.xml index 4d35b6b4037c..3921ffce2e96 100644 --- a/autofill/autofill-impl/src/main/res/values/styles.xml +++ b/autofill/autofill-impl/src/main/res/values/styles.xml @@ -52,4 +52,18 @@ @drawable/ic_close_24 + + + + \ No newline at end of file