Polish the keyboard quick switch view and border animation colors

Flag: ENABLE_KEYBOARD_QUICK_SWITCH
Bug: 276336349
Test: keyboard quick switched on tablet and handheld
Change-Id: I2c21737db3fc4c332ffef9098e8d05d998cf3c39
This commit is contained in:
Schneider Victor-tulias
2023-04-07 13:29:32 -07:00
parent 296f8776f7
commit e5c7d7dcd2
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:androidprv="http://schemas.android.com/apk/prv/res/android"
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" />
</shape>
@@ -16,6 +16,6 @@
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
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" />
</shape>
@@ -23,7 +23,7 @@
android:importantForAccessibility="yes"
android:background="@drawable/keyboard_quick_switch_task_view_background"
android:clipToOutline="true"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
launcher:borderColor="?androidprv:attr/materialColorOutline">
<include
layout="@layout/keyboard_quick_switch_thumbnail"
@@ -23,7 +23,7 @@
android:background="@drawable/keyboard_quick_switch_overview_button_background"
android:clipToOutline="true"
android:importantForAccessibility="yes"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
launcher:borderColor="?androidprv:attr/materialColorOutline">
<ImageView
android:id="@+id/icon"
@@ -32,7 +32,7 @@
android:layout_marginBottom="8dp"
android:src="@drawable/ic_empty_recents"
app:tint="?android:attr/textColorPrimary"
app:tint="?androidprv:attr/materialColorOnSurface"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/text"
@@ -23,7 +23,7 @@
android:importantForAccessibility="yes"
android:background="@drawable/keyboard_quick_switch_task_view_background"
android:clipToOutline="true"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
launcher:borderColor="?androidprv:attr/materialColorOutline">
<include
layout="@layout/keyboard_quick_switch_thumbnail"
+1 -1
View File
@@ -24,7 +24,7 @@
android:clipChildren="false"
android:defaultFocusHighlightEnabled="false"
android:focusable="true"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
launcher:borderColor="?androidprv:attr/materialColorOutline">
<com.android.quickstep.views.TaskThumbnailView
android:id="@+id/snapshot"
+1 -1
View File
@@ -25,7 +25,7 @@
android:clipToOutline="true"
android:defaultFocusHighlightEnabled="false"
android:focusable="true"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
launcher:borderColor="?androidprv:attr/materialColorOutline">
<View
android:id="@+id/background"
+1 -1
View File
@@ -29,7 +29,7 @@
android:clipChildren="false"
android:defaultFocusHighlightEnabled="false"
android:focusable="true"
launcher:borderColor="?androidprv:attr/materialColorSecondaryContainer">
launcher:borderColor="?androidprv:attr/materialColorOutline">
<com.android.quickstep.views.TaskThumbnailView
android:id="@+id/snapshot"
+3 -2
View File
@@ -14,7 +14,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<resources
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<style name="TextAppearance.GestureTutorial"
parent="android:TextAppearance.Material.Body1" />
@@ -234,7 +235,7 @@
<style name="KeyboardQuickSwitchOverview">
<item name="fontFamily">google-sans-text</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>
</style>
@@ -26,7 +26,6 @@ import android.view.animation.Interpolator;
import androidx.annotation.NonNull;
import androidx.annotation.Px;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatedFloat;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.anim.Interpolators;
@@ -61,7 +60,7 @@ public final class BorderAnimator {
@NonNull private final Interpolator mInterpolator;
@NonNull private final Paint mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private int mAlignmentAdjustment;
private float mAlignmentAdjustment;
@Nullable private Animator mRunningBorderAnimation;
@@ -106,16 +105,12 @@ public final class BorderAnimator {
private void updateOutline() {
float interpolatedProgress = mInterpolator.getInterpolation(
mBorderAnimationProgress.value);
mAlignmentAdjustment = (int) Utilities.mapBoundToRange(
mBorderAnimationProgress.value,
/* lowerBound= */ 0f,
/* upperBound= */ 1f,
/* toMin= */ 0f,
/* toMax= */ (float) (mBorderWidthPx / 2f),
mInterpolator);
float borderWidth = mBorderWidthPx * interpolatedProgress;
// Inset the border by half the width to create an inwards-growth animation
mAlignmentAdjustment = borderWidth / 2f;
mBorderPaint.setAlpha(Math.round(255 * interpolatedProgress));
mBorderPaint.setStrokeWidth(Math.round(mBorderWidthPx * interpolatedProgress));
mBorderPaint.setStrokeWidth(borderWidth);
mInvalidateViewCallback.run();
}