use of com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE in project android_packages_apps_Launcher3 by crdroidandroid.
the class WorkspaceStateTransitionAnimation method applyChildState.
private void applyChildState(LauncherState state, CellLayout cl, int childIndex, PageAlphaProvider pageAlphaProvider, PropertySetter propertySetter, StateAnimationConfig config) {
float pageAlpha = pageAlphaProvider.getPageAlpha(childIndex);
float springLoadedProgress = (state instanceof SpringLoadedState) ? 1.0f : 0f;
propertySetter.setFloat(cl, CellLayout.SPRING_LOADED_PROGRESS, springLoadedProgress, ZOOM_OUT);
Interpolator fadeInterpolator = config.getInterpolator(ANIM_WORKSPACE_FADE, pageAlphaProvider.interpolator);
propertySetter.setFloat(cl.getShortcutsAndWidgets(), VIEW_ALPHA, pageAlpha, fadeInterpolator);
}
use of com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE in project android_packages_apps_Launcher3 by crdroidandroid.
the class WorkspaceStateTransitionAnimation method setWorkspaceProperty.
/**
* Starts a transition animation for the workspace.
*/
private void setWorkspaceProperty(LauncherState state, PropertySetter propertySetter, StateAnimationConfig config) {
ScaleAndTranslation scaleAndTranslation = state.getWorkspaceScaleAndTranslation(mLauncher);
ScaleAndTranslation hotseatScaleAndTranslation = state.getHotseatScaleAndTranslation(mLauncher);
mNewScale = scaleAndTranslation.scale;
PageAlphaProvider pageAlphaProvider = state.getWorkspacePageAlphaProvider(mLauncher);
final int childCount = mWorkspace.getChildCount();
for (int i = 0; i < childCount; i++) {
applyChildState(state, (CellLayout) mWorkspace.getChildAt(i), i, pageAlphaProvider, propertySetter, config);
}
int elements = state.getVisibleElements(mLauncher);
Interpolator fadeInterpolator = config.getInterpolator(ANIM_WORKSPACE_FADE, pageAlphaProvider.interpolator);
Hotseat hotseat = mWorkspace.getHotseat();
Interpolator scaleInterpolator = config.getInterpolator(ANIM_WORKSPACE_SCALE, ZOOM_OUT);
LauncherState fromState = mLauncher.getStateManager().getState();
boolean shouldSpring = propertySetter instanceof PendingAnimation && fromState == HINT_STATE && state == NORMAL;
if (shouldSpring) {
((PendingAnimation) propertySetter).add(getSpringScaleAnimator(mLauncher, mWorkspace, mNewScale));
} else {
propertySetter.setFloat(mWorkspace, SCALE_PROPERTY, mNewScale, scaleInterpolator);
}
mWorkspace.setPivotToScaleWithSelf(hotseat);
float hotseatScale = hotseatScaleAndTranslation.scale;
if (shouldSpring) {
PendingAnimation pa = (PendingAnimation) propertySetter;
pa.add(getSpringScaleAnimator(mLauncher, hotseat, hotseatScale));
} else {
Interpolator hotseatScaleInterpolator = config.getInterpolator(ANIM_HOTSEAT_SCALE, scaleInterpolator);
propertySetter.setFloat(hotseat, SCALE_PROPERTY, hotseatScale, hotseatScaleInterpolator);
}
float hotseatIconsAlpha = (elements & HOTSEAT_ICONS) != 0 ? 1 : 0;
propertySetter.setViewAlpha(hotseat, hotseatIconsAlpha, fadeInterpolator);
float workspacePageIndicatorAlpha = (elements & WORKSPACE_PAGE_INDICATOR) != 0 ? 1 : 0;
propertySetter.setViewAlpha(mLauncher.getWorkspace().getPageIndicator(), workspacePageIndicatorAlpha, fadeInterpolator);
Interpolator translationInterpolator = config.getInterpolator(ANIM_WORKSPACE_TRANSLATE, ZOOM_OUT);
propertySetter.setFloat(mWorkspace, VIEW_TRANSLATE_X, scaleAndTranslation.translationX, translationInterpolator);
propertySetter.setFloat(mWorkspace, VIEW_TRANSLATE_Y, scaleAndTranslation.translationY, translationInterpolator);
Interpolator hotseatTranslationInterpolator = config.getInterpolator(ANIM_HOTSEAT_TRANSLATE, translationInterpolator);
propertySetter.setFloat(hotseat, VIEW_TRANSLATE_Y, hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator);
propertySetter.setFloat(mWorkspace.getPageIndicator(), VIEW_TRANSLATE_Y, hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator);
if (!config.hasAnimationFlag(SKIP_SCRIM)) {
setScrim(propertySetter, state, config);
}
}
use of com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE in project android_packages_apps_Launcher3 by crdroidandroid.
the class QuickstepAtomicAnimationFactory method prepareForAtomicAnimation.
@Override
public void prepareForAtomicAnimation(LauncherState fromState, LauncherState toState, StateAnimationConfig config) {
RecentsView overview = mActivity.getOverviewPanel();
if (toState == NORMAL && fromState == OVERVIEW) {
config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(LINEAR, 0, 0.25f));
config.setInterpolator(ANIM_SCRIM_FADE, LINEAR);
config.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL);
config.setInterpolator(ANIM_WORKSPACE_FADE, ACCEL);
if (SysUINavigationMode.getMode(mActivity).hasGestures && overview.getTaskViewCount() > 0) {
// Overview is going offscreen, so keep it at its current scale and opacity.
config.setInterpolator(ANIM_OVERVIEW_SCALE, FINAL_FRAME);
config.setInterpolator(ANIM_OVERVIEW_FADE, FINAL_FRAME);
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, clampToProgress(FAST_OUT_SLOW_IN, 0, 0.75f));
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, FINAL_FRAME);
} else {
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL_DEACCEL);
config.setInterpolator(ANIM_OVERVIEW_SCALE, clampToProgress(ACCEL, 0, 0.9f));
config.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7);
}
// Scroll RecentsView to page 0 as it goes offscreen, if necessary.
int numPagesToScroll = overview.getNextPage() - DEFAULT_PAGE;
long scrollDuration = Math.min(MAX_PAGE_SCROLL_DURATION, numPagesToScroll * PER_PAGE_SCROLL_DURATION);
config.duration = Math.max(config.duration, scrollDuration);
overview.snapToPage(DEFAULT_PAGE, Math.toIntExact(config.duration));
Workspace workspace = mActivity.getWorkspace();
// Start from a higher workspace scale, but only if we're invisible so we don't jump.
boolean isWorkspaceVisible = workspace.getVisibility() == VISIBLE;
if (isWorkspaceVisible) {
CellLayout currentChild = (CellLayout) workspace.getChildAt(workspace.getCurrentPage());
isWorkspaceVisible = currentChild.getVisibility() == VISIBLE && currentChild.getShortcutsAndWidgets().getAlpha() > 0;
}
if (!isWorkspaceVisible) {
workspace.setScaleX(WORKSPACE_PREPARE_SCALE);
workspace.setScaleY(WORKSPACE_PREPARE_SCALE);
}
Hotseat hotseat = mActivity.getHotseat();
boolean isHotseatVisible = hotseat.getVisibility() == VISIBLE && hotseat.getAlpha() > 0;
if (!isHotseatVisible) {
hotseat.setScaleX(WORKSPACE_PREPARE_SCALE);
hotseat.setScaleY(WORKSPACE_PREPARE_SCALE);
}
} else if ((fromState == NORMAL || fromState == HINT_STATE || fromState == HINT_STATE_TWO_BUTTON) && toState == OVERVIEW) {
if (SysUINavigationMode.getMode(mActivity).hasGestures) {
config.setInterpolator(ANIM_WORKSPACE_SCALE, fromState == NORMAL ? ACCEL : OVERSHOOT_1_2);
config.setInterpolator(ANIM_WORKSPACE_TRANSLATE, ACCEL);
// Scrolling in tasks, so show straight away
if (overview.getTaskViewCount() > 0) {
config.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT);
} else {
config.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2);
}
} else {
config.setInterpolator(ANIM_WORKSPACE_SCALE, OVERSHOOT_1_2);
config.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2);
// Scale up the recents, if it is not coming from the side
if (overview.getVisibility() != VISIBLE || overview.getContentAlpha() == 0) {
RECENTS_SCALE_PROPERTY.set(overview, RECENTS_PREPARE_SCALE);
}
}
config.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2);
config.setInterpolator(ANIM_ALL_APPS_FADE, OVERSHOOT_1_2);
config.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2);
config.setInterpolator(ANIM_DEPTH, OVERSHOOT_1_2);
config.setInterpolator(ANIM_SCRIM_FADE, t -> {
// Animate at the same rate until reaching progress 1, and skip the overshoot.
return Math.min(1, OVERSHOOT_1_2.getInterpolation(t));
});
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_2);
config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, OVERSHOOT_1_2);
} else if (fromState == HINT_STATE && toState == NORMAL) {
config.setInterpolator(ANIM_DEPTH, DEACCEL_3);
if (mHintToNormalDuration == -1) {
ValueAnimator va = getSpringScaleAnimator(mActivity, mActivity.getWorkspace(), toState.getWorkspaceScaleAndTranslation(mActivity).scale);
mHintToNormalDuration = (int) va.getDuration();
}
config.duration = Math.max(config.duration, mHintToNormalDuration);
}
}
use of com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE in project android_packages_apps_Launcher3 by crdroidandroid.
the class NoButtonQuickSwitchTouchController method setupAnimators.
private void setupAnimators() {
// Animate the non-overview components (e.g. workspace, shelf) out of the way.
StateAnimationConfig nonOverviewBuilder = new StateAnimationConfig();
nonOverviewBuilder.setInterpolator(ANIM_WORKSPACE_FADE, FADE_OUT_INTERPOLATOR);
nonOverviewBuilder.setInterpolator(ANIM_ALL_APPS_FADE, FADE_OUT_INTERPOLATOR);
nonOverviewBuilder.setInterpolator(ANIM_WORKSPACE_SCALE, FADE_OUT_INTERPOLATOR);
nonOverviewBuilder.setInterpolator(ANIM_DEPTH, FADE_OUT_INTERPOLATOR);
nonOverviewBuilder.setInterpolator(ANIM_VERTICAL_PROGRESS, TRANSLATE_OUT_INTERPOLATOR);
updateNonOverviewAnim(QUICK_SWITCH, nonOverviewBuilder);
mNonOverviewAnim.dispatchOnStart();
if (mRecentsView.getTaskViewCount() == 0) {
mRecentsView.setOnEmptyMessageUpdatedListener(isEmpty -> {
if (!isEmpty && mSwipeDetector.isDraggingState()) {
// We have loaded tasks, update the animators to start at the correct scale etc.
setupOverviewAnimators();
}
});
}
setupOverviewAnimators();
}
Aggregations