diff options
author | Michael Jurka <mikejurka@google.com> | 2010-11-23 16:23:58 -0800 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2010-12-08 14:52:41 -0800 |
commit | af91de06b99e2d5d41ce79fefa34ce2111e51917 (patch) | |
tree | d3a3d749bde953ae46563fe1621e9f0d9fe3b0e9 /src/com/android/launcher2/PagedView.java | |
parent | f32e5e842ed49826bf188e54e400880f36e4d601 (diff) | |
download | android_packages_apps_Trebuchet-af91de06b99e2d5d41ce79fefa34ce2111e51917.tar.gz android_packages_apps_Trebuchet-af91de06b99e2d5d41ce79fefa34ce2111e51917.tar.bz2 android_packages_apps_Trebuchet-af91de06b99e2d5d41ce79fefa34ce2111e51917.zip |
code cleanup, preparing for spring-loaded adding to screens
Change-Id: Ic52b8df2b4c4998272fbfe2b1b195c177cac9a23
Diffstat (limited to 'src/com/android/launcher2/PagedView.java')
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 257531ecd..fed0884c3 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.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()) { |