diff options
author | Michael Jurka <mikejurka@google.com> | 2010-08-20 00:41:17 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2010-08-23 15:26:14 -0700 |
commit | 01f0ed4126be412c8c4352026dad3b2a49832267 (patch) | |
tree | 858a9f6c2c14c06550588249beda3cffa4288808 /src | |
parent | 7898466dc0b4d6850fd6f7ad0af5d92ed2c0fa79 (diff) | |
download | android_packages_apps_Trebuchet-01f0ed4126be412c8c4352026dad3b2a49832267.tar.gz android_packages_apps_Trebuchet-01f0ed4126be412c8c4352026dad3b2a49832267.tar.bz2 android_packages_apps_Trebuchet-01f0ed4126be412c8c4352026dad3b2a49832267.zip |
pressing home twice shows small overview mode
Change-Id: If5a6c0942685cd52ef77562dd342f28e16ae571c
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 17 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 21 |
2 files changed, 28 insertions, 10 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 6b00742f8..c4bb69ef9 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -1,3 +1,4 @@ + /* * Copyright (C) 2008 The Android Open Source Project * @@ -1110,16 +1111,20 @@ public final class Launcher extends Activity boolean alreadyOnHome = ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); boolean allAppsVisible = isAllAppsVisible(); + boolean customizationDrawerVisible = isCustomizationDrawerVisible(); + // in all these cases, only animate if we're already on home if (LauncherApplication.isScreenXLarge()) { - mWorkspace.unshrink(alreadyOnHome); - } - if (!mWorkspace.isDefaultScreenShowing()) { + if (alreadyOnHome && !mWorkspace.isSmall() && + !allAppsVisible && !customizationDrawerVisible) { + mWorkspace.shrinkToMiddle(); + } else { + mWorkspace.unshrink(alreadyOnHome); + } + } else if (!mWorkspace.isDefaultScreenShowing()) { // 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)); + mWorkspace.moveToDefaultScreen(alreadyOnHome && !allAppsVisible); } closeAllApps(alreadyOnHome && allAppsVisible); hideCustomizationDrawer(); diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 5d75c0f6a..73eaeab9e 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -70,6 +70,9 @@ public class Workspace extends ViewGroup // This is how much the workspace shrinks when we enter all apps or // customization mode private static final float SHRINK_FACTOR = 0.16f; + private static final int SHRINK_TO_TOP = 0; + private static final int SHRINK_TO_MIDDLE = 1; + private static final int SHRINK_TO_BOTTOM = 2; /** * The velocity at which a fling gesture will cause us to snap to the next @@ -1061,8 +1064,16 @@ public class Workspace extends ViewGroup return true; } + public boolean isSmall() { + return mIsSmall; + } + void shrinkToTop() { - shrink(true, true); + shrink(SHRINK_TO_TOP, true); + } + + void shrinkToMiddle() { + shrink(SHRINK_TO_MIDDLE, true); } void shrinkToBottom() { @@ -1077,12 +1088,12 @@ public class Workspace extends ViewGroup // to get our width so we can layout the mini-screen views correctly mWaitingToShrinkToBottom = true; } else { - shrink(false, animated); + shrink(SHRINK_TO_BOTTOM, animated); } } // we use this to shrink the workspace for the all apps view and the customize view - private void shrink(boolean shrinkToTop, boolean animated) { + private void shrink(int shrinkPosition, boolean animated) { mIsSmall = true; final Resources res = getResources(); final int screenWidth = getWidth(); @@ -1095,8 +1106,10 @@ public class Workspace extends ViewGroup float totalWidth = screenCount * scaledScreenWidth + (screenCount - 1) * scaledSpacing; float newY = getResources().getDimension(R.dimen.smallScreenVerticalMargin); - if (!shrinkToTop) { + if (shrinkPosition == SHRINK_TO_BOTTOM) { newY = screenHeight - newY - scaledScreenHeight; + } else if (shrinkPosition == SHRINK_TO_MIDDLE) { + newY = screenHeight / 2 - scaledScreenHeight / 2; } // We animate all the screens to the centered position in workspace |