Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee80d691 authored by Thales Lima's avatar Thales Lima Committed by Android (Google) Code Review
Browse files

Merge "Make hotseat RTL aware" into tm-dev

parents 1dcf3d1a 612230db
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -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;
        }
+2 −1
Original line number Diff line number Diff line
@@ -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;
        }