Merge "Code cleanup: recycle typed arrays when they are no longer needed" into udc-dev am: f0233c53d3 am: 81fad35da2
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23214379 Change-Id: I4b92f4cf632f567dbfbd452af9e1aa0253e3afbe Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
40bae4e7cd
@@ -20,6 +20,7 @@ import static com.android.quickstep.util.BorderAnimator.DEFAULT_BORDER_COLOR;
|
|||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@@ -67,6 +68,9 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout {
|
|||||||
int defStyleAttr,
|
int defStyleAttr,
|
||||||
int defStyleRes) {
|
int defStyleRes) {
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
TypedArray ta = context.obtainStyledAttributes(
|
||||||
|
attrs, R.styleable.TaskView, defStyleAttr, defStyleRes);
|
||||||
|
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
Resources resources = context.getResources();
|
Resources resources = context.getResources();
|
||||||
mBorderAnimator = new BorderAnimator(
|
mBorderAnimator = new BorderAnimator(
|
||||||
@@ -75,17 +79,8 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout {
|
|||||||
R.dimen.keyboard_quick_switch_border_width),
|
R.dimen.keyboard_quick_switch_border_width),
|
||||||
/* borderRadiusPx= */ resources.getDimensionPixelSize(
|
/* borderRadiusPx= */ resources.getDimensionPixelSize(
|
||||||
R.dimen.keyboard_quick_switch_task_view_radius),
|
R.dimen.keyboard_quick_switch_task_view_radius),
|
||||||
/* borderColor= */ attrs == null
|
/* borderColor= */ ta.getColor(
|
||||||
? DEFAULT_BORDER_COLOR
|
R.styleable.TaskView_borderColor, DEFAULT_BORDER_COLOR),
|
||||||
: context.getTheme()
|
|
||||||
.obtainStyledAttributes(
|
|
||||||
attrs,
|
|
||||||
R.styleable.TaskView,
|
|
||||||
defStyleAttr,
|
|
||||||
defStyleRes)
|
|
||||||
.getColor(
|
|
||||||
R.styleable.TaskView_borderColor,
|
|
||||||
DEFAULT_BORDER_COLOR),
|
|
||||||
/* invalidateViewCallback= */ KeyboardQuickSwitchTaskView.this::invalidate,
|
/* invalidateViewCallback= */ KeyboardQuickSwitchTaskView.this::invalidate,
|
||||||
/* viewScaleTargetProvider= */ new BorderAnimator.ViewScaleTargetProvider() {
|
/* viewScaleTargetProvider= */ new BorderAnimator.ViewScaleTargetProvider() {
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -100,6 +95,7 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout {
|
|||||||
return mContent;
|
return mContent;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ta.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -195,6 +195,9 @@ public class KeyboardQuickSwitchViewController {
|
|||||||
// focus a less recent app or loop back to the opposite end
|
// focus a less recent app or loop back to the opposite end
|
||||||
: ((mCurrentFocusIndex + 1) % taskCount));
|
: ((mCurrentFocusIndex + 1) % taskCount));
|
||||||
|
|
||||||
|
if (mCurrentFocusIndex == toIndex) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
mKeyboardQuickSwitchView.animateFocusMove(mCurrentFocusIndex, toIndex);
|
mKeyboardQuickSwitchView.animateFocusMove(mCurrentFocusIndex, toIndex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import android.app.ActivityOptions;
|
|||||||
import android.app.ActivityTaskManager;
|
import android.app.ActivityTaskManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
@@ -438,6 +439,9 @@ public class TaskView extends FrameLayout implements Reusable {
|
|||||||
|
|
||||||
setWillNotDraw(!keyboardFocusHighlightEnabled);
|
setWillNotDraw(!keyboardFocusHighlightEnabled);
|
||||||
|
|
||||||
|
TypedArray ta = context.obtainStyledAttributes(
|
||||||
|
attrs, R.styleable.TaskView, defStyleAttr, defStyleRes);
|
||||||
|
|
||||||
mBorderAnimator = !keyboardFocusHighlightEnabled
|
mBorderAnimator = !keyboardFocusHighlightEnabled
|
||||||
? null
|
? null
|
||||||
: new BorderAnimator(
|
: new BorderAnimator(
|
||||||
@@ -445,18 +449,10 @@ public class TaskView extends FrameLayout implements Reusable {
|
|||||||
/* borderWidthPx= */ context.getResources().getDimensionPixelSize(
|
/* borderWidthPx= */ context.getResources().getDimensionPixelSize(
|
||||||
R.dimen.keyboard_quick_switch_border_width),
|
R.dimen.keyboard_quick_switch_border_width),
|
||||||
/* borderRadiusPx= */ (int) mCurrentFullscreenParams.mCornerRadius,
|
/* borderRadiusPx= */ (int) mCurrentFullscreenParams.mCornerRadius,
|
||||||
/* borderColor= */ attrs == null
|
/* borderColor= */ ta.getColor(
|
||||||
? DEFAULT_BORDER_COLOR
|
R.styleable.TaskView_borderColor, DEFAULT_BORDER_COLOR),
|
||||||
: context.getTheme()
|
|
||||||
.obtainStyledAttributes(
|
|
||||||
attrs,
|
|
||||||
R.styleable.TaskView,
|
|
||||||
defStyleAttr,
|
|
||||||
defStyleRes)
|
|
||||||
.getColor(
|
|
||||||
R.styleable.TaskView_borderColor,
|
|
||||||
DEFAULT_BORDER_COLOR),
|
|
||||||
/* invalidateViewCallback= */ TaskView.this::invalidate);
|
/* invalidateViewCallback= */ TaskView.this::invalidate);
|
||||||
|
ta.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateBorderBounds(Rect bounds) {
|
protected void updateBorderBounds(Rect bounds) {
|
||||||
|
|||||||
Reference in New Issue
Block a user