forked from chromium/chromium
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-adds ripple effect to all touchable surfaces. Fixes the previous issues of background re-usage by using a custom RippleDrawable that prevents sharing. (cherry picked from commit 03226c2) Bug: 1334642,1419775 Change-Id: I7ed24e19566494aee0c1eacb6b9f035b2e0ccba7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4288774 Commit-Queue: Wolfgang Billenstein <bwolfgang@google.com> Reviewed-by: Norge Vizcay <vizcay@google.com> Cr-Original-Commit-Position: refs/heads/main@{#1110200} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4295278 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Cr-Commit-Position: refs/branch-heads/5615@{#52} Cr-Branched-From: 9c6408e-refs/heads/main@{#1109224}
- Loading branch information
Wolfgang Billenstein
authored and
Chromium LUCI CQ
committed
Feb 28, 2023
1 parent
aa7d518
commit e592e2e
Showing
12 changed files
with
109 additions
and
97 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
22 changes: 22 additions & 0 deletions
22
...r/ui/android/fast_checkout/internal/java/res/drawable/fast_checkout_background_bottom.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,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2023 The Chromium Authors | ||
Use of this source code is governed by a BSD-style license that can be | ||
found in the LICENSE file. | ||
--> | ||
<org.chromium.chrome.browser.ui.fast_checkout.UnsharableRippleDrawable | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:color="?android:attr/colorControlHighlight"> | ||
<item> | ||
<org.chromium.components.browser_ui.widget.SurfaceColorDrawable | ||
android:shape="rectangle" | ||
app:surfaceElevation="@dimen/default_elevation_1"> | ||
<!-- TODO(crbug.com/1354596): Merge background resource for TTF Payments/Passwords and FC. --> | ||
<corners android:topLeftRadius="@dimen/fast_checkout_inner_corner_radius" | ||
android:topRightRadius="@dimen/fast_checkout_inner_corner_radius" | ||
android:bottomLeftRadius="@dimen/fast_checkout_outer_corner_radius" | ||
android:bottomRightRadius="@dimen/fast_checkout_outer_corner_radius" /> | ||
</org.chromium.components.browser_ui.widget.SurfaceColorDrawable> | ||
</item> | ||
</org.chromium.chrome.browser.ui.fast_checkout.UnsharableRippleDrawable> |
18 changes: 18 additions & 0 deletions
18
...r/ui/android/fast_checkout/internal/java/res/drawable/fast_checkout_background_middle.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,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2023 The Chromium Authors | ||
Use of this source code is governed by a BSD-style license that can be | ||
found in the LICENSE file. | ||
--> | ||
<org.chromium.chrome.browser.ui.fast_checkout.UnsharableRippleDrawable | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:color="?android:attr/colorControlHighlight"> | ||
<item> | ||
<org.chromium.components.browser_ui.widget.SurfaceColorDrawable | ||
android:shape="rectangle" | ||
app:surfaceElevation="@dimen/default_elevation_1"> | ||
<corners android:radius="@dimen/fast_checkout_inner_corner_radius" /> | ||
</org.chromium.components.browser_ui.widget.SurfaceColorDrawable> | ||
</item> | ||
</org.chromium.chrome.browser.ui.fast_checkout.UnsharableRippleDrawable> |
22 changes: 22 additions & 0 deletions
22
...wser/ui/android/fast_checkout/internal/java/res/drawable/fast_checkout_background_top.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,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2023 The Chromium Authors | ||
Use of this source code is governed by a BSD-style license that can be | ||
found in the LICENSE file. | ||
--> | ||
<org.chromium.chrome.browser.ui.fast_checkout.UnsharableRippleDrawable | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:color="?android:attr/colorControlHighlight"> | ||
<item> | ||
<org.chromium.components.browser_ui.widget.SurfaceColorDrawable | ||
android:shape="rectangle" | ||
app:surfaceElevation="@dimen/default_elevation_1"> | ||
<!-- TODO(crbug.com/1354596): Merge background resource for TTF Payments/Passwords and FC. --> | ||
<corners android:topLeftRadius="@dimen/fast_checkout_outer_corner_radius" | ||
android:topRightRadius="@dimen/fast_checkout_outer_corner_radius" | ||
android:bottomLeftRadius="@dimen/fast_checkout_inner_corner_radius" | ||
android:bottomRightRadius="@dimen/fast_checkout_inner_corner_radius" /> | ||
</org.chromium.components.browser_ui.widget.SurfaceColorDrawable> | ||
</item> | ||
</org.chromium.chrome.browser.ui.fast_checkout.UnsharableRippleDrawable> |
20 changes: 0 additions & 20 deletions
20
...fast_checkout/internal/java/res/drawable/fast_checkout_home_screen_address_background.xml
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
...roid/fast_checkout/internal/java/res/drawable/fast_checkout_home_screen_cc_background.xml
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
...android/fast_checkout/internal/java/res/drawable/fast_checkout_item_background_bottom.xml
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
...ui/android/fast_checkout/internal/java/res/drawable/fast_checkout_item_background_top.xml
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...id/fast_checkout/internal/java/res/drawable/fast_checkout_list_view_background_middle.xml
This file was deleted.
Oops, something went wrong.
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
38 changes: 38 additions & 0 deletions
38
...ernal/java/src/org/chromium/chrome/browser/ui/fast_checkout/UnsharableRippleDrawable.java
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,38 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package org.chromium.chrome.browser.ui.fast_checkout; | ||
|
||
import android.content.res.ColorStateList; | ||
import android.graphics.drawable.Drawable; | ||
import android.graphics.drawable.RippleDrawable; | ||
|
||
/** | ||
* RippleDrawable that does not allow sharing across views. Returns a constant state of null. | ||
*/ | ||
public class UnsharableRippleDrawable extends RippleDrawable { | ||
private static final ColorStateList DUMMY_COLOR = ColorStateList.valueOf(0xFFFFFF); | ||
|
||
public UnsharableRippleDrawable(ColorStateList color, Drawable content, Drawable mask) { | ||
super(color, content, mask); | ||
} | ||
|
||
/** | ||
* Constructor used for drawable inflation. Ideally this would call `super()` which is package | ||
* private unfortunately. The public constructor's color parameter must not be null. The color | ||
* passed during inflation will be overridden by the color set in the xml. The color xml | ||
* attribute is required so passing any color here should not cause any unintended issues. | ||
*/ | ||
public UnsharableRippleDrawable() { | ||
this(DUMMY_COLOR, null, null); | ||
} | ||
|
||
@Override | ||
public ConstantState getConstantState() { | ||
// Returning null means that these drawables will not be able to be shared. This avoids | ||
// issues with RecyclerView when backgrounds are shared and as result don't always fully | ||
// cover items of different heights. | ||
return null; | ||
} | ||
} |
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