When an app is chosen in All Apps, tapping a workspace screen adds it to that screen.
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 53661fa..a6f0a0e 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -213,7 +213,9 @@
private HandleView mHandleView;
private AllAppsView mAllAppsGrid;
private TabHost mHomeCustomizationDrawer;
- private CustomizePagedView mCustomizePagedView;
+
+ private PagedView mAllAppsPagedView = null;
+ private CustomizePagedView mCustomizePagedView = null;
private Bundle mSavedState;
@@ -2404,6 +2406,9 @@
final View fromView =
(fromState == State.ALL_APPS) ? (View) mAllAppsGrid : mHomeCustomizationDrawer;
+ mCustomizePagedView.endChoiceMode();
+ mAllAppsPagedView.endChoiceMode();
+
setPivotsForZoom(fromView, fromState, scaleFactor);
mWorkspace.unshrink(animated);
@@ -2461,6 +2466,9 @@
final float toViewStartY = fromAllApps ? workspaceHeight * 2 : -toView.getHeight() * 2;
final float toViewEndY = fromAllApps ? workspaceHeight - toView.getHeight() : 0.0f;
+ mCustomizePagedView.endChoiceMode();
+ mAllAppsPagedView.endChoiceMode();
+
if (toState == State.ALL_APPS) {
mWorkspace.shrinkToBottom(animated);
} else {
@@ -2603,13 +2611,28 @@
}
}
- void onWorkspaceUnshrink() {
- final boolean animated = true;
- if (isAllAppsVisible()) {
- closeAllApps(animated);
+ void onWorkspaceClick(CellLayout layout) {
+ Object itemInfo = mAllAppsPagedView.getChosenItem();
+ if (itemInfo == null) {
+ itemInfo = mCustomizePagedView.getChosenItem();
}
- if (isCustomizationDrawerVisible()) {
- hideCustomizationDrawer(animated);
+
+ if (itemInfo == null) {
+ // No items are chosen in All Apps or Customize, so just zoom into the workspace
+ mWorkspace.unshrink(layout);
+ if (isAllAppsVisible()) {
+ closeAllApps(true);
+ } else if (isCustomizationDrawerVisible()) {
+ hideCustomizationDrawer(true);
+ }
+ } else {
+ // Act as if the chosen item was dropped on the given CellLayout
+ if (mWorkspace.addExternalItemToScreen(itemInfo, layout)) {
+ mAllAppsPagedView.endChoiceMode();
+ mCustomizePagedView.endChoiceMode();
+ } else {
+ Toast.makeText(this, getString(R.string.out_of_space), Toast.LENGTH_SHORT).show();
+ }
}
}
@@ -2800,6 +2823,10 @@
}
}
+ void setAllAppsPagedView(PagedView view) {
+ mAllAppsPagedView = view;
+ }
+
/**
* Refreshes the shortcuts shown on the workspace.
*