summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DeviceProfile.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-08-20 12:33:21 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-08-20 12:56:58 -0700
commit756cd26592dee6b956becdc24d60995c64de9153 (patch)
tree3d415a7820c619e6c85f78000016f4403c346f2b /src/com/android/launcher3/DeviceProfile.java
parent7b7d6d09eec6b9f65273f597b2d93fc53a9069ff (diff)
downloadandroid_packages_apps_Trebuchet-756cd26592dee6b956becdc24d60995c64de9153.tar.gz
android_packages_apps_Trebuchet-756cd26592dee6b956becdc24d60995c64de9153.tar.bz2
android_packages_apps_Trebuchet-756cd26592dee6b956becdc24d60995c64de9153.zip
General code refactoring
> Removing utility method for isAttachedToWindow > Moving logic to calculate cell size from workspace to DeviceProfile > Replacing some constants with xml resource variables > Saving the item info using content values for better compatibility with other methods Change-Id: Idd612633d97a6241cb31148df9466031374bd5a0
Diffstat (limited to 'src/com/android/launcher3/DeviceProfile.java')
-rw-r--r--src/com/android/launcher3/DeviceProfile.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 9b4642d66..6364d90c1 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -280,6 +280,18 @@ public class DeviceProfile {
return bounds;
}
+ public Point getCellSize() {
+ Point result = new Point();
+ // Since we are only concerned with the overall padding, layout direction does
+ // not matter.
+ Rect padding = getWorkspacePadding(false /* isLayoutRtl */ );
+ result.x = calculateCellWidth(availableWidthPx - padding.left - padding.right,
+ inv.numColumns);
+ result.y = calculateCellHeight(availableHeightPx - padding.top - padding.bottom,
+ inv.numRows);
+ return result;
+ }
+
/** Returns the workspace padding in the specified orientation */
Rect getWorkspacePadding(boolean isLayoutRtl) {
Rect searchBarBounds = getSearchBarBounds(isLayoutRtl);