Merge "Fixing PagedView bad snap-back decisions" into ics-mr1
diff --git a/res/drawable-hdpi/bg_cling4.png b/res/drawable-hdpi/bg_cling4.png
new file mode 100644
index 0000000..9403667
--- /dev/null
+++ b/res/drawable-hdpi/bg_cling4.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_home_all_apps_holo_dark.png b/res/drawable-hdpi/ic_home_all_apps_holo_dark.png
index 1533a15..be2a880 100644
--- a/res/drawable-hdpi/ic_home_all_apps_holo_dark.png
+++ b/res/drawable-hdpi/ic_home_all_apps_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/bg_cling4.png b/res/drawable-mdpi/bg_cling4.png
new file mode 100644
index 0000000..2f152f4d
--- /dev/null
+++ b/res/drawable-mdpi/bg_cling4.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_home_all_apps_holo_dark.png b/res/drawable-mdpi/ic_home_all_apps_holo_dark.png
index ebbc792..3efe18e 100644
--- a/res/drawable-mdpi/ic_home_all_apps_holo_dark.png
+++ b/res/drawable-mdpi/ic_home_all_apps_holo_dark.png
Binary files differ
diff --git a/res/drawable-xhdpi/bg_cling4.png b/res/drawable-xhdpi/bg_cling4.png
new file mode 100644
index 0000000..f4bb83e
--- /dev/null
+++ b/res/drawable-xhdpi/bg_cling4.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_home_all_apps_holo_dark.png b/res/drawable-xhdpi/ic_home_all_apps_holo_dark.png
index 61d9b55..18c5a0a 100644
--- a/res/drawable-xhdpi/ic_home_all_apps_holo_dark.png
+++ b/res/drawable-xhdpi/ic_home_all_apps_holo_dark.png
Binary files differ
diff --git a/res/drawable/tab_widget_indicator_selector.xml b/res/drawable/tab_widget_indicator_selector.xml
index ff92b40..d06f757 100644
--- a/res/drawable/tab_widget_indicator_selector.xml
+++ b/res/drawable/tab_widget_indicator_selector.xml
@@ -16,7 +16,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
- <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_holo" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_holo" />
<!-- Focused states -->
diff --git a/res/layout-sw600dp-land/all_apps_cling.xml b/res/layout-sw600dp-land/all_apps_cling.xml
deleted file mode 100644
index bca7baf..0000000
--- a/res/layout-sw600dp-land/all_apps_cling.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.Cling
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- launcher:drawIdentifier="large_all_apps_landscape">
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="160dp"
- android:layout_marginLeft="200dp">
- <TextView
- style="@style/ClingTitleText"
- android:id="@+id/all_apps_cling_title"
- android:layout_marginTop="0dp"
- android:text="@string/all_apps_cling_title" />
- <TextView
- style="@style/ClingText"
- android:id="@+id/all_apps_cling_add_item"
- android:layout_width="340dp"
- android:layout_height="wrap_content"
- android:layout_marginTop="45dp"
- android:text="@string/all_apps_cling_add_item" />
- <Button
- style="@style/ClingButton"
- android:id="@+id/cling_dismiss"
- android:layout_marginTop="120dp"
- android:onClick="dismissAllAppsCling" />
- </FrameLayout>
-</com.android.launcher2.Cling>
\ No newline at end of file
diff --git a/res/layout-sw600dp-land/workspace_cling.xml b/res/layout-sw600dp-land/workspace_cling.xml
deleted file mode 100644
index 7175297..0000000
--- a/res/layout-sw600dp-land/workspace_cling.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.Cling
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- launcher:drawIdentifier="large_workspace_landscape">
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="260dp"
- android:layout_marginTop="30dp"
- android:layout_gravity="left|center_vertical">
- <TextView
- style="@style/ClingTitleText"
- android:id="@+id/workspace_cling_title"
- android:layout_marginTop="20dp"
- android:text="@string/workspace_cling_title" />
- <TextView
- style="@style/ClingText"
- android:id="@+id/workspace_cling_move_item"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="65dp"
- android:text="@string/workspace_cling_move_item" />
- <Button
- style="@style/ClingButton"
- android:id="@+id/cling_dismiss"
- android:layout_marginTop="95dp"
- android:onClick="dismissWorkspaceCling" />
- </FrameLayout>
- <TextView
- style="@style/ClingText"
- android:id="@+id/workspace_cling_open_all_apps"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:layout_gravity="right|top"
- android:layout_marginRight="160dp"
- android:layout_marginTop="30dp"
- android:gravity="left"
- android:text="@string/workspace_cling_open_all_apps" />
-</com.android.launcher2.Cling>
\ No newline at end of file
diff --git a/res/layout-sw600dp-port/all_apps_cling.xml b/res/layout-sw600dp-port/all_apps_cling.xml
deleted file mode 100644
index 507af51..0000000
--- a/res/layout-sw600dp-port/all_apps_cling.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.Cling
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- launcher:drawIdentifier="large_all_apps_portrait">
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="100dp"
- android:layout_marginLeft="0dp">
- <TextView
- style="@style/ClingTitleText"
- android:id="@+id/all_apps_cling_title"
- android:layout_marginTop="0dp"
- android:text="@string/all_apps_cling_title" />
- <TextView
- style="@style/ClingText"
- android:id="@+id/all_apps_cling_add_item"
- android:layout_width="340dp"
- android:layout_height="wrap_content"
- android:layout_marginTop="45dp"
- android:text="@string/all_apps_cling_add_item" />
- <Button
- style="@style/ClingButton"
- android:id="@+id/cling_dismiss"
- android:layout_marginTop="95dp"
- android:onClick="dismissAllAppsCling" />
- </FrameLayout>
-</com.android.launcher2.Cling>
\ No newline at end of file
diff --git a/res/layout-sw600dp-port/folder_cling.xml b/res/layout-sw600dp-port/folder_cling.xml
new file mode 100644
index 0000000..017d0fd
--- /dev/null
+++ b/res/layout-sw600dp-port/folder_cling.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.Cling
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ launcher:drawIdentifier="folder_large">
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="@dimen/cling_text_block_offset_x"
+ android:layout_marginTop="@dimen/cling_text_block_offset_y">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/folder_cling_title"
+ android:text="@string/folder_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/folder_cling_create_folder"
+ android:layout_width="480dp"
+ android:layout_height="wrap_content"
+ android:text="@string/folder_cling_create_folder" />
+ <Button
+ style="@style/ClingButton"
+ android:id="@+id/cling_dismiss"
+ android:layout_marginTop="15dp"
+ android:onClick="dismissFolderCling" />
+ </LinearLayout>
+ </FrameLayout>
+</com.android.launcher2.Cling>
diff --git a/res/layout-sw600dp-port/workspace_cling.xml b/res/layout-sw600dp-port/workspace_cling.xml
index 0b9477c..2eae0fc 100644
--- a/res/layout-sw600dp-port/workspace_cling.xml
+++ b/res/layout-sw600dp-port/workspace_cling.xml
@@ -16,39 +16,41 @@
<com.android.launcher2.Cling
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- launcher:drawIdentifier="large_workspace_portrait">
+ launcher:drawIdentifier="workspace_large">
<FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="60dp"
- android:layout_marginTop="30dp"
- android:layout_gravity="left|center_vertical">
- <TextView
- style="@style/ClingTitleText"
- android:id="@+id/workspace_cling_title"
- android:layout_marginTop="20dp"
- android:text="@string/workspace_cling_title" />
- <TextView
- style="@style/ClingText"
- android:id="@+id/workspace_cling_move_item"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="@dimen/cling_text_block_offset_x"
+ android:layout_marginTop="@dimen/cling_text_block_offset_y">
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="65dp"
- android:text="@string/workspace_cling_move_item" />
- <Button
- style="@style/ClingButton"
- android:id="@+id/cling_dismiss"
- android:layout_marginTop="95dp"
- android:onClick="dismissWorkspaceCling" />
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/workspace_cling_title"
+ android:text="@string/workspace_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/workspace_cling_move_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/workspace_cling_move_item" />
+ <Button
+ style="@style/ClingButton"
+ android:id="@+id/cling_dismiss"
+ android:layout_marginTop="15dp"
+ android:onClick="dismissWorkspaceCling" />
+ </LinearLayout>
</FrameLayout>
<TextView
style="@style/ClingText"
android:id="@+id/workspace_cling_open_all_apps"
- android:layout_width="200dp"
+ android:layout_width="180dp"
android:layout_height="wrap_content"
- android:layout_gravity="right|top"
- android:layout_marginRight="160dp"
- android:layout_marginTop="30dp"
- android:gravity="left"
+ android:layout_marginTop="15dp"
+ android:layout_marginRight="150dp"
+ android:layout_gravity="right"
+ android:gravity="right"
android:text="@string/workspace_cling_open_all_apps" />
</com.android.launcher2.Cling>
\ No newline at end of file
diff --git a/res/layout-sw600dp/all_apps_cling.xml b/res/layout-sw600dp/all_apps_cling.xml
new file mode 100644
index 0000000..7079b21
--- /dev/null
+++ b/res/layout-sw600dp/all_apps_cling.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.Cling
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ launcher:drawIdentifier="all_apps_large">
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="@dimen/cling_text_block_offset_x"
+ android:layout_marginTop="@dimen/cling_text_block_offset_y">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/all_apps_cling_title"
+ android:text="@string/all_apps_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/all_apps_cling_add_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/all_apps_cling_add_item" />
+ <Button
+ style="@style/ClingButton"
+ android:id="@+id/cling_dismiss"
+ android:layout_marginTop="15dp"
+ android:onClick="dismissAllAppsCling" />
+ </LinearLayout>
+ </FrameLayout>
+</com.android.launcher2.Cling>
diff --git a/res/layout-sw600dp/folder_cling.xml b/res/layout-sw600dp/folder_cling.xml
new file mode 100644
index 0000000..4188804
--- /dev/null
+++ b/res/layout-sw600dp/folder_cling.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.Cling
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ launcher:drawIdentifier="folder_large">
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="@dimen/cling_text_block_offset_x"
+ android:layout_marginTop="@dimen/cling_text_block_offset_y">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/folder_cling_title"
+ android:text="@string/folder_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/folder_cling_create_folder"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/folder_cling_create_folder" />
+ <Button
+ style="@style/ClingButton"
+ android:id="@+id/cling_dismiss"
+ android:layout_marginTop="15dp"
+ android:onClick="dismissFolderCling" />
+ </LinearLayout>
+ </FrameLayout>
+</com.android.launcher2.Cling>
diff --git a/res/layout-sw600dp/launcher.xml b/res/layout-sw600dp/launcher.xml
index bfa6f3e..94c69a6 100644
--- a/res/layout-sw600dp/launcher.xml
+++ b/res/layout-sw600dp/launcher.xml
@@ -45,4 +45,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
+
+ <include layout="@layout/folder_cling"
+ android:id="@+id/folder_cling"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone" />
</com.android.launcher2.DragLayer>
diff --git a/res/layout-sw600dp/market_button.xml b/res/layout-sw600dp/market_button.xml
index 3f31319..4ccecd9 100644
--- a/res/layout-sw600dp/market_button.xml
+++ b/res/layout-sw600dp/market_button.xml
@@ -19,8 +19,8 @@
style="@style/MarketButton"
android:onClick="onClickAppMarketButton"
android:gravity="center"
- android:paddingLeft="10dp"
- android:paddingRight="10dp"
+ android:paddingLeft="32dp"
+ android:paddingRight="32dp"
android:drawablePadding="10dp"
android:text="@string/market"
android:contentDescription="@string/market"
@@ -32,6 +32,5 @@
android:shadowDx="0.0"
android:shadowDy="0.0"
android:shadowRadius="2.0"
- android:background="@drawable/tab_widget_indicator_selector"
android:focusable="true"
android:clickable="true" />
diff --git a/res/layout-sw600dp/workspace_cling.xml b/res/layout-sw600dp/workspace_cling.xml
new file mode 100644
index 0000000..264b1e0
--- /dev/null
+++ b/res/layout-sw600dp/workspace_cling.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.Cling
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ launcher:drawIdentifier="workspace_large">
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="@dimen/cling_text_block_offset_x"
+ android:layout_marginTop="@dimen/cling_text_block_offset_y">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/workspace_cling_title"
+ android:text="@string/workspace_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/workspace_cling_move_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/workspace_cling_move_item" />
+ <Button
+ style="@style/ClingButton"
+ android:id="@+id/cling_dismiss"
+ android:layout_marginTop="15dp"
+ android:onClick="dismissWorkspaceCling" />
+ </LinearLayout>
+ </FrameLayout>
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/workspace_cling_open_all_apps"
+ android:layout_width="180dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="90dp"
+ android:layout_marginRight="130dp"
+ android:layout_gravity="right"
+ android:gravity="right"
+ android:text="@string/workspace_cling_open_all_apps" />
+</com.android.launcher2.Cling>
\ No newline at end of file
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index 1b01b48..efd29a6 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -29,6 +29,7 @@
android:id="@+id/tabs_container"
android:layout_width="wrap_content"
android:layout_height="@dimen/apps_customize_tab_bar_height"
+ android:layout_marginTop="@dimen/apps_customize_tab_bar_margin_top"
android:layout_gravity="center_horizontal">
<com.android.launcher2.FocusOnlyTabWidget
android:id="@android:id/tabs"
@@ -36,7 +37,8 @@
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="@drawable/tab_unselected_holo"
- android:tabStripEnabled="false" />
+ android:tabStripEnabled="false"
+ android:divider="@null" />
<include
android:id="@+id/market_button"
layout="@layout/market_button"
diff --git a/res/layout/market_button.xml b/res/layout/market_button.xml
index 2d840d7..5e10156 100644
--- a/res/layout/market_button.xml
+++ b/res/layout/market_button.xml
@@ -19,13 +19,12 @@
style="@style/MarketButton"
android:onClick="onClickAppMarketButton"
android:gravity="center"
- android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
- android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
android:contentDescription="@string/market"
android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
android:shadowDx="0.0"
android:shadowDy="0.0"
android:shadowRadius="2.0"
- android:background="@drawable/tab_widget_indicator_selector"
android:focusable="true"
android:clickable="true" />
diff --git a/res/values-land/config.xml b/res/values-land/config.xml
index 121bb0c..fc20456 100644
--- a/res/values-land/config.xml
+++ b/res/values-land/config.xml
@@ -20,4 +20,9 @@
<bool name="config_useDropTargetDownTransition">false</bool>
<!-- Whether or not to fade the side pages -->
<bool name="config_workspaceFadeAdjacentScreens">false</bool>
+
+ <!-- Folder max bounds and max number of items.
+ Note: folder_max_count_x * folder_max_count_y >= folder_max_num_items. -->
+ <integer name="folder_max_count_x">6</integer>
+ <integer name="folder_max_count_y">3</integer>
</resources>
diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml
index bb155bd..7949d2d 100644
--- a/res/values-land/styles.xml
+++ b/res/values-land/styles.xml
@@ -65,10 +65,5 @@
<item name="android:shadowDy">1.0</item>
<item name="android:shadowRadius">4.0</item>
</style>
-
- <style name="TabIndicator.AppsCustomize">
- <item name="android:paddingTop">5dp</item>
- <item name="android:paddingBottom">10dp</item>
- </style>
</resources>
diff --git a/res/values-sw340dp-port/dimens.xml b/res/values-sw340dp-port/dimens.xml
index ef44913..bf7ebc3 100644
--- a/res/values-sw340dp-port/dimens.xml
+++ b/res/values-sw340dp-port/dimens.xml
@@ -59,7 +59,4 @@
<dimen name="apps_customize_pageLayoutPaddingRight">8dp</dimen>
<dimen name="apps_customize_cell_height">92dp</dimen>
<dimen name="apps_customize_widget_cell_height_gap">16dp</dimen>
-
-<!-- Folders -->
- <dimen name="folder_preview_size">64dp</dimen>
</resources>
diff --git a/res/values-sw340dp/dimens.xml b/res/values-sw340dp/dimens.xml
new file mode 100644
index 0000000..69d6e58
--- /dev/null
+++ b/res/values-sw340dp/dimens.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <!-- Drag padding to add to the bottom of drop targets -->
+ <dimen name="drop_target_drag_padding">20dp</dimen>
+</resources>
diff --git a/res/values-sw600dp-land/dimens.xml b/res/values-sw600dp-land/dimens.xml
index f51f6f9..42c4353 100644
--- a/res/values-sw600dp-land/dimens.xml
+++ b/res/values-sw600dp-land/dimens.xml
@@ -37,4 +37,11 @@
<dimen name="apps_customize_pageLayoutPaddingRight">30dp</dimen>
<integer name="apps_customize_widget_cell_count_x">3</integer>
<integer name="apps_customize_widget_cell_count_y">2</integer>
+ <integer name="apps_customize_cling_focused_x">4</integer>
+ <integer name="apps_customize_cling_focused_y">2</integer>
+
+<!-- Cling -->
+ <!-- The offset for the text in the cling -->
+ <dimen name="cling_text_block_offset_x">140dp</dimen>
+ <dimen name="cling_text_block_offset_y">80dp</dimen>
</resources>
diff --git a/res/values-sw600dp-port/dimens.xml b/res/values-sw600dp-port/dimens.xml
index 6753cbf..5de73b6 100644
--- a/res/values-sw600dp-port/dimens.xml
+++ b/res/values-sw600dp-port/dimens.xml
@@ -40,4 +40,11 @@
<dimen name="apps_customize_pageLayoutPaddingRight">30dp</dimen>
<integer name="apps_customize_widget_cell_count_x">2</integer>
<integer name="apps_customize_widget_cell_count_y">3</integer>
+ <integer name="apps_customize_cling_focused_x">2</integer>
+ <integer name="apps_customize_cling_focused_y">2</integer>
+
+<!-- Cling -->
+ <!-- The offset for the text in the cling -->
+ <dimen name="cling_text_block_offset_x">80dp</dimen>
+ <dimen name="cling_text_block_offset_y">160dp</dimen>
</resources>
\ No newline at end of file
diff --git a/res/values-sw600dp/config.xml b/res/values-sw600dp/config.xml
index 2a81e12..7a07898 100644
--- a/res/values-sw600dp/config.xml
+++ b/res/values-sw600dp/config.xml
@@ -19,4 +19,9 @@
<!-- When shrinking the workspace, this is the percentage of its original size. -->
<integer name="config_workspaceShrinkPercent">17</integer>
+ <!-- Folder max bounds and max number of items. Note: folder_max_count_x * folder_max_count_y
+ >= folder_max_num_items. When these are set to -1, they are automatically determined. -->
+ <integer name="folder_max_count_x">-1</integer>
+ <integer name="folder_max_count_y">-1</integer>
+ <integer name="folder_max_num_items">-1</integer>
</resources>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 584734b..5c3b950 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -33,6 +33,7 @@
<!-- AppsCustomize -->
<dimen name="apps_customize_tab_bar_height">56dp</dimen>
+ <dimen name="apps_customize_tab_bar_margin_top">8dp</dimen>
<dimen name="apps_customize_cell_width">96dp</dimen>
<dimen name="apps_customize_cell_height">98dp</dimen>
<dimen name="apps_customize_widget_cell_width_gap">36dp</dimen>
@@ -74,7 +75,7 @@
<!-- Folders -->
<!-- The size of the image which sits behind the preview of the folder contents -->
- <dimen name="folder_preview_size">80dp</dimen>
+ <dimen name="folder_preview_size">78dp</dimen>
<!-- The amount that the preview contents are inset from the preview background -->
<dimen name="folder_preview_padding">4dp</dimen>
</resources>
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index ec281f9..e0542ba 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -18,6 +18,38 @@
-->
<resources>
+<!-- Clings -->
+ <style name="ClingButton">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:paddingTop">10dp</item>
+ <item name="android:paddingBottom">15dp</item>
+ <item name="android:paddingLeft">35dp</item>
+ <item name="android:paddingRight">35dp</item>
+ <item name="android:text">@string/cling_dismiss</item>
+ <item name="android:textSize">20sp</item>
+ <item name="android:textStyle">bold</item>
+ <item name="android:background">@drawable/cling_button_bg</item>
+ </style>
+ <style name="ClingTitleText">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_marginBottom">5dp</item>
+ <item name="android:textSize">32sp</item>
+ <item name="android:textColor">#49C0EC</item>
+ <item name="android:shadowColor">#000000</item>
+ <item name="android:shadowDy">2</item>
+ <item name="android:shadowRadius">2.0</item>
+ </style>
+ <style name="ClingText">
+ <item name="android:textSize">22sp</item>
+ <item name="android:textColor">#FFFFFF</item>
+ <item name="android:shadowColor">#000000</item>
+ <item name="android:shadowDy">2</item>
+ <item name="android:shadowRadius">2.0</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
<!-- Workspace -->
<style name="WorkspaceIcon.Portrait">
<item name="android:drawablePadding">0dp</item>
@@ -28,11 +60,13 @@
<item name="android:textSize">13sp</item>
</style>
<style name="WorkspaceIcon.Portrait.Folder">
+ <item name="android:drawablePadding">0dp</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:paddingRight">4dp</item>
<item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:textSize">13sp</item>
+ <item name="android:layout_marginTop">-2dp</item>
</style>
<style name="WorkspaceIcon.Landscape">
<item name="android:drawablePadding">0dp</item>
@@ -43,11 +77,13 @@
<item name="android:textSize">13sp</item>
</style>
<style name="WorkspaceIcon.Landscape.Folder">
+ <item name="android:drawablePadding">0dp</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:paddingRight">4dp</item>
<item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:textSize">13sp</item>
+ <item name="android:layout_marginTop">-2dp</item>
</style>
<style name="Theme" parent="android:Theme.Holo.Wallpaper.NoTitleBar">
@@ -75,8 +111,8 @@
<item name="android:textSize">13sp</item>
</style>
<style name="TabIndicator.AppsCustomize">
- <item name="android:paddingTop">16dp</item>
- <item name="android:paddingBottom">20dp</item>
+ <item name="android:paddingLeft">32dp</item>
+ <item name="android:paddingRight">32dp</item>
<item name="android:textSize">14sp</item>
</style>
@@ -118,8 +154,8 @@
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center_vertical</item>
<item name="android:drawablePadding">7.5dp</item>
- <item name="android:paddingLeft">25dp</item>
- <item name="android:paddingRight">25dp</item>
+ <item name="android:paddingLeft">60dp</item>
+ <item name="android:paddingRight">60dp</item>
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:textSize">16sp</item>
<item name="android:shadowColor">#393939</item>
diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml
index 5ad3af9..164f1e1 100644
--- a/res/values-vi/strings.xml
+++ b/res/values-vi/strings.xml
@@ -32,7 +32,7 @@
<string name="external_drop_widget_error" msgid="127440783198670829">"Không thể thả mục vào Màn hình chính này."</string>
<string name="external_drop_widget_pick_title" msgid="7040647073452295370">"Chọn tiện ích con để tạo"</string>
<string name="rename_folder_label" msgid="5646236631298452787">"Tên thư mục"</string>
- <string name="rename_folder_title" msgid="4544573104191526550">"Đổi tên thư mục"</string>
+ <string name="rename_folder_title" msgid="4544573104191526550">"Đổi tên thư mục"</string>
<string name="rename_action" msgid="6016003384693240896">"OK"</string>
<string name="cancel_action" msgid="3811860427489435048">"Hủy"</string>
<string name="menu_item_add_item" msgid="6233177331075781114">"Thêm vào Màn hình chính"</string>
diff --git a/res/values/config.xml b/res/values/config.xml
index b8040e6..7ab9870 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -84,4 +84,10 @@
<!-- When shrinking the workspace, this is the percentage of its original size. -->
<integer name="config_workspaceShrinkPercent">17</integer>
+
+ <!-- Folder max bounds and max number of items. Note: folder_max_count_x * folder_max_count_y
+ >= folder_max_num_items. When these are set to -1, they are automatically determined. -->
+ <integer name="folder_max_count_x">4</integer>
+ <integer name="folder_max_count_y">4</integer>
+ <integer name="folder_max_num_items">16</integer>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index da82809..fe0cb00 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -18,6 +18,9 @@
<!-- Cling -->
<dimen name="clingPunchThroughGraphicCenterRadius">94dp</dimen>
<dimen name="folderClingMarginTop">20dp</dimen>
+ <!-- The offset for the text in the cling -->
+ <dimen name="cling_text_block_offset_x">0dp</dimen>
+ <dimen name="cling_text_block_offset_y">0dp</dimen>
<!-- Workspace -->
<!-- qsb_bar_height_inset represents qsb_bar_height minus the padding
@@ -59,6 +62,7 @@
<!-- The height of the tab bar - if this changes, we should update the
external icon width/height above to compensate -->
<dimen name="apps_customize_tab_bar_height">52dp</dimen>
+ <dimen name="apps_customize_tab_bar_margin_top">0dp</dimen>
<dimen name="app_icon_size">48dp</dimen>
<!-- The width can be 72dp because we don't have L/R padding -->
<dimen name="apps_customize_cell_width">74dp</dimen>
@@ -78,9 +82,6 @@
<dimen name="button_bar_width_right_padding">0dp</dimen>
<dimen name="button_bar_height_plus_padding">70dp</dimen>
- <!-- Drag padding to add to the drop targets -->
- <dimen name="drop_target_drag_padding">40dp</dimen>
-
<!-- extra horizontal spacing between mini screen thumbnails ie. in all
apps and in customization mode -->
<dimen name="smallScreenExtraSpacing">0dip</dimen>
@@ -90,6 +91,9 @@
<dimen name="allAppsSmallScreenVerticalMarginLandscape">30dip</dimen>
<dimen name="allAppsSmallScreenVerticalMarginPortrait">60dip</dimen>
+ <!-- Drag padding to add to the bottom of drop targets -->
+ <dimen name="drop_target_drag_padding">14dp</dimen>
+
<!-- padding between the delete zone drawable and text -->
<dimen name="delete_zone_drawable_padding">8dip</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index e38c395..502a836 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -86,7 +86,7 @@
<style name="WorkspaceIcon.Portrait.Folder">
<item name="android:drawablePadding">0dp</item>
- <item name="android:paddingTop">0dp</item>
+ <item name="android:paddingTop">2dp</item>
</style>
<style name="WorkspaceIcon.Landscape.Folder">
<item name="android:drawablePadding">0dp</item>
@@ -161,8 +161,8 @@
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:gravity">center</item>
- <item name="android:paddingLeft">30dp</item>
- <item name="android:paddingRight">30dp</item>
+ <item name="android:paddingLeft">24dp</item>
+ <item name="android:paddingRight">24dp</item>
<item name="android:background">@drawable/tab_widget_indicator_selector</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">12sp</item>
diff --git a/res/xml/update_workspace.xml b/res/xml/update_workspace.xml
new file mode 100644
index 0000000..44a3f9e
--- /dev/null
+++ b/res/xml/update_workspace.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+
+<favorites xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
+ <!-- Update the db with new hotseat items. Note that we reference the browser's original
+ package name. -->
+ <!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
+ <favorite
+ launcher:packageName="com.android.contacts"
+ launcher:className="com.android.contacts.activities.DialtactsActivity"
+ launcher:container="-101"
+ launcher:screen="0"
+ launcher:x="0"
+ launcher:y="0" />
+ <favorite
+ launcher:packageName="com.android.contacts"
+ launcher:className="com.android.contacts.activities.PeopleActivity"
+ launcher:container="-101"
+ launcher:screen="1"
+ launcher:x="1"
+ launcher:y="0" />
+ <favorite
+ launcher:packageName="com.android.mms"
+ launcher:className="com.android.mms.ui.ConversationList"
+ launcher:container="-101"
+ launcher:screen="3"
+ launcher:x="3"
+ launcher:y="0" />
+ <favorite
+ launcher:packageName="com.android.browser"
+ launcher:className="com.android.browser.BrowserActivity"
+ launcher:container="-101"
+ launcher:screen="4"
+ launcher:x="4"
+ launcher:y="0" />
+</favorites>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 2cdd16a..0189d6c 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -193,6 +193,7 @@
private ArrayList<Object> mWidgets;
// Cling
+ private boolean mHasShownAllAppsCling;
private int mClingFocusedX;
private int mClingFocusedY;
@@ -396,14 +397,33 @@
int page = getPageForComponent(mSaveInstanceStateItemIndex);
invalidatePageData(Math.max(0, page));
- // Calculate the position for the cling punch through
- int[] offset = new int[2];
- int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY);
- mLauncher.getDragLayer().getLocationInDragLayer(this, offset);
- pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 + offset[0];
- pos[1] += (getMeasuredHeight() - mWidgetSpacingLayout.getMeasuredHeight()) / 2 + offset[1];
- mLauncher.showFirstRunAllAppsCling(pos);
+ // Show All Apps cling if we are finished transitioning, otherwise, we will try again when
+ // the transition completes in AppsCustomizeTabHost (otherwise the wrong offsets will be
+ // returned while animating)
+ AppsCustomizeTabHost host = (AppsCustomizeTabHost) getTabHost();
+ if (!host.isTransitioning()) {
+ post(new Runnable() {
+ @Override
+ public void run() {
+ showAllAppsCling();
+ }
+ });
+ }
+ }
+ void showAllAppsCling() {
+ if (!mHasShownAllAppsCling && isDataReady() && testDataReady()) {
+ mHasShownAllAppsCling = true;
+ // Calculate the position for the cling punch through
+ int[] offset = new int[2];
+ int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY);
+ mLauncher.getDragLayer().getLocationInDragLayer(this, offset);
+ // PagedViews are centered horizontally but top aligned
+ pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 +
+ offset[0];
+ pos[1] += offset[1];
+ mLauncher.showFirstRunAllAppsCling(pos);
+ }
}
@Override
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 334b369..778d6bc 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -171,7 +171,7 @@
private void reloadCurrentPage() {
if (!LauncherApplication.isScreenLarge()) {
- mAppsCustomizePane.flashScrollingIndicator();
+ mAppsCustomizePane.flashScrollingIndicator(true);
}
mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage());
mAppsCustomizePane.requestFocus();
@@ -355,19 +355,19 @@
public boolean onLauncherTransitionStart(Launcher l, Animator animation, boolean toWorkspace) {
mInTransition = true;
boolean delayLauncherTransitionUntilLayout = false;
+ boolean animated = (animation != null);
mLauncherTransition = null;
- // if the content wasn't visible before, delay the launcher animation until after a cal
+ // if the content wasn't visible before, delay the launcher animation until after a call
// to layout -- this prevents a blip
- if (animation != null) {
- if (mContent.getVisibility() == GONE) {
- mLauncherTransition = animation;
- delayLauncherTransitionUntilLayout = true;
- }
- mContent.setVisibility(VISIBLE);
- if (!delayLauncherTransitionUntilLayout) {
- enableAndBuildHardwareLayer();
- }
+ if (animated && mContent.getVisibility() == GONE) {
+ mLauncherTransition = animation;
+ delayLauncherTransitionUntilLayout = true;
+ }
+ mContent.setVisibility(VISIBLE);
+
+ if (animated && !delayLauncherTransitionUntilLayout) {
+ enableAndBuildHardwareLayer();
}
if (!toWorkspace && !LauncherApplication.isScreenLarge()) {
@@ -388,8 +388,9 @@
}
if (!toWorkspace) {
- // Dismiss the cling if necessary
+ // Dismiss the workspace cling and show the all apps cling (if not already shown)
l.dismissWorkspaceCling(null);
+ mAppsCustomizePane.showAllAppsCling();
if (!LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.hideScrollingIndicator(false);
diff --git a/src/com/android/launcher2/CachedTextView.java b/src/com/android/launcher2/CachedTextView.java
deleted file mode 100644
index f9f68a0..0000000
--- a/src/com/android/launcher2/CachedTextView.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.launcher2;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Bitmap.Config;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.PorterDuff.Mode;
-import android.graphics.drawable.Drawable;
-import android.text.Layout;
-import android.util.AttributeSet;
-import android.widget.TextView;
-
-/*
- * This class is a bit of a hack, designed to speed up long text labels in Launcher. It caches the
- * text in a TextView to a bitmap and then just draws that Bitmap instead afterward, speeding up
- * rendering. Marquee scrolling is not currently supported.
- *
- */
-public class CachedTextView extends TextView {
- private Bitmap mCache;
- private final Paint mCachePaint = new Paint();
- private final Canvas mCacheCanvas = new Canvas();
-
- private int mPrevAlpha = -1;
- private boolean mIsBuildingCache;
- boolean mIsTextCacheDirty;
- float mTextCacheLeft;
- float mTextCacheTop;
- float mTextCacheScrollX;
- float mRectLeft, mRectTop;
- private float mPaddingH = 0;
- private float mPaddingV = 0;
- private CharSequence mText;
- private boolean mEnabled = true;
-
- public CachedTextView(Context context) {
- super(context);
- }
-
- public CachedTextView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public CachedTextView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- protected int getCacheTopPadding() {
- return 0;
- }
- protected int getCacheLeftPadding() {
- return 0;
- }
- protected int getCacheRightPadding() {
- return 0;
- }
- protected int getCacheBottomPadding() {
- return 0;
- }
-
- public void disableCache() {
- mEnabled = false;
- }
-
- public void setText(CharSequence text, BufferType type) {
- super.setText(text, type);
- mIsTextCacheDirty = true;
- }
-
- private void buildAndUpdateCache() {
- final Layout layout = getLayout();
- final int left = getCompoundPaddingLeft();
- final int top = getExtendedPaddingTop();
- final float prevAlpha = getAlpha();
-
- mTextCacheLeft = layout.getLineLeft(0) - getCacheLeftPadding();
- mTextCacheTop = top + layout.getLineTop(0) - mPaddingV - getCacheTopPadding();
-
- mRectLeft = mScrollX + getLeft();
- mRectTop = 0;
- mTextCacheScrollX = mScrollX;
-
- final float textCacheRight =
- Math.min(left + layout.getLineRight(0) + mPaddingH, mScrollX + mRight - mLeft) +
- getCacheRightPadding();
- final float textCacheBottom = top + layout.getLineBottom(0) + mPaddingV +
- getCacheBottomPadding();
- final float xCharWidth = getPaint().measureText("x");
-
- int width = (int) (textCacheRight - mTextCacheLeft + (2 * xCharWidth));
- int height = (int) (textCacheBottom - mTextCacheTop);
-
- if (width > 0 && height > 0) {
- if (mCache != null) {
- if (mCache.getWidth() != width || mCache.getHeight() != height) {
- mCache.recycle();
- mCache = null;
- }
- }
- if (mCache == null) {
- mCache = Bitmap.createBitmap(width, height, Config.ARGB_8888);
- mCacheCanvas.setBitmap(mCache);
- } else {
- mCacheCanvas.drawColor(0, Mode.CLEAR);
- }
-
- mCacheCanvas.save();
- mCacheCanvas.translate(-mTextCacheLeft, -mTextCacheTop);
-
- mIsBuildingCache = true;
- setAlpha(1.0f);
- draw(mCacheCanvas);
- setAlpha(prevAlpha);
- mIsBuildingCache = false;
- mCacheCanvas.restore();
- mCacheCanvas.setBitmap(null);
-
- // A hack-- we set the text to be one space (we don't make it empty just to avoid any
- // potential issues with text measurement, like line height, etc.) so that the text view
- // doesn't draw it anymore, since it's been cached.
- mText = getText();
- setText(" ");
- }
- }
-
- public CharSequence getText() {
- return (mText == null) ? super.getText() : mText;
- }
-
- public void draw(Canvas canvas) {
- if (mEnabled && mIsTextCacheDirty && !mIsBuildingCache) {
- buildAndUpdateCache();
- mIsTextCacheDirty = false;
- }
- if (mCache != null && !mIsBuildingCache) {
- canvas.drawBitmap(mCache, mTextCacheLeft - mTextCacheScrollX + mScrollX,
- mTextCacheTop, mCachePaint);
- }
- super.draw(canvas);
- }
-
- protected boolean isBuildingCache() {
- return mIsBuildingCache;
- }
-
- @Override
- protected boolean onSetAlpha(int alpha) {
- if (mPrevAlpha != alpha) {
- mPrevAlpha = alpha;
- mCachePaint.setAlpha(alpha);
-
- // We manually update the drawables alpha since the default TextView implementation may
- // not do this if there is a background set (which we may due to the focus bg)
- final Drawable[] dr = getCompoundDrawables();
- for (int i = 0; i < dr.length; ++i) {
- if (dr[i] != null) {
- dr[i].mutate().setAlpha(alpha);
- }
- }
-
- super.onSetAlpha(alpha);
- }
- return true;
- }
-}
diff --git a/src/com/android/launcher2/Cling.java b/src/com/android/launcher2/Cling.java
index 32b1de4..f9a0681 100644
--- a/src/com/android/launcher2/Cling.java
+++ b/src/com/android/launcher2/Cling.java
@@ -44,6 +44,9 @@
private static String ALLAPPS_LANDSCAPE = "all_apps_landscape";
private static String FOLDER_PORTRAIT = "folder_portrait";
private static String FOLDER_LANDSCAPE = "folder_landscape";
+ private static String WORKSPACE_LARGE = "workspace_large";
+ private static String FOLDER_LARGE = "folder_large";
+ private static String ALLAPPS_LARGE = "all_apps_large";
private Launcher mLauncher;
private boolean mIsInitialized;
@@ -109,8 +112,14 @@
return new int[]{getMeasuredWidth() / 2, getMeasuredHeight() - (mButtonBarHeight / 2)};
} else if (mDrawIdentifier.equals(WORKSPACE_LANDSCAPE)) {
return new int[]{getMeasuredWidth() - (mButtonBarHeight / 2), getMeasuredHeight() / 2};
+ } else if (mDrawIdentifier.equals(WORKSPACE_LARGE)) {
+ final float scale = LauncherApplication.getScreenDensity();
+ final int cornerXOffset = (int) (scale * 15);
+ final int cornerYOffset = (int) (scale * 10);
+ return new int[]{getMeasuredWidth() - cornerXOffset, cornerYOffset};
} else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
- mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
+ mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) ||
+ mDrawIdentifier.equals(ALLAPPS_LARGE)) {
return mPositionData;
}
return new int[]{-1, -1};
@@ -120,8 +129,10 @@
public boolean onTouchEvent(android.view.MotionEvent event) {
if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) ||
mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) ||
+ mDrawIdentifier.equals(WORKSPACE_LARGE) ||
mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
- mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
+ mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) ||
+ mDrawIdentifier.equals(ALLAPPS_LARGE)) {
int[] pos = getPunchThroughPosition();
double diff = Math.sqrt(Math.pow(event.getX() - pos[0], 2) +
Math.pow(event.getY() - pos[1], 2));
@@ -129,7 +140,8 @@
return false;
}
} else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) ||
- mDrawIdentifier.equals(FOLDER_LANDSCAPE)) {
+ mDrawIdentifier.equals(FOLDER_LANDSCAPE) ||
+ mDrawIdentifier.equals(FOLDER_LARGE)) {
Folder f = mLauncher.getWorkspace().getOpenFolder();
if (f != null) {
Rect r = new Rect();
@@ -156,14 +168,18 @@
// Draw the background
if (mBackground == null) {
if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) ||
- mDrawIdentifier.equals(WORKSPACE_LANDSCAPE)) {
+ mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) ||
+ mDrawIdentifier.equals(WORKSPACE_LARGE)) {
mBackground = getResources().getDrawable(R.drawable.bg_cling1);
} else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
- mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
+ mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) ||
+ mDrawIdentifier.equals(ALLAPPS_LARGE)) {
mBackground = getResources().getDrawable(R.drawable.bg_cling2);
} else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) ||
mDrawIdentifier.equals(FOLDER_LANDSCAPE)) {
mBackground = getResources().getDrawable(R.drawable.bg_cling3);
+ } else if (mDrawIdentifier.equals(FOLDER_LARGE)) {
+ mBackground = getResources().getDrawable(R.drawable.bg_cling4);
}
}
if (mBackground != null) {
@@ -191,7 +207,8 @@
// Draw the hand graphic in All Apps
if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
- mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
+ mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) ||
+ mDrawIdentifier.equals(ALLAPPS_LARGE)) {
if (mHandTouchGraphic == null) {
mHandTouchGraphic = getResources().getDrawable(R.drawable.hand);
}
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index ee054ab..286e2fe 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -101,7 +101,6 @@
private int mScrollState = SCROLL_OUTSIDE_ZONE;
private ScrollRunnable mScrollRunnable = new ScrollRunnable();
- private RectF mDeleteRegion;
private DropTarget mLastDropTarget;
private InputMethodManager mInputMethodManager;
@@ -486,12 +485,6 @@
}
mLastDropTarget = dropTarget;
- // Scroll, maybe, but not if we're in the delete region.
- boolean inDeleteRegion = false;
- if (mDeleteRegion != null) {
- inDeleteRegion = mDeleteRegion.contains(x, y);
- }
-
// After a scroll, the touch point will still be in the scroll region.
// Rather than scrolling immediately, require a bit of twiddling to scroll again
final int slop = ViewConfiguration.get(mLauncher).getScaledWindowTouchSlop();
@@ -500,7 +493,7 @@
mLastTouch[0] = x;
mLastTouch[1] = y;
- if (!inDeleteRegion && x < mScrollZone) {
+ if (x < mScrollZone) {
if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) {
mScrollState = SCROLL_WAITING_IN_ZONE;
if (mDragScroller.onEnterScrollArea(x, y, SCROLL_LEFT)) {
@@ -508,7 +501,7 @@
mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY);
}
}
- } else if (!inDeleteRegion && x > mScrollView.getWidth() - mScrollZone) {
+ } else if (x > mScrollView.getWidth() - mScrollZone) {
if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) {
mScrollState = SCROLL_WAITING_IN_ZONE;
if (mDragScroller.onEnterScrollArea(x, y, SCROLL_RIGHT)) {
@@ -669,15 +662,6 @@
mScrollView = v;
}
- /**
- * Specifies the delete region. We won't scroll on touch events over the delete region.
- *
- * @param region The rectangle in DragLayer coordinates of the delete region.
- */
- void setDeleteRegion(RectF region) {
- mDeleteRegion = region;
- }
-
DragView getDragView() {
return mDragObject.dragView;
}
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 33b5de1..a6757d7 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -83,6 +83,7 @@
private FolderIcon mFolderIcon;
private int mMaxCountX;
private int mMaxCountY;
+ private int mMaxNumItems;
private Rect mNewSize = new Rect();
private Rect mIconRect = new Rect();
private ArrayList<View> mItemsInReadingOrder = new ArrayList<View>();
@@ -121,13 +122,20 @@
setAlwaysDrawnWithCacheEnabled(false);
mInflater = LayoutInflater.from(context);
mIconCache = ((LauncherApplication)context.getApplicationContext()).getIconCache();
- mMaxCountX = LauncherModel.getCellCountX();
- mMaxCountY = LauncherModel.getCellCountY();
+
+ Resources res = getResources();
+ mMaxCountX = res.getInteger(R.integer.folder_max_count_x);
+ mMaxCountY = res.getInteger(R.integer.folder_max_count_y);
+ mMaxNumItems = res.getInteger(R.integer.folder_max_num_items);
+ if (mMaxCountX < 0 || mMaxCountY < 0 || mMaxNumItems < 0) {
+ mMaxCountX = LauncherModel.getCellCountX();
+ mMaxCountY = LauncherModel.getCellCountY();
+ mMaxNumItems = mMaxCountX * mMaxCountY;
+ }
mInputMethodManager = (InputMethodManager)
mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
- Resources res = getResources();
mExpandDuration = res.getInteger(R.integer.config_folderAnimDuration);
if (sDefaultFolderName == null) {
@@ -746,7 +754,7 @@
int oldCountY = countY;
if (countX * countY < count) {
// Current grid is too small, expand it
- if (countX <= countY && countX < mMaxCountX) {
+ if ((countX <= countY || countY == mMaxCountY) && countX < mMaxCountX) {
countX++;
} else if (countY < mMaxCountY) {
countY++;
@@ -764,7 +772,7 @@
}
public boolean isFull() {
- return getItemCount() >= mMaxCountX * mMaxCountY;
+ return getItemCount() >= mMaxNumItems;
}
private void centerAboutIcon() {
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 7ee03fc..6ea14db 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -78,6 +78,7 @@
import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AccelerateDecelerateInterpolator;
@@ -161,6 +162,7 @@
private enum State { WORKSPACE, APPS_CUSTOMIZE, APPS_CUSTOMIZE_SPRING_LOADED };
private State mState = State.WORKSPACE;
private AnimatorSet mStateAnimation;
+ private AnimatorSet mDividerAnimator;
static final int APPWIDGET_HOST_ID = 1024;
private static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 300;
@@ -177,8 +179,11 @@
private LayoutInflater mInflater;
- private DragController mDragController;
private Workspace mWorkspace;
+ private View mQsbDivider;
+ private View mDockDivider;
+ private DragLayer mDragLayer;
+ private DragController mDragController;
private AppWidgetManager mAppWidgetManager;
private LauncherAppWidgetHost mAppWidgetHost;
@@ -241,7 +246,6 @@
static final ArrayList<String> sDumpLogs = new ArrayList<String>();
- private DragLayer mDragLayer;
private BubbleTextView mWaitingForResume;
@@ -560,7 +564,24 @@
// market intent, so refresh the icon
updateAppMarketIcon();
if (!mWorkspaceLoading) {
- mWorkspace.post(mBuildLayersRunnable);
+ final ViewTreeObserver observer = mWorkspace.getViewTreeObserver();
+ final Workspace workspace = mWorkspace;
+ // We want to let Launcher draw itself at least once before we force it to build
+ // layers on all the workspace pages, so that transitioning to Launcher from other
+ // apps is nice and speedy. Usually the first call to preDraw doesn't correspond to
+ // a true draw so we wait until the second preDraw call to be safe
+ observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
+ boolean mFirstTime = true;
+ public boolean onPreDraw() {
+ if (mFirstTime) {
+ mFirstTime = false;
+ } else {
+ workspace.post(mBuildLayersRunnable);
+ observer.removeOnPreDrawListener(this);
+ }
+ return true;
+ }
+ });
}
clearTypedText();
}
@@ -726,6 +747,8 @@
mDragLayer = (DragLayer) findViewById(R.id.drag_layer);
mWorkspace = (Workspace) mDragLayer.findViewById(R.id.workspace);
+ mQsbDivider = (ImageView) findViewById(R.id.qsb_divider);
+ mDockDivider = (ImageView) findViewById(R.id.dock_divider);
// Setup the drag layer
mDragLayer.setup(this, dragController);
@@ -2252,7 +2275,7 @@
if (!springLoaded && !LauncherApplication.isScreenLarge()) {
// Hide the workspace scrollbar
mWorkspace.hideScrollingIndicator(true);
- mWorkspace.hideDockDivider(true);
+ hideDockDivider();
}
if (!animationCancelled) {
updateWallpaperVisibility(false);
@@ -2294,7 +2317,7 @@
if (!springLoaded && !LauncherApplication.isScreenLarge()) {
// Hide the workspace scrollbar
mWorkspace.hideScrollingIndicator(true);
- mWorkspace.hideDockDivider(true);
+ hideDockDivider();
}
}
updateWallpaperVisibility(false);
@@ -2306,7 +2329,7 @@
* This is the opposite of showAppsCustomizeHelper.
* @param animated If true, the transition will be animated.
*/
- private void hideAppsCustomizeHelper(boolean animated) {
+ private void hideAppsCustomizeHelper(boolean animated, final boolean springLoaded) {
if (mStateAnimation != null) {
mStateAnimation.cancel();
mStateAnimation = null;
@@ -2370,6 +2393,7 @@
((LauncherTransitionable) fromView).onLauncherTransitionStart(instance, null, true);
((LauncherTransitionable) fromView).onLauncherTransitionEnd(instance, null, true);
}
+ mWorkspace.hideScrollingIndicator(false);
}
}
@@ -2380,10 +2404,12 @@
mWorkspace.changeState(Workspace.State.NORMAL, animated, stagger);
if (mState != State.WORKSPACE) {
mWorkspace.setVisibility(View.VISIBLE);
- hideAppsCustomizeHelper(animated);
+ hideAppsCustomizeHelper(animated, false);
// Show the search bar and hotseat
mSearchDropTargetBar.showSearchBar(animated);
+ // We only need to animate in the dock divider if we're going from spring loaded mode
+ showDockDivider(animated && mState == State.APPS_CUSTOMIZE_SPRING_LOADED);
// Set focus to the AppsCustomize button
if (mAllAppsButton != null) {
@@ -2391,8 +2417,7 @@
}
}
- mWorkspace.showDockDivider(!animated);
- mWorkspace.flashScrollingIndicator();
+ mWorkspace.flashScrollingIndicator(animated);
// Change the state *after* we've called all the transition code
mState = State.WORKSPACE;
@@ -2429,7 +2454,8 @@
void enterSpringLoadedDragMode() {
if (mState == State.APPS_CUSTOMIZE) {
mWorkspace.changeState(Workspace.State.SPRING_LOADED);
- hideAppsCustomizeHelper(true);
+ hideAppsCustomizeHelper(true, true);
+ hideDockDivider();
mState = State.APPS_CUSTOMIZE_SPRING_LOADED;
}
}
@@ -2466,6 +2492,33 @@
// Otherwise, we are not in spring loaded mode, so don't do anything.
}
+ void hideDockDivider() {
+ if (mQsbDivider != null && mDockDivider != null) {
+ mQsbDivider.setVisibility(View.INVISIBLE);
+ mDockDivider.setVisibility(View.INVISIBLE);
+ }
+ }
+
+ void showDockDivider(boolean animated) {
+ if (mQsbDivider != null && mDockDivider != null) {
+ mQsbDivider.setVisibility(View.VISIBLE);
+ mDockDivider.setVisibility(View.VISIBLE);
+ if (mDividerAnimator != null) {
+ mDividerAnimator.cancel();
+ mQsbDivider.setAlpha(1f);
+ mDockDivider.setAlpha(1f);
+ mDividerAnimator = null;
+ }
+ if (animated) {
+ mDividerAnimator = new AnimatorSet();
+ mDividerAnimator.playTogether(ObjectAnimator.ofFloat(mQsbDivider, "alpha", 1f),
+ ObjectAnimator.ofFloat(mDockDivider, "alpha", 1f));
+ mDividerAnimator.setDuration(mSearchDropTargetBar.getTransitionInDuration());
+ mDividerAnimator.start();
+ }
+ }
+ }
+
void lockAllApps() {
// TODO
}
@@ -3115,8 +3168,6 @@
/* Cling related */
private static final String PREFS_KEY = "com.android.launcher2.prefs";
private boolean isClingsEnabled() {
- // TEMPORARY: DISABLE CLINGS ON LARGE UI
- if (LauncherApplication.isScreenLarge()) return false;
// disable clings when running in a test harness
if(ActivityManager.isRunningInTestHarness()) return false;
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index 6cec101..a01cc47 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -268,7 +268,7 @@
if (!convertDatabase(db)) {
// Populate favorites table with initial favorites
- loadFavorites(db, ItemInfo.NO_ID);
+ loadFavorites(db, R.xml.default_workspace);
}
}
@@ -446,7 +446,7 @@
}
// Add default hotseat icons
- loadFavorites(db, LauncherSettings.Favorites.CONTAINER_HOTSEAT);
+ loadFavorites(db, R.xml.update_workspace);
version = 9;
}
@@ -700,7 +700,7 @@
* @param db The database to write the values into
* @param filterContainerId The specific container id of items to load
*/
- private int loadFavorites(SQLiteDatabase db, long filterContainerId) {
+ private int loadFavorites(SQLiteDatabase db, int workspaceResourceId) {
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ContentValues values = new ContentValues();
@@ -708,7 +708,7 @@
PackageManager packageManager = mContext.getPackageManager();
int i = 0;
try {
- XmlResourceParser parser = mContext.getResources().getXml(R.xml.default_workspace);
+ XmlResourceParser parser = mContext.getResources().getXml(workspaceResourceId);
AttributeSet attrs = Xml.asAttributeSet(parser);
XmlUtils.beginDocument(parser, TAG_FAVORITES);
@@ -731,92 +731,91 @@
if (a.hasValue(R.styleable.Favorite_container)) {
container = Long.valueOf(a.getString(R.styleable.Favorite_container));
}
- if (filterContainerId == ItemInfo.NO_ID || filterContainerId == container) {
- String screen = a.getString(R.styleable.Favorite_screen);
- String x = a.getString(R.styleable.Favorite_x);
- String y = a.getString(R.styleable.Favorite_y);
- // If we are adding to the hotset, the screen is used as the position in the
- // hotset. This screen can't be at position 0 because AllApps is in the
- // zeroth position.
- if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT &&
- Hotseat.isAllAppsButtonRank(Integer.valueOf(screen))) {
- throw new RuntimeException("Invalid screen position for hotseat item");
+ String screen = a.getString(R.styleable.Favorite_screen);
+ String x = a.getString(R.styleable.Favorite_x);
+ String y = a.getString(R.styleable.Favorite_y);
+
+ // If we are adding to the hotseat, the screen is used as the position in the
+ // hotseat. This screen can't be at position 0 because AllApps is in the
+ // zeroth position.
+ if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT &&
+ Hotseat.isAllAppsButtonRank(Integer.valueOf(screen))) {
+ throw new RuntimeException("Invalid screen position for hotseat item");
+ }
+
+ values.clear();
+ values.put(LauncherSettings.Favorites.CONTAINER, container);
+ values.put(LauncherSettings.Favorites.SCREEN, screen);
+ values.put(LauncherSettings.Favorites.CELLX, x);
+ values.put(LauncherSettings.Favorites.CELLY, y);
+
+ if (TAG_FAVORITE.equals(name)) {
+ long id = addAppShortcut(db, values, a, packageManager, intent);
+ added = id >= 0;
+ } else if (TAG_SEARCH.equals(name)) {
+ added = addSearchWidget(db, values);
+ } else if (TAG_CLOCK.equals(name)) {
+ added = addClockWidget(db, values);
+ } else if (TAG_APPWIDGET.equals(name)) {
+ added = addAppWidget(db, values, a, packageManager);
+ } else if (TAG_SHORTCUT.equals(name)) {
+ long id = addUriShortcut(db, values, a);
+ added = id >= 0;
+ } else if (TAG_FOLDER.equals(name)) {
+ String title;
+ int titleResId = a.getResourceId(R.styleable.Favorite_title, -1);
+ if (titleResId != -1) {
+ title = mContext.getResources().getString(titleResId);
+ } else {
+ title = mContext.getResources().getString(R.string.folder_name);
}
+ values.put(LauncherSettings.Favorites.TITLE, title);
+ long folderId = addFolder(db, values);
+ added = folderId >= 0;
- values.clear();
- values.put(LauncherSettings.Favorites.CONTAINER, container);
- values.put(LauncherSettings.Favorites.SCREEN, screen);
- values.put(LauncherSettings.Favorites.CELLX, x);
- values.put(LauncherSettings.Favorites.CELLY, y);
+ ArrayList<Long> folderItems = new ArrayList<Long>();
- if (TAG_FAVORITE.equals(name)) {
- long id = addAppShortcut(db, values, a, packageManager, intent);
- added = id >= 0;
- } else if (TAG_SEARCH.equals(name)) {
- added = addSearchWidget(db, values);
- } else if (TAG_CLOCK.equals(name)) {
- added = addClockWidget(db, values);
- } else if (TAG_APPWIDGET.equals(name)) {
- added = addAppWidget(db, values, a, packageManager);
- } else if (TAG_SHORTCUT.equals(name)) {
- long id = addUriShortcut(db, values, a);
- added = id >= 0;
- } else if (TAG_FOLDER.equals(name)) {
- String title;
- int titleResId = a.getResourceId(R.styleable.Favorite_title, -1);
- if (titleResId != -1) {
- title = mContext.getResources().getString(titleResId);
+ int folderDepth = parser.getDepth();
+ while ((type = parser.next()) != XmlPullParser.END_TAG ||
+ parser.getDepth() > folderDepth) {
+ if (type != XmlPullParser.START_TAG) {
+ continue;
+ }
+ final String folder_item_name = parser.getName();
+
+ TypedArray ar = mContext.obtainStyledAttributes(attrs,
+ R.styleable.Favorite);
+ values.clear();
+ values.put(LauncherSettings.Favorites.CONTAINER, folderId);
+
+ if (TAG_FAVORITE.equals(folder_item_name) && folderId >= 0) {
+ long id =
+ addAppShortcut(db, values, ar, packageManager, intent);
+ if (id >= 0) {
+ folderItems.add(id);
+ }
+ } else if (TAG_SHORTCUT.equals(folder_item_name) && folderId >= 0) {
+ long id = addUriShortcut(db, values, ar);
+ if (id >= 0) {
+ folderItems.add(id);
+ }
} else {
- title = mContext.getResources().getString(R.string.folder_name);
+ throw new RuntimeException("Folders can " +
+ "contain only shortcuts");
}
- values.put(LauncherSettings.Favorites.TITLE, title);
- long folderId = addFolder(db, values);
- added = folderId >= 0;
-
- ArrayList<Long> folderItems = new ArrayList<Long>();
-
- int folderDepth = parser.getDepth();
- while ((type = parser.next()) != XmlPullParser.END_TAG ||
- parser.getDepth() > folderDepth) {
- if (type != XmlPullParser.START_TAG) {
- continue;
- }
- final String folder_item_name = parser.getName();
-
- TypedArray ar = mContext.obtainStyledAttributes(attrs,
- R.styleable.Favorite);
- values.clear();
- values.put(LauncherSettings.Favorites.CONTAINER, folderId);
-
- if (TAG_FAVORITE.equals(folder_item_name) && folderId >= 0) {
- long id =
- addAppShortcut(db, values, ar, packageManager, intent);
- if (id >= 0) {
- folderItems.add(id);
- }
- } else if (TAG_SHORTCUT.equals(folder_item_name) && folderId >= 0) {
- long id = addUriShortcut(db, values, ar);
- if (id >= 0) {
- folderItems.add(id);
- }
- } else {
- throw new RuntimeException("Folders can " +
- "contain only shortcuts");
- }
- ar.recycle();
+ ar.recycle();
+ }
+ // We can only have folders with >= 2 items, so we need to remove the
+ // folder and clean up if less than 2 items were included, or some
+ // failed to add, and less than 2 were actually added
+ if (folderItems.size() < 2 && folderId >= 0) {
+ // We just delete the folder and any items that made it
+ deleteId(db, folderId);
+ if (folderItems.size() > 0) {
+ deleteId(db, folderItems.get(0));
}
- // We can only have folders with >= 2 items, so we need to remove the
- // folder and clean up if less than 2 items were included, or some
- // failed to add, and less than 2 were actually added
- if (folderItems.size() < 2 && folderId >= 0) {
- // We just delete the folder and any items that made it
- deleteId(db, folderId);
- if (folderItems.size() > 0) {
- deleteId(db, folderItems.get(0));
- }
- added = false;
- }
+ added = false;
}
}
if (added) i++;
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index f080721..ba303a1 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -1767,9 +1767,9 @@
hideScrollingIndicator(false);
}
};
- protected void flashScrollingIndicator() {
+ protected void flashScrollingIndicator(boolean animated) {
removeCallbacks(hideScrollingIndicatorRunnable);
- showScrollingIndicator(false);
+ showScrollingIndicator(!animated);
postDelayed(hideScrollingIndicatorRunnable, sScrollIndicatorFlashDuration);
}
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index ef39813..c29e50d 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -131,10 +131,6 @@
child.setId(childId);
mChildren.addView(child, index, lp);
- if (child instanceof PagedViewIcon) {
- PagedViewIcon pagedViewIcon = (PagedViewIcon) child;
- pagedViewIcon.disableCache();
- }
return true;
}
return false;
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index b03d867..af10f18 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -17,21 +17,14 @@
package com.android.launcher2;
import android.animation.ObjectAnimator;
-import android.content.ComponentName;
import android.content.Context;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.os.Message;
import android.util.AttributeSet;
-import android.view.KeyEvent;
import android.widget.Checkable;
+import android.widget.TextView;
import com.android.launcher.R;
@@ -40,7 +33,7 @@
* An icon on a PagedView, specifically for items in the launcher's paged view (with compound
* drawables on the top).
*/
-public class PagedViewIcon extends CachedTextView implements Checkable {
+public class PagedViewIcon extends TextView implements Checkable {
private static final String TAG = "PagedViewIcon";
// holographic outline
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index ae71761..88f7954 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -57,6 +57,7 @@
import android.view.DragEvent;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
@@ -107,7 +108,6 @@
private float mBackgroundAlpha = 0;
private float mOverScrollMaxBackgroundAlpha = 0.0f;
private int mOverScrollPageIndex = -1;
- private AnimatorSet mDividerAnimator;
private float mWallpaperScrollRatio = 1.0f;
@@ -1139,6 +1139,7 @@
}
private void screenScrolledLargeUI(int screenCenter) {
+ if (isSwitchingState()) return;
boolean isInOverscroll = false;
for (int i = 0; i < getChildCount(); i++) {
CellLayout cl = (CellLayout) getChildAt(i);
@@ -1280,21 +1281,34 @@
return (mBackground != null && mBackgroundAlpha > 0.0f && mDrawBackground);
}
- @Override
- protected void dispatchDraw(Canvas canvas) {
+ public void scrollTo (int x, int y) {
+ super.scrollTo(x, y);
+ syncChildrenLayersEnabledOnVisiblePages();
+ }
+
+ // This method just applies the value mChildrenLayersEnabled to all the pages that
+ // will be rendered on the next frame.
+ // We do this because calling setChildrenLayersEnabled on a view that's not
+ // visible/rendered causes slowdowns on some graphics cards
+ private void syncChildrenLayersEnabledOnVisiblePages() {
if (mChildrenLayersEnabled) {
getVisiblePages(mTempVisiblePagesRange);
final int leftScreen = mTempVisiblePagesRange[0];
final int rightScreen = mTempVisiblePagesRange[1];
if (leftScreen != -1 && rightScreen != -1) {
- // calling setChildrenLayersEnabled on a view that's not visible/rendered
- // causes slowdowns on some graphics cards, so we set it here to be sure
- // it's only called when it's safe (ie when the view will be rendered)
for (int i = leftScreen; i <= rightScreen; i++) {
- ((ViewGroup)getPageAt(i)).setChildrenLayersEnabled(true);
+ ViewGroup page = (ViewGroup) getPageAt(i);
+ if (page.getVisibility() == VISIBLE &&
+ page.getAlpha() > ViewConfiguration.ALPHA_THRESHOLD) {
+ ((ViewGroup)getPageAt(i)).setChildrenLayersEnabled(true);
+ }
}
}
}
+ }
+
+ @Override
+ protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (mInScrollArea && !LauncherApplication.isScreenLarge()) {
@@ -1723,6 +1737,7 @@
b * mNewBackgroundAlphaMultipliers[i]);
cl.setFastAlpha(a * mOldAlphas[i] + b * mNewAlphas[i]);
}
+ syncChildrenLayersEnabledOnVisiblePages();
}
});
@@ -1760,6 +1775,7 @@
// Fade the background gradient away
animateBackgroundGradient(0f, true);
}
+ syncChildrenLayersEnabledOnVisiblePages();
}
/**
@@ -3494,30 +3510,6 @@
mLauncher.getDragLayer().getLocationInDragLayer(this, loc);
}
- void showDockDivider(boolean immediately) {
- final ViewGroup parent = (ViewGroup) getParent();
- final View qsbDivider = (ImageView) (parent.findViewById(R.id.qsb_divider));
- final View dockDivider = (ImageView) (parent.findViewById(R.id.dock_divider));
- if (qsbDivider != null && dockDivider != null) {
- qsbDivider.setVisibility(View.VISIBLE);
- dockDivider.setVisibility(View.VISIBLE);
- if (mDividerAnimator != null) {
- mDividerAnimator.cancel();
- mDividerAnimator = null;
- }
- if (immediately) {
- qsbDivider.setAlpha(1f);
- dockDivider.setAlpha(1f);
- } else {
- mDividerAnimator = new AnimatorSet();
- mDividerAnimator.playTogether(ObjectAnimator.ofFloat(qsbDivider, "alpha", 1f),
- ObjectAnimator.ofFloat(dockDivider, "alpha", 1f));
- mDividerAnimator.setDuration(sScrollIndicatorFadeInDuration);
- mDividerAnimator.start();
- }
- }
- }
-
void setFadeForOverScroll(float fade) {
if (!isScrollingIndicatorEnabled()) return;
@@ -3531,42 +3523,4 @@
dockDivider.setAlpha(reducedFade);
scrollIndicator.setAlpha(1 - fade);
}
-
- void hideDockDivider(boolean immediately) {
- final ViewGroup parent = (ViewGroup) getParent();
- final View qsbDivider = (ImageView) (parent.findViewById(R.id.qsb_divider));
- final View dockDivider = (ImageView) (parent.findViewById(R.id.dock_divider));
- if (qsbDivider != null && dockDivider != null) {
- if (mDividerAnimator != null) {
- mDividerAnimator.cancel();
- mDividerAnimator = null;
- }
- if (immediately) {
- qsbDivider.setVisibility(View.GONE);
- dockDivider.setVisibility(View.GONE);
- qsbDivider.setAlpha(0f);
- dockDivider.setAlpha(0f);
- } else {
- mDividerAnimator = new AnimatorSet();
- mDividerAnimator.playTogether(ObjectAnimator.ofFloat(qsbDivider, "alpha", 0f),
- ObjectAnimator.ofFloat(dockDivider, "alpha", 0f));
- mDividerAnimator.addListener(new AnimatorListenerAdapter() {
- private boolean cancelled = false;
- @Override
- public void onAnimationCancel(android.animation.Animator animation) {
- cancelled = true;
- }
- @Override
- public void onAnimationEnd(android.animation.Animator animation) {
- if (!cancelled) {
- qsbDivider.setVisibility(View.GONE);
- dockDivider.setVisibility(View.GONE);
- }
- }
- });
- mDividerAnimator.setDuration(sScrollIndicatorFadeOutDuration);
- mDividerAnimator.start();
- }
- }
- }
}