diff options
author | Winson Chung <winsonc@google.com> | 2010-09-10 11:44:42 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2010-09-15 14:45:11 -0700 |
commit | e3193b93ad7bf33e2e45319084a99b9fc986622b (patch) | |
tree | 7d9676014362869b928faefa0a9323d2e8a3edb9 /src/com/android/launcher2/PagedViewCellLayout.java | |
parent | 1ff706b8c03063740ca74868fea46fa47d71bb27 (diff) | |
download | android_packages_apps_Trebuchet-e3193b93ad7bf33e2e45319084a99b9fc986622b.tar.gz android_packages_apps_Trebuchet-e3193b93ad7bf33e2e45319084a99b9fc986622b.tar.bz2 android_packages_apps_Trebuchet-e3193b93ad7bf33e2e45319084a99b9fc986622b.zip |
Initital changes for new customization drawer/widget tab design.
Change-Id: I160c8777fe2657ab303acfa20934f2e90f9e953e
Diffstat (limited to 'src/com/android/launcher2/PagedViewCellLayout.java')
-rw-r--r-- | src/com/android/launcher2/PagedViewCellLayout.java | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java index 219a36204..b247a065f 100644 --- a/src/com/android/launcher2/PagedViewCellLayout.java +++ b/src/com/android/launcher2/PagedViewCellLayout.java @@ -252,6 +252,16 @@ public class PagedViewCellLayout extends ViewGroup { requestLayout(); } + public void setCellDimensions(int width, int height) { + mCellWidth = width; + mCellHeight = height; + requestLayout(); + } + + public int getDefaultCellDimensions() { + return sDefaultCellDimensions; + } + private void setChildrenAlpha(float alpha) { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { @@ -281,37 +291,36 @@ public class PagedViewCellLayout extends ViewGroup { lp.isDragging = true; } + /** + * Estimates the number of cells that the specified width would take up. + */ public int estimateCellHSpan(int width) { + // TODO: we need to take widthGap into effect return (width + mCellWidth) / mCellWidth; } + + /** + * Estimates the number of cells that the specified height would take up. + */ public int estimateCellVSpan(int height) { + // TODO: we need to take heightGap into effect return (height + mCellHeight) / mCellHeight; } - public int[] estimateCellDimensions(int approxWidth, int approxHeight, - int cellHSpan, int cellVSpan) { - // NOTE: we are disabling this until we find a good way to approximate this without fully - // measuring - /* - // we may want to use this before any measuring/layout happens, so we pass in an approximate - // size for the layout - int numWidthGaps = mCellCountX - 1; - int numHeightGaps = mCellCountY - 1; - int hSpaceLeft = approxWidth - mPaddingLeft - - mPaddingRight - (mCellWidth * mCellCountX); - int vSpaceLeft = approxHeight - mPaddingTop - - mPaddingBottom - (mCellHeight * mCellCountY); - int widthGap = hSpaceLeft / numWidthGaps; - int heightGap = vSpaceLeft / numHeightGaps; - int minGap = Math.min(widthGap, heightGap); - return new int[] { - (cellHSpan * mCellWidth) + ((cellHSpan - 1) * minGap), - (cellVSpan * mCellHeight) + ((cellVSpan - 1) * minGap) - }; - */ - return new int[] { - (cellHSpan * mCellWidth), - (cellVSpan * mCellHeight) - }; + + /** + * Estimates the width that the number of vSpan cells will take up. + */ + public int estimateCellWidth(int hSpan) { + // TODO: we need to take widthGap into effect + return hSpan * mCellWidth; + } + + /** + * Estimates the height that the number of vSpan cells will take up. + */ + public int estimateCellHeight(int vSpan) { + // TODO: we need to take heightGap into effect + return vSpan * mCellHeight; } @Override |