From c5cfa73ef979ce31da2ef6b16ebedc598fc1c8f1 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Mon, 11 Jan 2010 19:39:32 -0500 Subject: [PATCH] Fix 2325492 - No icons in launcher after pressing home from within an app It looks like the evil hack in 14f122bf847e50a3e7730ccbe57abc25d086a01b to make the workspace not animate didn't completely work. The key to reproducing this bug is to make sure the activity is destroyed and to have last gone to an app from a screen other than the center screen, because that causes it to get reloaded from the icicle, which makes the timing more amenable to missing the animation, because the view isn't attached yet. --- src/com/android/launcher2/Workspace.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 374f0bf56d..9e32dd5634 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 * @param currentScreen */ void setCurrentScreen(int currentScreen) { + if (!mScroller.isFinished()) mScroller.abortAnimation(); clearVacantCache(); mCurrentScreen = Math.max(0, Math.min(currentScreen, getChildCount() - 1)); scrollTo(mCurrentScreen * getWidth(), 0); @@ -946,10 +947,6 @@ 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)); @@ -973,8 +970,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag final int delta = newX - mScrollX; final int duration = screenDelta * 300; awakenScrollBars(duration); - // 1ms is close to don't animate - mScroller.startScroll(mScrollX, 0, delta, 0, animate ? duration : 1); + mScroller.startScroll(mScrollX, 0, delta, 0, duration); invalidate(); } @@ -1425,7 +1421,11 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag } void moveToDefaultScreen(boolean animate) { - snapToScreen(mDefaultScreen, animate); + if (animate) { + snapToScreen(mDefaultScreen); + } else { + setCurrentScreen(mDefaultScreen); + } getChildAt(mDefaultScreen).requestFocus(); }