Search in sources :

Example 1 with ExitRecentsWindowFirstAnimationFrameEvent

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

the class RecentsTransitionHelper method launchTaskFromRecents.

/**
     * Launches the specified {@link Task}.
     */
public void launchTaskFromRecents(final TaskStack stack, @Nullable final Task task, final TaskStackView stackView, final TaskView taskView, final boolean screenPinningRequested, final Rect bounds, final int destinationStack) {
    final ActivityOptions opts = ActivityOptions.makeBasic();
    if (bounds != null) {
        opts.setLaunchBounds(bounds.isEmpty() ? null : bounds);
    }
    final ActivityOptions.OnAnimationStartedListener animStartedListener;
    final IAppTransitionAnimationSpecsFuture transitionFuture;
    if (taskView != null) {
        transitionFuture = getAppTransitionFuture(new AnimationSpecComposer() {

            @Override
            public List<AppTransitionAnimationSpec> composeSpecs() {
                return composeAnimationSpecs(task, stackView, destinationStack);
            }
        });
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
                stackView.cancelAllTaskViewAnimations();
                if (screenPinningRequested) {
                    // Request screen pinning after the animation runs
                    mStartScreenPinningRunnable.taskId = task.key.id;
                    mHandler.postDelayed(mStartScreenPinningRunnable, 350);
                }
            }
        };
    } else {
        // This is only the case if the task is not on screen (scrolled offscreen for example)
        transitionFuture = null;
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
                stackView.cancelAllTaskViewAnimations();
            }
        };
    }
    if (taskView == null) {
        // If there is no task view, then we do not need to worry about animating out occluding
        // task views, and we can launch immediately
        startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
    } else {
        LaunchTaskStartedEvent launchStartedEvent = new LaunchTaskStartedEvent(taskView, screenPinningRequested);
        if (task.group != null && !task.group.isFrontMostTask(task)) {
            launchStartedEvent.addPostAnimationCallback(new Runnable() {

                @Override
                public void run() {
                    startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
                }
            });
            EventBus.getDefault().send(launchStartedEvent);
        } else {
            EventBus.getDefault().send(launchStartedEvent);
            startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
        }
    }
    Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
}
Also used : OnAnimationStartedListener(android.app.ActivityOptions.OnAnimationStartedListener) IAppTransitionAnimationSpecsFuture(android.view.IAppTransitionAnimationSpecsFuture) AppTransitionAnimationSpec(android.view.AppTransitionAnimationSpec) LaunchTaskStartedEvent(com.android.systemui.recents.events.activity.LaunchTaskStartedEvent) ExitRecentsWindowFirstAnimationFrameEvent(com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent) CancelEnterRecentsWindowAnimationEvent(com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent) ActivityOptions(android.app.ActivityOptions)

Example 2 with ExitRecentsWindowFirstAnimationFrameEvent

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

the class RecentsTransitionHelper method launchTaskFromRecents.

/**
     * Launches the specified {@link Task}.
     */
public void launchTaskFromRecents(final TaskStack stack, @Nullable final Task task, final TaskStackView stackView, final TaskView taskView, final boolean screenPinningRequested, final Rect bounds, final int destinationStack) {
    final ActivityOptions opts = ActivityOptions.makeBasic();
    if (bounds != null) {
        opts.setLaunchBounds(bounds.isEmpty() ? null : bounds);
    }
    final ActivityOptions.OnAnimationStartedListener animStartedListener;
    final IAppTransitionAnimationSpecsFuture transitionFuture;
    if (taskView != null) {
        transitionFuture = getAppTransitionFuture(new AnimationSpecComposer() {

            @Override
            public List<AppTransitionAnimationSpec> composeSpecs() {
                return composeAnimationSpecs(task, stackView, destinationStack);
            }
        });
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
                stackView.cancelAllTaskViewAnimations();
                if (screenPinningRequested) {
                    // Request screen pinning after the animation runs
                    mStartScreenPinningRunnable.taskId = task.key.id;
                    mHandler.postDelayed(mStartScreenPinningRunnable, 350);
                }
            }
        };
    } else {
        // This is only the case if the task is not on screen (scrolled offscreen for example)
        transitionFuture = null;
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
                stackView.cancelAllTaskViewAnimations();
            }
        };
    }
    if (taskView == null) {
        // If there is no task view, then we do not need to worry about animating out occluding
        // task views, and we can launch immediately
        startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
    } else {
        LaunchTaskStartedEvent launchStartedEvent = new LaunchTaskStartedEvent(taskView, screenPinningRequested);
        if (task.group != null && !task.group.isFrontMostTask(task)) {
            launchStartedEvent.addPostAnimationCallback(new Runnable() {

                @Override
                public void run() {
                    startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
                }
            });
            EventBus.getDefault().send(launchStartedEvent);
        } else {
            EventBus.getDefault().send(launchStartedEvent);
            startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
        }
    }
    Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
}
Also used : OnAnimationStartedListener(android.app.ActivityOptions.OnAnimationStartedListener) IAppTransitionAnimationSpecsFuture(android.view.IAppTransitionAnimationSpecsFuture) AppTransitionAnimationSpec(android.view.AppTransitionAnimationSpec) LaunchTaskStartedEvent(com.android.systemui.recents.events.activity.LaunchTaskStartedEvent) ExitRecentsWindowFirstAnimationFrameEvent(com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent) CancelEnterRecentsWindowAnimationEvent(com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent) ActivityOptions(android.app.ActivityOptions)

Example 3 with ExitRecentsWindowFirstAnimationFrameEvent

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

the class RecentsTransitionHelper method launchTaskFromRecents.

/**
     * Launches the specified {@link Task}.
     */
public void launchTaskFromRecents(final TaskStack stack, @Nullable final Task task, final TaskStackView stackView, final TaskView taskView, final boolean screenPinningRequested, final Rect bounds, final int destinationStack) {
    final ActivityOptions opts = ActivityOptions.makeBasic();
    if (bounds != null) {
        opts.setLaunchBounds(bounds.isEmpty() ? null : bounds);
    }
    final ActivityOptions.OnAnimationStartedListener animStartedListener;
    final IAppTransitionAnimationSpecsFuture transitionFuture;
    if (taskView != null) {
        transitionFuture = getAppTransitionFuture(new AnimationSpecComposer() {

            @Override
            public List<AppTransitionAnimationSpec> composeSpecs() {
                return composeAnimationSpecs(task, stackView, destinationStack);
            }
        });
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
                stackView.cancelAllTaskViewAnimations();
                if (screenPinningRequested) {
                    // Request screen pinning after the animation runs
                    mStartScreenPinningRunnable.taskId = task.key.id;
                    mHandler.postDelayed(mStartScreenPinningRunnable, 350);
                }
            }
        };
    } else {
        // This is only the case if the task is not on screen (scrolled offscreen for example)
        transitionFuture = null;
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
                stackView.cancelAllTaskViewAnimations();
            }
        };
    }
    if (taskView == null) {
        // If there is no task view, then we do not need to worry about animating out occluding
        // task views, and we can launch immediately
        startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
    } else {
        LaunchTaskStartedEvent launchStartedEvent = new LaunchTaskStartedEvent(taskView, screenPinningRequested);
        if (task.group != null && !task.group.isFrontMostTask(task)) {
            launchStartedEvent.addPostAnimationCallback(new Runnable() {

                @Override
                public void run() {
                    startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
                }
            });
            EventBus.getDefault().send(launchStartedEvent);
        } else {
            EventBus.getDefault().send(launchStartedEvent);
            startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
        }
    }
    Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
}
Also used : OnAnimationStartedListener(android.app.ActivityOptions.OnAnimationStartedListener) IAppTransitionAnimationSpecsFuture(android.view.IAppTransitionAnimationSpecsFuture) AppTransitionAnimationSpec(android.view.AppTransitionAnimationSpec) LaunchTaskStartedEvent(com.android.systemui.recents.events.activity.LaunchTaskStartedEvent) ExitRecentsWindowFirstAnimationFrameEvent(com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent) CancelEnterRecentsWindowAnimationEvent(com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent) ActivityOptions(android.app.ActivityOptions)

Example 4 with ExitRecentsWindowFirstAnimationFrameEvent

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

the class RecentsTransitionHelper method launchTaskFromRecents.

/**
     * Launches the specified {@link Task}.
     */
public void launchTaskFromRecents(final TaskStack stack, @Nullable final Task task, final TaskStackView stackView, final TaskView taskView, final boolean screenPinningRequested, final Rect bounds, final int destinationStack) {
    final ActivityOptions opts = ActivityOptions.makeBasic();
    if (bounds != null) {
        opts.setLaunchBounds(bounds.isEmpty() ? null : bounds);
    }
    final ActivityOptions.OnAnimationStartedListener animStartedListener;
    final IAppTransitionAnimationSpecsFuture transitionFuture;
    if (taskView != null) {
        transitionFuture = getAppTransitionFuture(new AnimationSpecComposer() {

            @Override
            public List<AppTransitionAnimationSpec> composeSpecs() {
                return composeAnimationSpecs(task, stackView, destinationStack);
            }
        });
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
                stackView.cancelAllTaskViewAnimations();
                if (screenPinningRequested) {
                    // Request screen pinning after the animation runs
                    mStartScreenPinningRunnable.taskId = task.key.id;
                    mHandler.postDelayed(mStartScreenPinningRunnable, 350);
                }
            }
        };
    } else {
        // This is only the case if the task is not on screen (scrolled offscreen for example)
        transitionFuture = null;
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
                stackView.cancelAllTaskViewAnimations();
            }
        };
    }
    if (taskView == null) {
        // If there is no task view, then we do not need to worry about animating out occluding
        // task views, and we can launch immediately
        startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
    } else {
        LaunchTaskStartedEvent launchStartedEvent = new LaunchTaskStartedEvent(taskView, screenPinningRequested);
        if (task.group != null && !task.group.isFrontMostTask(task)) {
            launchStartedEvent.addPostAnimationCallback(new Runnable() {

                @Override
                public void run() {
                    startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
                }
            });
            EventBus.getDefault().send(launchStartedEvent);
        } else {
            EventBus.getDefault().send(launchStartedEvent);
            startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
        }
    }
    Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
}
Also used : OnAnimationStartedListener(android.app.ActivityOptions.OnAnimationStartedListener) IAppTransitionAnimationSpecsFuture(android.view.IAppTransitionAnimationSpecsFuture) AppTransitionAnimationSpec(android.view.AppTransitionAnimationSpec) LaunchTaskStartedEvent(com.android.systemui.recents.events.activity.LaunchTaskStartedEvent) ExitRecentsWindowFirstAnimationFrameEvent(com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent) CancelEnterRecentsWindowAnimationEvent(com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent) ActivityOptions(android.app.ActivityOptions)

Example 5 with ExitRecentsWindowFirstAnimationFrameEvent

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

the class RecentsTransitionHelper method launchTaskFromRecents.

/**
     * Launches the specified {@link Task}.
     */
public void launchTaskFromRecents(final TaskStack stack, @Nullable final Task task, final TaskStackView stackView, final TaskView taskView, final boolean screenPinningRequested, final Rect bounds, final int destinationStack) {
    final ActivityOptions opts = ActivityOptions.makeBasic();
    if (bounds != null) {
        opts.setLaunchBounds(bounds.isEmpty() ? null : bounds);
    }
    final ActivityOptions.OnAnimationStartedListener animStartedListener;
    final IAppTransitionAnimationSpecsFuture transitionFuture;
    if (taskView != null) {
        transitionFuture = getAppTransitionFuture(new AnimationSpecComposer() {

            @Override
            public List<AppTransitionAnimationSpec> composeSpecs() {
                return composeAnimationSpecs(task, stackView, destinationStack);
            }
        });
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
                stackView.cancelAllTaskViewAnimations();
                if (screenPinningRequested) {
                    // Request screen pinning after the animation runs
                    mStartScreenPinningRunnable.taskId = task.key.id;
                    mHandler.postDelayed(mStartScreenPinningRunnable, 350);
                }
            }
        };
    } else {
        // This is only the case if the task is not on screen (scrolled offscreen for example)
        transitionFuture = null;
        animStartedListener = new ActivityOptions.OnAnimationStartedListener() {

            @Override
            public void onAnimationStarted() {
                // If we are launching into another task, cancel the previous task's
                // window transition
                EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
                EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
                stackView.cancelAllTaskViewAnimations();
            }
        };
    }
    if (taskView == null) {
        // If there is no task view, then we do not need to worry about animating out occluding
        // task views, and we can launch immediately
        startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
    } else {
        LaunchTaskStartedEvent launchStartedEvent = new LaunchTaskStartedEvent(taskView, screenPinningRequested);
        if (task.group != null && !task.group.isFrontMostTask(task)) {
            launchStartedEvent.addPostAnimationCallback(new Runnable() {

                @Override
                public void run() {
                    startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
                }
            });
            EventBus.getDefault().send(launchStartedEvent);
        } else {
            EventBus.getDefault().send(launchStartedEvent);
            startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
        }
    }
    Recents.getSystemServices().sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
}
Also used : OnAnimationStartedListener(android.app.ActivityOptions.OnAnimationStartedListener) IAppTransitionAnimationSpecsFuture(android.view.IAppTransitionAnimationSpecsFuture) AppTransitionAnimationSpec(android.view.AppTransitionAnimationSpec) LaunchTaskStartedEvent(com.android.systemui.recents.events.activity.LaunchTaskStartedEvent) ExitRecentsWindowFirstAnimationFrameEvent(com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent) CancelEnterRecentsWindowAnimationEvent(com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent) ActivityOptions(android.app.ActivityOptions)

Aggregations

ActivityOptions (android.app.ActivityOptions)5 OnAnimationStartedListener (android.app.ActivityOptions.OnAnimationStartedListener)5 AppTransitionAnimationSpec (android.view.AppTransitionAnimationSpec)5 IAppTransitionAnimationSpecsFuture (android.view.IAppTransitionAnimationSpecsFuture)5 CancelEnterRecentsWindowAnimationEvent (com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent)5 ExitRecentsWindowFirstAnimationFrameEvent (com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent)5 LaunchTaskStartedEvent (com.android.systemui.recents.events.activity.LaunchTaskStartedEvent)5