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
This commit is contained in:
46
res/layout/dismissal_swipe_background.xml
Normal file
46
res/layout/dismissal_swipe_background.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2019 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/dismissal_swipe_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/homepage_card_dismissal_background">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dismissal_icon_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_delete"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_marginStart="@dimen/homepage_card_dismissal_side_margin"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dismissal_icon_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_delete"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="@dimen/homepage_card_dismissal_side_margin"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -21,41 +21,49 @@
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/ContextualCardStyle">
|
||||
|
||||
<ViewFlipper
|
||||
android:id="@+id/view_flipper"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
<include layout="@layout/dismissal_swipe_background"/>
|
||||
|
||||
<ViewFlipper
|
||||
android:id="@+id/view_flipper"
|
||||
android:layout_width="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:orientation="vertical">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@dimen/homepage_card_icon_size"
|
||||
android:layout_height="@dimen/homepage_card_icon_size"
|
||||
android:layout_marginStart="@dimen/homepage_card_icon_padding_start"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="2"
|
||||
android:minLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginStart="@dimen/homepage_card_text_padding_start"
|
||||
android:layout_marginTop="@dimen/homepage_half_card_title_margin_top"
|
||||
android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
|
||||
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">
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@dimen/homepage_card_icon_size"
|
||||
android:layout_height="@dimen/homepage_card_icon_size"
|
||||
android:layout_marginStart="@dimen/homepage_card_icon_padding_start"/>
|
||||
|
||||
<!--dismissal view-->
|
||||
<include layout="@layout/homepage_dismissal_view"/>
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="2"
|
||||
android:minLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginStart="@dimen/homepage_card_text_padding_start"
|
||||
android:layout_marginTop="@dimen/homepage_half_card_title_margin_top"
|
||||
android:textAppearance="@style/TextAppearance.ConditionCardTitle"/>
|
||||
|
||||
</ViewFlipper>
|
||||
</LinearLayout>
|
||||
|
||||
<!--dismissal view-->
|
||||
<include layout="@layout/homepage_dismissal_view"/>
|
||||
|
||||
</ViewFlipper>
|
||||
</FrameLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@@ -21,21 +21,35 @@
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/ContextualCardStyle">
|
||||
|
||||
<ViewFlipper
|
||||
android:id="@+id/view_flipper"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.slice.widget.SliceView
|
||||
android:id="@+id/slice_view"
|
||||
<include layout="@layout/dismissal_swipe_background"/>
|
||||
|
||||
<ViewFlipper
|
||||
android:id="@+id/view_flipper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:importantForAccessibility="no"
|
||||
style="@style/SliceViewStyle"/>
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!--dismissal view-->
|
||||
<include layout="@layout/homepage_dismissal_view"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/slice_view_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/contextual_card_background">
|
||||
|
||||
</ViewFlipper>
|
||||
<androidx.slice.widget.SliceView
|
||||
android:id="@+id/slice_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:importantForAccessibility="no"
|
||||
style="@style/SliceViewStyle"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!--dismissal view-->
|
||||
<include layout="@layout/homepage_dismissal_view"/>
|
||||
|
||||
</ViewFlipper>
|
||||
</FrameLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
Reference in New Issue
Block a user