Supporting custom widgets provided by launcher
-> This change provides integration for widgets provided by
the launcher package which can run arbitrary code.
Change-Id: I6052da5c4afed7ee72e3b44d045b9c46f2d84c42
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index d6aadce..34e1f3c 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -67,8 +67,8 @@
String name;
float minWidthDps;
float minHeightDps;
- float numRows;
- float numColumns;
+ public float numRows;
+ public float numColumns;
float numHotseatIcons;
float iconSize;
private float iconTextSize;
@@ -84,13 +84,13 @@
boolean transposeLayoutWithOrientation;
int desiredWorkspaceLeftRightMarginPx;
- int edgeMarginPx;
+ public int edgeMarginPx;
Rect defaultWidgetPadding;
int widthPx;
int heightPx;
- int availableWidthPx;
- int availableHeightPx;
+ public int availableWidthPx;
+ public int availableHeightPx;
int defaultPageSpacingPx;
int overviewModeMinIconZoneHeightPx;
@@ -100,11 +100,12 @@
float overviewModeIconZoneRatio;
float overviewModeScaleFactor;
+ public int cellWidthPx;
+ public int cellHeightPx;
+
int iconSizePx;
int iconTextSizePx;
int iconDrawablePaddingPx;
- int cellWidthPx;
- int cellHeightPx;
int allAppsIconSizePx;
int allAppsIconTextSizePx;
int allAppsCellWidthPx;
@@ -578,6 +579,16 @@
}
}
+ public int getWorkspaceGridHeight() {
+ Rect p = getWorkspacePadding();
+ return availableHeightPx - p.top - p.bottom;
+ }
+
+ public int getWorkspaceGridWidth() {
+ Rect p = getWorkspacePadding();
+ return availableWidthPx - p.left - p.right;
+ }
+
/** Returns the workspace padding in the specified orientation */
Rect getWorkspacePadding() {
return getWorkspacePadding(isLandscape ? CellLayout.LANDSCAPE : CellLayout.PORTRAIT);