use of com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION 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);
}
use of com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION 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;
}
use of com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION in project android_packages_apps_Launcher3 by crdroidandroid.
the class TaskViewUtils method composeRecentsSplitLaunchAnimatorLegacy.
/**
* Legacy version (until shell transitions are enabled)
*/
public static void composeRecentsSplitLaunchAnimatorLegacy(@NonNull AnimatorSet anim, @NonNull TaskView v, @NonNull RemoteAnimationTargetCompat[] appTargets, @NonNull RemoteAnimationTargetCompat[] wallpaperTargets, @NonNull RemoteAnimationTargetCompat[] nonAppTargets, boolean launcherClosing, @NonNull StateManager stateManager, @NonNull DepthController depthController, int targetStage) {
PendingAnimation out = new PendingAnimation(RECENTS_LAUNCH_DURATION);
boolean isRunningTask = v.isRunningTask();
TransformParams params = null;
TaskViewSimulator tvs = null;
RecentsView recentsView = v.getRecentsView();
if (ENABLE_QUICKSTEP_LIVE_TILE.get() && isRunningTask) {
params = recentsView.getLiveTileParams();
tvs = recentsView.getLiveTileTaskViewSimulator();
}
boolean inLiveTileMode = ENABLE_QUICKSTEP_LIVE_TILE.get() && recentsView.getRunningTaskIndex() != -1;
final RemoteAnimationTargets targets = new RemoteAnimationTargets(appTargets, wallpaperTargets, nonAppTargets, inLiveTileMode ? MODE_CLOSING : MODE_OPENING);
if (params == null) {
SurfaceTransactionApplier applier = new SurfaceTransactionApplier(v);
targets.addReleaseCheck(applier);
params = new TransformParams().setSyncTransactionApplier(applier).setTargetSet(targets);
}
Rect crop = new Rect();
Context context = v.getContext();
DeviceProfile dp = BaseActivity.fromContext(context).getDeviceProfile();
if (tvs == null && targets.apps.length > 0) {
tvs = new TaskViewSimulator(recentsView.getContext(), recentsView.getSizeStrategy());
tvs.setDp(dp);
// RecentsView never updates the display rotation until swipe-up so the value may
// be stale. Use the display value instead.
int displayRotation = DisplayController.INSTANCE.get(recentsView.getContext()).getInfo().rotation;
tvs.getOrientationState().update(displayRotation, displayRotation);
tvs.setPreview(targets.apps[targets.apps.length - 1]);
tvs.fullScreenProgress.value = 0;
tvs.recentsViewScale.value = 1;
// tvs.setScroll(startScroll);
// Fade in the task during the initial 20% of the animation
out.addFloat(params, TransformParams.TARGET_ALPHA, 0, 1, clampToProgress(LINEAR, 0, 0.2f));
}
TaskViewSimulator topMostSimulator = null;
if (tvs != null) {
out.setFloat(tvs.fullScreenProgress, AnimatedFloat.VALUE, 1, TOUCH_RESPONSE_INTERPOLATOR);
out.setFloat(tvs.recentsViewScale, AnimatedFloat.VALUE, tvs.getFullScreenScale(), TOUCH_RESPONSE_INTERPOLATOR);
out.setFloat(tvs.recentsViewScroll, AnimatedFloat.VALUE, 0, TOUCH_RESPONSE_INTERPOLATOR);
TaskViewSimulator finalTsv = tvs;
TransformParams finalParams = params;
out.addOnFrameCallback(() -> finalTsv.apply(finalParams));
topMostSimulator = tvs;
}
anim.play(out.buildAnim());
}
use of com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION in project android_packages_apps_Launcher3 by crdroidandroid.
the class TaskViewUtils method composeRecentsLaunchAnimator.
public static void composeRecentsLaunchAnimator(@NonNull AnimatorSet anim, @NonNull View v, @NonNull RemoteAnimationTargetCompat[] appTargets, @NonNull RemoteAnimationTargetCompat[] wallpaperTargets, @NonNull RemoteAnimationTargetCompat[] nonAppTargets, boolean launcherClosing, @NonNull StateManager stateManager, @NonNull RecentsView recentsView, @NonNull DepthController depthController) {
boolean skipLauncherChanges = !launcherClosing;
TaskView taskView = findTaskViewToLaunch(recentsView, v, appTargets);
PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION);
createRecentsWindowAnimator(taskView, skipLauncherChanges, appTargets, wallpaperTargets, nonAppTargets, depthController, pa);
Animator childStateAnimation = null;
// Found a visible recents task that matches the opening app, lets launch the app from there
Animator launcherAnim;
final AnimatorListenerAdapter windowAnimEndListener;
if (launcherClosing) {
Context context = v.getContext();
DeviceProfile dp = BaseActivity.fromContext(context).getDeviceProfile();
launcherAnim = dp.isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get() ? ObjectAnimator.ofFloat(recentsView, RecentsView.CONTENT_ALPHA, 0) : recentsView.createAdjacentPageAnimForTaskLaunch(taskView);
launcherAnim.setInterpolator(Interpolators.TOUCH_RESPONSE_INTERPOLATOR);
launcherAnim.setDuration(RECENTS_LAUNCH_DURATION);
// Make sure recents gets fixed up by resetting task alphas and scales, etc.
windowAnimEndListener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
recentsView.finishRecentsAnimation(false, /* toRecents */
() -> {
recentsView.post(() -> {
stateManager.moveToRestState();
stateManager.reapplyState();
});
});
}
};
} else {
AnimatorPlaybackController controller = stateManager.createAnimationToNewWorkspace(NORMAL, RECENTS_LAUNCH_DURATION);
controller.dispatchOnStart();
childStateAnimation = controller.getTarget();
launcherAnim = controller.getAnimationPlayer().setDuration(RECENTS_LAUNCH_DURATION);
windowAnimEndListener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
recentsView.finishRecentsAnimation(false, /* toRecents */
() -> stateManager.goToState(NORMAL, false));
}
};
}
pa.add(launcherAnim);
if (ENABLE_QUICKSTEP_LIVE_TILE.get() && recentsView.getRunningTaskIndex() != -1) {
pa.addOnFrameCallback(recentsView::redrawLiveTile);
}
anim.play(pa.buildAnim());
// Set the current animation first, before adding windowAnimEndListener. Setting current
// animation adds some listeners which need to be called before windowAnimEndListener
// (the ordering of listeners matter in this case).
stateManager.setCurrentAnimation(anim, childStateAnimation);
anim.addListener(windowAnimEndListener);
}
use of com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION in project android_packages_apps_Launcher3 by AOSPA.
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, mLauncher.getIApplicationThread());
return new ActivityOptionsWrapper(ActivityOptionsCompat.makeRemoteAnimation(adapterCompat), onEndCallback);
}
Aggregations