Merge "Polish the keyboard quick switch view and border animation colors" into udc-dev

This commit is contained in:
Schneider Victor-tulias
2023-04-18 20:10:35 +00:00
committed by Android (Google) Code Review
12 changed files with 51 additions and 21 deletions
@@ -0,0 +1,17 @@
<?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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="@android:color/system_neutral2_500"
android:lStar="80"/>
</selector>
@@ -0,0 +1,17 @@
<?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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="@android:color/system_neutral2_500"
android:lStar="35"/>
</selector>
@@ -17,6 +17,6 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="?androidprv:attr/materialColorSurfaceContainerHigh" /> <solid android:color="?androidprv:attr/materialColorSurfaceBright" />
<corners android:radius="@dimen/keyboard_quick_switch_task_view_radius" /> <corners android:radius="@dimen/keyboard_quick_switch_task_view_radius" />
</shape> </shape>
@@ -16,6 +16,6 @@
<shape <shape
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="?attr/overviewScrimColor" /> <solid android:color="@color/quick_switch_view_background" />
<corners android:radius="@dimen/keyboard_quick_switch_view_radius" /> <corners android:radius="@dimen/keyboard_quick_switch_view_radius" />
</shape> </shape>
@@ -23,7 +23,7 @@
android:importantForAccessibility="yes" android:importantForAccessibility="yes"
android:background="@drawable/keyboard_quick_switch_task_view_background" android:background="@drawable/keyboard_quick_switch_task_view_background"
android:clipToOutline="true" android:clipToOutline="true"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer"> launcher:borderColor="?androidprv:attr/materialColorOutline">
<include <include
layout="@layout/keyboard_quick_switch_thumbnail" layout="@layout/keyboard_quick_switch_thumbnail"
@@ -23,7 +23,7 @@
android:background="@drawable/keyboard_quick_switch_overview_button_background" android:background="@drawable/keyboard_quick_switch_overview_button_background"
android:clipToOutline="true" android:clipToOutline="true"
android:importantForAccessibility="yes" android:importantForAccessibility="yes"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer"> launcher:borderColor="?androidprv:attr/materialColorOutline">
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"
@@ -32,7 +32,7 @@
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:src="@drawable/ic_empty_recents" android:src="@drawable/ic_empty_recents"
app:tint="?android:attr/textColorPrimary" app:tint="?androidprv:attr/materialColorOnSurface"
app:layout_constraintVertical_chainStyle="packed" app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/text" app:layout_constraintBottom_toTopOf="@id/text"
@@ -23,7 +23,7 @@
android:importantForAccessibility="yes" android:importantForAccessibility="yes"
android:background="@drawable/keyboard_quick_switch_task_view_background" android:background="@drawable/keyboard_quick_switch_task_view_background"
android:clipToOutline="true" android:clipToOutline="true"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer"> launcher:borderColor="?androidprv:attr/materialColorOutline">
<include <include
layout="@layout/keyboard_quick_switch_thumbnail" layout="@layout/keyboard_quick_switch_thumbnail"
+1 -1
View File
@@ -24,7 +24,7 @@
android:clipChildren="false" android:clipChildren="false"
android:defaultFocusHighlightEnabled="false" android:defaultFocusHighlightEnabled="false"
android:focusable="true" android:focusable="true"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer"> launcher:borderColor="?androidprv:attr/materialColorOutline">
<com.android.quickstep.views.TaskThumbnailView <com.android.quickstep.views.TaskThumbnailView
android:id="@+id/snapshot" android:id="@+id/snapshot"
+1 -1
View File
@@ -25,7 +25,7 @@
android:clipToOutline="true" android:clipToOutline="true"
android:defaultFocusHighlightEnabled="false" android:defaultFocusHighlightEnabled="false"
android:focusable="true" android:focusable="true"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer"> launcher:borderColor="?androidprv:attr/materialColorOutline">
<View <View
android:id="@+id/background" android:id="@+id/background"
+1 -1
View File
@@ -29,7 +29,7 @@
android:clipChildren="false" android:clipChildren="false"
android:defaultFocusHighlightEnabled="false" android:defaultFocusHighlightEnabled="false"
android:focusable="true" android:focusable="true"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer"> launcher:borderColor="?androidprv:attr/materialColorOutline">
<com.android.quickstep.views.TaskThumbnailView <com.android.quickstep.views.TaskThumbnailView
android:id="@+id/snapshot" android:id="@+id/snapshot"
+3 -2
View File
@@ -14,7 +14,8 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<resources> <resources
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<style name="TextAppearance.GestureTutorial" <style name="TextAppearance.GestureTutorial"
parent="android:TextAppearance.Material.Body1" /> parent="android:TextAppearance.Material.Body1" />
@@ -217,7 +218,7 @@
<style name="KeyboardQuickSwitchOverview"> <style name="KeyboardQuickSwitchOverview">
<item name="fontFamily">google-sans-text</item> <item name="fontFamily">google-sans-text</item>
<item name="android:textSize">14sp</item> <item name="android:textSize">14sp</item>
<item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
<item name="lineHeight">20sp</item> <item name="lineHeight">20sp</item>
</style> </style>
@@ -26,7 +26,6 @@ import android.view.animation.Interpolator;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Px; import androidx.annotation.Px;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatedFloat; import com.android.launcher3.anim.AnimatedFloat;
import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.Interpolators;
@@ -61,7 +60,7 @@ public final class BorderAnimator {
@NonNull private final Interpolator mInterpolator; @NonNull private final Interpolator mInterpolator;
@NonNull private final Paint mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG); @NonNull private final Paint mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private int mAlignmentAdjustment; private float mAlignmentAdjustment;
@Nullable private Animator mRunningBorderAnimation; @Nullable private Animator mRunningBorderAnimation;
@@ -106,16 +105,12 @@ public final class BorderAnimator {
private void updateOutline() { private void updateOutline() {
float interpolatedProgress = mInterpolator.getInterpolation( float interpolatedProgress = mInterpolator.getInterpolation(
mBorderAnimationProgress.value); mBorderAnimationProgress.value);
mAlignmentAdjustment = (int) Utilities.mapBoundToRange( float borderWidth = mBorderWidthPx * interpolatedProgress;
mBorderAnimationProgress.value, // Inset the border by half the width to create an inwards-growth animation
/* lowerBound= */ 0f, mAlignmentAdjustment = borderWidth / 2f;
/* upperBound= */ 1f,
/* toMin= */ 0f,
/* toMax= */ (float) (mBorderWidthPx / 2f),
mInterpolator);
mBorderPaint.setAlpha(Math.round(255 * interpolatedProgress)); mBorderPaint.setAlpha(Math.round(255 * interpolatedProgress));
mBorderPaint.setStrokeWidth(Math.round(mBorderWidthPx * interpolatedProgress)); mBorderPaint.setStrokeWidth(borderWidth);
mInvalidateViewCallback.run(); mInvalidateViewCallback.run();
} }