-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored notification rationale dialog as a bottom sheet
Android T+ requires apps to request for notification permission. Chrome does this currently on first startup, and it shows a rationale dialog before the OS prompt to educate users of the usefulness of notifications. Per UX advice this UI should be displayed as a bottom sheet instead of a dialog. This CL introduces a bottom sheet that contains the same UI as the existing rationale dialog. It's behind a flag exposed on chrome://flags. It also removes an alternative set of strings that were used when experimenting with this UI. Bottomsheet screenshot: https://screenshot.googleplex.com/84j6m6brZBz6uSp HSV: https://hsv.googleplex.com/6181362051579904 Bug: 1361424 Change-Id: I70b0d79b71643adc99affeeff264e19d443ce222 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3896995 Commit-Queue: Salvador Guerrero Ramos <salg@google.com> Reviewed-by: Justin DeWitt <dewittj@chromium.org> Reviewed-by: Shakti Sahu <shaktisahu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1095798}
- Loading branch information
Salvador Guerrero
authored and
Chromium LUCI CQ
committed
Jan 23, 2023
1 parent
83f0341
commit 0af3699
Showing
24 changed files
with
686 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
.../notifications/android/java/res/layout/notification_permission_rationale_bottom_sheet.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:orientation="vertical"> | ||
|
||
<ImageView | ||
android:layout_width="250dp" | ||
android:layout_height="0dp" | ||
android:layout_weight="1" | ||
android:layout_marginVertical="24dp" | ||
android:layout_gravity="center_horizontal" | ||
android:importantForAccessibility="no" | ||
android:src="@drawable/notification_permission_rationale_dialog_header" | ||
app:srcCompat="@drawable/notification_permission_rationale_dialog_header" /> | ||
|
||
<TextView | ||
android:id="@+id/notification_permission_rationale_title" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="16dp" | ||
android:text="@string/notification_permission_rationale_dialog_title" | ||
android:textAppearance="@style/TextAppearance.Headline.Primary" /> | ||
|
||
<TextView | ||
android:id="@+id/notification_permission_rationale_message" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="12dp" | ||
android:layout_marginHorizontal="16dp" | ||
android:text="@string/notification_permission_rationale_dialog_message" | ||
android:textAppearance="@style/TextAppearance.TextMedium.Primary" /> | ||
|
||
<org.chromium.ui.widget.ButtonCompat | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:id="@+id/notification_permission_rationale_positive_button" | ||
android:layout_marginTop="28dp" | ||
android:layout_marginHorizontal="16dp" | ||
style="@style/FilledButton.Flat" | ||
android:text="@string/notification_permission_rationale_accept_button_text"/> | ||
|
||
<org.chromium.ui.widget.ButtonCompat | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:id="@+id/notification_permission_rationale_negative_button" | ||
android:layout_marginHorizontal="16dp" | ||
style="@style/TextButton" | ||
android:text="@string/notification_permission_rationale_reject_button_text"/> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.