Fix hotseat width to span a number of columns

Bug: 227344807
Test: manual
Change-Id: Ice4e37929bcbb8c9cf3af340e67b6bec002578bd
This commit is contained in:
Thales Lima
2022-04-26 20:29:30 +01:00
parent 8073fc8daf
commit 828875cd12
11 changed files with 104 additions and 48 deletions

View File

@@ -125,6 +125,7 @@ public class InvariantDeviceProfile {
public PointF[] borderSpaces;
public float folderBorderSpace;
public float[] hotseatBorderSpaces;
public int[] hotseatColumnSpan;
public float[] horizontalMargin;
@@ -356,6 +357,7 @@ public class InvariantDeviceProfile {
numDatabaseHotseatIcons = deviceType == TYPE_MULTI_DISPLAY
? closestProfile.numDatabaseHotseatIcons : closestProfile.numHotseatIcons;
hotseatBorderSpaces = displayOption.hotseatBorderSpaces;
hotseatColumnSpan = displayOption.hotseatColumnSpan;
numAllAppsColumns = closestProfile.numAllAppsColumns;
numDatabaseAllAppsColumns = deviceType == TYPE_MULTI_DISPLAY
@@ -396,7 +398,8 @@ public class InvariantDeviceProfile {
// We need to ensure that there is enough extra space in the wallpaper
// for the intended parallax effects
float parallaxFactor =
dpiFromPx(Math.min(displayWidth, displayHeight), displayInfo.densityDpi) < 720
dpiFromPx(Math.min(displayWidth, displayHeight), displayInfo.getDensityDpi())
< 720
? 2
: wallpaperTravelToScreenWidthRatio(displayWidth, displayHeight);
defaultWallpaperSize.x =
@@ -585,8 +588,8 @@ public class InvariantDeviceProfile {
}
}
float width = dpiFromPx(minWidthPx, displayInfo.densityDpi);
float height = dpiFromPx(minHeightPx, displayInfo.densityDpi);
float width = dpiFromPx(minWidthPx, displayInfo.getDensityDpi());
float height = dpiFromPx(minHeightPx, displayInfo.getDensityDpi());
// Sort the profiles based on the closeness to the device size
Collections.sort(points, (a, b) ->
@@ -806,7 +809,9 @@ public class InvariantDeviceProfile {
private float folderBorderSpace;
private final PointF[] borderSpaces = new PointF[COUNT_SIZES];
private final float[] horizontalMargin = new float[COUNT_SIZES];
//TODO(http://b/228998082) remove this when 3 button spaces are fixed
private final float[] hotseatBorderSpaces = new float[COUNT_SIZES];
private final int[] hotseatColumnSpan = new int[COUNT_SIZES];
private final float[] iconSizes = new float[COUNT_SIZES];
private final float[] textSizes = new float[COUNT_SIZES];
@@ -1032,6 +1037,17 @@ public class InvariantDeviceProfile {
R.styleable.ProfileDisplayOption_hotseatBorderSpaceTwoPanelPortrait,
hotseatBorderSpaces[INDEX_DEFAULT]);
hotseatColumnSpan[INDEX_DEFAULT] = a.getInt(
R.styleable.ProfileDisplayOption_hotseatColumnSpan, grid.numColumns);
hotseatColumnSpan[INDEX_LANDSCAPE] = a.getInt(
R.styleable.ProfileDisplayOption_hotseatColumnSpanLandscape, grid.numColumns);
hotseatColumnSpan[INDEX_TWO_PANEL_LANDSCAPE] = a.getInt(
R.styleable.ProfileDisplayOption_hotseatColumnSpanTwoPanelLandscape,
grid.numColumns);
hotseatColumnSpan[INDEX_TWO_PANEL_PORTRAIT] = a.getInt(
R.styleable.ProfileDisplayOption_hotseatColumnSpanTwoPanelPortrait,
grid.numColumns);
a.recycle();
}
@@ -1090,6 +1106,7 @@ public class InvariantDeviceProfile {
minCellSize[i].y += p.minCellSize[i].y;
horizontalMargin[i] += p.horizontalMargin[i];
hotseatBorderSpaces[i] += p.hotseatBorderSpaces[i];
hotseatColumnSpan[i] = p.hotseatColumnSpan[i];
allAppsCellSize[i].x += p.allAppsCellSize[i].x;
allAppsCellSize[i].y += p.allAppsCellSize[i].y;
allAppsIconSizes[i] += p.allAppsIconSizes[i];