am 14f122bf: Fix bug 2271894 - Odd animation when press home button from app that wasn\'t in center home screen

Merge commit '14f122bf847e50a3e7730ccbe57abc25d086a01b' into eclair-mr2

* commit '14f122bf847e50a3e7730ccbe57abc25d086a01b':
  Fix bug 2271894 - Odd animation when press home button from app that wasn't in center home screen
This commit is contained in:
Joe Onorato authored and Android Git Automerger committed 2009-11-19 14:57:17 -08:00
commit 920beea454
2 files changed
+14 -7

No files matched your search

+6 -4
View File
@@ -819,7 +819,7 @@ public final class Launcher extends Activity
} }
void closeSystemDialogs() { void closeSystemDialogs() {
closeAllApps(false); closeAllApps(true);
getWindow().closeAllPanels(); getWindow().closeAllPanels();
try { try {
@@ -854,11 +854,13 @@ public final class Launcher extends Activity
// for example onResume being called when the user pressed the 'back' button. // for example onResume being called when the user pressed the 'back' button.
mIsNewIntent = true; mIsNewIntent = true;
boolean alreadyOnHome = ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
!= Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
boolean allAppsVisible = isAllAppsVisible();
if (!mWorkspace.isDefaultScreenShowing()) { if (!mWorkspace.isDefaultScreenShowing()) {
mWorkspace.moveToDefaultScreen(); mWorkspace.moveToDefaultScreen(alreadyOnHome && !allAppsVisible);
} }
closeAllApps(alreadyOnHome && allAppsVisible);
closeAllApps(false);
final View v = getWindow().peekDecorView(); final View v = getWindow().peekDecorView();
if (v != null && v.getWindowToken() != null) { if (v != null && v.getWindowToken() != null) {
+8 -3
View File
@@ -947,6 +947,10 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
} }
void snapToScreen(int whichScreen) { void snapToScreen(int whichScreen) {
snapToScreen(whichScreen, true);
}
void snapToScreen(int whichScreen, boolean animate) {
//if (!mScroller.isFinished()) return; //if (!mScroller.isFinished()) return;
whichScreen = Math.max(0, Math.min(whichScreen, getChildCount() - 1)); 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 delta = newX - mScrollX;
final int duration = screenDelta * 300; final int duration = screenDelta * 300;
awakenScrollBars(duration); 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(); invalidate();
} }
@@ -1420,8 +1425,8 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
} }
} }
void moveToDefaultScreen() { void moveToDefaultScreen(boolean animate) {
snapToScreen(mDefaultScreen); snapToScreen(mDefaultScreen, animate);
getChildAt(mDefaultScreen).requestFocus(); getChildAt(mDefaultScreen).requestFocus();
} }