am f16e5713: Making AllApps transition more cinematic
* commit 'f16e571330f030e445c4f7f63f55d093337ffd87': Making AllApps transition more cinematic
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<!-- Duration in milliseconds of the all apps / configuration zoom-in animation. -->
|
<!-- Duration in milliseconds of the all apps / configuration zoom-in animation. -->
|
||||||
<!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
|
<!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
|
||||||
<integer name="config_allAppsZoomInTime">700</integer>
|
<integer name="config_allAppsZoomInTime">850</integer>
|
||||||
|
|
||||||
<!-- Duration in milliseconds of the transition between tabs in the all apps/customize
|
<!-- Duration in milliseconds of the transition between tabs in the all apps/customize
|
||||||
tray -->
|
tray -->
|
||||||
@@ -17,17 +17,29 @@
|
|||||||
|
|
||||||
<!-- Duration in milliseconds of the all apps zoom-out animation -->
|
<!-- Duration in milliseconds of the all apps zoom-out animation -->
|
||||||
<!-- NB: This should be less than the workspaceUnshrinkTime as they happen together. -->
|
<!-- NB: This should be less than the workspaceUnshrinkTime as they happen together. -->
|
||||||
<integer name="config_allAppsZoomOutTime">350</integer>
|
<integer name="config_allAppsZoomOutTime">500</integer>
|
||||||
|
|
||||||
<!-- Scaling factor used in the all apps zooming animations -->
|
<!-- Scaling factor used in the all apps zooming animations -->
|
||||||
<integer name="config_allAppsZoomScaleFactor">7</integer>
|
<integer name="config_allAppsZoomScaleFactor">10</integer>
|
||||||
|
|
||||||
|
<!-- Duration in milliseconds of the all apps / configuration zoom-in animation. -->
|
||||||
|
<!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
|
||||||
|
<integer name="config_customizeZoomInTime">700</integer>
|
||||||
|
|
||||||
|
<!-- Duration in milliseconds of the all apps zoom-out animation -->
|
||||||
|
<!-- NB: This should be less than the workspaceUnshrinkTime as they happen together. -->
|
||||||
|
<integer name="config_customizeZoomOutTime">350</integer>
|
||||||
|
|
||||||
|
<!-- Scaling factor used in the all apps zooming animations -->
|
||||||
|
<integer name="config_customizeZoomScaleFactor">7</integer>
|
||||||
|
|
||||||
<!-- Duration in milliseconds of the animations between all apps, customize, & home.
|
<!-- Duration in milliseconds of the animations between all apps, customize, & home.
|
||||||
NOTE: If these are changed, the toolbar animation times below should also be. -->
|
NOTE: If these are changed, the toolbar animation times below should also be. -->
|
||||||
<integer name="config_allAppsCameraPanTime">700</integer>
|
<integer name="config_allAppsCameraPanTime">700</integer>
|
||||||
<integer name="config_workspaceShrinkTime">700</integer>
|
|
||||||
<integer name="config_workspaceUnshrinkTime">350</integer>
|
|
||||||
<integer name="config_allAppsFadeOutTime">150</integer>
|
<integer name="config_allAppsFadeOutTime">150</integer>
|
||||||
|
<integer name="config_customizeWorkspaceShrinkTime">700</integer>
|
||||||
|
<integer name="config_allAppsWorkspaceShrinkTime">800</integer>
|
||||||
|
<integer name="config_workspaceUnshrinkTime">350</integer>
|
||||||
|
|
||||||
<!-- Duration in milliseconds toolbar fade in and fade out animations.
|
<!-- Duration in milliseconds toolbar fade in and fade out animations.
|
||||||
NOTE: Fade in and fade out time should together be less the transition
|
NOTE: Fade in and fade out time should together be less the transition
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ import android.view.ViewGroup;
|
|||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.View.OnLongClickListener;
|
import android.view.View.OnLongClickListener;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
|
import android.view.animation.DecelerateInterpolator;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.Advanceable;
|
import android.widget.Advanceable;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@@ -2647,10 +2648,11 @@ public final class Launcher extends Activity
|
|||||||
// Set pivotY so that at the starting zoom factor, the view is partially
|
// Set pivotY so that at the starting zoom factor, the view is partially
|
||||||
// visible. Modifying initialHeightFactor changes how much of the view is
|
// visible. Modifying initialHeightFactor changes how much of the view is
|
||||||
// initially showing, and hence the perceived angle from which the view enters.
|
// initially showing, and hence the perceived angle from which the view enters.
|
||||||
final float initialHeightFactor = 0.2f;
|
|
||||||
if (state == State.ALL_APPS) {
|
if (state == State.ALL_APPS) {
|
||||||
view.setPivotY((1 + initialHeightFactor) * height);
|
final float initialHeightFactor = 0.165f;
|
||||||
|
view.setPivotY((1 - initialHeightFactor) * height);
|
||||||
} else {
|
} else {
|
||||||
|
final float initialHeightFactor = 0.2f;
|
||||||
view.setPivotY(-initialHeightFactor * height);
|
view.setPivotY(-initialHeightFactor * height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2663,15 +2665,23 @@ public final class Launcher extends Activity
|
|||||||
*/
|
*/
|
||||||
private void cameraZoomOut(State toState, boolean animated) {
|
private void cameraZoomOut(State toState, boolean animated) {
|
||||||
final Resources res = getResources();
|
final Resources res = getResources();
|
||||||
final int duration = res.getInteger(R.integer.config_allAppsZoomInTime);
|
|
||||||
final float scale = (float) res.getInteger(R.integer.config_allAppsZoomScaleFactor);
|
|
||||||
final boolean toAllApps = (toState == State.ALL_APPS);
|
final boolean toAllApps = (toState == State.ALL_APPS);
|
||||||
|
|
||||||
|
final int duration = toAllApps ?
|
||||||
|
res.getInteger(R.integer.config_allAppsZoomInTime) :
|
||||||
|
res.getInteger(R.integer.config_customizeZoomInTime);
|
||||||
|
|
||||||
|
final float scale = toAllApps ?
|
||||||
|
(float) res.getInteger(R.integer.config_allAppsZoomScaleFactor) :
|
||||||
|
(float) res.getInteger(R.integer.config_customizeZoomScaleFactor);
|
||||||
|
|
||||||
final View toView = toAllApps ? (View) mAllAppsGrid : mHomeCustomizationDrawer;
|
final View toView = toAllApps ? (View) mAllAppsGrid : mHomeCustomizationDrawer;
|
||||||
|
|
||||||
setPivotsForZoom(toView, toState, scale);
|
setPivotsForZoom(toView, toState, scale);
|
||||||
|
|
||||||
if (toAllApps) {
|
if (toAllApps) {
|
||||||
mWorkspace.shrink(ShrinkState.BOTTOM_HIDDEN, animated);
|
mWorkspace.shrink(ShrinkState.BOTTOM_HIDDEN, animated);
|
||||||
|
toView.setAlpha(0f);
|
||||||
} else {
|
} else {
|
||||||
mWorkspace.shrink(ShrinkState.TOP, animated);
|
mWorkspace.shrink(ShrinkState.TOP, animated);
|
||||||
}
|
}
|
||||||
@@ -2680,8 +2690,17 @@ public final class Launcher extends Activity
|
|||||||
ValueAnimator scaleAnim = ObjectAnimator.ofPropertyValuesHolder(toView,
|
ValueAnimator scaleAnim = ObjectAnimator.ofPropertyValuesHolder(toView,
|
||||||
PropertyValuesHolder.ofFloat("scaleX", scale, 1.0f),
|
PropertyValuesHolder.ofFloat("scaleX", scale, 1.0f),
|
||||||
PropertyValuesHolder.ofFloat("scaleY", scale, 1.0f));
|
PropertyValuesHolder.ofFloat("scaleY", scale, 1.0f));
|
||||||
|
|
||||||
scaleAnim.setDuration(duration);
|
scaleAnim.setDuration(duration);
|
||||||
|
|
||||||
|
if (toAllApps) {
|
||||||
|
ObjectAnimator alphaAnim = ObjectAnimator.ofPropertyValuesHolder(toView,
|
||||||
|
PropertyValuesHolder.ofFloat("alpha", 1.0f));
|
||||||
|
alphaAnim.setInterpolator(new DecelerateInterpolator(1.5f));
|
||||||
|
alphaAnim.setDuration(duration);
|
||||||
|
alphaAnim.start();
|
||||||
|
}
|
||||||
|
|
||||||
scaleAnim.setInterpolator(new Workspace.ZoomOutInterpolator());
|
scaleAnim.setInterpolator(new Workspace.ZoomOutInterpolator());
|
||||||
scaleAnim.addListener(new AnimatorListenerAdapter() {
|
scaleAnim.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -2690,7 +2709,9 @@ public final class Launcher extends Activity
|
|||||||
toView.setTranslationX(0.0f);
|
toView.setTranslationX(0.0f);
|
||||||
toView.setTranslationY(0.0f);
|
toView.setTranslationY(0.0f);
|
||||||
toView.setVisibility(View.VISIBLE);
|
toView.setVisibility(View.VISIBLE);
|
||||||
toView.setAlpha(1.0f);
|
if (!toAllApps) {
|
||||||
|
toView.setAlpha(1.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
@@ -2707,7 +2728,7 @@ public final class Launcher extends Activity
|
|||||||
hideAndShowToolbarButtons(toState, toolbarShowAnim, toolbarHideAnim);
|
hideAndShowToolbarButtons(toState, toolbarShowAnim, toolbarHideAnim);
|
||||||
|
|
||||||
// toView should appear right at the end of the workspace shrink animation
|
// toView should appear right at the end of the workspace shrink animation
|
||||||
final int startDelay = res.getInteger(R.integer.config_workspaceShrinkTime) - duration;
|
final int startDelay = 0;
|
||||||
|
|
||||||
if (mStateAnimation != null) mStateAnimation.cancel();
|
if (mStateAnimation != null) mStateAnimation.cancel();
|
||||||
mStateAnimation = new AnimatorSet();
|
mStateAnimation = new AnimatorSet();
|
||||||
@@ -2740,10 +2761,17 @@ public final class Launcher extends Activity
|
|||||||
|
|
||||||
private void cameraZoomIn(State fromState, boolean animated, boolean springLoaded) {
|
private void cameraZoomIn(State fromState, boolean animated, boolean springLoaded) {
|
||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
int duration = res.getInteger(R.integer.config_allAppsZoomOutTime);
|
final boolean fromAllApps = (fromState == State.ALL_APPS);
|
||||||
float scaleFactor = (float) res.getInteger(R.integer.config_allAppsZoomScaleFactor);
|
|
||||||
final View fromView =
|
int duration = fromAllApps ?
|
||||||
(fromState == State.ALL_APPS) ? (View) mAllAppsGrid : mHomeCustomizationDrawer;
|
res.getInteger(R.integer.config_allAppsZoomOutTime) :
|
||||||
|
res.getInteger(R.integer.config_customizeZoomOutTime);
|
||||||
|
|
||||||
|
float scaleFactor = fromAllApps ?
|
||||||
|
(float) res.getInteger(R.integer.config_allAppsZoomScaleFactor) :
|
||||||
|
(float) res.getInteger(R.integer.config_customizeZoomScaleFactor);
|
||||||
|
|
||||||
|
final View fromView = fromAllApps ? (View) mAllAppsGrid : mHomeCustomizationDrawer;
|
||||||
|
|
||||||
mCustomizePagedView.endChoiceMode();
|
mCustomizePagedView.endChoiceMode();
|
||||||
mAllAppsPagedView.endChoiceMode();
|
mAllAppsPagedView.endChoiceMode();
|
||||||
@@ -2766,6 +2794,7 @@ public final class Launcher extends Activity
|
|||||||
ValueAnimator alphaAnim = ObjectAnimator.ofPropertyValuesHolder(fromView,
|
ValueAnimator alphaAnim = ObjectAnimator.ofPropertyValuesHolder(fromView,
|
||||||
PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.0f));
|
PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.0f));
|
||||||
alphaAnim.setDuration(res.getInteger(R.integer.config_allAppsFadeOutTime));
|
alphaAnim.setDuration(res.getInteger(R.integer.config_allAppsFadeOutTime));
|
||||||
|
alphaAnim.setInterpolator(new DecelerateInterpolator(1.5f));
|
||||||
alphaAnim.addListener(new AnimatorListenerAdapter() {
|
alphaAnim.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
|||||||
@@ -1040,6 +1040,7 @@ public class Workspace extends SmoothPagedView
|
|||||||
getResources().getDimension(R.dimen.allAppsSmallScreenVerticalMarginLandscape));
|
getResources().getDimension(R.dimen.allAppsSmallScreenVerticalMarginLandscape));
|
||||||
float finalAlpha = 1.0f;
|
float finalAlpha = 1.0f;
|
||||||
float extraShrinkFactor = 1.0f;
|
float extraShrinkFactor = 1.0f;
|
||||||
|
|
||||||
if (shrinkState == ShrinkState.BOTTOM_VISIBLE) {
|
if (shrinkState == ShrinkState.BOTTOM_VISIBLE) {
|
||||||
newY = screenHeight - newY - scaledPageHeight;
|
newY = screenHeight - newY - scaledPageHeight;
|
||||||
} else if (shrinkState == ShrinkState.BOTTOM_HIDDEN) {
|
} else if (shrinkState == ShrinkState.BOTTOM_HIDDEN) {
|
||||||
@@ -1057,6 +1058,13 @@ public class Workspace extends SmoothPagedView
|
|||||||
getResources().getDimension(R.dimen.customizeSmallScreenVerticalMarginLandscape));
|
getResources().getDimension(R.dimen.customizeSmallScreenVerticalMarginLandscape));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int duration;
|
||||||
|
if (shrinkState == ShrinkState.BOTTOM_HIDDEN || shrinkState == ShrinkState.BOTTOM_VISIBLE) {
|
||||||
|
duration = res.getInteger(R.integer.config_allAppsWorkspaceShrinkTime);
|
||||||
|
} else {
|
||||||
|
duration = res.getInteger(R.integer.config_customizeWorkspaceShrinkTime);
|
||||||
|
}
|
||||||
|
|
||||||
// We animate all the screens to the centered position in workspace
|
// We animate all the screens to the centered position in workspace
|
||||||
// At the same time, the screens become greyed/dimmed
|
// At the same time, the screens become greyed/dimmed
|
||||||
|
|
||||||
@@ -1071,17 +1079,16 @@ public class Workspace extends SmoothPagedView
|
|||||||
if (mAnimator != null) {
|
if (mAnimator != null) {
|
||||||
mAnimator.cancel();
|
mAnimator.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
mAnimator = new AnimatorSet();
|
mAnimator = new AnimatorSet();
|
||||||
for (int i = 0; i < screenCount; i++) {
|
for (int i = 0; i < screenCount; i++) {
|
||||||
CellLayout cl = (CellLayout) getChildAt(i);
|
final CellLayout cl = (CellLayout) getChildAt(i);
|
||||||
|
|
||||||
float rotation = (-i + 2) * WORKSPACE_ROTATION;
|
float rotation = (-i + 2) * WORKSPACE_ROTATION;
|
||||||
float rotationScaleX = (float) (1.0f / Math.cos(Math.PI * rotation / 180.0f));
|
float rotationScaleX = (float) (1.0f / Math.cos(Math.PI * rotation / 180.0f));
|
||||||
float rotationScaleY = getYScaleForScreen(i);
|
float rotationScaleY = getYScaleForScreen(i);
|
||||||
|
|
||||||
if (animated) {
|
if (animated) {
|
||||||
final int duration = res.getInteger(R.integer.config_workspaceShrinkTime);
|
|
||||||
|
|
||||||
ObjectAnimator animWithInterpolator = ObjectAnimator.ofPropertyValuesHolder(cl,
|
ObjectAnimator animWithInterpolator = ObjectAnimator.ofPropertyValuesHolder(cl,
|
||||||
PropertyValuesHolder.ofFloat("x", newX),
|
PropertyValuesHolder.ofFloat("x", newX),
|
||||||
PropertyValuesHolder.ofFloat("y", newY),
|
PropertyValuesHolder.ofFloat("y", newY),
|
||||||
|
|||||||
Reference in New Issue
Block a user