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

Commit e008411f authored by Jon Miranda's avatar Jon Miranda Committed by Android (Google) Code Review
Browse files

Merge "Align taskbar so that it does not overlap with nav buttons." into tm-qpr-dev

parents 495c7819 156ff34f
Loading
Loading
Loading
Loading
+16 −11
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar

    private float mTransientTaskbarAllAppsButtonTranslationXOffset;

    private final boolean mStartAlignTaskbar;
    private final boolean mShouldTryStartAlign;

    public TaskbarView(@NonNull Context context) {
        this(context, null);
@@ -121,7 +121,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
                resources.getDimension(isTransientTaskbar
                        ? R.dimen.transient_taskbar_all_apps_button_translation_x_offset
                        : R.dimen.taskbar_all_apps_button_translation_x_offset);
        mStartAlignTaskbar = mActivityContext.isThreeButtonNav()
        mShouldTryStartAlign = mActivityContext.isThreeButtonNav()
                && resources.getBoolean(R.bool.start_align_taskbar);

        int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
@@ -353,12 +353,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
        }
        int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
        boolean layoutRtl = isLayoutRtl();
        int iconEnd = right - (right - left - spaceNeeded) / 2;
        boolean needMoreSpaceForNav = layoutRtl ?
                navSpaceNeeded > (iconEnd - spaceNeeded) :
                iconEnd > (right - navSpaceNeeded);
        int centerAlignIconEnd = right - (right - left - spaceNeeded) / 2;
        int iconEnd;

        if (mStartAlignTaskbar) {
        if (mShouldTryStartAlign) {
            // Taskbar is aligned to the start
            int startSpacingPx = deviceProfile.inlineNavButtonsEndSpacingPx;

@@ -367,13 +365,20 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
            } else {
                iconEnd = startSpacingPx + spaceNeeded;
            }
        } else if (needMoreSpaceForNav) {
        } else {
            iconEnd = centerAlignIconEnd;
        }

        boolean needMoreSpaceForNav = layoutRtl
                ? navSpaceNeeded > (iconEnd - spaceNeeded)
                : iconEnd > (right - navSpaceNeeded);
        if (needMoreSpaceForNav) {
            // Add offset to account for nav bar when taskbar is centered
            int offset = layoutRtl
                    ? navSpaceNeeded - (iconEnd - spaceNeeded)
                    : (right - navSpaceNeeded) - iconEnd;
                    ? navSpaceNeeded - (centerAlignIconEnd - spaceNeeded)
                    : (right - navSpaceNeeded) - centerAlignIconEnd;

            iconEnd += offset;
            iconEnd = centerAlignIconEnd + offset;
        }

        sTmpRect.set(mIconLayoutBounds);