use of com.android.quickstep.views.LauncherRecentsView in project Neo-Launcher by NeoApplications.
the class LauncherActivityControllerHelper method prepareRecentsUI.
@Override
public AnimationFactory prepareRecentsUI(Launcher activity, boolean activityVisible, boolean animateActivity, Consumer<AnimatorPlaybackController> callback) {
final LauncherState startState = activity.getStateManager().getState();
LauncherState resetState = startState;
if (startState.disableRestore) {
resetState = activity.getStateManager().getRestState();
}
activity.getStateManager().setRestState(resetState);
final LauncherState fromState = animateActivity ? BACKGROUND_APP : OVERVIEW;
activity.getStateManager().goToState(fromState, false);
// Since all apps is not visible, we can safely reset the scroll position.
// This ensures then the next swipe up to all-apps starts from scroll 0.
activity.getAppsView().reset(false);
return new AnimationFactory() {
private final ShelfPeekAnim mShelfAnim = ((QuickstepAppTransitionManagerImpl) activity.getAppTransitionManager()).getShelfPeekAnim();
private boolean mIsAttachedToWindow;
@Override
public void createActivityController(long transitionLength) {
createActivityControllerInternal(activity, fromState, transitionLength, callback);
// attached state here as well to ensure recents is shown/hidden appropriately.
if (SysUINavigationMode.getMode(activity) == Mode.NO_BUTTON) {
setRecentsAttachedToAppWindow(mIsAttachedToWindow, false);
}
}
@Override
public void adjustActivityControllerInterpolators() {
if (mAdjustInterpolatorsRunnable != null) {
mAdjustInterpolatorsRunnable.run();
}
}
@Override
public void onTransitionCancelled() {
activity.getStateManager().goToState(startState, false);
}
@Override
public void setShelfState(ShelfAnimState shelfState, Interpolator interpolator, long duration) {
mShelfAnim.setShelfState(shelfState, interpolator, duration);
}
@Override
public void setRecentsAttachedToAppWindow(boolean attached, boolean animate) {
if (mIsAttachedToWindow == attached && animate) {
return;
}
mIsAttachedToWindow = attached;
LauncherRecentsView recentsView = activity.getOverviewPanel();
Animator fadeAnim = activity.getStateManager().createStateElementAnimation(INDEX_RECENTS_FADE_ANIM, attached ? 1 : 0);
int runningTaskIndex = recentsView.getRunningTaskIndex();
if (runningTaskIndex == recentsView.getTaskViewStartIndex()) {
// If we are on the first task (we haven't quick switched), translate recents in
// from the side. Calculate the start translation based on current scale/scroll.
float currScale = recentsView.getScaleX();
float scrollOffsetX = recentsView.getScrollOffset();
float offscreenX = recentsView.getOffscreenTranslationX(currScale);
float fromTranslationX = attached ? offscreenX - scrollOffsetX : 0;
float toTranslationX = attached ? 0 : offscreenX - scrollOffsetX;
activity.getStateManager().cancelStateElementAnimation(INDEX_RECENTS_TRANSLATE_X_ANIM);
if (!recentsView.isShown() && animate) {
recentsView.setTranslationX(fromTranslationX);
} else {
fromTranslationX = recentsView.getTranslationX();
}
if (!animate) {
recentsView.setTranslationX(toTranslationX);
} else {
activity.getStateManager().createStateElementAnimation(INDEX_RECENTS_TRANSLATE_X_ANIM, fromTranslationX, toTranslationX).start();
}
fadeAnim.setInterpolator(attached ? INSTANT : ACCEL_2);
} else {
fadeAnim.setInterpolator(ACCEL_DEACCEL);
}
fadeAnim.setDuration(animate ? RECENTS_ATTACH_DURATION : 0).start();
}
};
}
use of com.android.quickstep.views.LauncherRecentsView in project Neo-Launcher by NeoApplications.
the class NoButtonQuickSwitchTouchController method setupOverviewAnimators.
private void setupOverviewAnimators() {
final LauncherState fromState = QUICK_SWITCH;
final LauncherState toState = OVERVIEW;
LauncherState.ScaleAndTranslation fromScaleAndTranslation = fromState.getOverviewScaleAndTranslation(mLauncher);
LauncherState.ScaleAndTranslation toScaleAndTranslation = toState.getOverviewScaleAndTranslation(mLauncher);
// Update RecentView's translationX to have it start offscreen.
LauncherRecentsView recentsView = mLauncher.getOverviewPanel();
float startScale = Utilities.mapRange(SCALE_DOWN_INTERPOLATOR.getInterpolation(Y_ANIM_MIN_PROGRESS), fromScaleAndTranslation.scale, toScaleAndTranslation.scale);
fromScaleAndTranslation.translationX = recentsView.getOffscreenTranslationX(startScale);
// Set RecentView's initial properties.
recentsView.setScaleX(fromScaleAndTranslation.scale);
recentsView.setScaleY(fromScaleAndTranslation.scale);
recentsView.setTranslationX(fromScaleAndTranslation.translationX);
recentsView.setTranslationY(fromScaleAndTranslation.translationY);
recentsView.setContentAlpha(1);
// As we drag right, animate the following properties:
// - RecentsView translationX
// - OverviewScrim
AnimatorSet xOverviewAnim = new AnimatorSet();
xOverviewAnim.play(ObjectAnimator.ofFloat(recentsView, View.TRANSLATION_X, toScaleAndTranslation.translationX));
xOverviewAnim.play(ObjectAnimator.ofFloat(mLauncher.getDragLayer().getOverviewScrim(), OverviewScrim.SCRIM_PROGRESS, toState.getOverviewScrimAlpha(mLauncher)));
long xAccuracy = (long) (mXRange * 2);
xOverviewAnim.setDuration(xAccuracy);
mXOverviewAnim = AnimatorPlaybackController.wrap(xOverviewAnim, xAccuracy);
mXOverviewAnim.dispatchOnStart();
// As we drag up, animate the following properties:
// - RecentsView translationY
// - RecentsView scale
// - RecentsView fullscreenProgress
AnimatorSet yAnimation = new AnimatorSet();
Animator translateYAnim = ObjectAnimator.ofFloat(recentsView, View.TRANSLATION_Y, toScaleAndTranslation.translationY);
Animator scaleAnim = ObjectAnimator.ofFloat(recentsView, SCALE_PROPERTY, toScaleAndTranslation.scale);
Animator fullscreenProgressAnim = ObjectAnimator.ofFloat(recentsView, FULLSCREEN_PROGRESS, fromState.getOverviewFullscreenProgress(), toState.getOverviewFullscreenProgress());
scaleAnim.setInterpolator(SCALE_DOWN_INTERPOLATOR);
fullscreenProgressAnim.setInterpolator(SCALE_DOWN_INTERPOLATOR);
yAnimation.play(translateYAnim);
yAnimation.play(scaleAnim);
yAnimation.play(fullscreenProgressAnim);
long yAccuracy = (long) (mYRange * 2);
yAnimation.setDuration(yAccuracy);
mYOverviewAnim = AnimatorPlaybackController.wrap(yAnimation, yAccuracy);
mYOverviewAnim.dispatchOnStart();
}
Aggregations