Merge "Add border space to all apps cells" into tm-dev
This commit is contained in:
+34
-8
@@ -258,14 +258,6 @@
|
|||||||
<attr name="allAppsCellHeightTwoPanelLandscape" format="float" />
|
<attr name="allAppsCellHeightTwoPanelLandscape" format="float" />
|
||||||
<!-- defaults to allAppsCellWidth, if not specified -->
|
<!-- defaults to allAppsCellWidth, if not specified -->
|
||||||
<attr name="allAppsCellWidthTwoPanelLandscape" format="float" />
|
<attr name="allAppsCellWidthTwoPanelLandscape" format="float" />
|
||||||
<!-- defaults to borderSpace, if not specified -->
|
|
||||||
<attr name="allAppsBorderSpace" format="float" />
|
|
||||||
<!-- defaults to allAppsBorderSpace, if not specified -->
|
|
||||||
<attr name="allAppsBorderSpaceLandscape" format="float" />
|
|
||||||
<!-- defaults to allAppsBorderSpace, if not specified -->
|
|
||||||
<attr name="allAppsBorderSpaceTwoPanelPortrait" format="float" />
|
|
||||||
<!-- defaults to allAppsBorderSpace, if not specified -->
|
|
||||||
<attr name="allAppsBorderSpaceTwoPanelLandscape" format="float" />
|
|
||||||
<!-- The following values are only enabled if grid is supported. -->
|
<!-- The following values are only enabled if grid is supported. -->
|
||||||
<!-- defaults to iconImageSize, if not specified -->
|
<!-- defaults to iconImageSize, if not specified -->
|
||||||
<attr name="allAppsIconSize" format="float" />
|
<attr name="allAppsIconSize" format="float" />
|
||||||
@@ -280,6 +272,40 @@
|
|||||||
<!-- defaults to allAppsIconTextSize, if not specified -->
|
<!-- defaults to allAppsIconTextSize, if not specified -->
|
||||||
<attr name="allAppsIconTextSizeTwoPanelLandscape" format="float" />
|
<attr name="allAppsIconTextSizeTwoPanelLandscape" format="float" />
|
||||||
|
|
||||||
|
<!-- defaults to borderSpace, if not specified -->
|
||||||
|
<!-- space to be used horizontally and vertically -->
|
||||||
|
<attr name="allAppsBorderSpace" format="float" />
|
||||||
|
<!-- space to the right of the cell, defaults to allAppsBorderSpace if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceHorizontal" format="float" />
|
||||||
|
<!-- space below the cell, defaults to allAppsBorderSpace if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceVertical" format="float" />
|
||||||
|
<!-- space to be used horizontally and vertically,
|
||||||
|
defaults to allAppsBorderSpace if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceLandscape" format="float" />
|
||||||
|
<!-- space to the right of the cell, defaults to allAppsBorderSpaceLandscape
|
||||||
|
if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceLandscapeHorizontal" format="float" />
|
||||||
|
<!-- space below the cell, defaults to allAppsBorderSpaceLandscape if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceLandscapeVertical" format="float" />
|
||||||
|
<!-- space to be used horizontally and vertically in two panels,
|
||||||
|
defaults to allAppsBorderSpace if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceTwoPanelPortrait" format="float" />
|
||||||
|
<!-- space to the right of the cell in two panels, defaults to
|
||||||
|
allAppsBorderSpaceTwoPanelPortrait if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceTwoPanelPortraitHorizontal" format="float" />
|
||||||
|
<!-- space below the cell in two panels, defaults to allAppsBorderSpaceTwoPanelPortrait
|
||||||
|
if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceTwoPanelPortraitVertical" format="float" />
|
||||||
|
<!-- space to be used horizontally and vertically in two panels,
|
||||||
|
defaults to allAppsBorderSpace if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceTwoPanelLandscape" format="float" />
|
||||||
|
<!-- space to the right of the cell in two panels, defaults to
|
||||||
|
allAppsBorderSpaceTwoPanelLandscape if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceTwoPanelLandscapeHorizontal" format="float" />
|
||||||
|
<!-- space below the cell in two panels, defaults to allAppsBorderSpaceTwoPanelLandscape
|
||||||
|
if not specified -->
|
||||||
|
<attr name="allAppsBorderSpaceTwoPanelLandscapeVertical" format="float" />
|
||||||
|
|
||||||
<!-- defaults to borderSpaceDps, if not specified -->
|
<!-- defaults to borderSpaceDps, if not specified -->
|
||||||
<attr name="hotseatBorderSpace" format="float" />
|
<attr name="hotseatBorderSpace" format="float" />
|
||||||
<!-- defaults to hotseatBorderSpace, if not specified -->
|
<!-- defaults to hotseatBorderSpace, if not specified -->
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ public class DeviceProfile {
|
|||||||
pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].x, mMetrics),
|
pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].x, mMetrics),
|
||||||
pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].y, mMetrics));
|
pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].y, mMetrics));
|
||||||
cellLayoutBorderSpaceOriginalPx = new Point(cellLayoutBorderSpacePx);
|
cellLayoutBorderSpaceOriginalPx = new Point(cellLayoutBorderSpacePx);
|
||||||
folderCellLayoutBorderSpaceOriginalPx = pxFromDp(inv.folderBorderSpace, mMetrics, 1f);
|
folderCellLayoutBorderSpaceOriginalPx = pxFromDp(inv.folderBorderSpace, mMetrics);
|
||||||
folderCellLayoutBorderSpacePx = new Point(folderCellLayoutBorderSpaceOriginalPx,
|
folderCellLayoutBorderSpacePx = new Point(folderCellLayoutBorderSpaceOriginalPx,
|
||||||
folderCellLayoutBorderSpaceOriginalPx);
|
folderCellLayoutBorderSpaceOriginalPx);
|
||||||
|
|
||||||
@@ -525,21 +525,21 @@ public class DeviceProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Point getCellLayoutBorderSpace(InvariantDeviceProfile idp) {
|
private Point getCellLayoutBorderSpace(InvariantDeviceProfile idp) {
|
||||||
|
return getCellLayoutBorderSpace(idp, 1f);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Point getCellLayoutBorderSpace(InvariantDeviceProfile idp, float scale) {
|
||||||
if (!isScalableGrid) {
|
if (!isScalableGrid) {
|
||||||
return new Point(0, 0);
|
return new Point(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int horizontalSpacePx = pxFromDp(idp.borderSpaces[mTypeIndex].x, mMetrics);
|
int horizontalSpacePx = pxFromDp(idp.borderSpaces[mTypeIndex].x, mMetrics, scale);
|
||||||
int verticalSpacePx = pxFromDp(idp.borderSpaces[mTypeIndex].y, mMetrics);
|
int verticalSpacePx = pxFromDp(idp.borderSpaces[mTypeIndex].y, mMetrics, scale);
|
||||||
|
|
||||||
return new Point(horizontalSpacePx, verticalSpacePx);
|
return new Point(horizontalSpacePx, verticalSpacePx);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Point getCellLayoutBorderSpaceScaled(InvariantDeviceProfile idp, float scale) {
|
|
||||||
Point original = getCellLayoutBorderSpace(idp);
|
|
||||||
return new Point((int) (original.x * scale), (int) (original.y * scale));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Info getDisplayInfo() {
|
public Info getDisplayInfo() {
|
||||||
return mInfo;
|
return mInfo;
|
||||||
}
|
}
|
||||||
@@ -708,7 +708,7 @@ public class DeviceProfile {
|
|||||||
iconTextSizePx = (int) (pxFromSp(invIconTextSizeSp, mMetrics) * iconScale);
|
iconTextSizePx = (int) (pxFromSp(invIconTextSizeSp, mMetrics) * iconScale);
|
||||||
iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * iconScale);
|
iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * iconScale);
|
||||||
|
|
||||||
cellLayoutBorderSpacePx = getCellLayoutBorderSpaceScaled(inv, scale);
|
cellLayoutBorderSpacePx = getCellLayoutBorderSpace(inv, scale);
|
||||||
|
|
||||||
if (isScalableGrid) {
|
if (isScalableGrid) {
|
||||||
cellWidthPx = pxFromDp(inv.minCellSize[mTypeIndex].x, mMetrics, scale);
|
cellWidthPx = pxFromDp(inv.minCellSize[mTypeIndex].x, mMetrics, scale);
|
||||||
@@ -756,15 +756,22 @@ public class DeviceProfile {
|
|||||||
* Updates the iconSize for allApps* variants.
|
* Updates the iconSize for allApps* variants.
|
||||||
*/
|
*/
|
||||||
public void updateAllAppsIconSize(float scale, Resources res) {
|
public void updateAllAppsIconSize(float scale, Resources res) {
|
||||||
//TODO(b/218638090): remove the tablet condition once we have phone specs
|
allAppsBorderSpacePx = new Point(
|
||||||
if (isScalableGrid && isTablet) {
|
pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].x, mMetrics, scale),
|
||||||
|
pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].y, mMetrics, scale));
|
||||||
|
if (isScalableGrid) {
|
||||||
allAppsIconSizePx =
|
allAppsIconSizePx =
|
||||||
pxFromDp(inv.allAppsIconSize[mTypeIndex], mMetrics);
|
pxFromDp(inv.allAppsIconSize[mTypeIndex], mMetrics);
|
||||||
allAppsIconTextSizePx =
|
allAppsIconTextSizePx =
|
||||||
pxFromSp(inv.allAppsIconTextSize[mTypeIndex], mMetrics);
|
pxFromSp(inv.allAppsIconTextSize[mTypeIndex], mMetrics);
|
||||||
allAppsIconDrawablePaddingPx = iconDrawablePaddingOriginalPx;
|
allAppsIconDrawablePaddingPx = iconDrawablePaddingOriginalPx;
|
||||||
|
// AllApps cells don't have real space between cells,
|
||||||
|
// so we add the border space to the cell height
|
||||||
|
allAppsCellHeightPx = pxFromDp(inv.allAppsCellSize[mTypeIndex].y, mMetrics, scale)
|
||||||
|
+ allAppsBorderSpacePx.y;
|
||||||
|
// but width is just the cell,
|
||||||
|
// the border is added in #updateAllAppsContainerWidth
|
||||||
allAppsCellWidthPx = pxFromDp(inv.allAppsCellSize[mTypeIndex].x, mMetrics, scale);
|
allAppsCellWidthPx = pxFromDp(inv.allAppsCellSize[mTypeIndex].x, mMetrics, scale);
|
||||||
allAppsCellHeightPx = pxFromDp(inv.allAppsCellSize[mTypeIndex].y, mMetrics, scale);
|
|
||||||
} else {
|
} else {
|
||||||
float invIconSizeDp = inv.iconSize[mTypeIndex];
|
float invIconSizeDp = inv.iconSize[mTypeIndex];
|
||||||
float invIconTextSizeSp = inv.iconTextSize[mTypeIndex];
|
float invIconTextSizeSp = inv.iconTextSize[mTypeIndex];
|
||||||
|
|||||||
@@ -900,19 +900,44 @@ public class InvariantDeviceProfile {
|
|||||||
allAppsCellSize[INDEX_DEFAULT].y);
|
allAppsCellSize[INDEX_DEFAULT].y);
|
||||||
allAppsCellSize[INDEX_TWO_PANEL_LANDSCAPE] = new PointF(x, y);
|
allAppsCellSize[INDEX_TWO_PANEL_LANDSCAPE] = new PointF(x, y);
|
||||||
|
|
||||||
x = y = a.getFloat(R.styleable.ProfileDisplayOption_allAppsBorderSpace,
|
float allAppsBorderSpace = a.getFloat(
|
||||||
borderSpace);
|
R.styleable.ProfileDisplayOption_allAppsBorderSpace, borderSpace);
|
||||||
allAppsBorderSpaces[INDEX_DEFAULT] = new PointF(x, y);
|
float allAppsBorderSpaceLandscape = a.getFloat(
|
||||||
x = y = a.getFloat(R.styleable.ProfileDisplayOption_allAppsBorderSpaceLandscape,
|
R.styleable.ProfileDisplayOption_allAppsBorderSpaceLandscape,
|
||||||
allAppsBorderSpaces[INDEX_DEFAULT].x);
|
allAppsBorderSpace);
|
||||||
allAppsBorderSpaces[INDEX_LANDSCAPE] = new PointF(x, y);
|
float allAppsBorderSpaceTwoPanelPortrait = a.getFloat(
|
||||||
x = y = a.getFloat(
|
|
||||||
R.styleable.ProfileDisplayOption_allAppsBorderSpaceTwoPanelPortrait,
|
R.styleable.ProfileDisplayOption_allAppsBorderSpaceTwoPanelPortrait,
|
||||||
allAppsBorderSpaces[INDEX_DEFAULT].x);
|
allAppsBorderSpace);
|
||||||
allAppsBorderSpaces[INDEX_TWO_PANEL_PORTRAIT] = new PointF(x, y);
|
float allAppsBorderSpaceTwoPanelLandscape = a.getFloat(
|
||||||
x = y = a.getFloat(
|
|
||||||
R.styleable.ProfileDisplayOption_allAppsBorderSpaceTwoPanelLandscape,
|
R.styleable.ProfileDisplayOption_allAppsBorderSpaceTwoPanelLandscape,
|
||||||
allAppsBorderSpaces[INDEX_DEFAULT].x);
|
allAppsBorderSpace);
|
||||||
|
|
||||||
|
x = a.getFloat(R.styleable.ProfileDisplayOption_allAppsBorderSpaceHorizontal,
|
||||||
|
allAppsBorderSpace);
|
||||||
|
y = a.getFloat(R.styleable.ProfileDisplayOption_allAppsBorderSpaceVertical,
|
||||||
|
allAppsBorderSpace);
|
||||||
|
allAppsBorderSpaces[INDEX_DEFAULT] = new PointF(x, y);
|
||||||
|
|
||||||
|
x = a.getFloat(R.styleable.ProfileDisplayOption_allAppsBorderSpaceLandscapeHorizontal,
|
||||||
|
allAppsBorderSpaceLandscape);
|
||||||
|
y = a.getFloat(R.styleable.ProfileDisplayOption_allAppsBorderSpaceLandscapeVertical,
|
||||||
|
allAppsBorderSpaceLandscape);
|
||||||
|
allAppsBorderSpaces[INDEX_LANDSCAPE] = new PointF(x, y);
|
||||||
|
|
||||||
|
x = a.getFloat(
|
||||||
|
R.styleable.ProfileDisplayOption_allAppsBorderSpaceTwoPanelPortraitHorizontal,
|
||||||
|
allAppsBorderSpaceTwoPanelPortrait);
|
||||||
|
y = a.getFloat(
|
||||||
|
R.styleable.ProfileDisplayOption_allAppsBorderSpaceTwoPanelPortraitVertical,
|
||||||
|
allAppsBorderSpaceTwoPanelPortrait);
|
||||||
|
allAppsBorderSpaces[INDEX_TWO_PANEL_PORTRAIT] = new PointF(x, y);
|
||||||
|
|
||||||
|
x = a.getFloat(
|
||||||
|
R.styleable.ProfileDisplayOption_allAppsBorderSpaceTwoPanelLandscapeHorizontal,
|
||||||
|
allAppsBorderSpaceTwoPanelLandscape);
|
||||||
|
y = a.getFloat(
|
||||||
|
R.styleable.ProfileDisplayOption_allAppsBorderSpaceTwoPanelLandscapeVertical,
|
||||||
|
allAppsBorderSpaceTwoPanelLandscape);
|
||||||
allAppsBorderSpaces[INDEX_TWO_PANEL_LANDSCAPE] = new PointF(x, y);
|
allAppsBorderSpaces[INDEX_TWO_PANEL_LANDSCAPE] = new PointF(x, y);
|
||||||
|
|
||||||
iconSizes[INDEX_DEFAULT] =
|
iconSizes[INDEX_DEFAULT] =
|
||||||
|
|||||||
Reference in New Issue
Block a user