diff options
author | Steve Kondik <shade@chemlab.org> | 2012-11-05 12:14:58 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2012-11-05 12:14:58 -0800 |
commit | f5baac88b85efa794ae7909f784538f379dd36f2 (patch) | |
tree | c55b82edcaae558d71fc12f856bb93d9ae8ce8dc /src/com/cyanogenmod/trebuchet/Workspace.java | |
parent | 5bf25aecb90bd49ca3a8affea877e570b75baed6 (diff) | |
parent | 4124016ae5c8174aa53433894b896604ffa52c67 (diff) | |
download | android_packages_apps_Trebuchet-f5baac88b85efa794ae7909f784538f379dd36f2.tar.gz android_packages_apps_Trebuchet-f5baac88b85efa794ae7909f784538f379dd36f2.tar.bz2 android_packages_apps_Trebuchet-f5baac88b85efa794ae7909f784538f379dd36f2.zip |
Merge branch 'master' of https://android.googlesource.com/platform/packages/apps/Launcher2 into aosp
Conflicts:
res/layout-land/drop_target_bar.xml
src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java
src/com/cyanogenmod/trebuchet/Launcher.java
src/com/cyanogenmod/trebuchet/LauncherModel.java
Change-Id: I5aa702e333da27645b0d765b233f4d8a89991cb9
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/Workspace.java')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java index a947cd43d..cfe791280 100644 --- a/src/com/cyanogenmod/trebuchet/Workspace.java +++ b/src/com/cyanogenmod/trebuchet/Workspace.java @@ -49,6 +49,7 @@ import android.os.Parcelable; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; +import android.util.SparseArray; import android.view.Display; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -231,6 +232,9 @@ public class Workspace extends SmoothPagedView private int mLastReorderX = -1; private int mLastReorderY = -1; + private SparseArray<Parcelable> mSavedStates; + private final ArrayList<Integer> mRestoredPages = new ArrayList<Integer>(); + // These variables are used for storing the initial and final values during workspace animations private int mSavedScrollX; private float mSavedRotationY; @@ -1434,6 +1438,14 @@ public class Workspace extends SmoothPagedView } super.onDraw(canvas); + + // Call back to LauncherModel to finish binding after the first draw + post(new Runnable() { + @Override + public void run() { + mLauncher.getModel().bindRemainingSynchronousPages(); + } + }); } boolean isDrawingBackgroundGradient() { @@ -3516,6 +3528,32 @@ public class Workspace extends SmoothPagedView } @Override + protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container) { + // We don't dispatch restoreInstanceState to our children using this code path. + // Some pages will be restored immediately as their items are bound immediately, and + // others we will need to wait until after their items are bound. + mSavedStates = container; + } + + public void restoreInstanceStateForChild(int child) { + if (mSavedStates != null) { + mRestoredPages.add(child); + CellLayout cl = (CellLayout) getChildAt(child); + cl.restoreInstanceState(mSavedStates); + } + } + + public void restoreInstanceStateForRemainingPages() { + int count = getChildCount(); + for (int i = 0; i < count; i++) { + if (!mRestoredPages.contains(i)) { + restoreInstanceStateForChild(i); + } + } + mRestoredPages.clear(); + } + + @Override public void scrollLeft() { if (!isSmall() && !mIsSwitchingState) { super.scrollLeft(); |