diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java index 926ede1edd..8b2bca11e9 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java @@ -20,6 +20,7 @@ import static com.android.quickstep.util.BorderAnimator.DEFAULT_BORDER_COLOR; import android.animation.Animator; import android.content.Context; import android.content.res.Resources; +import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Canvas; import android.util.AttributeSet; @@ -67,6 +68,9 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout { int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); + TypedArray ta = context.obtainStyledAttributes( + attrs, R.styleable.TaskView, defStyleAttr, defStyleRes); + setWillNotDraw(false); Resources resources = context.getResources(); mBorderAnimator = new BorderAnimator( @@ -75,17 +79,8 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout { R.dimen.keyboard_quick_switch_border_width), /* borderRadiusPx= */ resources.getDimensionPixelSize( R.dimen.keyboard_quick_switch_task_view_radius), - /* borderColor= */ attrs == null - ? DEFAULT_BORDER_COLOR - : context.getTheme() - .obtainStyledAttributes( - attrs, - R.styleable.TaskView, - defStyleAttr, - defStyleRes) - .getColor( - R.styleable.TaskView_borderColor, - DEFAULT_BORDER_COLOR), + /* borderColor= */ ta.getColor( + R.styleable.TaskView_borderColor, DEFAULT_BORDER_COLOR), /* invalidateViewCallback= */ KeyboardQuickSwitchTaskView.this::invalidate, /* viewScaleTargetProvider= */ new BorderAnimator.ViewScaleTargetProvider() { @NonNull @@ -100,6 +95,7 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout { return mContent; } }); + ta.recycle(); } @Override diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java index c1f764f148..836bf79b34 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java @@ -195,6 +195,9 @@ public class KeyboardQuickSwitchViewController { // focus a less recent app or loop back to the opposite end : ((mCurrentFocusIndex + 1) % taskCount)); + if (mCurrentFocusIndex == toIndex) { + return true; + } mKeyboardQuickSwitchView.animateFocusMove(mCurrentFocusIndex, toIndex); return true; diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index d57070847b..c47c946a35 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -45,6 +45,7 @@ import android.app.ActivityOptions; import android.app.ActivityTaskManager; import android.content.Context; import android.content.Intent; +import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.PointF; import android.graphics.Rect; @@ -438,6 +439,9 @@ public class TaskView extends FrameLayout implements Reusable { setWillNotDraw(!keyboardFocusHighlightEnabled); + TypedArray ta = context.obtainStyledAttributes( + attrs, R.styleable.TaskView, defStyleAttr, defStyleRes); + mBorderAnimator = !keyboardFocusHighlightEnabled ? null : new BorderAnimator( @@ -445,18 +449,10 @@ public class TaskView extends FrameLayout implements Reusable { /* borderWidthPx= */ context.getResources().getDimensionPixelSize( R.dimen.keyboard_quick_switch_border_width), /* borderRadiusPx= */ (int) mCurrentFullscreenParams.mCornerRadius, - /* borderColor= */ attrs == null - ? DEFAULT_BORDER_COLOR - : context.getTheme() - .obtainStyledAttributes( - attrs, - R.styleable.TaskView, - defStyleAttr, - defStyleRes) - .getColor( - R.styleable.TaskView_borderColor, - DEFAULT_BORDER_COLOR), + /* borderColor= */ ta.getColor( + R.styleable.TaskView_borderColor, DEFAULT_BORDER_COLOR), /* invalidateViewCallback= */ TaskView.this::invalidate); + ta.recycle(); } protected void updateBorderBounds(Rect bounds) {