diff options
-rw-r--r-- | src/com/android/launcher2/CustomizePagedView.java | 41 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 22 |
2 files changed, 18 insertions, 45 deletions
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java index f832b62..cc21276 100644 --- a/src/com/android/launcher2/CustomizePagedView.java +++ b/src/com/android/launcher2/CustomizePagedView.java @@ -334,35 +334,18 @@ public class CustomizePagedView extends PagedView } if (enterChoiceMode) { - if (v instanceof Checkable) { - final Checkable c = (Checkable) v; - final boolean wasChecked = c.isChecked(); - resetCheckedGrandchildren(); - c.setChecked(!wasChecked); - - // End the current choice mode when we have no items selected - /*if (!c.isChecked()) { - endChoiceMode(); - } else if (isChoiceMode(CHOICE_MODE_NONE)) { - endChoiceMode(); - startChoiceMode(CHOICE_MODE_SINGLE, this); - }*/ - mChoiceMode = CHOICE_MODE_SINGLE; - - Workspace w = mLauncher.getWorkspace(); - int currentWorkspaceScreen = mLauncher.getCurrentWorkspaceScreen(); - final CellLayout cl = (CellLayout)w.getChildAt(currentWorkspaceScreen); - cl.setHover(true); - - animateClickFeedback(v, new Runnable() { - @Override - public void run() { - cl.setHover(false); - mLauncher.onWorkspaceClick(cl); - mChoiceMode = CHOICE_MODE_NONE; - } - }); - } + final ItemInfo itemInfo = (ItemInfo) v.getTag(); + + Workspace w = mLauncher.getWorkspace(); + int currentWorkspaceScreen = mLauncher.getCurrentWorkspaceScreen(); + final CellLayout cl = (CellLayout)w.getChildAt(currentWorkspaceScreen); + + animateClickFeedback(v, new Runnable() { + @Override + public void run() { + mLauncher.addExternalItemToScreen(itemInfo, cl); + } + }); return; } diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 6fcf432..2688e54 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -2669,24 +2669,14 @@ public final class Launcher extends Activity } } - void onWorkspaceClick(CellLayout layout) { - Object itemInfo = mAllAppsPagedView.getChosenItem(); - if (itemInfo == null) { - itemInfo = mCustomizePagedView.getChosenItem(); + void addExternalItemToScreen(ItemInfo itemInfo, CellLayout layout) { + if (!mWorkspace.addExternalItemToScreen(itemInfo, layout)) { + showOutOfSpaceMessage(); } + } - if (itemInfo == null) { - // No items are chosen in All Apps or Customize, so just zoom into the workspace - showWorkspace(true, layout); - } else { - // Act as if the chosen item was dropped on the given CellLayout - if (mWorkspace.addExternalItemToScreen(itemInfo, layout)) { - mAllAppsPagedView.endChoiceMode(); - mCustomizePagedView.endChoiceMode(); - } else { - showOutOfSpaceMessage(); - } - } + void onWorkspaceClick(CellLayout layout) { + showWorkspace(true, layout); } private void updateButtonWithIconFromExternalActivity( |