summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-08-11 14:43:29 -0700
committerRomain Guy <romainguy@android.com>2009-08-11 14:43:29 -0700
commit798300c4c05b12228f2e4f31c49c3cb728a37889 (patch)
treec0f311f7ea69b4a117c0044afb0f2d722d177a58
parent8f573952b8729b4319043ae0908997ecd2d68951 (diff)
downloadandroid_packages_apps_Trebuchet-798300c4c05b12228f2e4f31c49c3cb728a37889.tar.gz
android_packages_apps_Trebuchet-798300c4c05b12228f2e4f31c49c3cb728a37889.tar.bz2
android_packages_apps_Trebuchet-798300c4c05b12228f2e4f31c49c3cb728a37889.zip
Centers the wallpaper by default
-rw-r--r--src/com/android/launcher2/Workspace.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index bfda3035f..c9604121f 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -272,6 +272,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
clearVacantCache();
mCurrentScreen = Math.max(0, Math.min(currentScreen, getChildCount() - 1));
scrollTo(mCurrentScreen * getWidth(), 0);
+ updateWallpaperOffset();
invalidate();
}
@@ -456,9 +457,11 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
}
private void updateWallpaperOffset() {
- int scrollRange = getChildAt(getChildCount()-1).getRight()-getWidth();
- mWallpaperManager.setWallpaperOffsets(getWindowToken(),
- mScrollX/(float)scrollRange, 0);
+ updateWallpaperOffset(getChildAt(getChildCount() - 1).getRight() - (mRight - mLeft));
+ }
+
+ private void updateWallpaperOffset(int scrollRange) {
+ mWallpaperManager.setWallpaperOffsets(getWindowToken(), mScrollX / (float) scrollRange, 0);
}
@Override
@@ -548,6 +551,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
if (mFirstLayout) {
scrollTo(mCurrentScreen * width, 0);
+ updateWallpaperOffset(width * (getChildCount() - 1));
mFirstLayout = false;
}
}