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

Commit 80e30a0f authored by Winson's avatar Winson Committed by android-build-merger
Browse files

Merge "Allow dragging to dock single tasks." into nyc-dev

am: d037ef95

* commit 'd037ef95':
  Allow dragging to dock single tasks.
parents 0ff3250f d037ef95
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -749,7 +749,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    public final void onBusEvent(AllTaskViewsDismissedEvent event) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.hasDockedTask()) {
            mRecentsView.showEmptyView(R.string.recents_empty_message_dismissed_all);
            mRecentsView.showEmptyView(event.msgResId);
        } else {
            // Just go straight home (no animation necessary because there are no more task views)
            dismissRecentsToHome(false /* animateTaskViews */);
+6 −1
Original line number Diff line number Diff line
@@ -22,5 +22,10 @@ import com.android.systemui.recents.events.EventBus;
 * This is sent whenever all the task views in a stack have been dismissed.
 */
public class AllTaskViewsDismissedEvent extends EventBus.Event {
    // Simple event

    public final int msgResId;

    public AllTaskViewsDismissedEvent(int msgResId) {
        this.msgResId = msgResId;
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -245,7 +245,7 @@ public class RecentsHistoryAdapter extends RecyclerView.Adapter<RecentsHistoryAd
            if (row.getViewType() == TASK_ROW_VIEW_TYPE) {
                TaskRow taskRow = (TaskRow) row;
                Task task = taskRow.task;
                mStack.removeTask(task, AnimationProps.IMMEDIATE);
                mStack.removeTask(task, AnimationProps.IMMEDIATE, false /* fromDockGesture */);
                EventBus.getDefault().send(new DeleteTaskDataEvent(task));
                i = removeTaskRow(i);
            }
@@ -326,7 +326,7 @@ public class RecentsHistoryAdapter extends RecyclerView.Adapter<RecentsHistoryAd
    public void onTaskRemoved(Task task, int position) {
        // Since this is removed from the history, we need to update the stack as well to ensure
        // that the model is correct. Since the stack is hidden, we can update it immediately.
        mStack.removeTask(task, AnimationProps.IMMEDIATE);
        mStack.removeTask(task, AnimationProps.IMMEDIATE, false /* fromDockGesture */);
        removeTaskRow(position);
        if (mRows.isEmpty()) {
            dismissHistory();
+6 −5
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ public class TaskStack {
         * Notifies when a task has been removed from the stack.
         */
        void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask,
            Task newFrontMostTask, AnimationProps animation);
            Task newFrontMostTask, AnimationProps animation, boolean fromDockGesture);

        /**
         * Notifies when a task has been removed from the history.
@@ -513,14 +513,15 @@ public class TaskStack {
     * Removes a task from the stack, with an additional {@param animation} hint to the callbacks on
     * how they should update themselves.
     */
    public void removeTask(Task t, AnimationProps animation) {
    public void removeTask(Task t, AnimationProps animation, boolean fromDockGesture) {
        if (mStackTaskList.contains(t)) {
            boolean wasFrontMostTask = (getStackFrontMostTask(false /* includeFreeform */) == t);
            removeTaskImpl(mStackTaskList, t);
            Task newFrontMostTask = getStackFrontMostTask(false  /* includeFreeform */);
            if (mCb != null) {
                // Notify that a task has been removed
                mCb.onStackTaskRemoved(this, t, wasFrontMostTask, newFrontMostTask, animation);
                mCb.onStackTaskRemoved(this, t, wasFrontMostTask, newFrontMostTask, animation,
                        fromDockGesture);
            }
        } else if (mHistoryTaskList.contains(t)) {
            removeTaskImpl(mHistoryTaskList, t);
@@ -558,9 +559,9 @@ public class TaskStack {
                if (notifyStackChanges) {
                    // If we are notifying, then remove the task now, otherwise the raw task list
                    // will be reset at the end of this method
                    removeTask(task, AnimationProps.IMMEDIATE);
                    removeTask(task, AnimationProps.IMMEDIATE, false /* fromDockGesture */);
                    mCb.onStackTaskRemoved(this, task, i == (taskCount - 1), null,
                            AnimationProps.IMMEDIATE);
                            AnimationProps.IMMEDIATE, false /* fromDockGesture */);
                }
            }
            task.setGroup(null);
+4 −2
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ public class TaskStackHorizontalGridView extends HorizontalGridView implements T

    @Override
    public void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask,
            Task newFrontMostTask, AnimationProps animation) {
            Task newFrontMostTask, AnimationProps animation, boolean fromDockGesture) {
        getAdapter().notifyItemRemoved(stack.getStackTasks().indexOf(removedTask));
        if (mFocusedTask == removedTask) {
            resetFocusedTask(removedTask);
@@ -144,7 +144,9 @@ public class TaskStackHorizontalGridView extends HorizontalGridView implements T
        if (mStack.getStackTaskCount() == 0) {
            boolean shouldFinishActivity = (mStack.getStackTaskCount() == 0);
            if (shouldFinishActivity) {
                EventBus.getDefault().send(new AllTaskViewsDismissedEvent());
                EventBus.getDefault().send(new AllTaskViewsDismissedEvent(fromDockGesture
                        ? R.string.recents_empty_message
                        : R.string.recents_empty_message_dismissed_all));
            }
        }
    }
Loading