Search in sources :

Example 1 with TaskStackViewScroller

use of com.android.systemui.recents.views.TaskStackViewScroller in project android_frameworks_base by DirtyUnicorns.

the class RecentsImpl method getThumbnailTransitionActivityOptions.

/**
     * Creates the activity options for an app->recents transition.
     */
private ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo runningTask, TaskStackView stackView, Rect windowOverrideRect) {
    if (runningTask != null && runningTask.stackId == FREEFORM_WORKSPACE_STACK_ID) {
        ArrayList<AppTransitionAnimationSpec> specs = new ArrayList<>();
        ArrayList<Task> tasks = stackView.getStack().getStackTasks();
        TaskStackLayoutAlgorithm stackLayout = stackView.getStackAlgorithm();
        TaskStackViewScroller stackScroller = stackView.getScroller();
        stackView.updateLayoutAlgorithm(true);
        stackView.updateToInitialState();
        for (int i = tasks.size() - 1; i >= 0; i--) {
            Task task = tasks.get(i);
            if (task.isFreeformTask()) {
                mTmpTransform = stackLayout.getStackTransformScreenCoordinates(task, stackScroller.getStackScroll(), mTmpTransform, null, windowOverrideRect);
                Bitmap thumbnail = drawThumbnailTransitionBitmap(task, mTmpTransform, mThumbTransitionBitmapCache);
                Rect toTaskRect = new Rect();
                mTmpTransform.rect.round(toTaskRect);
                specs.add(new AppTransitionAnimationSpec(task.key.id, thumbnail, toTaskRect));
            }
        }
        AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()];
        specs.toArray(specsArray);
        return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, null, this);
    } else {
        // Update the destination rect
        Task toTask = new Task();
        TaskViewTransform toTransform = getThumbnailTransitionTransform(stackView, toTask, windowOverrideRect);
        Bitmap thumbnail = drawThumbnailTransitionBitmap(toTask, toTransform, mThumbTransitionBitmapCache);
        if (thumbnail != null) {
            RectF toTaskRect = toTransform.rect;
            return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, thumbnail, (int) toTaskRect.left, (int) toTaskRect.top, (int) toTaskRect.width(), (int) toTaskRect.height(), mHandler, null);
        }
        // If both the screenshot and thumbnail fails, then just fall back to the default transition
        return getUnknownTransitionActivityOptions();
    }
}
Also used : TaskStackViewScroller(com.android.systemui.recents.views.TaskStackViewScroller) Task(com.android.systemui.recents.model.Task) Rect(android.graphics.Rect) ArrayList(java.util.ArrayList) RectF(android.graphics.RectF) Bitmap(android.graphics.Bitmap) AppTransitionAnimationSpec(android.view.AppTransitionAnimationSpec) TaskViewTransform(com.android.systemui.recents.views.TaskViewTransform) TaskStackLayoutAlgorithm(com.android.systemui.recents.views.TaskStackLayoutAlgorithm)

Example 2 with TaskStackViewScroller

use of com.android.systemui.recents.views.TaskStackViewScroller in project android_frameworks_base by ResurrectionRemix.

the class RecentsImpl method getThumbnailTransitionActivityOptions.

/**
     * Creates the activity options for an app->recents transition.
     */
private ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo runningTask, TaskStackView stackView, Rect windowOverrideRect) {
    if (runningTask != null && runningTask.stackId == FREEFORM_WORKSPACE_STACK_ID) {
        ArrayList<AppTransitionAnimationSpec> specs = new ArrayList<>();
        ArrayList<Task> tasks = stackView.getStack().getStackTasks();
        TaskStackLayoutAlgorithm stackLayout = stackView.getStackAlgorithm();
        TaskStackViewScroller stackScroller = stackView.getScroller();
        stackView.updateLayoutAlgorithm(true);
        stackView.updateToInitialState();
        for (int i = tasks.size() - 1; i >= 0; i--) {
            Task task = tasks.get(i);
            if (task.isFreeformTask()) {
                mTmpTransform = stackLayout.getStackTransformScreenCoordinates(task, stackScroller.getStackScroll(), mTmpTransform, null, windowOverrideRect);
                Bitmap thumbnail = drawThumbnailTransitionBitmap(task, mTmpTransform, mThumbTransitionBitmapCache);
                Rect toTaskRect = new Rect();
                mTmpTransform.rect.round(toTaskRect);
                specs.add(new AppTransitionAnimationSpec(task.key.id, thumbnail, toTaskRect));
            }
        }
        AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()];
        specs.toArray(specsArray);
        return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, null, this);
    } else {
        // Update the destination rect
        Task toTask = new Task();
        TaskViewTransform toTransform = getThumbnailTransitionTransform(stackView, toTask, windowOverrideRect);
        Bitmap thumbnail = drawThumbnailTransitionBitmap(toTask, toTransform, mThumbTransitionBitmapCache);
        if (thumbnail != null) {
            RectF toTaskRect = toTransform.rect;
            return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, thumbnail, (int) toTaskRect.left, (int) toTaskRect.top, (int) toTaskRect.width(), (int) toTaskRect.height(), mHandler, null);
        }
        // If both the screenshot and thumbnail fails, then just fall back to the default transition
        return getUnknownTransitionActivityOptions();
    }
}
Also used : TaskStackViewScroller(com.android.systemui.recents.views.TaskStackViewScroller) Task(com.android.systemui.recents.model.Task) Rect(android.graphics.Rect) ArrayList(java.util.ArrayList) RectF(android.graphics.RectF) Bitmap(android.graphics.Bitmap) AppTransitionAnimationSpec(android.view.AppTransitionAnimationSpec) TaskViewTransform(com.android.systemui.recents.views.TaskViewTransform) TaskStackLayoutAlgorithm(com.android.systemui.recents.views.TaskStackLayoutAlgorithm)

Example 3 with TaskStackViewScroller

use of com.android.systemui.recents.views.TaskStackViewScroller in project platform_frameworks_base by android.

the class RecentsImpl method getThumbnailTransitionActivityOptions.

/**
     * Creates the activity options for an app->recents transition.
     */
private ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo runningTask, TaskStackView stackView, Rect windowOverrideRect) {
    if (runningTask != null && runningTask.stackId == FREEFORM_WORKSPACE_STACK_ID) {
        ArrayList<AppTransitionAnimationSpec> specs = new ArrayList<>();
        ArrayList<Task> tasks = stackView.getStack().getStackTasks();
        TaskStackLayoutAlgorithm stackLayout = stackView.getStackAlgorithm();
        TaskStackViewScroller stackScroller = stackView.getScroller();
        stackView.updateLayoutAlgorithm(true);
        stackView.updateToInitialState();
        for (int i = tasks.size() - 1; i >= 0; i--) {
            Task task = tasks.get(i);
            if (task.isFreeformTask()) {
                mTmpTransform = stackLayout.getStackTransformScreenCoordinates(task, stackScroller.getStackScroll(), mTmpTransform, null, windowOverrideRect);
                Bitmap thumbnail = drawThumbnailTransitionBitmap(task, mTmpTransform, mThumbTransitionBitmapCache);
                Rect toTaskRect = new Rect();
                mTmpTransform.rect.round(toTaskRect);
                specs.add(new AppTransitionAnimationSpec(task.key.id, thumbnail, toTaskRect));
            }
        }
        AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()];
        specs.toArray(specsArray);
        return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, null, this);
    } else {
        // Update the destination rect
        Task toTask = new Task();
        TaskViewTransform toTransform = getThumbnailTransitionTransform(stackView, toTask, windowOverrideRect);
        Bitmap thumbnail = drawThumbnailTransitionBitmap(toTask, toTransform, mThumbTransitionBitmapCache);
        if (thumbnail != null) {
            RectF toTaskRect = toTransform.rect;
            return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, thumbnail, (int) toTaskRect.left, (int) toTaskRect.top, (int) toTaskRect.width(), (int) toTaskRect.height(), mHandler, null);
        }
        // If both the screenshot and thumbnail fails, then just fall back to the default transition
        return getUnknownTransitionActivityOptions();
    }
}
Also used : TaskStackViewScroller(com.android.systemui.recents.views.TaskStackViewScroller) Task(com.android.systemui.recents.model.Task) Rect(android.graphics.Rect) ArrayList(java.util.ArrayList) RectF(android.graphics.RectF) Bitmap(android.graphics.Bitmap) AppTransitionAnimationSpec(android.view.AppTransitionAnimationSpec) TaskViewTransform(com.android.systemui.recents.views.TaskViewTransform) TaskStackLayoutAlgorithm(com.android.systemui.recents.views.TaskStackLayoutAlgorithm)

Example 4 with TaskStackViewScroller

use of com.android.systemui.recents.views.TaskStackViewScroller in project android_frameworks_base by AOSPA.

the class RecentsImpl method getThumbnailTransitionActivityOptions.

/**
     * Creates the activity options for an app->recents transition.
     */
private ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo runningTask, TaskStackView stackView, Rect windowOverrideRect) {
    if (runningTask != null && runningTask.stackId == FREEFORM_WORKSPACE_STACK_ID) {
        ArrayList<AppTransitionAnimationSpec> specs = new ArrayList<>();
        ArrayList<Task> tasks = stackView.getStack().getStackTasks();
        TaskStackLayoutAlgorithm stackLayout = stackView.getStackAlgorithm();
        TaskStackViewScroller stackScroller = stackView.getScroller();
        stackView.updateLayoutAlgorithm(true);
        stackView.updateToInitialState();
        for (int i = tasks.size() - 1; i >= 0; i--) {
            Task task = tasks.get(i);
            if (task.isFreeformTask()) {
                mTmpTransform = stackLayout.getStackTransformScreenCoordinates(task, stackScroller.getStackScroll(), mTmpTransform, null, windowOverrideRect);
                Bitmap thumbnail = drawThumbnailTransitionBitmap(task, mTmpTransform, mThumbTransitionBitmapCache);
                Rect toTaskRect = new Rect();
                mTmpTransform.rect.round(toTaskRect);
                specs.add(new AppTransitionAnimationSpec(task.key.id, thumbnail, toTaskRect));
            }
        }
        AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()];
        specs.toArray(specsArray);
        return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, null, this);
    } else {
        // Update the destination rect
        Task toTask = new Task();
        TaskViewTransform toTransform = getThumbnailTransitionTransform(stackView, toTask, windowOverrideRect);
        Bitmap thumbnail = drawThumbnailTransitionBitmap(toTask, toTransform, mThumbTransitionBitmapCache);
        if (thumbnail != null) {
            RectF toTaskRect = toTransform.rect;
            return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, thumbnail, (int) toTaskRect.left, (int) toTaskRect.top, (int) toTaskRect.width(), (int) toTaskRect.height(), mHandler, null);
        }
        // If both the screenshot and thumbnail fails, then just fall back to the default transition
        return getUnknownTransitionActivityOptions();
    }
}
Also used : TaskStackViewScroller(com.android.systemui.recents.views.TaskStackViewScroller) Task(com.android.systemui.recents.model.Task) Rect(android.graphics.Rect) ArrayList(java.util.ArrayList) RectF(android.graphics.RectF) Bitmap(android.graphics.Bitmap) AppTransitionAnimationSpec(android.view.AppTransitionAnimationSpec) TaskViewTransform(com.android.systemui.recents.views.TaskViewTransform) TaskStackLayoutAlgorithm(com.android.systemui.recents.views.TaskStackLayoutAlgorithm)

Example 5 with TaskStackViewScroller

use of com.android.systemui.recents.views.TaskStackViewScroller in project android_frameworks_base by crdroidandroid.

the class RecentsImpl method getThumbnailTransitionActivityOptions.

/**
     * Creates the activity options for an app->recents transition.
     */
private ActivityOptions getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo runningTask, TaskStackView stackView, Rect windowOverrideRect) {
    if (runningTask != null && runningTask.stackId == FREEFORM_WORKSPACE_STACK_ID) {
        ArrayList<AppTransitionAnimationSpec> specs = new ArrayList<>();
        ArrayList<Task> tasks = stackView.getStack().getStackTasks();
        TaskStackLayoutAlgorithm stackLayout = stackView.getStackAlgorithm();
        TaskStackViewScroller stackScroller = stackView.getScroller();
        stackView.updateLayoutAlgorithm(true);
        stackView.updateToInitialState();
        for (int i = tasks.size() - 1; i >= 0; i--) {
            Task task = tasks.get(i);
            if (task.isFreeformTask()) {
                mTmpTransform = stackLayout.getStackTransformScreenCoordinates(task, stackScroller.getStackScroll(), mTmpTransform, null, windowOverrideRect);
                Bitmap thumbnail = drawThumbnailTransitionBitmap(task, mTmpTransform, mThumbTransitionBitmapCache);
                Rect toTaskRect = new Rect();
                mTmpTransform.rect.round(toTaskRect);
                specs.add(new AppTransitionAnimationSpec(task.key.id, thumbnail, toTaskRect));
            }
        }
        AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()];
        specs.toArray(specsArray);
        return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, specsArray, mHandler, null, this);
    } else {
        // Update the destination rect
        Task toTask = new Task();
        TaskViewTransform toTransform = getThumbnailTransitionTransform(stackView, toTask, windowOverrideRect);
        Bitmap thumbnail = drawThumbnailTransitionBitmap(toTask, toTransform, mThumbTransitionBitmapCache);
        if (thumbnail != null) {
            RectF toTaskRect = toTransform.rect;
            return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, thumbnail, (int) toTaskRect.left, (int) toTaskRect.top, (int) toTaskRect.width(), (int) toTaskRect.height(), mHandler, null);
        }
        // If both the screenshot and thumbnail fails, then just fall back to the default transition
        return getUnknownTransitionActivityOptions();
    }
}
Also used : TaskStackViewScroller(com.android.systemui.recents.views.TaskStackViewScroller) Task(com.android.systemui.recents.model.Task) Rect(android.graphics.Rect) ArrayList(java.util.ArrayList) RectF(android.graphics.RectF) Bitmap(android.graphics.Bitmap) AppTransitionAnimationSpec(android.view.AppTransitionAnimationSpec) TaskViewTransform(com.android.systemui.recents.views.TaskViewTransform) TaskStackLayoutAlgorithm(com.android.systemui.recents.views.TaskStackLayoutAlgorithm)

Aggregations

Bitmap (android.graphics.Bitmap)5 Rect (android.graphics.Rect)5 RectF (android.graphics.RectF)5 AppTransitionAnimationSpec (android.view.AppTransitionAnimationSpec)5 Task (com.android.systemui.recents.model.Task)5 TaskStackLayoutAlgorithm (com.android.systemui.recents.views.TaskStackLayoutAlgorithm)5 TaskStackViewScroller (com.android.systemui.recents.views.TaskStackViewScroller)5 TaskViewTransform (com.android.systemui.recents.views.TaskViewTransform)5 ArrayList (java.util.ArrayList)5