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

Commit 479f7446 authored by Winson's avatar Winson
Browse files

Improving drag and drop

- No longer rendering the task view to another drag view, instead we 
  drag the task view directly.  This allows us to do a smooth transition
  to and from the freeform workspace and the stack by animating the 
  thumbnail scale as we clip/unclip the task view.
- Removing the extra code to disable rotation while dragging since the 
  system does that for us already

Change-Id: I1e02c9319347aace9870eaa4983b3b87c5f0f58e
parent 74bfa271
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -214,9 +214,6 @@
    <!-- The amount to offset when animating into an affiliate group. -->
    <dimen name="recents_task_view_affiliate_group_enter_offset">64dp</dimen>

    <!-- The alpha to apply to a task thumbnail. -->
    <item name="recents_task_view_thumbnail_alpha" format="float" type="dimen">0.9</item>

    <!-- The height of a task view bar. -->
    <dimen name="recents_task_bar_height">56dp</dimen>

+0 −12
Original line number Diff line number Diff line
@@ -724,18 +724,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        getResizeTaskDebugDialog().showResizeTaskDialog(event.task, mRecentsView);
    }

    public final void onBusEvent(DragStartEvent event) {
        // Lock the orientation while dragging
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);

        // TODO: docking requires custom accessibility actions
    }

    public final void onBusEvent(DragEndEvent event) {
        // Unlock the orientation when dragging completes
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_BEHIND);
    }

    public final void onBusEvent(LaunchTaskSucceededEvent event) {
        MetricsLogger.histogram(this, "overview_task_launch_index", event.taskIndexFromStackFront);
    }
+1 −4
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.systemui.recents.events.ui.dragndrop;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.views.DragView;
import com.android.systemui.recents.views.DropTarget;
import com.android.systemui.recents.views.TaskView;

@@ -30,15 +29,13 @@ public class DragEndEvent extends EventBus.Event {

    public final Task task;
    public final TaskView taskView;
    public final DragView dragView;
    public final DropTarget dropTarget;
    public final ReferenceCountedTrigger postAnimationTrigger;

    public DragEndEvent(Task task, TaskView taskView, DragView dragView, DropTarget dropTarget,
    public DragEndEvent(Task task, TaskView taskView, DropTarget dropTarget,
            ReferenceCountedTrigger postAnimationTrigger) {
        this.task = task;
        this.taskView = taskView;
        this.dragView = dragView;
        this.dropTarget = dropTarget;
        this.postAnimationTrigger = postAnimationTrigger;
    }
+4 −4
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@

package com.android.systemui.recents.events.ui.dragndrop;

import android.graphics.Point;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.views.DragView;
import com.android.systemui.recents.views.TaskView;

/**
@@ -28,11 +28,11 @@ public class DragStartEvent extends EventBus.Event {

    public final Task task;
    public final TaskView taskView;
    public final DragView dragView;
    public final Point tlOffset;

    public DragStartEvent(Task task, TaskView taskView, DragView dragView) {
    public DragStartEvent(Task task, TaskView taskView, Point tlOffset) {
        this.task = task;
        this.taskView = taskView;
        this.dragView = dragView;
        this.tlOffset = tlOffset;
    }
}
+7 −3
Original line number Diff line number Diff line
@@ -409,7 +409,7 @@ public class SystemServicesProxy {
            return thumbnail;
        }

        Bitmap thumbnail = SystemServicesProxy.getThumbnail(mAm, taskId);
        Bitmap thumbnail = getThumbnail(taskId);
        if (thumbnail != null) {
            thumbnail.setHasAlpha(false);
            // We use a dumb heuristic for now, if the thumbnail is purely transparent in the top
@@ -429,8 +429,12 @@ public class SystemServicesProxy {
    /**
     * Returns a task thumbnail from the activity manager
     */
    public static Bitmap getThumbnail(ActivityManager activityManager, int taskId) {
        ActivityManager.TaskThumbnail taskThumbnail = activityManager.getTaskThumbnail(taskId);
    public Bitmap getThumbnail(int taskId) {
        if (mAm == null) {
            return null;
        }

        ActivityManager.TaskThumbnail taskThumbnail = mAm.getTaskThumbnail(taskId);
        if (taskThumbnail == null) return null;

        Bitmap thumbnail = taskThumbnail.mainThumbnail;
Loading