summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2015-05-15 16:29:45 -0700
committerHyunyoung Song <hyunyoungs@google.com>2015-05-15 16:29:45 -0700
commitb790083b8f757e6d73b92460e6447acbf5490654 (patch)
tree5394c034f39dca4caa1e6617d8b0cfb3ebfbe33e
parente3a1df20e6aa68175109c0bceb8cbf4b7fe80978 (diff)
downloadandroid_packages_apps_Trebuchet-b790083b8f757e6d73b92460e6447acbf5490654.tar.gz
android_packages_apps_Trebuchet-b790083b8f757e6d73b92460e6447acbf5490654.tar.bz2
android_packages_apps_Trebuchet-b790083b8f757e6d73b92460e6447acbf5490654.zip
Transition from back to showing widget tray if shortcut/Widget configure activity
was cancelled. Recent refactoring of the State inside Launcher introduced a check of which state can show widget tray (only workspace) that was too agressive. b/21201908 Change-Id: Iaccb44d23485aa101d7720b29335645a74f4dcdc
-rw-r--r--src/com/android/launcher3/Launcher.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 72472b9f4..a828b1a42 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -809,7 +809,7 @@ public class Launcher extends Activity
}
boolean isWidgetDrop = (requestCode == REQUEST_PICK_APPWIDGET ||
- requestCode == REQUEST_CREATE_APPWIDGET);
+ requestCode == REQUEST_CREATE_APPWIDGET || requestCode == REQUEST_CREATE_SHORTCUT);
final boolean workspaceLocked = isWorkspaceLocked();
// We have special handling for widgets
@@ -3447,10 +3447,19 @@ public class Launcher extends Activity
/**
* Sets up the transition to show the apps/widgets view.
+ *
+ * @return whether the current from and to state allowed this operation
*/
- private void showAppsOrWidgets(boolean animated, State toState) {
- if (mState != State.WORKSPACE) return;
- if (toState != State.APPS && toState != State.WIDGETS) return;
+ // TODO: calling method should use the return value so that when {@code false} is returned
+ // the workspace transition doesn't fall into invalid state.
+ private boolean showAppsOrWidgets(boolean animated, State toState) {
+ if (mState != State.WORKSPACE && mState != State.APPS_SPRING_LOADED &&
+ mState != State.WIDGETS_SPRING_LOADED) {
+ return false;
+ }
+ if (toState != State.APPS && toState != State.WIDGETS) {
+ return false;
+ }
if (toState == State.APPS) {
mStateTransitionAnimation.startAnimationToAllApps(animated);
@@ -3472,6 +3481,7 @@ public class Launcher extends Activity
// Send an accessibility event to announce the context change
getWindow().getDecorView()
.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+ return true;
}
/**