diff options
Diffstat (limited to 'src/com/android/launcher2/LauncherModel.java')
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 29723d447..d4b7f7652 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -1557,7 +1557,8 @@ public class LauncherModel extends BroadcastReceiver { return; } - final int currentScreen = (synchronizeBindPage > -1) ? synchronizeBindPage : + final boolean isLoadingSynchronously = (synchronizeBindPage > -1); + final int currentScreen = isLoadingSynchronously ? synchronizeBindPage : oldCallbacks.getCurrentWorkspaceScreen(); // Load all the items that are on the current page first (and in the process, unbind @@ -1609,10 +1610,11 @@ public class LauncherModel extends BroadcastReceiver { bindWorkspaceItems(oldCallbacks, currentWorkspaceItems, currentAppWidgets, currentFolders, null); - // Load all the remaining pages + // Load all the remaining pages (if we are loading synchronously, we want to defer this + // work until after the first render) mDeferredBindRunnables.clear(); bindWorkspaceItems(oldCallbacks, otherWorkspaceItems, otherAppWidgets, otherFolders, - mDeferredBindRunnables); + (isLoadingSynchronously ? mDeferredBindRunnables : null)); // Tell the workspace that we're done binding items r = new Runnable() { @@ -1631,7 +1633,11 @@ public class LauncherModel extends BroadcastReceiver { mIsLoadingAndBindingWorkspace = false; } }; - mDeferredBindRunnables.add(r); + if (isLoadingSynchronously) { + mDeferredBindRunnables.add(r); + } else { + runOnMainThread(r); + } } private void loadAndBindAllApps() { |