diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 38f84df503..fd744dc85d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1560,7 +1560,10 @@ public class Launcher extends Activity // processing a multi-step drop if (mAppsView != null && mWidgetsView != null && mPendingAddInfo.container == ItemInfo.NO_ID) { - showWorkspace(false); + if (!showWorkspace(false)) { + // If we are already on the workspace, then manually reset all apps + mAppsView.reset(); + } } } else if (Intent.ACTION_USER_PRESENT.equals(action)) { mUserPresent = true; @@ -3194,11 +3197,11 @@ public class Launcher extends Activity } } - public void showWorkspace(boolean animated) { - showWorkspace(animated, null); + public boolean showWorkspace(boolean animated) { + return showWorkspace(animated, null); } - public void showWorkspace(boolean animated, Runnable onCompleteRunnable) { + public boolean showWorkspace(boolean animated, Runnable onCompleteRunnable) { boolean changed = mState != State.WORKSPACE || mWorkspace.getState() != Workspace.State.NORMAL; if (changed) { @@ -3224,6 +3227,7 @@ public class Launcher extends Activity getWindow().getDecorView() .sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); } + return changed; } void showOverviewMode(boolean animated) { diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 4567193189..41b4e047c7 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -290,6 +290,15 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc } } + /** + * Resets the state of AllApps. + */ + public void reset() { + // Reset the search bar and base recycler view after transitioning home + mSearchBarController.reset(); + mAppsRecyclerView.reset(); + } + @Override protected void onFinishInflate() { super.onFinishInflate(); @@ -555,9 +564,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc @Override public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) { if (toWorkspace) { - // Reset the search bar and base recycler view after transitioning home - mSearchBarController.reset(); - mAppsRecyclerView.reset(); + reset(); } }