From 3125d9dec8709a6c95039c7b35d27494da46eaab Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Mon, 27 Sep 2010 11:30:20 -0700 Subject: Making the CAB text match the type of item selected in customization mode. --- src/com/android/launcher2/AllAppsPagedView.java | 2 +- src/com/android/launcher2/CustomizePagedView.java | 29 ++++++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java index 3c394741c..3fb167986 100644 --- a/src/com/android/launcher2/AllAppsPagedView.java +++ b/src/com/android/launcher2/AllAppsPagedView.java @@ -417,7 +417,7 @@ public class AllAppsPagedView extends PagedView @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { - mode.setTitle(R.string.cab_selection_text); + mode.setTitle(R.string.cab_app_selection_text); // Until the workspace has a selection mode and the CAB supports drag-and-drop, we // take a hybrid approach: grab the views from the workspace and stuff them into the CAB. diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java index f6cff05ed..f55b46e26 100644 --- a/src/com/android/launcher2/CustomizePagedView.java +++ b/src/com/android/launcher2/CustomizePagedView.java @@ -124,6 +124,8 @@ public class CustomizePagedView extends PagedView private static final int sMinWidgetCellHSpan = 2; private static final int sMaxWidgetCellHSpan = 4; + private int mChoiceModeTitleText; + // The scale factor for widget previews inside the widget drawer private static final float sScaleFactor = 0.75f; @@ -336,15 +338,29 @@ public class CustomizePagedView extends PagedView // On certain pages, we allow single tap to mark items as selected so that they can be // dropped onto the mini workspaces + boolean enterChoiceMode = false; switch (mCustomizationType) { case WidgetCustomization: + mChoiceModeTitleText = R.string.cab_widget_selection_text; + enterChoiceMode = true; + break; case ApplicationCustomization: + mChoiceModeTitleText = R.string.cab_app_selection_text; + enterChoiceMode = true; + break; case FolderCustomization: + mChoiceModeTitleText = R.string.cab_folder_selection_text; + enterChoiceMode = true; + break; case ShortcutCustomization: - if (isChoiceMode(CHOICE_MODE_NONE)) { - startChoiceMode(CHOICE_MODE_SINGLE, this); - } + mChoiceModeTitleText = R.string.cab_shortcut_selection_text; + enterChoiceMode = true; + break; + default: + break; + } + if (enterChoiceMode) { if (v instanceof Checkable) { final Checkable c = (Checkable) v; final boolean wasChecked = c.isChecked(); @@ -354,11 +370,12 @@ public class CustomizePagedView extends PagedView // 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); } } return; - default: - break; } // Otherwise, we just handle the single click here @@ -798,7 +815,7 @@ public class CustomizePagedView extends PagedView @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { - mode.setTitle(R.string.cab_selection_text); + mode.setTitle(mChoiceModeTitleText); return true; } -- cgit v1.2.3