From 557d6ed50cc6560163440aa134870ef0bb11415b Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 8 Jul 2011 15:34:52 -0700 Subject: Fixing issues with spring loaded adding. - Delaying until items are added - Showing bg when going into spring loaded mode - Fixing regression where dropping widgets on full page would not trigger a notification - Fixing regression on tablet where pages were no longer being rotated or shown Change-Id: Iadc0c406f0c065c5029addea1abfee395eed81b9 --- src/com/android/launcher2/PagedView.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/com/android/launcher2/PagedView.java') diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 81e876fdb..8c74c42e5 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -368,8 +368,11 @@ public abstract class PagedView extends ViewGroup { // we moved this functionality to a helper function so SmoothPagedView can reuse it protected boolean computeScrollHelper() { if (mScroller.computeScrollOffset()) { - mDirtyPageAlpha = true; - scrollTo(mScroller.getCurrX(), mScroller.getCurrY()); + // Don't bother scrolling if the page does not need to be moved + if (mScrollX != mScroller.getCurrX() || mScrollY != mScroller.getCurrY()) { + mDirtyPageAlpha = true; + scrollTo(mScroller.getCurrX(), mScroller.getCurrY()); + } invalidate(); return true; } else if (mNextPage != INVALID_PAGE) { @@ -652,7 +655,7 @@ public abstract class PagedView extends ViewGroup { if (pageCount > 0) { final int pageWidth = getScaledMeasuredWidth(getChildAt(0)); final int screenWidth = getMeasuredWidth(); - int x = getRelativeChildOffset(0) + pageWidth; + int x = getScaledRelativeChildOffset(0) + pageWidth; int leftScreen = 0; int rightScreen = 0; while (x <= mScrollX) { @@ -1255,6 +1258,10 @@ public abstract class PagedView extends ViewGroup { return (getMeasuredWidth() - getChildWidth(index)) / 2; } + protected int getScaledRelativeChildOffset(int index) { + return (getMeasuredWidth() - getScaledMeasuredWidth(getChildAt(index))) / 2; + } + protected int getChildOffset(int index) { if (getChildCount() == 0) return 0; -- cgit v1.2.3