diff options
author | Michael Jurka <mikejurka@google.com> | 2010-08-09 21:05:32 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2010-08-10 14:10:20 -0700 |
commit | 4cb3724a2c1e5f278e1531d643accc40fcd8e219 (patch) | |
tree | 8b188e770e842eb14f72fd6d5b19d01b13e46bcb /src | |
parent | 3ec8bdd576e23f6aa783d5377abecac6fda07374 (diff) | |
download | packages_apps_trebuchet-4cb3724a2c1e5f278e1531d643accc40fcd8e219.zip packages_apps_trebuchet-4cb3724a2c1e5f278e1531d643accc40fcd8e219.tar.gz packages_apps_trebuchet-4cb3724a2c1e5f278e1531d643accc40fcd8e219.tar.bz2 |
workspace bug fixes
- fixed: pressing home sometimes left workspaces
in shrunken state
- fixed: position of delete zone (trash icon)
- fixed: workspace unshrink sometimes looked weird
when coming from all apps
- fixed: clicking power button and returning left
workspace in shrunken state
Change-Id: Ie974202926e6880ccda26ac9fe967fb587a9b7a3
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 11 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 56 |
2 files changed, 48 insertions, 19 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 5184f80..008b636 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -1038,9 +1038,15 @@ public final class Launcher extends Activity != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); boolean allAppsVisible = isAllAppsVisible(); - // TODO: Figure out the right thing to do in XLarge mode here + // in all these cases, only animate if we're already on home + if (LauncherApplication.isScreenXLarge()) { + mWorkspace.unshrink(alreadyOnHome); + } if (!mWorkspace.isDefaultScreenShowing()) { - mWorkspace.moveToDefaultScreen(alreadyOnHome && !allAppsVisible); + // on the phone, we don't animate the change to the workspace if all apps is visible + // on xlarge screens, however, we want an animated transition + mWorkspace.moveToDefaultScreen(alreadyOnHome && + (LauncherApplication.isScreenXLarge() || !allAppsVisible)); } closeAllApps(alreadyOnHome && allAppsVisible); hideCustomizationDrawer(); @@ -2409,6 +2415,7 @@ public final class Launcher extends Activity animate = false; } closeAllApps(animate); + mWorkspace.unshrink(animate); } } } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 26785c5..69a8686 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -1149,16 +1149,22 @@ public class Workspace extends ViewGroup // We call this when we trigger an unshrink by clicking on the CellLayout cl private void unshrink(CellLayout clThatWasClicked) { + int newCurrentScreen = mCurrentScreen; + final int screenCount = getChildCount(); + for (int i = 0; i < screenCount; i++) { + if (getChildAt(i) == clThatWasClicked) { + newCurrentScreen = i; + } + } + unshrink(newCurrentScreen); + } + + private void unshrink(int newCurrentScreen) { if (mIsSmall) { - int newCurrentScreen = mCurrentScreen; + int delta = (newCurrentScreen - mCurrentScreen)*getWidth(); + final int screenCount = getChildCount(); for (int i = 0; i < screenCount; i++) { - if (getChildAt(i) == clThatWasClicked) { - newCurrentScreen = i; - } - } - final int delta = (newCurrentScreen - mCurrentScreen)*getWidth(); - for (int i = 0; i < screenCount; i++) { CellLayout cl = (CellLayout) getChildAt(i); cl.setX(cl.getX() + delta); } @@ -1169,20 +1175,32 @@ public class Workspace extends ViewGroup } } - public void unshrink() { + void unshrink() { + unshrink(true); + } + + void unshrink(boolean animated) { if (mIsSmall) { Sequencer s = new Sequencer(); final int screenCount = getChildCount(); + + final int duration = getResources().getInteger(R.integer.config_workspaceUnshrinkTime); for (int i = 0; i < screenCount; i++) { final CellLayout cl = (CellLayout)getChildAt(i); - final int duration = - getResources().getInteger(R.integer.config_workspaceUnshrinkTime); - s.playTogether( - new PropertyAnimator(duration, cl, "translationX", 0.0f), - new PropertyAnimator(duration, cl, "translationY", 0.0f), - new PropertyAnimator(duration, cl, "scaleX", 1.0f), - new PropertyAnimator(duration, cl, "scaleY", 1.0f), - new PropertyAnimator(duration, cl, "dimmedBitmapAlpha", 0.0f)); + if (animated) { + s.playTogether( + new PropertyAnimator(duration, cl, "translationX", 0.0f), + new PropertyAnimator(duration, cl, "translationY", 0.0f), + new PropertyAnimator(duration, cl, "scaleX", 1.0f), + new PropertyAnimator(duration, cl, "scaleY", 1.0f), + new PropertyAnimator(duration, cl, "dimmedBitmapAlpha", 0.0f)); + } else { + cl.setTranslationX(0.0f); + cl.setTranslationY(0.0f); + cl.setScaleX(1.0f); + cl.setScaleY(1.0f); + cl.setDimmedBitmapAlpha(0.0f); + } } s.addListener(mUnshrinkAnimationListener); s.start(); @@ -1830,7 +1848,11 @@ public class Workspace extends ViewGroup void moveToDefaultScreen(boolean animate) { if (animate) { - snapToScreen(mDefaultScreen); + if (mIsSmall) { + unshrink(mDefaultScreen); + } else { + snapToScreen(mDefaultScreen); + } } else { setCurrentScreen(mDefaultScreen); } |