Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragPositioningCallbackUtility.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -142,6 +142,24 @@ public class DragPositioningCallbackUtility { repositionTaskBounds.offset((int) deltaX, (int) deltaY); repositionTaskBounds.offset((int) deltaX, (int) deltaY); } } /** * Calculates the new position of the top edge of the task and returns true if it is below the * disallowed area. * * @param disallowedAreaForEndBoundsHeight the height of the area that where the task positioner * should not finalize the bounds using WCT#setBounds * @param taskBoundsAtDragStart the bounds of the task on the first drag input event * @param repositionStartPoint initial input coordinate * @param y the y position of the motion event * @return true if the top of the task is below the disallowed area */ static boolean isBelowDisallowedArea(int disallowedAreaForEndBoundsHeight, Rect taskBoundsAtDragStart, PointF repositionStartPoint, float y) { final float deltaY = y - repositionStartPoint.y; final float topPosition = taskBoundsAtDragStart.top + deltaY; return topPosition > disallowedAreaForEndBoundsHeight; } /** /** * Updates repositionTaskBounds to the final bounds of the task after the drag is finished. If * Updates repositionTaskBounds to the final bounds of the task after the drag is finished. If * the bounds are outside of the stable bounds, they are shifted to place task at the top of the * the bounds are outside of the stable bounds, they are shifted to place task at the top of the Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -125,7 +125,9 @@ class FluidResizeTaskPositioner implements DragPositioningCallback { } } mTaskOrganizer.applyTransaction(wct); mTaskOrganizer.applyTransaction(wct); } else if (mCtrlType == CTRL_TYPE_UNDEFINED } else if (mCtrlType == CTRL_TYPE_UNDEFINED && y > mDisallowedAreaForEndBoundsHeight) { && DragPositioningCallbackUtility.isBelowDisallowedArea( mDisallowedAreaForEndBoundsHeight, mTaskBoundsAtDragStart, mRepositionStartPoint, y)) { final WindowContainerTransaction wct = new WindowContainerTransaction(); final WindowContainerTransaction wct = new WindowContainerTransaction(); DragPositioningCallbackUtility.onDragEnd(mRepositionTaskBounds, DragPositioningCallbackUtility.onDragEnd(mRepositionTaskBounds, mTaskBoundsAtDragStart, mStableBounds, mRepositionStartPoint, x, y); mTaskBoundsAtDragStart, mStableBounds, mRepositionStartPoint, x, y); Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -142,7 +142,9 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback, // won't be called. // won't be called. mDesktopWindowDecoration.hideResizeVeil(); mDesktopWindowDecoration.hideResizeVeil(); } } } else if (y > mDisallowedAreaForEndBoundsHeight) { } else if (DragPositioningCallbackUtility.isBelowDisallowedArea( mDisallowedAreaForEndBoundsHeight, mTaskBoundsAtDragStart, mRepositionStartPoint, y)) { DragPositioningCallbackUtility.onDragEnd(mRepositionTaskBounds, DragPositioningCallbackUtility.onDragEnd(mRepositionTaskBounds, mTaskBoundsAtDragStart, mStableBounds, mRepositionStartPoint, x, y); mTaskBoundsAtDragStart, mStableBounds, mRepositionStartPoint, x, y); DragPositioningCallbackUtility.applyTaskBoundsChange(new WindowContainerTransaction(), DragPositioningCallbackUtility.applyTaskBoundsChange(new WindowContainerTransaction(), Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragPositioningCallbackUtility.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -142,6 +142,24 @@ public class DragPositioningCallbackUtility { repositionTaskBounds.offset((int) deltaX, (int) deltaY); repositionTaskBounds.offset((int) deltaX, (int) deltaY); } } /** * Calculates the new position of the top edge of the task and returns true if it is below the * disallowed area. * * @param disallowedAreaForEndBoundsHeight the height of the area that where the task positioner * should not finalize the bounds using WCT#setBounds * @param taskBoundsAtDragStart the bounds of the task on the first drag input event * @param repositionStartPoint initial input coordinate * @param y the y position of the motion event * @return true if the top of the task is below the disallowed area */ static boolean isBelowDisallowedArea(int disallowedAreaForEndBoundsHeight, Rect taskBoundsAtDragStart, PointF repositionStartPoint, float y) { final float deltaY = y - repositionStartPoint.y; final float topPosition = taskBoundsAtDragStart.top + deltaY; return topPosition > disallowedAreaForEndBoundsHeight; } /** /** * Updates repositionTaskBounds to the final bounds of the task after the drag is finished. If * Updates repositionTaskBounds to the final bounds of the task after the drag is finished. If * the bounds are outside of the stable bounds, they are shifted to place task at the top of the * the bounds are outside of the stable bounds, they are shifted to place task at the top of the Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositioner.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -125,7 +125,9 @@ class FluidResizeTaskPositioner implements DragPositioningCallback { } } mTaskOrganizer.applyTransaction(wct); mTaskOrganizer.applyTransaction(wct); } else if (mCtrlType == CTRL_TYPE_UNDEFINED } else if (mCtrlType == CTRL_TYPE_UNDEFINED && y > mDisallowedAreaForEndBoundsHeight) { && DragPositioningCallbackUtility.isBelowDisallowedArea( mDisallowedAreaForEndBoundsHeight, mTaskBoundsAtDragStart, mRepositionStartPoint, y)) { final WindowContainerTransaction wct = new WindowContainerTransaction(); final WindowContainerTransaction wct = new WindowContainerTransaction(); DragPositioningCallbackUtility.onDragEnd(mRepositionTaskBounds, DragPositioningCallbackUtility.onDragEnd(mRepositionTaskBounds, mTaskBoundsAtDragStart, mStableBounds, mRepositionStartPoint, x, y); mTaskBoundsAtDragStart, mStableBounds, mRepositionStartPoint, x, y); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -142,7 +142,9 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback, // won't be called. // won't be called. mDesktopWindowDecoration.hideResizeVeil(); mDesktopWindowDecoration.hideResizeVeil(); } } } else if (y > mDisallowedAreaForEndBoundsHeight) { } else if (DragPositioningCallbackUtility.isBelowDisallowedArea( mDisallowedAreaForEndBoundsHeight, mTaskBoundsAtDragStart, mRepositionStartPoint, y)) { DragPositioningCallbackUtility.onDragEnd(mRepositionTaskBounds, DragPositioningCallbackUtility.onDragEnd(mRepositionTaskBounds, mTaskBoundsAtDragStart, mStableBounds, mRepositionStartPoint, x, y); mTaskBoundsAtDragStart, mStableBounds, mRepositionStartPoint, x, y); DragPositioningCallbackUtility.applyTaskBoundsChange(new WindowContainerTransaction(), DragPositioningCallbackUtility.applyTaskBoundsChange(new WindowContainerTransaction(), Loading