code cleanup, preparing for spring-loaded adding to screens

Change-Id: Ic52b8df2b4c4998272fbfe2b1b195c177cac9a23
This commit is contained in:
Michael Jurka
2010-11-23 16:23:58 -08:00
parent f32e5e842e
commit af91de06b9
5 changed files with 85 additions and 113 deletions
+15 -3
View File
@@ -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.view.animation.Animation.AnimationListener;
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 @@ public abstract class PagedView extends ViewGroup {
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()) {