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
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 81e876f..8c74c42 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -368,8 +368,11 @@
// 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 @@
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 @@
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;