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

Commit d9529619 authored by Winson's avatar Winson
Browse files

Fixing some drag and drop issues.

- When opening recents while there is a task docked, initialize the
  stack scroll to the front of the stack
- When undocking a task while recents is open, scroll to the front of
  the stack
- Fixing offset when adjusting the task stack size due to top inset 
  being double applied in some dock states
- Fixing issue with task view not scaling when picking up from the 
  freeform workspace

Change-Id: I15436ac21f05ff521492d8ae1c682a414503101a
parent 957c742f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import com.android.systemui.recents.model.TaskStack;
/**
 * This is sent by the activity whenever the task stach has changed.
 */
public class TaskStackUpdatedEvent extends EventBus.Event {
public class TaskStackUpdatedEvent extends EventBus.AnimatedEvent {

    /**
     * A new TaskStack instance representing the latest stack state.
+5 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.recents.events.ui.dragndrop;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.views.RecentsViewTouchHandler;
import com.android.systemui.recents.views.TaskView;

/**
 * This event is sent by the drag manager when it requires drop targets to register themselves for
@@ -27,10 +28,13 @@ import com.android.systemui.recents.views.RecentsViewTouchHandler;
public class DragStartInitializeDropTargetsEvent extends EventBus.Event {

    public final Task task;
    public final TaskView taskView;
    public final RecentsViewTouchHandler handler;

    public DragStartInitializeDropTargetsEvent(Task task, RecentsViewTouchHandler handler) {
    public DragStartInitializeDropTargetsEvent(Task task, TaskView taskView,
            RecentsViewTouchHandler handler) {
        this.task = task;
        this.taskView = taskView;
        this.handler = handler;
    }
}
+6 −1
Original line number Diff line number Diff line
@@ -400,7 +400,12 @@ public class TaskStack {
            // Calculate the task stack bounds from the new window bounds
            Rect searchBarSpaceBounds = new Rect();
            Rect taskStackBounds = new Rect();
            config.getTaskStackBounds(newWindowBounds, insets.top, insets.right,
            // If the task stack bounds is specifically under the dock area, then ignore the top
            // inset
            int top = dockArea.bottom < 1f
                    ? 0
                    : insets.top;
            config.getTaskStackBounds(newWindowBounds, top, insets.right,
                    searchBarSpaceBounds, taskStackBounds);
            return taskStackBounds;
        }
+0 −16
Original line number Diff line number Diff line
@@ -319,22 +319,6 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
        }
    }

    @Override
    public void onMultiWindowModeChanged(boolean multiWindowMode) {
        super.onMultiWindowModeChanged(multiWindowMode);
        if (!multiWindowMode) {
            RecentsTaskLoader loader = Recents.getTaskLoader();
            RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
            launchOpts.loadIcons = false;
            launchOpts.loadThumbnails = false;
            launchOpts.onlyLoadForCache = true;
            RecentsTaskLoadPlan loadPlan = loader.createLoadPlan(this);
            loader.preloadTasks(loadPlan, -1, false);
            loader.loadTasks(this, loadPlan, launchOpts);
            EventBus.getDefault().send(new TaskStackUpdatedEvent(loadPlan.getTaskStack()));
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        switch (keyCode) {
+0 −7
Original line number Diff line number Diff line
@@ -227,12 +227,6 @@ public class RecentsTvView extends FrameLayout {
        EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(null));
    }

    public final void onBusEvent(TaskStackUpdatedEvent event) {
        mStack.setTasks(event.stack.computeAllTasksList(), true /* notifyStackChanges */);
        mStack.createAffiliatedGroupings(getContext());
    }


    public final void onBusEvent(RecentsVisibilityChangedEvent event) {
        if (!event.visible) {
            // Reset the view state
@@ -240,7 +234,6 @@ public class RecentsTvView extends FrameLayout {
        }
    }


    public void setTaskStackViewAdapter(TaskStackHorizontalViewAdapter taskStackViewAdapter) {
        if(mTaskStackHorizontalView != null) {
            mTaskStackHorizontalView.setAdapter(taskStackViewAdapter);
Loading