From dc2b2c7929ffbf4d30a549e8df692885d2fc873e Mon Sep 17 00:00:00 2001 From: Yi-Ling Chuang Date: Fri, 29 Mar 2019 22:44:27 +0800 Subject: [PATCH] Inflate dismissal background instead of drawing while swiping - Only swipe the foreground out to have the background revealed. - Inflate dismissal_swipe_background.xml while swiping. - Fix the fly-in transition. - Fix the overlapping problem. Bug: 129742618 Test: robotests Change-Id: I5311e50332d0ea0437d1693d075d5c3a2176a443 --- res/layout/dismissal_swipe_background.xml | 46 +++++++++++++ res/layout/homepage_slice_half_tile.xml | 64 ++++++++++-------- res/layout/homepage_slice_tile.xml | 38 +++++++---- res/values/styles.xml | 1 + .../slices/SliceFullCardRendererHelper.java | 3 + .../slices/SwipeDismissalDelegate.java | 65 +++++++++---------- .../SliceContextualCardRendererTest.java | 4 +- .../slices/SwipeDismissalDelegateTest.java | 4 +- 8 files changed, 147 insertions(+), 78 deletions(-) create mode 100644 res/layout/dismissal_swipe_background.xml diff --git a/res/layout/dismissal_swipe_background.xml b/res/layout/dismissal_swipe_background.xml new file mode 100644 index 00000000000..49e612993cb --- /dev/null +++ b/res/layout/dismissal_swipe_background.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/homepage_slice_half_tile.xml b/res/layout/homepage_slice_half_tile.xml index 8b6d41525cb..205279dd795 100644 --- a/res/layout/homepage_slice_half_tile.xml +++ b/res/layout/homepage_slice_half_tile.xml @@ -21,41 +21,49 @@ android:layout_height="wrap_content" style="@style/ContextualCardStyle"> - - + + + android:layout_height="match_parent"> - - - + android:layout_height="match_parent" + android:paddingEnd="@dimen/homepage_card_padding_end" + android:paddingTop="@dimen/homepage_half_card_padding_top" + android:paddingBottom="@dimen/homepage_half_card_padding_bottom" + android:background="@color/contextual_card_background" + android:orientation="vertical"> - + - - + - + + + + + + + \ No newline at end of file diff --git a/res/layout/homepage_slice_tile.xml b/res/layout/homepage_slice_tile.xml index ca8791f9c07..b996c7e4777 100644 --- a/res/layout/homepage_slice_tile.xml +++ b/res/layout/homepage_slice_tile.xml @@ -21,21 +21,35 @@ android:layout_height="wrap_content" style="@style/ContextualCardStyle"> - + android:layout_height="match_parent"> - + + + android:layout_height="wrap_content"> - - + - + + + + + + + + \ No newline at end of file diff --git a/res/values/styles.xml b/res/values/styles.xml index 8cd22fe4e96..8c3a633fb43 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -492,6 +492,7 @@ 8dp @style/SliceRowStyle + @color/contextual_card_background