diff options
author | Joe Onorato <joeo@android.com> | 2009-11-10 15:06:42 -0800 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-11-10 19:56:02 -0800 |
commit | 3a8820bdbad90642cf5cda4b00a8c92ecb699159 (patch) | |
tree | aedf0fe5f2e6064dd79101df02c862a4cc4f46a9 /src/com/android/launcher2/Launcher.java | |
parent | 2ca0ae7d7c4d5f6b24a1b3d987813cad9ee4197f (diff) | |
download | android_packages_apps_Trebuchet-3a8820bdbad90642cf5cda4b00a8c92ecb699159.tar.gz android_packages_apps_Trebuchet-3a8820bdbad90642cf5cda4b00a8c92ecb699159.tar.bz2 android_packages_apps_Trebuchet-3a8820bdbad90642cf5cda4b00a8c92ecb699159.zip |
Fix bug 2250457 - Open folder on home screen changes changes the behaviour of the home button
Now, home always goes to the center worksapce screen and back from an
app goes to all apps if it was open.
Getting that animations smooth took a little bit of work.
Diffstat (limited to 'src/com/android/launcher2/Launcher.java')
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 60 |
1 files changed, 26 insertions, 34 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 6a0978b8c..ce3d5a71a 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -192,7 +192,6 @@ public final class Launcher extends Activity private boolean mRestoring; private boolean mWaitingForResult; - private boolean mExitingBecauseOfLaunch; private Bundle mSavedInstanceState; @@ -446,10 +445,6 @@ public final class Launcher extends Activity @Override protected void onPause() { super.onPause(); - if (mExitingBecauseOfLaunch) { - mExitingBecauseOfLaunch = false; - closeAllApps(false); - } dismissPreview(mPreviousView); dismissPreview(mNextView); } @@ -511,6 +506,11 @@ public final class Launcher extends Activity return; } + final boolean allApps = savedState.getBoolean(RUNTIME_STATE_ALL_APPS_FOLDER, false); + if (allApps) { + showAllApps(false); + } + final int currentScreen = savedState.getInt(RUNTIME_STATE_CURRENT_SCREEN, -1); if (currentScreen > -1) { mWorkspace.setCurrentScreen(currentScreen); @@ -856,23 +856,17 @@ public final class Launcher extends Activity // for example onResume being called when the user pressed the 'back' button. mIsNewIntent = true; - if ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != - Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) { - - if (!mWorkspace.isDefaultScreenShowing()) { - mWorkspace.moveToDefaultScreen(); - } + if (!mWorkspace.isDefaultScreenShowing()) { + mWorkspace.moveToDefaultScreen(); + } - closeAllApps(true); + closeAllApps(false); - final View v = getWindow().peekDecorView(); - if (v != null && v.getWindowToken() != null) { - InputMethodManager imm = (InputMethodManager)getSystemService( - INPUT_METHOD_SERVICE); - imm.hideSoftInputFromWindow(v.getWindowToken(), 0); - } - } else { - closeAllApps(false); + final View v = getWindow().peekDecorView(); + if (v != null && v.getWindowToken() != null) { + InputMethodManager imm = (InputMethodManager)getSystemService( + INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(v.getWindowToken(), 0); } } } @@ -902,10 +896,8 @@ public final class Launcher extends Activity final boolean isConfigurationChange = getChangingConfigurations() != 0; - // When the drawer is opened and we are saving the state because of a - // configuration change // TODO should not do this if the drawer is currently closing. - if (isAllAppsVisible() && isConfigurationChange) { + if (isAllAppsVisible()) { outState.putBoolean(RUNTIME_STATE_ALL_APPS_FOLDER, true); } @@ -1408,7 +1400,6 @@ public final class Launcher extends Activity // Open shortcut final Intent intent = ((ApplicationInfo) tag).intent; startActivitySafely(intent); - mExitingBecauseOfLaunch = true; } else if (tag instanceof FolderInfo) { handleFolderClick((FolderInfo) tag); } else if (v == mHandleView) { @@ -1416,7 +1407,7 @@ public final class Launcher extends Activity if (isAllAppsVisible()) { closeAllApps(true); } else { - showAllApps(); + showAllApps(true); } } } @@ -1819,10 +1810,16 @@ public final class Launcher extends Activity return mAllAppsGrid.isVisible(); } - void showAllApps() { - mAllAppsGrid.zoom(1.0f); + boolean isAllAppsOpaque() { + return mAllAppsGrid.isOpaque(); + } + + void showAllApps(boolean animated) { + mAllAppsGrid.zoom(1.0f, animated); //mWorkspace.hide(); + mWorkspace.startFading(false); + mAllAppsGrid.setFocusable(true); mAllAppsGrid.requestFocus(); @@ -1833,10 +1830,10 @@ public final class Launcher extends Activity void closeAllApps(boolean animated) { if (mAllAppsGrid.isVisible()) { - mAllAppsGrid.zoom(0.0f); + mAllAppsGrid.zoom(0.0f, animated); mAllAppsGrid.setFocusable(false); mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus(); - + mWorkspace.startFading(true); // TODO: fade these two too /* @@ -2138,11 +2135,6 @@ public final class Launcher extends Activity } } - final boolean allApps = mSavedState.getBoolean(RUNTIME_STATE_ALL_APPS_FOLDER, false); - if (allApps) { - showAllApps(); - } - mSavedState = null; } |