Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc2b2c79 authored by Yi-Ling Chuang's avatar Yi-Ling Chuang
Browse files

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
parent d50bb098
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+37 −29
Original line number Diff line number Diff line
@@ -21,6 +21,12 @@
    android:layout_height="wrap_content"
    style="@style/ContextualCardStyle">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <include layout="@layout/dismissal_swipe_background"/>

        <ViewFlipper
            android:id="@+id/view_flipper"
            android:layout_width="match_parent"
@@ -33,6 +39,7 @@
                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">

                <ImageView
@@ -58,4 +65,5 @@
            <include layout="@layout/homepage_dismissal_view"/>

        </ViewFlipper>
    </FrameLayout>
</com.google.android.material.card.MaterialCardView>
 No newline at end of file
+28 −14
Original line number Diff line number Diff line
@@ -21,11 +21,23 @@
    android:layout_height="wrap_content"
    style="@style/ContextualCardStyle">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <include layout="@layout/dismissal_swipe_background"/>

        <ViewFlipper
            android:id="@+id/view_flipper"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/slice_view_wrapper"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/contextual_card_background">

                <androidx.slice.widget.SliceView
                    android:id="@+id/slice_view"
                    android:layout_width="match_parent"
@@ -33,9 +45,11 @@
                    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>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -492,6 +492,7 @@
        <item name="android:paddingEnd">8dp</item>

        <item name="rowStyle">@style/SliceRowStyle</item>
        <item name="android:background">@color/contextual_card_background</item>
    </style>

    <style name="SliceRowStyle">
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.settings.homepage.contextualcards.slices;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;

import androidx.recyclerview.widget.RecyclerView;
import androidx.slice.Slice;
@@ -70,10 +71,12 @@ class SliceFullCardRendererHelper {

    static class SliceViewHolder extends RecyclerView.ViewHolder {
        public final SliceView sliceView;
        public final LinearLayout sliceViewWrapper;

        public SliceViewHolder(View view) {
            super(view);
            sliceView = view.findViewById(R.id.slice_view);
            sliceViewWrapper = view.findViewById(R.id.slice_view_wrapper);
        }
    }
}
Loading