summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/PagedViewCellLayout.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher2/PagedViewCellLayout.java')
-rw-r--r--src/com/android/launcher2/PagedViewCellLayout.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 29dc3521b..5e87b46d2 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));