mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 07:46:55 +00:00
Merge "Make hotseat RTL aware" into tm-dev am: ee80d6919e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/17523011 Change-Id: I6f3b94f7c3f1805f317b225a3825b39decb4abfd Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1015,29 +1015,32 @@ public class DeviceProfile {
|
||||
mInsets.right + hotseatBarSidePaddingStartPx, paddingBottom);
|
||||
}
|
||||
} else if (isTaskbarPresent) {
|
||||
boolean isRtl = Utilities.isRtl(context.getResources());
|
||||
int hotseatHeight = workspacePadding.bottom;
|
||||
int taskbarOffset = getTaskbarOffsetY();
|
||||
int additionalLeftSpace = 0;
|
||||
|
||||
// Center the QSB with hotseat and push icons to the right
|
||||
if (isQsbInline) {
|
||||
additionalLeftSpace = qsbWidth + hotseatBorderSpace;
|
||||
}
|
||||
// Push icons to the side
|
||||
int additionalQsbSpace = isQsbInline ? qsbWidth + hotseatBorderSpace : 0;
|
||||
|
||||
// Center the QSB vertically with hotseat
|
||||
int hotseatTopPadding = hotseatHeight - taskbarOffset - hotseatCellHeightPx;
|
||||
|
||||
int endOffset = ApiWrapper.getHotseatEndOffset(context);
|
||||
int requiredWidth = iconSizePx * numShownHotseatIcons
|
||||
+ hotseatBorderSpace * (numShownHotseatIcons - 1)
|
||||
+ additionalLeftSpace;
|
||||
+ additionalQsbSpace;
|
||||
|
||||
int hotseatSize = Math.min(requiredWidth, availableWidthPx - endOffset);
|
||||
int sideSpacing = (availableWidthPx - hotseatSize) / 2;
|
||||
mHotseatPadding.set(sideSpacing + additionalLeftSpace, hotseatTopPadding, sideSpacing,
|
||||
taskbarOffset);
|
||||
int hotseatWidth = Math.min(requiredWidth, availableWidthPx - endOffset);
|
||||
int sideSpacing = (availableWidthPx - hotseatWidth) / 2;
|
||||
mHotseatPadding.set(sideSpacing, hotseatTopPadding, sideSpacing, taskbarOffset);
|
||||
|
||||
if (isRtl) {
|
||||
mHotseatPadding.right += additionalQsbSpace;
|
||||
} else {
|
||||
mHotseatPadding.left += additionalQsbSpace;
|
||||
}
|
||||
|
||||
if (endOffset > sideSpacing) {
|
||||
int diff = Utilities.isRtl(context.getResources())
|
||||
int diff = isRtl
|
||||
? sideSpacing - endOffset
|
||||
: endOffset - sideSpacing;
|
||||
mHotseatPadding.left -= diff;
|
||||
@@ -1087,7 +1090,7 @@ public class DeviceProfile {
|
||||
*/
|
||||
public int getTaskbarOffsetY() {
|
||||
if (isQsbInline) {
|
||||
return getQsbOffsetY() + (Math.abs(hotseatQsbHeight - iconSizePx) / 2);
|
||||
return getQsbOffsetY() - (Math.abs(hotseatQsbHeight - hotseatCellHeightPx) / 2);
|
||||
} else {
|
||||
return (getQsbOffsetY() - taskbarSize) / 2;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,8 @@ public class Hotseat extends CellLayout implements Insettable {
|
||||
int left;
|
||||
if (mActivity.getDeviceProfile().isQsbInline) {
|
||||
int qsbSpace = mActivity.getDeviceProfile().hotseatBorderSpace;
|
||||
left = l + getPaddingLeft() - qsbWidth - qsbSpace;
|
||||
left = Utilities.isRtl(getResources()) ? r - getPaddingRight() + qsbSpace
|
||||
: l + getPaddingLeft() - qsbWidth - qsbSpace;
|
||||
} else {
|
||||
left = (r - l - qsbWidth) / 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user