diff options
author | Joe Onorato <joeo@android.com> | 2009-11-19 14:06:36 -0800 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-11-19 14:06:36 -0800 |
commit | 14f122bf847e50a3e7730ccbe57abc25d086a01b (patch) | |
tree | 05b7668b6ecc6259077847d81168e74f36019f71 /src/com/android/launcher2/Workspace.java | |
parent | 88ec0990c66702158d3c7f2f6ef5c03531978247 (diff) | |
download | packages_apps_trebuchet-14f122bf847e50a3e7730ccbe57abc25d086a01b.zip packages_apps_trebuchet-14f122bf847e50a3e7730ccbe57abc25d086a01b.tar.gz packages_apps_trebuchet-14f122bf847e50a3e7730ccbe57abc25d086a01b.tar.bz2 |
Fix bug 2271894 - Odd animation when press home button from app that wasn't in center home screen
Now:
- When you're on the workspace and you press home, it animates back to the middle
- When you're in all apps and you press home, all apps animates out and the workspace
doesn't animate to the middle (it just jumps there)
- When you're in an app and you press home, it doesn't animate to the middle
- When you're in an app and you press back, it still goes to the page you were on.
Don't look at the evil hack to make it move without animating.
Diffstat (limited to 'src/com/android/launcher2/Workspace.java')
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index d0cec8a..ac94cca 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -947,6 +947,10 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag } void snapToScreen(int whichScreen) { + snapToScreen(whichScreen, true); + } + + void snapToScreen(int whichScreen, boolean animate) { //if (!mScroller.isFinished()) return; whichScreen = Math.max(0, Math.min(whichScreen, getChildCount() - 1)); @@ -970,7 +974,8 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag final int delta = newX - mScrollX; final int duration = screenDelta * 300; awakenScrollBars(duration); - mScroller.startScroll(mScrollX, 0, delta, 0, duration); + // 1ms is close to don't animate + mScroller.startScroll(mScrollX, 0, delta, 0, animate ? duration : 1); invalidate(); } @@ -1420,8 +1425,8 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag } } - void moveToDefaultScreen() { - snapToScreen(mDefaultScreen); + void moveToDefaultScreen(boolean animate) { + snapToScreen(mDefaultScreen, animate); getChildAt(mDefaultScreen).requestFocus(); } |