Remove allocation in onLayout
The clipping rect was allocated in onLayout. After this change, the rect
is allocated once and the bounds are reset.
Test: manual
Change-Id: I92dcca915fc244a3d418e98a456a0719407cdf57
diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
index 76dfddb..bb159a9 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
@@ -62,6 +62,7 @@
private int mLayoutOrientation;
private int mLayoutDirection;
private int mHorizontalClipBound;
+ private final Rect mClippingRect;
public PagedTileLayout(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -71,6 +72,7 @@
setCurrentItem(0, false);
mLayoutOrientation = getResources().getConfiguration().orientation;
mLayoutDirection = getLayoutDirection();
+ mClippingRect = new Rect();
}
public void saveInstanceState(Bundle outState) {
@@ -280,8 +282,8 @@
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
- Rect clipBounds = new Rect(mHorizontalClipBound, 0, (r-l) - mHorizontalClipBound, b - t);
- setClipBounds(clipBounds);
+ mClippingRect.set(mHorizontalClipBound, 0, (r - l) - mHorizontalClipBound, b - t);
+ setClipBounds(mClippingRect);
}
@Override