Merge "Revert "Speed up All Apps -> Workspace transition""
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
package com.android.launcher2;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.Animator.AnimatorListener;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.TimeInterpolator;
|
||||
@@ -24,7 +26,6 @@ import android.animation.ValueAnimator;
|
||||
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.WallpaperManager;
|
||||
import android.appwidget.AppWidgetHostView;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.ClipData;
|
||||
@@ -56,7 +57,6 @@ import android.view.DragEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
@@ -77,7 +77,7 @@ import java.util.List;
|
||||
*/
|
||||
public class Workspace extends SmoothPagedView
|
||||
implements DropTarget, DragSource, DragScroller, View.OnTouchListener,
|
||||
DragController.DragListener, LauncherTransitionable {
|
||||
DragController.DragListener {
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
private static final String TAG = "Launcher.Workspace";
|
||||
|
||||
@@ -159,6 +159,8 @@ public class Workspace extends SmoothPagedView
|
||||
private State mState = State.NORMAL;
|
||||
private boolean mIsSwitchingState = false;
|
||||
|
||||
private AnimatorListener mChangeStateAnimationListener;
|
||||
|
||||
boolean mAnimatingViewIntoPlace = false;
|
||||
boolean mIsDragOccuring = false;
|
||||
boolean mChildrenLayersEnabled = true;
|
||||
@@ -385,6 +387,20 @@ public class Workspace extends SmoothPagedView
|
||||
// In this case, we will skip drawing background protection
|
||||
}
|
||||
|
||||
mChangeStateAnimationListener = new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
mIsSwitchingState = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mIsSwitchingState = false;
|
||||
mWallpaperOffset.setOverrideHorizontalCatchupConstant(false);
|
||||
updateChildrenLayersEnabled();
|
||||
}
|
||||
};
|
||||
|
||||
mWallpaperOffset = new WallpaperOffsetInterpolator();
|
||||
Display display = mLauncher.getWindowManager().getDefaultDisplay();
|
||||
mDisplayWidth = display.getWidth();
|
||||
@@ -1624,10 +1640,26 @@ public class Workspace extends SmoothPagedView
|
||||
cl.setBackgroundAlphaMultiplier(finalAlphaMultiplierValue);
|
||||
cl.setAlpha(finalAlpha);
|
||||
cl.setRotationY(rotation);
|
||||
mChangeStateAnimationListener.onAnimationEnd(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (animated) {
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(android.animation.Animator animation) {
|
||||
// The above code to determine initialAlpha and finalAlpha will ensure that only
|
||||
// the current page is visible during (and subsequently, after) the transition
|
||||
// animation. If fade adjacent pages is disabled, then re-enable the page
|
||||
// visibility after the transition animation.
|
||||
if (!mFadeInAdjacentScreens) {
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
final CellLayout cl = (CellLayout) getChildAt(i);
|
||||
cl.setAlpha(1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
for (int index = 0; index < getChildCount(); index++) {
|
||||
final int i = index;
|
||||
final CellLayout cl = (CellLayout) getChildAt(i);
|
||||
@@ -1683,6 +1715,9 @@ public class Workspace extends SmoothPagedView
|
||||
}
|
||||
}
|
||||
anim.setStartDelay(delay);
|
||||
// If we call this when we're not animated, onAnimationEnd is never called on
|
||||
// the listener; make sure we only use the listener when we're actually animating
|
||||
anim.addListener(mChangeStateAnimationListener);
|
||||
}
|
||||
|
||||
if (stateIsSpringLoaded) {
|
||||
@@ -1698,33 +1733,6 @@ public class Workspace extends SmoothPagedView
|
||||
return anim;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) {
|
||||
mIsSwitchingState = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) {
|
||||
mIsSwitchingState = false;
|
||||
mWallpaperOffset.setOverrideHorizontalCatchupConstant(false);
|
||||
updateChildrenLayersEnabled();
|
||||
// The code in getChangeStateAnimation to determine initialAlpha and finalAlpha will ensure
|
||||
// ensure that only the current page is visible during (and subsequently, after) the
|
||||
// transition animation. If fade adjacent pages is disabled, then re-enable the page
|
||||
// visibility after the transition animation.
|
||||
if (!mFadeInAdjacentScreens) {
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
final CellLayout cl = (CellLayout) getChildAt(i);
|
||||
cl.setAlpha(1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getContent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the View v into the given Canvas.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user