Search in sources :

Example 1 with ActivityOptionsWrapper

use of com.android.launcher3.util.ActivityOptionsWrapper 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 ActivityOptionsWrapper

use of com.android.launcher3.util.ActivityOptionsWrapper 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 ActivityOptionsWrapper

use of com.android.launcher3.util.ActivityOptionsWrapper in project android_packages_apps_Launcher3 by crdroidandroid.

the class QuickstepInteractionHandler method onInteraction.

@SuppressWarnings("NewApi")
@Override
public boolean onInteraction(View view, PendingIntent pendingIntent, RemoteViews.RemoteResponse remoteResponse) {
    LauncherAppWidgetHostView hostView = findHostViewAncestor(view);
    if (hostView == null) {
        Log.e(TAG, "View did not have a LauncherAppWidgetHostView ancestor.");
        return RemoteViews.startPendingIntent(hostView, pendingIntent, remoteResponse.getLaunchOptions(view));
    }
    Pair<Intent, ActivityOptions> options = remoteResponse.getLaunchOptions(view);
    ActivityOptionsWrapper activityOptions = mLauncher.getAppTransitionManager().getActivityLaunchOptions(hostView);
    if (Utilities.ATLEAST_S && !pendingIntent.isActivity()) {
        // use the Quickstep transition animation.
        try {
            ActivityTaskManager.getService().registerRemoteAnimationForNextActivityStart(pendingIntent.getCreatorPackage(), activityOptions.options.getRemoteAnimationAdapter());
        } catch (RemoteException e) {
        // Do nothing.
        }
    }
    activityOptions.options.setPendingIntentLaunchFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    activityOptions.options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_EMPTY);
    Object itemInfo = hostView.getTag();
    if (itemInfo instanceof ItemInfo) {
        mLauncher.addLaunchCookie((ItemInfo) itemInfo, activityOptions.options);
    }
    options = Pair.create(options.first, activityOptions.options);
    if (pendingIntent.isActivity()) {
        logAppLaunch(itemInfo);
    }
    return RemoteViews.startPendingIntent(hostView, pendingIntent, options);
}
Also used : ItemInfo(com.android.launcher3.model.data.ItemInfo) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) RemoteException(android.os.RemoteException) ActivityOptions(android.app.ActivityOptions)

Example 4 with ActivityOptionsWrapper

use of com.android.launcher3.util.ActivityOptionsWrapper in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaskView method launchTaskAnimated.

/**
 * Starts the task associated with this view and animates the startup.
 * @return CompletionStage to indicate the animation completion or null if the launch failed.
 */
public RunnableList launchTaskAnimated() {
    if (mTask != null) {
        TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "startActivityFromRecentsAsync", mTask);
        ActivityOptionsWrapper opts = mActivity.getActivityLaunchOptions(this, null);
        if (ActivityManagerWrapper.getInstance().startActivityFromRecents(mTask.key, opts.options)) {
            if (ENABLE_QUICKSTEP_LIVE_TILE.get() && getRecentsView().getRunningTaskId() != -1) {
                // Return a fresh callback in the live tile case, so that it's not accidentally
                // triggered by QuickstepTransitionManager.AppLaunchAnimationRunner.
                RunnableList callbackList = new RunnableList();
                getRecentsView().addSideTaskLaunchCallback(callbackList);
                return callbackList;
            }
            return opts.onEndCallback;
        } else {
            notifyTaskLaunchFailed(TAG);
            return null;
        }
    } else {
        return null;
    }
}
Also used : ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) RunnableList(com.android.launcher3.util.RunnableList)

Example 5 with ActivityOptionsWrapper

use of com.android.launcher3.util.ActivityOptionsWrapper in project android_packages_apps_Launcher3 by crdroidandroid.

the class BaseQuickstepLauncher method getActivityLaunchOptions.

@Override
public ActivityOptionsWrapper getActivityLaunchOptions(View v, @Nullable ItemInfo item) {
    ActivityOptionsWrapper activityOptions = mAppTransitionManager.hasControlRemoteAppTransitionPermission() ? mAppTransitionManager.getActivityLaunchOptions(v) : super.getActivityLaunchOptions(v, item);
    if (mLastTouchUpTime > 0) {
        ActivityOptionsCompat.setLauncherSourceInfo(activityOptions.options, mLastTouchUpTime);
    }
    activityOptions.options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON);
    addLaunchCookie(item, activityOptions.options);
    return activityOptions;
}
Also used : ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper)

Aggregations

ActivityOptionsWrapper (com.android.launcher3.util.ActivityOptionsWrapper)6 RunnableList (com.android.launcher3.util.RunnableList)4 ActivityOptions (android.app.ActivityOptions)2 RemoteAnimationAdapterCompat (com.android.systemui.shared.system.RemoteAnimationAdapterCompat)2 AnimatorSet (android.animation.AnimatorSet)1 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 Point (android.graphics.Point)1 Rect (android.graphics.Rect)1 Drawable (android.graphics.drawable.Drawable)1 RemoteException (android.os.RemoteException)1 NonNull (androidx.annotation.NonNull)1 LauncherAnimationRunner (com.android.launcher3.LauncherAnimationRunner)1 AnimationResult (com.android.launcher3.LauncherAnimationRunner.AnimationResult)1 RemoteAnimationFactory (com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory)1 ItemInfo (com.android.launcher3.model.data.ItemInfo)1 LauncherAppWidgetHostView (com.android.launcher3.widget.LauncherAppWidgetHostView)1 TaskView (com.android.quickstep.views.TaskView)1 RemoteAnimationRunnerCompat (com.android.systemui.shared.system.RemoteAnimationRunnerCompat)1 RemoteAnimationTargetCompat (com.android.systemui.shared.system.RemoteAnimationTargetCompat)1