Merge commit 'goog/readonly-p4-master'

This commit is contained in:
The Android Open Source Project 2009-03-31 21:34:26 -07:00
commit 65e2f48ad9
23 changed files with 297 additions and 86 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 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_above_anchor="true"
android:drawable="@drawable/spinner_dropdown_background_up" />
<item android:drawable="@drawable/spinner_dropdown_background_down" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

View File

@ -42,20 +42,24 @@
android:inputType="textAutoComplete"
android:imeOptions="actionSearch"
android:lines="1"
android:dropDownWidth="fill_parent"
android:popupBackground="@drawable/spinner_dropdown_background"
/>
<ImageButton android:id="@+id/search_go_btn"
android:layout_marginLeft="4dip"
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="2dip"
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"
/>
</com.android.launcher.Search>

View File

@ -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">"Zástupce"</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">"Složka"</string>
<string name="group_live_folders">"Složka Live"</string>
<string name="group_widgets">"Miniaplikace"</string>
<string name="group_wallpapers">"Tapeta"</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">"Vyberte složku Live"</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>

View File

@ -26,20 +26,27 @@
<string name="rename_action">"OK"</string>
<string name="cancel_action">"Abbrechen"</string>
<string name="menu_item_add_item">"Zur Startseite hinzufügen"</string>
<string name="group_applications">"Anwendung"</string>
<string name="group_shortcuts">"Verknüpfung"</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">"Ordner"</string>
<string name="group_live_folders">"Live-Ordner"</string>
<string name="group_widgets">"Widget"</string>
<string name="group_wallpapers">"Hintergrund"</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 der Startseite ist kein Platz mehr vorhanden."</string>
<string name="title_select_shortcut">"Tastenkürzel auswählen"</string>
<string name="title_select_live_folder">"Live-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>

View File

@ -26,20 +26,27 @@
<string name="rename_action">"Aceptar"</string>
<string name="cancel_action">"Cancelar"</string>
<string name="menu_item_add_item">"Añadir a pantalla de página principal"</string>
<string name="group_applications">"Aplicación"</string>
<string name="group_shortcuts">"Acceso directo"</string>
<!-- no translation found for group_applications (4118484163419674240) -->
<skip />
<!-- no translation found for group_shortcuts (9133529424900391877) -->
<skip />
<string name="group_search">"Búsqueda"</string>
<string name="group_folder">"Carpeta"</string>
<string name="group_live_folders">"Carpeta activa"</string>
<string name="group_widgets">"Widget"</string>
<string name="group_wallpapers">"Fondo de pantalla"</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">"Picture frame"</string>
<string name="add_search">"Búsqueda de Google"</string>
<string name="out_of_space">"No queda espacio en esta pantalla de página principal."</string>
<string name="title_select_shortcut">"Seleccionar acceso directo"</string>
<string name="title_select_live_folder">"Seleccionar carpeta activa"</string>
<!-- no translation found for title_select_live_folder (3753447798805166749) -->
<skip />
<string name="menu_add">"Añadir"</string>
<string name="menu_wallpaper">"Fondo de pantalla"</string>
<string name="menu_search">"Buscar con Google"</string>

View File

@ -26,20 +26,27 @@
<string name="rename_action">"OK"</string>
<string name="cancel_action">"Annuler"</string>
<string name="menu_item_add_item">"Ajouter à l\'écran d\'accueil"</string>
<string name="group_applications">"Application"</string>
<string name="group_shortcuts">"Raccourci"</string>
<!-- no translation found for group_applications (4118484163419674240) -->
<skip />
<!-- no translation found for group_shortcuts (9133529424900391877) -->
<skip />
<string name="group_search">"Recherche"</string>
<string name="group_folder">"Dossier"</string>
<string name="group_live_folders">"Dossier actif"</string>
<string name="group_widgets">"Widget"</string>
<string name="group_wallpapers">"Arrière-plan"</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">"Dossier"</string>
<string name="add_clock">"Horloge"</string>
<string name="add_photo_frame">"Cadre d\'image"</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 dossier actif"</string>
<!-- no translation found for title_select_live_folder (3753447798805166749) -->
<skip />
<string name="menu_add">"Ajouter"</string>
<string name="menu_wallpaper">"Arrière-plan"</string>
<string name="menu_search">"Rechercher"</string>

View File

@ -26,20 +26,27 @@
<string name="rename_action">"OK"</string>
<string name="cancel_action">"Annulla"</string>
<string name="menu_item_add_item">"Aggiungi a schermata Home"</string>
<string name="group_applications">"Applicazione"</string>
<string name="group_shortcuts">"Scorciatoia"</string>
<!-- no translation found for group_applications (4118484163419674240) -->
<skip />
<!-- no translation found for group_shortcuts (9133529424900391877) -->
<skip />
<string name="group_search">"Ricerca"</string>
<string name="group_folder">"Cartella"</string>
<string name="group_live_folders">"Cartella dinamica"</string>
<string name="group_widgets">"Widget"</string>
<string name="group_wallpapers">"Sfondo"</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">"Cartella"</string>
<string name="add_clock">"Orologio"</string>
<string name="add_photo_frame">"Cornice immagini"</string>
<string name="add_search">"Ricerca"</string>
<string name="out_of_space">"Spazio nella schermata Home esaurito."</string>
<string name="title_select_shortcut">"Seleziona collegamento"</string>
<string name="title_select_live_folder">"Seleziona cartella dinamica"</string>
<!-- no translation found for title_select_live_folder (3753447798805166749) -->
<skip />
<string name="menu_add">"Aggiungi"</string>
<string name="menu_wallpaper">"Sfondo"</string>
<string name="menu_search">"Cerca"</string>

View File

@ -26,20 +26,27 @@
<string name="rename_action">"확인"</string>
<string name="cancel_action">"취소"</string>
<string name="menu_item_add_item">"홈 화면에 추가"</string>
<string name="group_applications">"응용프로그램"</string>
<string name="group_shortcuts">"바로가기"</string>
<!-- no translation found for group_applications (4118484163419674240) -->
<skip />
<!-- no translation found for group_shortcuts (9133529424900391877) -->
<skip />
<string name="group_search">"검색"</string>
<string name="group_folder">"폴더"</string>
<string name="group_live_folders">"라이브 폴더"</string>
<string name="group_widgets">"위젯"</string>
<string name="group_wallpapers">"배경화면"</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">"폴더"</string>
<string name="add_clock">"시계"</string>
<string name="add_photo_frame">"사진 프레임"</string>
<string name="add_search">"검색"</string>
<string name="out_of_space">"홈 화면에 더 이상 공간이 없습니다."</string>
<string name="title_select_shortcut">"바로가기 선택"</string>
<string name="title_select_live_folder">"라이브 폴더 선택"</string>
<!-- no translation found for title_select_live_folder (3753447798805166749) -->
<skip />
<string name="menu_add">"추가"</string>
<string name="menu_wallpaper">"배경화면"</string>
<string name="menu_search">"검색"</string>

View File

@ -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">"Applikasjon"</string>
<string name="group_shortcuts">"Snarvei"</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">"Mappe"</string>
<string name="group_live_folders">"Aktiv mappe"</string>
<string name="group_widgets">"Skrivebordselement"</string>
<string name="group_wallpapers">"Bakgrunnsbilde"</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 aktiv 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>

View File

@ -26,20 +26,27 @@
<string name="rename_action">"OK"</string>
<string name="cancel_action">"Annuleren"</string>
<string name="menu_item_add_item">"Toevoegen aan startpagina"</string>
<string name="group_applications">"Toepassing"</string>
<string name="group_shortcuts">"Snelkoppeling"</string>
<!-- no translation found for group_applications (4118484163419674240) -->
<skip />
<!-- no translation found for group_shortcuts (9133529424900391877) -->
<skip />
<string name="group_search">"Zoeken"</string>
<string name="group_folder">"Map"</string>
<string name="group_live_folders">"Live map"</string>
<string name="group_widgets">"Widget"</string>
<string name="group_wallpapers">"Achtergrond"</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">"Map"</string>
<string name="add_clock">"Klok"</string>
<string name="add_photo_frame">"Fotolijstje"</string>
<string name="add_search">"Zoeken"</string>
<string name="out_of_space">"Er is geen ruimte meer op dit startscherm."</string>
<string name="title_select_shortcut">"Snelkoppeling selecteren"</string>
<string name="title_select_live_folder">"Live map selecteren"</string>
<!-- no translation found for title_select_live_folder (3753447798805166749) -->
<skip />
<string name="menu_add">"Toevoegen"</string>
<string name="menu_wallpaper">"Achtergrond"</string>
<string name="menu_search">"Zoeken"</string>

View File

@ -26,20 +26,27 @@
<string name="rename_action">"OK"</string>
<string name="cancel_action">"Anuluj"</string>
<string name="menu_item_add_item">"Dodaj do strony głównej"</string>
<string name="group_applications">"Aplikacja"</string>
<string name="group_shortcuts">"Skrót"</string>
<!-- no translation found for group_applications (4118484163419674240) -->
<skip />
<!-- no translation found for group_shortcuts (9133529424900391877) -->
<skip />
<string name="group_search">"Wyszukiwarka"</string>
<string name="group_folder">"Folder"</string>
<string name="group_live_folders">"Folder aktywny"</string>
<string name="group_widgets">"Widget"</string>
<string name="group_wallpapers">"Tapeta"</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">"Folder"</string>
<string name="add_clock">"Zegar"</string>
<string name="add_photo_frame">"Ramka obrazu"</string>
<string name="add_search">"Wyszukiwarka"</string>
<string name="out_of_space">"Brak miejsca na tej stronie głównej"</string>
<string name="title_select_shortcut">"Wybierz skrót"</string>
<string name="title_select_live_folder">"Wybierz folder aktywny"</string>
<!-- no translation found for title_select_live_folder (3753447798805166749) -->
<skip />
<string name="menu_add">"Dodaj"</string>
<string name="menu_wallpaper">"Tapeta"</string>
<string name="menu_search">"Szukaj"</string>

View File

@ -26,20 +26,27 @@
<string name="rename_action">"ОК"</string>
<string name="cancel_action">"Отмена"</string>
<string name="menu_item_add_item">"Добавление на главный экран"</string>
<string name="group_applications">"Приложение"</string>
<string name="group_shortcuts">"Ярлык"</string>
<!-- no translation found for group_applications (4118484163419674240) -->
<skip />
<!-- no translation found for group_shortcuts (9133529424900391877) -->
<skip />
<string name="group_search">"Поиск"</string>
<string name="group_folder">"Папка"</string>
<string name="group_live_folders">"Динамическая папка"</string>
<string name="group_widgets">"Виджет"</string>
<string name="group_wallpapers">"Фоновый рисунок"</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">"Папка"</string>
<string name="add_clock">"Часы"</string>
<string name="add_photo_frame">"Рамка для картинки"</string>
<string name="add_search">"Поиск"</string>
<string name="out_of_space">"На главном экране больше нет места."</string>
<string name="title_select_shortcut">"Выберите ярлык"</string>
<string name="title_select_live_folder">"Выберите активную папку"</string>
<!-- no translation found for title_select_live_folder (3753447798805166749) -->
<skip />
<string name="menu_add">"Добавить"</string>
<string name="menu_wallpaper">"Фоновый рисунок"</string>
<string name="menu_search">"Искать"</string>

View File

@ -26,20 +26,27 @@
<string name="rename_action">"确定"</string>
<string name="cancel_action">"取消"</string>
<string name="menu_item_add_item">"添加到“主页”屏幕"</string>
<string name="group_applications">"应用程序"</string>
<string name="group_shortcuts">"快捷键"</string>
<!-- no translation found for group_applications (4118484163419674240) -->
<skip />
<!-- no translation found for group_shortcuts (9133529424900391877) -->
<skip />
<string name="group_search">"搜索"</string>
<string name="group_folder">"文件夹"</string>
<string name="group_live_folders">"活动的文件夹"</string>
<string name="group_widgets">"小工具"</string>
<string name="group_wallpapers">"壁纸"</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">"文件夹"</string>
<string name="add_clock">"时钟"</string>
<string name="add_photo_frame">"相框"</string>
<string name="add_search">"搜索"</string>
<string name="out_of_space">"该“主页”屏幕上没有多余空间。"</string>
<string name="title_select_shortcut">"选择快捷键"</string>
<string name="title_select_live_folder">"选择活动文件夹"</string>
<!-- no translation found for title_select_live_folder (3753447798805166749) -->
<skip />
<string name="menu_add">"添加"</string>
<string name="menu_wallpaper">"壁纸"</string>
<string name="menu_search">"搜索"</string>

View File

@ -26,20 +26,27 @@
<string name="rename_action">"確定"</string>
<string name="cancel_action">"取消"</string>
<string name="menu_item_add_item">"新增至首頁畫面"</string>
<string name="group_applications">"應用程式"</string>
<string name="group_shortcuts">"捷徑"</string>
<!-- no translation found for group_applications (4118484163419674240) -->
<skip />
<!-- no translation found for group_shortcuts (9133529424900391877) -->
<skip />
<string name="group_search">"搜尋"</string>
<string name="group_folder">"資料夾"</string>
<string name="group_live_folders">"使用中的資料夾"</string>
<string name="group_widgets">"Widget"</string>
<string name="group_wallpapers">"桌布"</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">"資料夾"</string>
<string name="add_clock">"時鐘"</string>
<string name="add_photo_frame">"相框"</string>
<string name="add_search">"搜尋"</string>
<string name="out_of_space">"首頁已無空間"</string>
<string name="title_select_shortcut">"選取捷徑"</string>
<string name="title_select_live_folder">"選取作用中資料夾"</string>
<!-- no translation found for title_select_live_folder (3753447798805166749) -->
<skip />
<string name="menu_add">"新增"</string>
<string name="menu_wallpaper">"桌布"</string>
<string name="menu_search">"搜尋"</string>

19
res/values/dimens.xml Normal file
View File

@ -0,0 +1,19 @@
<?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>
<dimen name="search_widget_inset">19dip</dimen>
</resources>

View File

@ -53,4 +53,11 @@
<item name="android:layout_marginLeft">10dip</item>
<item name="android:layout_marginRight">10dip</item>
</style>
<style name="SearchButton" parent="@android:style/Widget.Button.Small">
<item name="android:paddingTop">7dip</item>
<item name="android:paddingBottom">9dip</item>
<item name="android:paddingLeft">10dip</item>
<item name="android:paddingRight">10dip</item>
</style>
</resources>

View File

@ -168,6 +168,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
private final BroadcastReceiver mApplicationsReceiver = new ApplicationsIntentReceiver();
private final ContentObserver mObserver = new FavoritesChangeObserver();
private final ContentObserver mAppWidgetResetObserver = new AppWidgetResetObserver();
private LayoutInflater mInflater;
@ -826,6 +827,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
sModel.abortLoaders();
getContentResolver().unregisterContentObserver(mObserver);
getContentResolver().unregisterContentObserver(mAppWidgetResetObserver);
unregisterReceiver(mApplicationsReceiver);
}
@ -1156,6 +1158,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
private void registerContentObservers() {
ContentResolver resolver = getContentResolver();
resolver.registerContentObserver(LauncherSettings.Favorites.CONTENT_URI, true, mObserver);
resolver.registerContentObserver(LauncherProvider.CONTENT_APPWIDGET_RESET_URI, true, mAppWidgetResetObserver);
}
@Override
@ -1221,6 +1224,16 @@ public final class Launcher extends Activity implements View.OnClickListener, On
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();
@ -1877,6 +1890,21 @@ public final class Launcher extends Activity implements View.OnClickListener, On
}
}
/**
* 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.
*/

View File

@ -65,6 +65,14 @@ public class LauncherProvider extends ContentProvider {
static final String TABLE_FAVORITES = "favorites";
static final String PARAMETER_NOTIFY = "notify";
/**
* {@link Uri} triggered at any registered {@link ContentObserver} when
* {@link AppWidgetHost#deleteHost()} is called during database creation.
* Use this to recall {@link AppWidgetHost#startListening()} if needed.
*/
static final Uri CONTENT_APPWIDGET_RESET_URI =
Uri.parse("content://" + AUTHORITY + "/appWidgetReset");
private SQLiteOpenHelper mOpenHelper;
@Override
@ -176,6 +184,17 @@ public class LauncherProvider extends ContentProvider {
mAppWidgetHost = new AppWidgetHost(context, Launcher.APPWIDGET_HOST_ID);
}
/**
* Send notification that we've deleted the {@link AppWidgetHost},
* probably as part of the initial database creation. The receiver may
* want to re-call {@link AppWidgetHost#startListening()} to ensure
* callbacks are correctly set.
*/
private void sendAppWidgetResetNotify() {
final ContentResolver resolver = mContext.getContentResolver();
resolver.notifyChange(CONTENT_APPWIDGET_RESET_URI, null);
}
@Override
public void onCreate(SQLiteDatabase db) {
if (LOGD) Log.d(LOG_TAG, "creating new launcher database");
@ -204,6 +223,7 @@ public class LauncherProvider extends ContentProvider {
// Database was just created, so wipe any previous widgets
if (mAppWidgetHost != null) {
mAppWidgetHost.deleteHost();
sendAppWidgetResetNotify();
}
if (!convertDatabase(db)) {

View File

@ -328,6 +328,33 @@ public class Search extends LinearLayout implements OnClickListener, OnKeyListen
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
*/