mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 02:38:20 +00:00
Pass a location when dragging bubble to fullscreen
When a bubble is dragged to full screen, pass the x and y coordinates of where the bubble was released to wm shell. The coordinates are used as a starting point for expanding the full screen task. Flag: com.android.wm.shell.enable_bubble_to_fullscreen Bug: 388858013 Test: treehugger Change-Id: I28bb10bdfb00786e43b350239cfdeb3df20b4a6f
This commit is contained in:
@@ -1364,12 +1364,12 @@ public class BubbleBarViewController {
|
||||
* Removes the bubble from the bubble bar and notifies sysui that the bubble should move to
|
||||
* full screen.
|
||||
*/
|
||||
public void moveBubbleToFullscreen(@NonNull BubbleView bubbleView) {
|
||||
public void moveDraggedBubbleToFullscreen(@NonNull BubbleView bubbleView, Point dropLocation) {
|
||||
if (bubbleView.getBubble() == null) {
|
||||
return;
|
||||
}
|
||||
String key = bubbleView.getBubble().getKey();
|
||||
mSystemUiProxy.moveBubbleToFullscreen(key);
|
||||
mSystemUiProxy.moveDraggedBubbleToFullscreen(key, dropLocation);
|
||||
onBubbleDismissed(bubbleView);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.android.launcher3.taskbar.bubbles;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.VelocityTracker;
|
||||
@@ -231,13 +232,14 @@ public class BubbleDragController {
|
||||
}
|
||||
|
||||
@Override
|
||||
void onDragEnd() {
|
||||
void onDragEnd(float x, float y) {
|
||||
mBubbleBarController.updateBubbleBarLocation(getBubbleBarLocationDuringDrag(),
|
||||
BubbleBarLocation.UpdateSource.DRAG_BUBBLE);
|
||||
if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) {
|
||||
mDropTargetManager.onDragEnded();
|
||||
if (mBubbleDragZoneChangedListener.isDraggedToFullscreen()) {
|
||||
mBubbleBarViewController.moveBubbleToFullscreen(bubbleView);
|
||||
mBubbleBarViewController.moveDraggedBubbleToFullscreen(
|
||||
bubbleView, new Point((int) x, (int) y));
|
||||
}
|
||||
} else {
|
||||
mBubblePinController.setListener(null);
|
||||
@@ -329,7 +331,7 @@ public class BubbleDragController {
|
||||
}
|
||||
|
||||
@Override
|
||||
void onDragEnd() {
|
||||
void onDragEnd(float x, float y) {
|
||||
// Make sure to update location as the first thing. Pivot update causes a relayout
|
||||
mBubbleBarController.updateBubbleBarLocation(getBubbleBarLocationDuringDrag(),
|
||||
BubbleBarLocation.UpdateSource.DRAG_BAR);
|
||||
@@ -428,7 +430,7 @@ public class BubbleDragController {
|
||||
/**
|
||||
* Called when the dragging interaction has ended and all the animations have completed
|
||||
*/
|
||||
abstract void onDragEnd();
|
||||
abstract void onDragEnd(float x, float y);
|
||||
|
||||
/**
|
||||
* Called when the dragged bubble is released outside of the dismiss target area and will
|
||||
@@ -579,7 +581,7 @@ public class BubbleDragController {
|
||||
Runnable onComplete = () -> {
|
||||
mActivity.setTaskbarWindowFullscreen(false);
|
||||
cleanUp(view);
|
||||
onDragEnd();
|
||||
onDragEnd(event.getRawX(), event.getRawY());
|
||||
};
|
||||
|
||||
if (mBubbleDismissController.handleTouchEvent(event)) {
|
||||
|
||||
@@ -690,10 +690,10 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context:
|
||||
bubbles?.showDropTarget(show, bubbleBarLocation)
|
||||
}
|
||||
|
||||
/** Tells SysUI to move the bubble to full screen. */
|
||||
fun moveBubbleToFullscreen(key: String) {
|
||||
executeWithErrorLog({ "Failed to call moveBubbleToFullscreen"}) {
|
||||
bubbles?.moveBubbleToFullscreen(key)
|
||||
/** Tells SysUI to move the dragged bubble to full screen. */
|
||||
fun moveDraggedBubbleToFullscreen(key: String, dropLocation: Point) {
|
||||
executeWithErrorLog({ "Failed to call moveDraggedBubbleToFullscreen"}) {
|
||||
bubbles?.moveDraggedBubbleToFullscreen(key, dropLocation)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user