Files
lawnchair/res/layout/private_space_header.xml
Brandon Dayauon 08b06523a5 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
2024-02-16 21:23:51 -08:00

99 lines
4.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2023 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.
-->
<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"
android:clipToOutline="true"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/settingsAndLockGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:layout_alignParentEnd="true"
android:animateLayoutChanges="true">
<ImageButton
android:id="@+id/ps_settings_button"
android:layout_width="@dimen/ps_header_image_height"
android:layout_height="@dimen/ps_header_image_height"
android:background="@drawable/ps_settings_background"
android:layout_marginEnd="@dimen/ps_header_settings_icon_margin_end"
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"
android:layout_height="@dimen/ps_header_image_height"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@android:color/transparent"
android:layout_marginEnd="@dimen/ps_header_layout_margin"
android:src="@drawable/bg_ps_transition_image"
android:contentDescription="@string/ps_container_transition" />
<TextView
android:id="@+id/ps_container_header"
android:layout_width="wrap_content"
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"
android:theme="@style/PrivateSpaceHeaderTextStyle"/>
</RelativeLayout>