Revert "Revert "Speed up All Apps -> Workspace transition""

- also, undo enabling hardware layers for
    scroll indicator, which could have caused
    slowness
- fix bug where scroll indicator was not seen
    after the first visit to all apps
- eliminate a some needless hardware layer redraws
- making items under All Apps invisible when we're
    in All Apps
- making workspace spaces invisible if their alpha is 0
    to prevent more hardware layer rebuilding

This reverts commit 9753d13c7b.

Change-Id: Ib908ae0b456b2d4b8a171991a95f20aea4749da1
This commit is contained in:
Michael Jurka
2012-02-14 22:51:29 -08:00
parent 3a58b88901
commit bed61d22bd
5 changed files with 145 additions and 88 deletions
+30 -38
View File
@@ -17,8 +17,6 @@
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;
@@ -26,6 +24,7 @@ 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;
@@ -57,6 +56,7 @@ 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 {
DragController.DragListener, LauncherTransitionable {
@SuppressWarnings({"UnusedDeclaration"})
private static final String TAG = "Launcher.Workspace";
@@ -159,8 +159,6 @@ 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;
@@ -387,20 +385,6 @@ 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();
@@ -1640,26 +1624,10 @@ 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);
@@ -1715,9 +1683,6 @@ 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) {
@@ -1733,6 +1698,33 @@ 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.
*