Bound drop target layout values to left and right.

Test: manual
Fix: 232636570
Bug: 233225825
Change-Id: I388cb3407cb9f887ccc222f4804636f9f7651884
This commit is contained in:
Pat Manning
2022-05-19 18:48:14 +01:00
parent 3e6cd99990
commit 3c0f4c156d

View File

@@ -285,13 +285,21 @@ public class DropTargetBar extends FrameLayout
int buttonPlusGapWidth = leftButtonWidth + buttonGap + rightButtonWidth;
int extraSpace = end - start - buttonPlusGapWidth;
start = (start - left) + (extraSpace / 2);
int leftBound = Math.max(left, 0);
int rightBound = Math.min(right, dp.availableWidthPx);
leftButton.layout(start, 0, start + leftButtonWidth,
int leftButtonStart = Utilities.boundToRange(
(start - left) + (extraSpace / 2), leftBound, rightBound);
int leftButtonEnd = Utilities.boundToRange(
leftButtonStart + leftButtonWidth, leftBound, rightBound);
int rightButtonStart = Utilities.boundToRange(
leftButtonEnd + buttonGap, leftBound, rightBound);
int rightButtonEnd = Utilities.boundToRange(
rightButtonStart + rightButtonWidth, leftBound, rightBound);
leftButton.layout(leftButtonStart, 0, leftButtonEnd,
leftButton.getMeasuredHeight());
int rightButtonStart = start + leftButtonWidth + buttonGap;
rightButton.layout(rightButtonStart, 0, rightButtonStart + rightButtonWidth,
rightButton.layout(rightButtonStart, 0, rightButtonEnd,
rightButton.getMeasuredHeight());
}
}