Merge "Ensure FloatingToolbar is not rendered at negative x, y coordinates." into nyc-dev

am: d971a9d5f2

* commit 'd971a9d5f2f945d89728af7fffe1e692c1c91e3b':
  Ensure FloatingToolbar is not rendered at negative x, y coordinates.

Change-Id: I2db5a9b674c0319b7c07a18ee763fcc1d90da7ea
This commit is contained in:
Abodunrinwa Toki
2016-04-29 14:09:05 +00:00
committed by android-build-merger

View File

@@ -592,9 +592,11 @@ public final class FloatingToolbar {
private void refreshCoordinatesAndOverflowDirection(Rect contentRectOnScreen) {
refreshViewPort();
int x = contentRectOnScreen.centerX() - mPopupWindow.getWidth() / 2;
// Update x so that the toolbar isn't rendered behind the nav bar in landscape.
x = Math.max(0, Math.min(x, mViewPortOnScreen.right - mPopupWindow.getWidth()));
// Initialize x ensuring that the toolbar isn't rendered behind the nav bar in
// landscape.
final int x = Math.min(
contentRectOnScreen.centerX() - mPopupWindow.getWidth() / 2,
mViewPortOnScreen.right - mPopupWindow.getWidth());
final int y;
@@ -684,7 +686,8 @@ public final class FloatingToolbar {
int rootViewTopOnWindow = mTmpCoords[1];
int windowLeftOnScreen = rootViewLeftOnScreen - rootViewLeftOnWindow;
int windowTopOnScreen = rootViewTopOnScreen - rootViewTopOnWindow;
mCoordsOnWindow.set(x - windowLeftOnScreen, y - windowTopOnScreen);
mCoordsOnWindow.set(
Math.max(0, x - windowLeftOnScreen), Math.max(0, y - windowTopOnScreen));
}
/**