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

Commit 08b06523 authored by Brandon Dayauon's avatar Brandon Dayauon
Browse files

Collapse private space container and animate header.

- Just opposite of how it will expand.
- RecyclerView.SmoothScroller is needed to scroll the container.

- Need to separate the lock button because this way I can use animateLayout changes and it itself was its own drawable. Separated into icon and textView in a viewGroup.
- Give the background the 10padding on the left and right so that when in animation, the icon can adjust the padding/margins there.
- Using propertySetter to set animation
- Animates the alpha of the settings alpha

- updated test to account for the nested child views the test needs to inspect

bug: 299294792
test: manual:
Expand + Collapse Video: https://drive.google.com/file/d/1Og66eqmXv3THn0wO4_x6Tfp2AbwFWUwZ/view?usp=sharing
Flag: ACONFIG com.android.launcher3.Flags.private_space_animation TEAMFOOD

Change-Id: I96f1d172a481522d23b4cee996ddec65961fce78
parent 772e0127
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 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.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="20dp"
    android:height="20dp"
    android:viewportWidth="960"
    android:viewportHeight="960">
    <path
        android:fillColor="?attr/materialColorOnPrimaryFixed"
        android:pathData="M263.72,864Q234,864 213,842.85Q192,821.7 192,792L192,408Q192,378.3 213.15,357.15Q234.3,336 264,336L288,336L288,240Q288,160.32 344.23,104.16Q400.45,48 480.23,48Q560,48 616,104.16Q672,160.32 672,240L672,336L696,336Q725.7,336 746.85,357.15Q768,378.3 768,408L768,792Q768,821.7 746.84,842.85Q725.68,864 695.96,864L263.72,864ZM264,792L696,792Q696,792 696,792Q696,792 696,792L696,408Q696,408 696,408Q696,408 696,408L264,408Q264,408 264,408Q264,408 264,408L264,792Q264,792 264,792Q264,792 264,792ZM480.21,672Q510,672 531,650.79Q552,629.58 552,599.79Q552,570 530.79,549Q509.58,528 479.79,528Q450,528 429,549.21Q408,570.42 408,600.21Q408,630 429.21,651Q450.42,672 480.21,672ZM360,336L600,336L600,240Q600,190 565,155Q530,120 480,120Q430,120 395,155Q360,190 360,240L360,336ZM264,792Q264,792 264,792Q264,792 264,792L264,408Q264,408 264,408Q264,408 264,408L264,408Q264,408 264,408Q264,408 264,408L264,792Q264,792 264,792Q264,792 264,792L264,792Z"/>
</vector>
+1 −4
Original line number Diff line number Diff line
@@ -15,13 +15,10 @@
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="@dimen/ps_button_height"
    android:width="@dimen/ps_button_width"
    android:height="@dimen/ps_button_height"
    android:viewportWidth="40"
    android:viewportHeight="40">
    <path
        android:pathData="M20,0L20,0A20,20 0,0 1,40 20L40,20A20,20 0,0 1,20 40L20,40A20,20 0,0 1,0 20L0,20A20,20 0,0 1,20 0z"
        android:fillColor="?attr/materialColorSurfaceBright"/>
    <group>
        <clip-path
            android:pathData="M10,10h20v20h-20z"/>
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2024 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.
  -->

<inset xmlns:android="http://schemas.android.com/apk/res/android"
    android:inset="4dp">
    <shape android:shape="rectangle">
        <corners android:radius="@dimen/ps_lock_corner_radius" />
        <solid android:color="?attr/materialColorPrimaryFixedDim" />
        <padding
            android:left="@dimen/ps_lock_button_background_padding"
            android:right="@dimen/ps_lock_button_background_padding" />
    </shape>
</inset>
 No newline at end of file
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 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.
  -->

<inset xmlns:android="http://schemas.android.com/apk/res/android"
    android:inset="4dp">
    <shape android:shape="rectangle">
        <corners android:radius="@dimen/ps_lock_corner_radius" />
        <solid android:color="?attr/materialColorSurfaceBright" />
    </shape>
</inset>
 No newline at end of file
+47 −19
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
<RelativeLayout
        android:id="@+id/ps_header_layout"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="@dimen/ps_header_height"
        android:background="@drawable/bg_ps_header"
@@ -25,27 +26,53 @@
        android:gravity="center_vertical"
        android:orientation="horizontal">

    <ImageButton
        android:id="@+id/ps_lock_unlock_button"
    <LinearLayout
        android:id="@+id/settingsAndLockGroup"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/ps_header_image_height"
        android:layout_alignParentEnd="true"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:background="@android:color/transparent"
        android:layout_marginEnd="@dimen/ps_header_layout_margin"
        android:contentDescription="@string/ps_container_lock_unlock_button" />

        android:gravity="center_vertical"
        android:layout_alignParentEnd="true"
        android:animateLayoutChanges="true">
        <ImageButton
            android:id="@+id/ps_settings_button"
        android:layout_width="wrap_content"
            android:layout_width="@dimen/ps_header_image_height"
            android:layout_height="@dimen/ps_header_image_height"
        android:layout_toStartOf="@+id/ps_lock_unlock_button"
        android:layout_centerVertical="true"
        android:background="@android:color/transparent"
            android:background="@drawable/ps_settings_background"
            android:layout_marginEnd="@dimen/ps_header_settings_icon_margin_end"
        android:src="@drawable/bg_ps_settings_button"
            android:src="@drawable/ic_ps_settings"
            android:contentDescription="@string/ps_container_settings" />

        <LinearLayout
            android:id="@+id/ps_lock_unlock_button"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/ps_header_image_height"
            android:background="@drawable/ps_lock_background"
            android:gravity="center_vertical"
            android:layout_marginEnd="@dimen/ps_header_layout_margin"
            android:contentDescription="@string/ps_container_lock_unlock_button">
            <ImageView
                android:id="@+id/lock_icon"
                android:layout_width="@dimen/ps_lock_icon_size"
                android:layout_height="@dimen/ps_lock_icon_size"
                android:layout_marginTop="@dimen/ps_lock_icon_margin_top"
                android:layout_marginBottom="@dimen/ps_lock_icon_margin_bottom"
                android:importantForAccessibility="no"
                android:src="@drawable/ic_lock"
                app:tint="@color/material_color_primary_fixed_dim"
                android:scaleType="center"/>
            <TextView
                android:id="@+id/lock_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="@dimen/ps_lock_icon_text_margin_start_expanded"
                android:layout_marginEnd="@dimen/ps_lock_icon_text_margin_end_expanded"
                android:textColor="@color/material_color_on_primary_fixed"
                android:textSize="14sp"
                android:text="@string/ps_container_lock_title"
                android:visibility="gone"
                style="@style/TextHeadline"/>
        </LinearLayout>
    </LinearLayout>
    <ImageView
        android:id="@+id/ps_transition_image"
        android:layout_width="wrap_content"
@@ -63,6 +90,7 @@
        android:layout_height="@dimen/ps_header_text_height"
        android:layout_alignParentStart="true"
        android:layout_centerVertical="true"
        android:layout_toStartOf="@+id/settingsAndLockGroup"
        android:gravity="center_vertical"
        android:layout_marginStart="@dimen/ps_header_layout_margin"
        android:text="@string/ps_container_title"
Loading