use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_Launcher3 by crdroidandroid.
the class PortraitStatesTouchController method getAllAppsToNormalAnimation.
private StateAnimationConfig getAllAppsToNormalAnimation() {
StateAnimationConfig builder = new StateAnimationConfig();
builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(DEACCEL, 1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD, 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL, 1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD, 1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
return builder;
}
use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_Launcher3 by crdroidandroid.
the class PortraitStatesTouchController method getNormalToAllAppsAnimation.
private StateAnimationConfig getNormalToAllAppsAnimation() {
StateAnimationConfig builder = new StateAnimationConfig();
builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(ACCEL, ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD, ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(ACCEL, ALL_APPS_SCRIM_VISIBLE_THRESHOLD, ALL_APPS_SCRIM_OPAQUE_THRESHOLD));
return builder;
}
use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_Launcher3 by crdroidandroid.
the class PortraitStatesTouchController method initCurrentAnimation.
@Override
protected float initCurrentAnimation() {
float range = getShiftRange();
long maxAccuracy = (long) (2 * range);
float startVerticalShift = mFromState.getVerticalProgress(mLauncher) * range;
float endVerticalShift = mToState.getVerticalProgress(mLauncher) * range;
float totalShift = endVerticalShift - startVerticalShift;
final StateAnimationConfig config = totalShift == 0 ? new StateAnimationConfig() : getConfigForStates(mFromState, mToState);
config.duration = maxAccuracy;
if (mCurrentAnimation != null) {
mCurrentAnimation.getTarget().removeListener(mClearStateOnCancelListener);
mCurrentAnimation.dispatchOnCancel();
}
mGoingBetweenStates = true;
if (mFromState == OVERVIEW && mToState == NORMAL && mOverviewPortraitStateTouchHelper.shouldSwipeDownReturnToApp()) {
// Reset the state manager, when changing the interaction mode
mLauncher.getStateManager().goToState(OVERVIEW, false);
mGoingBetweenStates = false;
mCurrentAnimation = mOverviewPortraitStateTouchHelper.createSwipeDownToTaskAppAnimation(maxAccuracy, Interpolators.LINEAR).createPlaybackController();
mLauncher.getStateManager().setCurrentUserControlledAnimation(mCurrentAnimation);
RecentsView recentsView = mLauncher.getOverviewPanel();
totalShift = LayoutUtils.getShelfTrackingDistance(mLauncher, mLauncher.getDeviceProfile(), recentsView.getPagedOrientationHandler());
} else {
mCurrentAnimation = mLauncher.getStateManager().createAnimationToNewWorkspace(mToState, config);
}
mCurrentAnimation.getTarget().addListener(mClearStateOnCancelListener);
if (totalShift == 0) {
totalShift = Math.signum(mFromState.ordinal - mToState.ordinal) * OverviewState.getDefaultSwipeHeight(mLauncher);
}
return 1 / totalShift;
}
use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_Launcher3 by crdroidandroid.
the class QuickSwitchTouchController method initCurrentAnimation.
@Override
protected float initCurrentAnimation() {
StateAnimationConfig config = new StateAnimationConfig();
setupInterpolators(config);
config.duration = (long) (getShiftRange() * 2);
// Set RecentView's initial properties for coming in from the side.
RECENTS_SCALE_PROPERTY.set(mOverviewPanel, QUICK_SWITCH.getOverviewScaleAndOffset(mLauncher)[0] * 0.85f);
ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mOverviewPanel, 1f);
mOverviewPanel.setContentAlpha(1);
mCurrentAnimation = mLauncher.getStateManager().createAnimationToNewWorkspace(mToState, config);
mCurrentAnimation.getTarget().addListener(mClearStateOnCancelListener);
mCurrentAnimation.getAnimationPlayer().addUpdateListener(valueAnimator -> updateFullscreenProgress((Float) valueAnimator.getAnimatedValue()));
return 1 / getShiftRange();
}
use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_Launcher3 by crdroidandroid.
the class LauncherTaskbarUIController method createAnimToLauncher.
/**
* Create Taskbar animation when going from an app to Launcher.
* @param toState If known, the state we will end up in when reaching Launcher.
*/
public Animator createAnimToLauncher(@Nullable LauncherState toState, long duration) {
PendingAnimation anim = new PendingAnimation(duration);
anim.add(mTaskbarAnimationController.createAnimToBackgroundAlpha(0, duration));
if (toState != null) {
mTaskbarStateHandler.setStateWithAnimation(toState, new StateAnimationConfig(), anim);
}
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mIsAnimatingToLauncher = true;
mTaskbarView.setHolesAllowedInLayout(true);
mTaskbarView.updateHotseatItemsVisibility();
}
@Override
public void onAnimationEnd(Animator animation) {
mIsAnimatingToLauncher = false;
setTaskbarViewVisible(false);
}
});
return anim.buildAnim();
}
Aggregations