diff options
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java index bb74c6f..0e0bc3e 100644 --- a/src/com/cyanogenmod/trebuchet/Workspace.java +++ b/src/com/cyanogenmod/trebuchet/Workspace.java @@ -81,6 +81,8 @@ public class Workspace extends PagedView DragController.DragListener, LauncherTransitionable, ViewGroup.OnHierarchyChangeListener { private static final String TAG = "Trebuchet.Workspace"; + private static final boolean DEBUG_CHANGE_STATE_ANIMATIONS = false; + // Y rotation to apply to the workspace screens private static final float WORKSPACE_ROTATION = 12.5f; private static final float WORKSPACE_OVERSCROLL_ROTATION = 24f; @@ -2212,89 +2214,72 @@ public class Workspace extends PagedView } } - // Zoom Effects - if ((mTransitionEffect == TransitionEffect.ZoomIn || - mTransitionEffect == TransitionEffect.ZoomOut) && stateIsNormal) { - if (i != mCurrentPage) { - scale = (mTransitionEffect == TransitionEffect.ZoomIn ? 0.5f : 1.1f); + if (stateIsNormal) { + // Zoom Effects + if ((mTransitionEffect == TransitionEffect.ZoomIn || mTransitionEffect == TransitionEffect.ZoomOut)) { + if (i != mCurrentPage) { + scale = (mTransitionEffect == TransitionEffect.ZoomIn ? 0.5f : 1.1f); + } } - } - // Stack Effect - if (mTransitionEffect == TransitionEffect.Stack) { - if (stateIsSpringLoaded) { - cl.setVisibility(VISIBLE); - } else if (stateIsNormal) { + // Stack Effect + if (mTransitionEffect == TransitionEffect.Stack) { if (i <= mCurrentPage) { cl.setVisibility(VISIBLE); } else { cl.setVisibility(INVISIBLE); } } - } - // Flip Effect - if (mTransitionEffect == TransitionEffect.Flip) { - if (stateIsSpringLoaded) { - cl.setVisibility(VISIBLE); - } else if (stateIsNormal) { + // Flip Effect + if (mTransitionEffect == TransitionEffect.Flip || mTransitionEffect == TransitionEffect.Accordion) { if (i == mCurrentPage) { cl.setVisibility(VISIBLE); } else { cl.setVisibility(INVISIBLE); } } - } - // Rotate Effects - if ((mTransitionEffect == TransitionEffect.RotateUp || - mTransitionEffect == TransitionEffect.RotateDown) && stateIsNormal) { - boolean up = mTransitionEffect == TransitionEffect.RotateUp; - rotation = (up ? WORKSPACE_ROTATION : -WORKSPACE_ROTATION) * Math.max(-1.0f, Math.min(1.0f , mCurrentPage - i)); - translationX = cl.getMeasuredWidth() * (Math.max(-1.0f, Math.min(1.0f, i - mCurrentPage))) + - (up ? -1.0f : 1.0f) * (float) Math.sin(Math.toRadians((double) rotation)) * - (mRotatePivotPoint + cl.getMeasuredHeight() * 0.5f); - translationY += (up ? -1.0f : 1.0f) * (1.0f - Math.cos(Math.toRadians((double) rotation))) * - (mRotatePivotPoint + cl.getMeasuredHeight() * 0.5f); - } - - // Cube Effects - if ((mTransitionEffect == TransitionEffect.CubeIn || mTransitionEffect == TransitionEffect.CubeOut) && stateIsNormal) { - if (i < mCurrentPage) { - rotationY = mTransitionEffect == TransitionEffect.CubeOut ? -90.0f : 90.0f; - } else if (i > mCurrentPage) { - rotationY = mTransitionEffect == TransitionEffect.CubeOut ? 90.0f : -90.0f; + // Rotate Effects + if ((mTransitionEffect == TransitionEffect.RotateUp || mTransitionEffect == TransitionEffect.RotateDown)) { + boolean up = mTransitionEffect == TransitionEffect.RotateUp; + rotation = (up ? WORKSPACE_ROTATION : -WORKSPACE_ROTATION) * Math.max(-1.0f, Math.min(1.0f , mCurrentPage - i)); + translationX = cl.getMeasuredWidth() * (Math.max(-1.0f, Math.min(1.0f, i - mCurrentPage))) + + (up ? -1.0f : 1.0f) * (float) Math.sin(Math.toRadians((double) rotation)) * + (mRotatePivotPoint + cl.getMeasuredHeight() * 0.5f); + translationY += (up ? -1.0f : 1.0f) * (1.0f - Math.cos(Math.toRadians((double) rotation))) * + (mRotatePivotPoint + cl.getMeasuredHeight() * 0.5f); } - } - // Cylinder Effects - if ((mTransitionEffect == TransitionEffect.CylinderIn || mTransitionEffect == TransitionEffect.CylinderOut) && stateIsNormal) { - if (i < mCurrentPage) { - rotationY = mTransitionEffect == TransitionEffect.CylinderOut ? -WORKSPACE_ROTATION : WORKSPACE_ROTATION; - } else if (i > mCurrentPage) { - rotationY = mTransitionEffect == TransitionEffect.CylinderOut ? WORKSPACE_ROTATION : -WORKSPACE_ROTATION; + // Cube Effects + if ((mTransitionEffect == TransitionEffect.CubeIn || mTransitionEffect == TransitionEffect.CubeOut)) { + if (i < mCurrentPage) { + rotationY = mTransitionEffect == TransitionEffect.CubeOut ? -90.0f : 90.0f; + } else if (i > mCurrentPage) { + rotationY = mTransitionEffect == TransitionEffect.CubeOut ? 90.0f : -90.0f; + } } - } - // Carousel Effects - if (mTransitionEffect == TransitionEffect.CarouselLeft || mTransitionEffect == TransitionEffect.CarouselRight && stateIsNormal) { - if (i < mCurrentPage) { - rotationY = 90.0f; - } else if (i > mCurrentPage) { - rotationY = -90.0f; + // Cylinder Effects + if ((mTransitionEffect == TransitionEffect.CylinderIn || mTransitionEffect == TransitionEffect.CylinderOut)) { + if (i < mCurrentPage) { + rotationY = mTransitionEffect == TransitionEffect.CylinderOut ? -WORKSPACE_ROTATION : WORKSPACE_ROTATION; + cl.setPivotX(cl.getMeasuredWidth()); + cl.setTranslationX(0); + } else if (i > mCurrentPage) { + rotationY = mTransitionEffect == TransitionEffect.CylinderOut ? WORKSPACE_ROTATION : -WORKSPACE_ROTATION; + cl.setPivotX(0); + cl.setTranslationX(0); + } } - } - // Accordion Effect - if (mTransitionEffect == TransitionEffect.Accordion) { - if (stateIsSpringLoaded) { - cl.setVisibility(VISIBLE); - } else if (stateIsNormal) { - if (i == mCurrentPage) { - cl.setVisibility(VISIBLE); - } else { - cl.setVisibility(INVISIBLE); + // Carousel Effects + if (mTransitionEffect == TransitionEffect.CarouselLeft || mTransitionEffect == TransitionEffect.CarouselRight) { + if (i < mCurrentPage) { + rotationY = 90.0f; + } else if (i > mCurrentPage) { + rotationY = -90.0f; } } } @@ -2303,6 +2288,7 @@ public class Workspace extends PagedView cl.setCameraDistance(1280 * mDensity); cl.setPivotX(cl.getMeasuredWidth() * 0.5f); cl.setPivotY(cl.getMeasuredHeight() * 0.5f); + cl.setVisibility(VISIBLE); } // Determine the pages alpha during the state transition @@ -2350,8 +2336,22 @@ public class Workspace extends PagedView } if (animated) { + if (DEBUG_CHANGE_STATE_ANIMATIONS) Log.d(TAG, oldState + " > " + state); for (int index = 0; index < getChildCount(); index++) { final int i = index; + + if (DEBUG_CHANGE_STATE_ANIMATIONS) { + Log.d(TAG, i + " alpha: " + mOldAlphas[i] + " > " + mNewAlphas[i]); + Log.d(TAG, i + " translationX: " + mOldTranslationXs[i] + " > " + mNewTranslationXs[i]); + Log.d(TAG, i + " translationY: " + mOldTranslationYs[i] + " > " + mNewTranslationYs[i]); + Log.d(TAG, i + " scaleX: " + mOldScaleXs[i] + " > " + mNewScaleXs[i]); + Log.d(TAG, i + " scaleY: " + mOldScaleYs[i] + " > " + mNewScaleYs[i]); + Log.d(TAG, i + " alpha: " + mOldAlphas[i] + " > " + mNewAlphas[i]); + Log.d(TAG, i + " backgroundAlpha: " + mOldBackgroundAlphas[i] + " > " + mNewBackgroundAlphas[i]); + Log.d(TAG, i + " rotation: " + mOldRotations[i] + " > " + mNewRotations[i]); + Log.d(TAG, i + " rotationY: " + mOldRotationYs[i] + " > " + mNewRotationYs[i]); + } + final CellLayout cl = (CellLayout) getChildAt(i); float currentAlpha = cl.getShortcutsAndWidgets().getAlpha(); if (mOldAlphas[i] == 0 && mNewAlphas[i] == 0) { |