Search in sources :

Example 1 with DockedFirstAnimationFrameEvent

use of com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent in project android_frameworks_base by ResurrectionRemix.

the class RecentsView method onBusEvent.

public final void onBusEvent(final DragEndEvent event) {
    // Handle the case where we drop onto a dock region
    if (event.dropTarget instanceof TaskStack.DockState) {
        final TaskStack.DockState dockState = (TaskStack.DockState) event.dropTarget;
        // Hide the dock region
        updateVisibleDockRegions(null, false, /* isDefaultDockState */
        -1, -1, false, /* animateAlpha */
        false);
        // We translated the view but we need to animate it back from the current layout-space
        // rect to its final layout-space rect
        Utilities.setViewFrameFromTranslation(event.taskView);
        // Dock the task and launch it
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.startTaskInDockedMode(event.task.key.id, dockState.createMode)) {
            final OnAnimationStartedListener startedListener = new OnAnimationStartedListener() {

                @Override
                public void onAnimationStarted() {
                    EventBus.getDefault().send(new DockedFirstAnimationFrameEvent());
                    // Remove the task and don't bother relaying out, as all the tasks will be
                    // relaid out when the stack changes on the multiwindow change event
                    getStack().removeTask(event.task, null, true);
                }
            };
            final Rect taskRect = getTaskRect(event.taskView);
            IAppTransitionAnimationSpecsFuture future = mTransitionHelper.getAppTransitionFuture(new AnimationSpecComposer() {

                @Override
                public List<AppTransitionAnimationSpec> composeSpecs() {
                    return mTransitionHelper.composeDockAnimationSpec(event.taskView, taskRect);
                }
            });
            ssp.overridePendingAppTransitionMultiThumbFuture(future, mTransitionHelper.wrapStartedListener(startedListener), true);
            MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_DRAG_DROP, event.task.getTopComponent().flattenToShortString());
        } else {
            EventBus.getDefault().send(new DragEndCancelledEvent(getStack(), event.task, event.taskView));
        }
    } else {
        // Animate the overlay alpha back to 0
        updateVisibleDockRegions(null, true, /* isDefaultDockState */
        -1, -1, true, /* animateAlpha */
        false);
    }
    // Show the stack action button again without changing visibility
    if (mStackActionButton != null) {
        mStackActionButton.animate().alpha(1f).setDuration(SHOW_STACK_ACTION_BUTTON_DURATION).setInterpolator(Interpolators.ALPHA_IN).start();
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) TaskStack(com.android.systemui.recents.model.TaskStack) OnAnimationStartedListener(android.app.ActivityOptions.OnAnimationStartedListener) Rect(android.graphics.Rect) IAppTransitionAnimationSpecsFuture(android.view.IAppTransitionAnimationSpecsFuture) List(java.util.List) ArrayList(java.util.ArrayList) DragEndCancelledEvent(com.android.systemui.recents.events.ui.dragndrop.DragEndCancelledEvent) AnimationSpecComposer(com.android.systemui.recents.views.RecentsTransitionHelper.AnimationSpecComposer) DockedFirstAnimationFrameEvent(com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent)

Example 2 with DockedFirstAnimationFrameEvent

use of com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent in project platform_frameworks_base by android.

the class RecentsView method onBusEvent.

public final void onBusEvent(final DragEndEvent event) {
    // Handle the case where we drop onto a dock region
    if (event.dropTarget instanceof TaskStack.DockState) {
        final TaskStack.DockState dockState = (TaskStack.DockState) event.dropTarget;
        // Hide the dock region
        updateVisibleDockRegions(null, false, /* isDefaultDockState */
        -1, -1, false, /* animateAlpha */
        false);
        // We translated the view but we need to animate it back from the current layout-space
        // rect to its final layout-space rect
        Utilities.setViewFrameFromTranslation(event.taskView);
        // Dock the task and launch it
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.startTaskInDockedMode(event.task.key.id, dockState.createMode)) {
            final OnAnimationStartedListener startedListener = new OnAnimationStartedListener() {

                @Override
                public void onAnimationStarted() {
                    EventBus.getDefault().send(new DockedFirstAnimationFrameEvent());
                    // Remove the task and don't bother relaying out, as all the tasks will be
                    // relaid out when the stack changes on the multiwindow change event
                    mTaskStackView.getStack().removeTask(event.task, null, true);
                }
            };
            final Rect taskRect = getTaskRect(event.taskView);
            IAppTransitionAnimationSpecsFuture future = mTransitionHelper.getAppTransitionFuture(new AnimationSpecComposer() {

                @Override
                public List<AppTransitionAnimationSpec> composeSpecs() {
                    return mTransitionHelper.composeDockAnimationSpec(event.taskView, taskRect);
                }
            });
            ssp.overridePendingAppTransitionMultiThumbFuture(future, mTransitionHelper.wrapStartedListener(startedListener), true);
            MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_DRAG_DROP, event.task.getTopComponent().flattenToShortString());
        } else {
            EventBus.getDefault().send(new DragEndCancelledEvent(mStack, event.task, event.taskView));
        }
    } else {
        // Animate the overlay alpha back to 0
        updateVisibleDockRegions(null, true, /* isDefaultDockState */
        -1, -1, true, /* animateAlpha */
        false);
    }
    // Show the stack action button again without changing visibility
    if (mStackActionButton != null) {
        mStackActionButton.animate().alpha(1f).setDuration(SHOW_STACK_ACTION_BUTTON_DURATION).setInterpolator(Interpolators.ALPHA_IN).start();
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) TaskStack(com.android.systemui.recents.model.TaskStack) OnAnimationStartedListener(android.app.ActivityOptions.OnAnimationStartedListener) Rect(android.graphics.Rect) IAppTransitionAnimationSpecsFuture(android.view.IAppTransitionAnimationSpecsFuture) List(java.util.List) ArrayList(java.util.ArrayList) DragEndCancelledEvent(com.android.systemui.recents.events.ui.dragndrop.DragEndCancelledEvent) AnimationSpecComposer(com.android.systemui.recents.views.RecentsTransitionHelper.AnimationSpecComposer) DockedFirstAnimationFrameEvent(com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent)

Example 3 with DockedFirstAnimationFrameEvent

use of com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent in project android_frameworks_base by crdroidandroid.

the class RecentsView method onBusEvent.

public final void onBusEvent(final DragEndEvent event) {
    // Handle the case where we drop onto a dock region
    if (event.dropTarget instanceof TaskStack.DockState) {
        final TaskStack.DockState dockState = (TaskStack.DockState) event.dropTarget;
        // Hide the dock region
        updateVisibleDockRegions(null, false, /* isDefaultDockState */
        -1, -1, false, /* animateAlpha */
        false);
        // We translated the view but we need to animate it back from the current layout-space
        // rect to its final layout-space rect
        Utilities.setViewFrameFromTranslation(event.taskView);
        // Dock the task and launch it
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.startTaskInDockedMode(event.task.key.id, dockState.createMode)) {
            final OnAnimationStartedListener startedListener = new OnAnimationStartedListener() {

                @Override
                public void onAnimationStarted() {
                    EventBus.getDefault().send(new DockedFirstAnimationFrameEvent());
                    // Remove the task and don't bother relaying out, as all the tasks will be
                    // relaid out when the stack changes on the multiwindow change event
                    getStack().removeTask(event.task, null, true);
                }
            };
            final Rect taskRect = getTaskRect(event.taskView);
            IAppTransitionAnimationSpecsFuture future = mTransitionHelper.getAppTransitionFuture(new AnimationSpecComposer() {

                @Override
                public List<AppTransitionAnimationSpec> composeSpecs() {
                    return mTransitionHelper.composeDockAnimationSpec(event.taskView, taskRect);
                }
            });
            ssp.overridePendingAppTransitionMultiThumbFuture(future, mTransitionHelper.wrapStartedListener(startedListener), true);
            MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_DRAG_DROP, event.task.getTopComponent().flattenToShortString());
        } else {
            EventBus.getDefault().send(new DragEndCancelledEvent(getStack(), event.task, event.taskView));
        }
    } else {
        // Animate the overlay alpha back to 0
        updateVisibleDockRegions(null, true, /* isDefaultDockState */
        -1, -1, true, /* animateAlpha */
        false);
    }
    // Show the stack action button again without changing visibility
    if (mStackActionButton != null) {
        mStackActionButton.animate().alpha(1f).setDuration(SHOW_STACK_ACTION_BUTTON_DURATION).setInterpolator(Interpolators.ALPHA_IN).start();
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) TaskStack(com.android.systemui.recents.model.TaskStack) OnAnimationStartedListener(android.app.ActivityOptions.OnAnimationStartedListener) Rect(android.graphics.Rect) IAppTransitionAnimationSpecsFuture(android.view.IAppTransitionAnimationSpecsFuture) List(java.util.List) ArrayList(java.util.ArrayList) DragEndCancelledEvent(com.android.systemui.recents.events.ui.dragndrop.DragEndCancelledEvent) AnimationSpecComposer(com.android.systemui.recents.views.RecentsTransitionHelper.AnimationSpecComposer) DockedFirstAnimationFrameEvent(com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent)

Example 4 with DockedFirstAnimationFrameEvent

use of com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent in project android_frameworks_base by AOSPA.

the class RecentsView method onBusEvent.

public final void onBusEvent(final DragEndEvent event) {
    // Handle the case where we drop onto a dock region
    if (event.dropTarget instanceof TaskStack.DockState) {
        final TaskStack.DockState dockState = (TaskStack.DockState) event.dropTarget;
        // Hide the dock region
        updateVisibleDockRegions(null, false, /* isDefaultDockState */
        -1, -1, false, /* animateAlpha */
        false);
        // We translated the view but we need to animate it back from the current layout-space
        // rect to its final layout-space rect
        Utilities.setViewFrameFromTranslation(event.taskView);
        // Dock the task and launch it
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.startTaskInDockedMode(event.task.key.id, dockState.createMode)) {
            final OnAnimationStartedListener startedListener = new OnAnimationStartedListener() {

                @Override
                public void onAnimationStarted() {
                    EventBus.getDefault().send(new DockedFirstAnimationFrameEvent());
                    // Remove the task and don't bother relaying out, as all the tasks will be
                    // relaid out when the stack changes on the multiwindow change event
                    getStack().removeTask(event.task, null, true);
                }
            };
            final Rect taskRect = getTaskRect(event.taskView);
            IAppTransitionAnimationSpecsFuture future = mTransitionHelper.getAppTransitionFuture(new AnimationSpecComposer() {

                @Override
                public List<AppTransitionAnimationSpec> composeSpecs() {
                    return mTransitionHelper.composeDockAnimationSpec(event.taskView, taskRect);
                }
            });
            ssp.overridePendingAppTransitionMultiThumbFuture(future, mTransitionHelper.wrapStartedListener(startedListener), true);
            MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_DRAG_DROP, event.task.getTopComponent().flattenToShortString());
        } else {
            EventBus.getDefault().send(new DragEndCancelledEvent(getStack(), event.task, event.taskView));
        }
    } else {
        // Animate the overlay alpha back to 0
        updateVisibleDockRegions(null, true, /* isDefaultDockState */
        -1, -1, true, /* animateAlpha */
        false);
    }
    // Show the stack action button again without changing visibility
    if (mStackActionButton != null) {
        mStackActionButton.animate().alpha(1f).setDuration(SHOW_STACK_ACTION_BUTTON_DURATION).setInterpolator(Interpolators.ALPHA_IN).start();
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) TaskStack(com.android.systemui.recents.model.TaskStack) OnAnimationStartedListener(android.app.ActivityOptions.OnAnimationStartedListener) Rect(android.graphics.Rect) IAppTransitionAnimationSpecsFuture(android.view.IAppTransitionAnimationSpecsFuture) List(java.util.List) ArrayList(java.util.ArrayList) DragEndCancelledEvent(com.android.systemui.recents.events.ui.dragndrop.DragEndCancelledEvent) AnimationSpecComposer(com.android.systemui.recents.views.RecentsTransitionHelper.AnimationSpecComposer) DockedFirstAnimationFrameEvent(com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent)

Example 5 with DockedFirstAnimationFrameEvent

use of com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent in project android_frameworks_base by DirtyUnicorns.

the class RecentsView method onBusEvent.

public final void onBusEvent(final DragEndEvent event) {
    // Handle the case where we drop onto a dock region
    if (event.dropTarget instanceof TaskStack.DockState) {
        final TaskStack.DockState dockState = (TaskStack.DockState) event.dropTarget;
        // Hide the dock region
        updateVisibleDockRegions(null, false, /* isDefaultDockState */
        -1, -1, false, /* animateAlpha */
        false);
        // We translated the view but we need to animate it back from the current layout-space
        // rect to its final layout-space rect
        Utilities.setViewFrameFromTranslation(event.taskView);
        // Dock the task and launch it
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.startTaskInDockedMode(event.task.key.id, dockState.createMode)) {
            final OnAnimationStartedListener startedListener = new OnAnimationStartedListener() {

                @Override
                public void onAnimationStarted() {
                    EventBus.getDefault().send(new DockedFirstAnimationFrameEvent());
                    // Remove the task and don't bother relaying out, as all the tasks will be
                    // relaid out when the stack changes on the multiwindow change event
                    getStack().removeTask(event.task, null, true);
                }
            };
            final Rect taskRect = getTaskRect(event.taskView);
            IAppTransitionAnimationSpecsFuture future = mTransitionHelper.getAppTransitionFuture(new AnimationSpecComposer() {

                @Override
                public List<AppTransitionAnimationSpec> composeSpecs() {
                    return mTransitionHelper.composeDockAnimationSpec(event.taskView, taskRect);
                }
            });
            ssp.overridePendingAppTransitionMultiThumbFuture(future, mTransitionHelper.wrapStartedListener(startedListener), true);
            MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_DRAG_DROP, event.task.getTopComponent().flattenToShortString());
        } else {
            EventBus.getDefault().send(new DragEndCancelledEvent(getStack(), event.task, event.taskView));
        }
    } else {
        // Animate the overlay alpha back to 0
        updateVisibleDockRegions(null, true, /* isDefaultDockState */
        -1, -1, true, /* animateAlpha */
        false);
    }
    // Show the stack action button again without changing visibility
    if (mStackActionButton != null) {
        mStackActionButton.animate().alpha(1f).setDuration(SHOW_STACK_ACTION_BUTTON_DURATION).setInterpolator(Interpolators.ALPHA_IN).start();
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) TaskStack(com.android.systemui.recents.model.TaskStack) OnAnimationStartedListener(android.app.ActivityOptions.OnAnimationStartedListener) Rect(android.graphics.Rect) IAppTransitionAnimationSpecsFuture(android.view.IAppTransitionAnimationSpecsFuture) List(java.util.List) ArrayList(java.util.ArrayList) DragEndCancelledEvent(com.android.systemui.recents.events.ui.dragndrop.DragEndCancelledEvent) AnimationSpecComposer(com.android.systemui.recents.views.RecentsTransitionHelper.AnimationSpecComposer) DockedFirstAnimationFrameEvent(com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent)

Aggregations

OnAnimationStartedListener (android.app.ActivityOptions.OnAnimationStartedListener)5 Rect (android.graphics.Rect)5 IAppTransitionAnimationSpecsFuture (android.view.IAppTransitionAnimationSpecsFuture)5 DockedFirstAnimationFrameEvent (com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent)5 DragEndCancelledEvent (com.android.systemui.recents.events.ui.dragndrop.DragEndCancelledEvent)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 TaskStack (com.android.systemui.recents.model.TaskStack)5 AnimationSpecComposer (com.android.systemui.recents.views.RecentsTransitionHelper.AnimationSpecComposer)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5