diff options
Diffstat (limited to 'src/com/android/launcher2/PagedViewCellLayout.java')
-rw-r--r-- | src/com/android/launcher2/PagedViewCellLayout.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java index 29dc352..5e87b46 100644 --- a/src/com/android/launcher2/PagedViewCellLayout.java +++ b/src/com/android/launcher2/PagedViewCellLayout.java @@ -352,6 +352,14 @@ public class PagedViewCellLayout extends ViewGroup implements Page { return n; } + /** Returns an estimated center position of the cell at the specified index */ + public int[] estimateCellPosition(int x, int y) { + return new int[] { + mPaddingLeft + (x * mCellWidth) + (x * mWidthGap) + (mCellWidth / 2), + mPaddingTop + (y * mCellHeight) + (y * mHeightGap) + (mCellHeight / 2) + }; + } + public void calculateCellCount(int width, int height, int maxCellCountX, int maxCellCountY) { mCellCountX = Math.min(maxCellCountX, estimateCellHSpan(width)); mCellCountY = Math.min(maxCellCountY, estimateCellVSpan(height)); |