Merge "Fixing the loader to bind the first screen as well as the hotseat together" into ub-launcher3-calgary
am: 9c17741
* commit '9c17741387e7828765436b777ba084a5bacb5b31':
Fixing the loader to bind the first screen as well as the hotseat together
Change-Id: I415cedac6f6b1037a80b1afbc10c67886a7993a2
This commit is contained in:
@@ -997,7 +997,7 @@ public class Launcher extends Activity
|
||||
mPaused = false;
|
||||
if (mRestoring || mOnResumeNeedsLoad) {
|
||||
setWorkspaceLoading(true);
|
||||
mModel.startLoader(PagedView.INVALID_RESTORE_PAGE);
|
||||
mModel.startLoader(getCurrentWorkspaceScreen());
|
||||
mRestoring = false;
|
||||
mOnResumeNeedsLoad = false;
|
||||
}
|
||||
@@ -3664,6 +3664,7 @@ public class Launcher extends Activity
|
||||
* @return true if we are currently paused. The caller might be able to
|
||||
* skip some work in that case since we will come back again.
|
||||
*/
|
||||
@Override
|
||||
public boolean setLoadOnResume() {
|
||||
if (mPaused) {
|
||||
if (LOGD) Log.d(TAG, "setLoadOnResume");
|
||||
@@ -3677,6 +3678,7 @@ public class Launcher extends Activity
|
||||
/**
|
||||
* Implementation of the method from LauncherModel.Callbacks.
|
||||
*/
|
||||
@Override
|
||||
public int getCurrentWorkspaceScreen() {
|
||||
if (mWorkspace != null) {
|
||||
return mWorkspace.getCurrentPage();
|
||||
@@ -4046,7 +4048,6 @@ public class Launcher extends Activity
|
||||
* Restores a pending widget.
|
||||
*
|
||||
* @param appWidgetId The app widget id
|
||||
* @param cellInfo The position on screen where to create the widget.
|
||||
*/
|
||||
private void completeRestoreAppWidget(final int appWidgetId) {
|
||||
LauncherAppWidgetHostView view = mWorkspace.getWidgetForAppWidgetId(appWidgetId);
|
||||
|
||||
@@ -1266,17 +1266,13 @@ public class LauncherModel extends BroadcastReceiver
|
||||
* of doing it now.
|
||||
*/
|
||||
public void startLoaderFromBackground() {
|
||||
boolean runLoader = false;
|
||||
Callbacks callbacks = getCallback();
|
||||
if (callbacks != null) {
|
||||
// Only actually run the loader if they're not paused.
|
||||
if (!callbacks.setLoadOnResume()) {
|
||||
runLoader = true;
|
||||
startLoader(callbacks.getCurrentWorkspaceScreen());
|
||||
}
|
||||
}
|
||||
if (runLoader) {
|
||||
startLoader(PagedView.INVALID_RESTORE_PAGE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1313,7 +1309,7 @@ public class LauncherModel extends BroadcastReceiver
|
||||
|
||||
// If there is already one running, tell it to stop.
|
||||
stopLoaderLocked();
|
||||
mLoaderTask = new LoaderTask(mApp.getContext(), loadFlags);
|
||||
mLoaderTask = new LoaderTask(mApp.getContext(), loadFlags, synchronousBindPage);
|
||||
if (synchronousBindPage != PagedView.INVALID_RESTORE_PAGE
|
||||
&& mAllAppsLoaded && mWorkspaceLoaded && !mIsLoaderTaskRunning) {
|
||||
mLoaderTask.runBindSynchronousPage(synchronousBindPage);
|
||||
@@ -1367,14 +1363,17 @@ public class LauncherModel extends BroadcastReceiver
|
||||
*/
|
||||
private class LoaderTask implements Runnable {
|
||||
private Context mContext;
|
||||
private int mPageToBindFirst;
|
||||
|
||||
@Thunk boolean mIsLoadingAndBindingWorkspace;
|
||||
private boolean mStopped;
|
||||
@Thunk boolean mLoadAndBindStepFinished;
|
||||
private int mFlags;
|
||||
|
||||
LoaderTask(Context context, int flags) {
|
||||
LoaderTask(Context context, int flags, int pageToBindFirst) {
|
||||
mContext = context;
|
||||
mFlags = flags;
|
||||
mPageToBindFirst = pageToBindFirst;
|
||||
}
|
||||
|
||||
private void loadAndBindWorkspace() {
|
||||
@@ -1396,7 +1395,7 @@ public class LauncherModel extends BroadcastReceiver
|
||||
}
|
||||
|
||||
// Bind the workspace
|
||||
bindWorkspace(-1);
|
||||
bindWorkspace(mPageToBindFirst);
|
||||
}
|
||||
|
||||
private void waitForIdle() {
|
||||
|
||||
Reference in New Issue
Block a user