mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Include border spacing to align tasbar icons with hotseat.
The original calculation was including spacing in the the hotseatCellSize, but that causes us to incorrectly compute the hotseatIconCenter. If we take advantage of DeviceProfile.calculateCellWidth, we get the width without the spacing. Then we can add spacing for every icon to the left of the current one when figuring out the center. Test: Manual on tablet using device types tablet and multi display. Fix: 210123477 Change-Id: Ie182718ad3a229ffa8bae031f3ac7f73f8539f49
This commit is contained in:
@@ -204,9 +204,11 @@ public class TaskbarViewController {
|
||||
PendingAnimation setter = new PendingAnimation(100);
|
||||
Rect hotseatPadding = launcherDp.getHotseatLayoutPadding(mActivity);
|
||||
float scaleUp = ((float) launcherDp.iconSizePx) / mActivity.getDeviceProfile().iconSizePx;
|
||||
int hotseatCellSize =
|
||||
(launcherDp.availableWidthPx - hotseatPadding.left - hotseatPadding.right)
|
||||
/ launcherDp.numShownHotseatIcons;
|
||||
int borderSpacing = launcherDp.cellLayoutBorderSpacePx.x;
|
||||
int hotseatCellSize = DeviceProfile.calculateCellWidth(
|
||||
launcherDp.availableWidthPx - hotseatPadding.left - hotseatPadding.right,
|
||||
borderSpacing,
|
||||
launcherDp.numShownHotseatIcons);
|
||||
|
||||
int offsetY = launcherDp.getTaskbarOffsetY();
|
||||
setter.setFloat(mTaskbarIconTranslationYForHome, VALUE, -offsetY, LINEAR);
|
||||
@@ -225,7 +227,8 @@ public class TaskbarViewController {
|
||||
setter.setFloat(child, SCALE_PROPERTY, scaleUp, LINEAR);
|
||||
|
||||
float childCenter = (child.getLeft() + child.getRight()) / 2;
|
||||
float hotseatIconCenter = hotseatPadding.left + hotseatCellSize * info.screenId
|
||||
float hotseatIconCenter = hotseatPadding.left
|
||||
+ (hotseatCellSize + borderSpacing) * info.screenId
|
||||
+ hotseatCellSize / 2;
|
||||
setter.setFloat(child, ICON_TRANSLATE_X, hotseatIconCenter - childCenter, LINEAR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user