Merge "Missing assets created by rescaling existing ones"
diff --git a/res/anim/paged_view_click_feedback.xml b/res/anim/paged_view_click_feedback.xml
index 786d974..d1e6e23 100644
--- a/res/anim/paged_view_click_feedback.xml
+++ b/res/anim/paged_view_click_feedback.xml
@@ -16,8 +16,8 @@
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="1.0"
- android:toAlpha="0.65"
- android:duration="100"
+ android:toAlpha="0.5"
+ android:duration="75"
android:fillAfter="true"
android:repeatCount="1"
android:repeatMode="reverse" />
diff --git a/res/layout-land/live_folder_grid.xml b/res/layout-land/live_folder_grid.xml
index 44519d4..1796756 100644
--- a/res/layout-land/live_folder_grid.xml
+++ b/res/layout-land/live_folder_grid.xml
@@ -30,21 +30,26 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <GridView
- android:id="@+id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
-
- android:cacheColorHint="#ff333333"
- android:background="@drawable/box_launcher_bottom"
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:background="@drawable/box_launcher_bottom">
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarStyle="insideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
+ <GridView
+ android:id="@+id/folder_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
- android:verticalSpacing="10dip"
- android:numColumns="5" />
+ android:cacheColorHint="#ff333333"
+
+ android:scrollbarAlwaysDrawVerticalTrack="true"
+ android:scrollbarStyle="insideInset"
+ android:drawSelectorOnTop="false"
+ android:listSelector="@drawable/grid_selector"
+
+ android:verticalSpacing="10dip"
+ android:numColumns="5" />
+ </FrameLayout>
</com.android.launcher2.LiveFolder>
diff --git a/res/layout-land/user_folder.xml b/res/layout-land/user_folder.xml
index b05974a..5da4aa5 100644
--- a/res/layout-land/user_folder.xml
+++ b/res/layout-land/user_folder.xml
@@ -27,21 +27,26 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <GridView
- android:id="@id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
-
- android:cacheColorHint="#ff333333"
- android:background="@drawable/box_launcher_bottom"
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:background="@drawable/box_launcher_bottom">
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarStyle="insideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
+ <GridView
+ android:id="@id/folder_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
- android:verticalSpacing="10dip"
- android:numColumns="5" />
+ android:cacheColorHint="#ff333333"
+
+ android:scrollbarAlwaysDrawVerticalTrack="true"
+ android:scrollbarStyle="insideInset"
+ android:drawSelectorOnTop="false"
+ android:listSelector="@drawable/grid_selector"
+
+ android:verticalSpacing="10dip"
+ android:numColumns="5" />
+ </FrameLayout>
</com.android.launcher2.UserFolder>
diff --git a/res/layout-port/live_folder_grid.xml b/res/layout-port/live_folder_grid.xml
index 745307f..85f74db 100644
--- a/res/layout-port/live_folder_grid.xml
+++ b/res/layout-port/live_folder_grid.xml
@@ -30,21 +30,25 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <GridView
- android:id="@id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:background="@drawable/box_launcher_bottom">
+ <GridView
+ android:id="@id/folder_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
- android:cacheColorHint="#ff333333"
- android:background="@drawable/box_launcher_bottom"
+ android:cacheColorHint="#ff333333"
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarStyle="insideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
+ android:scrollbarAlwaysDrawVerticalTrack="true"
+ android:scrollbarStyle="insideInset"
+ android:drawSelectorOnTop="false"
+ android:listSelector="@drawable/grid_selector"
- android:verticalSpacing="10dip"
- android:numColumns="4" />
+ android:verticalSpacing="10dip"
+ android:numColumns="4" />
+ </FrameLayout>
</com.android.launcher2.LiveFolder>
diff --git a/res/layout-port/user_folder.xml b/res/layout-port/user_folder.xml
index 7377cde..0e6df66 100644
--- a/res/layout-port/user_folder.xml
+++ b/res/layout-port/user_folder.xml
@@ -27,21 +27,25 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <GridView
- android:id="@id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:background="@drawable/box_launcher_bottom">
+ <GridView
+ android:id="@id/folder_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
- android:cacheColorHint="#ff333333"
- android:background="@drawable/box_launcher_bottom"
+ android:cacheColorHint="#ff333333"
- android:scrollbarAlwaysDrawVerticalTrack="true"
- android:scrollbarStyle="insideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
+ android:scrollbarAlwaysDrawVerticalTrack="true"
+ android:scrollbarStyle="insideInset"
+ android:drawSelectorOnTop="false"
+ android:listSelector="@drawable/grid_selector"
- android:verticalSpacing="10dip"
- android:numColumns="4" />
+ android:verticalSpacing="10dip"
+ android:numColumns="4" />
+ </FrameLayout>
</com.android.launcher2.UserFolder>
diff --git a/res/layout-xlarge-land/customization_drawer.xml b/res/layout-xlarge-land/customization_drawer.xml
index 9115259..304aaf7 100644
--- a/res/layout-xlarge-land/customization_drawer.xml
+++ b/res/layout-xlarge-land/customization_drawer.xml
@@ -19,6 +19,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
+ launcher:wallpaperCellSpanX="4"
launcher:widgetCellCountX="16"
launcher:cellCountX="8"
launcher:cellCountY="3"
diff --git a/res/layout-xlarge-port/customization_drawer.xml b/res/layout-xlarge-port/customization_drawer.xml
index 28127ea..a9e1c0d 100644
--- a/res/layout-xlarge-port/customization_drawer.xml
+++ b/res/layout-xlarge-port/customization_drawer.xml
@@ -19,6 +19,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
+ launcher:wallpaperCellSpanX="4"
launcher:widgetCellCountX="10"
launcher:cellCountX="5"
launcher:cellCountY="3"
diff --git a/res/layout-xlarge/all_apps_paged_view_application.xml b/res/layout-xlarge/all_apps_paged_view_application.xml
index 7458222..48b5712 100644
--- a/res/layout-xlarge/all_apps_paged_view_application.xml
+++ b/res/layout-xlarge/all_apps_paged_view_application.xml
@@ -27,7 +27,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
- android:singleLine="false"
- android:maxLines="1"
style="@style/WorkspaceIcon.Portrait" />
diff --git a/res/layout-xlarge/customize_paged_view_item.xml b/res/layout-xlarge/customize_paged_view_item.xml
index bbc04d7..35e06c3 100644
--- a/res/layout-xlarge/customize_paged_view_item.xml
+++ b/res/layout-xlarge/customize_paged_view_item.xml
@@ -26,7 +26,5 @@
android:id="@+id/customize_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:singleLine="false"
- android:maxLines="1"
style="@style/WorkspaceIcon.Landscape" />
diff --git a/res/layout-xlarge/customize_paged_view_wallpaper.xml b/res/layout-xlarge/customize_paged_view_wallpaper.xml
new file mode 100644
index 0000000..6cf248a
--- /dev/null
+++ b/res/layout-xlarge/customize_paged_view_wallpaper.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+
+ android:layout_width="wrap_content"
+ android:layout_height="365dp"
+ android:paddingLeft="12.5dp"
+ android:paddingRight="12.5dp"
+ android:paddingBottom="50dp"
+ android:gravity="top"
+ android:orientation="vertical">
+
+ <!-- The preview image for the wallpaper. -->
+ <ImageView
+ android:id="@+id/wallpaper_preview"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1.0"
+ android:scaleType="fitStart" />
+
+ <!-- The divider image. -->
+ <ImageView
+ android:id="@+id/divider"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingTop="10dp"
+ android:paddingBottom="10dp"
+ android:src="@drawable/widget_divider" />
+
+ <!-- The name of the wallpaper -->
+ <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/wallpaper_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="left"
+
+ android:textColor="#FFFFFFFF"
+ android:textSize="14sp"
+ android:shadowColor="#FF000000"
+ android:shadowDx="0.0"
+ android:shadowDy="1.0"
+ android:shadowRadius="1.0"
+
+ android:maxLines="2"
+ android:fadingEdge="horizontal" />
+</LinearLayout>
diff --git a/res/layout-xlarge/customize_paged_view_widget.xml b/res/layout-xlarge/customize_paged_view_widget.xml
index fab2a9b..deeeb3d 100644
--- a/res/layout-xlarge/customize_paged_view_widget.xml
+++ b/res/layout-xlarge/customize_paged_view_widget.xml
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<com.android.launcher2.PagedViewWidgetIcon
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
@@ -76,4 +76,4 @@
android:shadowDx="0.0"
android:shadowDy="1.0"
android:shadowRadius="1.0" />
-</com.android.launcher2.PagedViewWidgetIcon>
+</LinearLayout>
diff --git a/res/layout/live_folder_list.xml b/res/layout/live_folder_list.xml
index e5a305f..0dc7b7c 100644
--- a/res/layout/live_folder_list.xml
+++ b/res/layout/live_folder_list.xml
@@ -21,22 +21,25 @@
android:orientation="vertical">
<Button
- android:id="@+id/folder_close"
- android:background="@drawable/box_launcher_top"
- android:gravity="left|center_vertical"
- android:textSize="14sp"
- android:textColor="#404040"
- android:textStyle="bold"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ android:id="@+id/folder_close"
+ android:background="@drawable/box_launcher_top"
+ android:gravity="left|center_vertical"
+ android:textSize="14sp"
+ android:textColor="#404040"
+ android:textStyle="bold"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
- <ListView
- android:id="@id/folder_content"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
-
- android:cacheColorHint="#ff333333"
- android:background="@drawable/box_launcher_bottom" />
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:background="@drawable/box_launcher_bottom">
+ <ListView
+ android:id="@id/folder_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:cacheColorHint="#ff333333" />
+ </FrameLayout>
</com.android.launcher2.LiveFolder>
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index e938b73..22d1b63 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Aplikace"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Hry"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Stažené"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Nenalezeny žádné hry."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Žádné stažené aplikace."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Název složky"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Přejmenovat složku"</string>
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index 576abce..6806993 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Programmer"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Spil"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Downloadet"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Ingen spil."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Ingen hentede programmer."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Mappenavn"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Omdøb mappe"</string>
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 575db07..e60eb34 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Apps"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Spiele"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Heruntergeladen"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Keine Spiele gefunden."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Keine heruntergeladenen Apps"</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Ordnername"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Ordner umbenennen"</string>
diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml
index 0937c5b..0298d91 100644
--- a/res/values-el/strings.xml
+++ b/res/values-el/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Εφαρμογές"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Παιχνίδια"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Η λήψη ολοκληρώθηκε"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Δεν βρέθηκαν παιχνίδια."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Δεν βρέθηκαν ληφθ. εφαρμ."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Όνομα φακέλου"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Μετονομασία φακέλου"</string>
diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml
index d718936..9158dbc 100644
--- a/res/values-es-rUS/strings.xml
+++ b/res/values-es-rUS/strings.xml
@@ -37,8 +37,12 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Google Apps"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Juegos"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Descargado"</string>
- <string name="all_apps_no_games" msgid="5293893733372793696">"No"</string>
- <string name="all_apps_no_downloads" msgid="6145042636084482299">"No Google Apps"</string>
+ <string name="all_apps_no_games" msgid="5293893733372793696">"No se encontraron juegos."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"No se encontraron apps."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+ <skip />
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
+ <skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nombre de carpeta"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Cambiar nombre de carpeta"</string>
<string name="rename_action" msgid="6016003384693240896">"Aceptar"</string>
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index ab0485a..f9d8b15 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Aplicaciones"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Juegos"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Descargadas"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"No hay juegos."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Sin aplicaciones descarg."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nombre de carpeta"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Cambiar nombre de carpeta"</string>
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index 35ee775..5827611 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Applications"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Jeux"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Téléchargées"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Aucun jeu n\'a été trouvé."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Pas d\'application téléchargée"</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nom du dossier"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Renommer le dossier"</string>
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 7705763..5b40b98 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Applicazioni"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Giochi"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Scaricate"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Nessun gioco trovato."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Nessuna appl. scaricata"</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nome cartella"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Rinomina cartella"</string>
diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml
index 2a7a218..5932429 100644
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"アプリ"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"ゲーム"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"ダウンロード済み"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"ゲームなし"</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"ダウンロードアプリなし"</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"フォルダ名"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"フォルダ名を変更"</string>
diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml
index b23450d..6dc4a60 100644
--- a/res/values-ko/strings.xml
+++ b/res/values-ko/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"애플리케이션"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"게임"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"다운로드앱"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"게임이 없습니다."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"다운로드한 애플리케이션이 없습니다."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"폴더 이름"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"폴더 이름 바꾸기"</string>
diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
index 5026744..40cbbba 100644
--- a/res/values-nb/strings.xml
+++ b/res/values-nb/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Programmer"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Spill"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Nedlastet"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Finner ingen spill."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Finner ingen nedl.prog."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Mappenavn"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Gi nytt navn til mappe"</string>
diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml
index 6562529..fa19eea 100644
--- a/res/values-nl/strings.xml
+++ b/res/values-nl/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Toepassingen"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Games"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Gedownload"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Geen games gevonden."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Geen gedownl. apps gevond."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Mapnaam"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Naam van map wijzigen"</string>
diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml
index f2ac81d..cdfb0a9 100644
--- a/res/values-pl/strings.xml
+++ b/res/values-pl/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Aplikacje"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Gry"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Pobrane"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Nie znaleziono gier."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Brak pobranych aplikacji."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nazwa folderu"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Zmień nazwę folderu"</string>
diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml
index a3c432d..59effc7 100644
--- a/res/values-pt-rPT/strings.xml
+++ b/res/values-pt-rPT/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Aplicações"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Jogos"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Transferidas"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Sem jogos."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Sem aplic. transferidas."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nome da pasta"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Mudar o nome da pasta"</string>
diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
index 3941c4f..7f947a6 100644
--- a/res/values-pt/strings.xml
+++ b/res/values-pt/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Aplicativos"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Jogos"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Download concluído"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Nenhum jogo encontrado."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Nenhum aplic. encontrado."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nome da pasta"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Renomear pasta"</string>
diff --git a/res/values-rm/strings.xml b/res/values-rm/strings.xml
index 10cbc4a..5e7b1e7 100644
--- a/res/values-rm/strings.xml
+++ b/res/values-rm/strings.xml
@@ -51,6 +51,10 @@
<skip />
<!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
<skip />
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
+ <skip />
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
+ <skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Num da l\'ordinatur"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Renumnar l\'ordinatur"</string>
<string name="rename_action" msgid="6016003384693240896">"OK"</string>
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index fd5b35d..acfa352 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Приложения"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Игры"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Загруженные"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Игр не найдено."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Нет загруженных приложений."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Название папки"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Переименовать папку"</string>
diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml
index 17a6cdc..7248635 100644
--- a/res/values-sv/strings.xml
+++ b/res/values-sv/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Program"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Spel"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Hämtade"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Inga spel hittades."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"Inga hämtade appar."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Mappnamn"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Byt namn på mapp"</string>
diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
index 19417f0..9716ea7 100644
--- a/res/values-tr/strings.xml
+++ b/res/values-tr/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"Uygulamalar"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"Oyunlar"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"İndirilenler"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"Oyun bulunamadı."</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"İndirilmş uyg bulunamadı."</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Klasör adı"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"Klasörü yeniden adlandır"</string>
diff --git a/res/values-xlarge/config.xml b/res/values-xlarge/config.xml
index 6a56679..a54528e 100644
--- a/res/values-xlarge/config.xml
+++ b/res/values-xlarge/config.xml
@@ -5,6 +5,10 @@
<!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
<integer name="config_allAppsZoomInTime">350</integer>
+ <!-- Duration in milliseconds of the transition between tabs in the all apps/customize
+ tray -->
+ <integer name="config_tabTransitionTime">100</integer>
+
<!-- Duration in milliseconds of the all apps zoom-out animation -->
<!-- NB: This should be less than the workspaceUnshrinkTime as they happen together. -->
<integer name="config_allAppsZoomOutTime">350</integer>
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 751474b..22bba84 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"应用程序"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"游戏"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"已下载"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"未找到游戏。"</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"未找到已下载的应用程序。"</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"文件夹名称"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"重命名文件夹"</string>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index 824ec64..6cc7c32 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -37,9 +37,11 @@
<string name="all_apps_tab_apps" msgid="5468972551904071712">"應用程式"</string>
<string name="all_apps_tab_games" msgid="1855736784923494918">"遊戲"</string>
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"下載內容"</string>
- <!-- no translation found for all_apps_no_games (5293893733372793696) -->
+ <string name="all_apps_no_games" msgid="5293893733372793696">"找不到遊戲。"</string>
+ <string name="all_apps_no_downloads" msgid="6145042636084482299">"找不到已下載的應用程式。"</string>
+ <!-- no translation found for external_drop_widget_error (7794528430439958736) -->
<skip />
- <!-- no translation found for all_apps_no_downloads (6145042636084482299) -->
+ <!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"資料夾名稱"</string>
<string name="rename_folder_title" msgid="4544573104191526550">"重新命名資料夾"</string>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 5d6773c..975548e 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -74,15 +74,6 @@
<attr name="checkedOutlineColor" format="color" />
</declare-styleable>
- <!-- PagedViewWidgetIcon specific attributes. These attributes are used to
- customize a PagedViewWidgetIcon view in XML files. -->
- <declare-styleable name="PagedViewWidgetIcon">
- <!-- The checked blur color of the holographic outline -->
- <attr name="checkedBlurColor" />
- <!-- The checked outline color of the holographic outline -->
- <attr name="checkedOutlineColor" />
- </declare-styleable>
-
<!-- PagedView specific attributes. These attributes are used to customize
a PagedView view in XML files. -->
<declare-styleable name="PagedView">
@@ -105,6 +96,8 @@
<!-- CustomizePagedView specific attributes. These attributes are used to customize
a CustomizePagedView view in XML files. -->
<declare-styleable name="CustomizePagedView">
+ <!-- The cell span of an item in the wallpapers tab -->
+ <attr name="wallpaperCellSpanX" format="integer" />
<!-- The number of horizontal cells for the widget tab -->
<attr name="widgetCellCountX" format="integer" />
</declare-styleable>
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java
index e0ff1a8..a6e21b9 100644
--- a/src/com/android/launcher2/AllAppsTabbed.java
+++ b/src/com/android/launcher2/AllAppsTabbed.java
@@ -76,7 +76,8 @@
setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
// animate the changing of the tab content by fading pages in and out
- final int duration = 150;
+ final Resources res = getResources();
+ final int duration = res.getInteger(R.integer.config_tabTransitionTime);
final float alpha = mAllApps.getAlpha();
ValueAnimator alphaAnim = ObjectAnimator.ofFloat(mAllApps, "alpha", alpha, 0.0f).
setDuration(duration);
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 11c0c18..e340101 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -839,6 +839,10 @@
mBackgroundAlphaMultiplier = multiplier;
}
+ public float getBackgroundAlphaMultiplier() {
+ return mBackgroundAlphaMultiplier;
+ }
+
public void setBackgroundAlpha(float alpha) {
mBackgroundAlpha = alpha;
invalidate();
@@ -1034,15 +1038,15 @@
final int countY = mCountY;
final boolean[][] occupied = mOccupied;
- for (int x = 0; x < countX - (spanX - 1); x++) {
+ for (int y = 0; y < countY - (spanY - 1); y++) {
inner:
- for (int y = 0; y < countY - (spanY - 1); y++) {
+ for (int x = 0; x < countX - (spanX - 1); x++) {
for (int i = 0; i < spanX; i++) {
for (int j = 0; j < spanY; j++) {
if (occupied[x + i][y + j]) {
- // small optimization: we can skip to below the row we just found
+ // small optimization: we can skip to after the column we just found
// an occupied cell
- y += j;
+ x += i;
continue inner;
}
}
@@ -1150,15 +1154,15 @@
endY = Math.min(endY, intersectY + (spanY - 1) + (spanY == 1 ? 1 : 0));
}
- for (int x = startX; x < endX; x++) {
+ for (int y = startY; y < endY && !foundCell; y++) {
inner:
- for (int y = startY; y < endY; y++) {
+ for (int x = startX; x < endX; x++) {
for (int i = 0; i < spanX; i++) {
for (int j = 0; j < spanY; j++) {
if (mOccupied[x + i][y + j]) {
- // small optimization: we can skip to below the row we just found
+ // small optimization: we can skip to after the column we just found
// an occupied cell
- y += j;
+ x += i;
continue inner;
}
}
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 4cce81e..1763a00 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -77,12 +77,18 @@
// The mapping between the pages and the widgets that will be laid out on them
private ArrayList<ArrayList<AppWidgetProviderInfo>> mWidgetPages;
- // The max dimensions for the ImageView we use for displaying the widget
+ // The max dimensions for the ImageView we use for displaying a widget
private int mMaxWidgetWidth;
- // The max number of widget cells to take a "page" of widget
+ // The max number of widget cells to take a "page" of widgets
private int mMaxWidgetsCellHSpan;
+ // The size of the items on the wallpaper tab
+ private int mWallpaperCellHSpan;
+
+ // The max dimensions for the ImageView we use for displaying a wallpaper
+ private int mMaxWallpaperWidth;
+
// The raw sources of data for each of the different tabs of the customization page
private List<AppWidgetProviderInfo> mWidgetList;
private List<ResolveInfo> mShortcutList;
@@ -112,15 +118,15 @@
super(context, attrs, defStyle);
TypedArray a;
- a = context.obtainStyledAttributes(attrs, R.styleable.CustomizePagedView,
- defStyle, 0);
+ a = context.obtainStyledAttributes(attrs, R.styleable.CustomizePagedView, defStyle, 0);
+ mWallpaperCellHSpan = a.getInt(R.styleable.CustomizePagedView_wallpaperCellSpanX, 4);
mMaxWidgetsCellHSpan = a.getInt(R.styleable.CustomizePagedView_widgetCellCountX, 8);
a.recycle();
a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, defStyle, 0);
mCellCountX = a.getInt(R.styleable.PagedView_cellCountX, 7);
mCellCountY = a.getInt(R.styleable.PagedView_cellCountY, 4);
-
a.recycle();
+
mCustomizationType = CustomizationType.WidgetCustomization;
mWidgetPages = new ArrayList<ArrayList<AppWidgetProviderInfo>>();
mWorkspaceWidgetLayout = new PagedViewCellLayout(context);
@@ -283,6 +289,7 @@
public void setCustomizationFilter(CustomizationType filterType) {
mCustomizationType = filterType;
setCurrentPage(0);
+ updateCurrentPageScroll();
invalidatePageData();
// End the current choice mode so that we don't carry selections across tabs
@@ -449,21 +456,58 @@
/**
* Helper function to draw a drawable to the specified canvas with the specified bounds.
*/
- private void renderDrawableToBitmap(Drawable d, Bitmap bitmap, int l, int t, int r, int b) {
+ private void renderDrawableToBitmap(Drawable d, Bitmap bitmap, int x, int y, int w, int h) {
if (bitmap != null) mCanvas.setBitmap(bitmap);
mCanvas.save();
- d.setBounds(l, t, r, b);
+ d.setBounds(x, y, x+w, y+h);
d.draw(mCanvas);
mCanvas.restore();
}
/**
+ * This method will extract the preview image specified by the wallpaper source provider (if it
+ * exists) otherwise, it will try to generate a default image preview.
+ */
+ private Drawable getWallpaperPreview(ResolveInfo info) {
+ // To be implemented later: resolving the up-to-date wallpaper thumbnail
+
+ final int minDim = mWorkspaceWidgetLayout.estimateCellWidth(1);
+ final int dim = mWorkspaceWidgetLayout.estimateCellWidth(mWallpaperCellHSpan);
+ Resources resources = mLauncher.getResources();
+
+ // Create a new bitmap to hold the widget preview
+ int width = (int) (dim * sScaleFactor);
+ int height = (int) (dim * sScaleFactor);
+ final Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
+ final Drawable background = resources.getDrawable(R.drawable.default_widget_preview);
+ renderDrawableToBitmap(background, bitmap, 0, 0, width, height);
+
+ // Draw the icon flush left
+ try {
+ final IconCache iconCache =
+ ((LauncherApplication) mLauncher.getApplication()).getIconCache();
+ Drawable icon = new FastBitmapDrawable(Utilities.createIconBitmap(
+ iconCache.getFullResIcon(info, mPackageManager), mContext));
+
+ final int iconSize = minDim / 2;
+ final int offset = iconSize / 4;
+ renderDrawableToBitmap(icon, null, offset, offset, iconSize, iconSize);
+ } catch (Resources.NotFoundException e) {
+ // if we can't find the icon, then just don't draw it
+ }
+
+ Drawable drawable = new FastBitmapDrawable(bitmap);
+ drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
+ return drawable;
+ }
+
+ /**
* This method will extract the preview image specified by the widget developer (if it exists),
* otherwise, it will try to generate a default image preview with the widget's package icon.
- * @return the drawable will be used and sized in the ImageView to represent the widget
+ * @return the drawable that will be used and sized in the ImageView to represent the widget
*/
- private Drawable getWidgetIcon(AppWidgetProviderInfo info) {
- PackageManager packageManager = mLauncher.getPackageManager();
+ private Drawable getWidgetPreview(AppWidgetProviderInfo info) {
+ final PackageManager packageManager = mPackageManager;
String packageName = info.provider.getPackageName();
Drawable drawable = null;
if (info.previewImage != 0) {
@@ -487,9 +531,8 @@
final Drawable background = resources.getDrawable(R.drawable.default_widget_preview);
renderDrawableToBitmap(background, bitmap, 0, 0, width, height);
- // Draw the icon vertically centered, flush left
+ // Draw the icon flush left
try {
- Rect tmpRect = new Rect();
Drawable icon = null;
if (info.icon > 0) {
icon = packageManager.getDrawable(packageName, info.icon, null);
@@ -497,12 +540,10 @@
if (icon == null) {
icon = resources.getDrawable(R.drawable.ic_launcher_application);
}
- background.getPadding(tmpRect);
final int iconSize = minDim / 2;
final int offset = iconSize / 4;
- final int offsetIconSize = offset + iconSize;
- renderDrawableToBitmap(icon, null, offset, offset, offsetIconSize, offsetIconSize);
+ renderDrawableToBitmap(icon, null, offset, offset, iconSize, iconSize);
} catch (Resources.NotFoundException e) {
// if we can't find the icon, then just don't draw it
}
@@ -510,19 +551,21 @@
drawable = new FastBitmapDrawable(bitmap);
} else {
// Scale down the preview if necessary
- final float aspect = (float) info.minWidth / info.minHeight;
- final int boundedWidth = (int) Math.max(minDim, Math.min(maxDim, info.minWidth));
- final int boundedHeight = (int) Math.max(minDim, Math.min(maxDim, info.minHeight));
- final int scaledWidth = (int) (boundedWidth * sScaleFactor);
- final int scaledHeight = (int) (boundedHeight * sScaleFactor);
+ final float imageWidth = drawable.getIntrinsicWidth();
+ final float imageHeight = drawable.getIntrinsicHeight();
+ final float aspect = (float) imageWidth / imageHeight;
+ final int scaledWidth =
+ (int) (Math.max(minDim, Math.min(maxDim, imageWidth)) * sScaleFactor);
+ final int scaledHeight =
+ (int) (Math.max(minDim, Math.min(maxDim, imageHeight)) * sScaleFactor);
int width;
int height;
- if (scaledWidth > scaledHeight) {
+ if (aspect >= 1.0f) {
width = scaledWidth;
- height = (int) (width / aspect);
+ height = (int) (((float) scaledWidth / imageWidth) * imageHeight);
} else {
height = scaledHeight;
- width = (int) (height * aspect);
+ width = (int) (((float) scaledHeight / imageHeight) * imageWidth);
}
final Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
@@ -546,6 +589,7 @@
mWorkspaceWidgetLayout.setPadding(20, 10, 20, 0);
mMaxWidgetWidth = mWorkspaceWidgetLayout.estimateCellWidth(sMaxWidgetCellHSpan);
+ mMaxWallpaperWidth = mWorkspaceWidgetLayout.estimateCellWidth(mWallpaperCellHSpan);
}
private void syncWidgetPages() {
@@ -555,7 +599,7 @@
removeAllViews();
int numPages = relayoutWidgets();
for (int i = 0; i < numPages; ++i) {
- LinearLayout layout = new PagedViewWidgetLayout(getContext());
+ LinearLayout layout = new PagedViewExtendedLayout(getContext());
layout.setGravity(Gravity.CENTER_HORIZONTAL);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
@@ -590,7 +634,7 @@
l.setOnClickListener(this);
l.setOnLongClickListener(this);
- final Drawable icon = getWidgetIcon(info);
+ final Drawable icon = getWidgetPreview(info);
int[] spans = CellLayout.rectToCell(getResources(), info.minWidth, info.minHeight, null);
final int hSpan = spans[0];
@@ -608,6 +652,58 @@
}
}
+ private void syncWallpaperPages() {
+ if (mWallpaperList == null) return;
+
+ // We need to repopulate the LinearLayout for the wallpaper pages
+ removeAllViews();
+ int numPages = (int) Math.ceil((float) (mWallpaperList.size() * mWallpaperCellHSpan) /
+ mMaxWidgetsCellHSpan);
+ for (int i = 0; i < numPages; ++i) {
+ LinearLayout layout = new PagedViewExtendedLayout(getContext());
+ layout.setGravity(Gravity.CENTER_HORIZONTAL);
+ layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
+ mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
+
+ // Temporary change to prevent the last page from being too small (and items bleeding
+ // onto it). We can remove this once we properly fix the fading algorithm
+ if (i < numPages - 1) {
+ addView(layout, new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ LinearLayout.LayoutParams.MATCH_PARENT));
+ } else {
+ addView(layout, new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.MATCH_PARENT,
+ LinearLayout.LayoutParams.MATCH_PARENT));
+ }
+ }
+ }
+
+ private void syncWallpaperPageItems(int page) {
+ // Load the items on to the pages
+ LinearLayout layout = (LinearLayout) getChildAt(page);
+ layout.removeAllViews();
+ final int count = mWallpaperList.size();
+ for (int i = 0; i < count; ++i) {
+ final ResolveInfo info = mWallpaperList.get(i);
+
+ LinearLayout l = (LinearLayout) mInflater.inflate(
+ R.layout.customize_paged_view_wallpaper, layout, false);
+ l.setTag(info);
+ l.setOnClickListener(this);
+
+ final Drawable icon = getWallpaperPreview(info);
+
+ ImageView image = (ImageView) l.findViewById(R.id.wallpaper_preview);
+ image.setMaxWidth(mMaxWidgetWidth);
+ image.setImageDrawable(icon);
+ TextView name = (TextView) l.findViewById(R.id.wallpaper_name);
+ name.setText(info.loadLabel(mPackageManager));
+
+ layout.addView(l);
+ }
+ }
+
private void syncListPages(List<ResolveInfo> list) {
// we need to repopulate with PagedViewCellLayouts
removeAllViews();
@@ -714,8 +810,7 @@
centerPagedViewCellLayouts = true;
break;
case WallpaperCustomization:
- syncListPages(mWallpaperList);
- centerPagedViewCellLayouts = true;
+ syncWallpaperPages();
break;
case ApplicationCustomization:
syncAppPages();
@@ -755,7 +850,7 @@
syncListPageItems(page, mShortcutList);
break;
case WallpaperCustomization:
- syncListPageItems(page, mWallpaperList);
+ syncWallpaperPageItems(page);
break;
case ApplicationCustomization:
syncAppPageItems(page);
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 3c956f0..d796fbe 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -584,6 +584,8 @@
mDragSource.onDropCompleted((View) dropTarget, false);
return true;
}
+ } else {
+ mDragSource.onDropCompleted(null, false);
}
return false;
}
diff --git a/src/com/android/launcher2/FastBitmapDrawable.java b/src/com/android/launcher2/FastBitmapDrawable.java
index 1cafa09..1aa8b35 100644
--- a/src/com/android/launcher2/FastBitmapDrawable.java
+++ b/src/com/android/launcher2/FastBitmapDrawable.java
@@ -16,12 +16,13 @@
package com.android.launcher2;
-import android.graphics.drawable.Drawable;
-import android.graphics.Paint;
-import android.graphics.PixelFormat;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
+import android.graphics.Paint;
+import android.graphics.PixelFormat;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
class FastBitmapDrawable extends Drawable {
private Bitmap mBitmap;
@@ -41,7 +42,8 @@
@Override
public void draw(Canvas canvas) {
- canvas.drawBitmap(mBitmap, 0.0f, 0.0f, mPaint);
+ final Rect r = getBounds();
+ canvas.drawBitmap(mBitmap, r.left, r.top, mPaint);
}
@Override
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 549303d..37c2b41 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -47,12 +47,12 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.content.Intent.ShortcutIconResource;
import android.content.IntentFilter;
+import android.content.Intent.ShortcutIconResource;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -67,6 +67,7 @@
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
+import android.os.Message;
import android.os.Parcelable;
import android.os.SystemClock;
import android.os.SystemProperties;
@@ -85,25 +86,27 @@
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
-import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
+import android.view.View.OnLongClickListener;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
+import android.widget.Advanceable;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TabHost;
-import android.widget.TabHost.OnTabChangeListener;
-import android.widget.TabHost.TabContentFactory;
import android.widget.TextView;
import android.widget.Toast;
+import android.widget.TabHost.OnTabChangeListener;
+import android.widget.TabHost.TabContentFactory;
import com.android.common.Search;
import com.android.launcher.R;
+
/**
* Default launcher application.
*/
@@ -205,6 +208,7 @@
private HandleView mHandleView;
private AllAppsView mAllAppsGrid;
private TabHost mHomeCustomizationDrawer;
+ private boolean mAutoAdvanceRunning = false;
private PagedView mAllAppsPagedView = null;
private CustomizePagedView mCustomizePagedView = null;
@@ -224,10 +228,14 @@
private LauncherModel mModel;
private IconCache mIconCache;
+ private boolean mUserPresent = true;
+ private boolean mVisible = false;
+ private boolean mAttached = false;
private static LocaleConfiguration sLocaleConfiguration = null;
private ArrayList<ItemInfo> mDesktopItems = new ArrayList<ItemInfo>();
+
private static HashMap<Long, FolderInfo> sFolders = new HashMap<Long, FolderInfo>();
private ImageView mPreviousView;
@@ -241,6 +249,15 @@
private Intent mAppMarketIntent = null;
+ // Related to the auto-advancing of widgets
+ private final int ADVANCE_MSG = 1;
+ private final int mAdvanceInterval = 20000;
+ private final int mAdvanceStagger = 250;
+ private long mAutoAdvanceSentTime;
+ private long mAutoAdvanceTimeLeft = -1;
+ private HashMap<View, AppWidgetProviderInfo> mWidgetsToAdvance =
+ new HashMap<View, AppWidgetProviderInfo>();
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -299,7 +316,8 @@
mHomeCustomizationDrawer.setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
// animate the changing of the tab content by fading pages in and out
- final int duration = 150;
+ final Resources res = getResources();
+ final int duration = res.getInteger(R.integer.config_tabTransitionTime);
final float alpha = mCustomizePagedView.getAlpha();
ValueAnimator alphaAnim = ObjectAnimator.ofFloat(mCustomizePagedView,
"alpha", alpha, 0.0f);
@@ -1060,7 +1078,6 @@
}
}
-
/**
* Add a widget to the workspace.
*
@@ -1133,18 +1150,129 @@
mWorkspace.addInScreen(launcherInfo.hostView, screen, cellXY[0], cellXY[1],
launcherInfo.spanX, launcherInfo.spanY, isWorkspaceLocked());
+
+ addWidgetToAutoAdvanceIfNeeded(launcherInfo.hostView, appWidgetInfo);
}
}
- void showOutOfSpaceMessage() {
- Toast.makeText(this, getString(R.string.out_of_space), Toast.LENGTH_SHORT).show();
+ private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ final String action = intent.getAction();
+ if (Intent.ACTION_SCREEN_OFF.equals(action)) {
+ mUserPresent = false;
+ updateRunning();
+ } else if (Intent.ACTION_USER_PRESENT.equals(action)) {
+ mUserPresent = true;
+ updateRunning();
+ }
+ }
+ };
+
+ @Override
+ public void onAttachedToWindow() {
+ super.onAttachedToWindow();
+
+ // Listen for broadcasts related to user-presence
+ final IntentFilter filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_SCREEN_OFF);
+ filter.addAction(Intent.ACTION_USER_PRESENT);
+ registerReceiver(mReceiver, filter);
+
+ mAttached = true;
+ mVisible = true;
+ }
+
+ @Override
+ public void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mVisible = false;
+
+ if (mAttached) {
+ unregisterReceiver(mReceiver);
+ mAttached = false;
+ }
+ updateRunning();
+ }
+
+ public void onWindowVisibilityChanged(int visibility) {
+ mVisible = visibility == View.VISIBLE;
+ updateRunning();
+ }
+
+ private void sendAdvanceMessage(long delay) {
+ mHandler.removeMessages(ADVANCE_MSG);
+ Message msg = mHandler.obtainMessage(ADVANCE_MSG);
+ mHandler.sendMessageDelayed(msg, delay);
+ mAutoAdvanceSentTime = System.currentTimeMillis();
+ }
+
+ private void updateRunning() {
+ boolean autoAdvanceRunning = mVisible && mUserPresent && !mWidgetsToAdvance.isEmpty();
+ if (autoAdvanceRunning != mAutoAdvanceRunning) {
+ mAutoAdvanceRunning = autoAdvanceRunning;
+ if (autoAdvanceRunning) {
+ long delay = mAutoAdvanceTimeLeft == -1 ? mAdvanceInterval : mAutoAdvanceTimeLeft;
+ sendAdvanceMessage(delay);
+ } else {
+ if (!mWidgetsToAdvance.isEmpty()) {
+ mAutoAdvanceTimeLeft = Math.max(0, mAdvanceInterval -
+ (System.currentTimeMillis() - mAutoAdvanceSentTime));
+ }
+ mHandler.removeMessages(ADVANCE_MSG);
+ }
+ }
+ }
+
+ private final Handler mHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ if (msg.what == ADVANCE_MSG) {
+ int i = 0;
+ for (View key: mWidgetsToAdvance.keySet()) {
+ final View v = key.findViewById(mWidgetsToAdvance.get(key).autoAdvanceViewId);
+ final int delay = mAdvanceStagger * i;
+ if (v instanceof Advanceable) {
+ postDelayed(new Runnable() {
+ public void run() {
+ ((Advanceable) v).advance();
+ }
+ }, delay);
+ }
+ i++;
+ }
+ sendAdvanceMessage(mAdvanceInterval);
+ }
+ }
+ };
+
+ void addWidgetToAutoAdvanceIfNeeded(View hostView, AppWidgetProviderInfo appWidgetInfo) {
+ if (appWidgetInfo.autoAdvanceViewId == -1) return;
+ View v = hostView.findViewById(appWidgetInfo.autoAdvanceViewId);
+ if (v instanceof Advanceable) {
+ mWidgetsToAdvance.put(hostView, appWidgetInfo);
+ ((Advanceable) v).willBeAdvancedByHost();
+ updateRunning();
+ }
+ }
+
+ void removeWidgetToAutoAdvance(View hostView) {
+ if (mWidgetsToAdvance.containsKey(hostView)) {
+ mWidgetsToAdvance.remove(hostView);
+ updateRunning();
+ }
}
public void removeAppWidget(LauncherAppWidgetInfo launcherInfo) {
mDesktopItems.remove(launcherInfo);
+ removeWidgetToAutoAdvance(launcherInfo.hostView);
launcherInfo.hostView = null;
}
+ void showOutOfSpaceMessage() {
+ Toast.makeText(this, getString(R.string.out_of_space), Toast.LENGTH_SHORT).show();
+ }
+
public LauncherAppWidgetHost getAppWidgetHost() {
return mAppWidgetHost;
}
@@ -3064,6 +3192,8 @@
workspace.addInScreen(item.hostView, item.screen, item.cellX,
item.cellY, item.spanX, item.spanY, false);
+ addWidgetToAutoAdvanceIfNeeded(item.hostView, appWidgetInfo);
+
workspace.requestLayout();
mDesktopItems.add(item);
diff --git a/src/com/android/launcher2/LauncherAppWidgetInfo.java b/src/com/android/launcher2/LauncherAppWidgetInfo.java
index 32c92aa..844abb5 100644
--- a/src/com/android/launcher2/LauncherAppWidgetInfo.java
+++ b/src/com/android/launcher2/LauncherAppWidgetInfo.java
@@ -37,7 +37,7 @@
int appWidgetId = NO_ID;
ComponentName providerName;
-
+
// TODO: Are these necessary here?
int minWidth = -1;
int minHeight = -1;
@@ -65,7 +65,7 @@
itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
this.appWidgetId = appWidgetId;
}
-
+
@Override
void onAddToDatabase(ContentValues values) {
super.onAddToDatabase(values);
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index e9829fb..109696c 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -245,16 +245,29 @@
}
/**
- * Sets the current page.
+ * Updates the scroll of the current page immediately to its final scroll position. We use this
+ * in CustomizePagedView to allow tabs to share the same PagedView while resetting the scroll of
+ * the previous tab page.
*/
- void setCurrentPage(int currentPage) {
- if (!mScroller.isFinished()) mScroller.abortAnimation();
- if (getChildCount() == 0) return;
-
- mCurrentPage = Math.max(0, Math.min(currentPage, getPageCount() - 1));
+ protected void updateCurrentPageScroll() {
int newX = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage);
scrollTo(newX, 0);
mScroller.setFinalX(newX);
+ }
+
+ /**
+ * Sets the current page.
+ */
+ void setCurrentPage(int currentPage) {
+ if (!mScroller.isFinished()) {
+ mScroller.abortAnimation();
+ }
+ if (getChildCount() == 0 || currentPage == mCurrentPage) {
+ return;
+ }
+
+ mCurrentPage = Math.max(0, Math.min(currentPage, getPageCount() - 1));
+ updateCurrentPageScroll();
invalidate();
notifyPageSwitchListener();
@@ -617,6 +630,9 @@
* scrolling there.
*/
+ // Skip touch handling if there are no pages to swipe
+ if (getChildCount() <= 0) return super.onInterceptTouchEvent(ev);
+
/*
* Shortcut the most recurring case: the user is in the dragging
* state and he is moving his finger. We want to intercept this
@@ -771,6 +787,9 @@
@Override
public boolean onTouchEvent(MotionEvent ev) {
+ // Skip touch handling if there are no pages to swipe
+ if (getChildCount() <= 0) return super.onTouchEvent(ev);
+
acquireVelocityTrackerAndAddMovement(ev);
final int action = ev.getAction();
diff --git a/src/com/android/launcher2/PagedViewWidgetLayout.java b/src/com/android/launcher2/PagedViewExtendedLayout.java
similarity index 85%
rename from src/com/android/launcher2/PagedViewWidgetLayout.java
rename to src/com/android/launcher2/PagedViewExtendedLayout.java
index 4666873..52df9f1 100644
--- a/src/com/android/launcher2/PagedViewWidgetLayout.java
+++ b/src/com/android/launcher2/PagedViewExtendedLayout.java
@@ -22,20 +22,20 @@
import android.widget.LinearLayout;
/**
- * The linear layout used strictly for the widget tab of the customization tray
+ * The linear layout used strictly for the widget/wallpaper tab of the customization tray
*/
-public class PagedViewWidgetLayout extends LinearLayout {
+public class PagedViewExtendedLayout extends LinearLayout {
static final String TAG = "PagedViewWidgetLayout";
- public PagedViewWidgetLayout(Context context) {
+ public PagedViewExtendedLayout(Context context) {
this(context, null);
}
- public PagedViewWidgetLayout(Context context, AttributeSet attrs) {
+ public PagedViewExtendedLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
- public PagedViewWidgetLayout(Context context, AttributeSet attrs, int defStyle) {
+ public PagedViewExtendedLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index 89cf331..50ba8d4 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -16,9 +16,6 @@
package com.android.launcher2;
-import com.android.launcher.R;
-import com.android.launcher2.PagedView.PagedViewIconCache;
-
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -26,7 +23,6 @@
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
-import android.graphics.Rect;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
@@ -34,6 +30,9 @@
import android.widget.Checkable;
import android.widget.TextView;
+import com.android.launcher.R;
+import com.android.launcher2.PagedView.PagedViewIconCache;
+
/**
@@ -195,11 +194,12 @@
}
if (overlay != null) {
+ final int offset = getScrollX();
final int compoundPaddingLeft = getCompoundPaddingLeft();
final int compoundPaddingRight = getCompoundPaddingRight();
int hspace = getWidth() - compoundPaddingRight - compoundPaddingLeft;
canvas.drawBitmap(overlay,
- compoundPaddingLeft + (hspace - overlay.getWidth()) / 2,
+ offset + compoundPaddingLeft + (hspace - overlay.getWidth()) / 2,
mPaddingTop,
mPaint);
}
diff --git a/src/com/android/launcher2/PagedViewWidgetIcon.java b/src/com/android/launcher2/PagedViewWidgetIcon.java
deleted file mode 100644
index f285dab..0000000
--- a/src/com/android/launcher2/PagedViewWidgetIcon.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-package com.android.launcher2;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.Checkable;
-import android.widget.LinearLayout;
-
-import com.android.launcher.R;
-
-/**
- * An widget icon for use specifically in the CustomizePagedView. In class form so that
- * we can add logic for how it will look when checked/unchecked.
- */
-public class PagedViewWidgetIcon extends LinearLayout implements Checkable {
- private static final String TAG = "PagedViewIcon";
-
- // Holographic outline
- private final Paint mPaint = new Paint();
- private static HolographicOutlineHelper sHolographicOutlineHelper;
- private final Paint mErasePaint = new Paint();
- private Bitmap mCheckedOutline;
- private Canvas mHolographicOutlineCanvas;
- private boolean mIsHolographicUpdatePass;
-
- private int mAlpha;
-
- private boolean mIsChecked;
-
- // Highlight colours
- private int mCheckedBlurColor;
- private int mCheckedOutlineColor;
-
-
- public PagedViewWidgetIcon(Context context) {
- this(context, null);
- }
-
- public PagedViewWidgetIcon(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public PagedViewWidgetIcon(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedViewWidgetIcon,
- defStyle, 0);
- mCheckedBlurColor = a.getColor(R.styleable.PagedViewWidgetIcon_checkedBlurColor, 0);
- mCheckedOutlineColor = a.getColor(R.styleable.PagedViewWidgetIcon_checkedOutlineColor, 0);
- mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
- mErasePaint.setFilterBitmap(true);
- a.recycle();
-
- if (sHolographicOutlineHelper == null) {
- sHolographicOutlineHelper = new HolographicOutlineHelper();
- }
-
- setWillNotDraw(false);
- }
-
- public void invalidateCheckedImage() {
- if (mCheckedOutline != null) {
- mCheckedOutline.recycle();
- mCheckedOutline = null;
- }
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- // Draw the view itself
- if (mIsHolographicUpdatePass) {
- canvas.save();
- final float alpha = getAlpha();
- super.setAlpha(1.0f);
- super.onDraw(canvas);
- super.setAlpha(alpha);
- canvas.restore();
- } else {
- if (mAlpha > 0) {
- super.onDraw(canvas);
- }
- }
-
- // Draw the holographic checked overlay if necessary
- if (!mIsHolographicUpdatePass) {
- if (mCheckedOutline != null) {
- mPaint.setAlpha(255);
- canvas.drawBitmap(mCheckedOutline, 0, 0, mPaint);
- }
- }
- }
-
- @Override
- public boolean isChecked() {
- return mIsChecked;
- }
-
- @Override
- public void setChecked(boolean checked) {
- if (mIsChecked != checked) {
- mIsChecked = checked;
-
- if (mIsChecked) {
- // set a flag to indicate that we are going to draw the view at full alpha
- mIsHolographicUpdatePass = true;
- final int width = getMeasuredWidth();
- final int height = getMeasuredHeight();
- mCheckedOutline = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
- mHolographicOutlineCanvas = new Canvas(mCheckedOutline);
- mHolographicOutlineCanvas.concat(getMatrix());
- draw(mHolographicOutlineCanvas);
- sHolographicOutlineHelper.applyExpensiveOutlineWithBlur(mCheckedOutline,
- mHolographicOutlineCanvas, mCheckedBlurColor, mCheckedOutlineColor);
-
- // Unlike PagedViewIcon, we can't seem to properly set the clip rect for all the
- // children to respect when drawing... so for now, we erase over those parts in the
- // checked highlight image
- mHolographicOutlineCanvas.drawRect(0, findViewById(R.id.divider).getTop(),
- width, height, mErasePaint);
-
- mIsHolographicUpdatePass = false;
- mHolographicOutlineCanvas = null;
- } else {
- invalidateCheckedImage();
- }
-
- invalidate();
- }
- }
-
- @Override
- public void toggle() {
- setChecked(!mIsChecked);
- }
-}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index df3d2de..eac9ebd 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -20,9 +20,9 @@
import java.util.HashSet;
import java.util.List;
+import android.R.integer;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
-import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
@@ -55,6 +55,8 @@
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
+import android.util.Pair;
+import android.view.Display;
import android.view.DragEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -426,6 +428,10 @@
return false;
}
+ protected void onWindowVisibilityChanged (int visibility) {
+ mLauncher.onWindowVisibilityChanged(visibility);
+ }
+
@Override
public boolean dispatchUnhandledMove(View focused, int direction) {
if (mIsSmall || mIsInUnshrinkAnimation) {
@@ -554,12 +560,11 @@
int delta = screenCenter - (getChildOffset(i) -
getRelativeChildOffset(i) + halfScreenSize);
- float scrollProgress = delta/(totalDistance*1.0f);
+ float scrollProgress = delta / (totalDistance * 1.0f);
scrollProgress = Math.min(scrollProgress, 1.0f);
scrollProgress = Math.max(scrollProgress, -1.0f);
- float mult = mInDragMode ? 1.0f : Math.abs(scrollProgress);
- cl.setBackgroundAlphaMultiplier(mult);
+ cl.setBackgroundAlphaMultiplier(Math.abs(scrollProgress));
float rotation = WORKSPACE_ROTATION * scrollProgress;
cl.setRotationY(rotation);
@@ -775,6 +780,9 @@
mActivePointerId = INVALID_POINTER;
CellLayout currentPage = (CellLayout) getChildAt(mCurrentPage);
+ if (currentPage.getBackgroundAlphaMultiplier() < 1.0f) {
+ currentPage.setBackgroundAlpha(0.0f);
+ }
currentPage.setBackgroundAlphaMultiplier(1.0f);
final Resources res = getResources();
@@ -1039,8 +1047,8 @@
// For a TextView, adjust the clip rect so that we don't include the text label
if (v instanceof TextView) {
- final int iconHeight = ((TextView)v).getCompoundPaddingTop() - v.getPaddingTop();
- clipRect.bottom = clipRect.top + iconHeight;
+ final TextView tv = (TextView) v;
+ clipRect.bottom = clipRect.top + tv.getCompoundPaddingTop() - 1;
}
// Draw the View into the bitmap.
@@ -1347,8 +1355,6 @@
mDragTargetLayout.onDragEnter();
showOutlines();
mInDragMode = true;
- CellLayout cl = (CellLayout) getChildAt(mCurrentPage);
- cl.setBackgroundAlphaMultiplier(1.0f);
}
}
@@ -1394,6 +1400,30 @@
}
/**
+ * Tests to see if the drop will be accepted by Launcher, and if so, includes additional data
+ * in the returned structure related to the widgets that match the drop (or a null list if it is
+ * a shortcut drop). If the drop is not accepted then a null structure is returned.
+ */
+ private Pair<Integer, List<WidgetMimeTypeHandlerData>> validateDrag(DragEvent event) {
+ final LauncherModel model = mLauncher.getModel();
+ final ClipDescription desc = event.getClipDescription();
+ final int mimeTypeCount = desc.getMimeTypeCount();
+ for (int i = 0; i < mimeTypeCount; ++i) {
+ final String mimeType = desc.getMimeType(i);
+ if (mimeType.equals(InstallShortcutReceiver.SHORTCUT_MIMETYPE)) {
+ return new Pair<Integer, List<WidgetMimeTypeHandlerData>>(i, null);
+ } else {
+ final List<WidgetMimeTypeHandlerData> widgets =
+ model.resolveWidgetsForMimeType(mContext, mimeType);
+ if (widgets.size() > 0) {
+ return new Pair<Integer, List<WidgetMimeTypeHandlerData>>(i, widgets);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
* Global drag and drop handler
*/
@Override
@@ -1407,10 +1437,22 @@
final int y = (int) event.getY() - pos[1];
switch (event.getAction()) {
- case DragEvent.ACTION_DRAG_STARTED:
- // Check if we have enough space on this screen to add a new shortcut
- if (!layout.findCellForSpan(pos, 1, 1)) {
- Toast.makeText(mContext, mContext.getString(R.string.out_of_space),
+ case DragEvent.ACTION_DRAG_STARTED: {
+ // Validate this drag
+ Pair<Integer, List<WidgetMimeTypeHandlerData>> test = validateDrag(event);
+ if (test != null) {
+ boolean isShortcut = (test.second == null);
+ if (isShortcut) {
+ // Check if we have enough space on this screen to add a new shortcut
+ if (!layout.findCellForSpan(pos, 1, 1)) {
+ Toast.makeText(mContext, mContext.getString(R.string.out_of_space),
+ Toast.LENGTH_SHORT).show();
+ return false;
+ }
+ }
+ } else {
+ // Show error message if we couldn't accept any of the items
+ Toast.makeText(mContext, mContext.getString(R.string.external_drop_widget_error),
Toast.LENGTH_SHORT).show();
return false;
}
@@ -1428,18 +1470,12 @@
layout.visualizeDropLocation(null, mDragOutline, x, y, 1, 1);
return true;
+ }
case DragEvent.ACTION_DRAG_LOCATION:
// Visualize the drop location
layout.visualizeDropLocation(null, mDragOutline, x, y, 1, 1);
return true;
- case DragEvent.ACTION_DROP:
- // Check if we have enough space on this screen to add a new shortcut
- if (!layout.findCellForSpan(pos, 1, 1)) {
- Toast.makeText(mContext, mContext.getString(R.string.out_of_space),
- Toast.LENGTH_SHORT).show();
- return false;
- }
-
+ case DragEvent.ACTION_DROP: {
// Try and add any shortcuts
int newDropCount = 0;
final LauncherModel model = mLauncher.getModel();
@@ -1451,29 +1487,25 @@
// representation will be handled.
pos[0] = x;
pos[1] = y;
- final int mimeTypeCount = desc.getMimeTypeCount();
- for (int j = 0; j < mimeTypeCount; ++j) {
- final String mimeType = desc.getMimeType(j);
-
- if (mimeType.equals(InstallShortcutReceiver.SHORTCUT_MIMETYPE)) {
- final Intent intent = data.getItem(j).getIntent();
+ Pair<Integer, List<WidgetMimeTypeHandlerData>> test = validateDrag(event);
+ if (test != null) {
+ final int index = test.first;
+ final List<WidgetMimeTypeHandlerData> widgets = test.second;
+ final boolean isShortcut = (widgets == null);
+ final String mimeType = desc.getMimeType(index);
+ if (isShortcut) {
+ final Intent intent = data.getItem(index).getIntent();
Object info = model.infoFromShortcutIntent(mContext, intent, data.getIcon());
onDropExternal(x, y, info, layout);
} else {
- final List<WidgetMimeTypeHandlerData> widgets =
- model.resolveWidgetsForMimeType(mContext, mimeType);
- final int numWidgets = widgets.size();
-
- if (numWidgets == 0) {
- continue;
- } else if (numWidgets == 1) {
+ if (widgets.size() == 1) {
// If there is only one item, then go ahead and add and configure
// that widget
final AppWidgetProviderInfo widgetInfo = widgets.get(0).widgetInfo;
final PendingAddWidgetInfo createInfo =
new PendingAddWidgetInfo(widgetInfo, mimeType, data);
mLauncher.addAppWidgetFromDrop(createInfo, mCurrentPage, pos);
- } else if (numWidgets > 1) {
+ } else {
// Show the widget picker dialog if there is more than one widget
// that can handle this data type
final InstallWidgetReceiver.WidgetListAdapter adapter =
@@ -1489,17 +1521,9 @@
builder.show();
}
}
- newDropCount++;
- break;
}
-
- // Show error message if we couldn't accept any of the items
- if (newDropCount <= 0) {
- Toast.makeText(mContext, mContext.getString(R.string.external_drop_widget_error),
- Toast.LENGTH_SHORT).show();
- }
-
return true;
+ }
case DragEvent.ACTION_DRAG_ENDED:
// Hide the page outlines after the drop
layout.setHover(false);
@@ -1745,6 +1769,14 @@
onDropExternal(x, y, dragInfo, cellLayout, false);
}
+ @Override
+ public void getHitRect(Rect outRect) {
+ // We want the workspace to have the whole area of the display (it will find the correct
+ // cell layout to drop to in the existing drag/drop logic.
+ final Display d = mLauncher.getWindowManager().getDefaultDisplay();
+ outRect.set(0, 0, d.getWidth(), d.getHeight());
+ }
+
/**
* Add the item specified by dragInfo to the given layout.
* This is basically the equivalent of onDropExternal, except it's not initiated
@@ -1821,7 +1853,8 @@
if (view == null) {
cellLayout.onDragExit();
} else {
- mTargetCell = findNearestVacantArea(x, y, 1, 1, null, cellLayout, mTargetCell);
+ mTargetCell = new int[]{x, y};
+ cellLayout.findCellForSpan(mTargetCell, 1, 1);
addInScreen(view, indexOfChild(cellLayout), mTargetCell[0],
mTargetCell[1], info.spanX, info.spanY, insertAtFirst);
cellLayout.onDropChild(view);