Centers the wallpaper by default
This commit is contained in:
parent
8f573952b8
commit
798300c4c0
|
@ -272,6 +272,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
|
||||||
clearVacantCache();
|
clearVacantCache();
|
||||||
mCurrentScreen = Math.max(0, Math.min(currentScreen, getChildCount() - 1));
|
mCurrentScreen = Math.max(0, Math.min(currentScreen, getChildCount() - 1));
|
||||||
scrollTo(mCurrentScreen * getWidth(), 0);
|
scrollTo(mCurrentScreen * getWidth(), 0);
|
||||||
|
updateWallpaperOffset();
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,9 +457,11 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateWallpaperOffset() {
|
private void updateWallpaperOffset() {
|
||||||
int scrollRange = getChildAt(getChildCount()-1).getRight()-getWidth();
|
updateWallpaperOffset(getChildAt(getChildCount() - 1).getRight() - (mRight - mLeft));
|
||||||
mWallpaperManager.setWallpaperOffsets(getWindowToken(),
|
}
|
||||||
mScrollX/(float)scrollRange, 0);
|
|
||||||
|
private void updateWallpaperOffset(int scrollRange) {
|
||||||
|
mWallpaperManager.setWallpaperOffsets(getWindowToken(), mScrollX / (float) scrollRange, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -548,6 +551,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
|
||||||
|
|
||||||
if (mFirstLayout) {
|
if (mFirstLayout) {
|
||||||
scrollTo(mCurrentScreen * width, 0);
|
scrollTo(mCurrentScreen * width, 0);
|
||||||
|
updateWallpaperOffset(width * (getChildCount() - 1));
|
||||||
mFirstLayout = false;
|
mFirstLayout = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue