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

Commit b862d2c3 authored by Android Build Prod User's avatar Android Build Prod User Committed by Android (Google) Code Review
Browse files

Merge "Add Split button in OverviewActions" into sc-v2-dev

parents 8b07b8f6 6174106f
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -46,6 +46,23 @@
            android:layout_height="1dp"
            android:layout_weight="1" />

        <Button
            android:id="@+id/action_split"
            style="@style/OverviewActionButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableStart="@drawable/ic_split_screen"
            android:text="@string/action_split"
            android:theme="@style/ThemeControlHighlightWorkspaceColor"
            android:visibility="gone" />

        <Space
            android:id="@+id/action_split_space"
            android:layout_width="0dp"
            android:layout_height="1dp"
            android:layout_weight="1"
            android:visibility="gone" />

        <Button
            android:id="@+id/action_share"
            style="@style/OverviewActionButton"
+2 −0
Original line number Diff line number Diff line
@@ -191,6 +191,8 @@
    <string name="action_share">Share</string>
    <!-- Label for a button that causes a screen shot of the current app to be taken. [CHAR_LIMIT=40] -->
    <string name="action_screenshot">Screenshot</string>
    <!-- Label for a button that enters split screen selection mode. [CHAR_LIMIT=20] -->
    <string name="action_split">Split</string>
    <!-- Message shown when an action is blocked by a policy enforced by the app or the organization managing the device. [CHAR_LIMIT=NONE] -->
    <string name="blocked_by_policy">This action isn\'t allowed by the app or your organization</string>

+6 −2
Original line number Diff line number Diff line
@@ -43,8 +43,12 @@ public class SplitScreenSelectState extends OverviewState {
    @Override
    public float getSplitSelectTranslation(Launcher launcher) {
        RecentsView recentsView = launcher.getOverviewPanel();
        int splitPosition = recentsView.getSplitPlaceholder()
                .getActiveSplitPositionOption().stagePosition;
//<<<<<<< HEAD
//        int splitPosition = recentsView.getSplitPlaceholder()
//                .getActiveSplitPositionOption().stagePosition;
//=======
        int splitPosition = recentsView.getSplitPlaceholder().getActiveSplitStagePosition();
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
        if (!recentsView.shouldShiftThumbnailsForSplitSelect(splitPosition)) {
            return 0f;
        }
+12 −0
Original line number Diff line number Diff line
@@ -218,6 +218,11 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
            }
        }

        private void enterSplitSelect() {
            RecentsView overviewPanel = mThumbnailView.getTaskView().getRecentsView();
            overviewPanel.initiateSplitSelect(mThumbnailView.getTaskView());
        }

        /**
         * Called when the overlay is no longer used.
         */
@@ -323,6 +328,10 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
            public void onScreenshot() {
                endLiveTileMode(() -> saveScreenshot(mTask));
            }

            public void onSplit() {
                endLiveTileMode(TaskOverlay.this::enterSplitSelect);
            }
        }
    }

@@ -336,5 +345,8 @@ public class TaskOverlayFactory implements ResourceBasedOverride {

        /** User has indicated they want to screenshot the current task. */
        void onScreenshot();

        /** User wants to start split screen with current app. */
        void onSplit();
    }
}
+18 −12
Original line number Diff line number Diff line
@@ -32,12 +32,11 @@ import android.view.RemoteAnimationAdapter;
import android.view.SurfaceControl;
import android.window.TransitionInfo;

import androidx.annotation.Nullable;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.R;
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TaskAnimationManager;
import com.android.quickstep.TaskViewUtils;
@@ -57,7 +56,7 @@ public class SplitSelectStateController {
    private final SystemUiProxy mSystemUiProxy;
    private TaskView mInitialTaskView;
    private TaskView mSecondTaskView;
    private SplitPositionOption mInitialPosition;
    private @StagePosition int mStagePosition;
    private Rect mInitialBounds;
    private final Handler mHandler;

@@ -69,10 +68,10 @@ public class SplitSelectStateController {
    /**
     * To be called after first task selected
     */
    public void setInitialTaskSelect(TaskView taskView, SplitPositionOption positionOption,
    public void setInitialTaskSelect(TaskView taskView, @StagePosition int stagePosition,
            Rect initialBounds) {
        mInitialTaskView = taskView;
        mInitialPosition = positionOption;
        mStagePosition = stagePosition;
        mInitialBounds = initialBounds;
    }

@@ -83,7 +82,11 @@ public class SplitSelectStateController {
        mSecondTaskView = taskView;
        // Assume initial task is for top/left part of screen

        final int[] taskIds = mInitialPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT
//<<<<<<< HEAD
//        final int[] taskIds = mInitialPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT
//=======
        final int[] taskIds = mStagePosition == STAGE_POSITION_TOP_OR_LEFT
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
                ? new int[]{mInitialTaskView.getTask().key.id, taskView.getTask().key.id}
                : new int[]{taskView.getTask().key.id, mInitialTaskView.getTask().key.id};
        if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
@@ -113,7 +116,11 @@ public class SplitSelectStateController {
            DeviceProfile deviceProfile) {
        InsettableFrameLayout.LayoutParams params =
                new InsettableFrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
        boolean topLeftPosition = mInitialPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT;
//<<<<<<< HEAD
//        boolean topLeftPosition = mInitialPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT;
//=======
        boolean topLeftPosition = mStagePosition == STAGE_POSITION_TOP_OR_LEFT;
//>>>>>>> f6769c8532 (Add Split button in OverviewActions)
        if (deviceProfile.isLandscape) {
            params.width = (int) resources.getDimension(R.dimen.split_placeholder_size);
            params.gravity = topLeftPosition ? Gravity.START : Gravity.END;
@@ -125,9 +132,8 @@ public class SplitSelectStateController {
        return params;
    }

    @Nullable
    public SplitPositionOption getActiveSplitPositionOption() {
        return mInitialPosition;
    public @StagePosition int getActiveSplitStagePosition() {
        return mStagePosition;
    }

    /**
@@ -189,7 +195,7 @@ public class SplitSelectStateController {
    public void resetState() {
        mInitialTaskView = null;
        mSecondTaskView = null;
        mInitialPosition = null;
        mStagePosition = SplitConfigurationOptions.STAGE_POSITION_UNDEFINED;
        mInitialBounds = null;
    }

Loading