summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/Workspace.java
diff options
context:
space:
mode:
authorEd Heyl <ed@google.com>2012-07-25 14:52:36 -0700
committerEd Heyl <ed@google.com>2012-07-25 14:52:36 -0700
commit90abcc94258ba9d9c8b68ac9764b6ab1eba12985 (patch)
treebc753e764d1fecedbd43a4f9ea7d3c29e5298008 /src/com/android/launcher2/Workspace.java
parent4a3b54f51f54b5d68926d312eb07d74f90a1673d (diff)
parent0ede734d0780a968c9c345f99a18f9f8b9fc02cd (diff)
downloadandroid_packages_apps_Trebuchet-90abcc94258ba9d9c8b68ac9764b6ab1eba12985.tar.gz
android_packages_apps_Trebuchet-90abcc94258ba9d9c8b68ac9764b6ab1eba12985.tar.bz2
android_packages_apps_Trebuchet-90abcc94258ba9d9c8b68ac9764b6ab1eba12985.zip
resolved conflicts w/0ede734d0780a968c9c345f99a18f9f8b9fc02cd
Change-Id: I50900698a590e8d84a6cbcc560f95209d3a6d110
Diffstat (limited to 'src/com/android/launcher2/Workspace.java')
-rw-r--r--src/com/android/launcher2/Workspace.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 2e35261a9..d1d47f5f6 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -43,6 +43,7 @@ import android.os.IBinder;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
+import android.util.SparseArray;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
@@ -224,6 +225,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;
@@ -3420,6 +3424,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();