summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/PagedView.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-07-08 15:34:52 -0700
committerWinson Chung <winsonc@google.com>2011-07-11 11:38:24 -0700
commit557d6ed50cc6560163440aa134870ef0bb11415b (patch)
tree9abf7ad514d60f696d902a97f937cc356dd47ee6 /src/com/android/launcher2/PagedView.java
parenta71cb1778dc0c7e76132d21296c58da777183e26 (diff)
downloadandroid_packages_apps_Trebuchet-557d6ed50cc6560163440aa134870ef0bb11415b.tar.gz
android_packages_apps_Trebuchet-557d6ed50cc6560163440aa134870ef0bb11415b.tar.bz2
android_packages_apps_Trebuchet-557d6ed50cc6560163440aa134870ef0bb11415b.zip
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
Diffstat (limited to 'src/com/android/launcher2/PagedView.java')
-rw-r--r--src/com/android/launcher2/PagedView.java13
1 files changed, 10 insertions, 3 deletions
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;