diff options
author | Winson Chung <winsonc@google.com> | 2015-08-19 19:19:26 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-08-19 19:19:26 +0000 |
commit | 1cd32a2144dc1a620e6a22e5a05b489ec86abb18 (patch) | |
tree | 3ebcb439f5974dc18b9745ccf9ce59b7cfb5f040 /src/com/android | |
parent | 9fc953b94dbc6b99e6de08c9dcc80a0cb8e3e319 (diff) | |
parent | 15f8b17adb36e7345e39cc1c431f8c1abd84f832 (diff) | |
download | android_packages_apps_Trebuchet-1cd32a2144dc1a620e6a22e5a05b489ec86abb18.tar.gz android_packages_apps_Trebuchet-1cd32a2144dc1a620e6a22e5a05b489ec86abb18.tar.bz2 android_packages_apps_Trebuchet-1cd32a2144dc1a620e6a22e5a05b489ec86abb18.zip |
Merge "Deferring the move to the default screen until after we callback to the callbacks." into ub-launcher3-burnaby
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 5aeacaa57..6f2458c11 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1853,29 +1853,22 @@ public class Launcher extends Activity super.onNewIntent(intent); // Close the menu - if (Intent.ACTION_MAIN.equals(intent.getAction())) { + Folder openFolder = mWorkspace.getOpenFolder(); + boolean alreadyOnHome = mHasFocus && ((intent.getFlags() & + Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) + != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); + boolean isActionMain = Intent.ACTION_MAIN.equals(intent.getAction()); + if (isActionMain) { // also will cancel mWaitingForResult. closeSystemDialogs(); - final boolean alreadyOnHome = mHasFocus && ((intent.getFlags() & - Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) - != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); - if (mWorkspace == null) { // Can be cases where mWorkspace is null, this prevents a NPE return; } - Folder openFolder = mWorkspace.getOpenFolder(); // In all these cases, only animate if we're already on home mWorkspace.exitWidgetResizeMode(); - boolean moveToDefaultScreen = mLauncherCallbacks != null ? - mLauncherCallbacks.shouldMoveToDefaultScreenOnHomeIntent() : true; - if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive() && - openFolder == null && moveToDefaultScreen) { - mWorkspace.moveToDefaultScreen(true); - } - closeFolder(); exitSpringLoadedDragMode(); @@ -1909,13 +1902,30 @@ public class Launcher extends Activity } } - if (DEBUG_RESUME_TIME) { - Log.d(TAG, "Time spent in onNewIntent: " + (System.currentTimeMillis() - startTime)); - } - if (mLauncherCallbacks != null) { mLauncherCallbacks.onNewIntent(intent); } + + // Defer moving to the default screen until after we callback to the LauncherCallbacks + // as slow logic in the callbacks eat into the time the scroller expects for the snapToPage + // animation. + if (isActionMain) { + boolean moveToDefaultScreen = mLauncherCallbacks != null ? + mLauncherCallbacks.shouldMoveToDefaultScreenOnHomeIntent() : true; + if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive() && + openFolder == null && moveToDefaultScreen) { + mWorkspace.post(new Runnable() { + @Override + public void run() { + mWorkspace.moveToDefaultScreen(true); + } + }); + } + } + + if (DEBUG_RESUME_TIME) { + Log.d(TAG, "Time spent in onNewIntent: " + (System.currentTimeMillis() - startTime)); + } } @Override |