mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Add bottom padding to hotseat in multi-window mode.
In multi-window mode, the navigation bar is black which makes the hotseat's top padding -- and lack of symmetric botom padding -- super apparent. We add bottom padding to the hotseat so that the hotseat icons remain visually centered. Bug: 32176631 Change-Id: I3eebf5ab98898c8ee092bda6ec48c6afdcd353b9
This commit is contained in:
@@ -112,6 +112,7 @@ public class DeviceProfile {
|
||||
public int hotseatIconSizePx;
|
||||
public int hotseatBarHeightPx;
|
||||
private int hotseatBarTopPaddingPx;
|
||||
private int hotseatBarBottomPaddingPx;
|
||||
private int hotseatLandGutterPx;
|
||||
|
||||
// All apps
|
||||
@@ -185,6 +186,7 @@ public class DeviceProfile {
|
||||
hotseatBarHeightPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_height);
|
||||
hotseatBarTopPaddingPx =
|
||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding);
|
||||
hotseatBarBottomPaddingPx = 0;
|
||||
hotseatLandGutterPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_gutter_width);
|
||||
|
||||
// Determine sizes.
|
||||
@@ -215,6 +217,9 @@ public class DeviceProfile {
|
||||
profile.cellHeightPx = profile.iconSizePx + profile.iconDrawablePaddingPx
|
||||
+ Utilities.calculateTextHeight(profile.iconTextSizePx);
|
||||
|
||||
// The nav bar is black so we add bottom padding to visually center hotseat icons.
|
||||
profile.hotseatBarBottomPaddingPx = profile.hotseatBarTopPaddingPx;
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
@@ -404,7 +409,8 @@ public class DeviceProfile {
|
||||
availablePaddingX = (int) Math.min(availablePaddingX,
|
||||
width * MAX_HORIZONTAL_PADDING_PERCENT);
|
||||
int availablePaddingY = Math.max(0, height - topWorkspacePadding - paddingBottom
|
||||
- (int) (2 * inv.numRows * cellHeightPx));
|
||||
- (2 * inv.numRows * cellHeightPx) - hotseatBarTopPaddingPx
|
||||
- hotseatBarBottomPaddingPx);
|
||||
padding.set(availablePaddingX / 2, topWorkspacePadding + availablePaddingY / 2,
|
||||
availablePaddingX / 2, paddingBottom + availablePaddingY / 2);
|
||||
} else {
|
||||
@@ -537,7 +543,7 @@ public class DeviceProfile {
|
||||
lp.height = hotseatBarHeightPx + mInsets.bottom;
|
||||
hotseat.getLayout().setPadding(hotseatAdjustment + workspacePadding.left,
|
||||
hotseatBarTopPaddingPx, hotseatAdjustment + workspacePadding.right,
|
||||
mInsets.bottom);
|
||||
hotseatBarBottomPaddingPx + mInsets.bottom);
|
||||
} else {
|
||||
// For phones, layout the hotseat without any bottom margin
|
||||
// to ensure that we have space for the folders
|
||||
@@ -546,7 +552,7 @@ public class DeviceProfile {
|
||||
lp.height = hotseatBarHeightPx + mInsets.bottom;
|
||||
hotseat.getLayout().setPadding(hotseatAdjustment + workspacePadding.left,
|
||||
hotseatBarTopPaddingPx, hotseatAdjustment + workspacePadding.right,
|
||||
mInsets.bottom);
|
||||
hotseatBarBottomPaddingPx + mInsets.bottom);
|
||||
}
|
||||
hotseat.setLayoutParams(lp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user