diff options
author | Florian Edelmann <florian-edelmann@online.de> | 2013-04-08 20:13:30 +0200 |
---|---|---|
committer | Florian Edelmann <florian-edelmann@online.de> | 2013-04-08 21:31:41 +0200 |
commit | c7ef75bd61f3e556b8f9c8196f9112affbb7e567 (patch) | |
tree | fbe7c040bd4217fe4807951ab8c8c27b6caa0763 /src | |
parent | d8e1aa79e719c04d04cf75dd0a94c4b88133a491 (diff) | |
download | packages_apps_trebuchet-c7ef75bd61f3e556b8f9c8196f9112affbb7e567.zip packages_apps_trebuchet-c7ef75bd61f3e556b8f9c8196f9112affbb7e567.tar.gz packages_apps_trebuchet-c7ef75bd61f3e556b8f9c8196f9112affbb7e567.tar.bz2 |
added "carousel" transition effect
removed German translations again,
fixed whitespace errors,
fixed upper-/lowercase mistakes
Change-Id: Ia502eede0e8140f49bc61141252ad0c862e0720b
Diffstat (limited to 'src')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java | 32 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 39 |
2 files changed, 69 insertions, 2 deletions
diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java index 8170bfb..4e7eb05 100644 --- a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java +++ b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java @@ -311,7 +311,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen Stack, Accordion, CylinderIn, - CylinderOut + CylinderOut, + CarouselLeft, + CarouselRight } private TransitionEffect mTransitionEffect = TransitionEffect.Standard; @@ -2075,6 +2077,27 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } } + private void screenScrolledCarousel(int screenScroll, boolean left) { + for (int i = 0; i < getChildCount(); i++) { + View v = getPageAt(i); + if (v != null) { + float scrollProgress = getScrollProgress(screenScroll, v, i); + float rotation = 90.0f * -scrollProgress; + + v.setCameraDistance(mDensity * mCameraDistance); + v.setTranslationX(v.getMeasuredWidth() * scrollProgress); + v.setPivotX(left ? 0f : v.getMeasuredWidth()); + v.setPivotY(0f); + v.setRotationY(rotation); + + if (mFadeInAdjacentScreens) { + float alpha = 1 - Math.abs(scrollProgress); + v.setAlpha(alpha); + } + } + } + } + // Transition effects @Override protected void screenScrolled(int screenScroll) { @@ -2155,6 +2178,13 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen break; case CylinderOut: screenScrolledCylinder(scroll, false); + break; + case CarouselLeft: + screenScrolledCarousel(scroll, true); + break; + case CarouselRight: + screenScrolledCarousel(scroll, false); + break; } mScrollTransformsDirty = false; } diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java index a75e0e8..ca6cc2c 100644 --- a/src/com/cyanogenmod/trebuchet/Workspace.java +++ b/src/com/cyanogenmod/trebuchet/Workspace.java @@ -286,7 +286,9 @@ public class Workspace extends PagedView Stack, Accordion, CylinderIn, - CylinderOut + CylinderOut, + CarouselLeft, + CarouselRight } private TransitionEffect mTransitionEffect = TransitionEffect.Standard; @@ -1663,6 +1665,26 @@ public class Workspace extends PagedView } } + private void screenScrolledCarousel(int screenScroll, boolean left) { + for (int i = 0; i < getChildCount(); i++) { + CellLayout cl = (CellLayout) getPageAt(i); + if (cl != null) { + float scrollProgress = getScrollProgress(screenScroll, cl, i); + float rotation = 90.0f * -scrollProgress; + + cl.setCameraDistance(mDensity * mCameraDistance); + cl.setTranslationX(cl.getMeasuredWidth() * scrollProgress); + cl.setPivotX(left ? 0f : cl.getMeasuredWidth()); + cl.setPivotY(0f); + cl.setRotationY(rotation); + + if (mFadeInAdjacentScreens && !isSmall()) { + setCellLayoutFadeAdjacent(cl, scrollProgress); + } + } + } + } + @Override protected void screenScrolled(int screenScroll) { super.screenScrolled(screenScroll); @@ -1741,6 +1763,12 @@ public class Workspace extends PagedView case CylinderOut: screenScrolledCylinder(scroll, false); break; + case CarouselLeft: + screenScrolledCarousel(scroll, true); + break; + case CarouselRight: + screenScrolledCarousel(scroll, false); + break; } mScrollTransformsDirty = false; } @@ -2247,6 +2275,15 @@ public class Workspace extends PagedView } } + // Carousel Effects + if (mTransitionEffect == TransitionEffect.CarouselLeft || mTransitionEffect == TransitionEffect.CarouselRight && stateIsNormal) { + if (i < mCurrentPage) { + rotationY = 90.0f; + } else if (i > mCurrentPage) { + rotationY = -90.0f; + } + } + // Accordion Effect if (mTransitionEffect == TransitionEffect.Accordion) { if (stateIsSpringLoaded) { |