diff options
-rw-r--r-- | res/values-de/cm_strings.xml | 1 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Launcher.java | 67 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/LauncherViewPropertyAnimator.java | 11 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 130 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/widget/CustomAbsSpinner.java | 14 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/widget/EcoGallery.java | 6 |
6 files changed, 92 insertions, 137 deletions
diff --git a/res/values-de/cm_strings.xml b/res/values-de/cm_strings.xml index 7cb62e626..7edbac3cd 100644 --- a/res/values-de/cm_strings.xml +++ b/res/values-de/cm_strings.xml @@ -14,6 +14,7 @@ limitations under the License. --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="application_copyright">Copyright \u00A9 2013 The CyanogenMod Project</string> <string name="menu">MenĂ¼</string> <string name="cancel_target_label">Abbrechen</string> <string name="edit_target_label">Bearbeiten</string> diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java index 7208a9ac1..e2f35f23d 100644 --- a/src/com/cyanogenmod/trebuchet/Launcher.java +++ b/src/com/cyanogenmod/trebuchet/Launcher.java @@ -258,9 +258,6 @@ public final class Launcher extends Activity private boolean mWaitingForResult; private boolean mOnResumeNeedsLoad; - private final List<Runnable> mNewPendingIntents = new ArrayList<Runnable>(); - private boolean mOnNewIntentProcessing; - // Keep track of whether the user has left launcher private static boolean sPausedFromUserAction = false; @@ -1562,20 +1559,19 @@ public final class Launcher extends Activity public void run() { if (mWorkspace == null) { // Can be cases where mWorkspace is null, this prevents a NPE - synchronized (mNewPendingIntents) { - mOnNewIntentProcessing = false; - } return; } Folder openFolder = mWorkspace.getOpenFolder(); // In all these cases, only animate if we're already on home mWorkspace.exitWidgetResizeMode(); - boolean waitForPendingTranstions = true; if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive() && openFolder == null) { + if (mStateAnimation != null) { + mStateAnimation.end(); + mStateAnimation = null; + } mWorkspace.moveToDefaultScreen(true); mHotseat.moveToDefaultScreen(true); - waitForPendingTranstions = false; } closeFolder(); @@ -1584,20 +1580,9 @@ public final class Launcher extends Activity // If we are already on home, then just animate back to the workspace, // otherwise, just wait until onResume to set the state back to Workspace if (alreadyOnHome) { - showWorkspace(true, new Runnable() { - @Override - public void run() { - processNewPendingIntents(); - } - }); - // onCompleteRunnable is not called if there is no pending animations - // so we must ensure that processNewPendingIntents is called. - if (!waitForPendingTranstions) { - processNewPendingIntents(); - } + showWorkspace(true); } else { mOnResumeState = State.WORKSPACE; - processNewPendingIntents(); } final View v = getWindow().peekDecorView(); @@ -1614,43 +1599,15 @@ public final class Launcher extends Activity } }; - boolean markAsPending = false; - synchronized (mNewPendingIntents) { - if (mOnNewIntentProcessing) { - mNewPendingIntents.add(processIntent); - markAsPending = true; - } else { - mOnNewIntentProcessing = true; - } - } - - if (!markAsPending) { - if (alreadyOnHome && !mWorkspace.hasWindowFocus()) { - // Delay processing of the intent to allow the status bar animation to finish - // first in order to avoid janky animations. - mWorkspace.postDelayed(processIntent, 350); - } else { - // Process the intent immediately. - processIntent.run(); - } - } - - } - } - - private void processNewPendingIntents() { - Runnable newIntent = null; - synchronized (mNewPendingIntents) { - if (mNewPendingIntents.size() > 0) { - if (mWorkspace != null) { - newIntent = mNewPendingIntents.remove(0); - mWorkspace.post(newIntent); - } else { - mOnNewIntentProcessing = false; - } + if (alreadyOnHome && !mWorkspace.hasWindowFocus()) { + // Delay processing of the intent to allow the status bar animation to finish + // first in order to avoid janky animations. + mWorkspace.postDelayed(processIntent, 350); } else { - mOnNewIntentProcessing = false; + // Process the intent immediately. + processIntent.run(); } + } } diff --git a/src/com/cyanogenmod/trebuchet/LauncherViewPropertyAnimator.java b/src/com/cyanogenmod/trebuchet/LauncherViewPropertyAnimator.java index ee67b7fc2..3a00225a6 100644 --- a/src/com/cyanogenmod/trebuchet/LauncherViewPropertyAnimator.java +++ b/src/com/cyanogenmod/trebuchet/LauncherViewPropertyAnimator.java @@ -79,7 +79,16 @@ public class LauncherViewPropertyAnimator extends Animator implements AnimatorLi @Override public void end() { - throw new RuntimeException("Not implemented"); + if (mViewPropertyAnimator != null) { + mViewPropertyAnimator.cancel(); + mTarget.setTranslationX(mTranslationX); + mTarget.setTranslationY(mTranslationY); + mTarget.setScaleX(mScaleX); + mTarget.setScaleY(mScaleY); + mTarget.setRotation(mRotation); + mTarget.setRotationY(mRotationY); + mTarget.setAlpha(mAlpha); + } } @Override diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java index 065ac7140..cb96f36b5 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; @@ -177,8 +179,6 @@ public class Workspace extends PagedView boolean mIsDragOccuring = false; boolean mChildrenLayersEnabled = true; - private boolean mIsLandscape; - /** Is the user is dragging an item near the edge of a page? */ private boolean mInScrollArea = false; @@ -305,7 +305,6 @@ public class Workspace extends PagedView private boolean mStretchScreens; private boolean mShowSearchBar; private boolean mShowHotseat; - private boolean mResizeAnyWidget; private boolean mHideIconLabels; private boolean mHideDockIconLabels; private boolean mScrollWallpaper; @@ -1578,6 +1577,9 @@ public class Workspace extends PagedView } else if (cl.getVisibility() != VISIBLE) { cl.setVisibility(VISIBLE); } + if (mFadeInAdjacentScreens && !isSmall()) { + setCellLayoutFadeAdjacent(cl, scrollProgress); + } } } invalidate(); @@ -2215,89 +2217,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; } } } @@ -2306,6 +2291,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 @@ -2353,8 +2339,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) { @@ -4016,8 +4016,6 @@ public class Workspace extends PagedView // needed updateChildrenLayersEnabled(false); setupWallpaper(); - - mIsLandscape = LauncherApplication.isScreenLandscape(mLauncher); } void setupWallpaper() { @@ -4460,7 +4458,7 @@ public class Workspace extends PagedView } void moveToDefaultScreen(boolean animate) { - if (!isSmall()) { + if (!isSmall() && !mIsSwitchingState) { if (animate) { snapToPage(mDefaultHomescreen); } else { diff --git a/src/com/cyanogenmod/trebuchet/widget/CustomAbsSpinner.java b/src/com/cyanogenmod/trebuchet/widget/CustomAbsSpinner.java index 7861f50b0..d0653a420 100644 --- a/src/com/cyanogenmod/trebuchet/widget/CustomAbsSpinner.java +++ b/src/com/cyanogenmod/trebuchet/widget/CustomAbsSpinner.java @@ -27,7 +27,6 @@ import android.util.AttributeSet; import android.util.SparseArray; import android.view.View; import android.view.ViewGroup; -import android.view.animation.Interpolator; import android.widget.ArrayAdapter; import android.widget.SpinnerAdapter; import com.cyanogenmod.trebuchet.R; @@ -44,8 +43,6 @@ public abstract class CustomAbsSpinner extends CustomAdapterView<SpinnerAdapter> int mSelectionRightPadding = 0; int mSelectionBottomPadding = 0; Rect mSpinnerPadding = new Rect(); - View mSelectedView = null; - Interpolator mInterpolator; RecycleBin mRecycler = new RecycleBin(); private DataSetObserver mDataSetObserver; @@ -200,7 +197,7 @@ public abstract class CustomAbsSpinner extends CustomAdapterView<SpinnerAdapter> if (view != null) { // Put in recycler for re-measuring and/or layout - mRecycler.add(selectedPosition, view); + mRecycler.add(view); } if (view != null) { @@ -249,7 +246,7 @@ public abstract class CustomAbsSpinner extends CustomAdapterView<SpinnerAdapter> @Override protected ViewGroup.LayoutParams generateDefaultLayoutParams() { return new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.FILL_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } @@ -458,7 +455,7 @@ public abstract class CustomAbsSpinner extends CustomAdapterView<SpinnerAdapter> mScrapHeap.put(position, v); } - public void add(int position, View v) { + public void add(View v) { mScrapHeap.put(mScrapHeap.size(), v); } public View get() { @@ -474,19 +471,14 @@ public abstract class CustomAbsSpinner extends CustomAdapterView<SpinnerAdapter> } View get(int position) { - // System.out.print("Looking for " + position); View result = mScrapHeap.get(position); if (result != null) { - // System.out.println(" HIT"); mScrapHeap.delete(position); - } else { - // System.out.println(" MISS"); } return result; } View peek(int position) { - // System.out.print("Looking for " + position); return mScrapHeap.get(position); } diff --git a/src/com/cyanogenmod/trebuchet/widget/EcoGallery.java b/src/com/cyanogenmod/trebuchet/widget/EcoGallery.java index 8c7a7415d..c983704ae 100644 --- a/src/com/cyanogenmod/trebuchet/widget/EcoGallery.java +++ b/src/com/cyanogenmod/trebuchet/widget/EcoGallery.java @@ -36,8 +36,6 @@ import android.view.animation.Transformation; import android.widget.Scroller; import com.cyanogenmod.trebuchet.R; -import java.lang.reflect.Field; - public class EcoGallery extends CustomAbsSpinner implements GestureDetector.OnGestureListener { private static final String TAG = "Gallery"; @@ -448,7 +446,7 @@ public class EcoGallery extends CustomAbsSpinner implements GestureDetector.OnGe break; } else { count++; - mRecycler.add(firstPosition + i, child); + mRecycler.add(child); } } } else { @@ -460,7 +458,7 @@ public class EcoGallery extends CustomAbsSpinner implements GestureDetector.OnGe } else { start = i; count++; - mRecycler.add(firstPosition + i, child); + mRecycler.add(child); } } } |