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

Commit 3f84d8ca authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Add an option to move floating bubbles to fullscreen" into main

parents 7dc72ad5 0f82863d
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -103,4 +103,35 @@

    </LinearLayout>

    <!-- Menu option to move a bubble to fullscreen; only visible if bubble anything is enabled. -->
    <LinearLayout
        android:id="@+id/bubble_manage_menu_fullscreen_container"
        android:background="@drawable/bubble_manage_menu_row"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:minHeight="@dimen/bubble_menu_item_height"
        android:gravity="center_vertical"
        android:paddingStart="@dimen/bubble_menu_padding"
        android:paddingEnd="@dimen/bubble_menu_padding"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/bubble_manage_menu_fullscreen_icon"
            android:layout_width="@dimen/bubble_menu_icon_size"
            android:layout_height="@dimen/bubble_menu_icon_size"
            android:src="@drawable/desktop_mode_ic_handle_menu_fullscreen"
            android:tint="@color/bubbles_icon_tint"/>

        <TextView
            android:id="@+id/bubble_manage_menu_fullscreen_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:text="@string/bubble_fullscreen_text"
            android:textColor="@androidprv:color/materialColorOnSurface"
            android:textAppearance="@*android:style/TextAppearance.DeviceDefault" />

    </LinearLayout>

</LinearLayout>
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -606,6 +606,10 @@ public class BubbleExpandedView extends LinearLayout {
        updateManageButtonIfExists();
    }

    public float getCornerRadius() {
        return mCornerRadius;
    }

    /**
     * Updates the size and visuals of the pointer if {@link #mPointerView} is initialized.
     * Does nothing otherwise.
+18 −1
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ import com.android.wm.shell.common.FloatingContentCoordinator;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.shared.animation.Interpolators;
import com.android.wm.shell.shared.animation.PhysicsAnimator;
import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper;
import com.android.wm.shell.shared.bubbles.DeviceConfig;
import com.android.wm.shell.shared.bubbles.DismissView;
import com.android.wm.shell.shared.bubbles.RelativeTouchListener;
@@ -1319,7 +1320,7 @@ public class BubbleStackView extends FrameLayout
        mBubbleContainer.bringToFront();
    }

    // TODO: Create ManageMenuView and move setup / animations there
    // TODO (b/402196554) : Create ManageMenuView and move setup / animations there
    private void setUpManageMenu() {
        if (mManageMenu != null) {
            removeView(mManageMenu);
@@ -1377,6 +1378,22 @@ public class BubbleStackView extends FrameLayout
        mManageSettingsIcon = mManageMenu.findViewById(R.id.bubble_manage_menu_settings_icon);
        mManageSettingsText = mManageMenu.findViewById(R.id.bubble_manage_menu_settings_name);

        View fullscreenView = mManageMenu.findViewById(
                R.id.bubble_manage_menu_fullscreen_container);
        if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) {
            fullscreenView.setVisibility(VISIBLE);
            fullscreenView.setOnClickListener(
                    view -> {
                        showManageMenu(false /* show */);
                        BubbleExpandedView expandedView = getExpandedView();
                        if (expandedView != null && expandedView.getTaskView() != null) {
                            expandedView.getTaskView().moveToFullscreen();
                        }
                    });
        } else {
            fullscreenView.setVisibility(GONE);
        }

        // The menu itself should respect locale direction so the icons are on the correct side.
        mManageMenu.setLayoutDirection(LAYOUT_DIRECTION_LOCALE);
        addView(mManageMenu);
+18 −5
Original line number Diff line number Diff line
@@ -612,8 +612,7 @@ public class BubbleTransitions {
            mTaskLeash = taskChg.getLeash();
            mRootLeash = info.getRoot(0).getLeash();

            SurfaceControl dest =
                    mBubble.getBubbleBarExpandedView().getViewRootImpl().getSurfaceControl();
            SurfaceControl dest = getExpandedView(mBubble).getViewRootImpl().getSurfaceControl();
            final Runnable onPlucked = () -> {
                // Need to remove the taskview AFTER applying the startTransaction because
                // it isn't synchronized.
@@ -623,12 +622,12 @@ public class BubbleTransitions {
                mBubbleData.setExpanded(false /* expanded */);
            };
            if (dest != null) {
                pluck(mTaskLeash, mBubble.getBubbleBarExpandedView(), dest,
                pluck(mTaskLeash, getExpandedView(mBubble), dest,
                        taskChg.getStartAbsBounds().left - info.getRoot(0).getOffset().x,
                        taskChg.getStartAbsBounds().top - info.getRoot(0).getOffset().y,
                        mBubble.getBubbleBarExpandedView().getCornerRadius(), startTransaction,
                        getCornerRadius(mBubble), startTransaction,
                        onPlucked);
                mBubble.getBubbleBarExpandedView().post(() -> mTransitions.dispatchTransition(
                getExpandedView(mBubble).post(() -> mTransitions.dispatchTransition(
                        mTransition, info, startTransaction, finishTransaction, finishCallback,
                        null));
            } else {
@@ -649,6 +648,20 @@ public class BubbleTransitions {
            t.reparent(mTaskLeash, mRootLeash);
            t.apply();
        }

        private View getExpandedView(@NonNull Bubble bubble) {
            if (bubble.getBubbleBarExpandedView() != null) {
                return bubble.getBubbleBarExpandedView();
            }
            return bubble.getExpandedView();
        }

        private float getCornerRadius(@NonNull Bubble bubble) {
            if (bubble.getBubbleBarExpandedView() != null) {
                return bubble.getBubbleBarExpandedView().getCornerRadius();
            }
            return bubble.getExpandedView().getCornerRadius();
        }
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -28,9 +28,9 @@ import android.view.View;
import android.view.ViewGroup;

import com.android.app.animation.Interpolators;
import com.android.wm.shell.Flags;
import com.android.wm.shell.R;
import com.android.wm.shell.bubbles.Bubble;
import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper;

import java.util.ArrayList;

@@ -263,7 +263,7 @@ class BubbleBarMenuViewController {
                }
        ));

        if (Flags.enableBubbleAnything() || Flags.enableBubbleToFullscreen()) {
        if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) {
            menuActions.add(new BubbleBarMenuView.MenuAction(
                    Icon.createWithResource(resources,
                            R.drawable.desktop_mode_ic_handle_menu_fullscreen),
Loading