use of com.android.launcher3.LauncherState.ALL_APPS in project android_packages_apps_Trebuchet by LineageOS.
the class NavBarToHomeTouchController method initCurrentAnimation.
private void initCurrentAnimation() {
long accuracy = (long) (getShiftRange() * 2);
final PendingAnimation builder = new PendingAnimation(accuracy);
if (mStartState.overviewUi) {
RecentsView recentsView = mLauncher.getOverviewPanel();
AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher, builder);
builder.setFloat(mLauncher.getDragLayer().getOverviewScrim(), OverviewScrim.SCRIM_MULTIPLIER, OVERVIEW_TO_HOME_SCRIM_MULTIPLIER, PULLBACK_INTERPOLATOR);
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
builder.addOnFrameCallback(() -> recentsView.redrawLiveTile(false));
}
} else if (mStartState == ALL_APPS) {
AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
builder.setFloat(allAppsController, ALL_APPS_PROGRESS, -mPullbackDistance / allAppsController.getShiftRange(), PULLBACK_INTERPOLATOR);
// Slightly fade out all apps content to further distinguish from scrolling.
StateAnimationConfig config = new StateAnimationConfig();
config.duration = accuracy;
config.setInterpolator(StateAnimationConfig.ANIM_ALL_APPS_FADE, Interpolators.mapToProgress(PULLBACK_INTERPOLATOR, 0, 0.5f));
allAppsController.setAlphas(mEndState, config, builder);
}
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mLauncher);
if (topView != null) {
topView.addHintCloseAnim(mPullbackDistance, PULLBACK_INTERPOLATOR, builder);
}
mCurrentAnimation = builder.createPlaybackController().setOnCancelRunnable(this::clearState);
}
use of com.android.launcher3.LauncherState.ALL_APPS in project android_packages_apps_Trebuchet by LineageOS.
the class AllAppsTipView method showAllAppsTipIfNecessary.
private static boolean showAllAppsTipIfNecessary(Launcher launcher) {
FloatingHeaderView floatingHeaderView = launcher.getAppsView().getFloatingHeaderView();
if (!floatingHeaderView.hasVisibleContent() || AbstractFloatingView.getOpenView(launcher, TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE) != null || !launcher.isInState(ALL_APPS) || hasSeenAllAppsTip(launcher) || launcher.getSystemService(UserManager.class).isDemoUser() || Utilities.IS_RUNNING_IN_TEST_HARNESS) {
return false;
}
int[] coords = new int[2];
floatingHeaderView.findFixedRowByType(PredictionRowView.class).getLocationOnScreen(coords);
ArrowTipView arrowTipView = new ArrowTipView(launcher).setOnClosedCallback(() -> {
launcher.getSharedPrefs().edit().putBoolean(ALL_APPS_TIP_SEEN, true).apply();
launcher.getUserEventDispatcher().logActionTip(LauncherEventUtil.DISMISS, ALL_APPS_PREDICTION_TIPS);
});
arrowTipView.show(launcher.getString(R.string.all_apps_prediction_tip), coords[1]);
return true;
}
use of com.android.launcher3.LauncherState.ALL_APPS in project Neo-Launcher by NeoApplications.
the class NavBarToHomeTouchController method initCurrentAnimation.
private void initCurrentAnimation() {
long accuracy = (long) (getShiftRange() * 2);
final AnimatorSet anim = new AnimatorSet();
if (mStartState == OVERVIEW) {
RecentsView recentsView = mLauncher.getOverviewPanel();
float pullbackDist = mPullbackDistance;
if (!recentsView.isRtl()) {
pullbackDist = -pullbackDist;
}
Animator pullback = ObjectAnimator.ofFloat(recentsView, TRANSLATION_X, pullbackDist);
pullback.setInterpolator(PULLBACK_INTERPOLATOR);
anim.play(pullback);
} else if (mStartState == ALL_APPS) {
AnimatorSetBuilder builder = new AnimatorSetBuilder();
AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
Animator allAppsProgress = ObjectAnimator.ofFloat(allAppsController, ALL_APPS_PROGRESS, -mPullbackDistance / allAppsController.getShiftRange());
allAppsProgress.setInterpolator(PULLBACK_INTERPOLATOR);
builder.play(allAppsProgress);
// Slightly fade out all apps content to further distinguish from scrolling.
builder.setInterpolator(AnimatorSetBuilder.ANIM_ALL_APPS_FADE, Interpolators.mapToProgress(PULLBACK_INTERPOLATOR, 0, 0.5f));
AnimationConfig config = new AnimationConfig();
config.duration = accuracy;
allAppsController.setAlphas(mEndState.getVisibleElements(mLauncher), config, builder);
anim.play(builder.build());
}
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mLauncher);
if (topView != null) {
Animator hintCloseAnim = topView.createHintCloseAnim(mPullbackDistance);
if (hintCloseAnim != null) {
hintCloseAnim.setInterpolator(PULLBACK_INTERPOLATOR);
anim.play(hintCloseAnim);
}
}
anim.setDuration(accuracy);
mCurrentAnimation = AnimatorPlaybackController.wrap(anim, accuracy, this::clearState);
}
use of com.android.launcher3.LauncherState.ALL_APPS in project Neo-Launcher by NeoApplications.
the class QuickstepAppTransitionManagerImpl method getLauncherContentAnimator.
/**
* Content is everything on screen except the background and the floating view (if any).
*
* @param isAppOpening True when this is called when an app is opening.
* False when this is called when an app is closing.
* @param trans Array that contains the start and end translation values for the content.
*/
protected Pair<AnimatorSet, Runnable> getLauncherContentAnimator(boolean isAppOpening, float[] trans) {
AnimatorSet launcherAnimator = new AnimatorSet();
Runnable endListener;
float[] alphas = isAppOpening ? new float[] { 1, 0 } : new float[] { 0, 1 };
if (mLauncher.isInState(ALL_APPS)) {
// All Apps in portrait mode is full screen, so we only animate AllAppsContainerView.
final View appsView = mLauncher.getAppsView();
final float startAlpha = appsView.getAlpha();
final float startY = appsView.getTranslationY();
appsView.setAlpha(alphas[0]);
appsView.setTranslationY(trans[0]);
ObjectAnimator alpha = ObjectAnimator.ofFloat(appsView, View.ALPHA, alphas);
alpha.setDuration(CONTENT_ALPHA_DURATION);
alpha.setInterpolator(LINEAR);
appsView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
alpha.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
appsView.setLayerType(View.LAYER_TYPE_NONE, null);
}
});
ObjectAnimator transY = ObjectAnimator.ofFloat(appsView, View.TRANSLATION_Y, trans);
transY.setInterpolator(AGGRESSIVE_EASE);
transY.setDuration(CONTENT_TRANSLATION_DURATION);
launcherAnimator.play(alpha);
launcherAnimator.play(transY);
endListener = () -> {
appsView.setAlpha(startAlpha);
appsView.setTranslationY(startY);
appsView.setLayerType(View.LAYER_TYPE_NONE, null);
};
} else if (mLauncher.isInState(OVERVIEW)) {
AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
launcherAnimator.play(ObjectAnimator.ofFloat(allAppsController, ALL_APPS_PROGRESS, allAppsController.getProgress(), ALL_APPS_PROGRESS_OFF_SCREEN));
endListener = composeViewContentAnimator(launcherAnimator, alphas, trans);
} else {
mDragLayerAlpha.setValue(alphas[0]);
ObjectAnimator alpha = ObjectAnimator.ofFloat(mDragLayerAlpha, MultiValueAlpha.VALUE, alphas);
alpha.setDuration(CONTENT_ALPHA_DURATION);
alpha.setInterpolator(LINEAR);
launcherAnimator.play(alpha);
mDragLayer.setTranslationY(trans[0]);
ObjectAnimator transY = ObjectAnimator.ofFloat(mDragLayer, View.TRANSLATION_Y, trans);
transY.setInterpolator(AGGRESSIVE_EASE);
transY.setDuration(CONTENT_TRANSLATION_DURATION);
launcherAnimator.play(transY);
mDragLayer.getScrim().hideSysUiScrim(true);
// Pause page indicator animations as they lead to layer trashing.
mLauncher.getWorkspace().getPageIndicator().pauseAnimations();
mDragLayer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
endListener = this::resetContentView;
}
return new Pair<>(launcherAnimator, endListener);
}
use of com.android.launcher3.LauncherState.ALL_APPS in project Neo-Launcher by NeoApplications.
the class AbstractLauncherUiTest method checkLauncherIntegrity.
private static void checkLauncherIntegrity(Launcher launcher, ContainerType expectedContainerType) {
if (launcher != null) {
final LauncherStateManager stateManager = launcher.getStateManager();
final LauncherState stableState = stateManager.getCurrentStableState();
assertTrue("Stable state != state: " + stableState.getClass().getSimpleName() + ", " + stateManager.getState().getClass().getSimpleName(), stableState == stateManager.getState());
final boolean isResumed = launcher.hasBeenResumed();
assertTrue("hasBeenResumed() != isStarted(), hasBeenResumed(): " + isResumed, isResumed == launcher.isStarted());
assertTrue("hasBeenResumed() != isUserActive(), hasBeenResumed(): " + isResumed, isResumed == launcher.isUserActive());
final int ordinal = stableState.ordinal;
switch(expectedContainerType) {
case WORKSPACE:
case WIDGETS:
{
assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.NORMAL_STATE_ORDINAL);
break;
}
case ALL_APPS:
{
assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.ALL_APPS_STATE_ORDINAL);
break;
}
case OVERVIEW:
{
assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.OVERVIEW_STATE_ORDINAL);
break;
}
case BACKGROUND:
{
assertTrue("Launcher is resumed in state: " + expectedContainerType, !isResumed);
assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.NORMAL_STATE_ORDINAL);
break;
}
default:
throw new IllegalArgumentException("Illegal container: " + expectedContainerType);
}
} else {
assertTrue("Container type is not BACKGROUND or FALLBACK_OVERVIEW: " + expectedContainerType, expectedContainerType == ContainerType.BACKGROUND || expectedContainerType == ContainerType.FALLBACK_OVERVIEW);
}
}
Aggregations