From 79c938e8becd6c1f52b0ba7c8ffe23b116a4489e Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 11 Apr 2022 20:17:19 -0700 Subject: [PATCH] Prevent arrow popup from going off screen bottom when below icon. The current approach sometimes causes popups to go off the bottom of the screen, because we are not account for top insets and we are double counting extraVerticalSpace. Test: Manual Fix: 228326181 Change-Id: I148f9ff579e4406a0834195977e1cb7abf3707e5 --- src/com/android/launcher3/popup/ArrowPopup.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java index df8a3e2e8a..196cc56be7 100644 --- a/src/com/android/launcher3/popup/ArrowPopup.java +++ b/src/com/android/launcher3/popup/ArrowPopup.java @@ -602,6 +602,7 @@ public abstract class ArrowPopup mIsAboveIcon = y > dragLayer.getTop() + insets.top; if (!mIsAboveIcon) { y = mTempRect.top + iconHeight + extraVerticalSpace; + height -= extraVerticalSpace; } // Insets are added later, so subtract them now. @@ -609,7 +610,7 @@ public abstract class ArrowPopup y -= insets.top; mGravity = 0; - if (y + height > dragLayer.getBottom() - insets.bottom) { + if ((insets.top + y + height) > (dragLayer.getBottom() - insets.bottom)) { // The container is opening off the screen, so just center it in the drag layer instead. mGravity = Gravity.CENTER_VERTICAL; // Put the container next to the icon, preferring the right side in ltr (left in rtl).