Fixing some grid spacing issues. (Bug 10754537, 10754538)
- Ensuring app names don't run into each other in folders and on the workspace
- Ensuring that app names are aligned with folder names
Change-Id: Ie8d546eacd52005778d81c46011c1c84bc24118c
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index bb6903d..7a7a3b6 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -102,10 +102,13 @@
public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache) {
Bitmap b = info.getIcon(iconCache);
+ LauncherAppState app = LauncherAppState.getInstance();
+ DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
setCompoundDrawablesWithIntrinsicBounds(null,
new FastBitmapDrawable(b),
null, null);
+ setCompoundDrawablePadding((int) ((grid.folderIconSizePx - grid.iconSizePx) / 2f));
setText(info.title);
setTag(info);
}
diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java
index 70f0000..6e10175 100644
--- a/src/com/android/launcher3/DynamicGrid.java
+++ b/src/com/android/launcher3/DynamicGrid.java
@@ -207,7 +207,7 @@
// Folder
folderCellWidthPx = cellWidthPx + 3 * edgeMarginPx;
- folderCellHeightPx = cellHeightPx + edgeMarginPx;
+ folderCellHeightPx = cellHeightPx + (int) ((3f/2f) * edgeMarginPx);
folderBackgroundOffset = -edgeMarginPx;
folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset;
}
diff --git a/src/com/android/launcher3/ShortcutAndWidgetContainer.java b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
index 5ce5571..b951100 100644
--- a/src/com/android/launcher3/ShortcutAndWidgetContainer.java
+++ b/src/com/android/launcher3/ShortcutAndWidgetContainer.java
@@ -137,7 +137,8 @@
// Otherwise, center the icon
int cHeight = mIsHotseatLayout ? grid.hotseatCellHeightPx : Math.min(getMeasuredHeight(), grid.cellHeightPx);
int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
- child.setPadding(0, cellPaddingY, 0, 0);
+ int cellPaddingX = (int) (grid.edgeMarginPx / 2f);
+ child.setPadding(cellPaddingX, cellPaddingY, cellPaddingX, 0);
}
} else {
lp.x = 0;