am f40e4dd: AI 148147: Import lots of zh_TW translation changes.

Merge commit 'f40e4dd1cfb1d1faccd3b28ff8b92fce714a0c7c' into donut

* commit 'f40e4dd1cfb1d1faccd3b28ff8b92fce714a0c7c':
  AI 148147: Import lots of zh_TW translation changes.
diff --git a/res/drawable/search_button_bg.9.png b/res/drawable/search_button_bg.9.png
new file mode 100644
index 0000000..b140b24
--- /dev/null
+++ b/res/drawable/search_button_bg.9.png
Binary files differ
diff --git a/res/drawable/search_button_voice.png b/res/drawable/search_button_voice.png
new file mode 100644
index 0000000..4c3d683
--- /dev/null
+++ b/res/drawable/search_button_voice.png
Binary files differ
diff --git a/res/drawable/search_floater.9.png b/res/drawable/search_floater.9.png
new file mode 100644
index 0000000..a2007ad
--- /dev/null
+++ b/res/drawable/search_floater.9.png
Binary files differ
diff --git a/res/drawable/textfield_searchwidget.xml b/res/drawable/textfield_searchwidget.xml
new file mode 100644
index 0000000..80f3dca
--- /dev/null
+++ b/res/drawable/textfield_searchwidget.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    
+   <item android:state_window_focused="false" android:state_enabled="true"
+        android:drawable="@drawable/textfield_searchwidget_default" />
+    
+    <item android:state_pressed="true"
+        android:drawable="@drawable/textfield_searchwidget_pressed" />
+    
+    <item android:state_enabled="true" android:state_focused="true"
+        android:drawable="@drawable/textfield_searchwidget_selected" />
+    
+    <item android:state_enabled="true"
+        android:drawable="@drawable/textfield_searchwidget_default" />
+    
+</selector>
diff --git a/res/drawable/textfield_searchwidget_default.9.png b/res/drawable/textfield_searchwidget_default.9.png
new file mode 100644
index 0000000..247abca
--- /dev/null
+++ b/res/drawable/textfield_searchwidget_default.9.png
Binary files differ
diff --git a/res/drawable/textfield_searchwidget_pressed.9.png b/res/drawable/textfield_searchwidget_pressed.9.png
new file mode 100644
index 0000000..d628cbc
--- /dev/null
+++ b/res/drawable/textfield_searchwidget_pressed.9.png
Binary files differ
diff --git a/res/drawable/textfield_searchwidget_selected.9.png b/res/drawable/textfield_searchwidget_selected.9.png
new file mode 100644
index 0000000..9e93527
--- /dev/null
+++ b/res/drawable/textfield_searchwidget_selected.9.png
Binary files differ
diff --git a/res/layout-land/live_folder_grid.xml b/res/layout-land/live_folder_grid.xml
index d1b02a4..bb623b0 100644
--- a/res/layout-land/live_folder_grid.xml
+++ b/res/layout-land/live_folder_grid.xml
@@ -36,6 +36,7 @@
     	android:layout_height="0dip"
     	android:layout_weight="1"
             
+        android:cacheColorHint="#ff333333"
         android:background="@drawable/box_launcher_bottom"
 
         android:scrollbarAlwaysDrawVerticalTrack="true"
diff --git a/res/layout-land/user_folder.xml b/res/layout-land/user_folder.xml
index 61f859e..fbf337b 100644
--- a/res/layout-land/user_folder.xml
+++ b/res/layout-land/user_folder.xml
@@ -33,6 +33,7 @@
     	android:layout_height="0dip"
     	android:layout_weight="1"
             
+        android:cacheColorHint="#ff333333"
         android:background="@drawable/box_launcher_bottom"
 
         android:scrollbarAlwaysDrawVerticalTrack="true"
diff --git a/res/layout-port/live_folder_grid.xml b/res/layout-port/live_folder_grid.xml
index ec32d41..e5bcafe 100644
--- a/res/layout-port/live_folder_grid.xml
+++ b/res/layout-port/live_folder_grid.xml
@@ -36,6 +36,7 @@
     	android:layout_height="0dip"
     	android:layout_weight="1"
 
+        android:cacheColorHint="#ff333333"
         android:background="@drawable/box_launcher_bottom"
 
         android:scrollbarAlwaysDrawVerticalTrack="true"
diff --git a/res/layout-port/user_folder.xml b/res/layout-port/user_folder.xml
index 5795aea..27d70fc 100644
--- a/res/layout-port/user_folder.xml
+++ b/res/layout-port/user_folder.xml
@@ -33,6 +33,7 @@
     	android:layout_height="0dip"
     	android:layout_weight="1"
 
+        android:cacheColorHint="#ff333333"
         android:background="@drawable/box_launcher_bottom"
 
         android:scrollbarAlwaysDrawVerticalTrack="true"
diff --git a/res/layout/live_folder_list.xml b/res/layout/live_folder_list.xml
index 1d32f88..f96a190 100644
--- a/res/layout/live_folder_list.xml
+++ b/res/layout/live_folder_list.xml
@@ -36,7 +36,7 @@
     	android:layout_height="0dip"
     	android:layout_weight="1"
 
-        android:cacheColorHint="#00000000"
+        android:cacheColorHint="#ff333333"
         android:background="@drawable/box_launcher_bottom" />
 
 </com.android.launcher.LiveFolder>
diff --git a/res/layout/widget_search.xml b/res/layout/widget_search.xml
index 1db8488..841b155 100644
--- a/res/layout/widget_search.xml
+++ b/res/layout/widget_search.xml
@@ -14,52 +14,47 @@
      limitations under the License.
 -->
 
-<com.android.launcher.Search xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.launcher.Search 
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+    android:id="@+id/widget_search"  
     android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:orientation="horizontal"
-    android:background="@drawable/search_bg"
-    android:gravity="center_vertical"
-    >
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:gravity="top">
 
-    <ImageView
-        android:layout_width="wrap_content"
+    <LinearLayout
+        android:id="@+id/search_plate"
+        android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        android:paddingRight="3dip"
-        android:src="@drawable/google_logo" />
-        
-    <com.android.launcher.SearchAutoCompleteTextView
-        android:id="@+id/input"
-        android:layout_width="0dip"
-        android:layout_weight="1"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="1dip"
-        android:hint="@string/search_hint"
-        android:focusableInTouchMode="false"
-        android:singleLine="true"
-        android:selectAllOnFocus="true"
-        android:completionThreshold="1"
-        android:inputType="textAutoComplete"
-        android:imeOptions="actionSearch"
-        android:lines="1"
-        android:dropDownWidth="fill_parent"
-        android:popupBackground="@drawable/spinner_dropdown_background"
+        android:orientation="horizontal"
+        android:paddingLeft="12dip"
+        android:paddingRight="12dip"
+        android:paddingTop="7dip"
+        android:paddingBottom="13dip"
+        android:background="@drawable/search_floater" >
+
+        <TextView
+            android:id="@+id/search_src_text"
+            android:layout_width="0dip"
+            android:layout_height="wrap_content"
+            android:layout_weight="1.0"
+            android:editable="false"
+            android:inputType="text"
+            android:background="@drawable/textfield_searchwidget"
+            android:textAppearance="?android:attr/textAppearanceMediumInverse"
+            android:textColor="@android:color/primary_text_light"
         />
         
-     <ImageButton android:id="@+id/search_go_btn"
-         android:layout_marginLeft="5dip"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:src="@*android:drawable/ic_btn_search"
-         style="@style/SearchButton"
-         />
-    
-     <ImageButton android:id="@+id/search_voice_btn"
-         android:layout_marginLeft="4dip"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:src="@android:drawable/ic_btn_speak_now"
-         style="@style/SearchButton"
-         />
+        <ImageButton 
+            android:id="@+id/search_voice_btn"
+            android:layout_width="wrap_content"
+            android:layout_height="fill_parent"
+            android:layout_marginLeft="8dip"
+            android:background="@*android:drawable/btn_search_dialog_voice"
+            android:src="@*android:drawable/ic_btn_speak_now"
+        />
+
+    </LinearLayout>
 
 </com.android.launcher.Search>
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 7832ceb..f0cc369 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -26,20 +26,27 @@
     <string name="rename_action">"OK"</string>
     <string name="cancel_action">"Zrušit"</string>
     <string name="menu_item_add_item">"Přidat na plochu"</string>
-    <string name="group_applications">"Aplikace"</string>
-    <string name="group_shortcuts">"Klávesové zkratky"</string>
+    <!-- no translation found for group_applications (4118484163419674240) -->
+    <skip />
+    <!-- no translation found for group_shortcuts (9133529424900391877) -->
+    <skip />
     <string name="group_search">"Hledat"</string>
-    <string name="group_folder">"Nová složka"</string>
-    <string name="group_live_folders">"Složky"</string>
-    <string name="group_widgets">"Widgety"</string>
-    <string name="group_wallpapers">"Tapety"</string>
+    <!-- no translation found for group_folder (5143593791798929193) -->
+    <skip />
+    <!-- no translation found for group_live_folders (2664945399140647217) -->
+    <skip />
+    <!-- no translation found for group_widgets (6704978494073105844) -->
+    <skip />
+    <!-- no translation found for group_wallpapers (1568191644272224858) -->
+    <skip />
     <string name="add_folder">"Složka"</string>
     <string name="add_clock">"Hodiny"</string>
     <string name="add_photo_frame">"Rámeček fotografie"</string>
     <string name="add_search">"Vyhledávání"</string>
     <string name="out_of_space">"Na této ploše již není místo."</string>
     <string name="title_select_shortcut">"Vyberte zástupce"</string>
-    <string name="title_select_live_folder">"Vybrat složku"</string>
+    <!-- no translation found for title_select_live_folder (3753447798805166749) -->
+    <skip />
     <string name="menu_add">"Přidat"</string>
     <string name="menu_wallpaper">"Tapeta"</string>
     <string name="menu_search">"Hledat"</string>
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 9b39946..40f3cab 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -25,21 +25,28 @@
     <string name="rename_folder_title">"Ordner umbenennen"</string>
     <string name="rename_action">"OK"</string>
     <string name="cancel_action">"Abbrechen"</string>
-    <string name="menu_item_add_item">"Zum Startbildschirm hinzufügen"</string>
-    <string name="group_applications">"Anwendungen"</string>
-    <string name="group_shortcuts">"Verknüpfungen"</string>
+    <string name="menu_item_add_item">"Zur Startseite hinzufügen"</string>
+    <!-- no translation found for group_applications (4118484163419674240) -->
+    <skip />
+    <!-- no translation found for group_shortcuts (9133529424900391877) -->
+    <skip />
     <string name="group_search">"Suchen"</string>
-    <string name="group_folder">"Neuer Ordner"</string>
-    <string name="group_live_folders">"Ordner"</string>
-    <string name="group_widgets">"Widgets"</string>
-    <string name="group_wallpapers">"Hintergrundbilder"</string>
+    <!-- no translation found for group_folder (5143593791798929193) -->
+    <skip />
+    <!-- no translation found for group_live_folders (2664945399140647217) -->
+    <skip />
+    <!-- no translation found for group_widgets (6704978494073105844) -->
+    <skip />
+    <!-- no translation found for group_wallpapers (1568191644272224858) -->
+    <skip />
     <string name="add_folder">"Ordner"</string>
     <string name="add_clock">"Uhr"</string>
     <string name="add_photo_frame">"Bildrahmen"</string>
     <string name="add_search">"Suchen"</string>
-    <string name="out_of_space">"Auf dem Startbildschirm ist kein Platz mehr vorhanden."</string>
+    <string name="out_of_space">"Auf der Startseite ist kein Platz mehr vorhanden."</string>
     <string name="title_select_shortcut">"Tastenkürzel auswählen"</string>
-    <string name="title_select_live_folder">"Ordner auswählen"</string>
+    <!-- no translation found for title_select_live_folder (3753447798805166749) -->
+    <skip />
     <string name="menu_add">"Hinzufügen"</string>
     <string name="menu_wallpaper">"Hintergrund"</string>
     <string name="menu_search">"Suchen"</string>
diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml
new file mode 100644
index 0000000..221ab86
--- /dev/null
+++ b/res/values-es-rUS/strings.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <string name="application_name">"Página principal"</string>
+    <string name="folder_name">"Carpeta"</string>
+    <string name="chooser_wallpaper">"Seleccionar papel tapiz desde"</string>
+    <string name="wallpaper_instructions">"Definir papel tapiz"</string>
+    <string name="pick_wallpaper">"Galería de papel tapiz"</string>
+    <string name="activity_not_found">"La aplicación no está instalada en tu computadora."</string>
+    <string name="rename_folder_label">"Nombre de carpeta"</string>
+    <string name="rename_folder_title">"Cambiar nombre de carpeta"</string>
+    <string name="rename_action">"Aceptar"</string>
+    <string name="cancel_action">"Cancelar"</string>
+    <string name="menu_item_add_item">"Agregar a la pantalla Página principal"</string>
+    <!-- no translation found for group_applications (4118484163419674240) -->
+    <skip />
+    <!-- no translation found for group_shortcuts (9133529424900391877) -->
+    <skip />
+    <string name="group_search">"Buscar"</string>
+    <!-- no translation found for group_folder (5143593791798929193) -->
+    <skip />
+    <!-- no translation found for group_live_folders (2664945399140647217) -->
+    <skip />
+    <!-- no translation found for group_widgets (6704978494073105844) -->
+    <skip />
+    <!-- no translation found for group_wallpapers (1568191644272224858) -->
+    <skip />
+    <string name="add_folder">"Carpeta"</string>
+    <string name="add_clock">"Reloj"</string>
+    <string name="add_photo_frame">"Marco de imagen"</string>
+    <string name="add_search">"Buscar"</string>
+    <string name="out_of_space">"No hay más espacio en esta pantalla de la página principal"</string>
+    <!-- no translation found for shortcut_installed (6623689857689040689) -->
+    <skip />
+    <!-- no translation found for shortcut_uninstalled (2758997515869993129) -->
+    <skip />
+    <!-- no translation found for shortcut_duplicate (4887186782641532074) -->
+    <skip />
+    <string name="title_select_shortcut">"Seleccionar acceso directo"</string>
+    <!-- no translation found for title_select_live_folder (3753447798805166749) -->
+    <skip />
+    <string name="menu_add">"Agregar"</string>
+    <string name="menu_wallpaper">"Papel tapiz"</string>
+    <string name="menu_search">"Buscar"</string>
+    <string name="menu_notifications">"Notificaciones"</string>
+    <string name="menu_settings">"Configuración"</string>
+    <string name="permlab_install_shortcut">"instalar accesos directos"</string>
+    <string name="permdesc_install_shortcut">"Permite a una aplicación agregar accesos directos sin intervención del usuario."</string>
+    <string name="permlab_uninstall_shortcut">"desinstalar papel tapiz"</string>
+    <string name="permdesc_uninstall_shortcut">"Permite a una aplicación suprimir accesos directos sin intervención del usuario."</string>
+    <string name="permlab_read_settings">"leer configuración y accesos directos de la página principal"</string>
+    <string name="permdesc_read_settings">"Permite a una aplicación leer la configuración y los accesos directos de la página principal."</string>
+    <string name="permlab_write_settings">"escribir configuración y accesos directos de la página principal"</string>
+    <string name="permdesc_write_settings">"Permite a una aplicación cambiar la configuración y los accesos directos de la página principal."</string>
+    <string name="search_hint">"Búsqueda de Google"</string>
+    <string name="gadget_error_text">"Problema al cargar el widget"</string>
+</resources>
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index e0f01be..7558565 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -36,12 +36,12 @@
     <string name="add_folder">"Dossier"</string>
     <string name="add_clock">"Horloge"</string>
     <string name="add_photo_frame">"Cadre d\'image"</string>
-    <string name="add_search">"Recherche"</string>
+    <string name="add_search">"Rechercher"</string>
     <string name="out_of_space">"Plus d\'espace libre sur l\'écran d\'accueil."</string>
     <string name="title_select_shortcut">"Sélectionner un raccourci"</string>
     <string name="title_select_live_folder">"Sélectionner le dossier"</string>
     <string name="menu_add">"Ajouter"</string>
-    <string name="menu_wallpaper">"Fond d\'écran"</string>
+    <string name="menu_wallpaper">"Arrière-plan"</string>
     <string name="menu_search">"Rechercher"</string>
     <string name="menu_notifications">"Notifications"</string>
     <string name="menu_settings">"Paramètres"</string>
diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
index e6815dd..954b5d7 100644
--- a/res/values-nb/strings.xml
+++ b/res/values-nb/strings.xml
@@ -26,20 +26,27 @@
     <string name="rename_action">"OK"</string>
     <string name="cancel_action">"Avbryt"</string>
     <string name="menu_item_add_item">"Legg til skrivebord"</string>
-    <string name="group_applications">"Applikasjoner"</string>
-    <string name="group_shortcuts">"Snarveier"</string>
+    <!-- no translation found for group_applications (4118484163419674240) -->
+    <skip />
+    <!-- no translation found for group_shortcuts (9133529424900391877) -->
+    <skip />
     <string name="group_search">"Søk"</string>
-    <string name="group_folder">"Ny mappe"</string>
-    <string name="group_live_folders">"Mapper"</string>
-    <string name="group_widgets">"Skrivebordselementer"</string>
-    <string name="group_wallpapers">"Bakgrunner"</string>
+    <!-- no translation found for group_folder (5143593791798929193) -->
+    <skip />
+    <!-- no translation found for group_live_folders (2664945399140647217) -->
+    <skip />
+    <!-- no translation found for group_widgets (6704978494073105844) -->
+    <skip />
+    <!-- no translation found for group_wallpapers (1568191644272224858) -->
+    <skip />
     <string name="add_folder">"Mappe"</string>
     <string name="add_clock">"Klokke"</string>
     <string name="add_photo_frame">"Bilderamme"</string>
     <string name="add_search">"Søk"</string>
     <string name="out_of_space">"Ikke nok plass på skrivebordet."</string>
     <string name="title_select_shortcut">"Velg snarvei"</string>
-    <string name="title_select_live_folder">"Velg mappe"</string>
+    <!-- no translation found for title_select_live_folder (3753447798805166749) -->
+    <skip />
     <string name="menu_add">"Legg til"</string>
     <string name="menu_wallpaper">"Bakgrunnsbilde"</string>
     <string name="menu_search">"Søk"</string>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 5574944..f9cb0c5 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -24,4 +24,5 @@
     <color name="delete_color_filter">#A5FF0000</color>
 
     <color name="appwidget_error_color">#fccc</color>
+    <color name="snag_callout_color">#f444</color>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b0421b2..db9e658 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -72,6 +72,12 @@
     <string name="add_search">Search</string>
     <!-- Error message when user has filled a home screen, possibly not used -->
     <string name="out_of_space">No more room on this Home screen.</string>
+    <!-- Message displayed when a shortcut is created by an external application -->
+    <string name="shortcut_installed">Shortcut \"%s\" is installed.</string>
+    <!-- Message displayed when a shortcut is uninstalled by an external application -->
+    <string name="shortcut_uninstalled">Shortcut \"%s\" was removed.</string>
+    <!-- Message displayed when an external application attemps to create a shortcut that already exists -->
+    <string name="shortcut_duplicate">Shortcut \"%s\" already exists.</string>
 
     <!-- Title of dialog when user is selecting shortcut to add to homescreen -->
     <string name="title_select_shortcut">Select shortcut</string>
diff --git a/res/xml/default_workspace.xml b/res/xml/default_workspace.xml
index ae2e2a6..2280b61 100644
--- a/res/xml/default_workspace.xml
+++ b/res/xml/default_workspace.xml
@@ -19,7 +19,7 @@
     <clock
         launcher:screen="2"
         launcher:x="1"
-        launcher:y="0" />
+        launcher:y="1" />
 
     <search
         launcher:screen="1"
diff --git a/src/com/android/launcher/CellLayout.java b/src/com/android/launcher/CellLayout.java
index 91f0420..fe6b193 100644
--- a/src/com/android/launcher/CellLayout.java
+++ b/src/com/android/launcher/CellLayout.java
@@ -174,7 +174,7 @@
                 final int yCount = portrait ? mLongAxisCells : mShortAxisCells;
 
                 final boolean[][] occupied = mOccupied;
-                findOccupiedCells(xCount, yCount, occupied);
+                findOccupiedCells(xCount, yCount, occupied, null);
 
                 cellInfo.cell = null;
                 cellInfo.cellX = cellXY[0];
@@ -215,7 +215,7 @@
             final int yCount = portrait ? mLongAxisCells : mShortAxisCells;
 
             final boolean[][] occupied = mOccupied;
-            findOccupiedCells(xCount, yCount, occupied);
+            findOccupiedCells(xCount, yCount, occupied, null);
 
             findIntersectingVacantCells(info, info.cellX, info.cellY, xCount, yCount, occupied);
 
@@ -315,7 +315,7 @@
         return true;
     }
 
-    CellInfo findAllVacantCells(boolean[] occupiedCells) {
+    CellInfo findAllVacantCells(boolean[] occupiedCells, View ignoreView) {
         final boolean portrait = mPortrait;
         final int xCount = portrait ? mShortAxisCells : mLongAxisCells;
         final int yCount = portrait ? mLongAxisCells : mShortAxisCells;
@@ -329,7 +329,7 @@
                 }
             }
         } else {
-            findOccupiedCells(xCount, yCount, occupied);
+            findOccupiedCells(xCount, yCount, occupied, ignoreView);
         }
 
         CellInfo cellInfo = new CellInfo();
@@ -527,64 +527,72 @@
         super.setChildrenDrawnWithCacheEnabled(enabled);
     }
 
-    boolean acceptChildDrop(int x, int y, int cellHSpan, int cellVSpan, View cell) {
-        int[] cellXY = mCellXY;
-        pointToCellRounded(x, y, cellXY);
-        int cellX = cellXY[0];
-        int cellY = cellXY[1];
-
-        return findCell(cellX, cellY, cellHSpan, cellVSpan, cell) == null;
-    }
-
     /**
-     * Finds the first View intersecting with the specified cell. If the cell is outside
-     * of the layout, this is returned.
-     *
-     * @param cellX The X location of the cell to test.
-     * @param cellY The Y location of the cell to test.
-     * @param cellHSpan The horizontal span of the cell to test.
-     * @param cellVSpan The vertical span of the cell to test.
-     * @param ignoreCell View to ignore during the test.
-     *
-     * @return Returns the first View intersecting with the specified cell, this if the cell
-     *         lies outside of this layout's grid or null if no View was found.
+     * Find a vacant area that will fit the given bounds nearest the requested
+     * cell location. Uses Euclidean distance to score multiple vacant areas.
+     * 
+     * @param cellX The X location of the desired location.
+     * @param cellY The Y location of the desired location.
+     * @param spanX Horizontal span of the object.
+     * @param spanY Vertical span of the object.
+     * @param vacantCells Pre-computed set of vacant cells to search.
+     * @param recycle Previously returned value to possibly recycle.
+     * @return The X, Y cell of a vacant area that can contain this object,
+     *         nearest the requested location.
      */
-    View findCell(int cellX, int cellY, int cellHSpan, int cellVSpan, View ignoreCell) {
-        if (cellX < 0 || cellX + cellHSpan > (mPortrait ? mShortAxisCells : mLongAxisCells) ||
-                cellY < 0 || cellY + cellVSpan > (mPortrait ? mLongAxisCells : mShortAxisCells)) {
-            return this;
+    int[] findNearestVacantArea(int pixelX, int pixelY, int spanX, int spanY,
+            CellInfo vacantCells, int[] recycle) {
+        
+        // Keep track of best-scoring drop area
+        final int[] bestXY = recycle != null ? recycle : new int[2];
+        final int[] cellXY = mCellXY;
+        double bestDistance = Double.MAX_VALUE;
+        
+        // Bail early if vacant cells aren't valid
+        if (!vacantCells.valid) {
+            return null;
         }
 
-        final int count = getChildCount();
-        for (int i = 0; i < count; i++) {
-            final View view = getChildAt(i);
-            if (view == ignoreCell) {
+        // Look across all vacant cells for best fit
+        final int size = vacantCells.vacantCells.size();
+        for (int i = 0; i < size; i++) {
+            final CellInfo.VacantCell cell = vacantCells.vacantCells.get(i);
+            
+            // Reject if vacant cell isn't our exact size
+            if (cell.spanX != spanX || cell.spanY != spanY) {
                 continue;
             }
-
-            final LayoutParams lp = (LayoutParams) view.getLayoutParams();
-            if (cellX < lp.cellX + lp.cellHSpan && lp.cellX < cellX + cellHSpan &&
-                    cellY < lp.cellY + lp.cellVSpan && lp.cellY < cellY + cellVSpan) {
-                return view;
+            
+            // Score is center distance from requested pixel
+            cellToPoint(cell.cellX, cell.cellY, cellXY);
+            
+            double distance = Math.sqrt(Math.pow(cellXY[0] - pixelX, 2) +
+                    Math.pow(cellXY[1] - pixelY, 2));
+            if (distance <= bestDistance) {
+                bestDistance = distance;
+                bestXY[0] = cell.cellX;
+                bestXY[1] = cell.cellY;
             }
         }
 
-        return null;
+        // Return null if no suitable location found 
+        if (bestDistance < Double.MAX_VALUE) {
+            return bestXY;
+        } else {
+            return null;
+        }
     }
-
+    
     /**
      * Drop a child at the specified position
      *
      * @param child The child that is being dropped
-     * @param cellX The child's new x location
-     * @param cellY The child's new y location
+     * @param targetXY Destination area to move to
      */
-    void onDropChild(View child, int cellX, int cellY) {
-        int[] cellXY = mCellXY;
-        pointToCellRounded(cellX, cellY, cellXY);
+    void onDropChild(View child, int[] targetXY) {
         LayoutParams lp = (LayoutParams) child.getLayoutParams();
-        lp.cellX = cellXY[0];
-        lp.cellY = cellXY[1];
+        lp.cellX = targetXY[0];
+        lp.cellY = targetXY[1];
         lp.isDragging = false;
         mDragRect.setEmpty();
         child.requestLayout();
@@ -688,7 +696,7 @@
         final int yCount = portrait ? mLongAxisCells : mShortAxisCells;
         final boolean[][] occupied = mOccupied;
 
-        findOccupiedCells(xCount, yCount, occupied);
+        findOccupiedCells(xCount, yCount, occupied, null);
 
         return findVacantCell(vacant, spanX, spanY, xCount, yCount, occupied);
     }
@@ -723,7 +731,7 @@
         final int yCount = portrait ? mLongAxisCells : mShortAxisCells;
         final boolean[][] occupied = mOccupied;
 
-        findOccupiedCells(xCount, yCount, occupied);
+        findOccupiedCells(xCount, yCount, occupied, null);
 
         final boolean[] flat = new boolean[xCount * yCount];
         for (int y = 0; y < yCount; y++) {
@@ -735,7 +743,7 @@
         return flat;
     }
 
-    private void findOccupiedCells(int xCount, int yCount, boolean[][] occupied) {
+    private void findOccupiedCells(int xCount, int yCount, boolean[][] occupied, View ignoreView) {
         for (int x = 0; x < xCount; x++) {
             for (int y = 0; y < yCount; y++) {
                 occupied[x][y] = false;
@@ -745,7 +753,7 @@
         int count = getChildCount();
         for (int i = 0; i < count; i++) {
             View child = getChildAt(i);
-            if (child instanceof Folder) {
+            if (child instanceof Folder || child.equals(ignoreView)) {
                 continue;
             }
             LayoutParams lp = (LayoutParams) child.getLayoutParams();
diff --git a/src/com/android/launcher/DeleteZone.java b/src/com/android/launcher/DeleteZone.java
index 7f92c23..02e8011 100644
--- a/src/com/android/launcher/DeleteZone.java
+++ b/src/com/android/launcher/DeleteZone.java
@@ -19,6 +19,7 @@
 import android.widget.ImageView;
 import android.content.Context;
 import android.content.res.TypedArray;
+import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.animation.TranslateAnimation;
@@ -77,6 +78,10 @@
             Object dragInfo) {
         return true;
     }
+    
+    public Rect estimateDropLocation(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo, Rect recycle) {
+        return null;
+    }
 
     public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo) {
         final ItemInfo item = (ItemInfo) dragInfo;
diff --git a/src/com/android/launcher/DragLayer.java b/src/com/android/launcher/DragLayer.java
index b542de6..b5b84b8 100644
--- a/src/com/android/launcher/DragLayer.java
+++ b/src/com/android/launcher/DragLayer.java
@@ -113,8 +113,25 @@
     private DropTarget mLastDropTarget;
 
     private final Paint mTrashPaint = new Paint();
+    private final Paint mEstimatedPaint = new Paint();
     private Paint mDragPaint;
 
+    /**
+     * If true, draw a "snag" showing where the object currently being dragged
+     * would end up if dropped from current location.
+     */
+    private static final boolean DRAW_TARGET_SNAG = false;
+
+    private Rect mEstimatedRect = new Rect();
+    private float[] mDragCenter = new float[2];
+    private float[] mEstimatedCenter = new float[2];
+    private boolean mDrawEstimated = false;
+
+    private int mTriggerWidth = -1;
+    private int mTriggerHeight = -1;
+
+    private static final int DISTANCE_DRAW_SNAG = 20;
+
     private static final int ANIMATION_STATE_STARTING = 1;
     private static final int ANIMATION_STATE_RUNNING = 2;
     private static final int ANIMATION_STATE_DONE = 3;
@@ -141,6 +158,13 @@
 
         final int srcColor = context.getResources().getColor(R.color.delete_color_filter);
         mTrashPaint.setColorFilter(new PorterDuffColorFilter(srcColor, PorterDuff.Mode.SRC_ATOP));
+
+        // Make estimated paint area in gray
+        int snagColor = context.getResources().getColor(R.color.snag_callout_color);
+        mEstimatedPaint.setColor(snagColor);
+        mEstimatedPaint.setStrokeWidth(3);
+        mEstimatedPaint.setAntiAlias(true);
+
     }
 
     public void startDrag(View v, DragSource source, Object dragInfo, int dragAction) {
@@ -177,6 +201,9 @@
         int width = viewBitmap.getWidth();
         int height = viewBitmap.getHeight();
 
+        mTriggerWidth = width * 2 / 3;
+        mTriggerHeight = height * 2 / 3;
+
         Matrix scale = new Matrix();
         float scaleFactor = v.getWidth();
         scaleFactor = (scaleFactor + DRAG_SCALE) /scaleFactor;
@@ -252,6 +279,13 @@
                         break;
                 }
             } else {
+                // Only draw estimate drop "snag" when requested
+                if (DRAW_TARGET_SNAG && mDrawEstimated) {
+                    canvas.drawLine(mDragCenter[0], mDragCenter[1], mEstimatedCenter[0], mEstimatedCenter[1], mEstimatedPaint);
+                    canvas.drawCircle(mEstimatedCenter[0], mEstimatedCenter[1], 8, mEstimatedPaint);
+                }
+
+                // Draw actual icon being dragged
                 canvas.drawBitmap(mDragBitmap,
                         mScrollX + mLastMotionX - mTouchOffsetX - mBitmapOffsetX,
                         mScrollY + mLastMotionY - mTouchOffsetY - mBitmapOffsetY, mDragPaint);
@@ -355,8 +389,16 @@
             left = (int) (scrollX + x - touchX - offsetX);
             top = (int) (scrollY + y - touchY - offsetY);
 
+            // Invalidate current icon position
             rect.union(left - 1, top - 1, left + width + 1, top + height + 1);
-            invalidate(rect);
+
+            mDragCenter[0] = rect.centerX();
+            mDragCenter[1] = rect.centerY();
+
+            // Invalidate any old estimated location
+            if (DRAW_TARGET_SNAG && mDrawEstimated) {
+                rect.union(mEstimatedRect);
+            }
 
             final int[] coordinates = mDropCoordinates;
             DropTarget dropTarget = findDropTarget((int) x, (int) y, coordinates);
@@ -378,6 +420,33 @@
                         (int) mTouchOffsetX, (int) mTouchOffsetY, mDragInfo);
                 }
             }
+
+            // Render estimated drop "snag" only outside of width
+            mDrawEstimated = false;
+            if (DRAW_TARGET_SNAG && dropTarget != null) {
+                Rect foundEstimate = dropTarget.estimateDropLocation(mDragSource,
+                        (int) (scrollX + mLastMotionX), (int) (scrollY + mLastMotionY),
+                        (int) mTouchOffsetX, (int) mTouchOffsetY, mDragInfo, mEstimatedRect);
+
+                if (foundEstimate != null) {
+                    mEstimatedCenter[0] = foundEstimate.centerX();
+                    mEstimatedCenter[1] = foundEstimate.centerY();
+
+                    int deltaX = (int) Math.abs(mEstimatedCenter[0] - mDragCenter[0]);
+                    int deltaY = (int) Math.abs(mEstimatedCenter[1] - mDragCenter[1]);
+
+                    if (deltaX > mTriggerWidth || deltaY > mTriggerHeight) {
+                        mDrawEstimated = true;
+                    }
+                }
+            }
+
+            // Include new estimated area in invalidated rectangle
+            if (DRAW_TARGET_SNAG && mDrawEstimated) {
+                rect.union(mEstimatedRect);
+            }
+            invalidate(rect);
+
             mLastDropTarget = dropTarget;
 
             boolean inDragRegion = false;
@@ -478,9 +547,15 @@
                     }
                     if (target == null) {
                         if (child instanceof DropTarget) {
-                            dropCoordinates[0] = x;
-                            dropCoordinates[1] = y;
-                            return (DropTarget) child;
+                            // Only consider this child if they will accept
+                            DropTarget childTarget = (DropTarget) child;
+                            if (childTarget.acceptDrop(mDragSource, x, y, 0, 0, mDragInfo)) {
+                                dropCoordinates[0] = x;
+                                dropCoordinates[1] = y;
+                                return (DropTarget) child;
+                            } else {
+                                return null;
+                            }
                         }
                     } else {
                         return target;
@@ -531,6 +606,7 @@
 
         public void run() {
             if (mDragScroller != null) {
+                mDrawEstimated = false;
                 if (mDirection == SCROLL_LEFT) {
                     mDragScroller.scrollLeft();
                 } else {
diff --git a/src/com/android/launcher/DropTarget.java b/src/com/android/launcher/DropTarget.java
index 8129089..4835323 100644
--- a/src/com/android/launcher/DropTarget.java
+++ b/src/com/android/launcher/DropTarget.java
@@ -16,6 +16,8 @@
 
 package com.android.launcher;
 
+import android.graphics.Rect;
+
 /**
  * Interface defining an object that can receive a drag.
  *
@@ -42,18 +44,38 @@
     void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo);
 
     /**
-     * Indicates whether a drop action can occur at the specified location. The method
-     * {@link #onDrop(DragSource, int, int, int, int, Object)} will be invoked on this
-     * drop target only if this method returns true. 
-     *
+     * Check if a drop action can occur at, or near, the requested location.
+     * This may be called repeatedly during a drag, so any calls should return
+     * quickly.
+     * 
      * @param source DragSource where the drag started
      * @param x X coordinate of the drop location
      * @param y Y coordinate of the drop location
-     * @param xOffset Horizontal offset with the object being dragged where the original touch happened
-     * @param yOffset Vertical offset with the object being dragged where the original touch happened
+     * @param xOffset Horizontal offset with the object being dragged where the
+     *            original touch happened
+     * @param yOffset Vertical offset with the object being dragged where the
+     *            original touch happened
      * @param dragInfo Data associated with the object being dragged
-     *
-     * return True if the drop is accepted, false otherwise.
+     * @return True if the drop will be accepted, false otherwise.
      */
     boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo);
+
+    /**
+     * Estimate the surface area where this object would land if dropped at the
+     * given location.
+     * 
+     * @param source DragSource where the drag started
+     * @param x X coordinate of the drop location
+     * @param y Y coordinate of the drop location
+     * @param xOffset Horizontal offset with the object being dragged where the
+     *            original touch happened
+     * @param yOffset Vertical offset with the object being dragged where the
+     *            original touch happened
+     * @param dragInfo Data associated with the object being dragged
+     * @param recycle {@link Rect} object to be possibly recycled.
+     * @return Estimated area that would be occupied if object was dropped at
+     *         the given location. Should return null if no estimate is found,
+     *         or if this target doesn't provide estimations.
+     */
+    Rect estimateDropLocation(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo, Rect recycle);
 }
diff --git a/src/com/android/launcher/FolderIcon.java b/src/com/android/launcher/FolderIcon.java
index 667f92e..a56101d 100644
--- a/src/com/android/launcher/FolderIcon.java
+++ b/src/com/android/launcher/FolderIcon.java
@@ -18,6 +18,7 @@
 
 import android.content.Context;
 import android.content.res.Resources;
+import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
@@ -69,6 +70,10 @@
                 && item.container != mInfo.id;
     }
 
+    public Rect estimateDropLocation(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo, Rect recycle) {
+        return null;
+    }
+
     public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo) {
         final ApplicationInfo item = (ApplicationInfo) dragInfo;
         // TODO: update open folder that is looking at this data
diff --git a/src/com/android/launcher/InstallShortcutReceiver.java b/src/com/android/launcher/InstallShortcutReceiver.java
index a1e954a..fd2789c 100644
--- a/src/com/android/launcher/InstallShortcutReceiver.java
+++ b/src/com/android/launcher/InstallShortcutReceiver.java
@@ -21,6 +21,7 @@
 import android.content.Intent;
 import android.content.ContentResolver;
 import android.database.Cursor;
+import android.widget.Toast;
 
 public class InstallShortcutReceiver extends BroadcastReceiver {
     private final int[] mCoordinates = new int[2];
@@ -37,6 +38,8 @@
     }
 
     private boolean installShortcut(Context context, Intent data, int screen) {
+        String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
+
         if (findEmptyCell(context, mCoordinates, screen)) {
             CellLayout.CellInfo cell = new CellLayout.CellInfo();
             cell.cellX = mCoordinates[0];
@@ -44,7 +47,6 @@
             cell.screen = screen;
 
             Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
-            String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
 
             if (intent.getAction() == null) {
                 intent.setAction(Intent.ACTION_VIEW);
@@ -55,9 +57,17 @@
             boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true);
             if (duplicate || !LauncherModel.shortcutExists(context, name, intent)) {
                 Launcher.addShortcut(context, data, cell, true);
+                Toast.makeText(context, context.getString(R.string.shortcut_installed, name),
+                        Toast.LENGTH_SHORT).show();
+            } else {
+                Toast.makeText(context, context.getString(R.string.shortcut_duplicate, name),
+                        Toast.LENGTH_SHORT).show();
             }
 
             return true;
+        } else {
+            Toast.makeText(context, context.getString(R.string.out_of_space),
+                    Toast.LENGTH_SHORT).show();
         }
 
         return false;
diff --git a/src/com/android/launcher/Launcher.java b/src/com/android/launcher/Launcher.java
index 7dd3418..5754975 100644
--- a/src/com/android/launcher/Launcher.java
+++ b/src/com/android/launcher/Launcher.java
@@ -20,6 +20,7 @@
 import android.app.AlertDialog;
 import android.app.Application;
 import android.app.Dialog;
+import android.app.IWallpaperService;
 import android.app.SearchManager;
 import android.app.StatusBarManager;
 import android.content.ActivityNotFoundException;
@@ -35,26 +36,24 @@
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Resources;
 import android.content.res.Configuration;
+import android.content.res.Resources;
 import android.database.ContentObserver;
 import android.graphics.Bitmap;
 import android.graphics.Rect;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.TransitionDrawable;
-import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Looper;
+import android.os.Message;
 import android.os.MessageQueue;
 import android.os.Parcelable;
 import android.os.RemoteException;
 import android.os.ServiceManager;
-import android.os.Message;
-import android.provider.*;
-import android.telephony.PhoneNumberUtils;
+import android.provider.LiveFolders;
 import android.text.Selection;
 import android.text.SpannableStringBuilder;
 import android.text.TextUtils;
@@ -71,11 +70,10 @@
 import android.view.View.OnLongClickListener;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.EditText;
-import android.widget.TextView;
-import android.widget.Toast;
 import android.widget.GridView;
 import android.widget.SlidingDrawer;
-import android.app.IWallpaperService;
+import android.widget.TextView;
+import android.widget.Toast;
 import android.appwidget.AppWidgetManager;
 import android.appwidget.AppWidgetProviderInfo;
 
@@ -168,7 +166,6 @@
 
     private final BroadcastReceiver mApplicationsReceiver = new ApplicationsIntentReceiver();
     private final ContentObserver mObserver = new FavoritesChangeObserver();
-    private final ContentObserver mAppWidgetResetObserver = new AppWidgetResetObserver();
 
     private LayoutInflater mInflater;
 
@@ -353,6 +350,9 @@
         if (mRestoring) {
             startLoaders();
         }
+
+        // Make sure that the search gadget (if any) is in its normal place.
+        stopSearch();
     }
 
     @Override
@@ -387,45 +387,29 @@
             boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                     keyCode, event);
             if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
-                // something usable has been typed - dispatch it now.
-                final String str = mDefaultKeySsb.toString();
-
-                boolean isDialable = true;
-                final int count = str.length();
-                for (int i = 0; i < count; i++) {
-                    if (!PhoneNumberUtils.isReallyDialable(str.charAt(i))) {
-                        isDialable = false;
-                        break;
-                    }
-                }
-                Intent intent;
-                if (isDialable) {
-                    intent = new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", str, null));
-                } else {
-                    intent = new Intent(Contacts.Intents.UI.FILTER_CONTACTS_ACTION);
-                    intent.putExtra(Contacts.Intents.UI.FILTER_TEXT_EXTRA_KEY, str);
-                }
-
-                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
-                        | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
-
-                try {
-                    startActivity(intent);
-                } catch (android.content.ActivityNotFoundException ex) {
-                    // Oh well... no one knows how to filter/dial. Life goes on.
-                }
-
-                mDefaultKeySsb.clear();
-                mDefaultKeySsb.clearSpans();
-                Selection.setSelection(mDefaultKeySsb, 0);
-
-                return true;
+                // something usable has been typed - start a search
+                // the typed text will be retrieved and cleared by 
+                // showSearchDialog()
+                // If there are multiple keystrokes before the search dialog takes focus,
+                // onSearchRequested() will be called for every keystroke,
+                // but it is idempotent, so it's fine.
+                return onSearchRequested();
             }
         }
 
         return handled;
     }
 
+    private String getTypedText() {
+        return mDefaultKeySsb.toString();
+    }
+
+    private void clearTypedText() {
+        mDefaultKeySsb.clear();
+        mDefaultKeySsb.clearSpans();
+        Selection.setSelection(mDefaultKeySsb, 0);
+    }
+
     /**
      * Restores the previous state, if it exists.
      *
@@ -495,7 +479,7 @@
         drawer.setOnDrawerCloseListener(drawerManager);
         drawer.setOnDrawerScrollListener(drawerManager);
 
-        grid.setTextFilterEnabled(true);
+        grid.setTextFilterEnabled(false);
         grid.setDragger(dragLayer);
         grid.setLauncher(this);
 
@@ -782,9 +766,11 @@
             super.onSaveInstanceState(outState);
         }
 
-        if (mDrawer.isOpened()) {
+        // When the drawer is opened and we are saving the state because of a
+        // configuration change
+        if (mDrawer.isOpened() && getChangingConfigurations() != 0) {
             outState.putBoolean(RUNTIME_STATE_ALL_APPS_FOLDER, true);
-        }        
+        }
 
         if (mAddItemCellInfo != null && mAddItemCellInfo.valid && mWaitingForResult) {
             final CellLayout.CellInfo addItemCellInfo = mAddItemCellInfo;
@@ -827,7 +813,6 @@
         sModel.abortLoaders();
 
         getContentResolver().unregisterContentObserver(mObserver);
-        getContentResolver().unregisterContentObserver(mAppWidgetResetObserver);
         unregisterReceiver(mApplicationsReceiver);
     }
 
@@ -840,13 +825,74 @@
     @Override
     public void startSearch(String initialQuery, boolean selectInitialQuery, 
             Bundle appSearchData, boolean globalSearch) {
+
+        closeDrawer(false);
+        
+        // Slide the search widget to the top, if it's on the current screen,
+        // otherwise show the search dialog immediately.
+        Search searchWidget = mWorkspace.findSearchWidgetOnCurrentScreen();
+        if (searchWidget == null) {
+            showSearchDialog(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+        } else {
+            searchWidget.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+            // show the currently typed text in the search widget while sliding
+            searchWidget.setQuery(getTypedText());
+        }
+    }
+    
+    /**
+     * Show the search dialog immediately, without changing the search widget.
+     *
+     * @see Activity#startSearch(String, boolean, android.os.Bundle, boolean)
+     */
+    void showSearchDialog(String initialQuery, boolean selectInitialQuery, 
+            Bundle appSearchData, boolean globalSearch) {
+        
+        if (initialQuery == null) {
+            // Use any text typed in the launcher as the initial query
+            initialQuery = getTypedText();
+            clearTypedText();
+        }
         if (appSearchData == null) {
             appSearchData = new Bundle();
             appSearchData.putString(SearchManager.SOURCE, "launcher-search");
         }
-        super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+        
+        final SearchManager searchManager =
+                (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+
+        final Search searchWidget = mWorkspace.findSearchWidgetOnCurrentScreen();
+        if (searchWidget != null) {
+            // This gets called when the user leaves the search dialog to go back to
+            // the Launcher.
+            searchManager.setOnCancelListener(new SearchManager.OnCancelListener() {
+                public void onCancel() {
+                    searchManager.setOnCancelListener(null);
+                    stopSearch();
+                }            
+            });
+        }
+        
+        searchManager.startSearch(initialQuery, selectInitialQuery, getComponentName(),
+            appSearchData, globalSearch); 
     }
 
+    /**
+     * Cancel search dialog if it is open.
+     */
+    void stopSearch() {
+        // Close search dialog
+        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+        if (searchManager.isVisible()) {
+            searchManager.stopSearch();
+        }
+        // Restore search widget to its normal position
+        Search searchWidget = mWorkspace.findSearchWidgetOnCurrentScreen();
+        if (searchWidget != null) {
+            searchWidget.stopSearch(false);
+        }
+    }
+    
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         if (mDesktopLocked) return false;
@@ -866,8 +912,8 @@
                 .setAlphabeticShortcut('N');
 
         final Intent settings = new Intent(android.provider.Settings.ACTION_SETTINGS);
-        settings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
-                | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
+        settings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
+                Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
 
         menu.add(0, MENU_SETTINGS, 0, R.string.menu_settings)
                 .setIcon(android.R.drawable.ic_menu_preferences).setAlphabeticShortcut('P')
@@ -905,15 +951,16 @@
 
         return super.onOptionsItemSelected(item);
     }
+    
+    /**
+     * Indicates that we want global search for this activity by setting the globalSearch
+     * argument for {@link #startSearch} to true.
+     */
 
     @Override
     public boolean onSearchRequested() {
-        if (mWorkspace.snapToSearch()) {
-            closeDrawer(true);                // search widget: get drawer out of the way
-            return true;
-        } else {
-            return super.onSearchRequested(); // no search widget: use system search UI
-        }
+        startSearch(null, false, null, true); 
+        return true;
     }
 
     private void addItems() {
@@ -975,6 +1022,8 @@
     
         final View view = mInflater.inflate(info.layoutResource, null);
         view.setTag(info);
+        Search search = (Search) view.findViewById(R.id.widget_search);
+        search.setLauncher(this);
     
         mWorkspace.addInCurrentScreen(view, xy[0], xy[1], info.spanX, spanY);
     }
@@ -1158,7 +1207,6 @@
     private void registerContentObservers() {
         ContentResolver resolver = getContentResolver();
         resolver.registerContentObserver(LauncherSettings.Favorites.CONTENT_URI, true, mObserver);
-        resolver.registerContentObserver(LauncherProvider.CONTENT_APPWIDGET_RESET_URI, true, mAppWidgetResetObserver);
     }
 
     @Override
@@ -1224,16 +1272,6 @@
         sModel.loadUserItems(false, this, false, false);
     }
 
-    /**
-     * When reset, we handle by calling {@link AppWidgetHost#startListening()}
-     * to make sure our callbacks are set correctly.
-     */
-    private void onAppWidgetReset() {
-        if (mAppWidgetHost != null) {
-            mAppWidgetHost.startListening();
-        }
-    }
-
     void onDesktopItemsLoaded() {
         if (mDestroyed) return;
         bindDesktopItems();
@@ -1250,8 +1288,6 @@
             return;
         }
 
-        mAllAppsGrid.setAdapter(drawerAdapter);
-
         final Workspace workspace = mWorkspace;
         int count = workspace.getChildCount();
         for (int i = 0; i < count; i++) {
@@ -1275,7 +1311,7 @@
             mBinder.mTerminate = true;
         }
         
-        mBinder = new DesktopBinder(this, shortcuts, appWidgets);
+        mBinder = new DesktopBinder(this, shortcuts, appWidgets, drawerAdapter);
         mBinder.startBindingItems();
     }
 
@@ -1317,6 +1353,9 @@
                     final View view = mInflater.inflate(R.layout.widget_search,
                             (ViewGroup) workspace.getChildAt(screen), false);
                     
+                    Search search = (Search) view.findViewById(R.id.widget_search);
+                    search.setLauncher(this);
+                    
                     final Widget widget = (Widget) item;
                     view.setTag(widget);
                     
@@ -1329,7 +1368,7 @@
 
         if (end >= count) {
             finishBindDesktopItems();
-            binder.startBindingAppWidgetsWhenIdle();
+            binder.startBindingDrawer();
         } else {
             binder.obtainMessage(DesktopBinder.MESSAGE_BIND_ITEMS, i, count).sendToTarget();
         }
@@ -1376,6 +1415,12 @@
         mDrawer.unlock();
     }
     
+    private void bindDrawer(Launcher.DesktopBinder binder,
+            ApplicationsAdapter drawerAdapter) {
+        mAllAppsGrid.setAdapter(drawerAdapter);
+        binder.startBindingAppWidgetsWhenIdle();
+    }
+    
     private void bindAppWidgets(Launcher.DesktopBinder binder,
             LinkedList<LauncherAppWidgetInfo> appWidgets) {
         
@@ -1386,14 +1431,10 @@
             final LauncherAppWidgetInfo item = appWidgets.removeFirst();
             
             final int appWidgetId = item.appWidgetId;
-            final AppWidgetProviderInfo appWidgetInfo =
-                    mAppWidgetManager.getAppWidgetInfo(appWidgetId);
+            final AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
             item.hostView = mAppWidgetHost.createView(this, appWidgetId, appWidgetInfo);
             
-            if (LOGD) {
-                d(LOG_TAG, String.format("about to setAppWidget for id=%d, info=%s",
-                        appWidgetId, appWidgetInfo));
-            }
+            if (LOGD) d(LOG_TAG, String.format("about to setAppWidget for id=%d, info=%s", appWidgetId, appWidgetInfo));
             
             item.hostView.setAppWidget(appWidgetId, appWidgetInfo);
             item.hostView.setTag(item);
@@ -1891,21 +1932,6 @@
     }
 
     /**
-     * Receives notifications when the {@link AppWidgetHost} has been reset,
-     * usually only when the {@link LauncherProvider} database is first created.
-     */
-    private class AppWidgetResetObserver extends ContentObserver {
-        public AppWidgetResetObserver() {
-            super(new Handler());
-        }
-
-        @Override
-        public void onChange(boolean selfChange) {
-            onAppWidgetReset();
-        }
-    }
-
-    /**
      * Receives intents from other applications to change the wallpaper.
      */
     private static class WallpaperIntentReceiver extends BroadcastReceiver {
@@ -1996,21 +2022,25 @@
     private static class DesktopBinder extends Handler implements MessageQueue.IdleHandler {
         static final int MESSAGE_BIND_ITEMS = 0x1;
         static final int MESSAGE_BIND_APPWIDGETS = 0x2;
+        static final int MESSAGE_BIND_DRAWER = 0x3;
         
         // Number of items to bind in every pass
         static final int ITEMS_COUNT = 6;
 
         private final ArrayList<ItemInfo> mShortcuts;
         private final LinkedList<LauncherAppWidgetInfo> mAppWidgets;
+        private final ApplicationsAdapter mDrawerAdapter;
         private final WeakReference<Launcher> mLauncher;
         
-        public volatile boolean mTerminate = false;
+        public boolean mTerminate = false;
 
         DesktopBinder(Launcher launcher, ArrayList<ItemInfo> shortcuts,
-                ArrayList<LauncherAppWidgetInfo> appWidgets) {
+                ArrayList<LauncherAppWidgetInfo> appWidgets,
+                ApplicationsAdapter drawerAdapter) {
 
             mLauncher = new WeakReference<Launcher>(launcher);
             mShortcuts = shortcuts;
+            mDrawerAdapter = drawerAdapter;
             
             // Sort widgets so active workspace is bound first
             final int currentScreen = launcher.mWorkspace.getCurrentScreen();
@@ -2030,6 +2060,10 @@
         public void startBindingItems() {
             obtainMessage(MESSAGE_BIND_ITEMS, 0, mShortcuts.size()).sendToTarget();
         }
+
+        public void startBindingDrawer() {
+            obtainMessage(MESSAGE_BIND_DRAWER).sendToTarget();
+        }
         
         public void startBindingAppWidgetsWhenIdle() {
             // Ask for notification when message queue becomes idle
@@ -2059,6 +2093,10 @@
                     launcher.bindItems(this, mShortcuts, msg.arg1, msg.arg2);
                     break;
                 }
+                case MESSAGE_BIND_DRAWER: {
+                    launcher.bindDrawer(this, mDrawerAdapter);
+                    break;
+                }
                 case MESSAGE_BIND_APPWIDGETS: {
                     launcher.bindAppWidgets(this, mAppWidgets);
                     break;
@@ -2067,3 +2105,4 @@
         }
     }
 }
+
diff --git a/src/com/android/launcher/Search.java b/src/com/android/launcher/Search.java
index 71ab7ef..3d09479 100644
--- a/src/com/android/launcher/Search.java
+++ b/src/com/android/launcher/Search.java
@@ -16,71 +16,59 @@
 
 package com.android.launcher;
 
-import android.app.ISearchManager;
-import android.app.SearchManager;
 import android.content.ActivityNotFoundException;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
-import android.content.res.Resources;
-import android.content.res.Resources.NotFoundException;
-import android.database.Cursor;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
+import android.content.res.Configuration;
 import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.server.search.SearchableInfo;
-import android.text.Editable;
-import android.text.TextUtils;
-import android.text.TextWatcher;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.KeyEvent;
-import android.view.MotionEvent;
 import android.view.View;
-import android.view.ViewGroup;
 import android.view.View.OnClickListener;
 import android.view.View.OnKeyListener;
 import android.view.View.OnLongClickListener;
-import android.widget.AdapterView;
-import android.widget.AutoCompleteTextView;
-import android.widget.CursorAdapter;
-import android.widget.Filter;
+import android.view.animation.AccelerateDecelerateInterpolator;
+import android.view.animation.Animation;
+import android.view.animation.Interpolator;
+import android.view.animation.Transformation;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.ImageButton;
-import android.widget.ImageView;
 import android.widget.LinearLayout;
-import android.widget.SimpleCursorAdapter;
 import android.widget.TextView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.AdapterView.OnItemSelectedListener;
 
-public class Search extends LinearLayout implements OnClickListener, OnKeyListener,
-        OnLongClickListener, TextWatcher, OnItemClickListener, OnItemSelectedListener {
+public class Search extends LinearLayout 
+        implements OnClickListener, OnKeyListener, OnLongClickListener {
+
+    // Speed at which the widget slides up/down, in pixels/ms.
+    private static final float ANIMATION_VELOCITY = 1.0f;
 
     private final String TAG = "SearchWidget";
 
-    private AutoCompleteTextView mSearchText;
-    private ImageButton mGoButton;
+    private Launcher mLauncher;
+
+    private TextView mSearchText;
     private ImageButton mVoiceButton;
-    private OnLongClickListener mLongClickListener;
-    
-    // Support for suggestions
-    private SuggestionsAdapter mSuggestionsAdapter;
-    private SearchableInfo mSearchable;
-    private String mSuggestionAction = null;
-    private Uri mSuggestionData = null;
-    private String mSuggestionQuery = null;
-    private int mItemSelected = -1;
-    
+
+    /** The animation that morphs the search widget to the search dialog. */
+    private Animation mMorphAnimation;
+
+    /** The animation that morphs the search widget back to its normal position. */
+    private Animation mUnmorphAnimation;
+
+    // These four are passed to Launcher.startSearch() when the search widget
+    // has finished morphing. They are instance variables to make it possible to update
+    // them while the widget is morphing.
+    private String mInitialQuery;
+    private boolean mSelectInitialQuery;    
+    private Bundle mAppSearchData;
+    private boolean mGlobalSearch;
+
     // For voice searching
     private Intent mVoiceSearchIntent;
 
-    private Rect mTempRect = new Rect();
-    private boolean mRestoreFocus = false;
-
     /**
      * Used to inflate the Workspace from XML.
      *
@@ -89,293 +77,235 @@
      */
     public Search(Context context, AttributeSet attrs) {
         super(context, attrs);
+
+        Interpolator interpolator = new AccelerateDecelerateInterpolator();
+
+        mMorphAnimation = new ToParentOriginAnimation();
+        // no need to apply transformation before the animation starts,
+        // since the gadget is already in its normal place.
+        mMorphAnimation.setFillBefore(false);
+        // stay in the top position after the animation finishes
+        mMorphAnimation.setFillAfter(true);
+        mMorphAnimation.setInterpolator(interpolator);
+        mMorphAnimation.setAnimationListener(new Animation.AnimationListener() {
+            // The amount of time before the animation ends to show the search dialog.
+            private static final long TIME_BEFORE_ANIMATION_END = 80;
+            
+            // The runnable which we'll pass to our handler to show the search dialog.
+            private final Runnable mShowSearchDialogRunnable = new Runnable() {
+                public void run() {
+                    showSearchDialog();
+                }
+            };
+            
+            public void onAnimationEnd(Animation animation) { }
+            public void onAnimationRepeat(Animation animation) { }
+            public void onAnimationStart(Animation animation) {
+                // Make the search dialog show up ideally *just* as the animation reaches
+                // the top, to aid the illusion that the widget becomes the search dialog.
+                // Otherwise, there is a short delay when the widget reaches the top before
+                // the search dialog shows. We do this roughly 80ms before the animation ends.
+                getHandler().postDelayed(
+                        mShowSearchDialogRunnable,
+                        Math.max(mMorphAnimation.getDuration() - TIME_BEFORE_ANIMATION_END, 0));
+            }
+        });
+
+        mUnmorphAnimation = new FromParentOriginAnimation();
+        // stay in the top position until the animation starts
+        mUnmorphAnimation.setFillBefore(true);
+        // no need to apply transformation after the animation finishes,
+        // since the gadget is now back in its normal place.
+        mUnmorphAnimation.setFillAfter(false);
+        mUnmorphAnimation.setInterpolator(interpolator);
+        mUnmorphAnimation.setAnimationListener(new Animation.AnimationListener(){
+            public void onAnimationEnd(Animation animation) {
+                clearAnimation();
+            }
+            public void onAnimationRepeat(Animation animation) { }
+            public void onAnimationStart(Animation animation) { }
+        });
         
         mVoiceSearchIntent = new Intent(android.speech.RecognizerIntent.ACTION_WEB_SEARCH);
         mVoiceSearchIntent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                 android.speech.RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
     }
-    
+
     /**
-     * Implements OnClickListener (for button)
+     * Implements OnClickListener.
      */
     public void onClick(View v) {
-        if (v == mGoButton) {
-            query();
-        } else if (v == mVoiceButton) {
-            try {
-                getContext().startActivity(mVoiceSearchIntent);
-            } catch (ActivityNotFoundException ex) {
-                // Should not happen, since we check the availability of
-                // voice search before showing the button. But just in case...
-                Log.w(TAG, "Could not find voice search activity");
+        if (v == mVoiceButton) {
+            startVoiceSearch();
+        } else {
+            mLauncher.onSearchRequested();
+        }
+    }
+
+    private void startVoiceSearch() {
+        try {
+            getContext().startActivity(mVoiceSearchIntent);
+        } catch (ActivityNotFoundException ex) {
+            // Should not happen, since we check the availability of
+            // voice search before showing the button. But just in case...
+            Log.w(TAG, "Could not find voice search activity");
+        }
+    }
+
+    /**
+     * Sets the query text. The query field is not editable, instead we forward
+     * the key events to the launcher, which keeps track of the text, 
+     * calls setQuery() to show it, and gives it to the search dialog.
+     */
+    public void setQuery(String query) {
+        mSearchText.setText(query, TextView.BufferType.NORMAL);
+    }
+
+    /**
+     * Morph the search gadget to the search dialog.
+     * See {@link Activity.startSearch()} for the arguments.
+     */
+    public void startSearch(String initialQuery, boolean selectInitialQuery, 
+            Bundle appSearchData, boolean globalSearch) {
+        mInitialQuery = initialQuery;
+        mSelectInitialQuery = selectInitialQuery;
+        mAppSearchData = appSearchData;
+        mGlobalSearch = globalSearch;
+        
+        // Call up the keyboard before we actually call the search dialog so that it
+        // (hopefully) animates in at about the same time as the widget animation, and
+        // so that it becomes available as soon as possible. Only do this if a hard
+        // keyboard is not currently available.
+        if (getContext().getResources().getConfiguration().hardKeyboardHidden ==
+                Configuration.HARDKEYBOARDHIDDEN_YES) {
+            // Make sure the text field is not focusable, so it's not responsible for
+            // causing the whole view to shift up to accommodate the keyboard.
+            mSearchText.setFocusable(false);
+            
+            InputMethodManager inputManager = (InputMethodManager)
+                    getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+            inputManager.showSoftInputUnchecked(0, null);
+        }
+        
+        if (isAtTop()) {
+            showSearchDialog();
+        } else {
+            // Start the animation, unless it has already started.
+            if (getAnimation() != mMorphAnimation) {
+                mMorphAnimation.setDuration(getAnimationDuration());
+                startAnimation(mMorphAnimation);
             }
         }
     }
 
-    private void query() {
-        String query = mSearchText.getText().toString();
-        if (TextUtils.getTrimmedLength(mSearchText.getText()) == 0) {
-            return;
+    /**
+     * Shows the system search dialog immediately, without any animation.
+     */
+    private void showSearchDialog() {
+        mLauncher.showSearchDialog(
+                mInitialQuery, mSelectInitialQuery, mAppSearchData, mGlobalSearch);
+    }
+
+    /**
+     * Restore the search gadget to its normal position.
+     * 
+     * @param animate Whether to animate the movement of the gadget.
+     */
+    public void stopSearch(boolean animate) {
+        setQuery("");
+        
+        // Set the search field back to focusable after making it unfocusable in
+        // startSearch, so that the home screen doesn't try to shift around when the
+        // keyboard comes up.
+        mSearchText.setFocusable(true);
+        // Only restore if we are not already restored.
+        if (getAnimation() == mMorphAnimation) {
+            if (animate && !isAtTop()) {
+                mUnmorphAnimation.setDuration(getAnimationDuration());
+                startAnimation(mUnmorphAnimation);
+            } else {
+                clearAnimation();
+            }
         }
-        Bundle appData = new Bundle();
-        appData.putString(SearchManager.SOURCE, "launcher-widget");
-        sendLaunchIntent(Intent.ACTION_SEARCH, null, query, appData, 0, null, mSearchable);
-        clearQuery();
+    }
+
+    private boolean isAtTop() {
+        return getTop() == 0;
+    }
+
+    private int getAnimationDuration() {
+        return (int) (getTop() / ANIMATION_VELOCITY);
+    }
+
+    /**
+     * Modify clearAnimation() to invalidate the parent. This works around
+     * an issue where the region where the end of the animation placed the view
+     * was not redrawn after clearing the animation.
+     */
+    @Override
+    public void clearAnimation() {
+        Animation animation = getAnimation();
+        if (animation != null) {
+            super.clearAnimation();
+            if (animation.hasEnded() 
+                    && animation.getFillAfter()
+                    && animation.willChangeBounds()) {
+                ((View) getParent()).invalidate();
+            } else {
+                invalidate();
+            }
+        }
     }
     
-    /**
-     * Assemble a search intent and send it.
-     * 
-     * This is copied from SearchDialog.
-     *
-     * @param action The intent to send, typically Intent.ACTION_SEARCH
-     * @param data The data for the intent
-     * @param query The user text entered (so far)
-     * @param appData The app data bundle (if supplied)
-     * @param actionKey If the intent was triggered by an action key, e.g. KEYCODE_CALL, it will
-     * be sent here.  Pass KeyEvent.KEYCODE_UNKNOWN for no actionKey code.
-     * @param actionMsg If the intent was triggered by an action key, e.g. KEYCODE_CALL, the
-     * corresponding tag message will be sent here.  Pass null for no actionKey message.
-     * @param si Reference to the current SearchableInfo.  Passed here so it can be used even after
-     * we've called dismiss(), which attempts to null mSearchable.
-     */
-    private void sendLaunchIntent(final String action, final Uri data, final String query,
-            final Bundle appData, int actionKey, final String actionMsg, final SearchableInfo si) {
-        Intent launcher = new Intent(action);
-        launcher.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
-        if (query != null) {
-            launcher.putExtra(SearchManager.QUERY, query);
-        }
-
-        if (data != null) {
-            launcher.setData(data);
-        }
-
-        if (appData != null) {
-            launcher.putExtra(SearchManager.APP_DATA, appData);
-        }
-
-        // add launch info (action key, etc.)
-        if (actionKey != KeyEvent.KEYCODE_UNKNOWN) {
-            launcher.putExtra(SearchManager.ACTION_KEY, actionKey);
-            launcher.putExtra(SearchManager.ACTION_MSG, actionMsg);
-        }
-
-        // attempt to enforce security requirement (no 3rd-party intents)
-        if (si != null) {
-            launcher.setComponent(si.mSearchActivity);
-        }
-
-        getContext().startActivity(launcher);
-    }
-
-    @Override
-    public void onWindowFocusChanged(boolean hasWindowFocus) {
-        if (!hasWindowFocus && hasFocus()) {
-            mRestoreFocus = true;
-        }
-
-        super.onWindowFocusChanged(hasWindowFocus);
-
-        if (hasWindowFocus && mRestoreFocus) {
-            if (isInTouchMode()) {
-                final AutoCompleteTextView searchText = mSearchText;
-                searchText.setSelectAllOnFocus(false);
-                searchText.requestFocusFromTouch();
-                searchText.setSelectAllOnFocus(true);
+    public boolean onKey(View v, int keyCode, KeyEvent event) {
+        if (!event.isSystem() && 
+                (keyCode != KeyEvent.KEYCODE_DPAD_UP) &&
+                (keyCode != KeyEvent.KEYCODE_DPAD_DOWN) &&
+                (keyCode != KeyEvent.KEYCODE_DPAD_LEFT) &&
+                (keyCode != KeyEvent.KEYCODE_DPAD_RIGHT) &&
+                (keyCode != KeyEvent.KEYCODE_DPAD_CENTER)) {
+            // Forward key events to Launcher, which will forward text 
+            // to search dialog
+            switch (event.getAction()) {
+                case KeyEvent.ACTION_DOWN:
+                    return mLauncher.onKeyDown(keyCode, event);
+                case KeyEvent.ACTION_MULTIPLE:
+                    return mLauncher.onKeyMultiple(keyCode, event.getRepeatCount(), event);
+                case KeyEvent.ACTION_UP:
+                    return mLauncher.onKeyUp(keyCode, event);
             }
-            mRestoreFocus = false;
         }
-    }
-
-    /**
-     * Implements TextWatcher (for EditText)
-     */
-    public void beforeTextChanged(CharSequence s, int start, int before, int after) { 
-    }
-
-    /**
-     * Implements TextWatcher (for EditText)
-     */
-    public void onTextChanged(CharSequence s, int start, int before, int after) {
-        // enable the button if we have one or more non-space characters
-        boolean enabled = TextUtils.getTrimmedLength(mSearchText.getText()) != 0;
-        mGoButton.setEnabled(enabled);
-        mGoButton.setFocusable(enabled);
-    }
-
-    /**
-     * Implements TextWatcher (for EditText)
-     */
-    public void afterTextChanged(Editable s) {
-    }
-
-    /**
-     * Implements OnKeyListener (for EditText and for button)
-     * 
-     * This plays some games with state in order to "soften" the strength of suggestions
-     * presented.  Suggestions should not be used unless the user specifically navigates to them
-     * (or clicks them, in which case it's obvious).  This is not the way that AutoCompleteTextBox
-     * normally works.
-     */
-    public final boolean onKey(View v, int keyCode, KeyEvent event) {
-        if (v == mSearchText) {
-            boolean searchTrigger = (keyCode == KeyEvent.KEYCODE_ENTER || 
-                    keyCode == KeyEvent.KEYCODE_SEARCH ||
-                    keyCode == KeyEvent.KEYCODE_DPAD_CENTER);
-            if (event.getAction() == KeyEvent.ACTION_UP) {
-//              Log.d(TAG, "onKey() ACTION_UP isPopupShowing:" + mSearchText.isPopupShowing());
-                if (!mSearchText.isPopupShowing()) {
-                    if (searchTrigger) {
-                        query();
-                        return true;
-                    }
-                }
-            } else {
-//              Log.d(TAG, "onKey() ACTION_DOWN isPopupShowing:" + mSearchText.isPopupShowing() +
-//                      " mItemSelected="+ mItemSelected);
-                if (searchTrigger && mItemSelected < 0) {
-                    query();
-                    return true;
-                }
-            }
-        } else if (v == mGoButton || v == mVoiceButton) {
-            boolean handled = false;
-            if (!event.isSystem() && 
-                    (keyCode != KeyEvent.KEYCODE_DPAD_UP) &&
-                    (keyCode != KeyEvent.KEYCODE_DPAD_DOWN) &&
-                    (keyCode != KeyEvent.KEYCODE_DPAD_LEFT) &&
-                    (keyCode != KeyEvent.KEYCODE_DPAD_RIGHT) &&
-                    (keyCode != KeyEvent.KEYCODE_DPAD_CENTER)) {
-                if (mSearchText.requestFocus()) {
-                    handled = mSearchText.dispatchKeyEvent(event);
-                }
-            }
-            return handled;
-        }
-
         return false;
     }
-    
-    @Override
-    public void setOnLongClickListener(OnLongClickListener l) {
-        super.setOnLongClickListener(l);
-        mLongClickListener = l;
-    }
-    
+
     /**
-     * Implements OnLongClickListener (for button)
+     * Implements OnLongClickListener to pass long clicks on child views 
+     * to the widget. This makes it possible to pick up the widget by long
+     * clicking on the text field or a button.
      */
     public boolean onLongClick(View v) {
-        // Pretend that a long press on a child view is a long press on the search widget
-        if (mLongClickListener != null) {
-            return mLongClickListener.onLongClick(this);
-        }
-        return false;
-    }
-
-    @Override
-    public boolean onInterceptTouchEvent(MotionEvent ev) {
-        // Request focus unless the user tapped on the voice search button
-        final int x = (int) ev.getX();
-        final int y = (int) ev.getY();
-        final Rect frame = mTempRect;
-        mVoiceButton.getHitRect(frame);
-        if (!frame.contains(x, y)) {
-            requestFocusFromTouch();
-        }
-        return super.onInterceptTouchEvent(ev);
-    }
-    
-    /**
-     * In order to keep things simple, the external trigger will clear the query just before
-     * focusing, so as to give you a fresh query.  This way we eliminate any sources of
-     * accidental query launching.
-     */
-    public void clearQuery() {
-        mSearchText.setText(null);
+        return performLongClick();
     }
 
     @Override
     protected void onFinishInflate() {
         super.onFinishInflate();
 
-        mSearchText = (AutoCompleteTextView) findViewById(R.id.input);
-        // TODO: This can be confusing when the user taps the text field to give the focus
-        // (it is not necessary but I ran into this issue several times myself)
-        // mTitleInput.setOnClickListener(this);
-        mSearchText.setOnKeyListener(this);
-        mSearchText.addTextChangedListener(this);
-
-        mGoButton = (ImageButton) findViewById(R.id.search_go_btn);
+        mSearchText = (TextView) findViewById(R.id.search_src_text);
         mVoiceButton = (ImageButton) findViewById(R.id.search_voice_btn);
-        mGoButton.setOnClickListener(this);
+
+        mSearchText.setOnKeyListener(this);
+
+        mSearchText.setOnClickListener(this);
         mVoiceButton.setOnClickListener(this);
-        mGoButton.setOnKeyListener(this);
-        mVoiceButton.setOnKeyListener(this);
-        
+        setOnClickListener(this);        
+
         mSearchText.setOnLongClickListener(this);
-        mGoButton.setOnLongClickListener(this);
         mVoiceButton.setOnLongClickListener(this);
-        
-        // disable the button since we start out w/empty input
-        mGoButton.setEnabled(false);
-        mGoButton.setFocusable(false);
-        
-        configureSearchableInfo();
-        configureSuggestions();
+
         configureVoiceSearchButton();
     }
-    
-    /**
-     * Cache of popup padding value after read from {@link Resources}.
-     */
-    private static float mPaddingInset = -1;
-    
-    /**
-     * When our size is changed, pass down adjusted width and offset values to
-     * correctly center the {@link AutoCompleteTextView} popup and include our
-     * padding.
-     */
-    @Override
-    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
-        super.onLayout(changed, left, top, right, bottom);
-        if (changed) {
-            if (mPaddingInset == -1) {
-                mPaddingInset = getResources().getDimension(R.dimen.search_widget_inset);
-            }
-            
-            // Fill entire width of widget, minus padding inset
-            float paddedWidth = getWidth() - (mPaddingInset * 2);
-            float paddedOffset = -(mSearchText.getLeft() - mPaddingInset);
-                
-            mSearchText.setDropDownWidth((int) paddedWidth);
-            mSearchText.setDropDownHorizontalOffset((int) paddedOffset);
-        }
-    }
-    
-    /**
-     * Read the searchable info from the search manager
-     */
-    private void configureSearchableInfo() {
-        ISearchManager sms;
-        SearchableInfo searchable;
-        sms = ISearchManager.Stub.asInterface(ServiceManager.getService(Context.SEARCH_SERVICE));
-        try {
-            // TODO null isn't the published use of this API, but it works when global=true
-            // TODO better implementation:  defer all of this, let Home set it up 
-            searchable = sms.getSearchableInfo(null, true);
-        } catch (RemoteException e) {
-            searchable = null;
-        }
-        if (searchable == null) {
-            // no suggestions so just get out (no need to continue)
-            return;
-        }
-        mSearchable = searchable;
-    }
-    
+
     /**
      * If appropriate & available, configure voice search
      * 
@@ -384,346 +314,45 @@
      * voice search.
      */
     private void configureVoiceSearchButton() {
-        boolean voiceSearchVisible = false;
-        if (mSearchable.getVoiceSearchEnabled() && mSearchable.getVoiceSearchLaunchWebSearch()) {
-            // Enable the voice search button if there is an activity that can handle it
-            PackageManager pm = getContext().getPackageManager();
-            ResolveInfo ri = pm.resolveActivity(mVoiceSearchIntent,
-                    PackageManager.MATCH_DEFAULT_ONLY);
-            voiceSearchVisible = ri != null;
-        }
-        
+        // Enable the voice search button if there is an activity that can handle it
+        PackageManager pm = getContext().getPackageManager();
+        ResolveInfo ri = pm.resolveActivity(mVoiceSearchIntent,
+                PackageManager.MATCH_DEFAULT_ONLY);
+        boolean voiceSearchVisible = ri != null;
+
         // finally, set visible state of voice search button, as appropriate
         mVoiceButton.setVisibility(voiceSearchVisible ? View.VISIBLE : View.GONE);
     }
-     
-    /** The rest of the class deals with providing search suggestions */
-    
+
     /**
-     * Set up the suggestions provider mechanism
+     * Sets the {@link Launcher} that this gadget will call on to display the search dialog. 
      */
-    private void configureSuggestions() {
-        // get SearchableInfo
-        
-        mSearchText.setOnItemClickListener(this);
-        mSearchText.setOnItemSelectedListener(this);
-        
-        // attach the suggestions adapter
-        mSuggestionsAdapter = new SuggestionsAdapter(mContext, 
-                com.android.internal.R.layout.search_dropdown_item_2line, null,
-                SuggestionsAdapter.TWO_LINE_FROM, SuggestionsAdapter.TWO_LINE_TO, mSearchable);
-        mSearchText.setAdapter(mSuggestionsAdapter);
+    public void setLauncher(Launcher launcher) {
+        mLauncher = launcher;
     }
-    
-    /**
-     * Remove internal cursor references when detaching from window which
-     * prevents {@link Context} leaks.
-     */
-    @Override
-    public void onDetachedFromWindow() {
-        if (mSuggestionsAdapter != null) {
-            mSuggestionsAdapter.changeCursor(null);
-            mSuggestionsAdapter = null;
-        }
-    }
-    
-    /**
-     * Implements OnItemClickListener
-     */
-    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-//      Log.d(TAG, "onItemClick() position " + position);
-        launchSuggestion(mSuggestionsAdapter, position);
-    }
-    
+
     /** 
-     * Implements OnItemSelectedListener
+     * Moves the view to the top left corner of its parent.
      */
-     public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
-//       Log.d(TAG, "onItemSelected() position " + position);
-         mItemSelected = position;
-     }
-
-     /** 
-      * Implements OnItemSelectedListener
-      */
-     public void onNothingSelected(AdapterView<?> parent) {
-//       Log.d(TAG, "onNothingSelected()");
-         mItemSelected = -1;
-     }
-
-    /**
-     * Code to launch a suggestion query.  
-     * 
-     * This is copied from SearchDialog.
-     * 
-     * @param ca The CursorAdapter containing the suggestions
-     * @param position The suggestion we'll be launching from
-     * 
-     * @return Returns true if a successful launch, false if could not (e.g. bad position)
-     */
-    private boolean launchSuggestion(CursorAdapter ca, int position) {
-        if (ca != null) {
-            Cursor c = ca.getCursor();
-            if ((c != null) && c.moveToPosition(position)) {
-                setupSuggestionIntent(c, mSearchable);
-                
-                SearchableInfo si = mSearchable;
-                String suggestionAction = mSuggestionAction;
-                Uri suggestionData = mSuggestionData;
-                String suggestionQuery = mSuggestionQuery;
-                sendLaunchIntent(suggestionAction, suggestionData, suggestionQuery, null,
-                                    KeyEvent.KEYCODE_UNKNOWN, null, si);
-                clearQuery();
-                return true;
-            }
-        }
-        return false;
-    }
-    
-    /**
-     * When a particular suggestion has been selected, perform the various lookups required
-     * to use the suggestion.  This includes checking the cursor for suggestion-specific data,
-     * and/or falling back to the XML for defaults;  It also creates REST style Uri data when
-     * the suggestion includes a data id.
-     * 
-     * NOTE:  Return values are in member variables mSuggestionAction, mSuggestionData and
-     * mSuggestionQuery.
-     * 
-     * This is copied from SearchDialog.
-     * 
-     * @param c The suggestions cursor, moved to the row of the user's selection
-     * @param si The searchable activity's info record
-     */
-    void setupSuggestionIntent(Cursor c, SearchableInfo si) {
-        try {
-            // use specific action if supplied, or default action if supplied, or fixed default
-            mSuggestionAction = null;
-            int column = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_INTENT_ACTION);
-            if (column >= 0) {
-                final String action = c.getString(column);
-                if (action != null) {
-                    mSuggestionAction = action;
-                }
-            }
-            if (mSuggestionAction == null) {
-                mSuggestionAction = si.getSuggestIntentAction();
-            }
-            if (mSuggestionAction == null) {
-                mSuggestionAction = Intent.ACTION_SEARCH;
-            }
-            
-            // use specific data if supplied, or default data if supplied
-            String data = null;
-            column = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_INTENT_DATA);
-            if (column >= 0) {
-                final String rowData = c.getString(column);
-                if (rowData != null) {
-                    data = rowData;
-                }
-            }
-            if (data == null) {
-                data = si.getSuggestIntentData();
-            }
-            
-            // then, if an ID was provided, append it.
-            if (data != null) {
-                column = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID);
-                if (column >= 0) {
-                    final String id = c.getString(column);
-                    if (id != null) {
-                        data = data + "/" + Uri.encode(id);
-                    }
-                }
-            }
-            mSuggestionData = (data == null) ? null : Uri.parse(data);
-            
-            mSuggestionQuery = null;
-            column = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_QUERY);
-            if (column >= 0) {
-                final String query = c.getString(column);
-                if (query != null) {
-                    mSuggestionQuery = query;
-                }
-            }
-        } catch (RuntimeException e ) {
-            int rowNum;
-            try {                       // be really paranoid now
-                rowNum = c.getPosition();
-            } catch (RuntimeException e2 ) {
-                rowNum = -1;
-            }
-            Log.w(TAG, "Search Suggestions cursor at row " + rowNum + 
-                            " returned exception" + e.toString());
-        }
-    }
-
-    SearchAutoCompleteTextView getSearchInputField() {
-        return (SearchAutoCompleteTextView) mSearchText;
-    }
-
-    /**
-     * This class provides the filtering-based interface to suggestions providers.
-     * It is hardwired in a couple of places to support GoogleSearch - for example, it supports
-     * two-line suggestions, but it does not support icons.
-     */
-    private static class SuggestionsAdapter extends SimpleCursorAdapter {
-        public final static String[] TWO_LINE_FROM =    {SearchManager.SUGGEST_COLUMN_TEXT_1,
-                                                         SearchManager.SUGGEST_COLUMN_TEXT_2 };
-        public final static int[] TWO_LINE_TO =         {com.android.internal.R.id.text1, 
-                                                         com.android.internal.R.id.text2};
-        
-        private final String TAG = "SuggestionsAdapter";
-        
-        Filter mFilter;
-        SearchableInfo mSearchable;
-        private Resources mProviderResources;
-        String[] mFromStrings;
-
-        public SuggestionsAdapter(Context context, int layout, Cursor c,
-                String[] from, int[] to, SearchableInfo searchable) {
-            super(context, layout, c, from, to);
-            mFromStrings = from;
-            mSearchable = searchable;
-            
-            // set up provider resources (gives us icons, etc.)
-            Context activityContext = mSearchable.getActivityContext(mContext);
-            Context providerContext = mSearchable.getProviderContext(mContext, activityContext);
-            mProviderResources = providerContext.getResources();
-        }
-        
-        /**
-         * Use the search suggestions provider to obtain a live cursor.  This will be called
-         * in a worker thread, so it's OK if the query is slow (e.g. round trip for suggestions).
-         * The results will be processed in the UI thread and changeCursor() will be called.
-         */
+    private class ToParentOriginAnimation extends Animation {
         @Override
-        public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
-            String query = (constraint == null) ? "" : constraint.toString();
-            return getSuggestions(mSearchable, query);
+        protected void applyTransformation(float interpolatedTime, Transformation t) {
+            float dx = -getLeft() * interpolatedTime;
+            float dy = -getTop() * interpolatedTime;
+            t.getMatrix().setTranslate(dx, dy);
         }
-        
-        /**
-         * Overriding this allows us to write the selected query back into the box.
-         * NOTE:  This is a vastly simplified version of SearchDialog.jamQuery() and does
-         * not universally support the search API.  But it is sufficient for Google Search.
-         */
-        @Override
-        public CharSequence convertToString(Cursor cursor) {
-            CharSequence result = null;
-            if (cursor != null) {
-                int column = cursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_QUERY);
-                if (column >= 0) {
-                    final String query = cursor.getString(column);
-                    if (query != null) {
-                        result = query;
-                    }
-                }
-            }
-            return result;
-        }
-
-        /**
-         * Get the query cursor for the search suggestions.
-         * 
-         * TODO this is functionally identical to the version in SearchDialog.java.  Perhaps it 
-         * could be hoisted into SearchableInfo or some other shared spot.
-         * 
-         * @param query The search text entered (so far)
-         * @return Returns a cursor with suggestions, or null if no suggestions 
-         */
-        private Cursor getSuggestions(final SearchableInfo searchable, final String query) {
-            Cursor cursor = null;
-            if (searchable.getSuggestAuthority() != null) {
-                try {
-                    StringBuilder uriStr = new StringBuilder("content://");
-                    uriStr.append(searchable.getSuggestAuthority());
-
-                    // if content path provided, insert it now
-                    final String contentPath = searchable.getSuggestPath();
-                    if (contentPath != null) {
-                        uriStr.append('/');
-                        uriStr.append(contentPath);
-                    }
-
-                    // append standard suggestion query path 
-                    uriStr.append('/' + SearchManager.SUGGEST_URI_PATH_QUERY);
-
-                    // inject query, either as selection args or inline
-                    String[] selArgs = null;
-                    if (searchable.getSuggestSelection() != null) {    // use selection if provided
-                        selArgs = new String[] {query};
-                    } else {
-                        uriStr.append('/');                             // no sel, use REST pattern
-                        uriStr.append(Uri.encode(query));
-                    }
-
-                    // finally, make the query
-                    cursor = mContext.getContentResolver().query(
-                                                        Uri.parse(uriStr.toString()), null, 
-                                                        searchable.getSuggestSelection(), selArgs,
-                                                        null);
-                } catch (RuntimeException e) {
-                    Log.w(TAG, "Search Suggestions query returned exception " + e.toString());
-                    cursor = null;
-                }
-            }
-            
-            return cursor;
-        }
-
-        /**
-         * Overriding this allows us to affect the way that an icon is loaded.  Specifically,
-         * we can be more controlling about the resource path (and allow icons to come from other
-         * packages).
-         * 
-         * TODO: This is 100% identical to the version in SearchDialog.java
-         *
-         * @param v ImageView to receive an image
-         * @param value the value retrieved from the cursor
-         */
-        @Override
-        public void setViewImage(ImageView v, String value) {
-            int resID;
-            Drawable img = null;
-
-            try {
-                resID = Integer.parseInt(value);
-                if (resID != 0) {
-                    img = mProviderResources.getDrawable(resID);
-                }
-            } catch (NumberFormatException nfe) {
-                // img = null;
-            } catch (NotFoundException e2) {
-                // img = null;
-            }
-            
-            // finally, set the image to whatever we've gotten
-            v.setImageDrawable(img);
-        }
-        
-        /**
-         * This method is overridden purely to provide a bit of protection against
-         * flaky content providers.
-         * 
-         * TODO: This is 100% identical to the version in SearchDialog.java
-         * 
-         * @see android.widget.ListAdapter#getView(int, View, ViewGroup)
-         */
-        @Override 
-        public View getView(int position, View convertView, ViewGroup parent) {
-            try {
-                return super.getView(position, convertView, parent);
-            } catch (RuntimeException e) {
-                Log.w(TAG, "Search Suggestions cursor returned exception " + e.toString());
-                // what can I return here?
-                View v = newView(mContext, mCursor, parent);
-                if (v != null) {
-                    TextView tv = (TextView) v.findViewById(com.android.internal.R.id.text1);
-                    tv.setText(e.toString());
-                }
-                return v;
-            }
-        }
-
     }
+
+    /** 
+     * Moves the view from the top left corner of its parent.
+     */
+    private class FromParentOriginAnimation extends Animation {
+        @Override
+        protected void applyTransformation(float interpolatedTime, Transformation t) {
+            float dx = -getLeft() * (1.0f - interpolatedTime);
+            float dy = -getTop() * (1.0f - interpolatedTime);
+            t.getMatrix().setTranslate(dx, dy);
+        }
+    }
+
 }
diff --git a/src/com/android/launcher/UninstallShortcutReceiver.java b/src/com/android/launcher/UninstallShortcutReceiver.java
index e490f9c..334fbc2 100644
--- a/src/com/android/launcher/UninstallShortcutReceiver.java
+++ b/src/com/android/launcher/UninstallShortcutReceiver.java
@@ -22,6 +22,7 @@
 import android.content.ContentResolver;
 import android.database.Cursor;
 import android.net.Uri;
+import android.widget.Toast;
 
 import java.net.URISyntaxException;
 
@@ -62,7 +63,11 @@
                 c.close();
             }
 
-            if (changed) cr.notifyChange(LauncherSettings.Favorites.CONTENT_URI, null);
+            if (changed) {
+                cr.notifyChange(LauncherSettings.Favorites.CONTENT_URI, null);
+                Toast.makeText(context, context.getString(R.string.shortcut_uninstalled, name),
+                        Toast.LENGTH_SHORT).show();
+            }
         }
     }
 }
diff --git a/src/com/android/launcher/UserFolder.java b/src/com/android/launcher/UserFolder.java
index 1044e96..6cdfed9 100644
--- a/src/com/android/launcher/UserFolder.java
+++ b/src/com/android/launcher/UserFolder.java
@@ -1,6 +1,7 @@
 package com.android.launcher;
 
 import android.content.Context;
+import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -33,6 +34,10 @@
         return (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
                 itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) && item.container != mInfo.id;
     }
+    
+    public Rect estimateDropLocation(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo, Rect recycle) {
+        return null;
+    }
 
     public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo) {
         final ApplicationInfo item = (ApplicationInfo) dragInfo;
diff --git a/src/com/android/launcher/Workspace.java b/src/com/android/launcher/Workspace.java
index 359767a..d474efa 100644
--- a/src/com/android/launcher/Workspace.java
+++ b/src/com/android/launcher/Workspace.java
@@ -48,7 +48,7 @@
  */
 public class Workspace extends ViewGroup implements DropTarget, DragSource, DragScroller {
     private static final int INVALID_SCREEN = -1;
-
+    
     /**
      * The velocity at which a fling gesture will cause us to snap to the next screen
      */
@@ -75,6 +75,11 @@
      * CellInfo for the cell that is currently being dragged
      */
     private CellLayout.CellInfo mDragInfo;
+    
+    /**
+     * Target drop area calculated during last acceptDrop call.
+     */
+    private int[] mTargetCell = null;
 
     private float mLastMotionX;
     private float mLastMotionY;
@@ -88,8 +93,14 @@
 
     private Launcher mLauncher;
     private DragController mDragger;
-
+    
+    /**
+     * Cache of vacant cells, used during drag events and invalidated as needed.
+     */
+    private CellLayout.CellInfo mVacantCache = null;
+    
     private int[] mTempCell = new int[2];
+    private int[] mTempEstimate = new int[2];
 
     private boolean mAllowLongPress;
     private boolean mLocked;
@@ -363,7 +374,7 @@
     CellLayout.CellInfo findAllVacantCells(boolean[] occupied) {
         CellLayout group = (CellLayout) getChildAt(mCurrentScreen);
         if (group != null) {
-            return group.findAllVacantCells(occupied);
+            return group.findAllVacantCells(occupied, null);
         }
         return null;
     }
@@ -890,7 +901,7 @@
     }
 
     public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo) {
-        final CellLayout cellLayout = (CellLayout) getChildAt(mCurrentScreen);
+        final CellLayout cellLayout = getCurrentDropLayout();
         if (source != this) {
             onDropExternal(x - xOffset, y - yOffset, dragInfo, cellLayout);
         } else {
@@ -902,7 +913,9 @@
                     originalCellLayout.removeView(cell);
                     cellLayout.addView(cell);
                 }
-                cellLayout.onDropChild(cell, x - xOffset, y - yOffset);
+                mTargetCell = estimateDropCell(source, x - xOffset, y - yOffset,
+                        mDragInfo.spanX, mDragInfo.spanY, cell, cellLayout, mTargetCell);
+                cellLayout.onDropChild(cell, mTargetCell);
 
                 final ItemInfo info = (ItemInfo)cell.getTag();
                 CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams();
@@ -914,6 +927,7 @@
 
     public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
             Object dragInfo) {
+        mVacantCache = null;
     }
 
     public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
@@ -922,6 +936,7 @@
 
     public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
             Object dragInfo) {
+        mVacantCache = null;
     }
 
     private void onDropExternal(int x, int y, Object dragInfo, CellLayout cellLayout) {
@@ -955,7 +970,8 @@
 
         cellLayout.addView(view, insertAtFirst ? 0 : -1);
         view.setOnLongClickListener(mLongClickListener);
-        cellLayout.onDropChild(view, x, y);
+        mTargetCell = estimateDropCell(null, x, y, 1, 1, view, cellLayout, mTargetCell);
+        cellLayout.onDropChild(view, mTargetCell);
         CellLayout.LayoutParams lp = (CellLayout.LayoutParams) view.getLayoutParams();
 
         final LauncherModel model = Launcher.getModel();
@@ -963,18 +979,73 @@
         LauncherModel.addOrMoveItemInDatabase(mLauncher, info,
                 LauncherSettings.Favorites.CONTAINER_DESKTOP, mCurrentScreen, lp.cellX, lp.cellY);
     }
-
-    public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
-            Object dragInfo) {
-
-        final CellLayout.CellInfo cellInfo = mDragInfo;
-        int cellHSpan = cellInfo == null ? 1 : cellInfo.spanX;
-        int cellVSpan = cellInfo == null ? 1 : cellInfo.spanY;
-
-        return ((CellLayout) getChildAt(mCurrentScreen)).acceptChildDrop(x - xOffset, y - yOffset,
-                cellHSpan, cellVSpan, cellInfo == null ? null : cellInfo.cell);
+    
+    /**
+     * Return the current {@link CellLayout}, correctly picking the destination
+     * screen while a scroll is in progress.
+     */
+    private CellLayout getCurrentDropLayout() {
+        int index = mScroller.isFinished() ? mCurrentScreen : mNextScreen;
+        return (CellLayout) getChildAt(index);
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean acceptDrop(DragSource source, int x, int y,
+            int xOffset, int yOffset, Object dragInfo) {
+        // Workspaces accept everything
+        return true;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Rect estimateDropLocation(DragSource source, int x, int y,
+            int xOffset, int yOffset, Object dragInfo, Rect recycle) {
+        final CellLayout layout = getCurrentDropLayout();
+        
+        final CellLayout.CellInfo cellInfo = mDragInfo;
+        final int spanX = cellInfo == null ? 1 : cellInfo.spanX;
+        final int spanY = cellInfo == null ? 1 : cellInfo.spanY;
+        final View ignoreView = cellInfo == null ? null : cellInfo.cell;
+        
+        final Rect location = recycle != null ? recycle : new Rect();
+        
+        // Find drop cell and convert into rectangle
+        int[] dropCell = estimateDropCell(source, x - xOffset, y - yOffset,
+                spanX, spanY, ignoreView, layout, mTempCell);
+        
+        if (dropCell == null) {
+            return null;
+        }
+        
+        layout.cellToPoint(dropCell[0], dropCell[1], mTempEstimate);
+        location.left = mTempEstimate[0];
+        location.top = mTempEstimate[1];
+        
+        layout.cellToPoint(dropCell[0] + spanX, dropCell[1] + spanY, mTempEstimate);
+        location.right = mTempEstimate[0];
+        location.bottom = mTempEstimate[1];
+        
+        return location;
+    }
+
+    /**
+     * Calculate the nearest cell where the given object would be dropped.
+     */
+    private int[] estimateDropCell(DragSource source, int pixelX, int pixelY,
+            int spanX, int spanY, View ignoreView, CellLayout layout, int[] recycle) {
+        // Create vacant cell cache if none exists
+        if (mVacantCache == null) {
+            mVacantCache = layout.findAllVacantCells(null, ignoreView);
+        }
+
+        // Find the best target drop location
+        return layout.findNearestVacantArea(pixelX, pixelY,
+                spanX, spanY, mVacantCache, recycle);
+    }
+    
     void setLauncher(Launcher launcher) {
         mLauncher = launcher;
     }
@@ -1002,12 +1073,14 @@
     }
 
     public void scrollLeft() {
+        mVacantCache = null;
         if (mNextScreen == INVALID_SCREEN && mCurrentScreen > 0 && mScroller.isFinished()) {
             snapToScreen(mCurrentScreen - 1);
         }
     }
 
     public void scrollRight() {
+        mVacantCache = null;
         if (mNextScreen == INVALID_SCREEN && mCurrentScreen < getChildCount() -1 &&
                 mScroller.isFinished()) {
             snapToScreen(mCurrentScreen + 1);
@@ -1027,7 +1100,7 @@
         }
         return result;
     }
-    
+
     /**
      * Find a search widget on the given screen
      */
@@ -1041,102 +1114,14 @@
         }
         return null;
     }
-    
+
     /**
-     * Focuses on the search widget on the specified screen,
-     * if there is one.  Also clears the current search selection so we don't 
+     * Gets the first search widget on the current screen, if there is one.
+     * Returns <code>null</code> otherwise.
      */
-    private boolean focusOnSearch(int screen) {
-        CellLayout currentScreen = (CellLayout) getChildAt(screen);
-        final Search searchWidget = findSearchWidget(currentScreen);
-        if (searchWidget != null) {
-            // This is necessary when focus on search is requested from the menu
-            // If the workspace was not in touch mode before the menu is invoked
-            // and the user clicks "Search" by touching the menu item, the following
-            // happens:
-            //
-            // - We request focus from touch on the search widget
-            // - The search widget gains focus
-            // - The window focus comes back to Home's window
-            // - The touch mode change is propagated to Home's window
-            // - The search widget is not focusable in touch mode and ViewRoot
-            //   clears its focus
-            //
-            // Forcing focusable in touch mode ensures the search widget will
-            // keep the focus no matter what happens.
-            //
-            // Note: the search input field disables focusable in touch mode
-            // after the window gets the focus back, see SearchAutoCompleteTextView
-            final SearchAutoCompleteTextView input = searchWidget.getSearchInputField();
-            input.setFocusableInTouchMode(true);
-            input.showKeyboardOnNextFocus();
-
-            if (isInTouchMode()) {
-                searchWidget.requestFocusFromTouch();
-            } else {
-                searchWidget.requestFocus();
-            }
-            searchWidget.clearQuery();
-            return true;
-        }
-        return false;
-    }
-    
-    /**
-     * Snap to the nearest screen with a search widget and give it focus
-     * 
-     * @return True if a search widget was found
-     */
-    public boolean snapToSearch() {
-        // The screen we are searching
-        int current = mCurrentScreen;
-        
-        // first position scanned so far
-        int first = current;
-
-        // last position scanned so far
-        int last = current;
-
-        // True if we should move down on the next iteration
-        boolean next = false;
-
-        // True when we have looked at the first item in the data
-        boolean hitFirst;
-
-        // True when we have looked at the last item in the data
-        boolean hitLast;
-        
-        final int count = getChildCount();
-
-        while (true) {
-            if (focusOnSearch(current)) {
-                return true;
-            }
-
-            hitLast = last == count - 1;
-            hitFirst = first == 0;
-
-            if (hitLast && hitFirst) {
-                // Looked at everything
-                break;
-            }
-
-            if (hitFirst || (next && !hitLast)) {
-                // Either we hit the top, or we are trying to move down
-                last++;
-                current = last;
-                // Try going up next time
-                next = false;
-            } else {
-                // Either we hit the bottom, or we are trying to move up
-                first--;
-                current = first;
-                // Try going down next time
-                next = true;
-            }
-
-        }
-        return false;
+    public Search findSearchWidgetOnCurrentScreen() {
+        CellLayout currentScreen = (CellLayout)getChildAt(mCurrentScreen);
+        return findSearchWidget(currentScreen);
     }
 
     public Folder getFolderForTag(Object tag) {