summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/Launcher.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-06-02 10:49:29 -0700
committerWinson Chung <winsonc@google.com>2011-06-08 16:42:03 -0700
commitb26f3d6a8c62e7c1a603b6c7979375d8dd4f20d4 (patch)
tree9dadb1d6bbfdd26d57fbf579748b9445c8074113 /src/com/android/launcher2/Launcher.java
parentc0dcf597084d00e4c23a7fea5fd0738f6c095a6b (diff)
downloadandroid_packages_apps_Trebuchet-b26f3d6a8c62e7c1a603b6c7979375d8dd4f20d4.tar.gz
android_packages_apps_Trebuchet-b26f3d6a8c62e7c1a603b6c7979375d8dd4f20d4.tar.bz2
android_packages_apps_Trebuchet-b26f3d6a8c62e7c1a603b6c7979375d8dd4f20d4.zip
Modifying AppsCustomize behaviour to use springloaded mode.
Change-Id: I21d181ad3d245731ee8402915f8918b91bfc4553
Diffstat (limited to 'src/com/android/launcher2/Launcher.java')
-rw-r--r--src/com/android/launcher2/Launcher.java66
1 files changed, 30 insertions, 36 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 22ce003f4..b9c2f0956 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -168,7 +168,7 @@ public final class Launcher extends Activity
/** The different states that Launcher can be in. */
private enum State { WORKSPACE, APPS_CUSTOMIZE, ALL_APPS, CUSTOMIZE,
- CUSTOMIZE_SPRING_LOADED, ALL_APPS_SPRING_LOADED };
+ APPS_CUSTOMIZE_SPRING_LOADED };
private State mState = State.WORKSPACE;
private AnimatorSet mStateAnimation;
@@ -2667,7 +2667,16 @@ public final class Launcher extends Activity
setPivotsForZoom(toView, toState, scale);
if (toAllApps) {
- if (!springLoaded) {
+ if (springLoaded) {
+ if (toState == State.APPS_CUSTOMIZE) {
+ // Shrink workspaces away if going back to AppsCustomize from spring loaded mode
+ mWorkspace.shrink(ShrinkState.BOTTOM_HIDDEN, animated);
+ } else {
+ // Shrink workspaces to bottom if going back to AllApps from spring loaded mode
+ mWorkspace.shrink(ShrinkState.BOTTOM_VISIBLE, animated);
+ }
+ } else {
+ // Shrink workspaces away if going to AllApps/AppsCustomize from workspace
mWorkspace.shrink(ShrinkState.BOTTOM_HIDDEN, animated);
if (LauncherApplication.isScreenLarge()) {
@@ -2675,10 +2684,9 @@ public final class Launcher extends Activity
// controls when it should hide/show the mini workspaces
mAllAppsPagedView.resetSuccessfulDropFlag();
}
- } else {
- mWorkspace.shrink(ShrinkState.BOTTOM_VISIBLE, animated);
}
} else {
+ // In Customize mode, shrink the workspaces to the top
mWorkspace.shrink(ShrinkState.TOP, animated);
}
@@ -2897,39 +2905,25 @@ public final class Launcher extends Activity
}
void enterSpringLoadedDragMode(CellLayout layout) {
+ // Enter spring loaded mode on a new layout
mWorkspace.enterSpringLoadedDragMode(layout);
- if (mState == State.ALL_APPS || mState == State.APPS_CUSTOMIZE) {
- mState = State.ALL_APPS_SPRING_LOADED;
- if (LauncherApplication.isScreenLarge()) {
- cameraZoomIn(State.ALL_APPS, true, true);
- } else {
- cameraZoomIn(State.APPS_CUSTOMIZE, true, true);
- }
- } else if (mState == State.CUSTOMIZE) {
- mState = State.CUSTOMIZE_SPRING_LOADED;
- cameraZoomIn(State.CUSTOMIZE, true, true);
- }/* else {
- // we're already in spring loaded mode; don't do anything
- }*/
+
+ if (mState == State.APPS_CUSTOMIZE) {
+ mState = State.APPS_CUSTOMIZE_SPRING_LOADED;
+ cameraZoomIn(State.APPS_CUSTOMIZE, true, true);
+ } else {
+ // Do nothing
+ }
}
void exitSpringLoadedDragMode() {
- if (mState == State.ALL_APPS_SPRING_LOADED) {
- mWorkspace.exitSpringLoadedDragMode(Workspace.ShrinkState.BOTTOM_VISIBLE);
- if (LauncherApplication.isScreenLarge()) {
- cameraZoomOut(State.ALL_APPS, true, true);
- mState = State.ALL_APPS;
- } else {
- cameraZoomOut(State.APPS_CUSTOMIZE, true, true);
- mState = State.APPS_CUSTOMIZE;
- }
- } else if (mState == State.CUSTOMIZE_SPRING_LOADED) {
- mWorkspace.exitSpringLoadedDragMode(Workspace.ShrinkState.TOP);
- cameraZoomOut(State.CUSTOMIZE, true, true);
- mState = State.CUSTOMIZE;
- }/* else {
- // we're not in spring loaded mode; don't do anything
- }*/
+ if (mState == State.APPS_CUSTOMIZE_SPRING_LOADED) {
+ mWorkspace.exitSpringLoadedDragMode(Workspace.ShrinkState.BOTTOM_HIDDEN);
+ cameraZoomOut(State.APPS_CUSTOMIZE, true, true);
+ mState = State.APPS_CUSTOMIZE;
+ } else {
+ // Do nothing
+ }
}
void showAllApps(boolean animated) {
@@ -3001,7 +2995,7 @@ public final class Launcher extends Activity
*/
void closeAllApps(boolean animated) {
if (LauncherApplication.isScreenLarge()) {
- if (mState == State.ALL_APPS || mState == State.ALL_APPS_SPRING_LOADED) {
+ if (mState == State.ALL_APPS) {
mWorkspace.setVisibility(View.VISIBLE);
cameraZoomIn(State.ALL_APPS, animated, false);
@@ -3009,7 +3003,7 @@ public final class Launcher extends Activity
findViewById(R.id.all_apps_button).requestFocus();
}
} else {
- if (mState == State.APPS_CUSTOMIZE || mState == State.ALL_APPS_SPRING_LOADED) {
+ if (mState == State.APPS_CUSTOMIZE || mState == State.APPS_CUSTOMIZE_SPRING_LOADED) {
mWorkspace.setVisibility(View.VISIBLE);
cameraZoomIn(State.APPS_CUSTOMIZE, animated, false);
@@ -3045,7 +3039,7 @@ public final class Launcher extends Activity
// Hide the customization drawer (only exists in x-large configuration)
void hideCustomizationDrawer(boolean animated) {
- if (mState == State.CUSTOMIZE || mState == State.CUSTOMIZE_SPRING_LOADED) {
+ if (mState == State.CUSTOMIZE) {
cameraZoomIn(State.CUSTOMIZE, animated, false);
// Set focus to the customize button