mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Merge "Fix bug where icons in hotseat were clipped when display size is Small." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
23415e214c
@@ -149,10 +149,11 @@ public class DeviceProfile {
|
||||
// Hotseat
|
||||
public final int numShownHotseatIcons;
|
||||
public int hotseatCellHeightPx;
|
||||
private final int hotseatExtraVerticalSize;
|
||||
// In portrait: size = height, in landscape: size = width
|
||||
public int hotseatBarSizePx;
|
||||
public final int hotseatBarTopPaddingPx;
|
||||
public int hotseatBarBottomPaddingPx;
|
||||
public final int hotseatBarBottomPaddingPx;
|
||||
// Start is the side next to the nav bar, end is the side next to the workspace
|
||||
public final int hotseatBarSidePaddingStartPx;
|
||||
public final int hotseatBarSidePaddingEndPx;
|
||||
@@ -326,13 +327,9 @@ public class DeviceProfile {
|
||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_side_padding);
|
||||
// Add a bit of space between nav bar and hotseat in vertical bar layout.
|
||||
hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? workspacePageIndicatorHeight : 0;
|
||||
int hotseatExtraVerticalSize =
|
||||
hotseatExtraVerticalSize =
|
||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size);
|
||||
hotseatBarSizePx = pxFromDp(inv.iconSize, mMetrics, 1f)
|
||||
+ (isVerticalBarLayout()
|
||||
? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx)
|
||||
: (hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx
|
||||
+ (isScalableGrid ? 0 : hotseatExtraVerticalSize)));
|
||||
updateHotseatIconSize(pxFromDp(inv.iconSize, mMetrics, 1f));
|
||||
|
||||
overviewTaskMarginPx = res.getDimensionPixelSize(R.dimen.overview_task_margin);
|
||||
overviewTaskIconSizePx =
|
||||
@@ -362,7 +359,6 @@ public class DeviceProfile {
|
||||
extraHotseatBottomPadding = Math.round(paddingHotseatBottom * iconScale);
|
||||
|
||||
hotseatBarSizePx += extraHotseatBottomPadding;
|
||||
hotseatBarBottomPaddingPx += extraHotseatBottomPadding;
|
||||
} else if (!isVerticalBarLayout() && isPhone && isTallDevice) {
|
||||
// We increase the hotseat size when there is extra space.
|
||||
// ie. For a display with a large aspect ratio, we can keep the icons on the workspace
|
||||
@@ -371,7 +367,6 @@ public class DeviceProfile {
|
||||
int extraSpace = getCellSize().y - iconSizePx - iconDrawablePaddingPx * 2
|
||||
- workspacePageIndicatorHeight;
|
||||
hotseatBarSizePx += extraSpace;
|
||||
hotseatBarBottomPaddingPx += extraSpace;
|
||||
|
||||
// Recalculate the available dimensions using the new hotseat size.
|
||||
updateAvailableDimensions(res);
|
||||
@@ -388,6 +383,17 @@ public class DeviceProfile {
|
||||
new DotRenderer(allAppsIconSizePx, dotPath, DEFAULT_DOT_SIZE);
|
||||
}
|
||||
|
||||
private void updateHotseatIconSize(int hotseatIconSizePx) {
|
||||
hotseatCellHeightPx = hotseatIconSizePx;
|
||||
if (isVerticalBarLayout()) {
|
||||
hotseatBarSizePx = hotseatIconSizePx + hotseatBarSidePaddingStartPx
|
||||
+ hotseatBarSidePaddingEndPx;
|
||||
} else {
|
||||
hotseatBarSizePx = hotseatIconSizePx + hotseatBarTopPaddingPx
|
||||
+ hotseatBarBottomPaddingPx + (isScalableGrid ? 0 : hotseatExtraVerticalSize);
|
||||
}
|
||||
}
|
||||
|
||||
private void setCellLayoutBorderSpacing(int borderSpacing) {
|
||||
cellLayoutBorderSpacingPx = isScalableGrid ? borderSpacing : 0;
|
||||
}
|
||||
@@ -573,11 +579,7 @@ public class DeviceProfile {
|
||||
}
|
||||
|
||||
// Hotseat
|
||||
if (isVerticalLayout) {
|
||||
hotseatBarSizePx = iconSizePx + hotseatBarSidePaddingStartPx
|
||||
+ hotseatBarSidePaddingEndPx;
|
||||
}
|
||||
hotseatCellHeightPx = iconSizePx;
|
||||
updateHotseatIconSize(iconSizePx);
|
||||
|
||||
if (!isVerticalLayout) {
|
||||
int expectedWorkspaceHeight = availableHeightPx - hotseatBarSizePx
|
||||
@@ -763,7 +765,8 @@ public class DeviceProfile {
|
||||
hotseatBarTopPaddingPx,
|
||||
hotseatAdjustment + workspacePadding.right + cellLayoutPaddingLeftRightPx
|
||||
+ mInsets.right,
|
||||
hotseatBarBottomPaddingPx + mInsets.bottom + cellLayoutBottomPaddingPx);
|
||||
hotseatBarSizePx - hotseatCellHeightPx - hotseatBarTopPaddingPx
|
||||
+ cellLayoutBottomPaddingPx + mInsets.bottom);
|
||||
}
|
||||
return mHotseatPadding;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user