use of com.android.quickstep.util.OverviewToHomeAnim in project android_packages_apps_Launcher3 by crdroidandroid.
the class NavBarToHomeTouchController method onDragEnd.
@Override
public void onDragEnd(float velocity) {
boolean fling = mSwipeDetector.isFling(velocity);
float progress = mCurrentAnimation.getProgressFraction();
float interpolatedProgress = PULLBACK_INTERPOLATOR.getInterpolation(progress);
boolean success = interpolatedProgress >= SUCCESS_TRANSITION_PROGRESS || (velocity < 0 && fling);
if (success) {
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
RecentsView recentsView = mLauncher.getOverviewPanel();
recentsView.switchToScreenshot(null, () -> recentsView.finishRecentsAnimation(true, /* toRecents */
null));
}
if (mStartState.overviewUi) {
new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(mEndState)).animateWithVelocity(velocity);
} else {
mLauncher.getStateManager().goToState(mEndState, true, forSuccessCallback(() -> onSwipeInteractionCompleted(mEndState)));
}
if (mStartState != mEndState) {
logHomeGesture();
}
AbstractFloatingView topOpenView = AbstractFloatingView.getTopOpenView(mLauncher);
if (topOpenView != null) {
AbstractFloatingView.closeAllOpenViews(mLauncher);
// TODO: add to WW log
}
TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
} else {
// Quickly return to the state we came from (we didn't move far).
ValueAnimator anim = mCurrentAnimation.getAnimationPlayer();
anim.setFloatValues(progress, 0);
anim.addListener(forSuccessCallback(() -> onSwipeInteractionCompleted(mStartState)));
anim.setDuration(80).start();
}
}
use of com.android.quickstep.util.OverviewToHomeAnim in project android_packages_apps_Launcher3 by crdroidandroid.
the class NoButtonNavbarToOverviewTouchController method goToOverviewOrHomeOnDragEnd.
private void goToOverviewOrHomeOnDragEnd(float velocity) {
boolean goToHomeInsteadOfOverview = !mMotionPauseDetector.isPaused();
if (goToHomeInsteadOfOverview) {
new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(NORMAL)).animateWithVelocity(velocity);
}
if (mReachedOverview) {
float distanceDp = dpiFromPx(Math.max(Math.abs(mRecentsView.getTranslationX()), Math.abs(mRecentsView.getTranslationY())));
long duration = (long) Math.max(TRANSLATION_ANIM_MIN_DURATION_MS, distanceDp / TRANSLATION_ANIM_VELOCITY_DP_PER_MS);
mRecentsView.animate().translationX(0).translationY(0).setInterpolator(ACCEL_DEACCEL).setDuration(duration).withEndAction(goToHomeInsteadOfOverview ? null : this::maybeSwipeInteractionToOverviewComplete);
if (!goToHomeInsteadOfOverview) {
// Return to normal properties for the overview state.
StateAnimationConfig config = new StateAnimationConfig();
config.duration = duration;
LauncherState state = mLauncher.getStateManager().getState();
mLauncher.getStateManager().createAtomicAnimation(state, state, config).start();
}
}
}
Aggregations