Merge "[AllApps] NORMAL <-> ALL_APPS motion clean fixes for AOSP" into sc-v2-dev
This commit is contained in:
commit
0f4e4856a2
3 files changed
+35
-8
No files matched your search
@@ -714,6 +714,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawOnScrim(Canvas canvas) {
|
public void drawOnScrim(Canvas canvas) {
|
||||||
|
if (!mHeader.isHeaderProtectionSupported()) return;
|
||||||
mHeaderPaint.setColor(mHeaderColor);
|
mHeaderPaint.setColor(mHeaderColor);
|
||||||
mHeaderPaint.setAlpha((int) (getAlpha() * Color.alpha(mHeaderColor)));
|
mHeaderPaint.setAlpha((int) (getAlpha() * Color.alpha(mHeaderColor)));
|
||||||
if (mHeaderPaint.getColor() != mScrimColor && mHeaderPaint.getColor() != 0) {
|
if (mHeaderPaint.getColor() != mScrimColor && mHeaderPaint.getColor() != 0) {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import com.android.launcher3.Launcher;
|
|||||||
import com.android.launcher3.LauncherState;
|
import com.android.launcher3.LauncherState;
|
||||||
import com.android.launcher3.Utilities;
|
import com.android.launcher3.Utilities;
|
||||||
import com.android.launcher3.anim.AnimatorListeners;
|
import com.android.launcher3.anim.AnimatorListeners;
|
||||||
import com.android.launcher3.anim.Interpolators;
|
|
||||||
import com.android.launcher3.anim.PendingAnimation;
|
import com.android.launcher3.anim.PendingAnimation;
|
||||||
import com.android.launcher3.anim.PropertySetter;
|
import com.android.launcher3.anim.PropertySetter;
|
||||||
import com.android.launcher3.config.FeatureFlags;
|
import com.android.launcher3.config.FeatureFlags;
|
||||||
@@ -61,7 +60,6 @@ public class AllAppsTransitionController
|
|||||||
implements StateHandler<LauncherState>, OnDeviceProfileChangeListener {
|
implements StateHandler<LauncherState>, OnDeviceProfileChangeListener {
|
||||||
// This constant should match the second derivative of the animator interpolator.
|
// This constant should match the second derivative of the animator interpolator.
|
||||||
public static final float INTERP_COEFF = 1.7f;
|
public static final float INTERP_COEFF = 1.7f;
|
||||||
private static final float CONTENT_VISIBLE_MAX_THRESHOLD = 0.5f;
|
|
||||||
|
|
||||||
public static final FloatProperty<AllAppsTransitionController> ALL_APPS_PROGRESS =
|
public static final FloatProperty<AllAppsTransitionController> ALL_APPS_PROGRESS =
|
||||||
new FloatProperty<AllAppsTransitionController>("allAppsProgress") {
|
new FloatProperty<AllAppsTransitionController>("allAppsProgress") {
|
||||||
@@ -188,8 +186,7 @@ public class AllAppsTransitionController
|
|||||||
int visibleElements = state.getVisibleElements(mLauncher);
|
int visibleElements = state.getVisibleElements(mLauncher);
|
||||||
boolean hasAllAppsContent = (visibleElements & ALL_APPS_CONTENT) != 0;
|
boolean hasAllAppsContent = (visibleElements & ALL_APPS_CONTENT) != 0;
|
||||||
|
|
||||||
Interpolator allAppsFade = config.getInterpolator(ANIM_ALL_APPS_FADE,
|
Interpolator allAppsFade = config.getInterpolator(ANIM_ALL_APPS_FADE, LINEAR);
|
||||||
Interpolators.clampToProgress(LINEAR, 0, CONTENT_VISIBLE_MAX_THRESHOLD));
|
|
||||||
setter.setViewAlpha(mAppsView, hasAllAppsContent ? 1 : 0, allAppsFade);
|
setter.setViewAlpha(mAppsView, hasAllAppsContent ? 1 : 0, allAppsFade);
|
||||||
|
|
||||||
boolean shouldProtectHeader =
|
boolean shouldProtectHeader =
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/*
|
||||||
* Copyright (C) 2019 The Android Open Source Project
|
* Copyright (C) 2015 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -17,18 +17,31 @@ package com.android.launcher3.touch;
|
|||||||
|
|
||||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||||
import static com.android.launcher3.LauncherState.NORMAL;
|
import static com.android.launcher3.LauncherState.NORMAL;
|
||||||
|
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||||
|
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
|
||||||
|
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
|
||||||
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
import com.android.launcher3.AbstractFloatingView;
|
import com.android.launcher3.AbstractFloatingView;
|
||||||
import com.android.launcher3.Launcher;
|
import com.android.launcher3.Launcher;
|
||||||
import com.android.launcher3.LauncherState;
|
import com.android.launcher3.LauncherState;
|
||||||
|
import com.android.launcher3.anim.Interpolators;
|
||||||
|
import com.android.launcher3.states.StateAnimationConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TouchController to switch between NORMAL and ALL_APPS state.
|
* TouchController to switch between NORMAL and ALL_APPS state.
|
||||||
*/
|
*/
|
||||||
public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||||
|
|
||||||
|
private static final float ALLAPPS_STAGGERED_FADE_THRESHOLD = 0.5f;
|
||||||
|
|
||||||
|
public static final Interpolator ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER =
|
||||||
|
Interpolators.clampToProgress(LINEAR, 0, ALLAPPS_STAGGERED_FADE_THRESHOLD);
|
||||||
|
public static final Interpolator ALLAPPS_STAGGERED_FADE_LATE_RESPONDER =
|
||||||
|
Interpolators.clampToProgress(LINEAR, ALLAPPS_STAGGERED_FADE_THRESHOLD, 1f);
|
||||||
|
|
||||||
public AllAppsSwipeController(Launcher l) {
|
public AllAppsSwipeController(Launcher l) {
|
||||||
super(l, SingleAxisSwipeDetector.VERTICAL);
|
super(l, SingleAxisSwipeDetector.VERTICAL);
|
||||||
}
|
}
|
||||||
@@ -65,12 +78,28 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
|||||||
@Override
|
@Override
|
||||||
protected float initCurrentAnimation() {
|
protected float initCurrentAnimation() {
|
||||||
float range = getShiftRange();
|
float range = getShiftRange();
|
||||||
long maxAccuracy = (long) (2 * range);
|
StateAnimationConfig config = getConfigForStates(mFromState, mToState);
|
||||||
|
config.duration = (long) (2 * range);
|
||||||
|
|
||||||
mCurrentAnimation = mLauncher.getStateManager()
|
mCurrentAnimation = mLauncher.getStateManager()
|
||||||
.createAnimationToNewWorkspace(mToState, maxAccuracy);
|
.createAnimationToNewWorkspace(mToState, config);
|
||||||
float startVerticalShift = mFromState.getVerticalProgress(mLauncher) * range;
|
float startVerticalShift = mFromState.getVerticalProgress(mLauncher) * range;
|
||||||
float endVerticalShift = mToState.getVerticalProgress(mLauncher) * range;
|
float endVerticalShift = mToState.getVerticalProgress(mLauncher) * range;
|
||||||
float totalShift = endVerticalShift - startVerticalShift;
|
float totalShift = endVerticalShift - startVerticalShift;
|
||||||
return 1 / totalShift;
|
return 1 / totalShift;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected StateAnimationConfig getConfigForStates(LauncherState fromState,
|
||||||
|
LauncherState toState) {
|
||||||
|
StateAnimationConfig config = super.getConfigForStates(fromState, toState);
|
||||||
|
if (fromState == NORMAL && toState == ALL_APPS) {
|
||||||
|
config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER);
|
||||||
|
config.setInterpolator(ANIM_ALL_APPS_FADE, ALLAPPS_STAGGERED_FADE_LATE_RESPONDER);
|
||||||
|
} else if (fromState == ALL_APPS && toState == NORMAL) {
|
||||||
|
config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_LATE_RESPONDER);
|
||||||
|
config.setInterpolator(ANIM_ALL_APPS_FADE, ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER);
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user