diff options
author | nebkat <nebkat@teamhacksung.org> | 2012-01-21 16:53:27 +0000 |
---|---|---|
committer | nebkat <nebkat@teamhacksung.org> | 2012-01-21 16:54:24 +0000 |
commit | b6e50c4ed3f17ac6b1e5c20cd01462c41da17412 (patch) | |
tree | e7a00bd61477eb51c90cff65a42ba4a431171fc9 /src/com | |
parent | 2b36557bfea6efd1bf964788d72dbc9ee07cb87f (diff) | |
download | android_packages_apps_Trebuchet-b6e50c4ed3f17ac6b1e5c20cd01462c41da17412.tar.gz android_packages_apps_Trebuchet-b6e50c4ed3f17ac6b1e5c20cd01462c41da17412.tar.bz2 android_packages_apps_Trebuchet-b6e50c4ed3f17ac6b1e5c20cd01462c41da17412.zip |
Workspace: Zoom In/Out Transition
Change-Id: I67675033413b18f265fa3e0967125f850596cced
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java index 41b66b225..4e006d5cb 100644 --- a/src/com/cyanogenmod/trebuchet/Workspace.java +++ b/src/com/cyanogenmod/trebuchet/Workspace.java @@ -243,6 +243,8 @@ public class Workspace extends PagedView public enum TransitionEffect { Standard, Tablet, + ZoomIn, + ZoomOut, Stack } @@ -1270,6 +1272,31 @@ public class Workspace extends PagedView invalidate(); } + private void screenScrolledZoom(int screenScroll, boolean in) { + boolean isInOverscroll = false; + for (int i = 0; i < getChildCount(); i++) { + CellLayout cl = (CellLayout) getChildAt(i); + if (cl != null) { + float scrollProgress = getScrollProgress(screenScroll, cl, i); + float scale = 1.0f + (in ? -0.2f : 0.1f) * Math.abs(scrollProgress); + + // Extra translation to account for the increase in size + if (!in) { + float translationX = getMeasuredWidth() * 0.1f * -scrollProgress; + cl.setFastTranslationX(translationX); + } + + cl.setFastScaleX(scale); + cl.setFastScaleY(scale); + if (mFadeInAdjacentScreens && !isSmall()) { + float alpha = 1 - Math.abs(scrollProgress); + cl.setFastAlpha(alpha); + } + cl.fastInvalidate(); + } + } + } + private void screenScrolledStack(int screenScroll) { boolean isInOverscroll = false; for (int i = 0; i < getChildCount(); i++) { @@ -1355,6 +1382,12 @@ public class Workspace extends PagedView case Tablet: screenScrolledTablet(screenScroll); break; + case ZoomIn: + screenScrolledZoom(screenScroll, true); + break; + case ZoomOut: + screenScrolledZoom(screenScroll, false); + break; case Stack: screenScrolledStack(screenScroll); break; |