summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/Workspace.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher2/Workspace.java')
-rw-r--r--src/com/android/launcher2/Workspace.java68
1 files changed, 30 insertions, 38 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 4e731a2ed..f61917f9f 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -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.
*