Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 500a6cc6 authored by mpodolian's avatar mpodolian
Browse files

Add logic to show the expanded view drop target.

Added logic to show the expanded view silhouette at the Bubble Bar drop
location.

Bug: 388894910
Flag: com.android.wm.shell.enable_create_any_bubble
Test: Manual. Drag an app icon from the taskbar while inside the
application. Observe the expanded view appearing when the icon is
dragged over the Bubble Bar location and disappearing when dragged out.
video: http://recall/-/gx8ASgewUeUS3QYohfrd1J/erIYLNwEjzD0T5konPIdY6

Change-Id: I75433972c761fc6e99e46d999a2975131346e90f
parent 5f5442d2
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -95,7 +95,7 @@ abstract class BaseBubblePinController(private val screenSizeProvider: () -> Poi


    /** Signal the controller that dragging interaction has finished. */
    /** Signal the controller that dragging interaction has finished. */
    fun onDragEnd() {
    fun onDragEnd() {
        getDropTargetView()?.let { view -> view.animateOut { removeDropTargetView(view) } }
        hideDropTarget()
        dismissZone = null
        dismissZone = null
        listener?.onRelease(if (onLeft) LEFT else RIGHT)
        listener?.onRelease(if (onLeft) LEFT else RIGHT)
    }
    }
@@ -139,7 +139,7 @@ abstract class BaseBubblePinController(private val screenSizeProvider: () -> Poi
        return rect
        return rect
    }
    }


    private fun showDropTarget(location: BubbleBarLocation) {
    fun showDropTarget(location: BubbleBarLocation) {
        val targetView = getDropTargetView() ?: createDropTargetView().apply { alpha = 0f }
        val targetView = getDropTargetView() ?: createDropTargetView().apply { alpha = 0f }
        if (targetView.alpha > 0) {
        if (targetView.alpha > 0) {
            targetView.animateOut {
            targetView.animateOut {
@@ -152,6 +152,10 @@ abstract class BaseBubblePinController(private val screenSizeProvider: () -> Poi
        }
        }
    }
    }


    fun hideDropTarget() {
        getDropTargetView()?.let { view -> view.animateOut { removeDropTargetView(view) } }
    }

    private fun View.animateIn() {
    private fun View.animateIn() {
        dropTargetAnimator?.cancel()
        dropTargetAnimator?.cancel()
        dropTargetAnimator =
        dropTargetAnimator =
+12 −2
Original line number Original line Diff line number Diff line
@@ -849,16 +849,19 @@ public class BubbleController implements ConfigurationChangeListener,
    public void onDragItemOverBubbleBarDragZone(@Nullable BubbleBarLocation bubbleBarLocation) {
    public void onDragItemOverBubbleBarDragZone(@Nullable BubbleBarLocation bubbleBarLocation) {
        if (bubbleBarLocation == null) return;
        if (bubbleBarLocation == null) return;
        if (isShowingAsBubbleBar() && BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
        if (isShowingAsBubbleBar() && BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
            //TODO(b/388894910) show expanded view drop
            mBubbleStateListener.onDragItemOverBubbleBarDragZone(bubbleBarLocation);
            mBubbleStateListener.onDragItemOverBubbleBarDragZone(bubbleBarLocation);
            ensureBubbleViewsAndWindowCreated();
            if (mLayerView != null) {
                mLayerView.showBubbleBarExtendedViewDropTarget(bubbleBarLocation);
            }
        }
        }
    }
    }


    @Override
    @Override
    public void onItemDraggedOutsideBubbleBarDropZone() {
    public void onItemDraggedOutsideBubbleBarDropZone() {
        if (isShowingAsBubbleBar() && BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
        if (isShowingAsBubbleBar() && BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
            //TODO(b/388894910) hide expanded view drop
            mBubbleStateListener.onItemDraggedOutsideBubbleBarDropZone();
            mBubbleStateListener.onItemDraggedOutsideBubbleBarDropZone();
            hideBubbleBarExpandedViewDropTarget();
        }
        }
    }
    }


@@ -866,6 +869,7 @@ public class BubbleController implements ConfigurationChangeListener,
    public void onItemDroppedOverBubbleBarDragZone(@Nullable BubbleBarLocation bubbleBarLocation) {
    public void onItemDroppedOverBubbleBarDragZone(@Nullable BubbleBarLocation bubbleBarLocation) {
        if (bubbleBarLocation == null) return;
        if (bubbleBarLocation == null) return;
        if (isShowingAsBubbleBar() && BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
        if (isShowingAsBubbleBar() && BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
            hideBubbleBarExpandedViewDropTarget();
            //TODO(b/388894910) handle item drop with expandStackAndSelectBubble()
            //TODO(b/388894910) handle item drop with expandStackAndSelectBubble()
        }
        }
    }
    }
@@ -886,6 +890,12 @@ public class BubbleController implements ConfigurationChangeListener,
        return result;
        return result;
    }
    }


    private void hideBubbleBarExpandedViewDropTarget() {
        if (mLayerView != null) {
            mLayerView.hideBubbleBarExpandedViewDropTarget();
        }
    }

    /** Whether this userId belongs to the current user. */
    /** Whether this userId belongs to the current user. */
    private boolean isCurrentProfile(int userId) {
    private boolean isCurrentProfile(int userId) {
        return userId == UserHandle.USER_ALL
        return userId == UserHandle.USER_ALL
+10 −0
Original line number Original line Diff line number Diff line
@@ -128,6 +128,16 @@ public class BubbleBarLayerView extends FrameLayout
        setOnClickListener(view -> hideModalOrCollapse());
        setOnClickListener(view -> hideModalOrCollapse());
    }
    }


    /** Hides the expanded view drop target. */
    public void hideBubbleBarExpandedViewDropTarget() {
        mBubbleExpandedViewPinController.hideDropTarget();
    }

    /** Shows the expanded view drop target at the requested {@link BubbleBarLocation location} */
    public void showBubbleBarExtendedViewDropTarget(@NonNull BubbleBarLocation bubbleBarLocation) {
        mBubbleExpandedViewPinController.showDropTarget(bubbleBarLocation);
    }

    @Override
    @Override
    protected void onAttachedToWindow() {
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        super.onAttachedToWindow();