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

Commit 14d28ad4 authored by Vinit Nayak's avatar Vinit Nayak Committed by Winson Chung
Browse files

Revert "Revert "Implements the "Save App Pair" button in Overvie..."

Revert submission 26420318-revert-26391074-save-app-pair-button-ZKCRCDSCSN

Reason for revert: Test failure in question wasn't related to this topic b/328016248

Reverted changes: /q/submissionid:26420318-revert-26391074-save-app-pair-button-ZKCRCDSCSN

Change-Id: I2a4dbb83720768a9d29a4371c77e3b9410ab2fea
Merged-In: I2a4dbb83720768a9d29a4371c77e3b9410ab2fea
parent 7c8b31d2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -120,6 +120,16 @@
            android:layout_height="1dp"
            android:layout_weight="1"
            android:visibility="gone" />

        <Button
            android:id="@+id/action_save_app_pair"
            style="@style/GoOverviewActionButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableStart="@drawable/ic_save_app_pair"
            android:text="@string/action_save_app_pair"
            android:theme="@style/ThemeControlHighlightWorkspaceColor"
            android:visibility="gone" />
    </LinearLayout>

</com.android.quickstep.views.GoOverviewActionsView>
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
@@ -55,6 +55,15 @@
            android:theme="@style/ThemeControlHighlightWorkspaceColor"
            android:visibility="gone" />

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

        <Space
            android:layout_width="0dp"
            android:layout_height="1dp"
+2 −0
Original line number Diff line number Diff line
@@ -230,6 +230,8 @@
    <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>
    <!-- Label for a button that saves a new app pair. [CHAR_LIMIT=20] -->
    <string name="action_save_app_pair">Save app pair</string>
    <!-- Label for toast with instructions for split screen selection mode. [CHAR_LIMIT=50] -->
    <string name="toast_split_select_app">Tap another app to use split screen</string>
    <string name="toast_contextual_split_select_app">Choose another app to use split screen</string>
+15 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.launcher3.util.ResourceBasedOverride;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.Snackbar;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.views.GroupedTaskView;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskThumbnailView;
@@ -210,13 +211,19 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
            }
        }

        private void enterSplitSelect() {
        protected void enterSplitSelect() {
            RecentsView overviewPanel = mThumbnailView.getTaskView().getRecentsView();
            // Task has already been dismissed
            if (overviewPanel == null) return;
            overviewPanel.initiateSplitSelect(mThumbnailView.getTaskView());
        }

        protected void saveAppPair() {
            GroupedTaskView taskView = (GroupedTaskView) mThumbnailView.getTaskView();
            taskView.getRecentsView().getSplitSelectController().getAppPairsController()
                    .saveAppPair(taskView);
        }

        /**
         * Called when the overlay is no longer used.
         */
@@ -329,6 +336,10 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
            public void onSplit() {
                endLiveTileMode(TaskOverlay.this::enterSplitSelect);
            }

            public void onSaveAppPair() {
                endLiveTileMode(TaskOverlay.this::saveAppPair);
            }
        }
    }

@@ -342,5 +353,8 @@ public class TaskOverlayFactory implements ResourceBasedOverride {

        /** User wants to start split screen with current app. */
        void onSplit();

        /** User wants to save an app pair with current group of apps. */
        void onSaveAppPair();
    }
}
+14 −2
Original line number Diff line number Diff line
@@ -311,9 +311,21 @@ public interface TaskShortcutFactory {
        @Override
        public List<SystemShortcut> getShortcuts(BaseDraggingActivity activity,
                TaskIdAttributeContainer taskContainer) {
            DeviceProfile deviceProfile = activity.getDeviceProfile();
            final TaskView taskView = taskContainer.getTaskView();

            if (!FeatureFlags.enableAppPairs() || !taskView.containsMultipleTasks()) {
            final RecentsView recentsView = taskView.getRecentsView();
            boolean isLargeTileFocusedTask = deviceProfile.isTablet && taskView.isFocusedTask();
            boolean isInExpectedScrollPosition =
                    recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView));
            boolean shouldShowActionsButtonInstead =
                    isLargeTileFocusedTask && isInExpectedScrollPosition;

            // No "save app pair" menu item if:
            // - app pairs feature is not enabled
            // - the task in question is a single task
            // - the Overview Actions Button should be visible
            if (!FeatureFlags.enableAppPairs() || !taskView.containsMultipleTasks()
                    || shouldShowActionsButtonInstead) {
                return null;
            }

Loading