diff options
| author | 2019-04-02 03:55:48 +0000 | |
|---|---|---|
| committer | 2019-04-02 03:55:48 +0000 | |
| commit | 3b80b73ab855e967289239b24eb19550435ff2dc (patch) | |
| tree | 46a98643eef8e5832aa7eda6be34076e617bbea9 | |
| parent | 0ec1b0f9deb9df83bd8b6535b4f95b4ab9cb1798 (diff) | |
| parent | 87bdf0d630761947f1922501b716c2a9ba0aae20 (diff) | |
Merge "Remove allocation in onLayout"
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java index 76dfddb78c80..bb159a9ba2e8 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 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { 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 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { setCurrentItem(0, false); mLayoutOrientation = getResources().getConfiguration().orientation; mLayoutDirection = getLayoutDirection(); + mClippingRect = new Rect(); } public void saveInstanceState(Bundle outState) { @@ -280,8 +282,8 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { @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 |