Update icon and text size for two panel home screen
Adding new field for landscape icon text size and changing
the logic for when to use landscape sizes.
Test: manual
Bug: 182796672
Change-Id: I89833e8fd90f2606937c3b95ac10229a042213ec
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 99f6c75..381b0fe 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -162,6 +162,8 @@
<!-- landscapeIconSize defaults to iconSize, if not specified -->
<attr name="landscapeIconSize" format="float" />
<attr name="iconTextSize" format="float" />
+ <!-- landscapeIconTextSize defaults to iconTextSize, if not specified -->
+ <attr name="landscapeIconTextSize" format="float" />
<!-- If true, this display option is used to determine the default grid -->
<attr name="canBeDefault" format="boolean" />
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index aea38a0..35b0f27 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -506,9 +506,10 @@
// Workspace
final boolean isVerticalLayout = isVerticalBarLayout();
- float invIconSizeDp = isVerticalLayout ? inv.landscapeIconSize : inv.iconSize;
+ float invIconSizeDp = isLandscape ? inv.landscapeIconSize : inv.iconSize;
iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mInfo.metrics, scale));
- iconTextSizePx = (int) (Utilities.pxFromSp(inv.iconTextSize, mInfo.metrics) * scale);
+ float invIconTextSizeSp = isLandscape ? inv.landscapeIconTextSize : inv.iconTextSize;
+ iconTextSizePx = (int) (Utilities.pxFromSp(invIconTextSizeSp, mInfo.metrics) * scale);
iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * scale);
setCellLayoutBorderSpacing((int) (cellLayoutBorderSpacingOriginalPx * scale));
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 754e988..5612daf 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -106,6 +106,7 @@
public float iconSize;
public String iconShapePath;
public float landscapeIconSize;
+ public float landscapeIconTextSize;
public int iconBitmapSize;
public int fillResIconDpi;
public float iconTextSize;
@@ -163,6 +164,7 @@
landscapeIconSize = p.landscapeIconSize;
iconBitmapSize = p.iconBitmapSize;
iconTextSize = p.iconTextSize;
+ landscapeIconTextSize = p.landscapeIconTextSize;
numHotseatIcons = p.numHotseatIcons;
numAllAppsColumns = p.numAllAppsColumns;
isScalable = p.isScalable;
@@ -293,6 +295,7 @@
landscapeIconSize = displayOption.landscapeIconSize;
iconBitmapSize = ResourceUtils.pxFromDp(iconSize, displayInfo.metrics);
iconTextSize = displayOption.iconTextSize;
+ landscapeIconTextSize = displayOption.landscapeIconTextSize;
fillResIconDpi = getLauncherIconDensity(iconBitmapSize);
minCellHeight = displayOption.minCellHeight;
@@ -678,6 +681,7 @@
private float iconSize;
private float iconTextSize;
private float landscapeIconSize;
+ private float landscapeIconTextSize;
private float allAppsIconSize;
private float allAppsIconTextSize;
@@ -702,6 +706,8 @@
landscapeIconSize = a.getFloat(R.styleable.ProfileDisplayOption_landscapeIconSize,
iconSize);
iconTextSize = a.getFloat(R.styleable.ProfileDisplayOption_iconTextSize, 0);
+ landscapeIconTextSize = a.getFloat(
+ R.styleable.ProfileDisplayOption_landscapeIconTextSize, iconTextSize);
allAppsIconSize = a.getFloat(R.styleable.ProfileDisplayOption_allAppsIconSize,
iconSize);
@@ -731,6 +737,7 @@
landscapeIconSize *= w;
allAppsIconSize *= w;
iconTextSize *= w;
+ landscapeIconTextSize *= w;
allAppsIconTextSize *= w;
minCellHeight *= w;
minCellWidth *= w;
@@ -744,6 +751,7 @@
landscapeIconSize += p.landscapeIconSize;
allAppsIconSize += p.allAppsIconSize;
iconTextSize += p.iconTextSize;
+ landscapeIconTextSize += p.landscapeIconTextSize;
allAppsIconTextSize += p.allAppsIconTextSize;
minCellHeight += p.minCellHeight;
minCellWidth += p.minCellWidth;