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 committed 2023-04-07 13:29:32 -07:00
1 parent 296f8776f7
commit e5c7d7dcd2
12 files changed
+51 -21

No files matched your search

@@ -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();
}