Search in sources :

Example 1 with LauncherAnimationRunner

use of com.android.launcher3.LauncherAnimationRunner in project android_packages_apps_Launcher3 by crdroidandroid.

the class QuickstepTransitionManager method getActivityLaunchOptions.

/**
 * @return ActivityOptions with remote animations that controls how the window of the opening
 * targets are displayed.
 */
public ActivityOptionsWrapper getActivityLaunchOptions(View v) {
    boolean fromRecents = isLaunchingFromRecents(v, null);
    RunnableList onEndCallback = new RunnableList();
    mAppLaunchRunner = new AppLaunchAnimationRunner(v, onEndCallback);
    RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(mHandler, mAppLaunchRunner, true);
    // Note that this duration is a guess as we do not know if the animation will be a
    // recents launch or not for sure until we know the opening app targets.
    long duration = fromRecents ? RECENTS_LAUNCH_DURATION : APP_LAUNCH_DURATION;
    long statusBarTransitionDelay = duration - STATUS_BAR_TRANSITION_DURATION - STATUS_BAR_TRANSITION_PRE_DELAY;
    RemoteAnimationAdapterCompat adapterCompat = new RemoteAnimationAdapterCompat(runner, duration, statusBarTransitionDelay);
    return new ActivityOptionsWrapper(ActivityOptionsCompat.makeRemoteAnimation(adapterCompat), onEndCallback);
}
Also used : RemoteAnimationAdapterCompat(com.android.systemui.shared.system.RemoteAnimationAdapterCompat) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) RunnableList(com.android.launcher3.util.RunnableList) RemoteAnimationRunnerCompat(com.android.systemui.shared.system.RemoteAnimationRunnerCompat)

Example 2 with LauncherAnimationRunner

use of com.android.launcher3.LauncherAnimationRunner in project android_packages_apps_Launcher3 by crdroidandroid.

the class RecentsActivity method getActivityLaunchOptions.

@Override
public ActivityOptionsWrapper getActivityLaunchOptions(final View v, @Nullable ItemInfo item) {
    if (!(v instanceof TaskView)) {
        return super.getActivityLaunchOptions(v, item);
    }
    final TaskView taskView = (TaskView) v;
    RunnableList onEndCallback = new RunnableList();
    mActivityLaunchAnimationRunner = new RemoteAnimationFactory() {

        @Override
        public void onCreateAnimation(int transit, RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets, RemoteAnimationTargetCompat[] nonAppTargets, AnimationResult result) {
            AnimatorSet anim = composeRecentsLaunchAnimator(taskView, appTargets, wallpaperTargets, nonAppTargets);
            anim.addListener(resetStateListener());
            result.setAnimation(anim, RecentsActivity.this, onEndCallback::executeAllAndDestroy, true);
        }

        @Override
        public void onAnimationCancelled() {
            onEndCallback.executeAllAndDestroy();
        }
    };
    final LauncherAnimationRunner wrapper = new LauncherAnimationRunner(mUiHandler, mActivityLaunchAnimationRunner, true);
    RemoteAnimationAdapterCompat adapterCompat = new RemoteAnimationAdapterCompat(wrapper, RECENTS_LAUNCH_DURATION, RECENTS_LAUNCH_DURATION - STATUS_BAR_TRANSITION_DURATION - STATUS_BAR_TRANSITION_PRE_DELAY);
    final ActivityOptionsWrapper activityOptions = new ActivityOptionsWrapper(ActivityOptionsCompat.makeRemoteAnimation(adapterCompat), onEndCallback);
    activityOptions.options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON);
    return activityOptions;
}
Also used : RemoteAnimationAdapterCompat(com.android.systemui.shared.system.RemoteAnimationAdapterCompat) TaskView(com.android.quickstep.views.TaskView) RemoteAnimationFactory(com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) AnimationResult(com.android.launcher3.LauncherAnimationRunner.AnimationResult) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) AnimatorSet(android.animation.AnimatorSet) LauncherAnimationRunner(com.android.launcher3.LauncherAnimationRunner) RunnableList(com.android.launcher3.util.RunnableList)

Example 3 with LauncherAnimationRunner

use of com.android.launcher3.LauncherAnimationRunner in project android_packages_apps_Launcher3 by crdroidandroid.

the class SplitSelectStateController method setSecondTaskId.

/**
 * To be called after second task selected
 */
public void setSecondTaskId(TaskView taskView) {
    if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
        // Assume initial task is for top/left part of screen
        final int[] taskIds = mInitialPosition.mStagePosition == STAGE_POSITION_TOP_OR_LEFT ? new int[] { mInitialTaskView.getTask().key.id, taskView.getTask().key.id } : new int[] { taskView.getTask().key.id, mInitialTaskView.getTask().key.id };
        RemoteSplitLaunchAnimationRunner animationRunner = new RemoteSplitLaunchAnimationRunner(mInitialTaskView, taskView);
        mSystemUiProxy.startTasks(taskIds[0], null, /* mainOptions */
        taskIds[1], null, /* sideOptions */
        STAGE_POSITION_BOTTOM_OR_RIGHT, new RemoteTransitionCompat(animationRunner, MAIN_EXECUTOR));
        return;
    }
    // Assume initial mInitialTaskId is for top/left part of screen
    RemoteAnimationFactory initialSplitRunnerWrapped = new SplitLaunchAnimationRunner(mInitialTaskView, 0);
    RemoteAnimationFactory secondarySplitRunnerWrapped = new SplitLaunchAnimationRunner(taskView, 1);
    RemoteAnimationRunnerCompat initialSplitRunner = new LauncherAnimationRunner(new Handler(Looper.getMainLooper()), initialSplitRunnerWrapped, true);
    RemoteAnimationRunnerCompat secondarySplitRunner = new LauncherAnimationRunner(new Handler(Looper.getMainLooper()), secondarySplitRunnerWrapped, true);
    ActivityOptions initialOptions = ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(initialSplitRunner, 300, 150));
    ActivityOptions secondaryOptions = ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(secondarySplitRunner, 300, 150));
    mSystemUiProxy.startTask(mInitialTaskView.getTask().key.id, mInitialPosition.mStageType, mInitialPosition.mStagePosition, /*null*/
    initialOptions.toBundle());
    Pair<Integer, Integer> compliment = getComplimentaryStageAndPosition(mInitialPosition);
    mSystemUiProxy.startTask(taskView.getTask().key.id, compliment.first, compliment.second, /*null*/
    secondaryOptions.toBundle());
    // After successful launch, call resetState
    resetState();
}
Also used : RemoteAnimationAdapterCompat(com.android.systemui.shared.system.RemoteAnimationAdapterCompat) RemoteAnimationFactory(com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory) Handler(android.os.Handler) LauncherAnimationRunner(com.android.launcher3.LauncherAnimationRunner) RemoteTransitionCompat(com.android.systemui.shared.system.RemoteTransitionCompat) RemoteAnimationRunnerCompat(com.android.systemui.shared.system.RemoteAnimationRunnerCompat) ActivityOptions(android.app.ActivityOptions)

Example 4 with LauncherAnimationRunner

use of com.android.launcher3.LauncherAnimationRunner in project android_packages_apps_Launcher3 by crdroidandroid.

the class RecentsActivity method startHomeInternal.

private void startHomeInternal() {
    LauncherAnimationRunner runner = new LauncherAnimationRunner(getMainThreadHandler(), mAnimationToHomeFactory, true);
    RemoteAnimationAdapterCompat adapterCompat = new RemoteAnimationAdapterCompat(runner, HOME_APPEAR_DURATION, 0);
    startActivity(createHomeIntent(), ActivityOptionsCompat.makeRemoteAnimation(adapterCompat).toBundle());
}
Also used : RemoteAnimationAdapterCompat(com.android.systemui.shared.system.RemoteAnimationAdapterCompat) LauncherAnimationRunner(com.android.launcher3.LauncherAnimationRunner)

Example 5 with LauncherAnimationRunner

use of com.android.launcher3.LauncherAnimationRunner in project android_packages_apps_Launcher3 by crdroidandroid.

the class RemoteAnimationProvider method toActivityOptions.

ActivityOptions toActivityOptions(Handler handler, long duration, Context context) {
    mAnimationRunner = (transit, appTargets, wallpaperTargets, nonApps, result) -> result.setAnimation(createWindowAnimation(appTargets, wallpaperTargets), context);
    final LauncherAnimationRunner wrapper = new LauncherAnimationRunner(handler, mAnimationRunner, false);
    return ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(wrapper, duration, 0));
}
Also used : RemoteAnimationAdapterCompat(com.android.systemui.shared.system.RemoteAnimationAdapterCompat) LauncherAnimationRunner(com.android.launcher3.LauncherAnimationRunner)

Aggregations

RemoteAnimationAdapterCompat (com.android.systemui.shared.system.RemoteAnimationAdapterCompat)5 LauncherAnimationRunner (com.android.launcher3.LauncherAnimationRunner)4 RemoteAnimationFactory (com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory)2 ActivityOptionsWrapper (com.android.launcher3.util.ActivityOptionsWrapper)2 RunnableList (com.android.launcher3.util.RunnableList)2 RemoteAnimationRunnerCompat (com.android.systemui.shared.system.RemoteAnimationRunnerCompat)2 AnimatorSet (android.animation.AnimatorSet)1 ActivityOptions (android.app.ActivityOptions)1 Handler (android.os.Handler)1 AnimationResult (com.android.launcher3.LauncherAnimationRunner.AnimationResult)1 TaskView (com.android.quickstep.views.TaskView)1 RemoteAnimationTargetCompat (com.android.systemui.shared.system.RemoteAnimationTargetCompat)1 RemoteTransitionCompat (com.android.systemui.shared.system.RemoteTransitionCompat)1