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

Commit 0b73d101 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Hide overview and app icon split option when appropriate

Don't show app menu icon split option or overview
action split option when current taskView is already in
split or there are not at least 2 tasks with which to
invoke split

Fixes: 197245395
Test: Tested with small and large screen,
dismissing tasks in overview, with and without
GroupedTaskView as main running task

Change-Id: I90cc3c39e4d94662cb87314a210d45d145b6e026
parent 667bda84
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -107,6 +107,13 @@ public class TaskOverlayFactory implements ResourceBasedOverride {

    public static void addSplitOptions(List<SystemShortcut> outShortcuts,
            BaseDraggingActivity activity, TaskView taskView, DeviceProfile deviceProfile) {
        int[] taskViewTaskIds = taskView.getTaskIds();
        boolean alreadyHasMultipleTasks = taskViewTaskIds[0] != -1 &&
                taskViewTaskIds[1] != -1;
        if (alreadyHasMultipleTasks) {
            return;
        }

        PagedOrientationHandler orientationHandler =
                taskView.getRecentsView().getPagedOrientationHandler();
        List<SplitPositionOption> positions =
+0 −1
Original line number Diff line number Diff line
@@ -223,7 +223,6 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
        mDp = dp;
        updateVerticalMargin(SysUINavigationMode.getMode(getContext()));
        requestLayout();
        setSplitButtonVisible(mDp.isTablet);
    }

    public void setSplitButtonVisible(boolean visible) {
+16 −3
Original line number Diff line number Diff line
@@ -1500,7 +1500,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        mActionsView.setDp(dp);
        mOrientationState.setDeviceProfile(dp);

        // Update RecentsView adn TaskView's DeviceProfile dependent layout.
        // Update RecentsView and TaskView's DeviceProfile dependent layout.
        updateOrientationHandler();
    }

@@ -2593,7 +2593,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        mFirstFloatingTaskView.setAlpha(1);
        mFirstFloatingTaskView.addAnimation(anim, startingTaskRect,
                mTempRect, mSplitHiddenTaskView, true /*fadeWithThumbnail*/);
        anim.addEndListener(aBoolean -> mActionsView.setSplitButtonVisible(false));
    }

    /**
@@ -2933,6 +2932,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
                        dispatchScrollChanged();
                    }
                }
                updateFocusedSplitButtonVisibility();
                onDismissAnimationEnds();
                mPendingAnimation = null;
            }
@@ -2940,6 +2940,19 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        return anim;
    }

    /**
     * Shows split button if
     * * We're in large screen
     * * We're not already in split
     * * There are at least 2 tasks to invoke split
     */
    private void updateFocusedSplitButtonVisibility() {
        mActionsView.setSplitButtonVisible(mActivity.getDeviceProfile().isTablet &&
                !(getRunningTaskView() instanceof GroupedTaskView) &&
                getTaskViewCount() > 1
        );
    }

    /**
     * Returns all the tasks in the top row, without the focused task
     */
@@ -3745,7 +3758,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
            mSecondSplitHiddenTaskView.setVisibility(VISIBLE);
            mSecondSplitHiddenTaskView = null;
        }
        mActionsView.setSplitButtonVisible(true);
    }

    private void updateDeadZoneRects() {
@@ -3960,6 +3972,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    @Override
    protected void notifyPageSwitchListener(int prevPage) {
        super.notifyPageSwitchListener(prevPage);
        updateFocusedSplitButtonVisibility();
        loadVisibleTaskData(TaskView.FLAG_UPDATE_ALL);
        updateEnabledOverlays();
    }