Bound drop target layout values to left and right. am: 3c0f4c156d

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/18491881

Change-Id: I73f92539caabbc4f7e2b2452c19dd5ad90b4a13d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Pat Manning
2022-05-20 00:30:18 +00:00
committed by Automerger Merge Worker
+13 -5
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());
}
}