diff options
author | Michael Jurka <mikejurka@google.com> | 2011-01-20 14:16:56 -0800 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-01-24 16:55:30 -0800 |
commit | 8c920dd3683d752aa4c43e964831ce53f9b72887 (patch) | |
tree | 35faeed05b46a1e0b1c9ab0b35f57fb997913a72 /src/com/android/launcher2/PagedView.java | |
parent | adabb50e55f202e73576d2c268ae681c2bc5a822 (diff) | |
download | android_packages_apps_Trebuchet-8c920dd3683d752aa4c43e964831ce53f9b72887.tar.gz android_packages_apps_Trebuchet-8c920dd3683d752aa4c43e964831ce53f9b72887.tar.bz2 android_packages_apps_Trebuchet-8c920dd3683d752aa4c43e964831ce53f9b72887.zip |
Refactoring CellLayout into three classes
- splitting the rendering of children from the CellLayout to enhance performance, gives ~4 fps boost while scrolling on pages full of icons, and no change on pages full of widgets
- this will allow us to add hardware layer support trivially, which will increase performance while scrolling ~6-10 fps
- separated logic for caching celllayouts to bitmaps into a separate class
Change-Id: Ib6abeb19126e1504997b43c2f44af2a2fb3cd39f
Diffstat (limited to 'src/com/android/launcher2/PagedView.java')
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 4a0f44e2c..d99921f9f 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -109,7 +109,7 @@ public abstract class PagedView extends ViewGroup { protected boolean mAllowOverScroll = true; protected int mUnboundedScrollX; - // parameter that adjusts the layout to be optimized for CellLayouts with that scale factor + // parameter that adjusts the layout to be optimized for pages with that scale factor protected float mLayoutScale = 1.0f; protected static final int INVALID_POINTER = -1; @@ -416,20 +416,20 @@ public abstract class PagedView extends ViewGroup { setMeasuredDimension(widthSize, heightSize); } - protected void moveToNewPageWithoutMovingCellLayouts(int newCurrentPage) { + protected void scrollToNewPageWithoutMovingPages(int newCurrentPage) { int newX = getChildOffset(newCurrentPage) - getRelativeChildOffset(newCurrentPage); int delta = newX - mScrollX; - final int screenCount = getChildCount(); - for (int i = 0; i < screenCount; i++) { - CellLayout cl = (CellLayout) getChildAt(i); - cl.setX(cl.getX() + delta); + final int pageCount = getChildCount(); + for (int i = 0; i < pageCount; i++) { + View page = (View) getChildAt(i); + page.setX(page.getX() + delta); } setCurrentPage(newCurrentPage); } - // A layout scale of 1.0f assumes that the CellLayouts, in their unshrunken state, have a - // scale of 1.0f. A layout scale of 0.8f assumes the CellLayouts have a scale of 0.8f, and + // A layout scale of 1.0f assumes that the pages, in their unshrunken state, have a + // scale of 1.0f. A layout scale of 0.8f assumes the pages have a scale of 0.8f, and // tightens the layout accordingly public void setLayoutScale(float childrenScale) { mLayoutScale = childrenScale; @@ -451,7 +451,7 @@ public abstract class PagedView extends ViewGroup { } // Also, the page offset has changed (since the pages are now smaller); // update the page offset, but again preserving absolute X and Y coordinates - moveToNewPageWithoutMovingCellLayouts(mCurrentPage); + scrollToNewPageWithoutMovingPages(mCurrentPage); } @Override |