From a93e1583528fb93b3aad3c2b4bcc2c794a4ae23d Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 29 Sep 2021 15:41:08 -0700 Subject: [PATCH] Update stashed handle region to only include the handle Before it included the whole width/height of the view, rather than just the outline where the handle is drawn. Test: Swipe up from a light app on dark wallpaper, ensure handle changes color as soon as the white app background is past halfway through the handle Bug: 193938970 Change-Id: Ic8b83f60976f05b8ff56590422bd9b2fa6140e76 --- .../android/launcher3/taskbar/StashedHandleView.java | 10 +++++++--- .../launcher3/taskbar/StashedHandleViewController.java | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java index 0224bc4a5b..670035aee2 100644 --- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java +++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleView.java @@ -54,10 +54,14 @@ public class StashedHandleView extends View { R.color.taskbar_stashed_handle_dark_color); } - public void updateSampledRegion() { + /** + * Updates mSampledRegion to be the location of the stashedHandleBounds relative to the screen. + * @see #getSampledRegion() + */ + public void updateSampledRegion(Rect stashedHandleBounds) { getLocationOnScreen(mTmpArr); - mSampledRegion.set(mTmpArr[0], mTmpArr[1], mTmpArr[0] + getWidth(), - mTmpArr[1] + getHeight()); + mSampledRegion.set(stashedHandleBounds); + mSampledRegion.offset(mTmpArr[0], mTmpArr[1]); } public Rect getSampledRegion() { diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java index 2858d7c38e..d6e0ba7d04 100644 --- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java @@ -109,6 +109,7 @@ public class StashedHandleViewController { stashedCenterY - mStashedHandleHeight / 2, stashedCenterX + mStashedHandleWidth / 2, stashedCenterY + mStashedHandleHeight / 2); + mStashedHandleView.updateSampledRegion(mStashedHandleBounds); mStashedHandleRadius = view.getHeight() / 2f; outline.setRoundRect(mStashedHandleBounds, mStashedHandleRadius); } @@ -154,7 +155,7 @@ public class StashedHandleViewController { public void onIsStashed(boolean isStashed) { mRegionSamplingHelper.setWindowVisible(isStashed); if (isStashed) { - mStashedHandleView.updateSampledRegion(); + mStashedHandleView.updateSampledRegion(mStashedHandleBounds); mRegionSamplingHelper.start(mStashedHandleView.getSampledRegion()); } else { mRegionSamplingHelper.stop();