Move NavButtons to end of taskbar

* Layout hotseat icons from the end instead of the start
* IME down and system back arrow are now separate views

Bug: 191399224
Test: Tested w/ RTL + LTR in gesture
and 3 button nav w/ and w/o IME

Change-Id: I4d0ecd0bee0c519892c63eeefef45055b26d349b
This commit is contained in:
Vinit Nayak
2021-07-19 12:53:28 -07:00
parent 5bd217414c
commit 8dcbde87c0
6 changed files with 65 additions and 44 deletions

View File

@@ -194,24 +194,30 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
int count = getChildCount();
int spaceNeeded = count * (mItemMarginLeftRight * 2 + mIconTouchSize);
int iconStart = (right - left - spaceNeeded) / 2;
int startOffset = ApiWrapper.getHotseatStartOffset(getContext());
if (startOffset > iconStart) {
int diff = startOffset - iconStart;
iconStart = isLayoutRtl() ? (iconStart - diff) : iconStart + diff;
int navSpaceNeeded = ApiWrapper.getHotseatEndOffset(getContext());
boolean layoutRtl = isLayoutRtl();
int iconEnd = right - (right - left - spaceNeeded) / 2;
boolean needMoreSpaceForNav = layoutRtl ?
navSpaceNeeded > (iconEnd - spaceNeeded) :
iconEnd > (right - navSpaceNeeded);
if (needMoreSpaceForNav) {
int offset = layoutRtl ?
navSpaceNeeded - (iconEnd - spaceNeeded) :
(right - navSpaceNeeded) - iconEnd;
iconEnd += offset;
}
// Layout the children
mIconLayoutBounds.left = iconStart;
mIconLayoutBounds.right = iconEnd;
mIconLayoutBounds.top = (bottom - top - mIconTouchSize) / 2;
mIconLayoutBounds.bottom = mIconLayoutBounds.top + mIconTouchSize;
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
iconStart += mItemMarginLeftRight;
int iconEnd = iconStart + mIconTouchSize;
for (int i = count; i > 0; i--) {
View child = getChildAt(i - 1);
iconEnd -= mItemMarginLeftRight;
int iconStart = iconEnd - mIconTouchSize;
child.layout(iconStart, mIconLayoutBounds.top, iconEnd, mIconLayoutBounds.bottom);
iconStart = iconEnd + mItemMarginLeftRight;
iconEnd = iconStart - mItemMarginLeftRight;
}
mIconLayoutBounds.right = iconStart;
mIconLayoutBounds.left = iconEnd;
}
@Override