code cleanup, preparing for spring-loaded adding to screens
Change-Id: Ic52b8df2b4c4998272fbfe2b1b195c177cac9a23
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 257531e..fed0884 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -16,8 +16,7 @@
package com.android.launcher2;
-import java.util.ArrayList;
-import java.util.HashMap;
+import com.android.launcher.R;
import android.content.Context;
import android.content.res.TypedArray;
@@ -41,7 +40,8 @@
import android.widget.Checkable;
import android.widget.Scroller;
-import com.android.launcher.R;
+import java.util.ArrayList;
+import java.util.HashMap;
/**
* An abstraction of the original Workspace which supports browsing through a
@@ -433,6 +433,18 @@
setMeasuredDimension(widthSize, heightSize);
}
+ protected void moveToNewPageWithoutMovingCellLayouts(int newCurrentPage) {
+ int newX = getChildOffset(newCurrentPage) - getRelativeChildOffset(newCurrentPage);
+ int delta = newX - mScrollX;
+
+ final int screenCount = getChildCount();
+ for (int i = 0; i < screenCount; i++) {
+ CellLayout cl = (CellLayout) getChildAt(i);
+ cl.setX(cl.getX() + delta);
+ }
+ setCurrentPage(newCurrentPage);
+ }
+
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) {