am f5e4dd01: (-s ours) Put the label into the same texture as the icon.
Merge commit 'f5e4dd01adcc086231ab1e847ec62547626a643e'
* commit 'f5e4dd01adcc086231ab1e847ec62547626a643e':
Put the label into the same texture as the icon.
diff --git a/Android.mk b/Android.mk
index a9fa30a..00a8977 100644
--- a/Android.mk
+++ b/Android.mk
@@ -17,7 +17,7 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-#LOCAL_MODULE_TAGS := user
+LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-subdir-java-files)
diff --git a/res/drawable-hdpi/ic_search_widget.png b/res/drawable-hdpi/ic_search_widget.png
deleted file mode 100644
index 06b9b25..0000000
--- a/res/drawable-hdpi/ic_search_widget.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/search_button_bg.9.png b/res/drawable-hdpi/search_button_bg.9.png
deleted file mode 100644
index 9fba3d1..0000000
--- a/res/drawable-hdpi/search_button_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/search_button_voice.png b/res/drawable-hdpi/search_button_voice.png
deleted file mode 100644
index a60f7d9..0000000
--- a/res/drawable-hdpi/search_button_voice.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/search_floater.9.png b/res/drawable-hdpi/search_floater.9.png
deleted file mode 100644
index 02441d0..0000000
--- a/res/drawable-hdpi/search_floater.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/textfield_searchwidget_default.9.png b/res/drawable-hdpi/textfield_searchwidget_default.9.png
deleted file mode 100644
index 2fe637d..0000000
--- a/res/drawable-hdpi/textfield_searchwidget_default.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/textfield_searchwidget_pressed.9.png b/res/drawable-hdpi/textfield_searchwidget_pressed.9.png
deleted file mode 100644
index 58af9ba..0000000
--- a/res/drawable-hdpi/textfield_searchwidget_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/textfield_searchwidget_selected.9.png b/res/drawable-hdpi/textfield_searchwidget_selected.9.png
deleted file mode 100644
index 8a84fdc..0000000
--- a/res/drawable-hdpi/textfield_searchwidget_selected.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/textfield_searchwidget.xml b/res/drawable/textfield_searchwidget.xml
deleted file mode 100644
index 80f3dca..0000000
--- a/res/drawable/textfield_searchwidget.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_window_focused="false" android:state_enabled="true"
- android:drawable="@drawable/textfield_searchwidget_default" />
-
- <item android:state_pressed="true"
- android:drawable="@drawable/textfield_searchwidget_pressed" />
-
- <item android:state_enabled="true" android:state_focused="true"
- android:drawable="@drawable/textfield_searchwidget_selected" />
-
- <item android:state_enabled="true"
- android:drawable="@drawable/textfield_searchwidget_default" />
-
-</selector>
diff --git a/res/layout-land/application_boxed.xml b/res/layout-land/application_boxed.xml
index 7656b58..dc62361 100644
--- a/res/layout-land/application_boxed.xml
+++ b/res/layout-land/application_boxed.xml
@@ -16,7 +16,7 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/name"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="88dip"
android:paddingLeft="2dip"
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index d2009b8..da944b7 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -19,13 +19,13 @@
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher2"
android:id="@+id/drag_layer"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
<com.android.launcher2.AllAppsView
android:id="@+id/all_apps_view"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:scrollbarStyle="outsideInset"
android:drawSelectorOnTop="false"
@@ -37,8 +37,8 @@
<!-- The workspace contains 3 screens of cells -->
<com.android.launcher2.Workspace
android:id="@+id/workspace"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:scrollbars="horizontal"
android:fadeScrollbars="true"
launcher:defaultScreen="2">
@@ -82,7 +82,7 @@
<com.android.launcher2.HandleView
android:id="@+id/all_apps_button"
android:layout_width="@dimen/button_bar_height"
- android:layout_height="fill_parent"
+ android:layout_height="match_parent"
android:layout_gravity="right|center_vertical"
android:focusable="true"
@@ -96,7 +96,7 @@
<com.android.launcher2.DeleteZone
android:id="@+id/delete_zone"
android:layout_width="49dip"
- android:layout_height="fill_parent"
+ android:layout_height="match_parent"
android:scaleType="center"
android:src="@drawable/delete_zone_selector"
diff --git a/res/layout-land/live_folder_grid.xml b/res/layout-land/live_folder_grid.xml
index 572c295..44519d4 100644
--- a/res/layout-land/live_folder_grid.xml
+++ b/res/layout-land/live_folder_grid.xml
@@ -27,12 +27,12 @@
android:textSize="14sp"
android:textColor="#404040"
android:textStyle="bold"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content" />
<GridView
android:id="@+id/folder_content"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
diff --git a/res/layout-land/user_folder.xml b/res/layout-land/user_folder.xml
index 645c02f..b05974a 100644
--- a/res/layout-land/user_folder.xml
+++ b/res/layout-land/user_folder.xml
@@ -24,12 +24,12 @@
android:textSize="14sp"
android:textColor="#404040"
android:textStyle="bold"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content" />
<GridView
android:id="@id/folder_content"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
diff --git a/res/layout-land/workspace_screen.xml b/res/layout-land/workspace_screen.xml
index 531bac2..299478e 100644
--- a/res/layout-land/workspace_screen.xml
+++ b/res/layout-land/workspace_screen.xml
@@ -18,8 +18,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher2"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
launcher:cellWidth="@dimen/workspace_cell_width"
launcher:cellHeight="@dimen/workspace_cell_height"
diff --git a/res/layout-port/application_boxed.xml b/res/layout-port/application_boxed.xml
index a6991d5..5e64cee 100644
--- a/res/layout-port/application_boxed.xml
+++ b/res/layout-port/application_boxed.xml
@@ -16,7 +16,7 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/name"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="88dip"
android:paddingLeft="2dip"
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index 001f3e3..f73e91c 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -19,13 +19,13 @@
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher2"
android:id="@+id/drag_layer"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
<com.android.launcher2.AllAppsView
android:id="@+id/all_apps_view"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:scrollbarStyle="outsideInset"
android:drawSelectorOnTop="false"
@@ -38,8 +38,8 @@
<!-- The workspace contains 3 screens of cells -->
<com.android.launcher2.Workspace
android:id="@+id/workspace"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
launcher:defaultScreen="2">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
diff --git a/res/layout-port/live_folder_grid.xml b/res/layout-port/live_folder_grid.xml
index 51e5e47..745307f 100644
--- a/res/layout-port/live_folder_grid.xml
+++ b/res/layout-port/live_folder_grid.xml
@@ -27,12 +27,12 @@
android:textSize="14sp"
android:textColor="#404040"
android:textStyle="bold"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content" />
<GridView
android:id="@id/folder_content"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
diff --git a/res/layout-port/user_folder.xml b/res/layout-port/user_folder.xml
index 6a189dc..7377cde 100644
--- a/res/layout-port/user_folder.xml
+++ b/res/layout-port/user_folder.xml
@@ -24,12 +24,12 @@
android:textSize="14sp"
android:textColor="#404040"
android:textStyle="bold"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content" />
<GridView
android:id="@id/folder_content"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
diff --git a/res/layout-port/workspace_screen.xml b/res/layout-port/workspace_screen.xml
index 531bac2..299478e 100644
--- a/res/layout-port/workspace_screen.xml
+++ b/res/layout-port/workspace_screen.xml
@@ -18,8 +18,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher2"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
launcher:cellWidth="@dimen/workspace_cell_width"
launcher:cellHeight="@dimen/workspace_cell_height"
diff --git a/res/layout/add_list_item.xml b/res/layout/add_list_item.xml
index f276511..62fc4f4 100644
--- a/res/layout/add_list_item.xml
+++ b/res/layout/add_list_item.xml
@@ -15,7 +15,7 @@
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLargeInverse"
diff --git a/res/layout/application_list.xml b/res/layout/application_list.xml
index 29f7400..b515c9e 100644
--- a/res/layout/application_list.xml
+++ b/res/layout/application_list.xml
@@ -18,7 +18,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingLeft="10dip"
@@ -34,7 +34,7 @@
<LinearLayout
android:layout_width="0dip"
android:layout_weight="1.0"
- android:layout_height="fill_parent"
+ android:layout_height="match_parent"
android:paddingLeft="8dip"
android:paddingRight="8dip"
diff --git a/res/layout/list_checkbox_2lines.xml b/res/layout/list_checkbox_2lines.xml
index ed80c5f..1debcd6 100644
--- a/res/layout/list_checkbox_2lines.xml
+++ b/res/layout/list_checkbox_2lines.xml
@@ -15,7 +15,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
diff --git a/res/layout/live_folder_list.xml b/res/layout/live_folder_list.xml
index cf3d2f1..e5a305f 100644
--- a/res/layout/live_folder_list.xml
+++ b/res/layout/live_folder_list.xml
@@ -27,12 +27,12 @@
android:textSize="14sp"
android:textColor="#404040"
android:textStyle="bold"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ListView
android:id="@id/folder_content"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
diff --git a/res/layout/pick_item.xml b/res/layout/pick_item.xml
index f276511..62fc4f4 100644
--- a/res/layout/pick_item.xml
+++ b/res/layout/pick_item.xml
@@ -15,7 +15,7 @@
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLargeInverse"
diff --git a/res/layout/rename_folder.xml b/res/layout/rename_folder.xml
index cbb42b4..75eb504 100644
--- a/res/layout/rename_folder.xml
+++ b/res/layout/rename_folder.xml
@@ -15,7 +15,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dip"
android:orientation="vertical">
@@ -31,7 +31,7 @@
<EditText
android:id="@+id/folder_name"
android:layout_height="wrap_content"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:scrollHorizontally="true"
android:autoText="false"
android:capitalize="none"
diff --git a/res/layout/wallpaper_chooser.xml b/res/layout/wallpaper_chooser.xml
index 7267246..92a6596 100644
--- a/res/layout/wallpaper_chooser.xml
+++ b/res/layout/wallpaper_chooser.xml
@@ -20,17 +20,17 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
<ImageView android:id="@+id/wallpaper"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1.0"
android:scaleType="fitCenter" />
<Gallery android:id="@+id/gallery"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button android:id="@+id/set"
diff --git a/res/layout/widget_search.xml b/res/layout/widget_search.xml
deleted file mode 100644
index a346723..0000000
--- a/res/layout/widget_search.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<com.android.launcher2.Search
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher2"
- android:id="@+id/widget_search"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical"
- android:gravity="center">
-
- <LinearLayout
- android:id="@+id/search_plate"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingLeft="14dip"
- android:paddingRight="14dip"
- android:paddingTop="13dip"
- android:paddingBottom="12dip"
- android:background="@drawable/search_floater" >
-
- <TextView
- android:id="@+id/search_src_text"
- android:layout_width="0dip"
- android:layout_height="42dip"
- android:layout_weight="1.0"
- android:editable="false"
- android:focusable="true"
- android:inputType="none"
- android:background="@drawable/textfield_searchwidget"
- android:textAppearance="?android:attr/textAppearanceMediumInverse"
- android:textColor="@android:color/primary_text_light"
- />
-
- <ImageButton
- android:id="@+id/search_voice_btn"
- android:layout_width="wrap_content"
- android:layout_height="42dip"
- android:layout_marginLeft="4dip"
- android:background="@*android:drawable/btn_search_dialog_voice"
- android:src="@*android:drawable/ic_btn_speak_now"
- />
-
- </LinearLayout>
-
-</com.android.launcher2.Search>
diff --git a/res/raw/rollo3.c b/res/raw/allapps.rs
similarity index 67%
rename from res/raw/rollo3.c
rename to res/raw/allapps.rs
index aa7e075..abcf0dc 100644
--- a/res/raw/rollo3.c
+++ b/res/raw/allapps.rs
@@ -106,7 +106,7 @@
if (g_LastTouchDown) {
float dx = -(state->newPositionX - g_LastPositionX);
g_PosVelocity = 0;
- g_PosPage += dx * 4;
+ g_PosPage += dx * 5.2f;
float pmin = -0.49f;
float pmax = g_PosMax + 0.49f;
@@ -250,40 +250,6 @@
g_PosPage = clampf(g_PosPage, -0.49, g_PosMax + 0.49);
}
-int positionStrip(float row, float column, int isTop, float p, int isText)
-{
- float mat1[16];
- float x = 0.5f * (column - 1.5f);
- float scale = 72.f * 3 / getWidth();
-
- if (isTop) {
- matrixLoadTranslate(mat1, x, 0.8f, 0.f);
- matrixScale(mat1, scale, scale, 1.f);
- } else {
- matrixLoadTranslate(mat1, x, -0.9f, 0.f);
- matrixScale(mat1, scale, -scale, 1.f);
- }
- matrixTranslate(mat1, 0, p * 2, 0.f);
- matrixRotate(mat1, -p * 50, 1, 0, 0);
- vpLoadModelMatrix(mat1);
-
- float soff = -(row * 1.4);
- if (isTop) {
- matrixLoadScale(mat1, 1.f, -0.85f, 1.f);
- if (isText) {
- matrixScale(mat1, 1.f, 2.f, 1.f);
- }
- matrixTranslate(mat1, 0, soff - 0.95f + 0.18f, 0);
- } else {
- matrixLoadScale(mat1, 1.f, 0.85f, 1.f);
- if (isText) {
- matrixScale(mat1, 1.f, 2.f, 1.f);
- }
- matrixTranslate(mat1, 0, soff - 0.65f, 0);
- }
- vpLoadTextureMatrix(mat1);
- return -(soff + 0.3f) * 10.f;
-}
void
draw_home_button()
@@ -306,20 +272,16 @@
float rowFrac = rowOffset - intRowOffset;
float colWidth = getWidth() / 4;
float rowHeight = colWidth + 25.f;
- float yoff = h - ((h - (rowHeight * 4.f)) / 2);
-
- yoff -= 110;
+ float yoff = 0.5f * h + 1.5f * rowHeight;
int row, col;
- int iconNum = intRowOffset * 4;
- float ymax = yoff + rowHeight;
- float ymin = yoff - (3 * rowHeight) - 70;
- float gridTop = yoff -3;
- float gridBottom = ymin;
+ int iconNum = (intRowOffset - 5) * 4;
- gridBottom += 50;
+ bindProgramVertex(NAMED_PVCurve);
- for (row = 0; row < 5; row++) {
+ storeF(ALLOC_VP_CONSTANTS, 4, p);
+
+ for (row = -5; row < 15; row++) {
float y = yoff - ((-rowFrac + row) * rowHeight);
for (col=0; col < 4; col++) {
@@ -328,100 +290,37 @@
}
if (iconNum >= 0) {
- float x = colWidth * col - ((128 - colWidth) / 2);
+ float x = colWidth * col + (colWidth / 2);
+ storeF(ALLOC_VP_CONSTANTS, 2, x);
- if ((y >= ymin) && (y <= ymax)) {
- float iconY = y - 20;
- setColor(1.f, 1.f, 1.f, 1.f);
- if (state->selectedIconIndex == iconNum && !p) {
- bindTexture(NAMED_PFTexNearest, 0, state->selectedIconTexture);
- drawSpriteScreenspace(x, iconY, 0, 128, 128);
- }
-
- bindTexture(NAMED_PFTexNearest, 0, loadI32(ALLOC_ICON_IDS, iconNum));
- if (!p) {
- int cropT = 0;
- if (y > gridTop) {
- cropT = y - gridTop;
- }
- int cropB = 0;
- if (y < gridBottom) {
- cropB = gridBottom - y;
- }
- drawSpriteScreenspaceCropped(x, iconY+cropB, 0, 128, 128-cropT-cropB,
- 0, 128-cropB, 128, -128+cropT+cropB);
- } else {
- float px = ((x + 64) - (getWidth() / 2)) / (getWidth() / 2);
- float py = ((iconY + 64) - (getHeight() / 2)) / (getWidth() / 2);
- float d = 64.f / (getWidth() / 2);
- px *= p + 1;
- py *= p + 1;
- drawQuadTexCoords(px - d, py - d, -p, 0, 1,
- px - d, py + d, -p, 0, 0,
- px + d, py + d, -p, 1, 0,
- px + d, py - d, -p, 1, 1);
- }
+ if (state->selectedIconIndex == iconNum && !p) {
+ bindProgramFragment(NAMED_PFTexNearest);
+ bindTexture(NAMED_PFTexNearest, 0, state->selectedIconTexture);
+ storeF(ALLOC_VP_CONSTANTS, 0, SELECTION_TEXTURE_WIDTH_PX);
+ storeF(ALLOC_VP_CONSTANTS, 1, SELECTION_TEXTURE_HEIGHT_PX);
+ storeF(ALLOC_VP_CONSTANTS, 3, y - (SELECTION_TEXTURE_HEIGHT_PX - ICON_TEXTURE_HEIGHT_PX) * 0.5f);
+ drawSimpleMesh(NAMED_SMCell);
}
+
+ bindProgramFragment(NAMED_PFTexMip);
+ storeF(ALLOC_VP_CONSTANTS, 0, ICON_TEXTURE_WIDTH_PX);
+ storeF(ALLOC_VP_CONSTANTS, 1, ICON_TEXTURE_HEIGHT_PX);
+ storeF(ALLOC_VP_CONSTANTS, 3, y);
+ bindTexture(NAMED_PFTexMip, 0, loadI32(ALLOC_ICON_IDS, iconNum));
+ drawSimpleMesh(NAMED_SMCell);
+
+ bindProgramFragment(NAMED_PFTexMipAlpha);
+ storeF(ALLOC_VP_CONSTANTS, 0, 128.f);
+ storeF(ALLOC_VP_CONSTANTS, 1, 64.f);
+ storeF(ALLOC_VP_CONSTANTS, 3, y - 64.f);
+ bindTexture(NAMED_PFTexMipAlpha, 0, loadI32(ALLOC_LABEL_IDS, iconNum));
+ drawSimpleMesh(NAMED_SMCell);
}
iconNum++;
}
}
}
-void drawStrip(float row, float column, int isTop, int iconNum, float p)
-{
- if (iconNum < 0) return;
- int offset = positionStrip(row, column, isTop, p, 0);
- bindTexture(NAMED_PFTexMip, 0, loadI32(ALLOC_ICON_IDS, iconNum));
- if (offset < -20) return;
- offset = clamp(offset, 0, 199 - 20);
-
- int len = 20;
- if (isTop && (offset < 7)) {
- len -= 7 - offset;
- offset = 7;
- }
-
- drawSimpleMeshRange(NAMED_SMMesh, offset * 6, len * 6);
- //drawSimpleMesh(NAMED_SMMesh);
-}
-
-void drawTop(float rowOffset, float p)
-{
- int row, col;
- int iconNum = 0;
- for (row = 0; row <= (int)(rowOffset+1); row++) {
- for (col=0; col < 4; col++) {
- if (iconNum >= state->iconCount) {
- return;
- }
- drawStrip(rowOffset - row, col, 1, iconNum, p);
- iconNum++;
- }
- }
-}
-
-void drawBottom(float rowOffset, float p)
-{
- float pos = -1.f;
- int intRowOffset = rowOffset;
- pos -= rowOffset - intRowOffset;
-
- int row, col;
- int iconNum = (intRowOffset + 3) * 4;
- while (1) {
- for (col=0; col < 4; col++) {
- if (iconNum >= state->iconCount) {
- return;
- }
- if (pos > -1) {
- drawStrip(pos, col, 0, iconNum, p);
- }
- iconNum++;
- }
- pos += 1.f;
- }
-}
int
main(int launchID)
@@ -484,31 +383,11 @@
//debugF(" draw g_PosPage", g_PosPage);
// Draw the icons ========================================
-
- /*
- bindProgramFragment(NAMED_PFColor);
- positionStrip(1, 0, 1, 0, 0);
- drawSimpleMesh(NAMED_SMMesh);
- */
-
- bindProgramFragment(NAMED_PFTexMip);
-
- drawTop(g_PosPage, 1-g_Zoom);
- drawBottom(g_PosPage, 1-g_Zoom);
-
- bindProgramFragment(NAMED_PFTexMip);
- {
- float mat1[16];
- matrixLoadIdentity(mat1);
- vpLoadModelMatrix(mat1);
- vpLoadTextureMatrix(mat1);
- }
+ drawFrontGrid(g_PosPage, 1-g_Zoom);
bindProgramFragment(NAMED_PFTexNearest);
- drawFrontGrid(g_PosPage, 1-g_Zoom);
draw_home_button();
-
// This is a WAR to do a rendering pass without drawing during init to
// force the driver to preload and compile its shaders.
// Without this the first animation does not appear due to the time it
diff --git a/res/raw/rollo.c b/res/raw/rollo.c
deleted file mode 100644
index 6a41727..0000000
--- a/res/raw/rollo.c
+++ /dev/null
@@ -1,432 +0,0 @@
-#pragma version(1)
-#pragma stateVertex(PV)
-#pragma stateFragment(PFTexLinear)
-#pragma stateStore(PSIcons)
-
-#define PI 3.14159f
-
-
-// Attraction to center values from page edge to page center.
-float g_AttractionTable[9];
-float g_FrictionTable[9];
-float g_PhysicsTableSize;
-
-float g_PosPage;
-float g_PosVelocity;
-float g_LastPositionX;
-int g_LastTouchDown;
-float g_DT;
-int g_LastTime;
-int g_PageCount;
-float g_Zoom;
-
-// Drawing constants, should be parameters ======
-#define VIEW_ANGLE 1.28700222f
-
-float g_OldPosPage;
-float g_OldPosVelocity;
-float g_OldZoom;
-
-int g_DrawLastFrame;
-int lastFrame(int draw) {
- // We draw one extra frame to work around the last frame post bug.
- // We also need to track if we drew the last frame to deal with large DT
- // in the physics.
- int ret = g_DrawLastFrame | draw;
- g_DrawLastFrame = draw;
- return ret; // should return draw instead.
-}
-
-void updateReadback() {
- if ((g_OldPosPage != g_PosPage) ||
- (g_OldPosVelocity != g_PosVelocity) ||
- (g_OldZoom != g_Zoom)) {
-
- g_OldPosPage = g_PosPage;
- g_OldPosVelocity = g_PosVelocity;
- g_OldZoom = g_Zoom;
-
- int i[3];
- i[0] = g_PosPage * (1 << 16);
- i[1] = g_PosVelocity * (1 << 16);
- i[2] = g_OldZoom * (1 << 16);
- sendToClient(&i[0], 1, 12, 1);
- }
-}
-
-void init() {
- g_AttractionTable[0] = 6.5f;
- g_AttractionTable[1] = 6.5f;
- g_AttractionTable[2] = 7.0f;
- g_AttractionTable[3] = 6.0f;
- g_AttractionTable[4] = -6.0f;
- g_AttractionTable[5] = -7.0f;
- g_AttractionTable[6] = -6.5f;
- g_AttractionTable[7] = -6.5f;
- g_AttractionTable[8] = -6.5f; // dup 7 to avoid a clamp later
- g_FrictionTable[0] = 3.5f;
- g_FrictionTable[1] = 3.6f;
- g_FrictionTable[2] = 4.0f;
- g_FrictionTable[3] = 5.0f;
- g_FrictionTable[4] = 5.0f;
- g_FrictionTable[5] = 4.0f;
- g_FrictionTable[6] = 3.6f;
- g_FrictionTable[7] = 3.5f;
- g_FrictionTable[8] = 3.5f; // dup 7 to avoid a clamp later
- g_PhysicsTableSize = 7;
-
- g_PosVelocity = 0;
- g_PosPage = 0;
- g_LastTouchDown = 0;
- g_LastPositionX = 0;
- g_Zoom = 0;
-}
-
-void resetHWWar() {
-}
-
-void move() {
- if (g_LastTouchDown) {
- float dx = -(state->newPositionX - g_LastPositionX);
- g_PosVelocity = 0;
- g_PosPage += dx;
-
- float pmin = -0.25f;
- float pmax = (g_PageCount - 1) + 0.25f;
- g_PosPage = clampf(g_PosPage, pmin, pmax);
- }
- g_LastTouchDown = state->newTouchDown;
- g_LastPositionX = state->newPositionX;
- //debugF("Move P", g_PosPage);
-}
-
-void fling() {
- g_LastTouchDown = 0;
- g_PosVelocity = -state->flingVelocityX;
- float av = fabsf(g_PosVelocity);
- float minVel = 3.5f;
-
- minVel *= 1.f - (fabsf(fracf(g_PosPage + 0.5f) - 0.5f) * 0.45f);
-
- if (av < minVel && av > 0.2f) {
- if (g_PosVelocity > 0) {
- g_PosVelocity = minVel;
- } else {
- g_PosVelocity = -minVel;
- }
- }
-
- if (g_PosPage <= 0) {
- g_PosVelocity = maxf(0, g_PosVelocity);
- }
- if (g_PosPage > (g_PageCount - 1)) {
- g_PosVelocity = minf(0, g_PosVelocity);
- }
- //debugF("fling v", g_PosVelocity);
-}
-
-void touchUp() {
- g_LastTouchDown = 0;
-}
-
-int
-count_pages(int iconCount)
-{
- int iconsPerPage = COLUMNS_PER_PAGE * ROWS_PER_PAGE;
- int pages = iconCount / iconsPerPage;
- if (pages*iconsPerPage != iconCount) {
- pages++;
- }
- return pages;
-}
-
-float
-modf(float x, float y)
-{
- return x-(y*floorf(x/y));
-}
-
-void updatePos() {
- if (g_LastTouchDown) {
- return;
- }
-
- float tablePosNorm = fracf(g_PosPage + 0.5f);
- float tablePosF = tablePosNorm * g_PhysicsTableSize;
- int tablePosI = tablePosF;
- float tablePosFrac = tablePosF - tablePosI;
- float accel = lerpf(g_AttractionTable[tablePosI],
- g_AttractionTable[tablePosI + 1],
- tablePosFrac) * g_DT;
- float friction = lerpf(g_FrictionTable[tablePosI],
- g_FrictionTable[tablePosI + 1],
- tablePosFrac) * g_DT;
- //debugF(" accel", accel);
- //debugF(" friction", friction);
-
- // If our velocity is low OR acceleration is opposing it, apply it.
- if (fabsf(g_PosVelocity) < 1.0f || (g_PosVelocity * accel) < 0) {
- g_PosVelocity += accel;
- }
-
- if ((friction > fabsf(g_PosVelocity)) && (friction > fabsf(accel))) {
- // Special get back to center and overcome friction physics.
- float t = tablePosNorm - 0.5f;
- if (fabsf(t) < (friction * g_DT)) {
- // really close, just snap
- g_PosPage = roundf(g_PosPage);
- g_PosVelocity = 0;
- } else {
- if (t > 0) {
- g_PosVelocity = -friction;
- } else {
- g_PosVelocity = friction;
- }
- }
- } else {
- // Normal physics
- if (g_PosVelocity > 0) {
- g_PosVelocity -= friction;
- g_PosVelocity = maxf(g_PosVelocity, 0);
- } else {
- g_PosVelocity += friction;
- g_PosVelocity = minf(g_PosVelocity, 0);
- }
- }
- g_PosPage += g_PosVelocity * g_DT;
-
- // Check for out of boundry conditions.
- if (g_PosPage < 0 && g_PosVelocity < 0) {
- float damp = 1.0 + (g_PosPage * 4);
- damp = clampf(damp, 0.f, 0.9f);
- g_PosVelocity *= damp;
- }
- if (g_PosPage > (g_PageCount-1) && g_PosVelocity > 0) {
- float damp = 1.0 - ((g_PosPage - g_PageCount + 1) * 4);
- damp = clampf(damp, 0.f, 0.9f);
- g_PosVelocity *= damp;
- }
-}
-
-float
-far_size(float sizeAt0)
-{
- return sizeAt0 * (RADIUS+2) / 2; // -2 is the camera z=(z-camZ)/z
-}
-
-void
-draw_page(int icon, int lastIcon, float centerAngle, float scale)
-{
- int row;
- int col;
-
- //debugF("center angle", centerAngle);
-
- float iconTextureWidth = ICON_WIDTH_PX / (float)ICON_TEXTURE_WIDTH_PX;
- float iconTextureHeight = ICON_HEIGHT_PX / (float)ICON_TEXTURE_HEIGHT_PX;
-
- float iconWidthAngle = VIEW_ANGLE * ICON_WIDTH_PX / SCREEN_WIDTH_PX;
- float columnGutterAngle = iconWidthAngle * 0.9f;
-
- float farIconSize = FAR_ICON_SIZE;
- float iconGutterHeight = farIconSize * 1.3f;
-
- float farIconTextureSize = far_size(2 * ICON_TEXTURE_WIDTH_PX / (float)SCREEN_WIDTH_PX);
-
- float normalizedLabelWidth = 2 * params->bubbleWidth / (float)SCREEN_WIDTH_PX;
- float farLabelHeight = far_size(params->bubbleHeight * (normalizedLabelWidth / params->bubbleWidth));
-
- for (row=0; row<ROWS_PER_PAGE && icon<=lastIcon; row++) {
- float angle = centerAngle;
- angle -= (columnGutterAngle + iconWidthAngle) * 1.5f;
-
- float iconTop = (farIconSize + iconGutterHeight) * (1.85f + ICON_TOP_OFFSET)
- - row * (farIconSize + iconGutterHeight);
- float iconBottom = iconTop - farIconSize;
-
- float labelY = iconBottom - farLabelHeight;
- float iconTextureTop = iconTop + (0.5f * (farIconTextureSize - farIconSize));
- float iconTextureBottom = iconTextureTop - farIconTextureSize;
-
- for (col=0; col<COLUMNS_PER_PAGE && icon<=lastIcon; col++) {
- // icon
- float sine = sinf(angle);
- float cosine = cosf(angle);
-
- float centerX = sine * RADIUS;
- float centerZ = cosine * RADIUS / scale;
-
- if (scale > 1.f) {
- centerX *= scale;
- }
-
- float iconLeftX = centerX - (/*cosine * */ farIconTextureSize * .5);
- float iconRightX = centerX + (/*cosine * */ farIconTextureSize * .5);
- float iconLeftZ = centerZ;// + (sine * farIconTextureSize * .5);
- float iconRightZ = centerZ;// - (sine * farIconTextureSize * .5);
-
- color(1.0f, 1.0f, 1.0f, 0.99f);
- if (state->selectedIconIndex == icon) {
- bindTexture(NAMED_PFTexLinear, 0, state->selectedIconTexture);
- drawQuadTexCoords(
- iconLeftX, iconTextureTop, iconLeftZ, 0.0f, 0.0f,
- iconRightX, iconTextureTop, iconRightZ, 1.0f, 0.0f,
- iconRightX, iconTextureBottom, iconRightZ, 1.0f, 1.0f,
- iconLeftX, iconTextureBottom, iconLeftZ, 0.0f, 1.0f);
- } else {
- bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_ICON_IDS, icon));
- drawQuadTexCoords(
- iconLeftX, iconTextureTop, iconLeftZ, 0.0f, 0.0f,
- iconRightX, iconTextureTop, iconRightZ, 1.0f, 0.0f,
- iconRightX, iconTextureBottom, iconRightZ, 1.0f, 1.0f,
- iconLeftX, iconTextureBottom, iconLeftZ, 0.0f, 1.0f);
- }
-
- // label
- if (scale < 1.2f) {
- float a = (1.2f - maxf(scale, 1.0f)) * 5;
- color(1.0f, 1.0f, 1.0f, a);
- bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_LABEL_IDS, icon));
- drawSprite(centerX, labelY, centerZ,
- params->bubbleBitmapWidth, params->bubbleBitmapHeight);
- }
-
- angle += columnGutterAngle + iconWidthAngle;
- icon++;
- }
- }
-}
-
-void
-draw_home_button()
-{
- color(1.0f, 1.0f, 1.0f, 1.0f);
- bindTexture(NAMED_PFTexLinear, 0, state->homeButtonId);
-
- float scale = 2.0f / SCREEN_WIDTH_PX;
-
- float x = 0.0f;
-
- float y = -(SCREEN_HEIGHT_PX / (float)SCREEN_WIDTH_PX);
- y += g_Zoom * (scale * params->homeButtonTextureHeight / 2);
-
- float z = 0.0f;
- drawSprite(x, y, z, params->homeButtonTextureWidth, params->homeButtonTextureHeight);
-}
-
-int
-main(int launchID)
-{
- // Compute dt in seconds.
- int newTime = uptimeMillis();
- g_DT = (newTime - g_LastTime) / 1000.f;
- g_LastTime = newTime;
-
- if (!g_DrawLastFrame) {
- // If we stopped rendering we cannot use DT.
- // assume 30fps in this case.
- g_DT = 0.033f;
- }
- if (g_DT > 0.2f) {
- // physics may break if DT is large.
- g_DT = 0.2f;
- }
-
- //debugF("zoom", g_Zoom);
- if (g_Zoom != state->zoomTarget) {
- float dz = (state->zoomTarget - g_Zoom) * g_DT * 5;
- if (dz && (fabsf(dz) < 0.03f)) {
- if (dz > 0) {
- dz = 0.03f;
- } else {
- dz = -0.03f;
- }
- }
- if (fabsf(g_Zoom - state->zoomTarget) < fabsf(dz)) {
- g_Zoom = state->zoomTarget;
- } else {
- g_Zoom += dz;
- }
- updateReadback();
- }
-
- // Set clear value to dim the background based on the zoom position.
- if ((g_Zoom < 0.001f) && (state->zoomTarget < 0.001f)) {
- pfClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- // When we're zoomed out and not tracking motion events, reset the pos to 0.
- if (!g_LastTouchDown) {
- g_PosPage = 0;
- }
- return lastFrame(0);
- } else if (g_Zoom < 0.85f) {
- pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
- } else {
- pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
- }
-
- // icons & labels
- int iconCount = state->iconCount;
- g_PageCount = count_pages(iconCount);
-
- updatePos(0.1f);
- updateReadback();
-
- //debugF(" draw g_PosPage", g_PosPage);
-
- // Draw the icons ========================================
-
- // Bug makes 1.0f alpha fail.
- color(1.0f, 1.0f, 1.0f, 0.99f);
-
- if (iconCount <= 0) {
- return lastFrame(0);
- }
- int lastIcon = iconCount-1;
-
- int page = g_PosPage;
- float currentPagePosition = g_PosPage - page;
-
- int iconsPerPage = COLUMNS_PER_PAGE * ROWS_PER_PAGE;
- int icon = clamp(iconsPerPage * page, 0, lastIcon);
-
- float scale = (1 / g_Zoom);
-
- float pageAngle = VIEW_ANGLE * 1.2f;
- draw_page(icon, lastIcon, -pageAngle*currentPagePosition, scale);
- draw_page(icon+iconsPerPage, lastIcon, (-pageAngle*currentPagePosition)+pageAngle, scale);
-
- // Draw the border lines for debugging ========================================
- /*
- bindProgramVertex(NAMED_PVOrtho);
- bindProgramFragment(NAMED_PFOrtho);
- bindProgramFragmentStore(NAMED_PFSText);
-
- color(1.0f, 1.0f, 0.0f, 0.99f);
- int i;
- for (i=0; i<ROWS_PER_PAGE+1; i++) {
- int y = loadI32(ALLOC_Y_BORDERS, i);
- drawRect(0, y, SCREEN_WIDTH_PX, y+1, 0.0f);
- }
- for (i=0; i<COLUMNS_PER_PAGE+1; i++) {
- int x = loadI32(ALLOC_X_BORDERS, i);
- drawRect(x, 0, x+1, SCREEN_HEIGHT_PX, 0.0f);
- }
- */
-
- // Draw the home button ========================================
- draw_home_button();
-
- /*
- bindTexture(NAMED_PFOrtho, 0, loadI32(ALLOC_PARAMS, PARAM_SCROLL_HANDLE_ID));
- float handleLeft = 40 + (320 * (scrollXPx/(float)(maxScrollXPx)));
- float handleTop = 680;
- float handleWidth = loadI32(ALLOC_PARAMS, PARAM_SCROLL_HANDLE_TEX_WIDTH);
- float handleHeight = loadI32(ALLOC_PARAMS, PARAM_SCROLL_HANDLE_TEX_HEIGHT);
- drawRect(handleLeft, handleTop, handleLeft+handleWidth, handleTop+handleHeight, 0.0f);
- */
-
- // Bug workaround where the last frame is not always displayed
- // So we keep rendering until the bug is fixed.
- return lastFrame((g_PosVelocity != 0) || fracf(g_PosPage) || (g_Zoom != state->zoomTarget));
-}
-
diff --git a/res/raw/rollo2.c b/res/raw/rollo2.c
deleted file mode 100644
index eb87063..0000000
--- a/res/raw/rollo2.c
+++ /dev/null
@@ -1,404 +0,0 @@
-#pragma version(1)
-#pragma stateVertex(PV)
-#pragma stateFragment(PFTexLinear)
-#pragma stateStore(PSIcons)
-
-#define PI 3.14159f
-
-
-// Attraction to center values from page edge to page center.
-float g_AttractionTable[9];
-float g_FrictionTable[9];
-float g_PhysicsTableSize;
-
-float g_PosPage;
-float g_PosVelocity;
-float g_LastPositionX;
-int g_LastTouchDown;
-float g_DT;
-int g_LastTime;
-int g_PageCount;
-float g_Zoom;
-float g_OldPosPage;
-float g_OldPosVelocity;
-float g_OldZoom;
-
-// Drawing constants, should be parameters ======
-#define VIEW_ANGLE 1.28700222f
-
-int g_DrawLastFrame;
-int lastFrame(int draw) {
- // We draw one extra frame to work around the last frame post bug.
- // We also need to track if we drew the last frame to deal with large DT
- // in the physics.
- int ret = g_DrawLastFrame | draw;
- g_DrawLastFrame = draw;
- return ret; // should return draw instead.
-}
-
-void updateReadback() {
- if ((g_OldPosPage != g_PosPage) ||
- (g_OldPosVelocity != g_PosVelocity) ||
- (g_OldZoom != g_Zoom)) {
-
- g_OldPosPage = g_PosPage;
- g_OldPosVelocity = g_PosVelocity;
- g_OldZoom = g_Zoom;
-
- int i[3];
- i[0] = g_PosPage * (1 << 16);
- i[1] = g_PosVelocity * (1 << 16);
- i[2] = g_OldZoom * (1 << 16);
- sendToClient(&i[0], 1, 12, 1);
- }
-}
-
-void init() {
- g_AttractionTable[0] = 6.5f;
- g_AttractionTable[1] = 6.5f;
- g_AttractionTable[2] = 7.0f;
- g_AttractionTable[3] = 6.0f;
- g_AttractionTable[4] = -6.0f;
- g_AttractionTable[5] = -7.0f;
- g_AttractionTable[6] = -6.5f;
- g_AttractionTable[7] = -6.5f;
- g_AttractionTable[8] = -6.5f; // dup 7 to avoid a clamp later
- g_FrictionTable[0] = 3.5f;
- g_FrictionTable[1] = 3.6f;
- g_FrictionTable[2] = 4.0f;
- g_FrictionTable[3] = 5.0f;
- g_FrictionTable[4] = 5.0f;
- g_FrictionTable[5] = 4.0f;
- g_FrictionTable[6] = 3.6f;
- g_FrictionTable[7] = 3.5f;
- g_FrictionTable[8] = 3.5f; // dup 7 to avoid a clamp later
- g_PhysicsTableSize = 7;
-
- g_PosVelocity = 0;
- g_PosPage = 0;
- g_LastTouchDown = 0;
- g_LastPositionX = 0;
- g_Zoom = 0;
-}
-
-void resetHWWar() {
-}
-
-void move() {
- if (g_LastTouchDown) {
- float dx = -(state->newPositionX - g_LastPositionX);
- g_PosVelocity = 0;
- g_PosPage += dx;
-
- float pmin = -0.25f;
- float pmax = (g_PageCount - 1) + 0.25f;
- g_PosPage = clampf(g_PosPage, pmin, pmax);
- }
- g_LastTouchDown = state->newTouchDown;
- g_LastPositionX = state->newPositionX;
- //debugF("Move P", g_PosPage);
-}
-
-void fling() {
- g_LastTouchDown = 0;
- g_PosVelocity = -state->flingVelocityX;
- float av = fabsf(g_PosVelocity);
- float minVel = 3.5f;
-
- minVel *= 1.f - (fabsf(fracf(g_PosPage + 0.5f) - 0.5f) * 0.45f);
-
- if (av < minVel && av > 0.2f) {
- if (g_PosVelocity > 0) {
- g_PosVelocity = minVel;
- } else {
- g_PosVelocity = -minVel;
- }
- }
-
- if (g_PosPage <= 0) {
- g_PosVelocity = maxf(0, g_PosVelocity);
- }
- if (g_PosPage > (g_PageCount - 1)) {
- g_PosVelocity = minf(0, g_PosVelocity);
- }
- //debugF("fling v", g_PosVelocity);
-}
-
-void touchUp() {
- g_LastTouchDown = 0;
-}
-
-int
-count_pages(int iconCount)
-{
- int iconsPerPage = COLUMNS_PER_PAGE * ROWS_PER_PAGE;
- int pages = iconCount / iconsPerPage;
- if (pages*iconsPerPage != iconCount) {
- pages++;
- }
- return pages;
-}
-
-float
-modf(float x, float y)
-{
- return x-(y*floorf(x/y));
-}
-
-void updatePos() {
- if (g_LastTouchDown) {
- return;
- }
-
- float tablePosNorm = fracf(g_PosPage + 0.5f);
- float tablePosF = tablePosNorm * g_PhysicsTableSize;
- int tablePosI = tablePosF;
- float tablePosFrac = tablePosF - tablePosI;
- float accel = lerpf(g_AttractionTable[tablePosI],
- g_AttractionTable[tablePosI + 1],
- tablePosFrac) * g_DT;
- float friction = lerpf(g_FrictionTable[tablePosI],
- g_FrictionTable[tablePosI + 1],
- tablePosFrac) * g_DT;
- //debugF(" accel", accel);
- //debugF(" friction", friction);
-
- // If our velocity is low OR acceleration is opposing it, apply it.
- if (fabsf(g_PosVelocity) < 1.0f || (g_PosVelocity * accel) < 0) {
- g_PosVelocity += accel;
- }
-
- if ((friction > fabsf(g_PosVelocity)) && (friction > fabsf(accel))) {
- // Special get back to center and overcome friction physics.
- float t = tablePosNorm - 0.5f;
- if (fabsf(t) < (friction * g_DT)) {
- // really close, just snap
- g_PosPage = roundf(g_PosPage);
- g_PosVelocity = 0;
- } else {
- if (t > 0) {
- g_PosVelocity = -friction;
- } else {
- g_PosVelocity = friction;
- }
- }
- } else {
- // Normal physics
- if (g_PosVelocity > 0) {
- g_PosVelocity -= friction;
- g_PosVelocity = maxf(g_PosVelocity, 0);
- } else {
- g_PosVelocity += friction;
- g_PosVelocity = minf(g_PosVelocity, 0);
- }
- }
- g_PosPage += g_PosVelocity * g_DT;
-
- // Check for out of boundry conditions.
- if (g_PosPage < 0 && g_PosVelocity < 0) {
- float damp = 1.0 + (g_PosPage * 4);
- damp = clampf(damp, 0.f, 0.9f);
- g_PosVelocity *= damp;
- }
- if (g_PosPage > (g_PageCount-1) && g_PosVelocity > 0) {
- float damp = 1.0 - ((g_PosPage - g_PageCount + 1) * 4);
- damp = clampf(damp, 0.f, 0.9f);
- g_PosVelocity *= damp;
- }
-}
-
-int positionStrip(float row, float column)
-{
- float mat1[16];
-
- float y = 1.2f - row * 0.6f;
-
- float scale = 256.f / getWidth();
- float xscale = scale * 4.55 / 1.8f / 2;
-
- matrixLoadTranslate(mat1, 0.f, y, 0.f);
- matrixScale(mat1, 1.f, scale, 1.f);
- vpLoadModelMatrix(mat1);
-
- float soff = -21.8f - (column * 1.25f);
- matrixLoadScale(mat1, xscale, 1.f, 1.f);
- matrixTranslate(mat1, soff, 0, 0);
- vpLoadTextureMatrix(mat1);
-
- return - soff * 10.f;
-}
-
-void drawIcon(float row, float column, int iconNum)
-{
- int offset = positionStrip(row, column);
- bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_ICON_IDS, iconNum));
-
- if (offset < 0) {
- offset = 0;
- }
- if (offset >= (450 - 20)) {
- offset = (449 - 20);
- }
- drawSimpleMeshRange(NAMED_SMMesh, offset * 6, 20 * 6);
-}
-
-void
-draw_home_button()
-{
- color(1.0f, 1.0f, 1.0f, 1.0f);
- bindTexture(NAMED_PFTexLinear, 0, state->homeButtonId);
-
- float scale = 2.0f / SCREEN_WIDTH_PX;
-
- float x = 0.0f;
-
- float y = -(SCREEN_HEIGHT_PX / (float)SCREEN_WIDTH_PX);
- y += g_Zoom * (scale * params->homeButtonTextureHeight / 2);
-
- float z = 0.0f;
- drawSprite(x, y, z, params->homeButtonTextureWidth, params->homeButtonTextureHeight);
-}
-
-int
-main(int launchID)
-{
- // Compute dt in seconds.
- int newTime = uptimeMillis();
- g_DT = (newTime - g_LastTime) / 1000.f;
- g_LastTime = newTime;
-
- if (!g_DrawLastFrame) {
- // If we stopped rendering we cannot use DT.
- // assume 30fps in this case.
- g_DT = 0.033f;
- }
- if (g_DT > 0.2f) {
- // physics may break if DT is large.
- g_DT = 0.2f;
- }
-
- debugF("zoom", g_Zoom);
- if (g_Zoom != state->zoomTarget) {
- float dz = (state->zoomTarget - g_Zoom) * g_DT * 5;
- if (dz && (fabsf(dz) < 0.03f)) {
- if (dz > 0) {
- dz = 0.03f;
- } else {
- dz = -0.03f;
- }
- }
- if (fabsf(g_Zoom - state->zoomTarget) < fabsf(dz)) {
- g_Zoom = state->zoomTarget;
- } else {
- g_Zoom += dz;
- }
- updateReadback();
- }
-
- // Set clear value to dim the background based on the zoom position.
- if ((g_Zoom < 0.001f) && (state->zoomTarget < 0.001f)) {
- pfClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- // When we're zoomed out and not tracking motion events, reset the pos to 0.
- if (!g_LastTouchDown) {
- g_PosPage = 0;
- }
- return lastFrame(0);
- } else if (g_Zoom < 0.85f) {
- pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
- } else {
- pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
- }
-
- // icons & labels
- int iconCount = state->iconCount;
- g_PageCount = count_pages(iconCount);
-
- updatePos(0.1f);
- updateReadback();
-
- debugF(" draw g_PosPage", g_PosPage);
-
- // Draw the icons ========================================
-
- // Bug makes 1.0f alpha fail.
- //color(0.2f, 0.2f, 0.2f, 0.99f);
- //bindProgramFragment(NAMED_PFColor);
- //positionStrip(0, 0);
- //drawSimpleMesh(NAMED_SMMesh);
-
- bindProgramFragment(NAMED_PFTexLinear);
-
-
- int lastIcon = iconCount-1;
-
- int page = g_PosPage;
- float currentPagePosition = g_PosPage - page;
-
- int iconsPerPage = COLUMNS_PER_PAGE * ROWS_PER_PAGE;
- float scale = (1 / g_Zoom);
-
- float pageAngle = VIEW_ANGLE * 1.2f;
-
- float zoomOffset = 40 * (1 - g_Zoom);
- int drawPage;
- //lastIcon = 1;
- for (drawPage = 0; drawPage < g_PageCount; drawPage++) {
- int r, c;
- for (r=0; r < 4; r++) {
- for (c=0; c < 4; c++) {
- int iconNum = drawPage * 16 + c + r * 4;
- if (iconNum <= lastIcon) {
- float p = (((float)drawPage) - g_PosPage) * 5.f;
- p += c - 1.5f;
- p += zoomOffset;
- if (fabsf(p) > 2) {
- drawIcon(r, p, iconNum);
- }
- }
- }
- }
- }
-
- for (drawPage = 0; drawPage < g_PageCount; drawPage++) {
- int r, c;
- for (r=0; r < 4; r++) {
- for (c=0; c < 4; c++) {
- int iconNum = drawPage * 16 + c + r * 4;
- if (iconNum <= lastIcon) {
- float p = (((float)drawPage) - g_PosPage) * 5.f;
- p += c - 1.5f;
- p += zoomOffset;
- float x = (p * 1.13f + 1.88f) * getWidth() * 0.2f;
- float y = 570 - r * 147;
-
- if (fabsf(p) <= 2) {
- drawIcon(r, p, iconNum);
- }
- if (fabsf(p) <= 2.5) {
- float a = (1.2f - maxf(scale, 1.0f)) * 5;
- color(1.0f, 1.0f, 1.0f, a);
- bindTexture(NAMED_PFTexLinear, 0, loadI32(ALLOC_LABEL_IDS, iconNum));
- drawSpriteScreenspace(x, y, 0,
- params->bubbleBitmapWidth, params->bubbleBitmapHeight);
- }
- }
- }
- }
-
- }
-
- {
- float mat1[16];
- matrixLoadIdentity(mat1);
- vpLoadModelMatrix(mat1);
- vpLoadTextureMatrix(mat1);
- }
-
- // Draw the home button ========================================
- //draw_home_button();
-
- // Bug workaround where the last frame is not always displayed
- // So we keep rendering until the bug is fixed.
- return 1; //(g_PosVelocity != 0) || fracf(g_PosPage) || g_Zoom != g_ZoomTarget);
-}
-
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 815bd10..d91aed2 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Přidat na plochu"</string>
<string name="group_applications" msgid="4118484163419674240">"Aplikace"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Zástupce"</string>
- <string name="group_search" msgid="5905328940867162196">"Hledat"</string>
<string name="group_folder" msgid="5143593791798929193">"Nová složka"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Složky"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgety"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Složka"</string>
<string name="add_clock" msgid="2337943840175865746">"Hodiny"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Rámeček fotografie"</string>
- <string name="add_search" msgid="7104834713685095105">"Vyhledávání"</string>
<string name="out_of_space" msgid="8365249326091984698">"Na této ploše již není místo."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Zástupce <xliff:g id="NAME">%s</xliff:g> byl vytvořen."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Zástupce <xliff:g id="NAME">%s</xliff:g> byl odebrán."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Povoluje aplikaci číst nastavení a odkazy plochy."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"zápis nastavení a odkazů plochy"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Povoluje aplikaci změnit nastavení a odkazy plochy."</string>
- <string name="search_hint" msgid="6974176141372467453">"Vyhledávání Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Problém s načtením widgetu"</string>
</resources>
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index 391ec16..d38bd8d 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Føj til Startskærm"</string>
<string name="group_applications" msgid="4118484163419674240">"Programmer"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Genveje"</string>
- <string name="group_search" msgid="5905328940867162196">"Søg"</string>
<string name="group_folder" msgid="5143593791798929193">"Ny mappe"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Mapper"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Mappe"</string>
<string name="add_clock" msgid="2337943840175865746">"Ur"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Billedramme"</string>
- <string name="add_search" msgid="7104834713685095105">"Søg"</string>
<string name="out_of_space" msgid="8365249326091984698">"Der er ikke mere plads på Startskærmen."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Genvejen \"<xliff:g id="NAME">%s</xliff:g>\" blev oprettet."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Genvejen \"<xliff:g id="NAME">%s</xliff:g>\" blev fjernet."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Tillader, at et program læser indstillingerne og genvejene i Start."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"skriv indstillinger og genveje for Start"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Tillader, at et program ændrer indstillingerne og genvejene i Start."</string>
- <string name="search_hint" msgid="6974176141372467453">"Google-søgning"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Der er problemer med indlæsning af widget"</string>
</resources>
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 522bd4d..1c846b8 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Zum Startbildschirm hinzufügen"</string>
<string name="group_applications" msgid="4118484163419674240">"Anwendungen"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Verknüpfungen"</string>
- <string name="group_search" msgid="5905328940867162196">"Suchen"</string>
<string name="group_folder" msgid="5143593791798929193">"Neuer Ordner"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Ordner"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Ordner"</string>
<string name="add_clock" msgid="2337943840175865746">"Uhr"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Bildrahmen"</string>
- <string name="add_search" msgid="7104834713685095105">"Suchen"</string>
<string name="out_of_space" msgid="8365249326091984698">"Auf dem Startbildschirm ist kein Platz mehr vorhanden."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"\"<xliff:g id="NAME">%s</xliff:g>\"-Verknüpfung wurde erstellt."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"\"<xliff:g id="NAME">%s</xliff:g>\"-Verknüpfung wurde entfernt."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Ermöglicht einer Anwendung, die Einstellungen und Shortcuts auf der Startseite zu lesen."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"Einstellungen und Shortcuts für Startseite schreiben"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Ermöglicht einer Anwendung, die Einstellungen und Shortcuts auf der Startseite zu ändern."</string>
- <string name="search_hint" msgid="6974176141372467453">"Google-Suche"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Problem beim Laden des Widgets"</string>
</resources>
diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml
index bb65bf3..1876e8b 100644
--- a/res/values-el/strings.xml
+++ b/res/values-el/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Προσθήκη στην αρχική οθόνη"</string>
<string name="group_applications" msgid="4118484163419674240">"Εφαρμογές"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Συντομεύσεις"</string>
- <string name="group_search" msgid="5905328940867162196">"Αναζήτηση"</string>
<string name="group_folder" msgid="5143593791798929193">"Νέος φάκελος"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Φάκελοι"</string>
<string name="group_widgets" msgid="6704978494073105844">"Γραφικά στοιχεία"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Φάκελος"</string>
<string name="add_clock" msgid="2337943840175865746">"Ρολόι"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Πλαίσιο εικόνας"</string>
- <string name="add_search" msgid="7104834713685095105">"Αναζήτηση"</string>
<string name="out_of_space" msgid="8365249326091984698">"Δεν υπάρχει χώρος σε αυτήν την αρχική οθόνη."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Δημιουργήθηκε η συντόμευση \"<xliff:g id="NAME">%s</xliff:g>\"."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Η συντόμευση \"<xliff:g id="NAME">%s</xliff:g>\" καταργήθηκε."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Επιτρέπει σε μια εφαρμογή την ανάγνωση των ρυθμίσεων και των συντομεύσεων στην αρχική οθόνη."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"εγγραφή ρυθμίσεων και συντομεύσεων αρχικής οθόνης"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Επιτρέπει σε μια εφαρμογή την αλλαγή των ρυθμίσεων και των συντομεύσεων στην αρχική οθόνη."</string>
- <string name="search_hint" msgid="6974176141372467453">"Αναζήτηση Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Παρουσιάστηκε πρόβλημα στη φόρτωση του γραφικού στοιχείου"</string>
</resources>
diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml
index bee06e3..1aa02fa 100644
--- a/res/values-es-rUS/strings.xml
+++ b/res/values-es-rUS/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Agregar a la pantalla Página principal"</string>
<string name="group_applications" msgid="4118484163419674240">"Aplicaciones"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Accesos directos"</string>
- <string name="group_search" msgid="5905328940867162196">"Buscar"</string>
<string name="group_folder" msgid="5143593791798929193">"Carpeta nueva"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Carpetas"</string>
<string name="group_widgets" msgid="6704978494073105844">"Controles"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Carpeta"</string>
<string name="add_clock" msgid="2337943840175865746">"Reloj"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Marco de imagen"</string>
- <string name="add_search" msgid="7104834713685095105">"Buscar"</string>
<string name="out_of_space" msgid="8365249326091984698">"No hay más espacio en esta pantalla de la página principal"</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Acceso directo \"<xliff:g id="NAME">%s</xliff:g>\" creado."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"El acceso directo \"<xliff:g id="NAME">%s</xliff:g>\" ha sido eliminado."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Permite a una aplicación leer la configuración y los accesos directos de la página principal."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"escribir configuración y accesos directos de la página principal"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Permite a una aplicación cambiar la configuración y los accesos directos de la página principal."</string>
- <string name="search_hint" msgid="6974176141372467453">"Búsqueda de Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Problema al cargar el widget"</string>
</resources>
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index 7554c1b..1d3e3dd 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Añadir a pantalla de página principal"</string>
<string name="group_applications" msgid="4118484163419674240">"Aplicaciones"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Accesos directos"</string>
- <string name="group_search" msgid="5905328940867162196">"Búsqueda"</string>
<string name="group_folder" msgid="5143593791798929193">"Nueva carpeta"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Carpetas"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Carpeta"</string>
<string name="add_clock" msgid="2337943840175865746">"Reloj"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Picture frame"</string>
- <string name="add_search" msgid="7104834713685095105">"Búsqueda de Google"</string>
<string name="out_of_space" msgid="8365249326091984698">"No queda espacio en esta pantalla de página principal."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Se ha creado el acceso directo \"<xliff:g id="NAME">%s</xliff:g>\"."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Se ha eliminado el acceso directo \"<xliff:g id="NAME">%s</xliff:g>\"."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Permite que una aplicación lea la información de configuración y accesos directos de la página principal."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"escribir información de accesos directos y de configuración de la página principal"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Permite que una aplicación modifique la configuración y los accesos directos de la página principal."</string>
- <string name="search_hint" msgid="6974176141372467453">"Búsqueda de Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Problema al cargar el widget"</string>
</resources>
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index 0d66612..2b19e26 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Ajouter à l\'écran d\'accueil"</string>
<string name="group_applications" msgid="4118484163419674240">"Applications"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Raccourcis"</string>
- <string name="group_search" msgid="5905328940867162196">"Recherche"</string>
<string name="group_folder" msgid="5143593791798929193">"Nouveau dossier"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Dossiers"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Dossier"</string>
<string name="add_clock" msgid="2337943840175865746">"Horloge"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Cadre d\'image"</string>
- <string name="add_search" msgid="7104834713685095105">"Recherche"</string>
<string name="out_of_space" msgid="8365249326091984698">"Plus d\'espace libre sur l\'écran d\'accueil."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Le raccourci \"<xliff:g id="NAME">%s</xliff:g>\" a été créé."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Le raccourci \"<xliff:g id="NAME">%s</xliff:g>\" a été supprimé."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Permet à une application de lire les paramètres et raccourcis de la page d\'accueil."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"Enregistrer les paramètres de la page d\'accueil et des raccourcis"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Permet à une application de modifier les paramètres et les raccourcis de la page d\'accueil."</string>
- <string name="search_hint" msgid="6974176141372467453">"Recherche Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Problème lors du chargement du widget"</string>
</resources>
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 422f998..4bdd19d 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Aggiungi a schermata Home"</string>
<string name="group_applications" msgid="4118484163419674240">"Applicazioni"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Collegamenti"</string>
- <string name="group_search" msgid="5905328940867162196">"Ricerca"</string>
<string name="group_folder" msgid="5143593791798929193">"Nuova cartella"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Cartelle"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widget"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Cartella"</string>
<string name="add_clock" msgid="2337943840175865746">"Orologio"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Cornice immagini"</string>
- <string name="add_search" msgid="7104834713685095105">"Ricerca"</string>
<string name="out_of_space" msgid="8365249326091984698">"Spazio nella schermata Home esaurito."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Collegamento \"<xliff:g id="NAME">%s</xliff:g>\" creato."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Il collegamento \"<xliff:g id="NAME">%s</xliff:g>\" è stato rimosso."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Consente a un\'applicazione di leggere le impostazioni e le scorciatoie in Home."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"creare impostazioni e scorciatoie in Home"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Consente a un\'applicazione di modificare le impostazioni e le scorciatoie in Home."</string>
- <string name="search_hint" msgid="6974176141372467453">"Ricerca Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Errore durante il caricamento del widget"</string>
</resources>
diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml
index 2d8cc6b..5db6f9b 100644
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"ホーム画面に追加"</string>
<string name="group_applications" msgid="4118484163419674240">"アプリケーション"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"ショートカット"</string>
- <string name="group_search" msgid="5905328940867162196">"検索"</string>
<string name="group_folder" msgid="5143593791798929193">"新しいフォルダ"</string>
<string name="group_live_folders" msgid="2664945399140647217">"フォルダ"</string>
<string name="group_widgets" msgid="6704978494073105844">"ウィジェット"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"フォルダ"</string>
<string name="add_clock" msgid="2337943840175865746">"時計"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"写真フレーム"</string>
- <string name="add_search" msgid="7104834713685095105">"検索"</string>
<string name="out_of_space" msgid="8365249326091984698">"ホーム画面に空きスペースがありません。"</string>
<string name="shortcut_installed" msgid="7071557296331322355">"ショートカット「<xliff:g id="NAME">%s</xliff:g>」を作成しました。"</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"ショートカット「<xliff:g id="NAME">%s</xliff:g>」を削除しました。"</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"ホームの設定とショートカットの読み取りをアプリケーションに許可します。"</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"ホームの設定とショートカットの書き込み"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"ホームの設定とショートカットの変更をアプリケーションに許可します。"</string>
- <string name="search_hint" msgid="6974176141372467453">"Google検索"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"ウィジェットを表示できません"</string>
</resources>
diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml
index 91718b1..f0d917e 100644
--- a/res/values-ko/strings.xml
+++ b/res/values-ko/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"홈 화면에 추가"</string>
<string name="group_applications" msgid="4118484163419674240">"응용프로그램"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"바로가기"</string>
- <string name="group_search" msgid="5905328940867162196">"검색"</string>
<string name="group_folder" msgid="5143593791798929193">"새 폴더"</string>
<string name="group_live_folders" msgid="2664945399140647217">"폴더"</string>
<string name="group_widgets" msgid="6704978494073105844">"위젯"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"폴더"</string>
<string name="add_clock" msgid="2337943840175865746">"시계"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"사진 프레임"</string>
- <string name="add_search" msgid="7104834713685095105">"검색"</string>
<string name="out_of_space" msgid="8365249326091984698">"홈 화면에 더 이상 공간이 없습니다."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"바로가기(\'<xliff:g id="NAME">%s</xliff:g>\')가 생성되었습니다."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"바로가기(\'<xliff:g id="NAME">%s</xliff:g>\')가 삭제되었습니다."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"응용프로그램이 홈에 있는 설정 및 바로가기를 읽을 수 있도록 합니다."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"홈 설정 및 바로가기 쓰기"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"응용프로그램이 홈에 있는 설정 및 바로가기를 변경할 수 있도록 합니다."</string>
- <string name="search_hint" msgid="6974176141372467453">"Google 검색"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"위젯을 로드하는 중 문제가 발생했습니다."</string>
</resources>
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index d2d31c2..d1236f2 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -17,7 +17,6 @@
<resources>
<dimen name="workspace_cell_width">106dip</dimen>
<dimen name="workspace_cell_height">74dip</dimen>
- <dimen name="search_widget_inset">19dip</dimen>
<dimen name="gesture_thumbnail_inset">8dip</dimen>
<dimen name="gesture_thumbnail_size">64dip</dimen>
</resources>
diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
index 2208898..4ba9b73 100644
--- a/res/values-nb/strings.xml
+++ b/res/values-nb/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Legg til skrivebord"</string>
<string name="group_applications" msgid="4118484163419674240">"Applikasjoner"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Snarveier"</string>
- <string name="group_search" msgid="5905328940867162196">"Søk"</string>
<string name="group_folder" msgid="5143593791798929193">"Ny mappe"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Mapper"</string>
<string name="group_widgets" msgid="6704978494073105844">"Skrivebordselementer"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Mappe"</string>
<string name="add_clock" msgid="2337943840175865746">"Klokke"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Bilderamme"</string>
- <string name="add_search" msgid="7104834713685095105">"Søk"</string>
<string name="out_of_space" msgid="8365249326091984698">"Ikke nok plass på skrivebordet."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Opprettet snarveien «<xliff:g id="NAME">%s</xliff:g>»."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Fjernet snarveien «<xliff:g id="NAME">%s</xliff:g>»."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Lar applikasjonen lese innstillinger og snarveier fra skrivebordet."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"skrive skrivebordsinnstillinger og -snarveier"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Lar applikasjonen endre innstillinger og snarveier på skrivebordet."</string>
- <string name="search_hint" msgid="6974176141372467453">"Google-søk"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Problem under lasting av gadget"</string>
</resources>
diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml
index 3a69066..73964c5 100644
--- a/res/values-nl/strings.xml
+++ b/res/values-nl/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Toevoegen aan startpagina"</string>
<string name="group_applications" msgid="4118484163419674240">"Toepassingen"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Sneltoetsen"</string>
- <string name="group_search" msgid="5905328940867162196">"Zoeken"</string>
<string name="group_folder" msgid="5143593791798929193">"Nieuwe map"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Mappen"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Map"</string>
<string name="add_clock" msgid="2337943840175865746">"Klok"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Fotolijstje"</string>
- <string name="add_search" msgid="7104834713685095105">"Zoeken"</string>
<string name="out_of_space" msgid="8365249326091984698">"Er is geen ruimte meer op dit startscherm."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Snelkoppeling \'<xliff:g id="NAME">%s</xliff:g>\' is gemaakt."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Snelkoppeling \'<xliff:g id="NAME">%s</xliff:g>\' is verwijderd."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Hiermee kan een toepassing de instellingen en snelkoppelingen op de startpagina lezen."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"instellingen en snelkoppelingen voor de startpagina schrijven"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Hiermee kan een toepassing de instellingen en snelkoppelingen op de startpagina wijzigen."</string>
- <string name="search_hint" msgid="6974176141372467453">"Google Zoeken"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Probleem bij het laden van widget"</string>
</resources>
diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml
index cc9306b..74bed2a 100644
--- a/res/values-pl/strings.xml
+++ b/res/values-pl/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Dodaj do strony głównej"</string>
<string name="group_applications" msgid="4118484163419674240">"Aplikacje"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Skróty"</string>
- <string name="group_search" msgid="5905328940867162196">"Wyszukiwarka"</string>
<string name="group_folder" msgid="5143593791798929193">"Nowy folder"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Foldery"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widżety"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Folder"</string>
<string name="add_clock" msgid="2337943840175865746">"Zegar"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Ramka obrazu"</string>
- <string name="add_search" msgid="7104834713685095105">"Wyszukiwarka"</string>
<string name="out_of_space" msgid="8365249326091984698">"Brak miejsca na tej stronie głównej"</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Skrót „<xliff:g id="NAME">%s</xliff:g>” został utworzony."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Skrót „<xliff:g id="NAME">%s</xliff:g>” został usunięty."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Umożliwia aplikacji odczytywanie ustawień i skrótów strony głównej."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"zapisywanie ustawień i skrótów strony głównej"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Umożliwia aplikacji zmianę ustawień i skrótów strony głównej."</string>
- <string name="search_hint" msgid="6974176141372467453">"Szukaj w Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Problem podczas ładowania widżetu"</string>
</resources>
diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml
index 895e945..0998818 100644
--- a/res/values-pt-rPT/strings.xml
+++ b/res/values-pt-rPT/strings.xml
@@ -31,7 +31,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Adicionar ao ecrã principal"</string>
<string name="group_applications" msgid="4118484163419674240">"Aplicações"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Atalhos"</string>
- <string name="group_search" msgid="5905328940867162196">"Pesquisar"</string>
<string name="group_folder" msgid="5143593791798929193">"Nova pasta"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Pastas"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
@@ -39,7 +38,6 @@
<string name="add_folder" msgid="3521088587367839879">"Pasta"</string>
<string name="add_clock" msgid="2337943840175865746">"Relógio"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Moldura de imagem"</string>
- <string name="add_search" msgid="7104834713685095105">"Pesquisar"</string>
<string name="out_of_space" msgid="8365249326091984698">"Não existe espaço suficiente neste ecrã principal."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"O atalho \"<xliff:g id="NAME">%s</xliff:g>\" foi criado."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"O atalho \"<xliff:g id="NAME">%s</xliff:g>\" foi removido."</string>
@@ -62,6 +60,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Permite que uma aplicação leia as definições e os atalhos do ecrã principal."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"escrever definições e atalhos do ecrã principal"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Permite que uma aplicação altere as definições e os atalhos do ecrã principal."</string>
- <string name="search_hint" msgid="6974176141372467453">"Pesquisa do Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Erro ao carregar o widget"</string>
</resources>
diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
index 003927d..08686c1 100644
--- a/res/values-pt/strings.xml
+++ b/res/values-pt/strings.xml
@@ -31,7 +31,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Adicionar à tela da Página inicial"</string>
<string name="group_applications" msgid="4118484163419674240">"Aplicativos"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Atalhos"</string>
- <string name="group_search" msgid="5905328940867162196">"Pesquisar"</string>
<string name="group_folder" msgid="5143593791798929193">"Nova pasta"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Pastas"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
@@ -39,7 +38,6 @@
<string name="add_folder" msgid="3521088587367839879">"Pasta"</string>
<string name="add_clock" msgid="2337943840175865746">"Relógio"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Frame da imagem"</string>
- <string name="add_search" msgid="7104834713685095105">"Pesquisar"</string>
<string name="out_of_space" msgid="8365249326091984698">"Não há mais espaço nesta tela da Página inicial."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Atalho \"<xliff:g id="NAME">%s</xliff:g>\" criado."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"O atalho \"<xliff:g id="NAME">%s</xliff:g>\" foi removido."</string>
@@ -62,6 +60,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Permite que um aplicativo leia as configurações e atalhos na Página inicial."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"gravar configurações e atalhos da Página inicial"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Permite que um aplicativo altere as configurações e atalhos na Página inicial."</string>
- <string name="search_hint" msgid="6974176141372467453">"Pesquisa do Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Problema ao carregar o widget"</string>
</resources>
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index 7542fdb..5ce7a7b 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Добавить на главный экран"</string>
<string name="group_applications" msgid="4118484163419674240">"Приложения"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Ярлыки"</string>
- <string name="group_search" msgid="5905328940867162196">"Поиск"</string>
<string name="group_folder" msgid="5143593791798929193">"Новая папка"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Папки"</string>
<string name="group_widgets" msgid="6704978494073105844">"Виджеты"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Папка"</string>
<string name="add_clock" msgid="2337943840175865746">"Часы"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Рамка фотографии"</string>
- <string name="add_search" msgid="7104834713685095105">"Поиск"</string>
<string name="out_of_space" msgid="8365249326091984698">"На этом главном экране нет свободного места."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Ярлык \"<xliff:g id="NAME">%s</xliff:g>\" создан"</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Ярлык \"<xliff:g id="NAME">%s</xliff:g>\" удален."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Позволяет приложению считывать настройки и ярлыки на главном экране."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"изменять настройки и ярлыки главного экрана"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Позволяет приложению изменять настройки и ярлыки на главном экране."</string>
- <string name="search_hint" msgid="6974176141372467453">"Поиск Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Не удалось загрузить виджет"</string>
</resources>
diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml
index efc9227..6c54a46 100644
--- a/res/values-sv/strings.xml
+++ b/res/values-sv/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Lägg till på startsidan"</string>
<string name="group_applications" msgid="4118484163419674240">"Program"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Genvägar"</string>
- <string name="group_search" msgid="5905328940867162196">"Sök"</string>
<string name="group_folder" msgid="5143593791798929193">"Ny mapp"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Mappar"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgetar"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Mapp"</string>
<string name="add_clock" msgid="2337943840175865746">"Klocka"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Bildram"</string>
- <string name="add_search" msgid="7104834713685095105">"Sök"</string>
<string name="out_of_space" msgid="8365249326091984698">"Det finns inte plats för mer på den här startsidan."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Genvägen \"<xliff:g id="NAME">%s</xliff:g>\" har skapats."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"Genvägen \"<xliff:g id="NAME">%s</xliff:g>\" har tagits bort."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Tillåter att ett program läser inställningar och genvägar på startsidan."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"skriva inställningar och genvägar för startsidan"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Tillåter att ett program ändrar inställningar och genvägar på startsidan."</string>
- <string name="search_hint" msgid="6974176141372467453">"Sök på Google"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Det gick inte att läsa in widgeten"</string>
</resources>
diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
index 5e823ed..acf0775 100644
--- a/res/values-tr/strings.xml
+++ b/res/values-tr/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"Ana ekrana ekle"</string>
<string name="group_applications" msgid="4118484163419674240">"Uygulamalar"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Kısayollar"</string>
- <string name="group_search" msgid="5905328940867162196">"Arama"</string>
<string name="group_folder" msgid="5143593791798929193">"Yeni klasör"</string>
<string name="group_live_folders" msgid="2664945399140647217">"Klasörler"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widget\'lar"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"Klasör"</string>
<string name="add_clock" msgid="2337943840175865746">"Saat"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"Resim çerçevesi"</string>
- <string name="add_search" msgid="7104834713685095105">"Arama"</string>
<string name="out_of_space" msgid="8365249326091984698">"Bu Ana ekranda başka yer yok."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"\"<xliff:g id="NAME">%s</xliff:g>\" kısayolu oluşturuldu."</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"\"<xliff:g id="NAME">%s</xliff:g>\" kısayolu kaldırıldı."</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"Bir uygulamaya Ana Sayfadaki ayarları ve kısayolları okuma izni verir."</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"Ana Sayfa ayarlarını ve kısayollarını yaz"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"Bir uygulamaya Ana Sayfadaki ayarları ve kısayolları değiştirme izni verir."</string>
- <string name="search_hint" msgid="6974176141372467453">"Google Arama"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Widget yüklenirken sorun oluştu"</string>
</resources>
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 98eb170..e6dd9ca 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"添加到主屏幕"</string>
<string name="group_applications" msgid="4118484163419674240">"应用程序"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"快捷方式"</string>
- <string name="group_search" msgid="5905328940867162196">"搜索"</string>
<string name="group_folder" msgid="5143593791798929193">"新建文件夹"</string>
<string name="group_live_folders" msgid="2664945399140647217">"文件夹"</string>
<string name="group_widgets" msgid="6704978494073105844">"窗口小部件"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"文件夹"</string>
<string name="add_clock" msgid="2337943840175865746">"时钟"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"相框"</string>
- <string name="add_search" msgid="7104834713685095105">"搜索"</string>
<string name="out_of_space" msgid="8365249326091984698">"此主屏幕上已没有空间。"</string>
<string name="shortcut_installed" msgid="7071557296331322355">"已创建“<xliff:g id="NAME">%s</xliff:g>”快捷方式。"</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"已删除“<xliff:g id="NAME">%s</xliff:g>”快捷方式。"</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"允许应用程序读取主屏幕的设置和快捷方式。"</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"写入主屏幕的设置和快捷方式"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"允许应用程序更改主屏幕的设置和快捷方式。"</string>
- <string name="search_hint" msgid="6974176141372467453">"Google 搜索"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"载入窗口小部件时出现问题"</string>
</resources>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index 8d3d8a0..5e5ae95 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -30,7 +30,6 @@
<string name="menu_item_add_item" msgid="6233177331075781114">"新增至首頁畫面"</string>
<string name="group_applications" msgid="4118484163419674240">"應用程式"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"捷徑"</string>
- <string name="group_search" msgid="5905328940867162196">"搜尋"</string>
<string name="group_folder" msgid="5143593791798929193">"新資料夾"</string>
<string name="group_live_folders" msgid="2664945399140647217">"資料夾"</string>
<string name="group_widgets" msgid="6704978494073105844">"小工具"</string>
@@ -38,7 +37,6 @@
<string name="add_folder" msgid="3521088587367839879">"資料夾"</string>
<string name="add_clock" msgid="2337943840175865746">"時鐘"</string>
<string name="add_photo_frame" msgid="3154058437359487954">"相框"</string>
- <string name="add_search" msgid="7104834713685095105">"搜尋"</string>
<string name="out_of_space" msgid="8365249326091984698">"首頁已無空間"</string>
<string name="shortcut_installed" msgid="7071557296331322355">"已建立「<xliff:g id="NAME">%s</xliff:g>」捷徑。"</string>
<string name="shortcut_uninstalled" msgid="2129499669449749995">"已移除「<xliff:g id="NAME">%s</xliff:g>」捷徑。"</string>
@@ -61,6 +59,5 @@
<string name="permdesc_read_settings" msgid="8377434937176025492">"允許應用程式讀取首頁中的設定和捷徑。"</string>
<string name="permlab_write_settings" msgid="1360567537236705628">"寫入首頁設定和捷徑"</string>
<string name="permdesc_write_settings" msgid="1098648778383349818">"允許應用程式變更首頁中的設定和捷徑。"</string>
- <string name="search_hint" msgid="6974176141372467453">"Google 搜尋"</string>
<string name="gadget_error_text" msgid="8359351016167075858">"載入小工具時發生問題"</string>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index e0ca384..78756ac 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -15,7 +15,6 @@
-->
<resources>
- <dimen name="search_widget_inset">19dip</dimen>
<dimen name="gesture_thumbnail_inset">8dip</dimen>
<dimen name="gesture_thumbnail_size">64dip</dimen>
<dimen name="button_bar_height">56dip</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 38f27c7..35d4733 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -56,8 +56,6 @@
<string name="group_applications">Applications</string>
<!-- Options in "Add to Home" dialog box; Title of the group containing the list of all shortcuts -->
<string name="group_shortcuts">Shortcuts</string>
- <!-- Options in "Add to Home" dialog box; Title of the search gadget -->
- <string name="group_search">Search</string>
<!-- Options in "Add to Home" dialog box; Title of the folder gadget -->
<string name="group_folder">New folder</string>
<!-- Options in "Add to Home" dialog box; Title of the group containing the list of all live folders -->
@@ -72,8 +70,6 @@
<string name="add_clock">Clock</string>
<!-- Options in "Add to Home" dialog box; Name of the Picture frame widget-->
<string name="add_photo_frame">Picture frame</string>
- <!-- Options in "Add to Home" dialog box; Name of the global search widget-->
- <string name="add_search">Search</string>
<!-- Error message when user has filled a home screen, possibly not used -->
<string name="out_of_space">No more room on this Home screen.</string>
<!-- Message displayed when a shortcut is created by an external application -->
@@ -126,12 +122,6 @@
<!-- Widgets: -->
<skip />
- <!-- TODO: Determine if this can be removed.
- This is the hint text shown in the search widget, before text is entered.
- This translation SHOULD MATCH the string "search_hint" which is found in
- GoogleSearch/res/values/strings.xml -->
- <string name="search_hint">Google Search</string>
-
<!-- Text to show user in place of a gadget when we can't display it properly -->
<string name="gadget_error_text">Problem loading widget</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 125a1be..f90810f 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -35,8 +35,8 @@
<item name="android:shadowRadius">2.0</item>
<item name="android:textColor">#FFF</item>
<item name="android:gravity">center_horizontal</item>
- <item name="android:layout_width">fill_parent</item>
- <item name="android:layout_height">fill_parent</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">match_parent</item>
<item name="android:background">@drawable/shortcut_selector</item>
<item name="android:paddingLeft">5dip</item>
<item name="android:paddingRight">5dip</item>
diff --git a/src/com/android/launcher2/ActivityPicker.java b/src/com/android/launcher2/ActivityPicker.java
deleted file mode 100644
index b6da08e..0000000
--- a/src/com/android/launcher2/ActivityPicker.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.launcher2;
-
-import com.android.internal.app.AlertActivity;
-import com.android.internal.app.AlertController;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.Intent.ShortcutIconResource;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.PaintFlagsDrawFilter;
-import android.graphics.PixelFormat;
-import android.graphics.Rect;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.PaintDrawable;
-import android.os.Bundle;
-import android.os.Parcelable;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Displays a list of all activities matching the incoming
- * {@link android.content.Intent#EXTRA_INTENT} query, along with any injected items.
- */
-public class ActivityPicker extends AlertActivity implements
- DialogInterface.OnClickListener, DialogInterface.OnCancelListener {
-
- /**
- * Adapter of items that are displayed in this dialog.
- */
- private PickAdapter mAdapter;
-
- /**
- * Base {@link android.content.Intent} used when building list.
- */
- private Intent mBaseIntent;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- final Intent intent = getIntent();
-
- // Read base intent from extras, otherwise assume default
- Parcelable parcel = intent.getParcelableExtra(Intent.EXTRA_INTENT);
- if (parcel instanceof Intent) {
- mBaseIntent = (Intent) parcel;
- } else {
- mBaseIntent = new Intent(Intent.ACTION_MAIN, null);
- mBaseIntent.addCategory(Intent.CATEGORY_DEFAULT);
- }
-
- // Create dialog parameters
- AlertController.AlertParams params = mAlertParams;
- params.mOnClickListener = this;
- params.mOnCancelListener = this;
-
- // Use custom title if provided, otherwise default window title
- if (intent.hasExtra(Intent.EXTRA_TITLE)) {
- params.mTitle = intent.getStringExtra(Intent.EXTRA_TITLE);
- } else {
- params.mTitle = getTitle();
- }
-
- // Build list adapter of pickable items
- List<PickAdapter.Item> items = getItems();
- mAdapter = new PickAdapter(this, items);
- params.mAdapter = mAdapter;
-
- setupAlert();
- }
-
- /**
- * Handle clicking of dialog item by passing back
- * {@link #getIntentForPosition(int)} in {@link #setResult(int, android.content.Intent)}.
- */
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = getIntentForPosition(which);
- setResult(Activity.RESULT_OK, intent);
- finish();
- }
-
- /**
- * Handle canceled dialog by passing back {@link android.app.Activity#RESULT_CANCELED}.
- */
- public void onCancel(DialogInterface dialog) {
- setResult(Activity.RESULT_CANCELED);
- finish();
- }
-
- /**
- * Build the specific {@link android.content.Intent} for a given list position. Convenience
- * method that calls through to {@link PickAdapter.Item#getIntent(android.content.Intent)}.
- */
- protected Intent getIntentForPosition(int position) {
- PickAdapter.Item item = (PickAdapter.Item) mAdapter.getItem(position);
- return item.getIntent(mBaseIntent);
- }
-
- /**
- * Build and return list of items to be shown in dialog. Default
- * implementation mixes activities matching {@link #mBaseIntent} from
- * {@link #putIntentItems(android.content.Intent, java.util.List)} with any injected items from
- * {@link android.content.Intent#EXTRA_SHORTCUT_NAME}. Override this method in subclasses to
- * change the items shown.
- */
- protected List<PickAdapter.Item> getItems() {
- PackageManager packageManager = getPackageManager();
- List<PickAdapter.Item> items = new ArrayList<PickAdapter.Item>();
-
- // Add any injected pick items
- final Intent intent = getIntent();
- ArrayList<String> labels =
- intent.getStringArrayListExtra(Intent.EXTRA_SHORTCUT_NAME);
- ArrayList<ShortcutIconResource> icons =
- intent.getParcelableArrayListExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
-
- if (labels != null && icons != null && labels.size() == icons.size()) {
- for (int i = 0; i < labels.size(); i++) {
- String label = labels.get(i);
- Drawable icon = null;
-
- try {
- // Try loading icon from requested package
- ShortcutIconResource iconResource = icons.get(i);
- Resources res = packageManager.getResourcesForApplication(
- iconResource.packageName);
- icon = res.getDrawable(res.getIdentifier(
- iconResource.resourceName, null, null));
- } catch (NameNotFoundException e) {
- // Ignore
- }
-
- items.add(new PickAdapter.Item(this, label, icon));
- }
- }
-
- // Add any intent items if base was given
- if (mBaseIntent != null) {
- putIntentItems(mBaseIntent, items);
- }
-
- return items;
- }
-
- /**
- * Fill the given list with any activities matching the base {@link android.content.Intent}.
- */
- protected void putIntentItems(Intent baseIntent, List<PickAdapter.Item> items) {
- PackageManager packageManager = getPackageManager();
- List<ResolveInfo> list = packageManager.queryIntentActivities(baseIntent,
- 0 /* no flags */);
- Collections.sort(list, new ResolveInfo.DisplayNameComparator(packageManager));
-
- final int listSize = list.size();
- for (int i = 0; i < listSize; i++) {
- ResolveInfo resolveInfo = list.get(i);
- items.add(new PickAdapter.Item(this, packageManager, resolveInfo));
- }
- }
-
- /**
- * Adapter which shows the set of activities that can be performed for a
- * given {@link android.content.Intent}.
- */
- protected static class PickAdapter extends BaseAdapter {
-
- /**
- * Item that appears in a {@link PickAdapter} list.
- */
- public static class Item {
- protected static IconResizer sResizer;
-
- protected IconResizer getResizer(Context context) {
- if (sResizer == null) {
- sResizer = new IconResizer(context);
- }
- return sResizer;
- }
-
- CharSequence label;
- Drawable icon;
- String packageName;
- String className;
- Bundle extras;
-
- /**
- * Create a list item from given label and icon.
- */
- Item(Context context, CharSequence label, Drawable icon) {
- this.label = label;
- this.icon = getResizer(context).createIconThumbnail(icon);
- }
-
- /**
- * Create a list item and fill it with details from the given
- * {@link android.content.pm.ResolveInfo} object.
- */
- Item(Context context, PackageManager pm, ResolveInfo resolveInfo) {
- label = resolveInfo.loadLabel(pm);
- if (label == null && resolveInfo.activityInfo != null) {
- label = resolveInfo.activityInfo.name;
- }
-
- icon = getResizer(context).createIconThumbnail(resolveInfo.loadIcon(pm));
- packageName = resolveInfo.activityInfo.applicationInfo.packageName;
- className = resolveInfo.activityInfo.name;
- }
-
- Intent getIntent(Intent baseIntent) {
- Intent intent = new Intent(baseIntent);
- if (packageName != null && className != null) {
- // Valid package and class, so fill details as normal intent
- intent.setClassName(packageName, className);
- if (extras != null) {
- intent.putExtras(extras);
- }
- } else {
- // No valid package or class, so treat as shortcut with label
- intent.setAction(Intent.ACTION_CREATE_SHORTCUT);
- intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, label);
- }
- return intent;
- }
- }
-
- private final LayoutInflater mInflater;
-
- private List<Item> mItems;
- private int mLayoutRes = R.layout.pick_item;
-
- /**
- * Create an adapter for the given items.
- */
- public PickAdapter(Context context, List<Item> items) {
- mInflater = (LayoutInflater)
- context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mItems = items;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getCount() {
- return mItems.size();
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getItem(int position) {
- return mItems.get(position);
- }
-
- /**
- * {@inheritDoc}
- */
- public long getItemId(int position) {
- return position;
- }
-
- /**
- * {@inheritDoc}
- */
- public View getView(int position, View convertView, ViewGroup parent) {
- if (convertView == null) {
- convertView = mInflater.inflate(mLayoutRes, parent, false);
- }
-
- Item item = (Item) getItem(position);
- TextView textView = (TextView) convertView;
- textView.setText(item.label);
- textView.setCompoundDrawablesWithIntrinsicBounds(item.icon, null, null, null);
-
- return convertView;
- }
- }
-
- /**
- * Utility class to resize icons to match default icon size. Code is mostly
- * borrowed from Launcher.
- */
- private static class IconResizer {
- private int mIconWidth = -1;
- private int mIconHeight = -1;
-
- private final Rect mOldBounds = new Rect();
- private Canvas mCanvas = new Canvas();
- private Resources mResources;
-
- public IconResizer(Context context) {
- mCanvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG,
- Paint.FILTER_BITMAP_FLAG));
-
- mResources = context.getResources();
- mIconWidth = mIconHeight = (int) mResources.getDimension(
- android.R.dimen.app_icon_size);
- }
-
- /**
- * Returns a Drawable representing the thumbnail of the specified Drawable.
- * The size of the thumbnail is defined by the dimension
- * android.R.dimen.launcher_application_icon_size.
- *
- * This method is not thread-safe and should be invoked on the UI thread only.
- *
- * @param icon The icon to get a thumbnail of.
- *
- * @return A thumbnail for the specified icon or the icon itself if the
- * thumbnail could not be created.
- */
- public Drawable createIconThumbnail(Drawable icon) {
- int width = mIconWidth;
- int height = mIconHeight;
-
- if (icon == null) {
- return null;
- }
-
- final int iconWidth = icon.getIntrinsicWidth();
- final int iconHeight = icon.getIntrinsicHeight();
-
- if (icon instanceof PaintDrawable) {
- PaintDrawable painter = (PaintDrawable) icon;
- painter.setIntrinsicWidth(width);
- painter.setIntrinsicHeight(height);
- }
-
- if (width > 0 && height > 0) {
- if (width < iconWidth || height < iconHeight) {
- final float ratio = (float) iconWidth / iconHeight;
-
- if (iconWidth > iconHeight) {
- height = (int) (width / ratio);
- } else if (iconHeight > iconWidth) {
- width = (int) (height * ratio);
- }
-
- final Bitmap.Config c = icon.getOpacity() != PixelFormat.OPAQUE ?
- Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
- final Bitmap thumb = Bitmap.createBitmap(mIconWidth, mIconHeight, c);
- final Canvas canvas = mCanvas;
- canvas.setBitmap(thumb);
- // Copy the old bounds to restore them later
- // If we were to do oldBounds = icon.getBounds(),
- // the call to setBounds() that follows would
- // change the same instance and we would lose the
- // old bounds
- mOldBounds.set(icon.getBounds());
- final int x = (mIconWidth - width) / 2;
- final int y = (mIconHeight - height) / 2;
- icon.setBounds(x, y, x + width, y + height);
- icon.draw(canvas);
- icon.setBounds(mOldBounds);
- icon = new BitmapDrawable(mResources, thumb);
- } else if (iconWidth < width && iconHeight < height) {
- final Bitmap.Config c = Bitmap.Config.ARGB_8888;
- final Bitmap thumb = Bitmap.createBitmap(mIconWidth, mIconHeight, c);
- final Canvas canvas = mCanvas;
- canvas.setBitmap(thumb);
- mOldBounds.set(icon.getBounds());
- final int x = (width - iconWidth) / 2;
- final int y = (height - iconHeight) / 2;
- icon.setBounds(x, y, x + iconWidth, y + iconHeight);
- icon.draw(canvas);
- icon.setBounds(mOldBounds);
- icon = new BitmapDrawable(mResources, thumb);
- }
- }
-
- return icon;
- }
- }
-}
diff --git a/src/com/android/launcher2/AllAppsList.java b/src/com/android/launcher2/AllAppsList.java
index 561b345..00e9ea8 100644
--- a/src/com/android/launcher2/AllAppsList.java
+++ b/src/com/android/launcher2/AllAppsList.java
@@ -17,25 +17,13 @@
package com.android.launcher2;
import android.content.ComponentName;
-import android.content.ContentResolver;
-import android.content.ContentValues;
import android.content.Intent;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.content.res.Resources;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.util.Log;
-import android.os.Process;
-import java.lang.ref.WeakReference;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
@@ -46,13 +34,15 @@
public static final int DEFAULT_APPLICATIONS_NUMBER = 42;
/** The list off all apps. */
- public ArrayList<ApplicationInfo> data = new ArrayList(DEFAULT_APPLICATIONS_NUMBER);
+ public ArrayList<ApplicationInfo> data =
+ new ArrayList<ApplicationInfo>(DEFAULT_APPLICATIONS_NUMBER);
/** The list of apps that have been added since the last notify() call. */
- public ArrayList<ApplicationInfo> added = new ArrayList(DEFAULT_APPLICATIONS_NUMBER);
+ public ArrayList<ApplicationInfo> added =
+ new ArrayList<ApplicationInfo>(DEFAULT_APPLICATIONS_NUMBER);
/** The list of apps that have been removed since the last notify() call. */
- public ArrayList<ApplicationInfo> removed = new ArrayList();
+ public ArrayList<ApplicationInfo> removed = new ArrayList<ApplicationInfo>();
/** The list of apps that have been modified since the last notify() call. */
- public ArrayList<ApplicationInfo> modified = new ArrayList();
+ public ArrayList<ApplicationInfo> modified = new ArrayList<ApplicationInfo>();
/**
* Boring constructor.
@@ -106,7 +96,7 @@
*/
public void removePackage(String packageName) {
final List<ApplicationInfo> data = this.data;
- for (int i=data.size()-1; i>=0; i--) {
+ for (int i = data.size() - 1; i >= 0; i--) {
ApplicationInfo info = data.get(i);
final ComponentName component = info.intent.getComponent();
if (packageName.equals(component.getPackageName())) {
@@ -126,7 +116,7 @@
if (matches.size() > 0) {
// Find disabled/removed activities and remove them from data and add them
// to the removed list.
- for (int i=data.size()-1; i>=0; i--) {
+ for (int i = data.size() - 1; i >= 0; i--) {
final ApplicationInfo applicationInfo = data.get(i);
final ComponentName component = applicationInfo.intent.getComponent();
if (packageName.equals(component.getPackageName())) {
@@ -142,7 +132,7 @@
// Also updates existing activities with new labels/icons
Utilities.BubbleText bubble = new Utilities.BubbleText(context);
int count = matches.size();
- for (int i=0; i<count; i++) {
+ for (int i = 0; i < count; i++) {
final ResolveInfo info = matches.get(i);
ApplicationInfo applicationInfo = findApplicationInfoLocked(
info.activityInfo.applicationInfo.packageName,
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java
index 37ec15c..999844d 100644
--- a/src/com/android/launcher2/AllAppsView.java
+++ b/src/com/android/launcher2/AllAppsView.java
@@ -114,8 +114,10 @@
private boolean mShouldGainFocus;
+ private boolean mHaveSurface = false;
private boolean mZoomDirty = false;
private boolean mAnimateNextZoom;
+ private float mNextZoom;
private float mZoom;
private float mPosX;
private float mVelocity;
@@ -125,12 +127,19 @@
public static final int ALLOC_PARAMS = 0;
public static final int ALLOC_STATE = 1;
public static final int ALLOC_ICON_IDS = 3;
+ public static final int ALLOC_LABEL_IDS = 4;
+ public static final int ALLOC_VP_CONSTANTS = 5;
public static final int COLUMNS_PER_PAGE = 4;
public static final int ROWS_PER_PAGE = 4;
- public static final int ICON_TEXTURE_WIDTH_PX = 128;
- public static final int ICON_TEXTURE_HEIGHT_PX = 128;
+ public static final int ICON_WIDTH_PX = 64;
+ public static final int ICON_TEXTURE_WIDTH_PX = 74;
+ public static final int SELECTION_TEXTURE_WIDTH_PX = 74 + 20;
+
+ public static final int ICON_HEIGHT_PX = 64;
+ public static final int ICON_TEXTURE_HEIGHT_PX = 74;
+ public static final int SELECTION_TEXTURE_HEIGHT_PX = 74 + 20;
public int SCREEN_WIDTH_PX;
public int SCREEN_HEIGHT_PX;
@@ -185,9 +194,12 @@
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
super.surfaceDestroyed(holder);
- mRollo.mHasSurface = false;
// Without this, we leak mMessageCallback which leaks the context.
mRS.mMessageCallback = null;
+ // We may lose any callbacks that are pending, so make sure that we re-sync that
+ // on the next surfaceChanged.
+ mZoomDirty = true;
+ mHaveSurface = false;
}
@Override
@@ -196,9 +208,10 @@
super.surfaceChanged(holder, format, w, h);
+ mHaveSurface = true;
+
if (mRollo == null) {
mRollo = new RolloRS();
- mRollo.mHasSurface = true;
mRollo.init(getResources(), w, h);
if (mAllAppsList != null) {
mRollo.setApps(mAllAppsList);
@@ -207,8 +220,6 @@
gainFocus();
mShouldGainFocus = false;
}
- } else {
- mRollo.mHasSurface = true;
}
mRollo.dirtyCheck();
mRollo.resize(w, h);
@@ -267,7 +278,7 @@
}
if (gainFocus) {
- if (mRollo != null && mRollo.mHasSurface) {
+ if (mRollo != null) {
gainFocus();
} else {
mShouldGainFocus = true;
@@ -567,8 +578,7 @@
&& mCurrentIconIndex >= 0 && mCurrentIconIndex < mAllAppsList.size()) {
ApplicationInfo app = mAllAppsList.get(mCurrentIconIndex);
- Bitmap bmp = Utilities.extractIconFromTexture(app.iconBitmap, getContext());
-
+ Bitmap bmp = app.iconBitmap;
final int w = bmp.getWidth();
final int h = bmp.getHeight();
@@ -576,9 +586,10 @@
int screenX = mMotionDownRawX - (w / 2);
int screenY = mMotionDownRawY - h;
+ int left = (mDefines.ICON_TEXTURE_WIDTH_PX - mDefines.ICON_WIDTH_PX) / 2;
+ int top = (mDefines.ICON_TEXTURE_HEIGHT_PX - mDefines.ICON_HEIGHT_PX) / 2;
mDragController.startDrag(bmp, screenX, screenY,
0, 0, w, h, this, app, DragController.DRAG_ACTION_COPY);
- bmp.recycle();
mLauncher.closeAllApps(true);
}
@@ -636,10 +647,13 @@
*/
public void zoom(float zoom, boolean animate) {
cancelLongPress();
- if (mRollo == null || !mRollo.mHasSurface) {
+ mNextZoom = zoom;
+ mAnimateNextZoom = animate;
+ // if we do setZoom while we don't have a surface, we won't
+ // get the callbacks that actually set mZoom.
+ if (mRollo == null || !mHaveSurface) {
mZoomDirty = true;
mZoom = zoom;
- mAnimateNextZoom = animate;
return;
} else {
mRollo.setZoom(zoom, animate);
@@ -772,13 +786,16 @@
private ProgramStore mPSText;
private ProgramFragment mPFColor;
private ProgramFragment mPFTexMip;
+ private ProgramFragment mPFTexMipAlpha;
private ProgramFragment mPFTexNearest;
private ProgramVertex mPV;
private ProgramVertex mPVOrtho;
+ private ProgramVertex mPVCurve;
private SimpleMesh mMesh;
- private SimpleMesh mMesh2;
private ProgramVertex.MatrixAllocation mPVA;
+ private Allocation mUniformAlloc;
+
private Allocation mHomeButtonNormal;
private Allocation mHomeButtonFocused;
private Allocation mHomeButtonPressed;
@@ -786,6 +803,10 @@
private Allocation[] mIcons;
private int[] mIconIds;
private Allocation mAllocIconIds;
+
+ private Allocation[] mLabels;
+ private int[] mLabelIds;
+ private Allocation mAllocLabelIds;
private Allocation mSelectedIcon;
private int[] mTouchYBorders;
@@ -794,9 +815,6 @@
private Bitmap mSelectionBitmap;
private Canvas mSelectionCanvas;
- boolean mHasSurface = false;
- private boolean mAppsDirty = true;
-
Params mParams;
State mState;
@@ -860,49 +878,27 @@
initProgramVertex();
initProgramFragment();
initProgramStore();
- initMesh();
+ //initMesh();
initGl();
initData();
initTouchState();
initRs();
}
- public void initMesh() {
- SimpleMesh.TriangleMeshBuilder tm = new SimpleMesh.TriangleMeshBuilder(mRS, 3,
- SimpleMesh.TriangleMeshBuilder.TEXTURE_0 | SimpleMesh.TriangleMeshBuilder.COLOR);
+ public void initMesh2() {
+ SimpleMesh.TriangleMeshBuilder tm = new SimpleMesh.TriangleMeshBuilder(mRS, 2, 0);
- float y = 0;
- float z = 0;
- for (int ct=0; ct < 200; ct++) {
- float angle = 0;
- float maxAngle = 3.14f * 0.16f;
- float l = 1.f;
-
- l = 1 - ((ct-7) * 0.10f);
- if (ct > 7) {
- angle = maxAngle * (ct - 7) * 0.2f;
- angle = Math.min(angle, maxAngle);
- }
- l = Math.max(0.4f, l);
- l = Math.min(1.0f, l);
-
- y += 0.1f * Math.cos(angle);
- z += 0.1f * Math.sin(angle);
-
- float t = 0.1f * ct;
- float ds = 0.08f;
- tm.setColor(l, l, l, 0.99f);
- tm.setTexture(ds, t);
- tm.addVertex(-0.5f, y, z);
- tm.setTexture(1 - ds, t);
- tm.addVertex(0.5f, y, z);
+ for (int ct=0; ct < 16; ct++) {
+ float pos = (1.f / 16.f) * ct;
+ tm.addVertex(0.0f, pos);
+ tm.addVertex(1.0f, pos);
}
- for (int ct=0; ct < (200 * 2 - 2); ct+= 2) {
+ for (int ct=0; ct < (16 * 2 - 2); ct+= 2) {
tm.addTriangle(ct, ct+1, ct+2);
tm.addTriangle(ct+1, ct+3, ct+2);
}
- mMesh2 = tm.create();
- mMesh2.setName("SMMesh");
+ mMesh = tm.create();
+ mMesh.setName("SMCell");
}
void resize(int w, int h) {
@@ -921,6 +917,72 @@
mPV.setName("PV");
mPV.bindAllocation(mPVA);
+ Element.Builder eb = new Element.Builder(mRS);
+ eb.add(Element.createVector(mRS, Element.DataType.FLOAT_32, 2), "ImgSize");
+ eb.add(Element.createVector(mRS, Element.DataType.FLOAT_32, 4), "Position");
+ Element e = eb.create();
+
+ mUniformAlloc = Allocation.createSized(mRS, e, 1);
+
+ initMesh2();
+ ProgramVertex.ShaderBuilder sb = new ProgramVertex.ShaderBuilder(mRS);
+ String t = new String("void main() {\n" +
+ // Animation
+ " float ani = UNI_Position.z;\n" +
+
+ " float scale = (2.0 / 480.0);\n" +
+ " float x = UNI_Position.x + UNI_ImgSize.x * (1.0 - ani) * (ATTRIB_position.x - 0.5);\n" +
+ " float ys= UNI_Position.y + UNI_ImgSize.y * (1.0 - ani) * ATTRIB_position.y;\n" +
+ " float y = 0.0;\n" +
+ " float z = 0.0;\n" +
+ " float lum = 1.0;\n" +
+
+ " float cv = min(ys, 50.0) - 50.0;\n" +
+ " y += cv * 0.681;\n" + // Roughy 47 degrees
+ " z += -cv * 0.731;\n" +
+ " cv = clamp(ys, 50.0, 120.0) - 120.0;\n" + // curve range
+ " y += cv * cos(cv * 0.4 / (180.0 / 3.14));\n" +
+ " z += cv * sin(cv * 0.4 / (180.0 / 3.14));\n" +
+
+ " cv = max(ys, 750.0) - 750.0;\n" +
+ " y += cv * 0.681;\n" +
+ " z += cv * 0.731;\n" +
+ " cv = clamp(ys, 680.0, 750.0) - 680.0;\n" +
+ " y += cv * cos(cv * 0.4 / (180.0 / 3.14));\n" +
+ " z += cv * sin(cv * 0.4 / (180.0 / 3.14));\n" +
+
+ " y += clamp(ys, 120.0, 680.0);\n" +
+ " lum += (clamp(ys, 60.0, 115.0) - 115.0) / 100.0;\n" +
+ " lum -= (clamp(ys, 685.0, 740.0) - 685.0) / 100.0;\n" +
+
+ " vec4 pos;\n" +
+ " pos.x = x * scale - 1.0;\n" +
+ " pos.y = y * scale - 1.66;\n" +
+ " pos.z = z * scale;\n" +
+ " pos.w = 1.0;\n" +
+
+ " pos.x *= 1.0 + ani * 4.0;\n" +
+ " pos.y *= 1.0 + ani * 4.0;\n" +
+ " pos.z -= ani * 1.5;\n" +
+ " lum *= 1.0 - ani;\n" +
+
+ " gl_Position = UNI_MVP * pos;\n" +
+ " varColor.rgba = vec4(lum, lum, lum, 1.0);\n" +
+ " varTex0.xy = ATTRIB_position;\n" +
+ " varTex0.y = 1.0 - varTex0.y;\n" +
+ " varTex0.zw = vec2(0.0, 0.0);\n" +
+ "}\n");
+ sb.setShader(t);
+ sb.addConstant(mUniformAlloc.getType());
+ sb.addInput(mMesh.getVertexType(0).getElement());
+ mPVCurve = sb.create();
+ mPVCurve.setName("PVCurve");
+ mPVCurve.bindAllocation(mPVA);
+ mPVCurve.bindConstants(mUniformAlloc, 1);
+
+ float tf[] = new float[] {72.f, 72.f, 0.f, 0.f, 120.f, 120.f, 0.f, 0.f};
+ mUniformAlloc.data(tf);
+
//pva = new ProgramVertex.MatrixAllocation(mRS);
//pva.setupOrthoWindow(mWidth, mHeight);
//pvb.setTextureMatrixEnable(true);
@@ -934,7 +996,7 @@
private void initProgramFragment() {
Sampler.Builder sb = new Sampler.Builder(mRS);
sb.setMin(Sampler.Value.LINEAR_MIP_LINEAR);
- sb.setMag(Sampler.Value.LINEAR);
+ sb.setMag(Sampler.Value.NEAREST);
sb.setWrapS(Sampler.Value.CLAMP);
sb.setWrapT(Sampler.Value.CLAMP);
Sampler linear = sb.create();
@@ -943,12 +1005,12 @@
sb.setMag(Sampler.Value.NEAREST);
Sampler nearest = sb.create();
- ProgramFragment.Builder bf = new ProgramFragment.Builder(mRS, null, null);
- mPFColor = bf.create();
- mPFColor.setName("PFColor");
+ ProgramFragment.Builder bf = new ProgramFragment.Builder(mRS);
+ //mPFColor = bf.create();
+ //mPFColor.setName("PFColor");
- bf.setTexEnable(true, 0);
- bf.setTexEnvMode(ProgramFragment.EnvMode.MODULATE, 0);
+ bf.setTexture(ProgramFragment.Builder.EnvMode.MODULATE,
+ ProgramFragment.Builder.Format.RGBA, 0);
mPFTexMip = bf.create();
mPFTexMip.setName("PFTexMip");
mPFTexMip.bindSampler(linear, 0);
@@ -956,6 +1018,13 @@
mPFTexNearest = bf.create();
mPFTexNearest.setName("PFTexNearest");
mPFTexNearest.bindSampler(nearest, 0);
+
+ bf.setTexture(ProgramFragment.Builder.EnvMode.MODULATE,
+ ProgramFragment.Builder.Format.ALPHA, 0);
+ mPFTexMipAlpha = bf.create();
+ mPFTexMipAlpha.setName("PFTexMipAlpha");
+ mPFTexMipAlpha.bindSampler(linear, 0);
+
}
private void initProgramStore() {
@@ -1008,8 +1077,8 @@
mParams.save();
mState.save();
- mSelectionBitmap = Bitmap.createBitmap(Defines.ICON_TEXTURE_WIDTH_PX,
- Defines.ICON_TEXTURE_HEIGHT_PX, Bitmap.Config.ARGB_8888);
+ mSelectionBitmap = Bitmap.createBitmap(Defines.SELECTION_TEXTURE_WIDTH_PX,
+ Defines.SELECTION_TEXTURE_HEIGHT_PX, Bitmap.Config.ARGB_8888);
mSelectionCanvas = new Canvas(mSelectionBitmap);
setApps(null);
@@ -1020,11 +1089,12 @@
private void initRs() {
ScriptC.Builder sb = new ScriptC.Builder(mRS);
- sb.setScript(mRes, R.raw.rollo3);
+ sb.setScript(mRes, R.raw.allapps);
sb.setRoot(true);
sb.addDefines(mDefines);
sb.setType(mParams.mType, "params", Defines.ALLOC_PARAMS);
sb.setType(mState.mType, "state", Defines.ALLOC_STATE);
+ sb.setType(mUniformAlloc.getType(), "vpConstants", Defines.ALLOC_VP_CONSTANTS);
mInvokeMove = sb.addInvokable("move");
mInvokeFling = sb.addInvokable("fling");
mInvokeMoveTo = sb.addInvokable("moveTo");
@@ -1035,22 +1105,15 @@
mScript.bindAllocation(mParams.mAlloc, Defines.ALLOC_PARAMS);
mScript.bindAllocation(mState.mAlloc, Defines.ALLOC_STATE);
mScript.bindAllocation(mAllocIconIds, Defines.ALLOC_ICON_IDS);
+ mScript.bindAllocation(mAllocLabelIds, Defines.ALLOC_LABEL_IDS);
+ mScript.bindAllocation(mUniformAlloc, Defines.ALLOC_VP_CONSTANTS);
mRS.contextBindRootScript(mScript);
}
void dirtyCheck() {
- if (mHasSurface) {
- if (mAppsDirty && mAllAppsList != null) {
- for (int i=0; i < mState.iconCount; i++) {
- uploadAppIcon(i, mAllAppsList.get(i));
- }
- saveAppsList();
- mAppsDirty = false;
- }
- if (mZoomDirty) {
- setZoom(mZoom, mAnimateNextZoom);
- }
+ if (mZoomDirty) {
+ setZoom(mNextZoom, mAnimateNextZoom);
}
}
@@ -1065,21 +1128,18 @@
mIconIds = new int[allocCount];
mAllocIconIds = Allocation.createSized(mRS, Element.USER_I32(mRS), allocCount);
+ mLabels = new Allocation[count];
+ mLabelIds = new int[allocCount];
+ mAllocLabelIds = Allocation.createSized(mRS, Element.USER_I32(mRS), allocCount);
+
Element ie8888 = Element.RGBA_8888(mRS);
mState.iconCount = count;
- long before = SystemClock.uptimeMillis();
for (int i=0; i < mState.iconCount; i++) {
createAppIconAllocations(i, list.get(i));
}
- long after = SystemClock.uptimeMillis();
- //Log.d(TAG, "createAppIconAllocations took " + (after-before) + "ms");
- if (mHasSurface) {
- for (int i=0; i < mState.iconCount; i++) {
- uploadAppIcon(i, list.get(i));
- }
- } else {
- mRollo.mAppsDirty = true;
+ for (int i=0; i < mState.iconCount; i++) {
+ uploadAppIcon(i, list.get(i));
}
saveAppsList();
}
@@ -1098,29 +1158,13 @@
}
}
- private void frameBitmapAllocMips(Allocation alloc, int w, int h) {
- int black[] = new int[w > h ? w : h];
- Allocation.Adapter2D a = alloc.createAdapter2D();
- int mip = 0;
- while (w > 1 || h > 1) {
- a.subData(0, 0, 1, h, black);
- a.subData(w-1, 0, 1, h, black);
- a.subData(0, 0, w, 1, black);
- a.subData(0, h-1, w, 1, black);
- mip++;
- w = (w + 1) >> 1;
- h = (h + 1) >> 1;
- a.setConstraint(Dimension.LOD, mip);
- }
- a.subData(0, 0, 1, 1, black);
- }
-
private void createAppIconAllocations(int index, ApplicationInfo item) {
- Bitmap bitmap = item.iconBitmap;
- mIcons[index] = Allocation.createFromBitmap(mRS, bitmap, Element.RGBA_8888(mRS), true);
- frameBitmapAllocMips(mIcons[index], bitmap.getWidth(), bitmap.getHeight());
-
+ mIcons[index] = Allocation.createFromBitmap(mRS, item.iconBitmap,
+ Element.RGBA_8888(mRS), true);
+ mLabels[index] = Allocation.createFromBitmap(mRS, item.titleBitmap,
+ Element.A_8(mRS), true);
mIconIds[index] = mIcons[index].getID();
+ mLabelIds[index] = mLabels[index].getID();
}
private void uploadAppIcon(int index, ApplicationInfo item) {
@@ -1131,6 +1175,7 @@
+ " item=" + item);
}
mIcons[index].uploadToTexture(0);
+ mLabels[index].uploadToTexture(0);
}
/**
@@ -1142,13 +1187,21 @@
int[] iconIds = new int[count];
mAllocIconIds = Allocation.createSized(mRS, Element.USER_I32(mRS), count);
+ Allocation[] labels = new Allocation[count];
+ int[] labelIds = new int[count];
+ mAllocLabelIds = Allocation.createSized(mRS, Element.USER_I32(mRS), count);
+
final int oldCount = mRollo.mState.iconCount;
System.arraycopy(mIcons, 0, icons, 0, oldCount);
System.arraycopy(mIconIds, 0, iconIds, 0, oldCount);
+ System.arraycopy(mLabels, 0, labels, 0, oldCount);
+ System.arraycopy(mLabelIds, 0, labelIds, 0, oldCount);
mIcons = icons;
mIconIds = iconIds;
+ mLabels = labels;
+ mLabelIds = labelIds;
}
/**
@@ -1160,15 +1213,11 @@
System.arraycopy(mIcons, index, mIcons, dest, count);
System.arraycopy(mIconIds, index, mIconIds, dest, count);
+ System.arraycopy(mLabels, index, mLabels, dest, count);
+ System.arraycopy(mLabelIds, index, mLabelIds, dest, count);
createAppIconAllocations(index, item);
-
- if (mHasSurface) {
- uploadAppIcon(index, item);
- } else {
- mAppsDirty = true;
- }
-
+ uploadAppIcon(index, item);
mRollo.mState.iconCount++;
}
@@ -1181,12 +1230,16 @@
System.arraycopy(mIcons, src, mIcons, index, count);
System.arraycopy(mIconIds, src, mIconIds, index, count);
+ System.arraycopy(mLabels, src, mLabels, index, count);
+ System.arraycopy(mLabelIds, src, mLabelIds, index, count);
mRollo.mState.iconCount--;
final int last = mState.iconCount;
mIcons[last] = null;
mIconIds[last] = 0;
+ mLabels[last] = null;
+ mLabelIds[last] = 0;
}
/**
@@ -1196,9 +1249,11 @@
mRS.contextBindRootScript(null);
mAllocIconIds.data(mIconIds);
+ mAllocLabelIds.data(mLabelIds);
if (mScript != null) { // this happens when we init it
mScript.bindAllocation(mAllocIconIds, Defines.ALLOC_ICON_IDS);
+ mScript.bindAllocation(mAllocLabelIds, Defines.ALLOC_LABEL_IDS);
}
mState.save();
@@ -1313,7 +1368,7 @@
ApplicationInfo info = mAllAppsList.get(index);
Bitmap selectionBitmap = mSelectionBitmap;
- Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas, selectionBitmap,
+ Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,
selectionBitmap.getWidth(), selectionBitmap.getHeight(),
pressed == SELECTED_PRESSED, info.iconBitmap);
@@ -1368,10 +1423,12 @@
Log.d(TAG, "mRollo.mIconIds.length=" + mIconIds.length);
}
Log.d(TAG, "mRollo.mIconIds=" + Arrays.toString(mIconIds));
+ if (mLabelIds != null) {
+ Log.d(TAG, "mRollo.mLabelIds.length=" + mLabelIds.length);
+ }
+ Log.d(TAG, "mRollo.mLabelIds=" + Arrays.toString(mLabelIds));
Log.d(TAG, "mRollo.mTouchXBorders=" + Arrays.toString(mTouchXBorders));
Log.d(TAG, "mRollo.mTouchYBorders=" + Arrays.toString(mTouchYBorders));
- Log.d(TAG, "mRollo.mHasSurface=" + mHasSurface);
- Log.d(TAG, "mRollo.mAppsDirty=" + mAppsDirty);
Log.d(TAG, "mRollo.mState.newPositionX=" + mState.newPositionX);
Log.d(TAG, "mRollo.mState.newTouchDown=" + mState.newTouchDown);
Log.d(TAG, "mRollo.mState.flingVelocity=" + mState.flingVelocity);
diff --git a/src/com/android/launcher2/AppInfoCache.java b/src/com/android/launcher2/AppInfoCache.java
index e81168e..a2d9830 100644
--- a/src/com/android/launcher2/AppInfoCache.java
+++ b/src/com/android/launcher2/AppInfoCache.java
@@ -168,13 +168,10 @@
application.title = info.activityInfo.name;
}
- // TODO: turn this on in froyo, not enough time for testing in mr3
- //if (application.iconBitmap != null) {
- // application.iconBitmap.recycle();
- //}
application.iconBitmap = Utilities.createAllAppsBitmap(
- info.activityInfo.loadIcon(packageManager),
- application.title.toString(), bubble, context);
+ info.activityInfo.loadIcon(packageManager), context);
+
+ application.titleBitmap = bubble.createTextBitmap(application.title.toString());
}
}
diff --git a/src/com/android/launcher2/ApplicationInfo.java b/src/com/android/launcher2/ApplicationInfo.java
index ae0e219..0fe84e7 100644
--- a/src/com/android/launcher2/ApplicationInfo.java
+++ b/src/com/android/launcher2/ApplicationInfo.java
@@ -37,6 +37,11 @@
CharSequence title;
/**
+ * A bitmap of the application's text in the bubble.
+ */
+ Bitmap titleBitmap;
+
+ /**
* The intent used to start the application.
*/
Intent intent;
@@ -47,7 +52,7 @@
Drawable icon;
/**
- * What we show in all apps, including the text.
+ * A bitmap version of the application icon.
*/
Bitmap iconBitmap;
@@ -144,9 +149,9 @@
ArrayList<ApplicationInfo> list) {
Log.d(tag, label + " size=" + list.size());
for (ApplicationInfo info: list) {
- Log.d(tag, " title=\"" + info.title + "\" icon=" + info.icon
- + " iconBitmap=" + info.iconBitmap + " filtered=" + info.filtered
- + " customIcon=" + info.customIcon);
+ Log.d(tag, " title=\"" + info.title + "\" titleBitmap=" + info.titleBitmap
+ + " icon=" + info.icon + " iconBitmap=" + info.iconBitmap
+ + " filtered=" + info.filtered + " customIcon=" + info.customIcon);
}
}
}
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 6970875..df8ca89 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -901,7 +901,7 @@
}
public LayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan) {
- super(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+ super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
this.cellX = cellX;
this.cellY = cellY;
this.cellHSpan = cellHSpan;
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 590ca69..daabbcc 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -18,25 +18,18 @@
import android.content.Context;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.IBinder;
import android.os.Handler;
import android.os.Vibrator;
-import android.os.SystemClock;
-import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
-import android.view.ViewGroup;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
import java.util.ArrayList;
@@ -44,6 +37,7 @@
* Class for initiating a drag within a view or across multiple views.
*/
public class DragController {
+ @SuppressWarnings({"UnusedDeclaration"})
private static final String TAG = "Launcher.DragController";
/** Indicates the drag is a move. */
@@ -113,6 +107,8 @@
/** The view that will be scrolled when dragging to the left and right edges of the screen. */
private View mScrollView;
+ private View mMoveTarget;
+
private DragScroller mDragScroller;
private int mScrollState = SCROLL_OUTSIDE_ZONE;
private ScrollRunnable mScrollRunnable = new ScrollRunnable();
@@ -147,7 +143,6 @@
* Used to create a new DragLayer from XML.
*
* @param context The application's context.
- * @param attrs The attribtues set containing the Workspace's customization values.
*/
public DragController(Context context) {
mContext = context;
@@ -159,7 +154,7 @@
*
* @param v The view that is being dragged
* @param source An object representing where the drag originated
- * @param info The data associated with the object that is being dragged
+ * @param dragInfo The data associated with the object that is being dragged
* @param dragAction The drag action: either {@link #DRAG_ACTION_MOVE} or
* {@link #DRAG_ACTION_COPY}
*/
@@ -195,7 +190,7 @@
* @param textureWidth The width of the region inside b to use.
* @param textureHeight The height of the region inside b to use.
* @param source An object representing where the drag originated
- * @param info The data associated with the object that is being dragged
+ * @param dragInfo The data associated with the object that is being dragged
* @param dragAction The drag action: either {@link #DRAG_ACTION_MOVE} or
* {@link #DRAG_ACTION_COPY}
*/
@@ -275,6 +270,7 @@
* || super.dispatchKeyEvent(event);
* </pre>
*/
+ @SuppressWarnings({"UnusedDeclaration"})
public boolean dispatchKeyEvent(KeyEvent event) {
return mDragging;
}
@@ -343,6 +339,17 @@
}
/**
+ * Sets the view that should handle move events.
+ */
+ void setMoveTarget(View view) {
+ mMoveTarget = view;
+ }
+
+ public boolean dispatchUnhandledMove(View focused, int direction) {
+ return mMoveTarget != null && mMoveTarget.dispatchUnhandledMove(focused, direction);
+ }
+
+ /**
* Call this from a drag source view.
*/
public boolean onTouchEvent(MotionEvent ev) {
@@ -377,7 +384,7 @@
// Drop on someone?
final int[] coordinates = mCoordinatesTemp;
- DropTarget dropTarget = findDropTarget((int) screenX, (int) screenY, coordinates);
+ DropTarget dropTarget = findDropTarget(screenX, screenY, coordinates);
if (dropTarget != null) {
if (mLastDropTarget == dropTarget) {
dropTarget.onDragOver(mDragSource, coordinates[0], coordinates[1],
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index 7ae9891..c683207 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -18,9 +18,9 @@
import android.content.Context;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.MotionEvent;
import android.view.KeyEvent;
+import android.view.View;
import android.widget.FrameLayout;
/**
@@ -57,4 +57,9 @@
public boolean onTouchEvent(MotionEvent ev) {
return mDragController.onTouchEvent(ev);
}
+
+ @Override
+ public boolean dispatchUnhandledMove(View focused, int direction) {
+ return mDragController.dispatchUnhandledMove(focused, direction);
+ }
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 45545db..1830521 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -19,7 +19,6 @@
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
-import android.app.ISearchManager;
import android.app.SearchManager;
import android.app.StatusBarManager;
import android.app.WallpaperManager;
@@ -46,8 +45,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
-import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.SystemProperties;
import android.provider.LiveFolders;
import android.text.Selection;
@@ -113,9 +110,6 @@
static final String EXTRA_SHORTCUT_DUPLICATE = "duplicate";
- static final String EXTRA_CUSTOM_WIDGET = "custom_widget";
- static final String SEARCH_WIDGET = "search_widget";
-
static final int SCREEN_COUNT = 5;
static final int DEFAULT_SCREEN = 2;
static final int NUMBER_CELLS_X = 4;
@@ -183,8 +177,6 @@
private SpannableStringBuilder mDefaultKeySsb = null;
- private boolean mIsNewIntent;
-
private boolean mWorkspaceLoading = true;
private boolean mPaused = true;
@@ -412,21 +404,6 @@
mModel.startLoader(this, true);
mRestoring = false;
}
-
- // If this was a new intent (i.e., the mIsNewIntent flag got set to true by
- // onNewIntent), then close the search dialog if needed, because it probably
- // came from the user pressing 'home' (rather than, for example, pressing 'back').
- if (mIsNewIntent) {
- // Post to a handler so that this happens after the search dialog tries to open
- // itself again.
- mWorkspace.post(new Runnable() {
- public void run() {
- stopSearch();
- }
- });
- }
-
- mIsNewIntent = false;
}
@Override
@@ -554,6 +531,7 @@
mHandleView = (HandleView) findViewById(R.id.all_apps_button);
mHandleView.setLauncher(this);
mHandleView.setOnClickListener(this);
+ mHandleView.setOnLongClickListener(this);
mPreviousView = (ImageView) dragLayer.findViewById(R.id.previous_screen);
mNextView = (ImageView) dragLayer.findViewById(R.id.next_screen);
@@ -578,6 +556,7 @@
dragController.setDragScoller(workspace);
dragController.setDragListener(deleteZone);
dragController.setScrollView(dragLayer);
+ dragController.setMoveTarget(workspace);
// The order here is bottom to top.
dragController.addDropTarget(workspace);
@@ -773,15 +752,15 @@
private static ApplicationInfo infoFromShortcutIntent(Context context, Intent data) {
Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
- Bitmap bitmap = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
+ Parcelable bitmap = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
Drawable icon = null;
boolean filtered = false;
boolean customIcon = false;
ShortcutIconResource iconResource = null;
- if (bitmap != null) {
- icon = new FastBitmapDrawable(Utilities.createBitmapThumbnail(bitmap, context));
+ if (bitmap != null && bitmap instanceof Bitmap) {
+ icon = new FastBitmapDrawable(Utilities.createBitmapThumbnail((Bitmap) bitmap, context));
filtered = true;
customIcon = true;
} else {
@@ -845,11 +824,6 @@
// also will cancel mWaitingForResult.
closeSystemDialogs();
- // Set this flag so that onResume knows to close the search dialog if it's open,
- // because this was a new intent (thus a press of 'home' or some such) rather than
- // for example onResume being called when the user pressed the 'back' button.
- mIsNewIntent = true;
-
boolean alreadyOnHome = ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
!= Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
boolean allAppsVisible = isAllAppsVisible();
@@ -953,26 +927,6 @@
closeAllApps(true);
- // Slide the search widget to the top, if it's on the current screen,
- // otherwise show the search dialog immediately.
- Search searchWidget = mWorkspace.findSearchWidgetOnCurrentScreen();
- if (searchWidget == null) {
- showSearchDialog(initialQuery, selectInitialQuery, appSearchData, globalSearch);
- } else {
- searchWidget.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
- // show the currently typed text in the search widget while sliding
- searchWidget.setQuery(getTypedText());
- }
- }
-
- /**
- * Show the search dialog immediately, without changing the search widget.
- *
- * @see Activity#startSearch(String, boolean, android.os.Bundle, boolean)
- */
- void showSearchDialog(String initialQuery, boolean selectInitialQuery,
- Bundle appSearchData, boolean globalSearch) {
-
if (initialQuery == null) {
// Use any text typed in the launcher as the initial query
initialQuery = getTypedText();
@@ -985,37 +939,10 @@
final SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
-
- final Search searchWidget = mWorkspace.findSearchWidgetOnCurrentScreen();
- if (searchWidget != null) {
- // This gets called when the user leaves the search dialog to go back to
- // the Launcher.
- searchManager.setOnCancelListener(new SearchManager.OnCancelListener() {
- public void onCancel() {
- searchManager.setOnCancelListener(null);
- stopSearch();
- }
- });
- }
-
searchManager.startSearch(initialQuery, selectInitialQuery, getComponentName(),
appSearchData, globalSearch);
}
- /**
- * Cancel search dialog if it is open.
- */
- void stopSearch() {
- // Close search dialog
- SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
- searchManager.stopSearch();
- // Restore search widget to its normal position
- Search searchWidget = mWorkspace.findSearchWidgetOnCurrentScreen();
- if (searchWidget != null) {
- searchWidget.stopSearch(false);
- }
- }
-
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (isWorkspaceLocked()) {
@@ -1100,51 +1027,21 @@
void addAppWidget(Intent data) {
// TODO: catch bad widget exception when sent
int appWidgetId = data.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
+ AppWidgetProviderInfo appWidget = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
- String customWidget = data.getStringExtra(EXTRA_CUSTOM_WIDGET);
- if (SEARCH_WIDGET.equals(customWidget)) {
- // We don't need this any more, since this isn't a real app widget.
- mAppWidgetHost.deleteAppWidgetId(appWidgetId);
- // add the search widget
- addSearch();
+ if (appWidget.configure != null) {
+ // Launch over to configure widget, if needed
+ Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
+ intent.setComponent(appWidget.configure);
+ intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
+
+ startActivityForResult(intent, REQUEST_CREATE_APPWIDGET);
} else {
- AppWidgetProviderInfo appWidget = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
-
- if (appWidget.configure != null) {
- // Launch over to configure widget, if needed
- Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
- intent.setComponent(appWidget.configure);
- intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
-
- startActivityForResult(intent, REQUEST_CREATE_APPWIDGET);
- } else {
- // Otherwise just add it
- onActivityResult(REQUEST_CREATE_APPWIDGET, Activity.RESULT_OK, data);
- }
+ // Otherwise just add it
+ onActivityResult(REQUEST_CREATE_APPWIDGET, Activity.RESULT_OK, data);
}
}
- void addSearch() {
- final Widget info = Widget.makeSearch();
- final CellLayout.CellInfo cellInfo = mAddItemCellInfo;
-
- final int[] xy = mCellCoordinates;
- final int spanX = info.spanX;
- final int spanY = info.spanY;
-
- if (!findSlot(cellInfo, xy, spanX, spanY)) return;
-
- LauncherModel.addItemToDatabase(this, info, LauncherSettings.Favorites.CONTAINER_DESKTOP,
- mWorkspace.getCurrentScreen(), xy[0], xy[1], false);
-
- final View view = mInflater.inflate(info.layoutResource, null);
- view.setTag(info);
- Search search = (Search) view.findViewById(R.id.widget_search);
- search.setLauncher(this);
-
- mWorkspace.addInCurrentScreen(view, xy[0], xy[1], info.spanX, spanY);
- }
-
void processShortcut(Intent intent, int requestCodeApplication, int requestCodeShortcut) {
// Handle case where user selected "Applications"
String applicationName = getResources().getString(R.string.group_applications);
@@ -1486,14 +1383,21 @@
if (!isAllAppsVisible()) {
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- showPreviousPreview(v);
+ showPreviews(v);
}
return true;
case R.id.next_screen:
if (!isAllAppsVisible()) {
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- showNextPreview(v);
+ showPreviews(v);
+ }
+ return true;
+ case R.id.all_apps_button:
+ if (!isAllAppsVisible()) {
+ mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
+ HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
+ showPreviews(v);
}
return true;
}
@@ -1556,29 +1460,19 @@
v.setTag(null);
}
- private void showPreviousPreview(View anchor) {
- int current = mWorkspace.getCurrentScreen();
- if (current <= 0) return;
-
+ private void showPreviews(View anchor) {
showPreviews(anchor, 0, mWorkspace.getChildCount());
}
- private void showNextPreview(View anchor) {
- int current = mWorkspace.getCurrentScreen();
- if (current >= mWorkspace.getChildCount() - 1) return;
-
- showPreviews(anchor, 0, mWorkspace.getChildCount());
- }
-
private void showPreviews(final View anchor, int start, int end) {
- Resources resources = getResources();
+ final Resources resources = getResources();
+ final Workspace workspace = mWorkspace;
- Workspace workspace = mWorkspace;
CellLayout cell = ((CellLayout) workspace.getChildAt(start));
float max = workspace.getChildCount();
- Rect r = new Rect();
+ final Rect r = new Rect();
resources.getDrawable(R.drawable.preview_background).getPadding(r);
int extraW = (int) ((r.left + r.right) * max);
int extraH = r.top + r.bottom;
@@ -1609,10 +1503,10 @@
ImageView image = new ImageView(this);
cell = (CellLayout) workspace.getChildAt(i);
- Bitmap bitmap = Bitmap.createBitmap((int) sWidth, (int) sHeight,
+ final Bitmap bitmap = Bitmap.createBitmap((int) sWidth, (int) sHeight,
Bitmap.Config.ARGB_8888);
-
- Canvas c = new Canvas(bitmap);
+
+ final Canvas c = new Canvas(bitmap);
c.scale(scale, scale);
c.translate(-cell.getLeftPadding(), -cell.getTopPadding());
cell.dispatchDraw(c);
@@ -1630,8 +1524,8 @@
bitmaps.add(bitmap);
}
-
- PopupWindow p = new PopupWindow(this);
+
+ final PopupWindow p = new PopupWindow(this);
p.setContentView(preview);
p.setWidth((int) (sWidth * count + extraW));
p.setHeight((int) (sHeight + extraH));
@@ -1675,10 +1569,6 @@
}
}
- View getDrawerHandle() {
- return mHandleView;
- }
-
Workspace getWorkspace() {
return mWorkspace;
}
@@ -1829,22 +1719,14 @@
return mAllAppsGrid.isVisible();
}
- boolean isAllAppsOpaque() {
- return mAllAppsGrid.isOpaque();
- }
-
void showAllApps(boolean animated) {
mAllAppsGrid.zoom(1.0f, animated);
- //mWorkspace.hide();
-
- mWorkspace.startFading(false);
mAllAppsGrid.setFocusable(true);
mAllAppsGrid.requestFocus();
// TODO: fade these two too
mDeleteZone.setVisibility(View.GONE);
- //mHandleView.setVisibility(View.GONE);
}
/**
@@ -1887,13 +1769,6 @@
mAllAppsGrid.zoom(0.0f, animated);
mAllAppsGrid.setFocusable(false);
mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus();
- mWorkspace.startFading(true);
-
- // TODO: fade these two too
- /*
- mDeleteZone.setVisibility(View.VISIBLE);
- mHandleView.setVisibility(View.VISIBLE);
- */
}
}
@@ -1969,22 +1844,6 @@
Intent pickIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK);
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
- // add the search widget
- ArrayList<AppWidgetProviderInfo> customInfo =
- new ArrayList<AppWidgetProviderInfo>();
- AppWidgetProviderInfo info = new AppWidgetProviderInfo();
- info.provider = new ComponentName(getPackageName(), "XXX.YYY");
- info.label = getString(R.string.group_search);
- info.icon = R.drawable.ic_search_widget;
- customInfo.add(info);
- pickIntent.putParcelableArrayListExtra(
- AppWidgetManager.EXTRA_CUSTOM_INFO, customInfo);
- ArrayList<Bundle> customExtras = new ArrayList<Bundle>();
- Bundle b = new Bundle();
- b.putString(EXTRA_CUSTOM_WIDGET, SEARCH_WIDGET);
- customExtras.add(b);
- pickIntent.putParcelableArrayListExtra(
- AppWidgetManager.EXTRA_CUSTOM_EXTRAS, customExtras);
// start the pick activity
startActivityForResult(pickIntent, REQUEST_PICK_APPWIDGET);
break;
@@ -2125,19 +1984,6 @@
workspace.addInScreen(newLiveFolder, item.screen, item.cellX, item.cellY, 1, 1,
false);
break;
- case LauncherSettings.Favorites.ITEM_TYPE_WIDGET_SEARCH:
- final int screen = workspace.getCurrentScreen();
- final View view = mInflater.inflate(R.layout.widget_search,
- (ViewGroup) workspace.getChildAt(screen), false);
-
- Search search = (Search) view.findViewById(R.id.widget_search);
- search.setLauncher(this);
-
- final Widget widget = (Widget) item;
- view.setTag(widget);
-
- workspace.addWidget(view, widget, false);
- break;
}
}
@@ -2248,7 +2094,7 @@
*/
public void bindPackageRemoved(String packageName, ArrayList<ApplicationInfo> apps) {
removeDialog(DIALOG_CREATE_SHORTCUT);
- mWorkspace.removeShortcutsForPackage(packageName);
+ mWorkspace.removeItemsForPackage(packageName);
mAllAppsGrid.removeApps(apps);
}
@@ -2258,7 +2104,6 @@
public void dumpState() {
Log.d(TAG, "BEGIN launcher2 dump state for launcher " + this);
Log.d(TAG, "mSavedState=" + mSavedState);
- Log.d(TAG, "mIsNewIntent=" + mIsNewIntent);
Log.d(TAG, "mWorkspaceLoading=" + mWorkspaceLoading);
Log.d(TAG, "mRestoring=" + mRestoring);
Log.d(TAG, "mWaitingForResult=" + mWaitingForResult);
diff --git a/src/com/android/launcher2/LauncherAppWidgetInfo.java b/src/com/android/launcher2/LauncherAppWidgetInfo.java
index 25db72b..a28973b 100644
--- a/src/com/android/launcher2/LauncherAppWidgetInfo.java
+++ b/src/com/android/launcher2/LauncherAppWidgetInfo.java
@@ -25,7 +25,8 @@
class LauncherAppWidgetInfo extends ItemInfo {
/**
- * Identifier for this widget when talking with {@link AppWidgetManager} for updates.
+ * Identifier for this widget when talking with
+ * {@link android.appwidget.AppWidgetManager} for updates.
*/
int appWidgetId;
diff --git a/src/com/android/launcher2/LauncherApplication.java b/src/com/android/launcher2/LauncherApplication.java
index 9b63524..a72e53a 100644
--- a/src/com/android/launcher2/LauncherApplication.java
+++ b/src/com/android/launcher2/LauncherApplication.java
@@ -18,7 +18,6 @@
import android.app.Application;
import android.content.ContentResolver;
-import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.ContentObserver;
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index 97fa554..7eb240f 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -16,20 +16,25 @@
package com.android.launcher2;
+import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProviderInfo;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
+import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Intent;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
+import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
+import android.os.RemoteException;
import android.util.Log;
import android.os.Process;
import android.os.SystemClock;
@@ -602,6 +607,8 @@
final Context context = mContext;
final ContentResolver contentResolver = context.getContentResolver();
final PackageManager manager = context.getPackageManager();
+ final AppWidgetManager widgets = AppWidgetManager.getInstance(context);
+ final boolean isSafeMode = manager.isSafeMode();
/* TODO
if (mLocaleChanged) {
@@ -613,6 +620,8 @@
mAppWidgets.clear();
mFolders.clear();
+ final ArrayList<Long> itemsToRemove = new ArrayList<Long>();
+
final Cursor c = contentResolver.query(
LauncherSettings.Favorites.CONTENT_URI, null, null, null, null);
@@ -651,7 +660,6 @@
ApplicationInfo info;
String intentDescription;
- Widget widgetInfo;
LauncherAppWidgetInfo appWidgetInfo;
int container;
long id;
@@ -734,81 +742,82 @@
break;
case LauncherSettings.Favorites.ITEM_TYPE_LIVE_FOLDER:
-
id = c.getLong(idIndex);
- LiveFolderInfo liveFolderInfo = findOrMakeLiveFolder(mFolders, id);
+ Uri uri = Uri.parse(c.getString(uriIndex));
- intentDescription = c.getString(intentIndex);
- intent = null;
- if (intentDescription != null) {
- try {
- intent = Intent.parseUri(intentDescription, 0);
- } catch (URISyntaxException e) {
- // Ignore, a live folder might not have a base intent
+ // Make sure the live folder exists
+ final ProviderInfo providerInfo =
+ context.getPackageManager().resolveContentProvider(
+ uri.getAuthority(), 0);
+
+ if (providerInfo == null && !isSafeMode) {
+ itemsToRemove.add(id);
+ } else {
+ LiveFolderInfo liveFolderInfo = findOrMakeLiveFolder(mFolders, id);
+
+ intentDescription = c.getString(intentIndex);
+ intent = null;
+ if (intentDescription != null) {
+ try {
+ intent = Intent.parseUri(intentDescription, 0);
+ } catch (URISyntaxException e) {
+ // Ignore, a live folder might not have a base intent
+ }
}
+
+ liveFolderInfo.title = c.getString(titleIndex);
+ liveFolderInfo.id = id;
+ liveFolderInfo.uri = uri;
+ container = c.getInt(containerIndex);
+ liveFolderInfo.container = container;
+ liveFolderInfo.screen = c.getInt(screenIndex);
+ liveFolderInfo.cellX = c.getInt(cellXIndex);
+ liveFolderInfo.cellY = c.getInt(cellYIndex);
+ liveFolderInfo.baseIntent = intent;
+ liveFolderInfo.displayMode = c.getInt(displayModeIndex);
+
+ loadLiveFolderIcon(context, c, iconTypeIndex, iconPackageIndex,
+ iconResourceIndex, liveFolderInfo);
+
+ switch (container) {
+ case LauncherSettings.Favorites.CONTAINER_DESKTOP:
+ mItems.add(liveFolderInfo);
+ break;
+ }
+ mFolders.put(liveFolderInfo.id, liveFolderInfo);
}
-
- liveFolderInfo.title = c.getString(titleIndex);
- liveFolderInfo.id = id;
- container = c.getInt(containerIndex);
- liveFolderInfo.container = container;
- liveFolderInfo.screen = c.getInt(screenIndex);
- liveFolderInfo.cellX = c.getInt(cellXIndex);
- liveFolderInfo.cellY = c.getInt(cellYIndex);
- liveFolderInfo.uri = Uri.parse(c.getString(uriIndex));
- liveFolderInfo.baseIntent = intent;
- liveFolderInfo.displayMode = c.getInt(displayModeIndex);
-
- loadLiveFolderIcon(context, c, iconTypeIndex, iconPackageIndex,
- iconResourceIndex, liveFolderInfo);
-
- switch (container) {
- case LauncherSettings.Favorites.CONTAINER_DESKTOP:
- mItems.add(liveFolderInfo);
- break;
- }
- mFolders.put(liveFolderInfo.id, liveFolderInfo);
- break;
-
- case LauncherSettings.Favorites.ITEM_TYPE_WIDGET_SEARCH:
- widgetInfo = Widget.makeSearch();
-
- container = c.getInt(containerIndex);
- if (container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
- Log.e(TAG, "Widget found where container "
- + "!= CONTAINER_DESKTOP ignoring!");
- continue;
- }
-
- widgetInfo.id = c.getLong(idIndex);
- widgetInfo.screen = c.getInt(screenIndex);
- widgetInfo.container = container;
- widgetInfo.cellX = c.getInt(cellXIndex);
- widgetInfo.cellY = c.getInt(cellYIndex);
-
- mItems.add(widgetInfo);
break;
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
// Read all Launcher-specific widget details
int appWidgetId = c.getInt(appWidgetIdIndex);
- appWidgetInfo = new LauncherAppWidgetInfo(appWidgetId);
- appWidgetInfo.id = c.getLong(idIndex);
- appWidgetInfo.screen = c.getInt(screenIndex);
- appWidgetInfo.cellX = c.getInt(cellXIndex);
- appWidgetInfo.cellY = c.getInt(cellYIndex);
- appWidgetInfo.spanX = c.getInt(spanXIndex);
- appWidgetInfo.spanY = c.getInt(spanYIndex);
+ id = c.getLong(idIndex);
- container = c.getInt(containerIndex);
- if (container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
- Log.e(TAG, "Widget found where container "
- + "!= CONTAINER_DESKTOP -- ignoring!");
- continue;
+ final AppWidgetProviderInfo provider =
+ widgets.getAppWidgetInfo(appWidgetId);
+
+ if (!isSafeMode && (provider == null || provider.provider == null ||
+ provider.provider.getPackageName() == null)) {
+ itemsToRemove.add(id);
+ } else {
+ appWidgetInfo = new LauncherAppWidgetInfo(appWidgetId);
+ appWidgetInfo.id = id;
+ appWidgetInfo.screen = c.getInt(screenIndex);
+ appWidgetInfo.cellX = c.getInt(cellXIndex);
+ appWidgetInfo.cellY = c.getInt(cellYIndex);
+ appWidgetInfo.spanX = c.getInt(spanXIndex);
+ appWidgetInfo.spanY = c.getInt(spanYIndex);
+
+ container = c.getInt(containerIndex);
+ if (container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ Log.e(TAG, "Widget found where container "
+ + "!= CONTAINER_DESKTOP -- ignoring!");
+ continue;
+ }
+ appWidgetInfo.container = c.getInt(containerIndex);
+
+ mAppWidgets.add(appWidgetInfo);
}
- appWidgetInfo.container = c.getInt(containerIndex);
-
- mAppWidgets.add(appWidgetInfo);
break;
}
} catch (Exception e) {
@@ -818,6 +827,25 @@
} finally {
c.close();
}
+
+ if (itemsToRemove.size() > 0) {
+ ContentProviderClient client = contentResolver.acquireContentProviderClient(
+ LauncherSettings.Favorites.CONTENT_URI);
+ // Remove dead items
+ for (long id : itemsToRemove) {
+ if (DEBUG_LOADERS) {
+ Log.d(TAG, "Removed id = " + id);
+ }
+ // Don't notify content observers
+ try {
+ client.delete(LauncherSettings.Favorites.getContentUri(id, false),
+ null, null);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Could not remove id = " + id);
+ }
+ }
+ }
+
if (DEBUG_LOADERS) {
Log.d(TAG, "loaded workspace in " + (SystemClock.uptimeMillis()-t) + "ms");
}
@@ -976,7 +1004,7 @@
private void bindAllApps() {
synchronized (mLock) {
final ArrayList<ApplicationInfo> results
- = (ArrayList<ApplicationInfo>)mAllAppsList.data.clone();
+ = (ArrayList<ApplicationInfo>) mAllAppsList.data.clone();
// We're adding this now, so clear out this so we don't re-send them.
mAllAppsList.added = new ArrayList<ApplicationInfo>();
mHandler.post(new Runnable() {
@@ -991,7 +1019,7 @@
if (DEBUG_LOADERS) {
Log.d(TAG, "bound app " + count + " icons in "
- + (SystemClock.uptimeMillis()-t) + "ms");
+ + (SystemClock.uptimeMillis() - t) + "ms");
}
}
});
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index c3ceefd..f03e50c 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -16,8 +16,10 @@
package com.android.launcher2;
+import android.app.SearchManager;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProviderInfo;
import android.content.ContentProvider;
import android.content.Context;
import android.content.ContentValues;
@@ -46,10 +48,11 @@
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
+import java.util.List;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParser;
-import com.android.internal.util.XmlUtils;
+import com.android.common.XmlUtils;
import com.android.launcher2.LauncherSettings.Favorites;
public class LauncherProvider extends ContentProvider {
@@ -58,7 +61,7 @@
private static final String DATABASE_NAME = "launcher.db";
- private static final int DATABASE_VERSION = 6;
+ private static final int DATABASE_VERSION = 7;
static final String AUTHORITY = "com.android.launcher2.settings";
@@ -382,7 +385,13 @@
version = 6;
}
}
-
+
+ if (version < 7) {
+ // Version 7 gets rid of the special search widget.
+ convertWidgets(db);
+ version = 7;
+ }
+
if (version != DATABASE_VERSION) {
Log.w(TAG, "Destroying all old data.");
db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES);
@@ -459,30 +468,24 @@
/**
* Upgrade existing clock and photo frame widgets into their new widget
- * equivalents. This method allocates appWidgetIds, and then hands off to
- * LauncherAppWidgetBinder to finish the actual binding.
+ * equivalents.
*/
private void convertWidgets(SQLiteDatabase db) {
+ final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext);
final int[] bindSources = new int[] {
Favorites.ITEM_TYPE_WIDGET_CLOCK,
Favorites.ITEM_TYPE_WIDGET_PHOTO_FRAME,
+ Favorites.ITEM_TYPE_WIDGET_SEARCH,
};
-
- final ArrayList<ComponentName> bindTargets = new ArrayList<ComponentName>();
- bindTargets.add(new ComponentName("com.android.alarmclock",
- "com.android.alarmclock.AnalogAppWidgetProvider"));
- bindTargets.add(new ComponentName("com.android.camera",
- "com.android.camera.PhotoAppWidgetProvider"));
-
+
final String selectWhere = buildOrWhereString(Favorites.ITEM_TYPE, bindSources);
Cursor c = null;
- boolean allocatedAppWidgets = false;
db.beginTransaction();
try {
// Select and iterate through each matching widget
- c = db.query(TABLE_FAVORITES, new String[] { Favorites._ID },
+ c = db.query(TABLE_FAVORITES, new String[] { Favorites._ID, Favorites.ITEM_TYPE },
selectWhere, null, null, null, null);
if (LOGD) Log.d(TAG, "found upgrade cursor count=" + c.getCount());
@@ -490,7 +493,8 @@
final ContentValues values = new ContentValues();
while (c != null && c.moveToNext()) {
long favoriteId = c.getLong(0);
-
+ int favoriteType = c.getInt(1);
+
// Allocate and update database with new appWidgetId
try {
int appWidgetId = mAppWidgetHost.allocateAppWidgetId();
@@ -499,18 +503,35 @@
Log.d(TAG, "allocated appWidgetId=" + appWidgetId
+ " for favoriteId=" + favoriteId);
}
-
values.clear();
- values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId);
-
+ values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_APPWIDGET);
+ values.put(Favorites.APPWIDGET_ID, appWidgetId);
+
// Original widgets might not have valid spans when upgrading
- values.put(LauncherSettings.Favorites.SPANX, 2);
- values.put(LauncherSettings.Favorites.SPANY, 2);
+ if (favoriteType == Favorites.ITEM_TYPE_WIDGET_SEARCH) {
+ values.put(LauncherSettings.Favorites.SPANX, 4);
+ values.put(LauncherSettings.Favorites.SPANY, 1);
+ } else {
+ values.put(LauncherSettings.Favorites.SPANX, 2);
+ values.put(LauncherSettings.Favorites.SPANY, 2);
+ }
String updateWhere = Favorites._ID + "=" + favoriteId;
db.update(TABLE_FAVORITES, values, updateWhere, null);
-
- allocatedAppWidgets = true;
+
+ ComponentName cn = null;
+ if (favoriteType == Favorites.ITEM_TYPE_WIDGET_CLOCK) {
+ appWidgetManager.bindAppWidgetId(appWidgetId,
+ new ComponentName("com.android.alarmclock",
+ "com.android.alarmclock.AnalogAppWidgetProvider"));
+ } else if (favoriteType == Favorites.ITEM_TYPE_WIDGET_PHOTO_FRAME) {
+ appWidgetManager.bindAppWidgetId(appWidgetId,
+ new ComponentName("com.android.camera",
+ "com.android.camera.PhotoAppWidgetProvider"));
+ } else if (favoriteType == Favorites.ITEM_TYPE_WIDGET_SEARCH) {
+ appWidgetManager.bindAppWidgetId(appWidgetId,
+ getSearchWidgetProvider());
+ }
} catch (RuntimeException ex) {
Log.e(TAG, "Problem allocating appWidgetId", ex);
}
@@ -525,34 +546,9 @@
c.close();
}
}
-
- // If any appWidgetIds allocated, then launch over to binder
- if (allocatedAppWidgets) {
- launchAppWidgetBinder(bindSources, bindTargets);
- }
}
/**
- * Launch the widget binder that walks through the Launcher database,
- * binding any matching widgets to the corresponding targets. We can't
- * bind ourselves because our parent process can't obtain the
- * BIND_APPWIDGET permission.
- */
- private void launchAppWidgetBinder(int[] bindSources, ArrayList<ComponentName> bindTargets) {
- final Intent intent = new Intent();
- intent.setComponent(new ComponentName("com.android.settings",
- "com.android.settings.LauncherAppWidgetBinder"));
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
- final Bundle extras = new Bundle();
- extras.putIntArray(EXTRA_BIND_SOURCES, bindSources);
- extras.putParcelableArrayList(EXTRA_BIND_TARGETS, bindTargets);
- intent.putExtras(extras);
-
- mContext.startActivity(intent);
- }
-
- /**
* Loads the default set of favorite packages from an xml file.
*
* @param db The database to write the values into
@@ -645,48 +641,41 @@
return true;
}
- private boolean addSearchWidget(SQLiteDatabase db, ContentValues values) {
- // Add a search box
- values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_WIDGET_SEARCH);
- values.put(Favorites.SPANX, 4);
- values.put(Favorites.SPANY, 1);
- db.insert(TABLE_FAVORITES, null, values);
+ private ComponentName getSearchWidgetProvider() {
+ SearchManager searchManager =
+ (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
+ ComponentName searchComponent = searchManager.getGlobalSearchActivity();
+ if (searchComponent == null) return null;
+ return getProviderInPackage(searchComponent.getPackageName());
+ }
- return true;
+ /**
+ * Gets an appwidget provider from the given package. If the package contains more than
+ * one appwidget provider, an arbitrary one is returned.
+ */
+ private ComponentName getProviderInPackage(String packageName) {
+ AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext);
+ List<AppWidgetProviderInfo> providers = appWidgetManager.getInstalledProviders();
+ if (providers == null) return null;
+ final int providerCount = providers.size();
+ for (int i = 0; i < providerCount; i++) {
+ ComponentName provider = providers.get(i).provider;
+ if (provider != null && provider.getPackageName().equals(packageName)) {
+ return provider;
+ }
+ }
+ return null;
+ }
+
+ private boolean addSearchWidget(SQLiteDatabase db, ContentValues values) {
+ ComponentName cn = getSearchWidgetProvider();
+ return addAppWidget(db, values, cn, 4, 1);
}
private boolean addClockWidget(SQLiteDatabase db, ContentValues values) {
- final int[] bindSources = new int[] {
- Favorites.ITEM_TYPE_WIDGET_CLOCK,
- };
-
- final ArrayList<ComponentName> bindTargets = new ArrayList<ComponentName>();
- bindTargets.add(new ComponentName("com.android.alarmclock",
- "com.android.alarmclock.AnalogAppWidgetProvider"));
-
- boolean allocatedAppWidgets = false;
-
- // Try binding to an analog clock widget
- try {
- int appWidgetId = mAppWidgetHost.allocateAppWidgetId();
-
- values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_WIDGET_CLOCK);
- values.put(Favorites.SPANX, 2);
- values.put(Favorites.SPANY, 2);
- values.put(Favorites.APPWIDGET_ID, appWidgetId);
- db.insert(TABLE_FAVORITES, null, values);
-
- allocatedAppWidgets = true;
- } catch (RuntimeException ex) {
- Log.e(TAG, "Problem allocating appWidgetId", ex);
- }
-
- // If any appWidgetIds allocated, then launch over to binder
- if (allocatedAppWidgets) {
- launchAppWidgetBinder(bindSources, bindTargets);
- }
-
- return allocatedAppWidgets;
+ ComponentName cn = new ComponentName("com.android.alarmclock",
+ "com.android.alarmclock.AnalogAppWidgetProvider");
+ return addAppWidget(db, values, cn, 2, 2);
}
private boolean addAppWidget(SQLiteDatabase db, ContentValues values, TypedArray a) {
@@ -698,7 +687,13 @@
}
ComponentName cn = new ComponentName(packageName, className);
-
+ int spanX = a.getInt(R.styleable.Favorite_spanX, 0);
+ int spanY = a.getInt(R.styleable.Favorite_spanY, 0);
+ return addAppWidget(db, values, cn, spanX, spanY);
+ }
+
+ private boolean addAppWidget(SQLiteDatabase db, ContentValues values, ComponentName cn,
+ int spanX, int spanY) {
boolean allocatedAppWidgets = false;
final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext);
@@ -706,8 +701,8 @@
int appWidgetId = mAppWidgetHost.allocateAppWidgetId();
values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_APPWIDGET);
- values.put(Favorites.SPANX, a.getString(R.styleable.Favorite_spanX));
- values.put(Favorites.SPANY, a.getString(R.styleable.Favorite_spanY));
+ values.put(Favorites.SPANX, spanX);
+ values.put(Favorites.SPANY, spanY);
values.put(Favorites.APPWIDGET_ID, appWidgetId);
db.insert(TABLE_FAVORITES, null, values);
diff --git a/src/com/android/launcher2/LauncherSettings.java b/src/com/android/launcher2/LauncherSettings.java
index a438d47..9c685ce 100644
--- a/src/com/android/launcher2/LauncherSettings.java
+++ b/src/com/android/launcher2/LauncherSettings.java
@@ -91,8 +91,7 @@
}
/**
- * Favorites. When changing these values, be sure to update
- * {@link com.android.settings.LauncherAppWidgetBinder} as needed.
+ * Favorites.
*/
static final class Favorites implements BaseLauncherColumns {
/**
diff --git a/src/com/android/launcher2/Search.java b/src/com/android/launcher2/Search.java
deleted file mode 100644
index 283042d..0000000
--- a/src/com/android/launcher2/Search.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.launcher2;
-
-import android.app.Activity;
-import android.content.ActivityNotFoundException;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.res.Configuration;
-import android.graphics.drawable.Drawable;
-import android.os.Bundle;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnKeyListener;
-import android.view.View.OnLongClickListener;
-import android.view.animation.AccelerateDecelerateInterpolator;
-import android.view.animation.Animation;
-import android.view.animation.Interpolator;
-import android.view.animation.Transformation;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.ImageButton;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-public class Search extends LinearLayout
- implements OnClickListener, OnKeyListener, OnLongClickListener {
-
- // Speed at which the widget slides up/down, in pixels/ms.
- private static final float ANIMATION_VELOCITY = 1.0f;
-
- /** The distance in dips between the optical top of the widget and the top if its bounds */
- private static final float WIDGET_TOP_OFFSET = 9;
-
-
- private final String TAG = "Launcher.SearchWidget";
-
- private Launcher mLauncher;
-
- private TextView mSearchText;
- private ImageButton mVoiceButton;
-
- /** The animation that morphs the search widget to the search dialog. */
- private Animation mMorphAnimation;
-
- /** The animation that morphs the search widget back to its normal position. */
- private Animation mUnmorphAnimation;
-
- // These four are passed to Launcher.startSearch() when the search widget
- // has finished morphing. They are instance variables to make it possible to update
- // them while the widget is morphing.
- private String mInitialQuery;
- private boolean mSelectInitialQuery;
- private Bundle mAppSearchData;
- private boolean mGlobalSearch;
-
- // For voice searching
- private Intent mVoiceSearchIntent;
-
- private int mWidgetTopOffset;
-
- /**
- * Used to inflate the Workspace from XML.
- *
- * @param context The application's context.
- * @param attrs The attributes set containing the Workspace's customization values.
- */
- public Search(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- final float scale = context.getResources().getDisplayMetrics().density;
- mWidgetTopOffset = Math.round(WIDGET_TOP_OFFSET * scale);
-
- Interpolator interpolator = new AccelerateDecelerateInterpolator();
-
- mMorphAnimation = new ToParentOriginAnimation();
- // no need to apply transformation before the animation starts,
- // since the gadget is already in its normal place.
- mMorphAnimation.setFillBefore(false);
- // stay in the top position after the animation finishes
- mMorphAnimation.setFillAfter(true);
- mMorphAnimation.setInterpolator(interpolator);
- mMorphAnimation.setAnimationListener(new Animation.AnimationListener() {
- // The amount of time before the animation ends to show the search dialog.
- private static final long TIME_BEFORE_ANIMATION_END = 80;
-
- // The runnable which we'll pass to our handler to show the search dialog.
- private final Runnable mShowSearchDialogRunnable = new Runnable() {
- public void run() {
- showSearchDialog();
- }
- };
-
- public void onAnimationEnd(Animation animation) { }
- public void onAnimationRepeat(Animation animation) { }
- public void onAnimationStart(Animation animation) {
- // Make the search dialog show up ideally *just* as the animation reaches
- // the top, to aid the illusion that the widget becomes the search dialog.
- // Otherwise, there is a short delay when the widget reaches the top before
- // the search dialog shows. We do this roughly 80ms before the animation ends.
- getHandler().postDelayed(
- mShowSearchDialogRunnable,
- Math.max(mMorphAnimation.getDuration() - TIME_BEFORE_ANIMATION_END, 0));
- }
- });
-
- mUnmorphAnimation = new FromParentOriginAnimation();
- // stay in the top position until the animation starts
- mUnmorphAnimation.setFillBefore(true);
- // no need to apply transformation after the animation finishes,
- // since the gadget is now back in its normal place.
- mUnmorphAnimation.setFillAfter(false);
- mUnmorphAnimation.setInterpolator(interpolator);
- mUnmorphAnimation.setAnimationListener(new Animation.AnimationListener(){
- public void onAnimationEnd(Animation animation) {
- clearAnimation();
- }
- public void onAnimationRepeat(Animation animation) { }
- public void onAnimationStart(Animation animation) { }
- });
-
- mVoiceSearchIntent = new Intent(android.speech.RecognizerIntent.ACTION_WEB_SEARCH);
- mVoiceSearchIntent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL,
- android.speech.RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
- }
-
- /**
- * Implements OnClickListener.
- */
- public void onClick(View v) {
- if (v == mVoiceButton) {
- startVoiceSearch();
- } else {
- mLauncher.onSearchRequested();
- }
- }
-
- private void startVoiceSearch() {
- try {
- getContext().startActivity(mVoiceSearchIntent);
- } catch (ActivityNotFoundException ex) {
- // Should not happen, since we check the availability of
- // voice search before showing the button. But just in case...
- Log.w(TAG, "Could not find voice search activity");
- }
- }
-
- /**
- * Sets the query text. The query field is not editable, instead we forward
- * the key events to the launcher, which keeps track of the text,
- * calls setQuery() to show it, and gives it to the search dialog.
- */
- public void setQuery(String query) {
- mSearchText.setText(query, TextView.BufferType.NORMAL);
- }
-
- /**
- * Morph the search gadget to the search dialog.
- * See {@link Activity#startSearch()} for the arguments.
- */
- public void startSearch(String initialQuery, boolean selectInitialQuery,
- Bundle appSearchData, boolean globalSearch) {
- mInitialQuery = initialQuery;
- mSelectInitialQuery = selectInitialQuery;
- mAppSearchData = appSearchData;
- mGlobalSearch = globalSearch;
-
- if (isAtTop()) {
- showSearchDialog();
- } else {
- // Call up the keyboard before we actually call the search dialog so that it
- // (hopefully) animates in at about the same time as the widget animation, and
- // so that it becomes available as soon as possible. Only do this if a hard
- // keyboard is not currently available.
- if (getContext().getResources().getConfiguration().hardKeyboardHidden ==
- Configuration.HARDKEYBOARDHIDDEN_YES) {
- InputMethodManager inputManager = (InputMethodManager)
- getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- inputManager.showSoftInputUnchecked(0, null);
- }
-
- // Start the animation, unless it has already started.
- if (getAnimation() != mMorphAnimation) {
- mMorphAnimation.setDuration(getAnimationDuration());
- startAnimation(mMorphAnimation);
- }
- }
- }
-
- /**
- * Shows the system search dialog immediately, without any animation.
- */
- private void showSearchDialog() {
- mLauncher.showSearchDialog(
- mInitialQuery, mSelectInitialQuery, mAppSearchData, mGlobalSearch);
- }
-
- /**
- * Restore the search gadget to its normal position.
- *
- * @param animate Whether to animate the movement of the gadget.
- */
- public void stopSearch(boolean animate) {
- setQuery("");
-
- // Only restore if we are not already restored.
- if (getAnimation() == mMorphAnimation) {
- if (animate && !isAtTop()) {
- mUnmorphAnimation.setDuration(getAnimationDuration());
- startAnimation(mUnmorphAnimation);
- } else {
- clearAnimation();
- }
- }
- }
-
- private boolean isAtTop() {
- return getWidgetTop() == 0;
- }
-
- private int getAnimationDuration() {
- return (int) (getWidgetTop() / ANIMATION_VELOCITY);
- }
-
- /**
- * Modify clearAnimation() to invalidate the parent. This works around
- * an issue where the region where the end of the animation placed the view
- * was not redrawn after clearing the animation.
- */
- @Override
- public void clearAnimation() {
- Animation animation = getAnimation();
- if (animation != null) {
- super.clearAnimation();
- if (animation.hasEnded()
- && animation.getFillAfter()
- && animation.willChangeBounds()) {
- View parent = (View) getParent();
- if (parent != null) parent.invalidate();
- } else {
- invalidate();
- }
- }
- }
-
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- if (!event.isSystem() &&
- (keyCode != KeyEvent.KEYCODE_DPAD_UP) &&
- (keyCode != KeyEvent.KEYCODE_DPAD_DOWN) &&
- (keyCode != KeyEvent.KEYCODE_DPAD_LEFT) &&
- (keyCode != KeyEvent.KEYCODE_DPAD_RIGHT) &&
- (keyCode != KeyEvent.KEYCODE_DPAD_CENTER)) {
- // Forward key events to Launcher, which will forward text
- // to search dialog
- switch (event.getAction()) {
- case KeyEvent.ACTION_DOWN:
- return mLauncher.onKeyDown(keyCode, event);
- case KeyEvent.ACTION_MULTIPLE:
- return mLauncher.onKeyMultiple(keyCode, event.getRepeatCount(), event);
- case KeyEvent.ACTION_UP:
- return mLauncher.onKeyUp(keyCode, event);
- }
- }
- return false;
- }
-
- /**
- * Implements OnLongClickListener to pass long clicks on child views
- * to the widget. This makes it possible to pick up the widget by long
- * clicking on the text field or a button.
- */
- public boolean onLongClick(View v) {
- return performLongClick();
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
-
- mSearchText = (TextView) findViewById(R.id.search_src_text);
- mVoiceButton = (ImageButton) findViewById(R.id.search_voice_btn);
-
- mSearchText.setOnKeyListener(this);
-
- mSearchText.setOnClickListener(this);
- mVoiceButton.setOnClickListener(this);
- setOnClickListener(this);
-
- mSearchText.setOnLongClickListener(this);
- mVoiceButton.setOnLongClickListener(this);
-
- // Set the placeholder text to be the Google logo within the search widget.
- Drawable googlePlaceholder =
- getContext().getResources().getDrawable(R.drawable.placeholder_google);
- mSearchText.setCompoundDrawablesWithIntrinsicBounds(googlePlaceholder, null, null, null);
-
- configureVoiceSearchButton();
- }
-
- @Override
- public void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- }
-
- /**
- * If appropriate & available, configure voice search
- *
- * Note: Because the home screen search widget is always web search, we only check for
- * getVoiceSearchLaunchWebSearch() modes. We don't support the alternate form of app-specific
- * voice search.
- */
- private void configureVoiceSearchButton() {
- // Enable the voice search button if there is an activity that can handle it
- PackageManager pm = getContext().getPackageManager();
- ResolveInfo ri = pm.resolveActivity(mVoiceSearchIntent,
- PackageManager.MATCH_DEFAULT_ONLY);
- boolean voiceSearchVisible = ri != null;
-
- // finally, set visible state of voice search button, as appropriate
- mVoiceButton.setVisibility(voiceSearchVisible ? View.VISIBLE : View.GONE);
- }
-
- /**
- * Sets the {@link Launcher} that this gadget will call on to display the search dialog.
- */
- public void setLauncher(Launcher launcher) {
- mLauncher = launcher;
- }
-
- /**
- * Moves the view to the top left corner of its parent.
- */
- private class ToParentOriginAnimation extends Animation {
- @Override
- protected void applyTransformation(float interpolatedTime, Transformation t) {
- float dx = -getLeft() * interpolatedTime;
- float dy = -getWidgetTop() * interpolatedTime;
- t.getMatrix().setTranslate(dx, dy);
- }
- }
-
- /**
- * Moves the view from the top left corner of its parent.
- */
- private class FromParentOriginAnimation extends Animation {
- @Override
- protected void applyTransformation(float interpolatedTime, Transformation t) {
- float dx = -getLeft() * (1.0f - interpolatedTime);
- float dy = -getWidgetTop() * (1.0f - interpolatedTime);
- t.getMatrix().setTranslate(dx, dy);
- }
- }
-
- /**
- * The widget is centered vertically within it's 4x1 slot. This is accomplished by nesting
- * the actual widget inside another view. For animation purposes, we care about the top of the
- * actual widget rather than it's container. This method return the top of the actual widget.
- */
- private int getWidgetTop() {
- return getTop() + getChildAt(0).getTop() + mWidgetTopOffset;
- }
-}
diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java
index 2dfba43..94e281b 100644
--- a/src/com/android/launcher2/Utilities.java
+++ b/src/com/android/launcher2/Utilities.java
@@ -52,10 +52,6 @@
private static int sIconTextureWidth = -1;
private static int sIconTextureHeight = -1;
- private static int sTitleMargin = -1;
- private static float sBlurRadius = -1;
- private static Rect sIconTextureRect;
-
private static final Paint sPaint = new Paint();
private static final Paint sBlurPaint = new Paint();
private static final Paint sGlowColorPressedPaint = new Paint();
@@ -179,8 +175,7 @@
* Returns a bitmap suitable for the all apps view. The bitmap will be a power
* of two sized ARGB_8888 bitmap that can be used as a gl texture.
*/
- static Bitmap createAllAppsBitmap(Drawable icon, String title, BubbleText bubble,
- Context context) {
+ static Bitmap createAllAppsBitmap(Drawable icon, Context context) {
synchronized (sCanvas) { // we share the statics :-(
if (sIconWidth == -1) {
initStatics(context);
@@ -222,8 +217,8 @@
}
// no intrinsic size --> use default size
- final int textureWidth = sIconTextureWidth;
- final int textureHeight = sIconTextureHeight;
+ int textureWidth = sIconTextureWidth;
+ int textureHeight = sIconTextureHeight;
final Bitmap bitmap = Bitmap.createBitmap(textureWidth, textureHeight,
Bitmap.Config.ARGB_8888);
@@ -231,7 +226,7 @@
canvas.setBitmap(bitmap);
final int left = (textureWidth-width) / 2;
- final int top = sIconTextureRect.top;
+ final int top = (textureHeight-height) / 2;
if (false) {
// draw a big box for the icon for debugging
@@ -247,34 +242,12 @@
icon.draw(canvas);
icon.setBounds(sOldBounds);
- if (title != null) {
- bubble.drawText(canvas, title);
- }
-
return bitmap;
}
}
- static Bitmap extractIconFromTexture(Bitmap src, Context context) {
- synchronized (sCanvas) { // we share the statics :-(
- if (sIconWidth == -1) {
- initStatics(context);
- }
- final Bitmap bitmap = Bitmap.createBitmap(sIconWidth, sIconHeight,
- Bitmap.Config.ARGB_8888);
- final Canvas canvas = sCanvas;
- canvas.setBitmap(bitmap);
-
- Rect r = new Rect(0, 0, sIconWidth, sIconHeight);
- canvas.drawColor(0, PorterDuff.Mode.CLEAR);
- canvas.drawBitmap(src, sIconTextureRect, r, sEmptyPaint);
-
- return bitmap;
- }
- }
-
- static void drawSelectedAllAppsBitmap(Canvas dest, Bitmap destBitmap,
- int destWidth, int destHeight, boolean pressed, Bitmap src) {
+ static void drawSelectedAllAppsBitmap(Canvas dest, int destWidth, int destHeight,
+ boolean pressed, Bitmap src) {
synchronized (sCanvas) { // we share the statics :-(
if (sIconWidth == -1) {
// We can't have gotten to here without src being initialized, which
@@ -284,14 +257,12 @@
}
dest.drawColor(0, PorterDuff.Mode.CLEAR);
- dest.drawBitmap(src, sIconTextureRect, sIconTextureRect, sEmptyPaint);
int[] xy = new int[2];
- Bitmap mask = destBitmap.extractAlpha(sBlurPaint, xy);
+ Bitmap mask = src.extractAlpha(sBlurPaint, xy);
float px = (destWidth - src.getWidth()) / 2;
float py = (destHeight - src.getHeight()) / 2;
- dest.drawColor(0, PorterDuff.Mode.CLEAR);
dest.drawBitmap(mask, px + xy[0], py + xy[1],
pressed ? sGlowColorPressedPaint : sGlowColorFocusedPaint);
@@ -325,13 +296,13 @@
if (width > 0 && height > 0) {
if (width < bitmapWidth || height < bitmapHeight) {
final float ratio = (float) bitmapWidth / bitmapHeight;
-
+
if (bitmapWidth > bitmapHeight) {
height = (int) (width / ratio);
} else if (bitmapHeight > bitmapWidth) {
width = (int) (height * ratio);
}
-
+
final Bitmap.Config c = (width == sIconWidth && height == sIconHeight) ?
bitmap.getConfig() : Bitmap.Config.ARGB_8888;
final Bitmap thumb = Bitmap.createBitmap(sIconWidth, sIconHeight, c);
@@ -368,13 +339,7 @@
final float density = metrics.density;
sIconWidth = sIconHeight = (int) resources.getDimension(android.R.dimen.app_icon_size);
- sIconTextureWidth = sIconTextureHeight = roundToPow2(sIconWidth);
-
- sTitleMargin = (int)(1 * density);
- sBlurRadius = 5 * density;
- final int left = (sIconTextureWidth-sIconWidth)/2;
- final int top = (int)(sBlurRadius) + 1;
- sIconTextureRect = new Rect(left, top, left+sIconWidth, top+sIconHeight);
+ sIconTextureWidth = sIconTextureHeight = sIconWidth + 2;
sBlurPaint.setMaskFilter(new BlurMaskFilter(5 * density, BlurMaskFilter.Blur.NORMAL));
sGlowColorPressedPaint.setColor(0xffffc300);
@@ -399,65 +364,60 @@
private int mBitmapHeight;
BubbleText(Context context) {
- synchronized (sCanvas) { // we share the statics :-(
- if (sIconWidth == -1) {
- initStatics(context);
- }
- final Resources resources = context.getResources();
+ final Resources resources = context.getResources();
- final float scale = resources.getDisplayMetrics().density;
+ final float scale = resources.getDisplayMetrics().density;
- final float paddingLeft = 5.0f * scale;
- final float paddingRight = 5.0f * scale;
- final float cellWidth = resources.getDimension(R.dimen.workspace_cell_width);
- final float bubbleWidth = cellWidth - paddingLeft - paddingRight;
- mBubblePadding = 3.0f * scale;
+ final float paddingLeft = 5.0f * scale;
+ final float paddingRight = 5.0f * scale;
+ final float cellWidth = resources.getDimension(R.dimen.workspace_cell_width);
+ final float bubbleWidth = cellWidth - paddingLeft - paddingRight;
+ mBubblePadding = 3.0f * scale;
- RectF bubbleRect = mBubbleRect;
- bubbleRect.left = 0;
- bubbleRect.top = 0;
- bubbleRect.right = (int)(bubbleWidth+0.5f);
+ RectF bubbleRect = mBubbleRect;
+ bubbleRect.left = 0;
+ bubbleRect.top = 0;
+ bubbleRect.right = (int)(bubbleWidth+0.5f);
- mTextWidth = bubbleWidth - mBubblePadding - mBubblePadding;
+ mTextWidth = bubbleWidth - mBubblePadding - mBubblePadding;
- Paint rectPaint = new Paint();
- rectPaint.setColor(0xff000000);
- rectPaint.setAntiAlias(true);
+ Paint rectPaint = new Paint();
+ rectPaint.setColor(0xff000000);
+ rectPaint.setAntiAlias(true);
- TextPaint textPaint = mTextPaint = new TextPaint();
- textPaint.setTypeface(Typeface.DEFAULT);
- textPaint.setTextSize(13*scale);
- //textPaint.setColor(0xff00ff00);
- textPaint.setColor(0xffffffff);
- textPaint.setAntiAlias(true);
- if (TEXT_BURN) {
- textPaint.setShadowLayer(8, 0, 0, 0xff000000);
- }
+ TextPaint textPaint = mTextPaint = new TextPaint();
+ textPaint.setTypeface(Typeface.DEFAULT);
+ textPaint.setTextSize(13*scale);
+ textPaint.setColor(0xffffffff);
+ textPaint.setAntiAlias(true);
+ if (TEXT_BURN) {
+ textPaint.setShadowLayer(8, 0, 0, 0xff000000);
+ }
- final int iconTop = (int)(sBlurRadius) + 1;
- final int iconBottom = iconTop + sIconHeight;
+ float ascent = -textPaint.ascent();
+ float descent = textPaint.descent();
+ float leading = 0.0f;//(ascent+descent) * 0.1f;
+ mLeading = (int)(leading + 0.5f);
+ mFirstLineY = (int)(leading + ascent + 0.5f);
+ mLineHeight = (int)(leading + ascent + descent + 0.5f);
- float ascent = -textPaint.ascent();
- float descent = textPaint.descent();
- float leading = -1.0f;//(ascent+descent) * 0.1f;
- mLeading = (int)(leading + 0.5f);
- mFirstLineY = (int)(iconBottom + sTitleMargin + ascent + 0.5f);
- mLineHeight = (int)(leading + ascent + descent + 0.5f);
+ mBitmapWidth = roundToPow2((int)(mBubbleRect.width() + 0.5f));
+ mBitmapHeight = roundToPow2((int)((MAX_LINES * mLineHeight) + leading + 0.5f));
- mBitmapWidth = roundToPow2((int)(mBubbleRect.width() + 0.5f));
- mBitmapHeight = roundToPow2((int)((MAX_LINES * mLineHeight) + leading + 0.5f));
+ mBubbleRect.offsetTo((mBitmapWidth-mBubbleRect.width())/2, 0);
- mBubbleRect.offsetTo((mBitmapWidth-mBubbleRect.width())/2, 0);
-
- if (false) {
- Log.d(TAG, "mBitmapWidth=" + mBitmapWidth + " mBitmapHeight="
- + mBitmapHeight + " w=" + ((int)(mBubbleRect.width() + 0.5f))
- + " h=" + ((int)((MAX_LINES * mLineHeight) + leading + 0.5f)));
- }
+ if (false) {
+ Log.d(TAG, "mBitmapWidth=" + mBitmapWidth + " mBitmapHeight="
+ + mBitmapHeight + " w=" + ((int)(mBubbleRect.width() + 0.5f))
+ + " h=" + ((int)((MAX_LINES * mLineHeight) + leading + 0.5f)));
}
}
- void drawText(Canvas c, String text) {
+ /** You own the bitmap after this and you must call recycle on it. */
+ Bitmap createTextBitmap(String text) {
+ Bitmap b = Bitmap.createBitmap(mBitmapWidth, mBitmapHeight, Bitmap.Config.ALPHA_8);
+ Canvas c = new Canvas(b);
+
StaticLayout layout = new StaticLayout(text, mTextPaint, (int)mTextWidth,
Alignment.ALIGN_CENTER, 1, 0, true);
int lineCount = layout.getLineCount();
@@ -478,6 +438,8 @@
c.drawText(text.substring(layout.getLineStart(i), layout.getLineEnd(i)),
x, y, mTextPaint);
}
+
+ return b;
}
private int height(int lineCount) {
diff --git a/src/com/android/launcher2/Widget.java b/src/com/android/launcher2/Widget.java
deleted file mode 100644
index 348acee..0000000
--- a/src/com/android/launcher2/Widget.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.launcher2;
-
-import android.content.ContentValues;
-import android.graphics.Bitmap;
-
-/**
- * Represents one instance of a Launcher widget, such as search.
- */
-class Widget extends ItemInfo {
- int layoutResource;
-
- static Widget makeSearch() {
- Widget w = new Widget();
- w.itemType = LauncherSettings.Favorites.ITEM_TYPE_WIDGET_SEARCH;
- w.spanX = 4;
- w.spanY = 1;
- w.layoutResource = R.layout.widget_search;
- return w;
- }
-}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 9e32dd5..9abf562 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -17,19 +17,21 @@
package com.android.launcher2;
import android.app.WallpaperManager;
+import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.Intent;
import android.content.ComponentName;
+import android.content.pm.ProviderInfo;
import android.content.res.TypedArray;
import android.content.pm.PackageManager;
import android.graphics.Canvas;
-import android.graphics.RectF;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.net.Uri;
import android.os.Parcelable;
import android.os.Parcel;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
@@ -103,16 +105,9 @@
private int mTouchSlop;
private int mMaximumVelocity;
- final Rect mDrawerBounds = new Rect();
- final Rect mClipBounds = new Rect();
- int mDrawerContentHeight;
- int mDrawerContentWidth;
-
private Drawable mPreviousIndicator;
private Drawable mNextIndicator;
- private boolean mFading = true;
-
/**
* Used to inflate the Workspace from XML.
*
@@ -246,27 +241,6 @@
}
/**
- * Returns how many screens there are.
- */
- int getScreenCount() {
- return getChildCount();
- }
-
- /**
- * Computes a bounding rectangle for a range of cells
- *
- * @param cellX X coordinate of upper left corner expressed as a cell position
- * @param cellY Y coordinate of upper left corner expressed as a cell position
- * @param cellHSpan Width in cells
- * @param cellVSpan Height in cells
- * @param rect Rectnagle into which to put the results
- */
- public void cellToRect(int cellX, int cellY, int cellHSpan, int cellVSpan, RectF rect) {
- ((CellLayout)getChildAt(mCurrentScreen)).cellToRect(cellX, cellY,
- cellHSpan, cellVSpan, rect);
- }
-
- /**
* Sets the current screen.
*
* @param currentScreen
@@ -362,16 +336,6 @@
}
}
- void addWidget(View view, Widget widget) {
- addInScreen(view, widget.screen, widget.cellX, widget.cellY, widget.spanX,
- widget.spanY, false);
- }
-
- void addWidget(View view, Widget widget, boolean insert) {
- addInScreen(view, widget.screen, widget.cellX, widget.cellY, widget.spanX,
- widget.spanY, insert);
- }
-
CellLayout.CellInfo findAllVacantCells(boolean[] occupied) {
CellLayout group = (CellLayout) getChildAt(mCurrentScreen);
if (group != null) {
@@ -386,56 +350,6 @@
mVacantCache = null;
}
}
-
- /**
- * Returns the coordinate of a vacant cell for the current screen.
- */
- boolean getVacantCell(int[] vacant, int spanX, int spanY) {
- CellLayout group = (CellLayout) getChildAt(mCurrentScreen);
- if (group != null) {
- return group.getVacantCell(vacant, spanX, spanY);
- }
- return false;
- }
-
- /**
- * Adds the specified child in the current screen. The position and dimension of
- * the child are defined by x, y, spanX and spanY.
- *
- * @param child The child to add in one of the workspace's screens.
- * @param spanX The number of cells spanned horizontally by the child.
- * @param spanY The number of cells spanned vertically by the child.
- */
- void fitInCurrentScreen(View child, int spanX, int spanY) {
- fitInScreen(child, mCurrentScreen, spanX, spanY);
- }
-
- /**
- * Adds the specified child in the specified screen. The position and dimension of
- * the child are defined by x, y, spanX and spanY.
- *
- * @param child The child to add in one of the workspace's screens.
- * @param screen The screen in which to add the child.
- * @param spanX The number of cells spanned horizontally by the child.
- * @param spanY The number of cells spanned vertically by the child.
- */
- void fitInScreen(View child, int screen, int spanX, int spanY) {
- if (screen < 0 || screen >= getChildCount()) {
- throw new IllegalStateException("The screen must be >= 0 and < " + getChildCount());
- }
-
- final CellLayout group = (CellLayout) getChildAt(screen);
- boolean vacant = group.getVacantCell(mTempCell, spanX, spanY);
- if (vacant) {
- group.addView(child,
- new CellLayout.LayoutParams(mTempCell[0], mTempCell[1], spanX, spanY));
- child.setHapticFeedbackEnabled(false);
- child.setOnLongClickListener(mLongClickListener);
- if (child instanceof DropTarget) {
- mDragController.addDropTarget((DropTarget)child);
- }
- }
- }
/**
* Registers the specified listener on each screen contained in this workspace.
@@ -477,60 +391,17 @@
}
}
- public void startFading(boolean dest) {
- mFading = dest;
- invalidate();
- }
-
@Override
protected void dispatchDraw(Canvas canvas) {
- /*
- final boolean allAppsOpaque = mLauncher.isAllAppsOpaque();
- if (mFading == allAppsOpaque) {
- invalidate();
- } else {
- mFading = !allAppsOpaque;
- }
- if (allAppsOpaque) {
- // If the launcher is up, draw black.
- canvas.drawARGB(0xff, 0, 0, 0);
- return;
- }
- */
-
boolean restore = false;
int restoreCount = 0;
- // For the fade. If view gets setAlpha(), use that instead.
- float scale = mScale;
- if (scale < 0.999f) {
- int sx = mScrollX;
-
- int alpha = (scale < 0.5f) ? (int)(255 * 2 * scale) : 255;
-
- restoreCount = canvas.saveLayerAlpha(sx, 0, sx+getWidth(), getHeight(), alpha,
- Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG);
- restore = true;
-
- if (scale < 0.999f) {
- int w = getWidth();
- w += 2 * mCurrentScreen * w;
- int dx = w/2;
- int h = getHeight();
- int dy = (h/2) - (h/4);
- canvas.translate(dx, dy);
- canvas.scale(scale, scale);
- canvas.translate(-dx, -dy);
- }
- }
-
// ViewGroup.dispatchDraw() supports many features we don't need:
// clip to padding, layout animation, animation listener, disappearing
// children, etc. The following implementation attempts to fast-track
// the drawing dispatch by drawing only what we know needs to be drawn.
- boolean fastDraw = mTouchState != TOUCH_STATE_SCROLLING && mNextScreen == INVALID_SCREEN
- && scale > 0.999f;
+ boolean fastDraw = mTouchState != TOUCH_STATE_SCROLLING && mNextScreen == INVALID_SCREEN;
// If we are not scrolling or flinging, draw only the current screen
if (fastDraw) {
drawChild(canvas, getChildAt(mCurrentScreen), getDrawingTime());
@@ -555,12 +426,6 @@
}
}
- private float mScale = 1.0f;
- public void setScale(float scale) {
- mScale = scale;
- invalidate();
- }
-
protected void onAttachedToWindow() {
super.onAttachedToWindow();
mDragController.setWindowToken(getWindowToken());
@@ -970,6 +835,8 @@
final int delta = newX - mScrollX;
final int duration = screenDelta * 300;
awakenScrollBars(duration);
+
+ if (!mScroller.isFinished()) mScroller.abortAnimation();
mScroller.startScroll(mScrollX, 0, delta, 0, duration);
invalidate();
}
@@ -978,8 +845,7 @@
View child = cellInfo.cell;
// Make sure the drag was started by a long press as opposed to a long click.
- // Note that Search takes focus when clicked rather than entering touch mode
- if (!child.isInTouchMode() && !(child instanceof Search)) {
+ if (!child.isInTouchMode()) {
return;
}
@@ -1215,16 +1081,19 @@
public void scrollLeft() {
clearVacantCache();
- if (mNextScreen == INVALID_SCREEN && mCurrentScreen > 0 && mScroller.isFinished()) {
- snapToScreen(mCurrentScreen - 1);
+ if (mScroller.isFinished()) {
+ if (mCurrentScreen > 0) snapToScreen(mCurrentScreen - 1);
+ } else {
+ if (mNextScreen > 0) snapToScreen(mNextScreen - 1);
}
}
public void scrollRight() {
clearVacantCache();
- if (mNextScreen == INVALID_SCREEN && mCurrentScreen < getChildCount() -1 &&
- mScroller.isFinished()) {
- snapToScreen(mCurrentScreen + 1);
+ if (mScroller.isFinished()) {
+ if (mCurrentScreen < getChildCount() -1) snapToScreen(mCurrentScreen + 1);
+ } else {
+ if (mNextScreen < getChildCount() -1) snapToScreen(mNextScreen + 1);
}
}
@@ -1242,29 +1111,6 @@
return result;
}
- /**
- * Find a search widget on the given screen
- */
- private Search findSearchWidget(CellLayout screen) {
- final int count = screen.getChildCount();
- for (int i = 0; i < count; i++) {
- View v = screen.getChildAt(i);
- if (v instanceof Search) {
- return (Search) v;
- }
- }
- return null;
- }
-
- /**
- * Gets the first search widget on the current screen, if there is one.
- * Returns <code>null</code> otherwise.
- */
- public Search findSearchWidgetOnCurrentScreen() {
- CellLayout currentScreen = (CellLayout)getChildAt(mCurrentScreen);
- return findSearchWidget(currentScreen);
- }
-
public Folder getFolderForTag(Object tag) {
int screenCount = getChildCount();
for (int screen = 0; screen < screenCount; screen++) {
@@ -1314,74 +1160,106 @@
mAllowLongPress = allowLongPress;
}
- void removeShortcutsForPackage(String packageName) {
- final ArrayList<View> childrenToRemove = new ArrayList<View>();
+ void removeItemsForPackage(final String packageName) {
final int count = getChildCount();
+ final PackageManager manager = getContext().getPackageManager();
+ final AppWidgetManager widgets = AppWidgetManager.getInstance(getContext());
for (int i = 0; i < count; i++) {
final CellLayout layout = (CellLayout) getChildAt(i);
- int childCount = layout.getChildCount();
- childrenToRemove.clear();
+ // Avoid ANRs by treating each screen separately
+ post(new Runnable() {
+ public void run() {
+ final ArrayList<View> childrenToRemove = new ArrayList<View>();
+ childrenToRemove.clear();
+
+ int childCount = layout.getChildCount();
+ for (int j = 0; j < childCount; j++) {
+ final View view = layout.getChildAt(j);
+ Object tag = view.getTag();
+
+ if (tag instanceof ApplicationInfo) {
+ final ApplicationInfo info = (ApplicationInfo) tag;
+ // We need to check for ACTION_MAIN otherwise getComponent() might
+ // return null for some shortcuts (for instance, for shortcuts to
+ // web pages.)
+ final Intent intent = info.intent;
+ final ComponentName name = intent.getComponent();
+
+ if (Intent.ACTION_MAIN.equals(intent.getAction()) &&
+ name != null && packageName.equals(name.getPackageName())) {
+ // TODO: This should probably be done on a worker thread
+ LauncherModel.deleteItemFromDatabase(mLauncher, info);
+ childrenToRemove.add(view);
+ }
+ } else if (tag instanceof UserFolderInfo) {
+ final UserFolderInfo info = (UserFolderInfo) tag;
+ final ArrayList<ApplicationInfo> contents = info.contents;
+ final ArrayList<ApplicationInfo> toRemove =
+ new ArrayList<ApplicationInfo>(1);
+ final int contentsCount = contents.size();
+ boolean removedFromFolder = false;
+
+ for (int k = 0; k < contentsCount; k++) {
+ final ApplicationInfo appInfo = contents.get(k);
+ final Intent intent = appInfo.intent;
+ final ComponentName name = intent.getComponent();
+
+ if (Intent.ACTION_MAIN.equals(intent.getAction()) &&
+ name != null && packageName.equals(name.getPackageName())) {
+ toRemove.add(appInfo);
+ // TODO: This should probably be done on a worker thread
+ LauncherModel.deleteItemFromDatabase(mLauncher, appInfo);
+ removedFromFolder = true;
+ }
+ }
+
+ contents.removeAll(toRemove);
+ if (removedFromFolder) {
+ final Folder folder = getOpenFolder();
+ if (folder != null) folder.notifyDataSetChanged();
+ }
+ } else if (tag instanceof LiveFolderInfo) {
+ final LiveFolderInfo info = (LiveFolderInfo) tag;
+ final Uri uri = info.uri;
+ final ProviderInfo providerInfo = manager.resolveContentProvider(
+ uri.getAuthority(), 0);
- for (int j = 0; j < childCount; j++) {
- final View view = layout.getChildAt(j);
- Object tag = view.getTag();
-
- if (tag instanceof ApplicationInfo) {
- final ApplicationInfo info = (ApplicationInfo) tag;
- // We need to check for ACTION_MAIN otherwise getComponent() might
- // return null for some shortcuts (for instance, for shortcuts to
- // web pages.)
- final Intent intent = info.intent;
- final ComponentName name = intent.getComponent();
-
- if (Intent.ACTION_MAIN.equals(intent.getAction()) &&
- name != null && packageName.equals(name.getPackageName())) {
- LauncherModel.deleteItemFromDatabase(mLauncher, info);
- childrenToRemove.add(view);
- }
- } else if (tag instanceof UserFolderInfo) {
- final UserFolderInfo info = (UserFolderInfo) tag;
- final ArrayList<ApplicationInfo> contents = info.contents;
- final ArrayList<ApplicationInfo> toRemove = new ArrayList<ApplicationInfo>(1);
- final int contentsCount = contents.size();
- boolean removedFromFolder = false;
-
- for (int k = 0; k < contentsCount; k++) {
- final ApplicationInfo appInfo = contents.get(k);
- final Intent intent = appInfo.intent;
- final ComponentName name = intent.getComponent();
-
- if (Intent.ACTION_MAIN.equals(intent.getAction()) &&
- name != null && packageName.equals(name.getPackageName())) {
- toRemove.add(appInfo);
- LauncherModel.deleteItemFromDatabase(mLauncher, appInfo);
- removedFromFolder = true;
+ if (providerInfo == null ||
+ packageName.equals(providerInfo.packageName)) {
+ // TODO: This should probably be done on a worker thread
+ LauncherModel.deleteItemFromDatabase(mLauncher, info);
+ childrenToRemove.add(view);
+ }
+ } else if (tag instanceof LauncherAppWidgetInfo) {
+ final LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) tag;
+ final AppWidgetProviderInfo provider =
+ widgets.getAppWidgetInfo(info.appWidgetId);
+ if (provider == null ||
+ packageName.equals(provider.provider.getPackageName())) {
+ // TODO: This should probably be done on a worker thread
+ LauncherModel.deleteItemFromDatabase(mLauncher, info);
+ childrenToRemove.add(view);
+ }
}
}
-
- contents.removeAll(toRemove);
- if (removedFromFolder) {
- final Folder folder = getOpenFolder();
- if (folder != null) folder.notifyDataSetChanged();
+
+ childCount = childrenToRemove.size();
+ for (int j = 0; j < childCount; j++) {
+ View child = childrenToRemove.get(j);
+ layout.removeViewInLayout(child);
+ if (child instanceof DropTarget) {
+ mDragController.removeDropTarget((DropTarget)child);
+ }
+ }
+
+ if (childCount > 0) {
+ layout.requestLayout();
+ layout.invalidate();
}
}
- }
-
- childCount = childrenToRemove.size();
- for (int j = 0; j < childCount; j++) {
- View child = childrenToRemove.get(j);
- layout.removeViewInLayout(child);
- if (child instanceof DropTarget) {
- mDragController.removeDropTarget((DropTarget)child);
- }
- }
-
- if (childCount > 0) {
- layout.requestLayout();
- layout.invalidate();
- }
+ });
}
}
@@ -1465,11 +1343,4 @@
}
};
}
-
- void show() {
- setVisibility(VISIBLE);
- }
-
- void hide() {
- }
}