summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/gardening_crosshairs.pngbin605 -> 0 bytes
-rw-r--r--res/drawable-mdpi/gardening_crosshairs.pngbin498 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-hdpi/ic_no_applications.pngbin7774 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-hdpi/tab_selected_focused_holo.9.pngbin218 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-hdpi/tab_selected_holo.9.pngbin159 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-hdpi/tab_selected_pressed_focused_holo.9.pngbin522 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-hdpi/tab_selected_pressed_holo.9.pngbin271 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-mdpi/ic_home_add_holo_dark.pngbin1919 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-mdpi/ic_no_applications.pngbin3190 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-mdpi/tab_selected_focused_holo.9.pngbin199 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-mdpi/tab_selected_holo.9.pngbin140 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-mdpi/tab_selected_pressed_focused_holo.9.pngbin439 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-mdpi/tab_selected_pressed_holo.9.pngbin229 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/gardening_crosshairs.pngbin766 -> 0 bytes
-rw-r--r--res/values-af/strings.xml3
-rw-r--r--res/values-am/strings.xml3
-rw-r--r--res/values-ca/strings.xml3
-rw-r--r--res/values-cs/strings.xml4
-rw-r--r--res/values-da/strings.xml3
-rw-r--r--res/values-en-rGB/strings.xml3
-rw-r--r--res/values-es/strings.xml3
-rw-r--r--res/values-fr/strings.xml3
-rw-r--r--res/values-it/strings.xml3
-rw-r--r--res/values-nb/strings.xml3
-rw-r--r--res/values-nl/strings.xml3
-rw-r--r--res/values-sv/strings.xml3
-rw-r--r--res/values-uk/strings.xml3
-rw-r--r--res/values/config.xml2
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java28
-rw-r--r--src/com/android/launcher2/AppsCustomizeTabHost.java13
-rw-r--r--src/com/android/launcher2/BubbleTextView.java13
-rw-r--r--src/com/android/launcher2/CellLayout.java102
-rw-r--r--src/com/android/launcher2/DragLayer.java22
-rw-r--r--src/com/android/launcher2/FocusHelper.java10
-rw-r--r--src/com/android/launcher2/Folder.java14
-rw-r--r--src/com/android/launcher2/FolderIcon.java2
-rw-r--r--src/com/android/launcher2/HolographicOutlineHelper.java20
-rw-r--r--src/com/android/launcher2/IconCache.java2
-rw-r--r--src/com/android/launcher2/Launcher.java75
-rw-r--r--src/com/android/launcher2/LauncherModel.java3
-rw-r--r--src/com/android/launcher2/LauncherProvider.java72
-rw-r--r--src/com/android/launcher2/PagedView.java76
-rw-r--r--src/com/android/launcher2/PagedViewCellLayout.java30
-rw-r--r--src/com/android/launcher2/SmoothPagedView.java2
-rw-r--r--src/com/android/launcher2/Workspace.java46
45 files changed, 294 insertions, 278 deletions
diff --git a/res/drawable-hdpi/gardening_crosshairs.png b/res/drawable-hdpi/gardening_crosshairs.png
deleted file mode 100644
index d2d263c..0000000
--- a/res/drawable-hdpi/gardening_crosshairs.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/gardening_crosshairs.png b/res/drawable-mdpi/gardening_crosshairs.png
deleted file mode 100644
index 9d9f3c1..0000000
--- a/res/drawable-mdpi/gardening_crosshairs.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/ic_no_applications.png b/res/drawable-sw600dp-hdpi/ic_no_applications.png
deleted file mode 100644
index 933d091..0000000
--- a/res/drawable-sw600dp-hdpi/ic_no_applications.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/tab_selected_focused_holo.9.png b/res/drawable-sw600dp-hdpi/tab_selected_focused_holo.9.png
deleted file mode 100644
index 1ba35d5..0000000
--- a/res/drawable-sw600dp-hdpi/tab_selected_focused_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/tab_selected_holo.9.png b/res/drawable-sw600dp-hdpi/tab_selected_holo.9.png
deleted file mode 100644
index ef913cc..0000000
--- a/res/drawable-sw600dp-hdpi/tab_selected_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/tab_selected_pressed_focused_holo.9.png b/res/drawable-sw600dp-hdpi/tab_selected_pressed_focused_holo.9.png
deleted file mode 100644
index d7e9688..0000000
--- a/res/drawable-sw600dp-hdpi/tab_selected_pressed_focused_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/tab_selected_pressed_holo.9.png b/res/drawable-sw600dp-hdpi/tab_selected_pressed_holo.9.png
deleted file mode 100644
index b8b1fcf..0000000
--- a/res/drawable-sw600dp-hdpi/tab_selected_pressed_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/ic_home_add_holo_dark.png b/res/drawable-sw600dp-mdpi/ic_home_add_holo_dark.png
deleted file mode 100644
index 7f04589..0000000
--- a/res/drawable-sw600dp-mdpi/ic_home_add_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/ic_no_applications.png b/res/drawable-sw600dp-mdpi/ic_no_applications.png
deleted file mode 100644
index a4f695a..0000000
--- a/res/drawable-sw600dp-mdpi/ic_no_applications.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/tab_selected_focused_holo.9.png b/res/drawable-sw600dp-mdpi/tab_selected_focused_holo.9.png
deleted file mode 100644
index 782ae35..0000000
--- a/res/drawable-sw600dp-mdpi/tab_selected_focused_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/tab_selected_holo.9.png b/res/drawable-sw600dp-mdpi/tab_selected_holo.9.png
deleted file mode 100644
index 255d072..0000000
--- a/res/drawable-sw600dp-mdpi/tab_selected_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/tab_selected_pressed_focused_holo.9.png b/res/drawable-sw600dp-mdpi/tab_selected_pressed_focused_holo.9.png
deleted file mode 100644
index 10152bb..0000000
--- a/res/drawable-sw600dp-mdpi/tab_selected_pressed_focused_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/tab_selected_pressed_holo.9.png b/res/drawable-sw600dp-mdpi/tab_selected_pressed_holo.9.png
deleted file mode 100644
index 822ed51..0000000
--- a/res/drawable-sw600dp-mdpi/tab_selected_pressed_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/gardening_crosshairs.png b/res/drawable-xhdpi/gardening_crosshairs.png
deleted file mode 100644
index 3168463..0000000
--- a/res/drawable-xhdpi/gardening_crosshairs.png
+++ /dev/null
Binary files differ
diff --git a/res/values-af/strings.xml b/res/values-af/strings.xml
index 9d33b97..4d8b381 100644
--- a/res/values-af/strings.xml
+++ b/res/values-af/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Kortpaaie"</string>
<string name="group_widgets" msgid="6704978494073105844">"Legstukke"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Muurpapier"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"Geen spasie op tuisskerms oor nie."</string>
<string name="out_of_space" msgid="8365249326091984698">"Geen meer spasie op tuisskerm nie."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"Geen plek meer op die warmlaai nie."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Hierdie legstuk is te groot vir die hoofposisie."</string>
diff --git a/res/values-am/strings.xml b/res/values-am/strings.xml
index d3bd40f..375ba31 100644
--- a/res/values-am/strings.xml
+++ b/res/values-am/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"አቋራጮች"</string>
<string name="group_widgets" msgid="6704978494073105844">"ፍርግሞች"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"ልጣፍ"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"የመነሻ ማያ ገጾችህ ላይ ተጨማሪ ቦታ የለም።"</string>
<string name="out_of_space" msgid="8365249326091984698">"በዚህ መነሻ ማያ ላይ ምንም ቦታ የለም።"</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"በመትከያ ቦታው ላይ ተጨማሪ ክፍል የለም።"</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"ይህ ፍርግም ለማስቀመጫው በጣም ትልቅ ነው።"</string>
diff --git a/res/values-ca/strings.xml b/res/values-ca/strings.xml
index 0530068..a71b9f1 100644
--- a/res/values-ca/strings.xml
+++ b/res/values-ca/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Dreceres"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Empaperats"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"No queda espai a les pantalles d\'inici."</string>
<string name="out_of_space" msgid="8365249326091984698">"Ja no queda espai en aquesta pantalla Inici."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"No queda espai al hotseat."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Aquest widget és massa gran per al hotseat."</string>
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index ad1ce99..7d55c07 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -95,9 +95,9 @@
<string name="workspace_cling_move_item" msgid="791013895761065070">"Sem můžete umístit své oblíbené aplikace."</string>
<string name="workspace_cling_open_all_apps" msgid="2459977609848572588">"Chcete-li zobrazit všechny aplikace, dotkněte se kruhu."</string>
<string name="all_apps_cling_title" msgid="2559734712581447107">"Vybrat několik aplikací"</string>
- <string name="all_apps_cling_add_item" msgid="5665035103260318891">"Chcete-li na plochu přidat aplikaci, dotkněte se jí a podržte."</string>
+ <string name="all_apps_cling_add_item" msgid="5665035103260318891">"Chcete-li na plochu přidat aplikaci, dotkněte se jí a přidržte ji."</string>
<string name="folder_cling_title" msgid="4308949882377840953">"Uspořádat aplikace pomocí složek"</string>
- <string name="folder_cling_move_item" msgid="270598675060435169">"Chcete-li aplikaci přesunout, dotkněte se jí a podržte ji."</string>
+ <string name="folder_cling_move_item" msgid="270598675060435169">"Chcete-li aplikaci přesunout, dotkněte se jí a přidržte ji."</string>
<string name="folder_cling_create_folder" msgid="8352867485656129478">"Chcete-li na ploše vytvořit novou složku, přesuňte jednu aplikaci na druhou."</string>
<string name="cling_dismiss" msgid="2780907108735868381">"OK"</string>
<string name="folder_opened" msgid="1262064100943801533">"Složka otevřena, rozměry <xliff:g id="WIDTH">%1$d</xliff:g> × <xliff:g id="HEIGHT">%2$d</xliff:g>"</string>
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index 316f989..0014d40 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Genveje"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Tapeter"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"Der er ikke mere plads på dine startskærme."</string>
<string name="out_of_space" msgid="8365249326091984698">"Der er ikke mere plads på Startskærmen."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"Der er ikke mere plads i hotseatet."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Denne widget er for stor til hotseat."</string>
diff --git a/res/values-en-rGB/strings.xml b/res/values-en-rGB/strings.xml
index 7005487..941fa8e 100644
--- a/res/values-en-rGB/strings.xml
+++ b/res/values-en-rGB/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Shortcuts"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Wallpaper"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"No more room on your Home screens."</string>
<string name="out_of_space" msgid="8365249326091984698">"No more room on this Home screen."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"No more room on the hotseat."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"This widget is too large for the hot-seat."</string>
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index 81933e3..dda1d9e 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Accesos directos"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Fondos de pantalla"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"No queda espacio en las pantallas del escritorio."</string>
<string name="out_of_space" msgid="8365249326091984698">"No queda espacio en el escritorio."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"No queda espacio en la barra de accesos directos."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Este widget es demasiado grande para la barra de accesos directos."</string>
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index 4021dbf..515ae7f 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Raccourcis"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Fonds d\'écran"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"Vous n\'avez plus d\'espace libre sur vos écrans d\'accueil."</string>
<string name="out_of_space" msgid="8365249326091984698">"Plus d\'espace libre sur l\'écran d\'accueil."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"Vous n\'avez plus de place sur la barre d\'accès rapide."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Ce widget est trop volumineux pour la barre d\'accès rapide."</string>
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index ffad4a0..8381be2 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Scorciatoie"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widget"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Sfondi"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"Spazio nelle schermate Home esaurito."</string>
<string name="out_of_space" msgid="8365249326091984698">"Spazio nella schermata Home esaurito."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"Spazio nell\'area hotseat esaurito."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Questo widget è troppo grande per l\'area hotseat."</string>
diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
index 361126c..b795c05 100644
--- a/res/values-nb/strings.xml
+++ b/res/values-nb/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Snarveier"</string>
<string name="group_widgets" msgid="6704978494073105844">"Skrivebordselementer"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Bakgrunner"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"Det er ikke mer plass på startsidene dine."</string>
<string name="out_of_space" msgid="8365249326091984698">"Ikke nok plass på skrivebordet."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"Dokksonen er full."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Denne modulen er for stor for hotseat-feltet."</string>
diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml
index fbd9f31..3758b55 100644
--- a/res/values-nl/strings.xml
+++ b/res/values-nl/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Sneltoetsen"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Achtergronden"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"Er is geen ruimte meer op uw startschermen."</string>
<string name="out_of_space" msgid="8365249326091984698">"Er is geen ruimte meer op dit startscherm."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"Er is geen ruimte meer op de hotseat."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Deze widget is te groot voor de hotseat."</string>
diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml
index b3ee3e1..46bd262 100644
--- a/res/values-sv/strings.xml
+++ b/res/values-sv/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Genvägar"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgetar"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Bakgrundsbilder"</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"Det finns inte plats för mer på dina startskärmar."</string>
<string name="out_of_space" msgid="8365249326091984698">"Det finns inte plats för mer på den här startsidan."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"Utrymmet på Hotseat är fullt."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Denna widget är för stor för Hotseat."</string>
diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml
index a8b094d..bf8f165 100644
--- a/res/values-uk/strings.xml
+++ b/res/values-uk/strings.xml
@@ -40,8 +40,7 @@
<string name="group_shortcuts" msgid="9133529424900391877">"Ярлики"</string>
<string name="group_widgets" msgid="6704978494073105844">"Віджети"</string>
<string name="group_wallpapers" msgid="1568191644272224858">"Фонові мал."</string>
- <!-- no translation found for completely_out_of_space (1759078539443491182) -->
- <skip />
+ <string name="completely_out_of_space" msgid="1759078539443491182">"На головних екранах більше немає місця."</string>
<string name="out_of_space" msgid="8365249326091984698">"Немає більше місця на гол. екрані."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"На гарячій панелі більше немає місця."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Цей віджет завеликий для Hotseat."</string>
diff --git a/res/values/config.xml b/res/values/config.xml
index 1890125..bfd2bf5 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -42,8 +42,6 @@
<!-- The transition duration for the background of the drop targets -->
<integer name="config_dropTargetBgTransitionDuration">0</integer>
- <integer name="config_crosshairsFadeInTime">600</integer>
-
<!-- The duration (in ms) of the fade animation on the object outlines, used when
we are dragging objects around on the home screen. -->
<integer name="config_dragOutlineFadeTime">900</integer>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 2935cea..40bc2ca 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -576,9 +576,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
@Override
public void run() {
mWidgetLoadingId = mLauncher.getAppWidgetHost().allocateAppWidgetId();
- AppWidgetManager.getInstance(mLauncher).bindAppWidgetId(mWidgetLoadingId,
- info.componentName);
- mWidgetCleanupState = WIDGET_BOUND;
+ if (AppWidgetManager.getInstance(mLauncher)
+ .bindAppWidgetIdIfAllowed(mWidgetLoadingId, info.componentName)) {
+ mWidgetCleanupState = WIDGET_BOUND;
+ }
}
};
post(mBindWidgetRunnable);
@@ -586,8 +587,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mInflateWidgetRunnable = new Runnable() {
@Override
public void run() {
- AppWidgetHostView hostView =
- mLauncher.getAppWidgetHost().createView(mContext, mWidgetLoadingId, pInfo);
+ AppWidgetHostView hostView = mLauncher.
+ getAppWidgetHost().createView(getContext(), mWidgetLoadingId, pInfo);
info.boundWidget = hostView;
mWidgetCleanupState = WIDGET_INFLATED;
hostView.setVisibility(INVISIBLE);
@@ -761,7 +762,12 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
@Override
- public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) {
+ public View getContent() {
+ return null;
+ }
+
+ @Override
+ public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) {
mInTransition = true;
if (toWorkspace) {
cancelAllTasks();
@@ -769,8 +775,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
@Override
- public View getContent() {
- return null;
+ public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) {
}
@Override
@@ -859,6 +864,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
iter.remove();
mDirtyPageContent.set(task.page, true);
}
+ mDeferredSyncWidgetPageItems.clear();
}
public void setContentType(ContentType type) {
@@ -1419,7 +1425,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
float alpha;
- if (!LauncherApplication.isScreenLarge() || scrollProgress < 0) {
+ if (scrollProgress < 0) {
alpha = scrollProgress < 0 ? mAlphaInterpolator.getInterpolation(
1 - Math.abs(scrollProgress)) : 1.0f;
} else {
@@ -1462,7 +1468,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// If the view has 0 alpha, we set it to be invisible so as to prevent
// it from accepting touches
- if (alpha < ViewConfiguration.ALPHA_THRESHOLD) {
+ if (alpha == 0) {
v.setVisibility(INVISIBLE);
} else if (v.getVisibility() != VISIBLE) {
v.setVisibility(VISIBLE);
@@ -1687,6 +1693,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
count = mNumWidgetPages;
}
- return String.format(mContext.getString(stringId), page + 1, count);
+ return String.format(getContext().getString(stringId), page + 1, count);
}
}
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 21842da..01c08c9 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -102,7 +102,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
setup();
final ViewGroup tabsContainer = (ViewGroup) findViewById(R.id.tabs_container);
- final TabWidget tabs = (TabWidget) findViewById(com.android.internal.R.id.tabs);
+ final TabWidget tabs = getTabWidget();
final AppsCustomizePagedView appsCustomizePane = (AppsCustomizePagedView)
findViewById(R.id.apps_customize_pane_content);
mTabs = tabs;
@@ -123,12 +123,12 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
// Create the tabs
TextView tabView;
String label;
- label = mContext.getString(R.string.all_apps_button_label);
+ label = getContext().getString(R.string.all_apps_button_label);
tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
tabView.setText(label);
tabView.setContentDescription(label);
addTab(newTabSpec(APPS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
- label = mContext.getString(R.string.widgets_tab_label);
+ label = getContext().getString(R.string.widgets_tab_label);
tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
tabView.setText(label);
tabView.setContentDescription(label);
@@ -376,8 +376,8 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
/* LauncherTransitionable overrides */
@Override
- public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) {
- mAppsCustomizePane.onLauncherTransitionStart(l, animated, toWorkspace);
+ public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) {
+ mAppsCustomizePane.onLauncherTransitionPrepare(l, animated, toWorkspace);
mInTransition = true;
mTransitioningToWorkspace = toWorkspace;
@@ -404,7 +404,10 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
mAppsCustomizePane.reset();
mResetAfterTransition = false;
}
+ }
+ @Override
+ public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) {
if (animated) {
enableAndBuildHardwareLayer();
}
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index 526fda7..ddc4b9f 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -99,7 +99,7 @@ public class BubbleTextView extends TextView {
@Override
protected boolean setFrame(int left, int top, int right, int bottom) {
- if (mLeft != left || mRight != right || mTop != top || mBottom != bottom) {
+ if (getLeft() != left || getRight() != right || getTop() != top || getBottom() != bottom) {
mBackgroundSizeChanged = true;
}
return super.setFrame(left, top, right, bottom);
@@ -268,11 +268,11 @@ public class BubbleTextView extends TextView {
public void draw(Canvas canvas) {
final Drawable background = mBackground;
if (background != null) {
- final int scrollX = mScrollX;
- final int scrollY = mScrollY;
+ final int scrollX = getScrollX();
+ final int scrollY = getScrollY();
if (mBackgroundSizeChanged) {
- background.setBounds(0, 0, mRight - mLeft, mBottom - mTop);
+ background.setBounds(0, 0, getRight() - getLeft(), getBottom() - getTop());
mBackgroundSizeChanged = false;
}
@@ -296,8 +296,9 @@ public class BubbleTextView extends TextView {
getPaint().setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
super.draw(canvas);
canvas.save(Canvas.CLIP_SAVE_FLAG);
- canvas.clipRect(mScrollX, mScrollY + getExtendedPaddingTop(), mScrollX + getWidth(),
- mScrollY + getHeight(), Region.Op.INTERSECT);
+ canvas.clipRect(getScrollX(), getScrollY() + getExtendedPaddingTop(),
+ getScrollX() + getWidth(),
+ getScrollY() + getHeight(), Region.Op.INTERSECT);
getPaint().setShadowLayer(SHADOW_SMALL_RADIUS, 0.0f, 0.0f, SHADOW_SMALL_COLOUR);
super.draw(canvas);
canvas.restore();
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index a48a815..10eb8f8 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -122,10 +122,6 @@ public class CellLayout extends ViewGroup {
private BubbleTextView mPressedOrFocusedIcon;
- private Drawable mCrosshairsDrawable = null;
- private InterruptibleInOutAnimator mCrosshairsAnimator = null;
- private float mCrosshairsVisibility = 0.0f;
-
private HashMap<CellLayout.LayoutParams, Animator> mReorderAnimators = new
HashMap<CellLayout.LayoutParams, Animator>();
private HashMap<View, ReorderHintAnimation>
@@ -173,7 +169,7 @@ public class CellLayout extends ViewGroup {
public CellLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- mDragEnforcer = new DropTarget.DragEnforcer(mContext);
+ mDragEnforcer = new DropTarget.DragEnforcer(context);
// A ViewGroup usually does not draw, but CellLayout needs to draw a rectangle to show
// the user where a dragged item will land when dropped.
@@ -227,19 +223,8 @@ public class CellLayout extends ViewGroup {
// Initialize the data structures used for the drag visualization.
- mCrosshairsDrawable = res.getDrawable(R.drawable.gardening_crosshairs);
mEaseOutInterpolator = new DecelerateInterpolator(2.5f); // Quint ease out
- // Set up the animation for fading the crosshairs in and out
- int animDuration = res.getInteger(R.integer.config_crosshairsFadeInTime);
- mCrosshairsAnimator = new InterruptibleInOutAnimator(animDuration, 0.0f, 1.0f);
- mCrosshairsAnimator.getAnimator().addUpdateListener(new AnimatorUpdateListener() {
- public void onAnimationUpdate(ValueAnimator animation) {
- mCrosshairsVisibility = ((Float) animation.getAnimatedValue()).floatValue();
- invalidate();
- }
- });
- mCrosshairsAnimator.getAnimator().setInterpolator(mEaseOutInterpolator);
mDragCell[0] = mDragCell[1] = -1;
for (int i = 0; i < mDragOutlines.length; i++) {
@@ -422,38 +407,6 @@ public class CellLayout extends ViewGroup {
bg.draw(canvas);
}
- if (mCrosshairsVisibility > 0.0f) {
- final int countX = mCountX;
- final int countY = mCountY;
-
- final float MAX_ALPHA = 0.4f;
- final int MAX_VISIBLE_DISTANCE = 600;
- final float DISTANCE_MULTIPLIER = 0.002f;
-
- final Drawable d = mCrosshairsDrawable;
- final int width = d.getIntrinsicWidth();
- final int height = d.getIntrinsicHeight();
-
- int x = getPaddingLeft() - (mWidthGap / 2) - (width / 2);
- for (int col = 0; col <= countX; col++) {
- int y = getPaddingTop() - (mHeightGap / 2) - (height / 2);
- for (int row = 0; row <= countY; row++) {
- mTmpPointF.set(x - mDragCenter.x, y - mDragCenter.y);
- float dist = mTmpPointF.length();
- // Crosshairs further from the drag point are more faint
- float alpha = Math.min(MAX_ALPHA,
- DISTANCE_MULTIPLIER * (MAX_VISIBLE_DISTANCE - dist));
- if (alpha > 0.0f) {
- d.setBounds(x, y, x + width, y + height);
- d.setAlpha((int) (alpha * 255 * mCrosshairsVisibility));
- d.draw(canvas);
- }
- y += mCellHeight + mHeightGap;
- }
- x += mCellWidth + mWidthGap;
- }
- }
-
final Paint paint = mDragOutlinePaint;
for (int i = 0; i < mDragOutlines.length; i++) {
final float alpha = mDragOutlineAlphas[i];
@@ -747,8 +700,8 @@ public class CellLayout extends ViewGroup {
public void setTagToCellInfoForPoint(int touchX, int touchY) {
final CellInfo cellInfo = mCellInfo;
Rect frame = mRect;
- final int x = touchX + mScrollX;
- final int y = touchY + mScrollY;
+ final int x = touchX + getScrollX();
+ final int y = touchY + getScrollY();
final int count = mShortcutsAndWidgets.getChildCount();
boolean found = false;
@@ -766,7 +719,7 @@ public class CellLayout extends ViewGroup {
// The child hit rect is relative to the CellLayoutChildren parent, so we need to
// offset that by this CellLayout's padding to test an (x,y) point that is relative
// to this view.
- frame.offset(mPaddingLeft, mPaddingTop);
+ frame.offset(getPaddingLeft(), getPaddingTop());
frame.inset((int) (frame.width() * (1f - scale) / 2),
(int) (frame.height() * (1f - scale) / 2));
@@ -955,8 +908,8 @@ public class CellLayout extends ViewGroup {
}
int left = getPaddingLeft();
int top = getPaddingTop();
- int right = left + getWidth() - mPaddingLeft - mPaddingRight;
- int bottom = top + getHeight() - mPaddingTop - mPaddingBottom;
+ int right = left + getWidth() - getPaddingLeft() - getPaddingRight();
+ int bottom = top + getHeight() - getPaddingTop() - getPaddingBottom();
r.set(left, top, right, bottom);
return r;
}
@@ -979,8 +932,8 @@ public class CellLayout extends ViewGroup {
int numHeightGaps = mCountY - 1;
if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) {
- int hSpace = widthSpecSize - mPaddingLeft - mPaddingRight;
- int vSpace = heightSpecSize - mPaddingTop - mPaddingBottom;
+ int hSpace = widthSpecSize - getPaddingLeft() - getPaddingRight();
+ int vSpace = heightSpecSize - getPaddingTop() - getPaddingBottom();
int hFreeSpace = hSpace - (mCountX * mOriginalCellWidth);
int vFreeSpace = vSpace - (mCountY * mOriginalCellHeight);
mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
@@ -995,9 +948,9 @@ public class CellLayout extends ViewGroup {
int newWidth = widthSpecSize;
int newHeight = heightSpecSize;
if (widthSpecMode == MeasureSpec.AT_MOST) {
- newWidth = mPaddingLeft + mPaddingRight + (mCountX * mCellWidth) +
+ newWidth = getPaddingLeft() + getPaddingRight() + (mCountX * mCellWidth) +
((mCountX - 1) * mWidthGap);
- newHeight = mPaddingTop + mPaddingBottom + (mCountY * mCellHeight) +
+ newHeight = getPaddingTop() + getPaddingBottom() + (mCountY * mCellHeight) +
((mCountY - 1) * mHeightGap);
setMeasuredDimension(newWidth, newHeight);
}
@@ -1005,10 +958,10 @@ public class CellLayout extends ViewGroup {
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
- int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth - mPaddingLeft -
- mPaddingRight, MeasureSpec.EXACTLY);
- int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight - mPaddingTop -
- mPaddingBottom, MeasureSpec.EXACTLY);
+ int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth - getPaddingLeft() -
+ getPaddingRight(), MeasureSpec.EXACTLY);
+ int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight - getPaddingTop() -
+ getPaddingBottom(), MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
}
setMeasuredDimension(newWidth, newHeight);
@@ -1019,8 +972,8 @@ public class CellLayout extends ViewGroup {
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
- child.layout(mPaddingLeft, mPaddingTop,
- r - l - mPaddingRight, b - t - mPaddingBottom);
+ child.layout(getPaddingLeft(), getPaddingTop(),
+ r - l - getPaddingRight(), b - t - getPaddingBottom());
}
}
@@ -1205,9 +1158,6 @@ public class CellLayout extends ViewGroup {
}
if (dragOutline == null && v == null) {
- if (mCrosshairsDrawable != null) {
- invalidate();
- }
return;
}
@@ -1262,11 +1212,6 @@ public class CellLayout extends ViewGroup {
mDragOutlineAnims[mDragOutlineCurrent].setTag(dragOutline);
mDragOutlineAnims[mDragOutlineCurrent].animateIn();
}
-
- // If we are drawing crosshairs, the entire CellLayout needs to be invalidated
- if (mCrosshairsDrawable != null) {
- invalidate();
- }
}
public void clearDragOutlines() {
@@ -2545,12 +2490,6 @@ public class CellLayout extends ViewGroup {
*/
void onDragEnter() {
mDragEnforcer.onDragEnter();
- if (!mDragging) {
- // Fade in the drag indicators
- if (mCrosshairsAnimator != null) {
- mCrosshairsAnimator.animateIn();
- }
- }
mDragging = true;
}
@@ -2564,11 +2503,6 @@ public class CellLayout extends ViewGroup {
// Guard against that case.
if (mDragging) {
mDragging = false;
-
- // Fade out the drag indicators
- if (mCrosshairsAnimator != null) {
- mCrosshairsAnimator.animateOut();
- }
}
// Invalidate the drag data
@@ -2762,12 +2696,12 @@ out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) {
}
public int getDesiredWidth() {
- return mPaddingLeft + mPaddingRight + (mCountX * mCellWidth) +
+ return getPaddingLeft() + getPaddingRight() + (mCountX * mCellWidth) +
(Math.max((mCountX - 1), 0) * mWidthGap);
}
public int getDesiredHeight() {
- return mPaddingTop + mPaddingBottom + (mCountY * mCellHeight) +
+ return getPaddingTop() + getPaddingBottom() + (mCountY * mCellHeight) +
(Math.max((mCountY - 1), 0) * mHeightGap);
}
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index f71baec..69ed053 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -28,6 +28,7 @@ import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
@@ -43,7 +44,7 @@ import java.util.ArrayList;
/**
* A ViewGroup that coordinates dragging across its descendants
*/
-public class DragLayer extends FrameLayout {
+public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChangeListener {
private DragController mDragController;
private int[] mTmpXY = new int[2];
@@ -83,6 +84,7 @@ public class DragLayer extends FrameLayout {
// Disable multitouch across the workspace/all apps/customize tray
setMotionEventSplittingEnabled(false);
setChildrenDrawingOrderEnabled(true);
+ setOnHierarchyChangeListener(this);
}
public void setup(Launcher launcher, DragController controller) {
@@ -164,7 +166,9 @@ public class DragLayer extends FrameLayout {
if (currentFolder == null) {
return false;
} else {
- if (AccessibilityManager.getInstance(mContext).isTouchExplorationEnabled()) {
+ AccessibilityManager accessibilityManager = (AccessibilityManager)
+ getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
+ if (accessibilityManager.isTouchExplorationEnabled()) {
final int action = ev.getAction();
boolean isOverFolder;
switch (action) {
@@ -197,13 +201,15 @@ public class DragLayer extends FrameLayout {
}
private void sendTapOutsideFolderAccessibilityEvent(boolean isEditingName) {
- if (AccessibilityManager.getInstance(mContext).isEnabled()) {
+ AccessibilityManager accessibilityManager = (AccessibilityManager)
+ getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
+ if (accessibilityManager.isEnabled()) {
int stringId = isEditingName ? R.string.folder_tap_to_rename : R.string.folder_tap_to_close;
AccessibilityEvent event = AccessibilityEvent.obtain(
AccessibilityEvent.TYPE_VIEW_FOCUSED);
onInitializeAccessibilityEvent(event);
- event.getText().add(mContext.getString(stringId));
- AccessibilityManager.getInstance(mContext).sendAccessibilityEvent(event);
+ event.getText().add(getContext().getString(stringId));
+ accessibilityManager.sendAccessibilityEvent(event);
}
}
@@ -674,14 +680,12 @@ public class DragLayer extends FrameLayout {
}
@Override
- protected void onViewAdded(View child) {
- super.onViewAdded(child);
+ public void onChildViewAdded(View parent, View child) {
updateChildIndices();
}
@Override
- protected void onViewRemoved(View child) {
- super.onViewRemoved(child);
+ public void onChildViewRemoved(View parent, View child) {
updateChildIndices();
}
diff --git a/src/com/android/launcher2/FocusHelper.java b/src/com/android/launcher2/FocusHelper.java
index 0066440..e9f986d 100644
--- a/src/com/android/launcher2/FocusHelper.java
+++ b/src/com/android/launcher2/FocusHelper.java
@@ -85,8 +85,7 @@ public class FocusHelper {
*/
static boolean handleAppsCustomizeTabKeyEvent(View v, int keyCode, KeyEvent e) {
final TabHost tabHost = findTabHostParent(v);
- final ViewGroup contents = (ViewGroup)
- tabHost.findViewById(com.android.internal.R.id.tabcontent);
+ final ViewGroup contents = tabHost.getTabContentView();
final View shop = tabHost.findViewById(R.id.market_button);
final int action = e.getAction();
@@ -137,7 +136,7 @@ public class FocusHelper {
final PagedViewGridLayout parent = (PagedViewGridLayout) w.getParent();
final PagedView container = (PagedView) parent.getParent();
final TabHost tabHost = findTabHostParent(container);
- final TabWidget tabs = (TabWidget) tabHost.findViewById(com.android.internal.R.id.tabs);
+ final TabWidget tabs = tabHost.getTabWidget();
final int widgetIndex = parent.indexOfChild(w);
final int widgetCount = parent.getChildCount();
final int pageIndex = ((PagedView) container).indexToPage(container.indexOfChild(parent));
@@ -297,7 +296,7 @@ public class FocusHelper {
// PagedViewCellLayout/PagedViewCellLayoutChildren relationship
final PagedView container = (PagedView) parentLayout.getParent();
final TabHost tabHost = findTabHostParent(container);
- final TabWidget tabs = (TabWidget) tabHost.findViewById(com.android.internal.R.id.tabs);
+ final TabWidget tabs = tabHost.getTabWidget();
final int iconIndex = itemContainer.indexOfChild(v);
final int itemCount = itemContainer.getChildCount();
final int pageIndex = ((PagedView) container).indexToPage(container.indexOfChild(parentLayout));
@@ -442,8 +441,7 @@ public class FocusHelper {
final FocusOnlyTabWidget parent = (FocusOnlyTabWidget) v.getParent();
final TabHost tabHost = findTabHostParent(parent);
- final ViewGroup contents = (ViewGroup)
- tabHost.findViewById(com.android.internal.R.id.tabcontent);
+ final ViewGroup contents = tabHost.getTabContentView();
final int tabCount = parent.getTabCount();
final int tabIndex = parent.getChildTabIndex(v);
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 01939f8..0389264 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -127,7 +127,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
mInputMethodManager = (InputMethodManager)
- mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
+ getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
mExpandDuration = res.getInteger(R.integer.config_folderAnimDuration);
@@ -250,7 +250,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
if (commit) {
sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
- String.format(mContext.getString(R.string.folder_renamed), newTitle));
+ String.format(getContext().getString(R.string.folder_renamed), newTitle));
}
// In order to clear the focus from the text field, we set the focus on ourself. This
// ensures that every time the field is clicked, focus is gained, giving reliable behavior.
@@ -379,7 +379,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
@Override
public void onAnimationStart(Animator animation) {
sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
- String.format(mContext.getString(R.string.folder_opened),
+ String.format(getContext().getString(R.string.folder_opened),
mContent.getCountX(), mContent.getCountY()));
mState = STATE_ANIMATING;
}
@@ -399,11 +399,13 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
private void sendCustomAccessibilityEvent(int type, String text) {
- if (AccessibilityManager.getInstance(mContext).isEnabled()) {
+ AccessibilityManager accessibilityManager = (AccessibilityManager)
+ getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
+ if (accessibilityManager.isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(type);
onInitializeAccessibilityEvent(event);
event.getText().add(text);
- AccessibilityManager.getInstance(mContext).sendAccessibilityEvent(event);
+ accessibilityManager.sendAccessibilityEvent(event);
}
}
@@ -430,7 +432,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
@Override
public void onAnimationStart(Animator animation) {
sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
- mContext.getString(R.string.folder_closed));
+ getContext().getString(R.string.folder_closed));
mState = STATE_ANIMATING;
}
});
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index 2377f30..4a71329 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -601,7 +601,7 @@ public class FolderIcon extends LinearLayout implements FolderListener {
public void onTitleChanged(CharSequence title) {
mFolderName.setText(title.toString());
- setContentDescription(String.format(mContext.getString(R.string.folder_name_format),
+ setContentDescription(String.format(getContext().getString(R.string.folder_name_format),
title));
}
diff --git a/src/com/android/launcher2/HolographicOutlineHelper.java b/src/com/android/launcher2/HolographicOutlineHelper.java
index 1faaeef..56d194d 100644
--- a/src/com/android/launcher2/HolographicOutlineHelper.java
+++ b/src/com/android/launcher2/HolographicOutlineHelper.java
@@ -61,8 +61,6 @@ public class HolographicOutlineHelper {
sMediumInnerBlurMaskFilter = new BlurMaskFilter(scale * 2.0f, BlurMaskFilter.Blur.NORMAL);
}
- private static final MaskFilter sCoarseClipTable = TableMaskFilter.CreateClipTable(0, 200);
-
private int[] mTempOffset = new int[2];
HolographicOutlineHelper() {
@@ -99,24 +97,6 @@ public class HolographicOutlineHelper {
}
/**
- * Apply an outer blur to the given bitmap.
- * You should use OUTER_BLUR_RADIUS to ensure that the bitmap is big enough to draw
- * the blur without clipping.
- */
- void applyOuterBlur(Bitmap bitmap, Canvas canvas, int color) {
- mBlurPaint.setMaskFilter(sThickOuterBlurMaskFilter);
- Bitmap glow = bitmap.extractAlpha(mBlurPaint, mTempOffset);
-
- // Use the clip table to make the glow heavier closer to the outline
- mHolographicPaint.setMaskFilter(sCoarseClipTable);
- mHolographicPaint.setAlpha(150);
- mHolographicPaint.setColor(color);
-
- canvas.drawBitmap(glow, mTempOffset[0], mTempOffset[1], mHolographicPaint);
- glow.recycle();
- }
-
- /**
* Applies a more expensive and accurate outline to whatever is currently drawn in a specified
* bitmap.
*/
diff --git a/src/com/android/launcher2/IconCache.java b/src/com/android/launcher2/IconCache.java
index efa9fac..1e42f1b 100644
--- a/src/com/android/launcher2/IconCache.java
+++ b/src/com/android/launcher2/IconCache.java
@@ -64,7 +64,7 @@ public class IconCache {
public Drawable getFullResDefaultActivityIcon() {
return getFullResIcon(Resources.getSystem(),
- com.android.internal.R.mipmap.sym_def_app_icon);
+ android.R.mipmap.sym_def_app_icon);
}
public Drawable getFullResIcon(Resources resources, int iconId) {
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index e2b86a4..648791d 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -133,6 +133,8 @@ public final class Launcher extends Activity
private static final int REQUEST_PICK_APPWIDGET = 9;
private static final int REQUEST_PICK_WALLPAPER = 10;
+ private static final int REQUEST_BIND_APPWIDGET = 11;
+
static final String EXTRA_SHORTCUT_DUPLICATE = "duplicate";
static final int SCREEN_COUNT = 5;
@@ -250,7 +252,7 @@ public final class Launcher extends Activity
private static Drawable.ConstantState[] sAppMarketIcon = new Drawable.ConstantState[2];
static final ArrayList<String> sDumpLogs = new ArrayList<String>();
- PendingAddWidgetInfo mWidgetBeingConfigured = null;
+ PendingAddWidgetInfo mWidgetBeingBoundOrConfigured = null;
// We only want to get the SharedPreferences once since it does an FS stat each time we get
// it from the context.
@@ -545,7 +547,18 @@ public final class Launcher extends Activity
}
@Override
- protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
+ protected void onActivityResult(
+ final int requestCode, final int resultCode, final Intent data) {
+ if (requestCode == REQUEST_BIND_APPWIDGET) {
+ int appWidgetId = data != null ?
+ data.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1) : -1;
+ if (resultCode == RESULT_CANCELED) {
+ completeTwoStageWidgetDrop(RESULT_CANCELED, appWidgetId);
+ } else if (resultCode == RESULT_OK) {
+ addAppWidgetImpl(appWidgetId, mWidgetBeingBoundOrConfigured);
+ }
+ return;
+ }
boolean delayExitSpringLoadedMode = false;
boolean isWidgetDrop = (requestCode == REQUEST_PICK_APPWIDGET ||
requestCode == REQUEST_CREATE_APPWIDGET);
@@ -585,15 +598,16 @@ public final class Launcher extends Activity
}
private void completeTwoStageWidgetDrop(final int resultCode, final int appWidgetId) {
- CellLayout cellLayout = (CellLayout) mWorkspace.getChildAt(mWidgetBeingConfigured.screen);
+ CellLayout cellLayout =
+ (CellLayout) mWorkspace.getChildAt(mWidgetBeingBoundOrConfigured.screen);
Runnable onCompleteRunnable = null;
int animationType = 0;
if (resultCode == RESULT_OK) {
animationType = Workspace.COMPLETE_TWO_STAGE_WIDGET_DROP_ANIMATION;
final AppWidgetHostView layout = mAppWidgetHost.createView(this, appWidgetId,
- mWidgetBeingConfigured.info);
- mWidgetBeingConfigured.boundWidget = layout;
+ mWidgetBeingBoundOrConfigured.info);
+ mWidgetBeingBoundOrConfigured.boundWidget = layout;
onCompleteRunnable = new Runnable() {
@Override
public void run() {
@@ -613,10 +627,10 @@ public final class Launcher extends Activity
}
};
}
- mWorkspace.animateWidgetDrop(mWidgetBeingConfigured, cellLayout,
+ mWorkspace.animateWidgetDrop(mWidgetBeingBoundOrConfigured, cellLayout,
(DragView) mDragLayer.getAnimatedView(), onCompleteRunnable,
- animationType, mWidgetBeingConfigured.boundWidget, true);
- mWidgetBeingConfigured = null;
+ animationType, mWidgetBeingBoundOrConfigured.boundWidget, true);
+ mWidgetBeingBoundOrConfigured = null;
}
@Override
@@ -1541,7 +1555,7 @@ public final class Launcher extends Activity
}
}
startActivityForResultSafely(intent, REQUEST_CREATE_APPWIDGET);
- mWidgetBeingConfigured = info;
+ mWidgetBeingBoundOrConfigured = info;
} else {
// Otherwise just add it
completeAddAppWidget(appWidgetId, info.container, info.screen, info.boundWidget, appWidget);
@@ -1605,11 +1619,19 @@ public final class Launcher extends Activity
int appWidgetId;
if (hostView != null) {
appWidgetId = hostView.getAppWidgetId();
+ addAppWidgetImpl(appWidgetId, info);
} else {
appWidgetId = getAppWidgetHost().allocateAppWidgetId();
- AppWidgetManager.getInstance(this).bindAppWidgetId(appWidgetId, info.componentName);
+ mWidgetBeingBoundOrConfigured = info;
+ if (mAppWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId, info.componentName)) {
+ addAppWidgetImpl(appWidgetId, info);
+ } else {
+ Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_BIND);
+ intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
+ intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER, info.componentName);
+ startActivityForResult(intent, REQUEST_BIND_APPWIDGET);
+ }
}
- addAppWidgetImpl(appWidgetId, info);
}
void processShortcut(Intent intent) {
@@ -2144,6 +2166,12 @@ public final class Launcher extends Activity
}
}
+ private void dispatchOnLauncherTransitionPrepare(View v, boolean animated, boolean toWorkspace) {
+ if (v instanceof LauncherTransitionable) {
+ ((LauncherTransitionable) v).onLauncherTransitionPrepare(this, animated, toWorkspace);
+ }
+ }
+
private void dispatchOnLauncherTransitionStart(View v, boolean animated, boolean toWorkspace) {
if (v instanceof LauncherTransitionable) {
((LauncherTransitionable) v).onLauncherTransitionStart(this, animated, toWorkspace);
@@ -2224,7 +2252,7 @@ public final class Launcher extends Activity
final int fadeDuration = res.getInteger(R.integer.config_appsCustomizeFadeInTime);
final float scale = (float) res.getInteger(R.integer.config_appsCustomizeZoomScaleFactor);
final View fromView = mWorkspace;
- final View toView = mAppsCustomizeTabHost;
+ final AppsCustomizeTabHost toView = mAppsCustomizeTabHost;
final int startDelay =
res.getInteger(R.integer.config_workspaceAppsCustomizeAnimationStagger);
@@ -2304,8 +2332,8 @@ public final class Launcher extends Activity
boolean delayAnim = false;
final ViewTreeObserver observer;
- dispatchOnLauncherTransitionStart(fromView, animated, false);
- dispatchOnLauncherTransitionStart(toView, animated, false);
+ dispatchOnLauncherTransitionPrepare(fromView, animated, false);
+ dispatchOnLauncherTransitionPrepare(toView, animated, false);
// If any of the objects being animated haven't been measured/laid out
// yet, delay the animation until we get a layout pass
@@ -2329,6 +2357,8 @@ public final class Launcher extends Activity
if (mStateAnimation == stateAnimation) {
// Need to update pivots for zoom if layout changed
setPivotsForZoom(toView, scale);
+ dispatchOnLauncherTransitionStart(fromView, animated, false);
+ dispatchOnLauncherTransitionStart(toView, animated, false);
mStateAnimation.start();
}
}
@@ -2339,6 +2369,8 @@ public final class Launcher extends Activity
observer.addOnGlobalLayoutListener(delayedStart);
} else {
setPivotsForZoom(toView, scale);
+ dispatchOnLauncherTransitionStart(fromView, animated, false);
+ dispatchOnLauncherTransitionStart(toView, animated, false);
mStateAnimation.start();
}
} else {
@@ -2354,8 +2386,10 @@ public final class Launcher extends Activity
mWorkspace.hideScrollingIndicator(true);
hideDockDivider();
}
+ dispatchOnLauncherTransitionPrepare(fromView, animated, false);
dispatchOnLauncherTransitionStart(fromView, animated, false);
dispatchOnLauncherTransitionEnd(fromView, animated, false);
+ dispatchOnLauncherTransitionPrepare(toView, animated, false);
dispatchOnLauncherTransitionStart(toView, animated, false);
dispatchOnLauncherTransitionEnd(toView, animated, false);
updateWallpaperVisibility(false);
@@ -2420,8 +2454,8 @@ public final class Launcher extends Activity
mStateAnimation = new AnimatorSet();
- dispatchOnLauncherTransitionStart(fromView, animated, true);
- dispatchOnLauncherTransitionStart(toView, animated, true);
+ dispatchOnLauncherTransitionPrepare(fromView, animated, true);
+ dispatchOnLauncherTransitionPrepare(toView, animated, true);
mStateAnimation.addListener(new AnimatorListenerAdapter() {
@Override
@@ -2430,7 +2464,9 @@ public final class Launcher extends Activity
fromView.setVisibility(View.GONE);
dispatchOnLauncherTransitionEnd(fromView, animated, true);
dispatchOnLauncherTransitionEnd(toView, animated, true);
- mWorkspace.hideScrollingIndicator(false);
+ if (mWorkspace != null) {
+ mWorkspace.hideScrollingIndicator(false);
+ }
if (onCompleteRunnable != null) {
onCompleteRunnable.run();
}
@@ -2441,11 +2477,15 @@ public final class Launcher extends Activity
if (workspaceAnim != null) {
mStateAnimation.play(workspaceAnim);
}
+ dispatchOnLauncherTransitionStart(fromView, animated, true);
+ dispatchOnLauncherTransitionStart(toView, animated, true);
mStateAnimation.start();
} else {
fromView.setVisibility(View.GONE);
+ dispatchOnLauncherTransitionPrepare(fromView, animated, true);
dispatchOnLauncherTransitionStart(fromView, animated, true);
dispatchOnLauncherTransitionEnd(fromView, animated, true);
+ dispatchOnLauncherTransitionPrepare(toView, animated, true);
dispatchOnLauncherTransitionStart(toView, animated, true);
dispatchOnLauncherTransitionEnd(toView, animated, true);
mWorkspace.hideScrollingIndicator(false);
@@ -3433,6 +3473,7 @@ public final class Launcher extends Activity
interface LauncherTransitionable {
View getContent();
+ void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace);
void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace);
void onLauncherTransitionStep(Launcher l, float t);
void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace);
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index efe4711..37235e9 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -989,6 +989,9 @@ public class LauncherModel extends BroadcastReceiver {
final AppWidgetManager widgets = AppWidgetManager.getInstance(context);
final boolean isSafeMode = manager.isSafeMode();
+ // Make sure the default workspace is loaded, if needed
+ mApp.getLauncherProvider().loadDefaultFavoritesIfNecessary();
+
sWorkspaceItems.clear();
sAppWidgets.clear();
sFolders.clear();
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index c8fb09e..297c097 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -16,13 +16,6 @@
package com.android.launcher2;
-import com.android.internal.util.XmlUtils;
-import com.android.launcher.R;
-import com.android.launcher2.LauncherSettings.Favorites;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
import android.app.SearchManager;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetManager;
@@ -34,6 +27,7 @@ import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
@@ -54,6 +48,12 @@ import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
+import com.android.launcher.R;
+import com.android.launcher2.LauncherSettings.Favorites;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
@@ -71,6 +71,8 @@ public class LauncherProvider extends ContentProvider {
static final String TABLE_FAVORITES = "favorites";
static final String PARAMETER_NOTIFY = "notify";
+ static final String DB_CREATED_BUT_DEFAULT_WORKSPACE_NOT_LOADED =
+ "DB_CREATED_BUT_DEFAULT_WORKSPACE_NOT_LOADED";
/**
* {@link Uri} triggered at any registered {@link android.database.ContentObserver} when
@@ -197,6 +199,18 @@ public class LauncherProvider extends ContentProvider {
return mOpenHelper.generateNewId();
}
+ public void loadDefaultFavoritesIfNecessary() {
+ String spKey = LauncherApplication.getSharedPreferencesKey();
+ SharedPreferences sp = getContext().getSharedPreferences(spKey, Context.MODE_PRIVATE);
+ if (sp.getBoolean(DB_CREATED_BUT_DEFAULT_WORKSPACE_NOT_LOADED, false)) {
+ // Populate favorites table with initial favorites
+ SharedPreferences.Editor editor = sp.edit();
+ editor.remove(DB_CREATED_BUT_DEFAULT_WORKSPACE_NOT_LOADED);
+ mOpenHelper.loadFavorites(mOpenHelper.getWritableDatabase(), R.xml.default_workspace);
+ editor.commit();
+ }
+ }
+
private static class DatabaseHelper extends SQLiteOpenHelper {
private static final String TAG_FAVORITES = "favorites";
private static final String TAG_FAVORITE = "favorite";
@@ -267,11 +281,19 @@ public class LauncherProvider extends ContentProvider {
}
if (!convertDatabase(db)) {
- // Populate favorites table with initial favorites
- loadFavorites(db, R.xml.default_workspace);
+ // Set a shared pref so that we know we need to load the default workspace later
+ setFlagToLoadDefaultWorkspaceLater();
}
}
+ private void setFlagToLoadDefaultWorkspaceLater() {
+ String spKey = LauncherApplication.getSharedPreferencesKey();
+ SharedPreferences sp = mContext.getSharedPreferences(spKey, Context.MODE_PRIVATE);
+ SharedPreferences.Editor editor = sp.edit();
+ editor.putBoolean(DB_CREATED_BUT_DEFAULT_WORKSPACE_NOT_LOADED, true);
+ editor.commit();
+ }
+
private boolean convertDatabase(SQLiteDatabase db) {
if (LOGD) Log.d(TAG, "converting database from an older format, but not onUpgrade");
boolean converted = false;
@@ -684,15 +706,18 @@ public class LauncherProvider extends ContentProvider {
db.update(TABLE_FAVORITES, values, updateWhere, null);
if (favoriteType == Favorites.ITEM_TYPE_WIDGET_CLOCK) {
- appWidgetManager.bindAppWidgetId(appWidgetId,
+ // TODO: check return value
+ appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId,
new ComponentName("com.android.alarmclock",
"com.android.alarmclock.AnalogAppWidgetProvider"));
} else if (favoriteType == Favorites.ITEM_TYPE_WIDGET_PHOTO_FRAME) {
- appWidgetManager.bindAppWidgetId(appWidgetId,
+ // TODO: check return value
+ appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId,
new ComponentName("com.android.camera",
"com.android.camera.PhotoAppWidgetProvider"));
} else if (favoriteType == Favorites.ITEM_TYPE_WIDGET_SEARCH) {
- appWidgetManager.bindAppWidgetId(appWidgetId,
+ // TODO: check return value
+ appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId,
getSearchWidgetProvider());
}
} catch (RuntimeException ex) {
@@ -711,6 +736,24 @@ public class LauncherProvider extends ContentProvider {
}
}
+ private static final void beginDocument(XmlPullParser parser, String firstElementName)
+ throws XmlPullParserException, IOException {
+ int type;
+ while ((type = parser.next()) != parser.START_TAG
+ && type != parser.END_DOCUMENT) {
+ ;
+ }
+
+ if (type != parser.START_TAG) {
+ throw new XmlPullParserException("No start tag found");
+ }
+
+ if (!parser.getName().equals(firstElementName)) {
+ throw new XmlPullParserException("Unexpected start tag: found " + parser.getName() +
+ ", expected " + firstElementName);
+ }
+ }
+
/**
* Loads the default set of favorite packages from an xml file.
*
@@ -729,7 +772,7 @@ public class LauncherProvider extends ContentProvider {
try {
XmlResourceParser parser = mContext.getResources().getXml(workspaceResourceId);
AttributeSet attrs = Xml.asAttributeSet(parser);
- XmlUtils.beginDocument(parser, TAG_FAVORITES);
+ beginDocument(parser, TAG_FAVORITES);
final int depth = parser.getDepth();
@@ -989,7 +1032,8 @@ public class LauncherProvider extends ContentProvider {
allocatedAppWidgets = true;
- appWidgetManager.bindAppWidgetId(appWidgetId, cn);
+ // TODO: need to check return value
+ appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId, cn);
} catch (RuntimeException ex) {
Log.e(TAG, "Problem allocating appWidgetId", ex);
}
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 1fc39f6..83b688d 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -50,7 +50,7 @@ import java.util.ArrayList;
* An abstraction of the original Workspace which supports browsing through a
* sequential list of "pages"
*/
-public abstract class PagedView extends ViewGroup {
+public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarchyChangeListener {
private static final String TAG = "PagedView";
private static final boolean DEBUG = false;
protected static final int INVALID_PAGE = -1;
@@ -132,7 +132,7 @@ public abstract class PagedView extends ViewGroup {
protected int mUnboundedScrollX;
protected int[] mTempVisiblePagesRange = new int[2];
- // mOverScrollX is equal to mScrollX when we're within the normal scroll range. Otherwise
+ // mOverScrollX is equal to getScrollX() when we're within the normal scroll range. Otherwise
// it is equal to the scaled overscroll position. We use a separate value so as to prevent
// the screens from continuing to translate beyond the normal bounds.
protected int mOverScrollX;
@@ -158,7 +158,7 @@ public abstract class PagedView extends ViewGroup {
// to switch to a new page
protected boolean mUsePagingTouchSlop = true;
- // If true, the subclass should directly update mScrollX itself in its computeScroll method
+ // If true, the subclass should directly update scrollX itself in its computeScroll method
// (SmoothPagedView does this)
protected boolean mDeferScrollUpdate = false;
@@ -241,6 +241,7 @@ public abstract class PagedView extends ViewGroup {
mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity);
mMinFlingVelocity = (int) (MIN_FLING_VELOCITY * mDensity);
mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * mDensity);
+ setOnHierarchyChangeListener(this);
}
public void setPageSwitchListener(PageSwitchListener pageSwitchListener) {
@@ -362,7 +363,7 @@ public abstract class PagedView extends ViewGroup {
@Override
public void scrollBy(int x, int y) {
- scrollTo(mUnboundedScrollX + x, mScrollY + y);
+ scrollTo(mUnboundedScrollX + x, getScrollY() + y);
}
@Override
@@ -392,8 +393,8 @@ public abstract class PagedView extends ViewGroup {
protected boolean computeScrollHelper() {
if (mScroller.computeScrollOffset()) {
// Don't bother scrolling if the page does not need to be moved
- if (mScrollX != mScroller.getCurrX()
- || mScrollY != mScroller.getCurrY()
+ if (getScrollX() != mScroller.getCurrX()
+ || getScrollY() != mScroller.getCurrY()
|| mOverScrollX != mScroller.getCurrX()) {
scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
}
@@ -417,7 +418,9 @@ public abstract class PagedView extends ViewGroup {
}
// Notify the user when the page changes
- if (AccessibilityManager.getInstance(getContext()).isEnabled()) {
+ AccessibilityManager accessibilityManager = (AccessibilityManager)
+ getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
+ if (accessibilityManager.isEnabled()) {
AccessibilityEvent ev =
AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED);
ev.getText().add(getCurrentPageDescription());
@@ -455,8 +458,8 @@ public abstract class PagedView extends ViewGroup {
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int maxChildHeight = 0;
- final int verticalPadding = mPaddingTop + mPaddingBottom;
- final int horizontalPadding = mPaddingLeft + mPaddingRight;
+ final int verticalPadding = getPaddingTop() + getPaddingBottom();
+ final int horizontalPadding = getPaddingLeft() + getPaddingRight();
// The children are given the same width and height as the workspace
@@ -514,7 +517,7 @@ public abstract class PagedView extends ViewGroup {
protected void scrollToNewPageWithoutMovingPages(int newCurrentPage) {
int newX = getChildOffset(newCurrentPage) - getRelativeChildOffset(newCurrentPage);
- int delta = newX - mScrollX;
+ int delta = newX - getScrollX();
final int pageCount = getChildCount();
for (int i = 0; i < pageCount; i++) {
@@ -545,7 +548,7 @@ public abstract class PagedView extends ViewGroup {
int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY);
requestLayout();
measure(widthSpec, heightSpec);
- layout(mLeft, mTop, mRight, mBottom);
+ layout(getLeft(), getTop(), getRight(), getBottom());
for (int i = 0; i < childCount; i++) {
final View child = getPageAt(i);
child.setX(childrenX[i]);
@@ -569,7 +572,7 @@ public abstract class PagedView extends ViewGroup {
}
if (DEBUG) Log.d(TAG, "PagedView.onLayout()");
- final int verticalPadding = mPaddingTop + mPaddingBottom;
+ final int verticalPadding = getPaddingTop() + getPaddingBottom();
final int childCount = getChildCount();
int childLeft = 0;
if (childCount > 0) {
@@ -595,7 +598,7 @@ public abstract class PagedView extends ViewGroup {
if (child.getVisibility() != View.GONE) {
final int childWidth = getScaledMeasuredWidth(child);
final int childHeight = child.getMeasuredHeight();
- int childTop = mPaddingTop;
+ int childTop = getPaddingTop();
if (mCenterPagesVertically) {
childTop += ((getMeasuredHeight() - verticalPadding) - childHeight) / 2;
}
@@ -637,9 +640,7 @@ public abstract class PagedView extends ViewGroup {
}
@Override
- protected void onViewAdded(View child) {
- super.onViewAdded(child);
-
+ public void onChildViewAdded(View parent, View child) {
// This ensures that when children are added, they get the correct transforms / alphas
// in accordance with any scroll effects.
mForceScreenScrolled = true;
@@ -647,6 +648,10 @@ public abstract class PagedView extends ViewGroup {
invalidateCachedOffsets();
}
+ @Override
+ public void onChildViewRemoved(View parent, View child) {
+ }
+
protected void invalidateCachedOffsets() {
int count = getChildCount();
if (count == 0) {
@@ -691,8 +696,8 @@ public abstract class PagedView extends ViewGroup {
if (mChildRelativeOffsets != null && mChildRelativeOffsets[index] != -1) {
return mChildRelativeOffsets[index];
} else {
- final int padding = mPaddingLeft + mPaddingRight;
- final int offset = mPaddingLeft +
+ final int padding = getPaddingLeft() + getPaddingRight();
+ final int offset = getPaddingLeft() +
(getMeasuredWidth() - padding - getChildWidth(index)) / 2;
if (mChildRelativeOffsets != null) {
mChildRelativeOffsets[index] = offset;
@@ -702,8 +707,8 @@ public abstract class PagedView extends ViewGroup {
}
protected int getScaledRelativeChildOffset(int index) {
- final int padding = mPaddingLeft + mPaddingRight;
- final int offset = mPaddingLeft + (getMeasuredWidth() - padding -
+ final int padding = getPaddingLeft() + getPaddingRight();
+ final int offset = getPaddingLeft() + (getMeasuredWidth() - padding -
getScaledMeasuredWidth(getPageAt(index))) / 2;
return offset;
}
@@ -726,14 +731,15 @@ public abstract class PagedView extends ViewGroup {
int rightScreen = 0;
View currPage = getPageAt(leftScreen);
while (leftScreen < pageCount - 1 &&
- currPage.getX() + currPage.getWidth() - currPage.getPaddingRight() < mScrollX) {
+ currPage.getX() + currPage.getWidth() -
+ currPage.getPaddingRight() < getScrollX()) {
leftScreen++;
currPage = getPageAt(leftScreen);
}
rightScreen = leftScreen;
currPage = getPageAt(rightScreen + 1);
while (rightScreen < pageCount - 1 &&
- currPage.getX() - currPage.getPaddingLeft() < mScrollX + screenWidth) {
+ currPage.getX() - currPage.getPaddingLeft() < getScrollX() + screenWidth) {
rightScreen++;
currPage = getPageAt(rightScreen + 1);
}
@@ -748,8 +754,8 @@ public abstract class PagedView extends ViewGroup {
@Override
protected void dispatchDraw(Canvas canvas) {
int halfScreenSize = getMeasuredWidth() / 2;
- // mOverScrollX is equal to mScrollX when we're within the normal scroll range. Otherwise
- // it is equal to the scaled overscroll position.
+ // mOverScrollX is equal to getScrollX() when we're within the normal scroll range.
+ // Otherwise it is equal to the scaled overscroll position.
int screenCenter = mOverScrollX + halfScreenSize;
if (screenCenter != mLastScreenCenter || mForceScreenScrolled) {
@@ -770,8 +776,8 @@ public abstract class PagedView extends ViewGroup {
final long drawingTime = getDrawingTime();
// Clip to the bounds
canvas.save();
- canvas.clipRect(mScrollX, mScrollY, mScrollX + mRight - mLeft,
- mScrollY + mBottom - mTop);
+ canvas.clipRect(getScrollX(), getScrollY(), getScrollX() + getRight() - getLeft(),
+ getScrollY() + getBottom() - getTop());
// On certain graphics drivers, if you draw to a off-screen buffer that's not
// used, it can lead to poor performance. We were running into this when
@@ -781,9 +787,7 @@ public abstract class PagedView extends ViewGroup {
// View.INVISIBLE, preventing re-drawing of their hardware layer
for (int i = getChildCount() - 1; i >= 0; i--) {
final View v = getPageAt(i);
-
- if (leftScreen <= i && i <= rightScreen &&
- v.getAlpha() > ViewConfiguration.ALPHA_THRESHOLD) {
+ if (leftScreen <= i && i <= rightScreen && v.getAlpha() > 0) {
v.setVisibility(VISIBLE);
drawChild(canvas, v, drawingTime);
} else {
@@ -1043,7 +1047,7 @@ public abstract class PagedView extends ViewGroup {
mTotalMotionX += Math.abs(mLastMotionX - x);
mLastMotionX = x;
mLastMotionXRemainder = 0;
- mTouchX = mScrollX;
+ mTouchX = getScrollX();
mSmoothingTime = System.nanoTime() / NANOTIME_DIV;
pageBeginMoving();
}
@@ -1102,10 +1106,10 @@ public abstract class PagedView extends ViewGroup {
int overScrollAmount = (int) Math.round(f * screenSize);
if (amount < 0) {
mOverScrollX = overScrollAmount;
- mScrollX = 0;
+ super.scrollTo(0, getScrollY());
} else {
mOverScrollX = mMaxScrollX + overScrollAmount;
- mScrollX = mMaxScrollX;
+ super.scrollTo(mMaxScrollX, getScrollY());
}
invalidate();
}
@@ -1126,10 +1130,10 @@ public abstract class PagedView extends ViewGroup {
int overScrollAmount = (int) Math.round(OVERSCROLL_DAMP_FACTOR * f * screenSize);
if (amount < 0) {
mOverScrollX = overScrollAmount;
- mScrollX = 0;
+ super.scrollTo(0, getScrollY());
} else {
mOverScrollX = mMaxScrollX + overScrollAmount;
- mScrollX = mMaxScrollX;
+ super.scrollTo(mMaxScrollX, getScrollY());
}
invalidate();
}
@@ -1392,7 +1396,7 @@ public abstract class PagedView extends ViewGroup {
int getPageNearestToCenterOfScreen() {
int minDistanceFromScreenCenter = Integer.MAX_VALUE;
int minDistanceFromScreenCenterIndex = -1;
- int screenCenter = mScrollX + (getMeasuredWidth() / 2);
+ int screenCenter = getScrollX() + (getMeasuredWidth() / 2);
final int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
View layout = (View) getPageAt(i);
@@ -1855,7 +1859,7 @@ public abstract class PagedView extends ViewGroup {
protected String getCurrentPageDescription() {
int page = (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage;
- return String.format(mContext.getString(R.string.default_scroll_format),
+ return String.format(getContext().getString(R.string.default_scroll_format),
page + 1, getChildCount());
}
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 9e5452b..6f73e63 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -193,8 +193,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
int numHeightGaps = mCellCountY - 1;
if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) {
- int hSpace = widthSpecSize - mPaddingLeft - mPaddingRight;
- int vSpace = heightSpecSize - mPaddingTop - mPaddingBottom;
+ int hSpace = widthSpecSize - getPaddingLeft() - getPaddingRight();
+ int vSpace = heightSpecSize - getPaddingTop() - getPaddingBottom();
int hFreeSpace = hSpace - (mCellCountX * mOriginalCellWidth);
int vFreeSpace = vSpace - (mCellCountY * mOriginalCellHeight);
mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
@@ -210,9 +210,9 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
int newWidth = widthSpecSize;
int newHeight = heightSpecSize;
if (widthSpecMode == MeasureSpec.AT_MOST) {
- newWidth = mPaddingLeft + mPaddingRight + (mCellCountX * mCellWidth) +
+ newWidth = getPaddingLeft() + getPaddingRight() + (mCellCountX * mCellWidth) +
((mCellCountX - 1) * mWidthGap);
- newHeight = mPaddingTop + mPaddingBottom + (mCellCountY * mCellHeight) +
+ newHeight = getPaddingTop() + getPaddingBottom() + (mCellCountY * mCellHeight) +
((mCellCountY - 1) * mHeightGap);
setMeasuredDimension(newWidth, newHeight);
}
@@ -221,11 +221,11 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
int childWidthMeasureSpec =
- MeasureSpec.makeMeasureSpec(newWidth - mPaddingLeft -
- mPaddingRight, MeasureSpec.EXACTLY);
+ MeasureSpec.makeMeasureSpec(newWidth - getPaddingLeft() -
+ getPaddingRight(), MeasureSpec.EXACTLY);
int childheightMeasureSpec =
- MeasureSpec.makeMeasureSpec(newHeight - mPaddingTop -
- mPaddingBottom, MeasureSpec.EXACTLY);
+ MeasureSpec.makeMeasureSpec(newHeight - getPaddingTop() -
+ getPaddingBottom(), MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
}
@@ -233,7 +233,7 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
}
int getContentWidth() {
- return getWidthBeforeFirstLayout() + mPaddingLeft + mPaddingRight;
+ return getWidthBeforeFirstLayout() + getPaddingLeft() + getPaddingRight();
}
int getContentHeight() {
@@ -255,8 +255,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
- child.layout(mPaddingLeft, mPaddingTop,
- r - l - mPaddingRight, b - t - mPaddingBottom);
+ child.layout(getPaddingLeft(), getPaddingTop(),
+ r - l - getPaddingRight(), b - t - getPaddingBottom());
}
}
@@ -327,7 +327,7 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
public int estimateCellHSpan(int width) {
// We don't show the next/previous pages any more, so we use the full width, minus the
// padding
- int availWidth = width - (mPaddingLeft + mPaddingRight);
+ int availWidth = width - (getPaddingLeft() + getPaddingRight());
// We know that we have to fit N cells with N-1 width gaps, so we just juggle to solve for N
int n = Math.max(1, (availWidth + mWidthGap) / (mCellWidth + mWidthGap));
@@ -342,7 +342,7 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
public int estimateCellVSpan(int height) {
// The space for a page is the height - top padding (current page) - bottom padding (current
// page)
- int availHeight = height - (mPaddingTop + mPaddingBottom);
+ int availHeight = height - (getPaddingTop() + getPaddingBottom());
// We know that we have to fit N cells with N-1 height gaps, so we juggle to solve for N
int n = Math.max(1, (availHeight + mHeightGap) / (mCellHeight + mHeightGap));
@@ -354,8 +354,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
/** Returns an estimated center position of the cell at the specified index */
public int[] estimateCellPosition(int x, int y) {
return new int[] {
- mPaddingLeft + (x * mCellWidth) + (x * mWidthGap) + (mCellWidth / 2),
- mPaddingTop + (y * mCellHeight) + (y * mHeightGap) + (mCellHeight / 2)
+ getPaddingLeft() + (x * mCellWidth) + (x * mWidthGap) + (mCellWidth / 2),
+ getPaddingTop() + (y * mCellHeight) + (y * mHeightGap) + (mCellHeight / 2)
};
}
diff --git a/src/com/android/launcher2/SmoothPagedView.java b/src/com/android/launcher2/SmoothPagedView.java
index e6414d9..7e47f1a 100644
--- a/src/com/android/launcher2/SmoothPagedView.java
+++ b/src/com/android/launcher2/SmoothPagedView.java
@@ -175,7 +175,7 @@ public abstract class SmoothPagedView extends PagedView {
final float e = (float) Math.exp((now - mSmoothingTime) / SMOOTHING_CONSTANT);
final float dx = mTouchX - mUnboundedScrollX;
- scrollTo(Math.round(mUnboundedScrollX + dx * e), mScrollY);
+ scrollTo(Math.round(mUnboundedScrollX + dx * e), getScrollY());
mSmoothingTime = now;
// Keep generating points as long as we're more than 1px away from the target
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index d2f050c..29aea6f 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -68,7 +68,7 @@ import java.util.HashSet;
*/
public class Workspace extends SmoothPagedView
implements DropTarget, DragSource, DragScroller, View.OnTouchListener,
- DragController.DragListener, LauncherTransitionable {
+ DragController.DragListener, LauncherTransitionable, ViewGroup.OnHierarchyChangeListener {
private static final String TAG = "Launcher.Workspace";
// Y rotation to apply to the workspace screens
@@ -174,7 +174,7 @@ public class Workspace extends SmoothPagedView
private final int[] mTempXY = new int[2];
private float mOverscrollFade = 0;
private boolean mOverscrollTransformsSet;
- public static final int DRAG_BITMAP_PADDING = 0;
+ public static final int DRAG_BITMAP_PADDING = 2;
// Camera and Matrix used to determine the final position of a neighboring CellLayout
private final Matrix mMatrix = new Matrix();
@@ -322,6 +322,8 @@ public class Workspace extends SmoothPagedView
mDefaultPage = a.getInt(R.styleable.Workspace_defaultScreen, 1);
a.recycle();
+ setOnHierarchyChangeListener(this);
+
LauncherModel.updateWorkspaceLayoutCells(cellCountX, cellCountY);
setHapticFeedbackEnabled(false);
@@ -417,8 +419,7 @@ public class Workspace extends SmoothPagedView
}
@Override
- protected void onViewAdded(View child) {
- super.onViewAdded(child);
+ public void onChildViewAdded(View parent, View child) {
if (!(child instanceof CellLayout)) {
throw new IllegalArgumentException("A Workspace can only have CellLayout children.");
}
@@ -428,6 +429,10 @@ public class Workspace extends SmoothPagedView
cl.enableHardwareLayers();
}
+ @Override
+ public void onChildViewRemoved(View parent, View child) {
+ }
+
/**
* @return The open folder on the current screen, or null if there is none
*/
@@ -824,7 +829,7 @@ public class Workspace extends SmoothPagedView
int scrollRange = getScrollRange();
// Again, we adjust the wallpaper offset to be consistent between values of mLayoutScale
- float adjustedScrollX = Math.max(0, Math.min(mScrollX, mMaxScrollX));
+ float adjustedScrollX = Math.max(0, Math.min(getScrollX(), mMaxScrollX));
adjustedScrollX *= mWallpaperScrollRatio;
mLayoutScale = layoutScale;
@@ -1296,7 +1301,7 @@ public class Workspace extends SmoothPagedView
if (mBackground != null && mBackgroundAlpha > 0.0f && mDrawBackground) {
int alpha = (int) (mBackgroundAlpha * 255);
mBackground.setAlpha(alpha);
- mBackground.setBounds(mScrollX, 0, mScrollX + getMeasuredWidth(),
+ mBackground.setBounds(getScrollX(), 0, getScrollX() + getMeasuredWidth(),
getMeasuredHeight());
mBackground.draw(canvas);
}
@@ -1318,9 +1323,9 @@ public class Workspace extends SmoothPagedView
final int pageHeight = getChildAt(0).getHeight();
// Set the height of the outline to be the height of the page
- final int offset = (height - pageHeight - mPaddingTop - mPaddingBottom) / 2;
- final int paddingTop = mPaddingTop + offset;
- final int paddingBottom = mPaddingBottom + offset;
+ final int offset = (height - pageHeight - getPaddingTop() - getPaddingBottom()) / 2;
+ final int paddingTop = getPaddingTop() + offset;
+ final int paddingBottom = getPaddingBottom() + offset;
final int page = (mNextPage != INVALID_PAGE ? mNextPage : mCurrentPage);
final CellLayout leftPage = (CellLayout) getChildAt(page - 1);
@@ -1328,13 +1333,13 @@ public class Workspace extends SmoothPagedView
if (leftPage != null && leftPage.getIsDragOverlapping()) {
final Drawable d = getResources().getDrawable(R.drawable.page_hover_left_holo);
- d.setBounds(mScrollX, paddingTop, mScrollX + d.getIntrinsicWidth(),
+ d.setBounds(getScrollX(), paddingTop, getScrollX() + d.getIntrinsicWidth(),
height - paddingBottom);
d.draw(canvas);
} else if (rightPage != null && rightPage.getIsDragOverlapping()) {
final Drawable d = getResources().getDrawable(R.drawable.page_hover_right_holo);
- d.setBounds(mScrollX + width - d.getIntrinsicWidth(), paddingTop, mScrollX + width,
- height - paddingBottom);
+ d.setBounds(getScrollX() + width - d.getIntrinsicWidth(), paddingTop,
+ getScrollX() + width, height - paddingBottom);
d.draw(canvas);
}
}
@@ -1722,6 +1727,7 @@ public class Workspace extends SmoothPagedView
}
}
}
+ buildPageHardwareLayers();
anim.setStartDelay(delay);
}
@@ -1739,12 +1745,16 @@ public class Workspace extends SmoothPagedView
}
@Override
- public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) {
+ public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) {
mIsSwitchingState = true;
cancelScrollingIndicatorAnimations();
}
@Override
+ public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) {
+ }
+
+ @Override
public void onLauncherTransitionStep(Launcher l, float t) {
mTransitionProgress = t;
}
@@ -2545,12 +2555,12 @@ public class Workspace extends SmoothPagedView
v.getMatrix().invert(mTempInverseMatrix);
cachedInverseMatrix = mTempInverseMatrix;
}
- int scrollX = mScrollX;
+ int scrollX = getScrollX();
if (mNextPage != INVALID_PAGE) {
scrollX = mScroller.getFinalX();
}
xy[0] = xy[0] + scrollX - v.getLeft();
- xy[1] = xy[1] + mScrollY - v.getTop();
+ xy[1] = xy[1] + getScrollY() - v.getTop();
cachedInverseMatrix.mapPoints(xy);
}
@@ -2576,12 +2586,12 @@ public class Workspace extends SmoothPagedView
*/
void mapPointFromChildToSelf(View v, float[] xy) {
v.getMatrix().mapPoints(xy);
- int scrollX = mScrollX;
+ int scrollX = getScrollX();
if (mNextPage != INVALID_PAGE) {
scrollX = mScroller.getFinalX();
}
xy[0] -= (scrollX - v.getLeft());
- xy[1] -= (mScrollY - v.getTop());
+ xy[1] -= (getScrollY() - v.getTop());
}
static private float squaredDistance(float[] point1, float[] point2) {
@@ -3713,7 +3723,7 @@ public class Workspace extends SmoothPagedView
@Override
protected String getCurrentPageDescription() {
int page = (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage;
- return String.format(mContext.getString(R.string.workspace_scroll_format),
+ return String.format(getContext().getString(R.string.workspace_scroll_format),
page + 1, getChildCount());
}