merge in ics-release history after reset to master
diff --git a/res/anim/all_apps_2d_fade_in.xml b/res/anim/all_apps_2d_fade_in.xml
deleted file mode 100644
index 9d2171a..0000000
--- a/res/anim/all_apps_2d_fade_in.xml
+++ /dev/null
@@ -1,23 +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.
--->
-
-<alpha xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/decelerate_interpolator"
-
- android:fromAlpha="0.0"
- android:toAlpha="1.0"
-
- android:duration="@integer/config_appsCustomizeFadeInTime" />
diff --git a/res/anim/all_apps_2d_fade_out.xml b/res/anim/all_apps_2d_fade_out.xml
deleted file mode 100644
index 90520c7..0000000
--- a/res/anim/all_apps_2d_fade_out.xml
+++ /dev/null
@@ -1,23 +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.
--->
-
-<alpha xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/accelerate_interpolator"
-
- android:fromAlpha="1.0"
- android:toAlpha="0.0"
-
- android:duration="@integer/config_appsCustomizeFadeOutTime" />
diff --git a/res/anim/all_apps_zoom_in.xml b/res/anim/all_apps_zoom_in.xml
deleted file mode 100644
index 644d1cf..0000000
--- a/res/anim/all_apps_zoom_in.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/decelerate_interpolator"
- android:shareInterpolator="true">
- <translate xmlns:android="http://schemas.android.com/apk/res/android"
- android:fromXDelta="0%p"
- android:toXDelta="0%p"
- android:fromYDelta="-20%p"
- android:toYDelta="0%p"
- android:duration="500" />
- <scale
- android:fromXScale="5.0"
- android:toXScale="1.0"
- android:fromYScale="5.0"
- android:toYScale="1.0"
- android:pivotX="50%"
- android:pivotY="100%"
- android:duration="500" />
-</set>
diff --git a/res/anim/all_apps_zoom_out.xml b/res/anim/all_apps_zoom_out.xml
deleted file mode 100644
index 23a8712..0000000
--- a/res/anim/all_apps_zoom_out.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/accelerate_interpolator"
- android:shareInterpolator="true">
- <translate xmlns:android="http://schemas.android.com/apk/res/android"
- android:fromXDelta="0%p"
- android:toXDelta="0%p"
- android:fromYDelta="0%p"
- android:toYDelta="-20%p"
- android:duration="500" />
- <scale
- android:fromXScale="1.0"
- android:toXScale="5.0"
- android:fromYScale="1.0"
- android:toYScale="5.0"
- android:pivotX="50%"
- android:pivotY="100%"
- android:duration="500" />
-</set>
diff --git a/res/anim/fade_in_slow.xml b/res/anim/fade_in_slow.xml
deleted file mode 100644
index 9d2171a..0000000
--- a/res/anim/fade_in_slow.xml
+++ /dev/null
@@ -1,23 +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.
--->
-
-<alpha xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/decelerate_interpolator"
-
- android:fromAlpha="0.0"
- android:toAlpha="1.0"
-
- android:duration="@integer/config_appsCustomizeFadeInTime" />
diff --git a/res/anim/fade_out_slow.xml b/res/anim/fade_out_slow.xml
deleted file mode 100644
index 90520c7..0000000
--- a/res/anim/fade_out_slow.xml
+++ /dev/null
@@ -1,23 +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.
--->
-
-<alpha xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/accelerate_interpolator"
-
- android:fromAlpha="1.0"
- android:toAlpha="0.0"
-
- android:duration="@integer/config_appsCustomizeFadeOutTime" />
diff --git a/res/anim/home_customization_drawer_slide_down.xml b/res/anim/home_customization_drawer_slide_down.xml
deleted file mode 100644
index b3041c7..0000000
--- a/res/anim/home_customization_drawer_slide_down.xml
+++ /dev/null
@@ -1,22 +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.
--->
-<translate xmlns:android="http://schemas.android.com/apk/res/android"
- android:fromXDelta="0%p"
- android:toXDelta="0%p"
- android:fromYDelta="0%p"
- android:toYDelta="100%p"
-
- android:duration="500" />
diff --git a/res/anim/home_customization_drawer_slide_up.xml b/res/anim/home_customization_drawer_slide_up.xml
deleted file mode 100644
index 3df2320..0000000
--- a/res/anim/home_customization_drawer_slide_up.xml
+++ /dev/null
@@ -1,22 +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.
--->
-<translate xmlns:android="http://schemas.android.com/apk/res/android"
- android:fromXDelta="0%p"
- android:toXDelta="0%p"
- android:fromYDelta="100%p"
- android:toYDelta="0%p"
-
- android:duration="500" />
diff --git a/res/color/bright_text_dark_focused.xml b/res/color/bright_text_dark_focused.xml
deleted file mode 100644
index 4beb72c..0000000
--- a/res/color/bright_text_dark_focused.xml
+++ /dev/null
@@ -1,24 +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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_window_focused="true" android:state_focused="true" android:color="#000" />
- <item android:state_window_focused="false" android:state_focused="true" android:color="#FFF" />
- <item android:state_window_focused="false" android:color="#FFF" />
- <item android:state_selected="true" android:color="#000" />
- <item android:state_pressed="true" android:color="#000" />
- <item android:color="#FFF" />
-</selector>
diff --git a/res/drawable-hdpi/all_apps_bg_gradient.9.png b/res/drawable-hdpi/all_apps_bg_gradient.9.png
deleted file mode 100644
index 3f4b5b5..0000000
--- a/res/drawable-hdpi/all_apps_bg_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/apps_hotseat_button.png b/res/drawable-hdpi/apps_hotseat_button.png
new file mode 100644
index 0000000..c459ba8
--- /dev/null
+++ b/res/drawable-hdpi/apps_hotseat_button.png
Binary files differ
diff --git a/res/drawable-hdpi/box_launcher_bottom.9.png b/res/drawable-hdpi/box_launcher_bottom.9.png
deleted file mode 100644
index 9708e73..0000000
--- a/res/drawable-hdpi/box_launcher_bottom.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/homescreen_blue_strong_holo.9.png b/res/drawable-hdpi/homescreen_blue_strong_holo.9.png
deleted file mode 100644
index 3407107..0000000
--- a/res/drawable-hdpi/homescreen_blue_strong_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/hotseat_bg_panel.9.png b/res/drawable-hdpi/hotseat_bg_panel.9.png
new file mode 100644
index 0000000..ae718d4
--- /dev/null
+++ b/res/drawable-hdpi/hotseat_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-hdpi/hotseat_scrubber_holo.9.png b/res/drawable-hdpi/hotseat_scrubber_holo.9.png
index 3400050..3a026f8 100644
--- a/res/drawable-hdpi/hotseat_scrubber_holo.9.png
+++ b/res/drawable-hdpi/hotseat_scrubber_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/hotseat_track_holo.9.png b/res/drawable-hdpi/hotseat_track_holo.9.png
index a058a3a..f49344f 100644
--- a/res/drawable-hdpi/hotseat_track_holo.9.png
+++ b/res/drawable-hdpi/hotseat_track_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/widget_divider.png b/res/drawable-hdpi/widget_divider.png
deleted file mode 100644
index 2f92d60..0000000
--- a/res/drawable-hdpi/widget_divider.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-land-hdpi/hotseat_bg_panel.9.png b/res/drawable-land-hdpi/hotseat_bg_panel.9.png
new file mode 100644
index 0000000..6a25f46
--- /dev/null
+++ b/res/drawable-land-hdpi/hotseat_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-land-mdpi/hotseat_bg_panel.9.png b/res/drawable-land-mdpi/hotseat_bg_panel.9.png
new file mode 100644
index 0000000..dbe73d4
--- /dev/null
+++ b/res/drawable-land-mdpi/hotseat_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-large-hdpi/ic_home_info_holo_dark.png b/res/drawable-large-hdpi/ic_home_info_holo_dark.png
deleted file mode 100644
index 02df4e1..0000000
--- a/res/drawable-large-hdpi/ic_home_info_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/all_apps_bg_gradient.9.png b/res/drawable-mdpi/all_apps_bg_gradient.9.png
deleted file mode 100644
index 3f4b5b5..0000000
--- a/res/drawable-mdpi/all_apps_bg_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/apps_hotseat_button.png b/res/drawable-mdpi/apps_hotseat_button.png
new file mode 100644
index 0000000..f9006a4
--- /dev/null
+++ b/res/drawable-mdpi/apps_hotseat_button.png
Binary files differ
diff --git a/res/drawable-mdpi/box_launcher_bottom.9.png b/res/drawable-mdpi/box_launcher_bottom.9.png
deleted file mode 100644
index e7dac0d..0000000
--- a/res/drawable-mdpi/box_launcher_bottom.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/homescreen_blue_strong_holo.9.png b/res/drawable-mdpi/homescreen_blue_strong_holo.9.png
deleted file mode 100644
index fdd9dbb..0000000
--- a/res/drawable-mdpi/homescreen_blue_strong_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/hotseat_bg_panel.9.png b/res/drawable-mdpi/hotseat_bg_panel.9.png
new file mode 100644
index 0000000..1074d61
--- /dev/null
+++ b/res/drawable-mdpi/hotseat_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-mdpi/hotseat_scrubber_holo.9.png b/res/drawable-mdpi/hotseat_scrubber_holo.9.png
index 69f74f7..de66649 100644
--- a/res/drawable-mdpi/hotseat_scrubber_holo.9.png
+++ b/res/drawable-mdpi/hotseat_scrubber_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/hotseat_track_holo.9.png b/res/drawable-mdpi/hotseat_track_holo.9.png
index a058a3a..3dcab67 100644
--- a/res/drawable-mdpi/hotseat_track_holo.9.png
+++ b/res/drawable-mdpi/hotseat_track_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_voice_search.png b/res/drawable-mdpi/ic_voice_search.png
deleted file mode 100644
index 3c52e2a..0000000
--- a/res/drawable-mdpi/ic_voice_search.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/widget_divider.png b/res/drawable-mdpi/widget_divider.png
deleted file mode 100644
index 1b453c5..0000000
--- a/res/drawable-mdpi/widget_divider.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/grid_selector.xml b/res/drawable/grid_selector.xml
deleted file mode 100644
index 009cfe1..0000000
--- a/res/drawable/grid_selector.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2007, 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_pressed="true" android:drawable="@drawable/pressed_application_background" />
- <item android:state_focused="false" android:drawable="@drawable/focused_application_background" />
- <item android:state_window_focused="true" android:drawable="@drawable/focused_application_background" />
- <item android:state_window_focused="false" android:drawable="@android:color/transparent" />
-</selector>
diff --git a/res/drawable/home_button.xml b/res/drawable/home_button.xml
deleted file mode 100644
index 032989d..0000000
--- a/res/drawable/home_button.xml
+++ /dev/null
@@ -1,23 +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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/home_button_pressed" />
- <item android:state_focused="true" android:state_window_focused="true" android:drawable="@drawable/home_button_focused" />
- <item android:state_focused="true" android:state_window_focused="false" android:drawable="@drawable/home_button_normal" />
- <item android:drawable="@drawable/home_button_normal" />
-</selector>
-
diff --git a/res/layout-land/hotseat.xml b/res/layout-land/hotseat.xml
new file mode 100644
index 0000000..79661a7
--- /dev/null
+++ b/res/layout-land/hotseat.xml
@@ -0,0 +1,33 @@
+<?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.Hotseat
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ android:background="@drawable/hotseat_bg_panel"
+ launcher:cellCountX="1"
+ launcher:cellCountY="-1">
+ <com.android.launcher2.CellLayout
+ android:id="@+id/layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingTop="@dimen/workspace_top_padding"
+ android:paddingBottom="@dimen/workspace_bottom_padding"
+ launcher:cellWidth="@dimen/workspace_cell_width"
+ launcher:cellHeight="@dimen/workspace_cell_height"
+ launcher:widthGap="-1dp"
+ launcher:heightGap="-1dp"
+ launcher:maxGap="@dimen/workspace_max_gap" />
+</com.android.launcher2.Hotseat>
\ No newline at end of file
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 4aa4870..4d40ada 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -4,9 +4,9 @@
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.
@@ -22,25 +22,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <!-- The workspace contains 5 screens of cells -->
- <com.android.launcher2.Workspace
- android:id="@+id/workspace"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scrollbars="horizontal"
- android:fadeScrollbars="true"
- launcher:defaultScreen="2"
- launcher:cellCountX="4"
- launcher:cellCountY="4"
- launcher:pageSpacing="@dimen/workspace_page_spacing">
-
- <include android:id="@+id/cell1" layout="@layout/workspace_screen" />
- <include android:id="@+id/cell2" layout="@layout/workspace_screen" />
- <include android:id="@+id/cell3" layout="@layout/workspace_screen" />
- <include android:id="@+id/cell4" layout="@layout/workspace_screen" />
- <include android:id="@+id/cell5" layout="@layout/workspace_screen" />
- </com.android.launcher2.Workspace>
-
<include
android:id="@+id/paged_view_indicator_track"
layout="@layout/scroll_indicator_track"
@@ -54,6 +35,25 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
+ <!-- The workspace contains 5 screens of cells -->
+ <com.android.launcher2.Workspace
+ android:id="@+id/workspace"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingLeft="@dimen/qsb_bar_height"
+ android:paddingRight="@dimen/button_bar_height"
+ launcher:defaultScreen="2"
+ launcher:cellCountX="4"
+ launcher:cellCountY="4"
+ launcher:pageSpacing="@dimen/workspace_page_spacing">
+
+ <include android:id="@+id/cell1" layout="@layout/workspace_screen" />
+ <include android:id="@+id/cell2" layout="@layout/workspace_screen" />
+ <include android:id="@+id/cell3" layout="@layout/workspace_screen" />
+ <include android:id="@+id/cell4" layout="@layout/workspace_screen" />
+ <include android:id="@+id/cell5" layout="@layout/workspace_screen" />
+ </com.android.launcher2.Workspace>
+
<include layout="@layout/qsb_bar"
android:id="@+id/qsb_bar"
android:layout_width="@dimen/qsb_bar_height"
@@ -66,31 +66,11 @@
android:layout_height="match_parent"
android:visibility="invisible" />
- <RelativeLayout
- android:id="@+id/all_apps_button_cluster"
- android:layout_height="fill_parent"
- android:layout_width="@dimen/button_bar_height_portrait"
- android:layout_gravity="right|center_vertical"
- android:layout_marginBottom="@dimen/half_status_bar_height">
- <ImageView
- android:id="@+id/hotseat_left"
- style="@style/HotseatButton.Left"
- android:layout_below="@id/all_apps_button"
- android:src="@drawable/hotseat_phone"
- android:onClick="launchHotSeat" />
- <com.android.launcher2.HandleView
- style="@style/HotseatButton"
- android:id="@+id/all_apps_button"
- android:layout_centerVertical="true"
- android:layout_alignParentRight="true"
- android:src="@drawable/all_apps_button"
- launcher:direction="vertical" />
- <ImageView
- android:id="@+id/hotseat_right"
- style="@style/HotseatButton.Right"
- android:layout_above="@id/all_apps_button"
- android:src="@drawable/hotseat_browser"
- android:onClick="launchHotSeat" />
+ <include layout="@layout/hotseat"
+ android:id="@+id/hotseat"
+ android:layout_width="@dimen/button_bar_height"
+ android:layout_height="match_parent"
+ android:layout_gravity="right" />
- </RelativeLayout>
+
</com.android.launcher2.DragLayer>
diff --git a/res/layout-land/search_bar.xml b/res/layout-land/search_bar.xml
index e3f67a1..0dbfd7b 100644
--- a/res/layout-land/search_bar.xml
+++ b/res/layout-land/search_bar.xml
@@ -26,6 +26,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_search_normal_holo"
+ android:adjustViewBounds="true"
android:background="@drawable/button_bg"
android:onClick="onClickSearchButton"
android:focusable="true"
@@ -47,9 +48,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_voice_search_holo"
+ android:adjustViewBounds="true"
android:background="@drawable/button_bg"
android:onClick="onClickVoiceButton"
android:focusable="true"
android:clickable="true"
android:contentDescription="@string/accessibility_voice_search_button" />
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/res/layout-large/button_bar.xml b/res/layout-large/button_bar.xml
deleted file mode 100644
index efe9e13..0000000
--- a/res/layout-large/button_bar.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- android:focusable="false">
-
- <!-- Global search icon -->
- <ImageView
- android:id="@+id/search_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
- android:paddingRight="@dimen/toolbar_button_horizontal_padding"
- android:paddingTop="@dimen/toolbar_button_vertical_padding"
- android:paddingBottom="@dimen/toolbar_button_vertical_padding"
- android:src="@drawable/ic_search_normal_holo"
- android:background="@drawable/button_bg"
- android:onClick="onClickSearchButton"
-
- android:focusable="true"
- android:clickable="true"
- android:contentDescription="@string/accessibility_search_button" />
-
- <ImageView
- android:id="@+id/search_divider"
- android:src="@drawable/divider_launcher_holo"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_toRightOf="@+id/search_button"
- android:paddingTop="@dimen/toolbar_button_vertical_padding"
- android:paddingBottom="@dimen/toolbar_button_vertical_padding"
-
- android:onClick="onClickSearchButton"
- android:focusable="false"
- android:clickable="true" />
-
- <!-- Voice search icon -->
- <ImageView
- android:id="@+id/voice_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@+id/search_divider"
- android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
- android:paddingRight="@dimen/toolbar_button_horizontal_padding"
- android:paddingTop="@dimen/toolbar_button_vertical_padding"
- android:paddingBottom="@dimen/toolbar_button_vertical_padding"
- android:src="@drawable/ic_voice_search_holo"
- android:background="@drawable/button_bg"
- android:onClick="onClickVoiceButton"
-
- android:focusable="true"
- android:clickable="true"
- android:contentDescription="@string/accessibility_voice_search_button" />
-
- <!-- AllApps icon -->
- <com.android.launcher2.StrokedTextView
- android:id="@+id/all_apps_button"
- android:onClick="onClickAllAppsButton"
- android:text="@string/all_apps_button_label"
- android:drawablePadding="@dimen/all_apps_button_drawable_padding"
- android:drawableLeft="@drawable/ic_home_all_apps_holo_dark"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toLeftOf="@+id/all_apps_divider"
- android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
- android:paddingRight="@dimen/toolbar_button_horizontal_padding"
- android:paddingTop="@dimen/all_apps_button_vertical_padding"
- android:paddingBottom="@dimen/all_apps_button_vertical_padding"
- android:background="@drawable/button_bg"
-
- android:gravity="center_horizontal|center_vertical"
- android:textColor="#CCFFFFFF"
- android:textSize="18sp"
-
- launcher:strokeColor="#991e3157"
- launcher:strokeTextColor="#DDFFFFFF"
- launcher:strokeWidth="2.5"
-
- android:shadowColor="#DA000000"
- android:shadowDx="0.0"
- android:shadowDy="0.0"
- android:shadowRadius="2.5"
-
- android:focusable="true"
- android:clickable="true"
- android:contentDescription="@string/accessibility_all_apps_button" />
-
- <ImageView
- android:id="@+id/all_apps_divider"
- android:src="@drawable/divider_launcher_holo"
- android:onClick="onClickAllAppsButton"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_toLeftOf="@+id/configure_button"
- android:paddingTop="@dimen/toolbar_button_vertical_padding"
- android:paddingBottom="@dimen/toolbar_button_vertical_padding"
-
- android:focusable="false"
- android:clickable="true" />
-
- <!-- Customize icon -->
- <ImageView
- android:id="@+id/configure_button"
- android:src="@drawable/ic_home_add_holo_dark"
- android:onClick="onClickConfigureButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_alignParentRight="true"
- android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
- android:paddingRight="@dimen/toolbar_button_horizontal_padding"
- android:paddingTop="@dimen/toolbar_button_vertical_padding"
- android:paddingBottom="@dimen/toolbar_button_vertical_padding"
- android:background="@drawable/button_bg"
- android:focusable="true"
- android:contentDescription="@string/accessibility_customize_button" />
-
- <!-- Delete icon -->
- <com.android.launcher2.DeleteZone
- android:id="@+id/delete_zone"
- android:text="@string/delete_zone_label_workspace"
- android:drawablePadding="@dimen/delete_zone_drawable_padding"
- android:drawableLeft="@drawable/delete_target_selector"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignRight="@+id/configure_button"
- android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
- android:paddingRight="@dimen/toolbar_button_horizontal_padding"
- android:paddingTop="@dimen/toolbar_button_vertical_padding"
- android:paddingBottom="@dimen/toolbar_button_vertical_padding"
- android:background="@drawable/button_bg"
-
- android:gravity="center_horizontal|center_vertical"
- android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
- android:textSize="18sp"
- 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:visibility="gone"
- launcher:direction="horizontal"
-
- android:focusable="true"
- android:contentDescription="@string/accessibility_delete_button" />
-</RelativeLayout>
diff --git a/res/layout-port/hotseat.xml b/res/layout-port/hotseat.xml
new file mode 100644
index 0000000..88dd738
--- /dev/null
+++ b/res/layout-port/hotseat.xml
@@ -0,0 +1,33 @@
+<?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.Hotseat
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ android:background="@drawable/hotseat_bg_panel"
+ launcher:cellCountX="-1"
+ launcher:cellCountY="1">
+ <com.android.launcher2.CellLayout
+ android:id="@+id/layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingLeft="@dimen/workspace_left_padding"
+ android:paddingRight="@dimen/workspace_right_padding"
+ launcher:cellWidth="@dimen/workspace_cell_width"
+ launcher:cellHeight="@dimen/workspace_cell_height"
+ launcher:widthGap="-1dp"
+ launcher:heightGap="-1dp"
+ launcher:maxGap="@dimen/workspace_max_gap" />
+</com.android.launcher2.Hotseat>
\ No newline at end of file
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index 73051ba..fc39034 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -4,9 +4,9 @@
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.
@@ -22,6 +22,23 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <!-- Keep these behind the workspace so that they are not visible when
+ we go into AllApps -->
+ <include
+ android:id="@+id/paged_view_indicator_track"
+ layout="@layout/scroll_indicator_track"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:layout_marginBottom="@dimen/button_bar_height" />
+ <include
+ android:id="@+id/paged_view_indicator"
+ layout="@layout/scroll_indicator"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:layout_marginBottom="@dimen/button_bar_height" />
+
<!-- The workspace contains 5 screens of cells -->
<com.android.launcher2.Workspace
android:id="@+id/workspace"
@@ -39,21 +56,6 @@
<include android:id="@+id/cell5" layout="@layout/workspace_screen" />
</com.android.launcher2.Workspace>
- <include
- android:id="@+id/paged_view_indicator_track"
- layout="@layout/scroll_indicator_track"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:layout_marginBottom="@dimen/button_bar_height" />
- <include
- android:id="@+id/paged_view_indicator"
- layout="@layout/scroll_indicator"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:layout_marginBottom="@dimen/button_bar_height" />
-
<include layout="@layout/qsb_bar"
android:id="@+id/qsb_bar"
android:layout_width="match_parent"
@@ -66,31 +68,12 @@
android:layout_height="match_parent"
android:visibility="invisible" />
- <RelativeLayout
- android:id="@+id/all_apps_button_cluster"
- android:layout_width="fill_parent"
+ <include layout="@layout/hotseat"
+ android:id="@+id/hotseat"
+ android:layout_width="match_parent"
android:layout_height="@dimen/button_bar_height"
- android:layout_gravity="bottom|center_horizontal"
- android:paddingTop="2dip">
- <ImageView
- android:id="@+id/hotseat_left"
- style="@style/HotseatButton.Left"
- android:layout_toLeftOf="@id/all_apps_button"
- android:src="@drawable/hotseat_phone"
- android:onClick="launchHotSeat" />
- <com.android.launcher2.HandleView
- style="@style/HotseatButton"
- android:id="@+id/all_apps_button"
- android:layout_centerHorizontal="true"
- android:layout_alignParentBottom="true"
- android:src="@drawable/all_apps_button"
- launcher:direction="horizontal" />
- <ImageView
- android:id="@+id/hotseat_right"
- style="@style/HotseatButton.Right"
- android:layout_toRightOf="@id/all_apps_button"
- android:src="@drawable/hotseat_browser"
- android:onClick="launchHotSeat" />
- </RelativeLayout>
+ android:layout_gravity="bottom" />
+
+
</com.android.launcher2.DragLayer>
diff --git a/res/layout-port/search_bar.xml b/res/layout-port/search_bar.xml
index f9a202a..0de290a 100644
--- a/res/layout-port/search_bar.xml
+++ b/res/layout-port/search_bar.xml
@@ -36,7 +36,8 @@
android:id="@+id/search_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:src="@drawable/ic_search_normal_holo" />
+ android:src="@drawable/ic_search_normal_holo"
+ android:adjustViewBounds="true" />
</LinearLayout>
<!-- Voice search icon -->
@@ -48,6 +49,7 @@
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="@drawable/ic_voice_search_holo"
+ android:adjustViewBounds="true"
android:background="@drawable/button_bg"
android:onClick="onClickVoiceButton"
android:focusable="true"
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index adb0a6d..c277153 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -79,13 +79,6 @@
launcher:maxGap="@dimen/workspace_max_gap" />
<include
- style="@style/AppsCustomizeScrollTrack"
- android:id="@+id/paged_view_indicator_track"
- layout="@layout/scroll_indicator_track"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
- <include
android:id="@+id/paged_view_indicator"
layout="@layout/scroll_indicator"
android:layout_width="wrap_content"
diff --git a/res/layout/apps_customize_wallpaper.xml b/res/layout/apps_customize_wallpaper.xml
deleted file mode 100644
index d93825f..0000000
--- a/res/layout/apps_customize_wallpaper.xml
+++ /dev/null
@@ -1,68 +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.PagedViewWidget
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
-
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:orientation="vertical"
-
- launcher:blurColor="#FF6B8CF0"
- launcher:outlineColor="#FF8CD2FF"
-
- android:background="@drawable/focusable_view_bg"
- android:focusable="true">
-
- <!-- The wallpaper preview. -->
- <ImageView
- android:id="@+id/widget_preview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:paddingBottom="10dp"
- android:adjustViewBounds="true"
- android:scaleType="fitStart" />
-
- <!-- The divider image. -->
- <ImageView
- android:id="@+id/divider"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingTop="10dp"
- android:paddingBottom="10dp"
- android:src="@drawable/widget_divider" />
-
- <!-- The name of the wallpaper. -->
- <TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/widget_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:gravity="left|bottom"
-
- android:textColor="#FFFFFFFF"
- android:textSize="14sp"
- android:shadowColor="#FF000000"
- android:shadowDx="0.0"
- android:shadowDy="1.0"
- android:shadowRadius="1.0"
-
- android:maxLines="2"
- android:fadingEdge="horizontal" />
-</com.android.launcher2.PagedViewWidget>
diff --git a/res/layout/home_customization_drawer_item.xml b/res/layout/home_customization_drawer_item.xml
deleted file mode 100644
index 4d61dbf..0000000
--- a/res/layout/home_customization_drawer_item.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="200dip"
- android:layout_height="200dip"
- android:padding="20dip"
- android:orientation="vertical"
- android:gravity="center_horizontal|center_vertical|clip_vertical"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="#ffffffff" />
\ No newline at end of file
diff --git a/res/layout/home_customization_drawer_widget.xml b/res/layout/home_customization_drawer_widget.xml
deleted file mode 100644
index 1581308..0000000
--- a/res/layout/home_customization_drawer_widget.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="600dip"
- android:layout_height="match_parent"
- android:padding="20dip"
- android:orientation="vertical"
- android:gravity="center_horizontal|center_vertical|clip_vertical"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="#ffffffff" />
\ No newline at end of file
diff --git a/res/layout/list_category.xml b/res/layout/list_category.xml
deleted file mode 100644
index 1e8d04c..0000000
--- a/res/layout/list_category.xml
+++ /dev/null
@@ -1,18 +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.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- style="?android:attr/listSeparatorTextViewStyle" />
diff --git a/res/layout/list_checkbox_2lines.xml b/res/layout/list_checkbox_2lines.xml
deleted file mode 100644
index 1debcd6..0000000
--- a/res/layout/list_checkbox_2lines.xml
+++ /dev/null
@@ -1,60 +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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:gravity="center_vertical"
- android:paddingRight="?android:attr/scrollbarSize">
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="15dip"
- android:layout_marginRight="6dip"
- android:layout_marginTop="6dip"
- android:layout_marginBottom="6dip"
- android:layout_weight="1">
-
- <TextView android:id="@+id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal" />
-
- <TextView android:id="@+id/summary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/title"
- android:layout_alignLeft="@id/title"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:maxLines="2" />
-
- </RelativeLayout>
-
- <CheckBox
- android:id="@+id/checkbox"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="4dip"
- android:layout_gravity="center_vertical"
- android:focusable="false"
- android:clickable="false" />
-
-</LinearLayout>
diff --git a/res/layout/pick_item.xml b/res/layout/pick_item.xml
deleted file mode 100644
index 62fc4f4..0000000
--- a/res/layout/pick_item.xml
+++ /dev/null
@@ -1,25 +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.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:textAppearance="?android:attr/textAppearanceLargeInverse"
- android:gravity="center_vertical"
- android:drawablePadding="14dip"
- android:paddingLeft="15dip"
- android:paddingRight="15dip" />
diff --git a/res/layout/scroll_indicator_track.xml b/res/layout/scroll_indicator_track.xml
index c0d065a..e3aa625 100644
--- a/res/layout/scroll_indicator_track.xml
+++ b/res/layout/scroll_indicator_track.xml
@@ -16,7 +16,7 @@
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- android:paddingLeft="@dimen/scroll_track_padding"
- android:paddingRight="@dimen/scroll_track_padding"
+ android:paddingLeft="@dimen/scroll_track_padding_left"
+ android:paddingRight="@dimen/scroll_track_padding_right"
android:scaleType="fitXY"
android:src="@drawable/hotseat_track_holo" />
\ No newline at end of file
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 463cd17..d484393 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -17,7 +17,7 @@
<resources>
<!-- QSB -->
<dimen name="toolbar_button_vertical_padding">12dip</dimen>
- <dimen name="toolbar_button_horizontal_padding">12dip</dimen>
+ <dimen name="toolbar_button_horizontal_padding">10dip</dimen>
<!-- Workspace -->
<dimen name="workspace_left_padding">@dimen/qsb_bar_height</dimen>
@@ -25,10 +25,8 @@
<dimen name="workspace_top_padding">0dp</dimen>
<dimen name="workspace_bottom_padding">0dp</dimen>
<dimen name="workspace_page_spacing">8dp</dimen>
-
- <dimen name="folder_cell_width">100dip</dimen>
- <dimen name="folder_cell_height">74dip</dimen>
- <dimen name="button_bar_height">62dip</dimen>
+ <dimen name="scroll_track_padding_left">@dimen/qsb_bar_height</dimen>
+ <dimen name="scroll_track_padding_right">@dimen/button_bar_height</dimen>
<!-- AppsCustomize -->
<dimen name="apps_customize_cell_width">80dp</dimen>
diff --git a/res/values-large/config.xml b/res/values-large/config.xml
index 34dbb0f..f0ce348 100644
--- a/res/values-large/config.xml
+++ b/res/values-large/config.xml
@@ -1,22 +1,8 @@
<resources>
<!-- AllApps/Customize/AppsCustomize -->
- <!-- Fade/zoom in/out duration & scale in the Customize transition.
- Note: This should be less than the workspaceShrinkTime as they happen together. -->
- <integer name="config_customizeZoomInTime">800</integer>
- <integer name="config_customizeZoomOutTime">600</integer>
- <integer name="config_customizeZoomScaleFactor">7</integer>
- <integer name="config_customizeFadeInTime">800</integer>
<!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
<integer name="config_workspaceSpringLoadShrinkPercentage">90</integer>
- <!-- The slope, in percent, of the drag movement needed to drag an item out of
- Customize (y / x * 100%) -->
- <integer name="config_customizationDrawerDragSlopeThreshold">150</integer>
-
- <!-- Duration in milliseconds of the animations between all apps, customize, & home.
- NOTE: If these are changed, the toolbar animation times below should also be. -->
- <integer name="config_customizeWorkspaceShrinkTime">800</integer>
-
<!-- Workspace -->
<!-- Whether or not the drop targets drop down as opposed to fade in -->
<bool name="config_useDropTargetDownTransition">true</bool>
diff --git a/res/values-large/dimens.xml b/res/values-large/dimens.xml
index 05ec9c8..a0fc814 100644
--- a/res/values-large/dimens.xml
+++ b/res/values-large/dimens.xml
@@ -53,7 +53,6 @@
<dimen name="allAppsSmallScreenVerticalMarginLandscape">30dip</dimen>
<dimen name="allAppsSmallScreenVerticalMarginPortrait">60dip</dimen>
- <dimen name="all_apps_button_drawable_padding">0dip</dimen>
<dimen name="all_apps_button_vertical_padding">4dip</dimen>
<!-- roughly a status bar (for determining how many rows of icons are in home) -->
@@ -64,9 +63,6 @@
<dimen name="wallpaper_chooser_grid_height">140dp</dimen>
<dimen name="live_wallpaper_grid_item_padding">8dip</dimen>
- <!-- live_wallpaper_grid_item_width + 2 * live_wallpaper_grid_item_padding-->
- <dimen name="live_wallpaper_column_width">212dip</dimen>
-
<!-- How much the content view of an alert dialog should be inset (currently used
for the WallpaperChooser in XLarge mode) -->
<dimen name="alert_dialog_content_inset">0dp</dimen>
diff --git a/res/values-large/styles.xml b/res/values-large/styles.xml
index bd4efe7..c4203fd 100644
--- a/res/values-large/styles.xml
+++ b/res/values-large/styles.xml
@@ -18,17 +18,7 @@
-->
<resources>
-<!-- AppsCustomize -->
- <style name="AppsCustomizeScrollTrack">
- <item name="android:visibility">gone</item>
- </style>
-
<!-- Workspace -->
- <style name="ScrollIndicatorTrack">
- <item name="android:visibility">gone</item>
- <item name="android:alpha">0</item>
- </style>
-
<style name="WorkspaceIcon.Portrait">
<item name="android:drawablePadding">4dp</item>
<item name="android:paddingLeft">4dp</item>
diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml
index c5fdd68..998bdc2 100644
--- a/res/values-port/dimens.xml
+++ b/res/values-port/dimens.xml
@@ -18,16 +18,10 @@
<!-- Workspace -->
<dimen name="workspace_left_padding">0dp</dimen>
<dimen name="workspace_right_padding">0dp</dimen>
- <!-- NOTE: This padding is the @dimen/qsb_bar_height + some padding -->
- <dimen name="workspace_top_padding">60dp</dimen>
- <!-- NOTE: This padding is the @dimen/button_bar_height + some padding
- for signposting -->
- <dimen name="workspace_bottom_padding">64dp</dimen>
+ <dimen name="workspace_top_padding">@dimen/qsb_bar_height</dimen>
+ <dimen name="workspace_bottom_padding">@dimen/button_bar_height</dimen>
<dimen name="workspace_page_spacing">8dp</dimen>
- <dimen name="folder_cell_width">74dip</dimen>
- <dimen name="folder_cell_height">86dip</dimen>
-
<integer name="apps_customize_cellCountX">4</integer>
<integer name="apps_customize_cellCountY">5</integer>
<dimen name="apps_customize_pageLayoutWidthGap">-1dp</dimen>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 55518df..e093e36 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -38,6 +38,15 @@
<attr name="cellCountY" format="integer" />
</declare-styleable>
+ <!-- Hotseat specific attributes. These attributes are used to customize
+ the hotseat in XML files. -->
+ <declare-styleable name="Hotseat">
+ <!-- The number of horizontal cells in the CellLayout -->
+ <attr name="cellCountX" />
+ <!-- The number of vertical cells in the CellLayout -->
+ <attr name="cellCountY" />
+ </declare-styleable>
+
<!-- CellLayout specific attributes. These attributes are used to customize
a CellLayout view in XML files. -->
<declare-styleable name="CellLayout">
@@ -125,6 +134,7 @@
<declare-styleable name="Favorite">
<attr name="className" format="string" />
<attr name="packageName" format="string" />
+ <attr name="container" format="string" />
<attr name="screen" format="string" />
<attr name="x" format="string" />
<attr name="y" format="string" />
diff --git a/res/values/colors.xml b/res/values/colors.xml
index ae73b04..71f282c 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -23,17 +23,9 @@
<color name="delete_target_hover_tint">#DAFF0000</color>
<color name="info_target_hover_tint">#DA0099CC</color>
- <color name="window_background">#FF191919</color>
- <color name="grid_dark_background">#EB191919</color>
<color name="bubble_dark_background">#20000000</color>
<color name="appwidget_error_color">#FCCC</color>
- <color name="snag_callout_color">#F444</color>
-
- <color name="gesture_color">#ff0563c1</color>
- <color name="uncertain_gesture_color">#ff848484</color>
-
- <color name="dimmed_view_color">#FF7F7F7F</color>
<color name="drag_outline_color">#6595f9</color>
@@ -44,5 +36,4 @@
<color name="workspace_all_apps_and_delete_zone_text_color">#CCFFFFFF</color>
<color name="workspace_all_apps_and_delete_zone_text_shadow_color">#A0000000</color>
- <color name="workspace_delete_zone_drag_text_color">#FFFF0000</color>
</resources>
diff --git a/res/values/config.xml b/res/values/config.xml
index 7a45211..5ddf0a1 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -36,12 +36,6 @@
AppsCustomize (y / x * 100%) -->
<integer name="config_appsCustomizeDragSlopeThreshold">150</integer>
- <!-- Fade in/out duration of toolbar/button bar icons.
- Note: In + Out duration together should be less the duration of the transition
- between AllApps, Customize & the Workspace. -->
- <integer name="config_toolbarButtonFadeInTime">350</integer>
- <integer name="config_toolbarButtonFadeOutTime">200</integer>
-
<!-- Batch loading for loading in LauncherModel -->
<integer name="config_allAppsBatchLoadDelay">0</integer>
<integer name="config_allAppsBatchSize">0</integer>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 08a2c76..75786eb 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -16,13 +16,14 @@
<resources>
<!-- Workspace -->
- <dimen name="qsb_bar_height">56dp</dimen>
+ <dimen name="qsb_bar_height">48dp</dimen>
<dimen name="workspace_cell_width">80dp</dimen>
<dimen name="workspace_cell_height">80dp</dimen>
<dimen name="workspace_width_gap">-1dp</dimen>
<dimen name="workspace_height_gap">-1dp</dimen>
<dimen name="workspace_max_gap">8dp</dimen>
- <dimen name="scroll_track_padding">10dp</dimen>
+ <dimen name="scroll_track_padding_left">12dp</dimen>
+ <dimen name="scroll_track_padding_right">12dp</dimen>
<!-- QSB -->
<dimen name="toolbar_button_vertical_padding">0dip</dimen>
@@ -41,15 +42,11 @@
<dimen name="title_texture_width">120px</dimen>
<!-- height of the bottom row of controls -->
- <dimen name="button_bar_height">56dip</dimen>
+ <dimen name="button_bar_height">80dip</dimen>
<!-- Drag padding to add to the drop targets -->
<dimen name="drop_target_drag_padding">20dp</dimen>
- <!-- so we have access to this dimension in landscape mode even though
- button_bar_height changes -->
- <dimen name="button_bar_height_portrait">56dip</dimen>
-
<!-- extra horizontal spacing between mini screen thumbnails ie. in all
apps and in customization mode -->
<dimen name="smallScreenExtraSpacing">0dip</dimen>
@@ -66,10 +63,6 @@
home icon in landscape) -->
<dimen name="status_bar_height">25dip</dimen>
- <!-- roughly half a status bar (for vertically centering the right-hand
- button cluster in landscape) -->
- <dimen name="half_status_bar_height">12dip</dimen>
-
<!-- Dragging -->
<!-- the area at the edge of the screen that makes the workspace go left
or right while you're dragging. -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index dcbc6d9..c0df443 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -24,13 +24,6 @@
<string name="sharedUserId" translatable="false"><xliff:g id="x"></xliff:g></string>
<!-- Do not translate. android:process of this application. -->
<string name="process" translatable="false"><xliff:g id="x"></xliff:g></string>
-
- <!-- Do not translate. We wish to prioritize the Wallpaper and Live Wallpaper pickers,
- but because they are in a different package, we need to reference the component in
- a non language-dependent way. If the Live Wallpaper picker component name changes
- this will have to be updated as well. -->
- <string name="live_wallpaper_picker_package_name" translatable="false">com.android.wallpaper.livepicker</string>
- <string name="live_wallpaper_picker_class_name" translatable="false">com.android.wallpaper.livepicker.LiveWallpaperActivity</string>
<!-- General -->
<skip />
@@ -40,30 +33,10 @@
<string name="uid_name">Android Core Apps</string>
<!-- Default folder name -->
<string name="folder_name"></string>
- <!-- Title of dialog that appears after user selects Wallpaper from menu -->
- <string name="chooser_wallpaper">Select wallpaper from</string>
- <!-- Button label on Wallpaper Gallery screen; user selects this button to set a specific wallpaper -->
- <string name="wallpaper_instructions">Set wallpaper</string>
- <!-- Option in "Select wallpaper from" dialog box -->
- <string name="pick_wallpaper">Wallpapers</string>
<!-- Displayed when user selects a shortcut for an app that was uninstalled [CHAR_LIMIT=none]-->
<string name="activity_not_found">Application is not installed.</string>
- <!-- List item for configuring the current wallpaper -->
- <string name="configure_wallpaper">Configure...</string>
<!-- Labels for the tabs in the customize drawer -->
<string name="widgets_tab_label">Widgets</string>
- <!-- Title of tab containing all possible folders (ie standard Folders and Live Folders) that
- can be added to the home screen -->
- <string name="folders_tab_label">Folders</string>
- <!-- Title of tab containing all possible shortcuts (eg Contacts, Bookmarks) that can be
- added to the home screen -->
- <string name="shortcuts_tab_label">More</string>
- <!-- Title of tab for configuring wallpapers -->
- <string name="wallpapers_tab_label">Wallpapers</string>
- <!-- Title of tab for configuring applications -->
- <string name="applications_tab_label">App shortcuts</string>
- <!-- Placeholder text, will be removed -->
- <string name="wallpapers_temp_tab_text">This will be the wallpapers tab</string>
<!-- AppsCustomize pane -->
<!-- Message to tell the user to long-press on a widget to add it [CHAR_LIMIT=50] -->
@@ -102,24 +75,14 @@
<string name="menu_item_add_item">Add to Home screen</string>
<!-- Options in "Add to Home" dialog box; Title of the group containing the list of all apps -->
<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 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 -->
- <string name="group_live_folders">Folders</string>
<!-- Options in "Add to Home" dialog box; Title of the group containing the list of all widgets/gadgets -->
<string name="group_widgets">Widgets</string>
<!-- Options in "Add to Home" dialog box; Title of the group containing the list of apps that can set the wallpaper-->
<string name="group_wallpapers">Wallpapers</string>
- <!-- Options in "Add to Home" dialog box; Name of the Folder widget-->
- <string name="add_folder">Folder</string>
- <!-- Options in "Add to Home" dialog box; Name of the Clock widget-->
- <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>
<!-- 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>
+ <!-- Error message when user tries to drop an invalid item on the hotseat -->
+ <string name="invalid_hotseat_item">This widget is too large for the hotseat.</string>
<!-- Message displayed when a shortcut is created by an external application -->
<string name="shortcut_installed">Shortcut \"<xliff:g id="name" example="Browser">%s</xliff:g>\" created.</string>
<!-- Message displayed when a shortcut is uninstalled by an external application -->
@@ -131,8 +94,6 @@
<string name="title_select_shortcut">Select shortcut</string>
<!-- Title of dialog when user is selecting an application to add to homescreen -->
<string name="title_select_application">Select application</string>
- <!-- Title of dialog when user is selecting live folder to add to homescreen -->
- <string name="title_select_live_folder">Select folder</string>
<!-- All applications label -->
<string name="all_apps_button_label">Apps</string>
@@ -159,8 +120,6 @@
<string name="accessibility_voice_search_button">Voice Search</string>
<!-- Accessibility: AllApps button -->
<string name="accessibility_all_apps_button">Applications</string>
- <!-- Accessibility: Customize button -->
- <string name="accessibility_customize_button">Customize</string>
<!-- Accessibility: Delete button -->
<string name="accessibility_delete_button">Remove</string>
@@ -180,8 +139,6 @@
<string name="menu_search">Search</string>
<!-- Noun, menu item used to bring down the notifications shade -->
<string name="menu_notifications">Notifications</string>
- <!-- Noun, menu item used to show the gestures settings -->
- <string name="menu_gestures">Gestures</string>
<!-- Noun, menu item used to show the system settings -->
<string name="menu_settings">Settings</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 46e5f95..33a1d10 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -29,15 +29,6 @@
<item name="android:windowNoTitle">true</item>
</style>
- <style name="AppsCustomizeScrollTrack">
- <item name="android:visibility">visible</item>
- </style>
-
- <style name="AnimationPreview">
- <item name="android:windowEnterAnimation">@anim/fade_in_fast</item>
- <item name="android:windowExitAnimation">@anim/fade_out_fast</item>
- </style>
-
<style name="WorkspaceIcon">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
@@ -155,23 +146,4 @@
<item name="android:shadowDy">0.0</item>
<item name="android:shadowRadius">2.0</item>
</style>
-
- <style name="HotseatButton">
- <item name="android:paddingLeft">12dip</item>
- <item name="android:paddingRight">12dip</item>
- <item name="android:background">@drawable/hotseat_bg_center</item>
- <item name="android:layout_width">wrap_content</item>
- <item name="android:layout_height">fill_parent</item>
- <item name="android:scaleType">center</item>
- <item name="android:focusable">true</item>
- <item name="android:clickable">true</item>
- </style>
- <style name="HotseatButton.Left">
- <item name="android:layout_marginLeft">4dip</item>
- <item name="android:background">@drawable/hotseat_bg_left</item>
- </style>
- <style name="HotseatButton.Right">
- <item name="android:layout_marginRight">4dip</item>
- <item name="android:background">@drawable/hotseat_bg_right</item>
- </style>
</resources>
diff --git a/res/xml/default_workspace.xml b/res/xml/default_workspace.xml
index 722731c..0e96a67 100644
--- a/res/xml/default_workspace.xml
+++ b/res/xml/default_workspace.xml
@@ -15,13 +15,19 @@
-->
<favorites xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
- <!-- Far-left screen [0] -->
+ <!-- Far-left screen [0] -->
- <!-- Left screen [1] -->
-
- <!-- Middle screen [2] -->
+ <!-- Left screen [1] -->
- <!-- Right screen [3] -->
+ <!-- Middle screen [2] -->
+ <favorite
+ launcher:packageName="com.google.android.camera"
+ launcher:className="com.android.camera.Camera"
+ launcher:screen="2"
+ launcher:x="0"
+ launcher:y="3" />
+
+ <!-- Right screen [3] -->
<appwidget
launcher:packageName="com.android.music"
launcher:className="com.android.music.MediaAppWidgetProvider"
@@ -31,6 +37,29 @@
launcher:spanX="4"
launcher:spanY="1" />
- <!-- Far-right screen [4] -->
+ <!-- Far-right screen [4] -->
+
+ <!-- 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="1"
+ launcher:x="1"
+ launcher:y="0" />
+ <favorite
+ launcher:packageName="com.android.contacts"
+ launcher:className="com.android.contacts.activities.PeopleActivity"
+ launcher:container="-101"
+ launcher:screen="2"
+ launcher:x="2"
+ launcher:y="0" />
+ <favorite
+ launcher:packageName="com.android.browser"
+ launcher:className="com.android.browser.BrowserActivity"
+ launcher:container="-101"
+ launcher:screen="3"
+ launcher:x="3"
+ launcher:y="0" />
</favorites>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index c127ecd..ca11c1e 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -350,6 +350,10 @@
@Override
public void onClick(View v) {
+ // When we have exited all apps or are in transition, disregard clicks
+ if (!mLauncher.isAllAppsCustomizeOpen() ||
+ mLauncher.getWorkspace().isSwitchingState()) return;
+
if (v instanceof PagedViewIcon) {
// Animate some feedback to the click
final ApplicationInfo appInfo = (ApplicationInfo) v.getTag();
@@ -459,11 +463,6 @@
}
- /*
- * DragSource implementation
- */
- @Override
- public void onDragViewVisible() {}
@Override
public void onDropCompleted(View target, DragObject d, boolean success) {
endDragging(target, success);
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 2623586..ed408df 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -147,6 +147,10 @@
anim.setDuration(duration);
anim.addListener(new AnimatorListenerAdapter() {
@Override
+ public void onAnimationStart(android.animation.Animator animation) {
+ mAppsCustomizePane.hideScrollingIndicator(false);
+ }
+ @Override
public void onAnimationEnd(android.animation.Animator animation) {
mAppsCustomizePane.setContentType(type);
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index ae22507..de9c188 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -1454,23 +1454,12 @@
void onDropChild(View child) {
if (child != null) {
LayoutParams lp = (LayoutParams) child.getLayoutParams();
- lp.isDragging = false;
lp.dropped = true;
child.requestLayout();
}
}
/**
- * Start dragging the specified child
- *
- * @param child The child that is being dragged
- */
- void onDragChild(View child) {
- LayoutParams lp = (LayoutParams) child.getLayoutParams();
- lp.isDragging = true;
- }
-
- /**
* Computes a bounding rectangle for a range of cells
*
* @param cellX X coordinate of upper left corner expressed as a cell position
@@ -1755,11 +1744,6 @@
*/
public boolean isLockedToGrid = true;
- /**
- * Is this item currently being dragged
- */
- public boolean isDragging;
-
// X coordinate of the view in the layout.
@ViewDebug.ExportedProperty
int x;
@@ -1863,6 +1847,7 @@
int spanX;
int spanY;
int screen;
+ long container;
boolean valid;
@Override
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 5aecede..eb0db69 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -23,13 +23,11 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Vibrator;
-import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
-import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import com.android.launcher.R;
@@ -288,13 +286,6 @@
final DragView dragView = mDragObject.dragView = new DragView(mLauncher, b, registrationX,
registrationY, 0, 0, b.getWidth(), b.getHeight());
- final DragSource dragSource = source;
- dragView.setOnDrawRunnable(new Runnable() {
- public void run() {
- dragSource.onDragViewVisible();
- };
- });
-
if (dragRegion != null) {
dragView.setDragRegion(new Rect(dragRegion));
}
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index 8563be9..809a651 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -215,8 +215,8 @@
pt[1] += view.getTop() - view.getScrollY();
viewParent = view.getParent();
}
- coord[0] = (int) pt[0];
- coord[1] = (int) pt[1];
+ coord[0] = (int) Math.round(pt[0]);
+ coord[1] = (int) Math.round(pt[1]);
return scale;
}
diff --git a/src/com/android/launcher2/DragSource.java b/src/com/android/launcher2/DragSource.java
index 2a8f263..06f5ee1 100644
--- a/src/com/android/launcher2/DragSource.java
+++ b/src/com/android/launcher2/DragSource.java
@@ -25,11 +25,5 @@
*
*/
public interface DragSource {
- /**
- * Callback from the DragController when it begins drawing the drag view.
- * This allows the DragSource to dim or hide the original view.
- */
- void onDragViewVisible();
-
void onDropCompleted(View target, DragObject d, boolean success);
}
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index 1c75e47..386cb55 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -41,6 +41,7 @@
private Rect mDragRegion = null;
private DragLayer mDragLayer = null;
+ private boolean mHasDrawn = false;
ValueAnimator mAnim;
private float mOffsetX = 0.0f;
@@ -49,13 +50,6 @@
private DragLayer.LayoutParams mLayoutParams;
/**
- * A callback to be called the first time this view is drawn.
- * This allows the originator of the drag to dim or hide the original view as soon
- * as the DragView is drawn.
- */
- private Runnable mOnDrawRunnable = null;
-
- /**
* Construct the drag view.
* <p>
* The registration point is the point inside our view that the touch events should
@@ -125,10 +119,6 @@
return mOffsetY;
}
- public void setOnDrawRunnable(Runnable r) {
- mOnDrawRunnable = r;
- }
-
public int getDragRegionLeft() {
return mDragRegion.left;
}
@@ -168,14 +158,7 @@
canvas.drawRect(0, 0, getWidth(), getHeight(), p);
}
- // Call the callback if we haven't already been detached
- if (getParent() != null) {
- if (mOnDrawRunnable != null) {
- mOnDrawRunnable.run();
- mOnDrawRunnable = null;
- }
- }
-
+ mHasDrawn = true;
canvas.drawBitmap(mBitmap, 0.0f, 0.0f, mPaint);
}
@@ -184,6 +167,10 @@
invalidate();
}
+ public boolean hasDrawn() {
+ return mHasDrawn;
+ }
+
@Override
public void setAlpha(float alpha) {
super.setAlpha(alpha);
diff --git a/src/com/android/launcher2/FocusHelper.java b/src/com/android/launcher2/FocusHelper.java
index d45c9ac..233fd6f 100644
--- a/src/com/android/launcher2/FocusHelper.java
+++ b/src/com/android/launcher2/FocusHelper.java
@@ -31,23 +31,13 @@
import java.util.Comparator;
/**
- * A keyboard listener we set on all the button bar buttons.
+ * A keyboard listener we set on all the hotseat buttons.
*/
-class ButtonBarKeyEventListener implements View.OnKeyListener {
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- return FocusHelper.handleButtonBarButtonKeyEvent(v, keyCode, event);
- }
-}
-
-/**
- * A keyboard listener we set on all the dock buttons.
- */
-class DockKeyEventListener implements View.OnKeyListener {
+class HotseatKeyEventListener implements View.OnKeyListener {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
final Configuration configuration = v.getResources().getConfiguration();
- return FocusHelper.handleDockButtonKeyEvent(v, keyCode, event, configuration.orientation);
+ return FocusHelper.handleHotseatButtonKeyEvent(v, keyCode, event, configuration.orientation);
}
}
@@ -446,98 +436,9 @@
}
/**
- * Handles key events in the workspace button bar.
+ * Handles key events in the workspace hotseat (bottom of the screen).
*/
- static boolean handleButtonBarButtonKeyEvent(View v, int keyCode, KeyEvent e) {
- if (!LauncherApplication.isScreenLarge()) return false;
-
- final ViewGroup parent = (ViewGroup) v.getParent();
- final ViewGroup launcher = (ViewGroup) parent.getParent();
- final Workspace workspace = (Workspace) launcher.findViewById(R.id.workspace);
- final int buttonIndex = parent.indexOfChild(v);
- final int buttonCount = parent.getChildCount();
- final int pageIndex = workspace.getCurrentPage();
- final int pageCount = workspace.getChildCount();
- final int firstButtonIndex = parent.indexOfChild(parent.findViewById(R.id.search_button));
- final int lastButtonIndex = parent.indexOfChild(parent.findViewById(R.id.configure_button));
-
- final int action = e.getAction();
- final boolean handleKeyEvent = (action != KeyEvent.ACTION_UP);
- boolean wasHandled = false;
- switch (keyCode) {
- case KeyEvent.KEYCODE_DPAD_LEFT:
- if (handleKeyEvent) {
- // Select the previous button, otherwise do nothing (since the button bar is
- // static)
- if (buttonIndex > firstButtonIndex) {
- int newButtonIndex = buttonIndex - 1;
- while (newButtonIndex >= firstButtonIndex) {
- View prev = parent.getChildAt(newButtonIndex);
- if (isVisible(prev) && prev.isFocusable()) {
- prev.requestFocus();
- break;
- }
- --newButtonIndex;
- }
- } else {
- if (pageIndex > 0) {
- // Snap to previous page and clear focus
- workspace.snapToPage(pageIndex - 1);
- }
- }
- }
- wasHandled = true;
- break;
- case KeyEvent.KEYCODE_DPAD_RIGHT:
- if (handleKeyEvent) {
- // Select the next button, otherwise do nothing (since the button bar is
- // static)
- if (buttonIndex < lastButtonIndex) {
- int newButtonIndex = buttonIndex + 1;
- while (newButtonIndex <= lastButtonIndex) {
- View next = parent.getChildAt(newButtonIndex);
- if (isVisible(next) && next.isFocusable()) {
- next.requestFocus();
- break;
- }
- ++newButtonIndex;
- }
- } else {
- if (pageIndex < (pageCount - 1)) {
- // Snap to next page and clear focus
- workspace.snapToPage(pageIndex + 1);
- }
- }
- }
- wasHandled = true;
- break;
- case KeyEvent.KEYCODE_DPAD_UP:
- // Do nothing
- wasHandled = true;
- break;
- case KeyEvent.KEYCODE_DPAD_DOWN:
- if (handleKeyEvent) {
- // Select the first bubble text view in the current page of the workspace
- final CellLayout layout = (CellLayout) workspace.getChildAt(pageIndex);
- final CellLayoutChildren children = layout.getChildrenLayout();
- final View newIcon = getBubbleTextViewInDirection(layout, children, -1, 1);
- if (newIcon != null) {
- newIcon.requestFocus();
- } else {
- workspace.requestFocus();
- }
- }
- wasHandled = true;
- break;
- default: break;
- }
- return wasHandled;
- }
-
- /**
- * Handles key events in the workspace dock (bottom of the screen).
- */
- static boolean handleDockButtonKeyEvent(View v, int keyCode, KeyEvent e, int orientation) {
+ static boolean handleHotseatButtonKeyEvent(View v, int keyCode, KeyEvent e, int orientation) {
final ViewGroup parent = (ViewGroup) v.getParent();
final ViewGroup launcher = (ViewGroup) parent.getParent();
final Workspace workspace = (Workspace) launcher.findViewById(R.id.workspace);
@@ -547,7 +448,7 @@
final int pageCount = workspace.getChildCount();
// NOTE: currently we don't special case for the phone UI in different
- // orientations, even though the dock is on the side in landscape mode. This
+ // orientations, even though the hotseat is on the side in landscape mode. This
// is to ensure that accessibility consistency is maintained across rotations.
final int action = e.getAction();
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 7641fe7..d3b5d41 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -214,15 +214,13 @@
mEmptyCell[0] = item.cellX;
mEmptyCell[1] = item.cellY;
mCurrentDragView = v;
+
+ mContent.removeView(mCurrentDragView);
+ mInfo.remove(mCurrentDragInfo);
}
return true;
}
- public void onDragViewVisible() {
- mContent.removeView(mCurrentDragView);
- mInfo.remove(mCurrentDragInfo);
- }
-
public boolean isEditingName() {
return mIsEditingName;
}
@@ -732,8 +730,7 @@
int centeredTop = centerY - height / 2;
// We first fetch the currently visible CellLayoutChildren
- int page = mLauncher.getWorkspace().getCurrentPage();
- CellLayout currentPage = (CellLayout) mLauncher.getWorkspace().getChildAt(page);
+ CellLayout currentPage = mLauncher.getWorkspace().getCurrentDropLayout();
CellLayoutChildren boundingLayout = currentPage.getChildrenLayout();
Rect bounds = new Rect();
parent.getDescendantRectRelativeToSelf(boundingLayout, bounds);
@@ -851,8 +848,7 @@
}
// Remove the folder completely
- final CellLayout cellLayout = (CellLayout)
- mLauncher.getWorkspace().getChildAt(mInfo.screen);
+ CellLayout cellLayout = mLauncher.getCellLayout(mInfo.container, mInfo.screen);
cellLayout.removeView(mFolderIcon);
if (mFolderIcon instanceof DropTarget) {
mDragController.removeDropTarget((DropTarget) mFolderIcon);
@@ -860,9 +856,8 @@
mLauncher.removeFolder(mInfo);
if (finalItem != null) {
- LauncherModel.addOrMoveItemInDatabase(mLauncher, finalItem,
- LauncherSettings.Favorites.CONTAINER_DESKTOP, mInfo.screen,
- mInfo.cellX, mInfo.cellY);
+ LauncherModel.addOrMoveItemInDatabase(mLauncher, finalItem, mInfo.container,
+ mInfo.screen, mInfo.cellX, mInfo.cellY);
}
LauncherModel.deleteItemFromDatabase(mLauncher, mInfo);
@@ -871,8 +866,8 @@
View child = mLauncher.createShortcut(R.layout.application, cellLayout,
(ShortcutInfo) finalItem);
- mLauncher.getWorkspace().addInScreen(child, mInfo.screen, mInfo.cellX, mInfo.cellY,
- mInfo.spanX, mInfo.spanY);
+ mLauncher.getWorkspace().addInScreen(child, mInfo.container, mInfo.screen, mInfo.cellX,
+ mInfo.cellY, mInfo.spanX, mInfo.spanY);
}
}
@@ -893,7 +888,11 @@
si.cellX = lp.cellX = mEmptyCell[0];
si.cellX = lp.cellY = mEmptyCell[1];
mContent.addViewToCellLayout(mCurrentDragView, -1, (int)item.id, lp, true);
- mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, mCurrentDragView);
+ if (d.dragView.hasDrawn()) {
+ mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, mCurrentDragView);
+ } else {
+ mCurrentDragView.setVisibility(VISIBLE);
+ }
mItemsInvalidated = true;
setupContentDimension(getItemCount());
mSuppressOnAdd = true;
diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java
new file mode 100644
index 0000000..deab131
--- /dev/null
+++ b/src/com/android/launcher2/Hotseat.java
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+
+package com.android.launcher2;
+
+import android.content.Context;
+import android.content.res.Configuration;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.FrameLayout;
+
+import com.android.launcher.R;
+
+public class Hotseat extends FrameLayout {
+ static final String TAG = "Hotseat";
+
+ private Launcher mLauncher;
+ private CellLayout mContent;
+
+ private int mCellCountX;
+ private int mCellCountY;
+ private boolean mIsLandscape;
+
+ public Hotseat(Context context) {
+ this(context, null);
+ }
+
+ public Hotseat(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public Hotseat(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+
+ TypedArray a = context.obtainStyledAttributes(attrs,
+ R.styleable.Hotseat, defStyle, 0);
+ mCellCountX = a.getInt(R.styleable.Hotseat_cellCountX, -1);
+ mCellCountY = a.getInt(R.styleable.Hotseat_cellCountY, -1);
+ mIsLandscape = context.getResources().getConfiguration().orientation ==
+ Configuration.ORIENTATION_LANDSCAPE;
+ }
+
+ public void setup(Launcher launcher) {
+ mLauncher = launcher;
+ }
+
+ CellLayout getLayout() {
+ return mContent;
+ }
+
+ /* Get the orientation invariant order of the item in the hotseat for persistence. */
+ int getOrderInHotseat(int x, int y) {
+ return mIsLandscape ? (mContent.getCountY() - y - 1) : x;
+ }
+ /* Get the orientation specific coordinates given an invariant order in the hotseat. */
+ int getCellXFromOrder(int rank) {
+ return mIsLandscape ? 0 : rank;
+ }
+ int getCellYFromOrder(int rank) {
+ return mIsLandscape ? (mContent.getCountY() - (rank + 1)) : 0;
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ if (mCellCountX < 0) mCellCountX = LauncherModel.getCellCountX();
+ if (mCellCountY < 0) mCellCountY = LauncherModel.getCellCountY();
+ mContent = (CellLayout) findViewById(R.id.layout);
+ mContent.setGridSize(mCellCountX, mCellCountY);
+
+ resetLayout();
+ }
+
+ void resetLayout() {
+ mContent.removeAllViewsInLayout();
+
+ // Add the Apps button
+ Context context = getContext();
+ LayoutInflater inflater = LayoutInflater.from(context);
+ BubbleTextView allAppsButton = (BubbleTextView)
+ inflater.inflate(R.layout.application, mContent, false);
+ allAppsButton.setCompoundDrawablesWithIntrinsicBounds(null,
+ context.getResources().getDrawable(R.drawable.apps_hotseat_button), null, null);
+ // button.setText(context.getString(R.string.all_apps_button_label));
+ allAppsButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(android.view.View v) {
+ mLauncher.showAllApps(true);
+ }
+ });
+
+ // Note: We do this to ensure that the hotseat is always laid out in the orientation of
+ // the hotseat in order regardless of which orientation they were added
+ int x = getCellXFromOrder(0);
+ int y = getCellYFromOrder(0);
+ mContent.addViewToCellLayout(allAppsButton, -1, 0, new CellLayout.LayoutParams(x,y,1,1),
+ true);
+ }
+}
diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java
index c67e90e..9d7054c 100644
--- a/src/com/android/launcher2/InstallShortcutReceiver.java
+++ b/src/com/android/launcher2/InstallShortcutReceiver.java
@@ -65,7 +65,8 @@
boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true);
if (duplicate || !LauncherModel.shortcutExists(context, name, intent)) {
LauncherApplication app = (LauncherApplication) context.getApplicationContext();
- app.getModel().addShortcut(context, data, screen, mCoordinates[0],
+ app.getModel().addShortcut(context, data,
+ LauncherSettings.Favorites.CONTAINER_DESKTOP, screen, mCoordinates[0],
mCoordinates[1], true);
Toast.makeText(context, context.getString(R.string.shortcut_installed, name),
Toast.LENGTH_SHORT).show();
@@ -94,14 +95,16 @@
int cellX, cellY, spanX, spanY;
for (int i = 0; i < items.size(); ++i) {
item = items.get(i);
- if (item.screen == screen) {
- cellX = item.cellX;
- cellY = item.cellY;
- spanX = item.spanX;
- spanY = item.spanY;
- for (int x = cellX; x < cellX + spanX && x < xCount; x++) {
- for (int y = cellY; y < cellY + spanY && y < yCount; y++) {
- occupied[x][y] = true;
+ if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ if (item.screen == screen) {
+ cellX = item.cellX;
+ cellY = item.cellY;
+ spanX = item.spanX;
+ spanY = item.spanY;
+ for (int x = cellX; x < cellX + spanX && x < xCount; x++) {
+ for (int y = cellY; y < cellY + spanY && y < yCount; y++) {
+ occupied[x][y] = true;
+ }
}
}
}
diff --git a/src/com/android/launcher2/InstallWidgetReceiver.java b/src/com/android/launcher2/InstallWidgetReceiver.java
index b4ce038..6b3763c 100644
--- a/src/com/android/launcher2/InstallWidgetReceiver.java
+++ b/src/com/android/launcher2/InstallWidgetReceiver.java
@@ -188,7 +188,8 @@
final PendingAddWidgetInfo createInfo = new PendingAddWidgetInfo(widgetInfo, mMimeType,
mClipData);
- mLauncher.addAppWidgetFromDrop(createInfo, mTargetLayoutScreen, null, mTargetLayoutPos);
+ mLauncher.addAppWidgetFromDrop(createInfo, LauncherSettings.Favorites.CONTAINER_DESKTOP,
+ mTargetLayoutScreen, null, mTargetLayoutPos);
}
}
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 6d0f88f..0abdec0 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -115,7 +115,6 @@
static final boolean PROFILE_STARTUP = false;
static final boolean DEBUG_WIDGETS = false;
- static final boolean DEBUG_USER_INTERFACE = false;
private static final int MENU_GROUP_ADD = 1;
private static final int MENU_GROUP_WALLPAPER = MENU_GROUP_ADD + 1;
@@ -149,6 +148,8 @@
// Type: int
private static final String RUNTIME_STATE = "launcher.state";
// Type: int
+ private static final String RUNTIME_STATE_PENDING_ADD_CONTAINER = "launcher.add_container";
+ // Type: int
private static final String RUNTIME_STATE_PENDING_ADD_SCREEN = "launcher.add_screen";
// Type: int
private static final String RUNTIME_STATE_PENDING_ADD_CELL_X = "launcher.add_cell_x";
@@ -185,16 +186,14 @@
private AppWidgetManager mAppWidgetManager;
private LauncherAppWidgetHost mAppWidgetHost;
- private int mAddScreen = -1;
- private int mAddCellX = -1;
- private int mAddCellY = -1;
- private int[] mAddDropPosition;
+ private ItemInfo mPendingAddInfo = new ItemInfo();
private int[] mTmpAddItemCellCoordinates = new int[2];
private FolderInfo mFolderInfo;
- private ViewGroup mButtonCluster;
+ private Hotseat mHotseat;
private View mAllAppsButton;
+
private SearchDropTargetBar mSearchDeleteBar;
private AppsCustomizeTabHost mAppsCustomizeTabHost;
private AppsCustomizePagedView mAppsCustomizeContent;
@@ -259,6 +258,7 @@
private static class PendingAddArguments {
int requestCode;
Intent intent;
+ long container;
int screen;
int cellX;
int cellY;
@@ -600,20 +600,22 @@
private boolean completeAdd(PendingAddArguments args) {
switch (args.requestCode) {
case REQUEST_PICK_APPLICATION:
- completeAddApplication(args.intent, args.screen, args.cellX, args.cellY);
+ completeAddApplication(args.intent, args.container, args.screen, args.cellX,
+ args.cellY);
break;
case REQUEST_PICK_SHORTCUT:
processShortcut(args.intent);
break;
case REQUEST_CREATE_SHORTCUT:
- completeAddShortcut(args.intent, args.screen, args.cellX, args.cellY);
+ completeAddShortcut(args.intent, args.container, args.screen, args.cellX,
+ args.cellY);
return true;
case REQUEST_PICK_APPWIDGET:
addAppWidgetFromPick(args.intent);
break;
case REQUEST_CREATE_APPWIDGET:
int appWidgetId = args.intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
- completeAddAppWidget(appWidgetId, args.screen);
+ completeAddAppWidget(appWidgetId, args.container, args.screen);
return true;
case REQUEST_PICK_WALLPAPER:
// We just wanted the activity result here so we can clear mWaitingForResult
@@ -632,13 +634,15 @@
// For example, the user would PICK_SHORTCUT for "Music playlist", and we
// launch over to the Music app to actually CREATE_SHORTCUT.
- if (resultCode == RESULT_OK && mAddScreen != -1) {
+ if (resultCode == RESULT_OK && mPendingAddInfo.container != ItemInfo.NO_ID &&
+ mPendingAddInfo.screen > -1) {
final PendingAddArguments args = new PendingAddArguments();
args.requestCode = requestCode;
args.intent = data;
- args.screen = mAddScreen;
- args.cellX = mAddCellX;
- args.cellY = mAddCellY;
+ args.container = mPendingAddInfo.container;
+ args.screen = mPendingAddInfo.screen;
+ args.cellX = mPendingAddInfo.cellX;
+ args.cellY = mPendingAddInfo.cellY;
// If the loader is still running, defer the add until it is done.
if (isWorkspaceLocked()) {
@@ -797,12 +801,15 @@
mWorkspace.setCurrentPage(currentScreen);
}
- final int addScreen = savedState.getInt(RUNTIME_STATE_PENDING_ADD_SCREEN, -1);
+ final long pendingAddContainer = savedState.getLong(RUNTIME_STATE_PENDING_ADD_CONTAINER, -1);
+ final int pendingAddScreen = savedState.getInt(RUNTIME_STATE_PENDING_ADD_SCREEN, -1);
- if (addScreen > -1) {
- mAddScreen = addScreen;
- mAddCellX = savedState.getInt(RUNTIME_STATE_PENDING_ADD_CELL_X);
- mAddCellY = savedState.getInt(RUNTIME_STATE_PENDING_ADD_CELL_Y);
+
+ if (pendingAddContainer != ItemInfo.NO_ID && pendingAddScreen > -1) {
+ mPendingAddInfo.container = pendingAddContainer;
+ mPendingAddInfo.screen = pendingAddScreen;
+ mPendingAddInfo.cellX = savedState.getInt(RUNTIME_STATE_PENDING_ADD_CELL_X);
+ mPendingAddInfo.cellY = savedState.getInt(RUNTIME_STATE_PENDING_ADD_CELL_Y);
mRestoring = true;
}
@@ -841,6 +848,12 @@
// Setup the drag layer
mDragLayer.setup(this, dragController);
+ // Setup the hotseat
+ mHotseat = (Hotseat) findViewById(R.id.hotseat);
+ if (mHotseat != null) {
+ mHotseat.setup(this);
+ }
+
// Setup the workspace
mWorkspace.setHapticFeedbackEnabled(false);
mWorkspace.setOnLongClickListener(this);
@@ -857,47 +870,9 @@
mAppsCustomizeTabHost.findViewById(R.id.apps_customize_pane_content);
mAppsCustomizeContent.setup(this, dragController);
- // Setup AppsCustomize button
- mAllAppsButton = mDragLayer.findViewById(R.id.all_apps_button);
- mAllAppsButton.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- onClickAllAppsButton(v);
- }
- });
- if (!LauncherApplication.isScreenLarge()) {
- // Setup AppsCustomize button on the phone
- HandleView handleView = (HandleView) mAllAppsButton;
- handleView.setLauncher(this);
- handleView.setOnLongClickListener(this);
- // Setup Hotseat
- ImageView hotseatLeft = (ImageView) findViewById(R.id.hotseat_left);
- hotseatLeft.setContentDescription(mHotseatLabels[0]);
- hotseatLeft.setImageDrawable(mHotseatIcons[0]);
- ImageView hotseatRight = (ImageView) findViewById(R.id.hotseat_right);
- hotseatRight.setContentDescription(mHotseatLabels[1]);
- hotseatRight.setImageDrawable(mHotseatIcons[1]);
- }
-
- if (!LauncherApplication.isScreenLarge()) {
- // Setup keylistener for button cluster
- mButtonCluster = (ViewGroup) findViewById(R.id.all_apps_button_cluster);
- View.OnKeyListener listener = null;
- if (LauncherApplication.isScreenLarge()) {
- // For tablets, AllApps lives in the button bar at the top
- listener = new ButtonBarKeyEventListener();
- } else {
- // For phones, AppsCustomize lives in the "dock" at the bottom
- listener = new DockKeyEventListener();
- }
- int buttonCount = mButtonCluster.getChildCount();
- for (int i = 0; i < buttonCount; ++i) {
- mButtonCluster.getChildAt(i).setOnKeyListener(listener);
- }
- }
-
- // Setup the drag controller (the drop targets have to be added in reverse order)
+ // Setup the drag controller (drop targets have to be added in reverse order in priority)
dragController.setDragScoller(mWorkspace);
dragController.setScrollView(mDragLayer);
dragController.setMoveTarget(mWorkspace);
@@ -907,40 +882,7 @@
}
}
- @SuppressWarnings({"UnusedDeclaration"})
- public void previousScreen(View v) {
- if (mState != State.APPS_CUSTOMIZE) {
- mWorkspace.scrollLeft();
- }
- }
- @SuppressWarnings({"UnusedDeclaration"})
- public void nextScreen(View v) {
- if (mState != State.APPS_CUSTOMIZE) {
- mWorkspace.scrollRight();
- }
- }
-
- @SuppressWarnings({"UnusedDeclaration"})
- public void launchHotSeat(View v) {
- if (mState == State.APPS_CUSTOMIZE) return;
-
- int index = -1;
- if (v.getId() == R.id.hotseat_left) {
- index = 0;
- } else if (v.getId() == R.id.hotseat_right) {
- index = 1;
- }
-
- // reload these every tap; you never know when they might change
- loadHotseats();
- if (index >= 0 && index < mHotseats.length && mHotseats[index] != null) {
- startActivitySafely(
- mHotseats[index],
- "hotseat"
- );
- }
- }
/**
* Creates a view representing a shortcut.
@@ -976,9 +918,9 @@
* @param data The intent describing the application.
* @param cellInfo The position on screen where to create the shortcut.
*/
- void completeAddApplication(Intent data, int screen, int cellX, int cellY) {
+ void completeAddApplication(Intent data, long container, int screen, int cellX, int cellY) {
final int[] cellXY = mTmpAddItemCellCoordinates;
- final CellLayout layout = (CellLayout) mWorkspace.getChildAt(screen);
+ final CellLayout layout = getCellLayout(container, screen);
// First we check if we already know the exact location where we want to add this item.
if (cellX >= 0 && cellY >= 0) {
@@ -995,7 +937,7 @@
info.setActivity(data.getComponent(), Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
info.container = ItemInfo.NO_ID;
- mWorkspace.addApplicationShortcut(info, screen, cellXY[0], cellXY[1],
+ mWorkspace.addApplicationShortcut(info, layout, container, screen, cellXY[0], cellXY[1],
isWorkspaceLocked(), cellX, cellY);
} else {
Log.e(TAG, "Couldn't find ActivityInfo for selected application: " + data);
@@ -1008,11 +950,12 @@
* @param data The intent describing the shortcut.
* @param cellInfo The position on screen where to create the shortcut.
*/
- private void completeAddShortcut(Intent data, int screen, int cellX, int cellY) {
- final int[] cellXY = mTmpAddItemCellCoordinates;
- final CellLayout layout = (CellLayout) mWorkspace.getChildAt(screen);
+ private void completeAddShortcut(Intent data, long container, int screen, int cellX,
+ int cellY) {
+ int[] cellXY = mTmpAddItemCellCoordinates;
+ int[] touchXY = mPendingAddInfo.dropPos;
+ CellLayout layout = getCellLayout(container, screen);
- int[] touchXY = mAddDropPosition;
boolean foundCellSpan = false;
// First we check if we already know the exact location where we want to add this item.
@@ -1022,9 +965,7 @@
foundCellSpan = true;
} else if (touchXY != null) {
// when dragging and dropping, just find the closest free spot
- CellLayout screenLayout = (CellLayout) mWorkspace.getChildAt(screen);
- int[] result = screenLayout.findNearestVacantArea(
- touchXY[0], touchXY[1], 1, 1, cellXY);
+ int[] result = layout.findNearestVacantArea(touchXY[0], touchXY[1], 1, 1, cellXY);
foundCellSpan = (result != null);
} else {
foundCellSpan = layout.findCellForSpan(cellXY, 1, 1);
@@ -1036,11 +977,12 @@
}
final ShortcutInfo info = mModel.addShortcut(
- this, data, screen, cellXY[0], cellXY[1], false);
+ this, data, container, screen, cellXY[0], cellXY[1], false);
if (!mRestoring) {
final View view = createShortcut(info);
- mWorkspace.addInScreen(view, screen, cellXY[0], cellXY[1], 1, 1, isWorkspaceLocked());
+ mWorkspace.addInScreen(view, container, screen, cellXY[0], cellXY[1], 1, 1,
+ isWorkspaceLocked());
}
}
@@ -1050,11 +992,11 @@
* @param appWidgetId The app widget id
* @param cellInfo The position on screen where to create the widget.
*/
- private void completeAddAppWidget(final int appWidgetId, int screen) {
+ private void completeAddAppWidget(final int appWidgetId, long container, int screen) {
AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
// Calculate the grid spans needed to fit this widget
- CellLayout layout = (CellLayout) mWorkspace.getChildAt(screen);
+ CellLayout layout = getCellLayout(container, screen);
// We want to account for the extra amount of padding that we are adding to the widget
// to ensure that it gets the full amount of space that it has requested
@@ -1070,18 +1012,16 @@
// Try finding open space on Launcher screen
// We have saved the position to which the widget was dragged-- this really only matters
// if we are placing widgets on a "spring-loaded" screen
- final int[] cellXY = mTmpAddItemCellCoordinates;
-
- int[] touchXY = mAddDropPosition;
+ int[] cellXY = mTmpAddItemCellCoordinates;
+ int[] touchXY = mPendingAddInfo.dropPos;
boolean foundCellSpan = false;
- if (mAddCellX >= 0 && mAddCellY >= 0) {
- cellXY[0] = mAddCellX;
- cellXY[1] = mAddCellY;
+ if (mPendingAddInfo.cellX >= 0 && mPendingAddInfo.cellY >= 0) {
+ cellXY[0] = mPendingAddInfo.cellX;
+ cellXY[1] = mPendingAddInfo.cellY;
foundCellSpan = true;
} else if (touchXY != null) {
// when dragging and dropping, just find the closest free spot
- CellLayout screenLayout = (CellLayout) mWorkspace.getChildAt(screen);
- int[] result = screenLayout.findNearestVacantArea(
+ int[] result = layout.findNearestVacantArea(
touchXY[0], touchXY[1], spanXY[0], spanXY[1], cellXY);
foundCellSpan = (result != null);
} else {
@@ -1108,8 +1048,7 @@
launcherInfo.spanY = spanXY[1];
LauncherModel.addItemToDatabase(this, launcherInfo,
- LauncherSettings.Favorites.CONTAINER_DESKTOP,
- screen, cellXY[0], cellXY[1], false);
+ container, screen, cellXY[0], cellXY[1], false);
if (!mRestoring) {
// Perform actual inflation because we're live
@@ -1118,7 +1057,7 @@
launcherInfo.hostView.setAppWidget(appWidgetId, appWidgetInfo);
launcherInfo.hostView.setTag(launcherInfo);
- mWorkspace.addInScreen(launcherInfo.hostView, screen, cellXY[0], cellXY[1],
+ mWorkspace.addInScreen(launcherInfo.hostView, container, screen, cellXY[0], cellXY[1],
launcherInfo.spanX, launcherInfo.spanY, isWorkspaceLocked());
addWidgetToAutoAdvanceIfNeeded(launcherInfo.hostView, appWidgetInfo);
@@ -1331,10 +1270,12 @@
// this state is reflected.
closeFolder();
- if (mAddScreen > -1 && mWaitingForResult) {
- outState.putInt(RUNTIME_STATE_PENDING_ADD_SCREEN, mAddScreen);
- outState.putInt(RUNTIME_STATE_PENDING_ADD_CELL_X, mAddCellX);
- outState.putInt(RUNTIME_STATE_PENDING_ADD_CELL_Y, mAddCellY);
+ if (mPendingAddInfo.container != ItemInfo.NO_ID && mPendingAddInfo.screen > -1 &&
+ mWaitingForResult) {
+ outState.putLong(RUNTIME_STATE_PENDING_ADD_CONTAINER, mPendingAddInfo.container);
+ outState.putInt(RUNTIME_STATE_PENDING_ADD_SCREEN, mPendingAddInfo.screen);
+ outState.putInt(RUNTIME_STATE_PENDING_ADD_CELL_X, mPendingAddInfo.cellX);
+ outState.putInt(RUNTIME_STATE_PENDING_ADD_CELL_Y, mPendingAddInfo.cellY);
}
if (mFolderInfo != null && mWaitingForResult) {
@@ -1372,7 +1313,7 @@
TextKeyListener.getInstance().release();
- unbindWorkspaceItems();
+ unbindWorkspaceAndHotseatItems();
getContentResolver().unregisterContentObserver(mWidgetObserver);
unregisterReceiver(mCloseSystemDialogsReceiver);
@@ -1507,10 +1448,11 @@
}
private void resetAddInfo() {
- mAddScreen = -1;
- mAddCellX = -1;
- mAddCellY = -1;
- mAddDropPosition = null;
+ mPendingAddInfo.container = ItemInfo.NO_ID;
+ mPendingAddInfo.screen = -1;
+ mPendingAddInfo.cellX = mPendingAddInfo.cellY = -1;
+ mPendingAddInfo.spanX = mPendingAddInfo.spanY = -1;
+ mPendingAddInfo.dropPos = null;
}
private void manageApps() {
@@ -1566,7 +1508,7 @@
startActivityForResultSafely(intent, REQUEST_CREATE_APPWIDGET);
} else {
// Otherwise just add it
- completeAddAppWidget(appWidgetId, mAddScreen);
+ completeAddAppWidget(appWidgetId, info.container, info.screen);
// Exit spring loaded mode if necessary after adding the widget
exitSpringLoadedDragModeDelayed(false);
@@ -1581,14 +1523,16 @@
* @param cell The cell it should be added to, optional
* @param position The location on the screen where it was dropped, optional
*/
- void processShortcutFromDrop(ComponentName componentName, int screen, int[] cell, int[] loc) {
+ void processShortcutFromDrop(ComponentName componentName, long container, int screen,
+ int[] cell, int[] loc) {
resetAddInfo();
- mAddScreen = screen;
- mAddDropPosition = loc;
+ mPendingAddInfo.container = container;
+ mPendingAddInfo.screen = screen;
+ mPendingAddInfo.dropPos = loc;
if (cell != null) {
- mAddCellX = cell[0];
- mAddCellY = cell[1];
+ mPendingAddInfo.cellX = cell[0];
+ mPendingAddInfo.cellY = cell[1];
}
Intent createShortcutIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
@@ -1604,14 +1548,15 @@
* @param cell The cell it should be added to, optional
* @param position The location on the screen where it was dropped, optional
*/
- void addAppWidgetFromDrop(PendingAddWidgetInfo info, int screen, int[] cell, int[] loc) {
+ void addAppWidgetFromDrop(PendingAddWidgetInfo info, long container, int screen,
+ int[] cell, int[] loc) {
resetAddInfo();
- mAddScreen = screen;
- mAddDropPosition = loc;
-
+ mPendingAddInfo.container = info.container = container;
+ mPendingAddInfo.screen = info.screen = screen;
+ mPendingAddInfo.dropPos = loc;
if (cell != null) {
- mAddCellX = cell[0];
- mAddCellY = cell[1];
+ mPendingAddInfo.cellX = cell[0];
+ mPendingAddInfo.cellY = cell[1];
}
int appWidgetId = getAppWidgetHost().allocateAppWidgetId();
@@ -1641,21 +1586,21 @@
startActivityForResult(intent, REQUEST_PICK_WALLPAPER);
}
- FolderIcon addFolder(final int screen, int cellX, int cellY) {
+ FolderIcon addFolder(CellLayout layout, long container, final int screen, int cellX,
+ int cellY) {
final FolderInfo folderInfo = new FolderInfo();
folderInfo.title = getText(R.string.folder_name);
// Update the model
- LauncherModel.addItemToDatabase(Launcher.this, folderInfo,
- LauncherSettings.Favorites.CONTAINER_DESKTOP,
- screen, cellX, cellY, false);
+ LauncherModel.addItemToDatabase(Launcher.this, folderInfo, container, screen, cellX, cellY,
+ false);
sFolders.put(folderInfo.id, folderInfo);
// Create the view
- FolderIcon newFolder = FolderIcon.fromXml(R.layout.folder_icon, this,
- (ViewGroup) mWorkspace.getChildAt(mWorkspace.getCurrentPage()),
- folderInfo, mIconCache);
- mWorkspace.addInScreen(newFolder, screen, cellX, cellY, 1, 1, isWorkspaceLocked());
+ FolderIcon newFolder =
+ FolderIcon.fromXml(R.layout.folder_icon, this, layout, folderInfo, mIconCache);
+ mWorkspace.addInScreen(newFolder, container, screen, cellX, cellY, 1, 1,
+ isWorkspaceLocked());
return newFolder;
}
@@ -1753,8 +1698,7 @@
ViewGroup parent = (ViewGroup) folder.getParent().getParent();
if (parent != null) {
- CellLayout cl = (CellLayout) mWorkspace.getChildAt(folder.mInfo.screen);
- FolderIcon fi = (FolderIcon) cl.getChildAt(folder.mInfo.cellX, folder.mInfo.cellY);
+ FolderIcon fi = (FolderIcon) mWorkspace.getViewForTag(folder.mInfo);
shrinkAndFadeInFolderIcon(fi);
mDragController.removeDropTarget((DropTarget)folder);
}
@@ -1774,7 +1718,7 @@
* Go through the and disconnect any of the callbacks in the drawables and the views or we
* leak the previous Home screen on orientation change.
*/
- private void unbindWorkspaceItems() {
+ private void unbindWorkspaceAndHotseatItems() {
LauncherModel.unbindWorkspaceItems();
}
@@ -1995,16 +1939,6 @@
return false;
}
- switch (v.getId()) {
- case R.id.all_apps_button:
- if (mState != State.APPS_CUSTOMIZE) {
- mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
- HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- showPreviews(v);
- }
- return true;
- }
-
if (isWorkspaceLocked()) {
return false;
}
@@ -2020,12 +1954,13 @@
return true;
}
+ // The hotseat touch handling does not go through Workspace, and we always allow long press
+ // on hotseat items.
final View itemUnderLongClick = longClickCellInfo.cell;
-
- if (mWorkspace.allowLongPress() && !mDragController.isDragging()) {
+ boolean allowLongPress = isHotseatLayout(v) || mWorkspace.allowLongPress();
+ if (allowLongPress && !mDragController.isDragging()) {
if (itemUnderLongClick == null) {
// User long pressed on empty space
- mWorkspace.setAllowLongPress(false);
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
addItems();
@@ -2041,137 +1976,26 @@
return true;
}
- @SuppressWarnings({"unchecked"})
- private void dismissPreview(final View v) {
- final PopupWindow window = (PopupWindow) v.getTag();
- if (window != null) {
- window.setOnDismissListener(new PopupWindow.OnDismissListener() {
- public void onDismiss() {
- ViewGroup group = (ViewGroup) v.getTag(R.id.workspace);
- int count = group.getChildCount();
- for (int i = 0; i < count; i++) {
- ((ImageView) group.getChildAt(i)).setImageDrawable(null);
- }
- ArrayList<Bitmap> bitmaps =
- (ArrayList<Bitmap>) v.getTag(R.id.all_apps_button_cluster);
- for (Bitmap bitmap : bitmaps) bitmap.recycle();
-
- v.setTag(R.id.workspace, null);
- v.setTag(R.id.all_apps_button_cluster, null);
- window.setOnDismissListener(null);
- }
- });
- window.dismiss();
- }
- v.setTag(null);
+ boolean isHotseatLayout(View layout) {
+ return mHotseat != null && layout != null &&
+ (layout instanceof CellLayout) && (layout == mHotseat.getLayout());
+ }
+ Hotseat getHotseat() {
+ return mHotseat;
}
- private void showPreviews(View anchor) {
- showPreviews(anchor, 0, mWorkspace.getChildCount());
- }
-
- private void showPreviews(final View anchor, int start, int end) {
- final Resources resources = getResources();
- final Workspace workspace = mWorkspace;
-
- CellLayout cell = ((CellLayout) workspace.getChildAt(start));
-
- float max = workspace.getChildCount();
-
- 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;
-
- int aW = cell.getWidth() - extraW;
- float w = aW / max;
-
- int width = cell.getWidth();
- int height = cell.getHeight();
- int x = cell.getPaddingLeft();
- int y = cell.getPaddingTop();
- width -= (x + cell.getPaddingRight());
- height -= (y + cell.getPaddingBottom());
-
- float scale = w / width;
-
- int count = end - start;
-
- final float sWidth = width * scale;
- float sHeight = height * scale;
-
- LinearLayout preview = new LinearLayout(this);
-
- PreviewTouchHandler handler = new PreviewTouchHandler(anchor);
- ArrayList<Bitmap> bitmaps = new ArrayList<Bitmap>(count);
-
- for (int i = start; i < end; i++) {
- ImageView image = new ImageView(this);
- cell = (CellLayout) workspace.getChildAt(i);
-
- final Bitmap bitmap = Bitmap.createBitmap((int) sWidth, (int) sHeight,
- Bitmap.Config.ARGB_8888);
-
- final Canvas c = new Canvas(bitmap);
- c.scale(scale, scale);
- c.translate(-cell.getPaddingLeft(), -cell.getPaddingTop());
- cell.drawChildren(c);
-
- image.setBackgroundDrawable(resources.getDrawable(R.drawable.preview_background));
- image.setImageBitmap(bitmap);
- image.setTag(i);
- image.setOnClickListener(handler);
- image.setOnFocusChangeListener(handler);
- image.setFocusable(true);
- if (i == mWorkspace.getCurrentPage()) image.requestFocus();
-
- preview.addView(image,
- LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
-
- bitmaps.add(bitmap);
- }
-
- final PopupWindow p = new PopupWindow(this);
- p.setContentView(preview);
- p.setWidth((int) (sWidth * count + extraW));
- p.setHeight((int) (sHeight + extraH));
- p.setAnimationStyle(R.style.AnimationPreview);
- p.setOutsideTouchable(true);
- p.setFocusable(true);
- p.setBackgroundDrawable(new ColorDrawable(0));
- p.showAsDropDown(anchor, 0, 0);
-
- p.setOnDismissListener(new PopupWindow.OnDismissListener() {
- public void onDismiss() {
- dismissPreview(anchor);
+ /**
+ * Returns the CellLayout of the specified container at the specified screen.
+ */
+ CellLayout getCellLayout(long container, int screen) {
+ if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
+ if (mHotseat != null) {
+ return mHotseat.getLayout();
+ } else {
+ return null;
}
- });
-
- anchor.setTag(p);
- anchor.setTag(R.id.workspace, preview);
- anchor.setTag(R.id.all_apps_button_cluster, bitmaps);
- }
-
- class PreviewTouchHandler implements View.OnClickListener, Runnable, View.OnFocusChangeListener {
- private final View mAnchor;
-
- public PreviewTouchHandler(View anchor) {
- mAnchor = anchor;
- }
-
- public void onClick(View v) {
- mWorkspace.snapToPage((Integer) v.getTag());
- v.post(this);
- }
-
- public void run() {
- dismissPreview(mAnchor);
- }
-
- public void onFocusChange(View v, boolean hasFocus) {
- if (hasFocus) {
- mWorkspace.snapToPage((Integer) v.getTag());
- }
+ } else {
+ return (CellLayout) mWorkspace.getChildAt(screen);
}
}
@@ -2215,7 +2039,8 @@
private void showAddDialog() {
resetAddInfo();
- mAddScreen = mWorkspace.getCurrentPage();
+ mPendingAddInfo.container = LauncherSettings.Favorites.CONTAINER_DESKTOP;
+ mPendingAddInfo.screen = mWorkspace.getCurrentPage();
mWaitingForResult = true;
showDialog(DIALOG_CREATE_SHORTCUT);
}
@@ -2410,12 +2235,6 @@
toView.setTranslationY(0.0f);
toView.setVisibility(View.VISIBLE);
toView.bringToFront();
-
- if (!springLoaded && !LauncherApplication.isScreenLarge()) {
- // Hide the workspace scrollbar
- mWorkspace.hideScrollingIndicator(true);
- mWorkspace.hideScrollIndicatorTrack();
- }
}
@Override
public void onAnimationEnd(Animator animation) {
@@ -2427,6 +2246,12 @@
if (toView instanceof LauncherTransitionable) {
((LauncherTransitionable) toView).onLauncherTransitionEnd(scaleAnim);
}
+
+ if (!springLoaded && !LauncherApplication.isScreenLarge()) {
+ // Hide the workspace scrollbar
+ mWorkspace.hideScrollingIndicator(true);
+ mWorkspace.hideScrollIndicatorTrack();
+ }
}
});
@@ -2506,16 +2331,18 @@
}
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
+ public void onAnimationStart(android.animation.Animator animation) {
+ if (!springLoaded && !LauncherApplication.isScreenLarge()) {
+ // Show the workspace scrollbar
+ mWorkspace.showScrollIndicatorTrack();
+ mWorkspace.flashScrollingIndicator();
+ }
+ }
+ @Override
public void onAnimationEnd(Animator animation) {
fromView.setVisibility(View.GONE);
if (fromView instanceof LauncherTransitionable) {
((LauncherTransitionable) fromView).onLauncherTransitionEnd(alphaAnim);
-
- if (!springLoaded && !LauncherApplication.isScreenLarge()) {
- // Show the workspace scrollbar
- mWorkspace.showScrollIndicatorTrack();
- mWorkspace.flashScrollingIndicator();
- }
}
}
});
@@ -2591,30 +2418,34 @@
// Otherwise, we are not in spring loaded mode, so don't do anything.
}
+ public boolean isAllAppsCustomizeOpen() {
+ return mState == State.APPS_CUSTOMIZE;
+ }
+
/**
- * Shows the dock/hotseat area.
+ * Shows the hotseat area.
*/
- void showDock(boolean animated) {
+ void showHotseat(boolean animated) {
if (!LauncherApplication.isScreenLarge()) {
if (animated) {
int duration = mSearchDeleteBar.getTransitionInDuration();
- mButtonCluster.animate().alpha(1f).setDuration(duration);
+ mHotseat.animate().alpha(1f).setDuration(duration);
} else {
- mButtonCluster.setAlpha(1f);
+ mHotseat.setAlpha(1f);
}
}
}
/**
- * Hides the dock/hotseat area.
+ * Hides the hotseat area.
*/
- void hideDock(boolean animated) {
+ void hideHotseat(boolean animated) {
if (!LauncherApplication.isScreenLarge()) {
if (animated) {
int duration = mSearchDeleteBar.getTransitionOutDuration();
- mButtonCluster.animate().alpha(0f).setDuration(duration);
+ mHotseat.animate().alpha(0f).setDuration(duration);
} else {
- mButtonCluster.setAlpha(0f);
+ mHotseat.setAlpha(0f);
}
}
}
@@ -2625,9 +2456,9 @@
cameraZoomOut(State.APPS_CUSTOMIZE, animated, false);
mAppsCustomizeTabHost.requestFocus();
- // Hide the search bar and dock
+ // Hide the search bar and hotseat
mSearchDeleteBar.hideSearchBar(animated);
- hideDock(animated);
+ hideHotseat(animated);
// Change the state *after* we've called all the transition code
mState = State.APPS_CUSTOMIZE;
@@ -2684,12 +2515,14 @@
mWorkspace.setVisibility(View.VISIBLE);
cameraZoomIn(State.APPS_CUSTOMIZE, animated, false);
- // Show the search bar and dock
+ // Show the search bar and hotseat
mSearchDeleteBar.showSearchBar(animated);
- showDock(animated);
+ showHotseat(animated);
// Set focus to the AppsCustomize button
- findViewById(R.id.all_apps_button).requestFocus();
+ if (mAllAppsButton != null) {
+ mAllAppsButton.requestFocus();
+ }
}
}
@@ -3022,21 +2855,12 @@
final CellLayout layoutParent = (CellLayout) workspace.getChildAt(i);
layoutParent.removeAllViewsInLayout();
}
-
- if (DEBUG_USER_INTERFACE) {
- android.widget.Button finishButton = new android.widget.Button(this);
- finishButton.setText("Finish");
- workspace.addInScreen(finishButton, 1, 0, 0, 1, 1);
-
- finishButton.setOnClickListener(new android.widget.Button.OnClickListener() {
- public void onClick(View v) {
- finish();
- }
- });
+ if (mHotseat != null) {
+ mHotseat.resetLayout();
}
// This wasn't being called before which resulted in a leak of AppWidgetHostViews
- unbindWorkspaceItems();
+ unbindWorkspaceAndHotseatItems();
}
/**
@@ -3045,30 +2869,27 @@
* Implementation of the method from LauncherModel.Callbacks.
*/
public void bindItems(ArrayList<ItemInfo> shortcuts, int start, int end) {
-
setLoadOnResume();
final Workspace workspace = mWorkspace;
-
for (int i=start; i<end; i++) {
final ItemInfo item = shortcuts.get(i);
switch (item.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
- final View shortcut = createShortcut((ShortcutInfo)item);
- workspace.addInScreen(shortcut, item.screen, item.cellX, item.cellY, 1, 1,
- false);
+ View shortcut = createShortcut((ShortcutInfo)item);
+ workspace.addInScreen(shortcut, item.container, item.screen, item.cellX,
+ item.cellY, 1, 1, false);
break;
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
- final FolderIcon newFolder = FolderIcon.fromXml(R.layout.folder_icon, this,
+ FolderIcon newFolder = FolderIcon.fromXml(R.layout.folder_icon, this,
(ViewGroup) workspace.getChildAt(workspace.getCurrentPage()),
(FolderInfo) item, mIconCache);
- workspace.addInScreen(newFolder, item.screen, item.cellX, item.cellY, 1, 1,
- false);
+ workspace.addInScreen(newFolder, item.container, item.screen, item.cellX,
+ item.cellY, 1, 1, false);
break;
}
}
-
workspace.requestLayout();
}
@@ -3106,7 +2927,7 @@
item.hostView.setAppWidget(appWidgetId, appWidgetInfo);
item.hostView.setTag(item);
- workspace.addInScreen(item.hostView, item.screen, item.cellX,
+ workspace.addInScreen(item.hostView, item.container, item.screen, item.cellX,
item.cellY, item.spanX, item.spanY, false);
addWidgetToAutoAdvanceIfNeeded(item.hostView, appWidgetInfo);
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index b4e632a..c8cf1f8 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -178,17 +178,24 @@
static void moveItemInDatabase(Context context, final ItemInfo item, final long container,
final int screen, final int cellX, final int cellY) {
item.container = container;
- item.screen = screen;
item.cellX = cellX;
item.cellY = cellY;
+ // We store hotseat items in canonical form which is this orientation invariant position
+ // in the hotseat
+ if (context instanceof Launcher && screen < 0 &&
+ container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
+ item.screen = ((Launcher) context).getHotseat().getOrderInHotseat(cellX, cellY);
+ } else {
+ item.screen = screen;
+ }
final Uri uri = LauncherSettings.Favorites.getContentUri(item.id, false);
final ContentValues values = new ContentValues();
final ContentResolver cr = context.getContentResolver();
values.put(LauncherSettings.Favorites.CONTAINER, item.container);
- values.put(LauncherSettings.Favorites.CELLX, cellX);
- values.put(LauncherSettings.Favorites.CELLY, cellY);
+ values.put(LauncherSettings.Favorites.CELLX, item.cellX);
+ values.put(LauncherSettings.Favorites.CELLY, item.cellY);
values.put(LauncherSettings.Favorites.SCREEN, item.screen);
sWorker.post(new Runnable() {
@@ -205,7 +212,8 @@
// Items are added/removed from the corresponding FolderInfo elsewhere, such
// as in Workspace.onDrop. Here, we just add/remove them from the list of items
// that are on the desktop, as appropriate
- if (modelItem.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ if (modelItem.container == LauncherSettings.Favorites.CONTAINER_DESKTOP ||
+ modelItem.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
if (!sWorkspaceItems.contains(modelItem)) {
sWorkspaceItems.add(modelItem);
}
@@ -356,12 +364,19 @@
* Add an item to the database in a specified container. Sets the container, screen, cellX and
* cellY fields of the item. Also assigns an ID to the item.
*/
- static void addItemToDatabase(Context context, final ItemInfo item, long container,
- int screen, int cellX, int cellY, final boolean notify) {
+ static void addItemToDatabase(Context context, final ItemInfo item, final long container,
+ final int screen, final int cellX, final int cellY, final boolean notify) {
item.container = container;
- item.screen = screen;
item.cellX = cellX;
item.cellY = cellY;
+ // We store hotseat items in canonical form which is this orientation invariant position
+ // in the hotseat
+ if (context instanceof Launcher && screen < 0 &&
+ container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
+ item.screen = ((Launcher) context).getHotseat().getOrderInHotseat(cellX, cellY);
+ } else {
+ item.screen = screen;
+ }
final ContentValues values = new ContentValues();
final ContentResolver cr = context.getContentResolver();
@@ -371,7 +386,7 @@
LauncherApplication app = (LauncherApplication) l.getApplication();
item.id = app.getLauncherProvider().generateNewId();
values.put(LauncherSettings.Favorites._ID, item.id);
- item.updateValuesWithCoordinates(values, cellX, cellY);
+ item.updateValuesWithCoordinates(values, item.cellX, item.cellY);
sWorker.post(new Runnable() {
public void run() {
@@ -382,13 +397,11 @@
switch (item.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
sFolders.put(item.id, (FolderInfo) item);
- if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
- sWorkspaceItems.add(item);
- }
- break;
+ // Fall through
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
- if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP ||
+ item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
sWorkspaceItems.add(item);
}
break;
@@ -404,8 +417,8 @@
* Creates a new unique child id, for a given cell span across all layouts.
*/
static int getCellLayoutChildId(
- int cellId, int screen, int localCellX, int localCellY, int spanX, int spanY) {
- return ((cellId & 0xFF) << 24)
+ long container, int screen, int localCellX, int localCellY, int spanX, int spanY) {
+ return (((int) container & 0xFF) << 24)
| (screen & 0xFF) << 16 | (localCellX & 0xFF) << 8 | (localCellY & 0xFF);
}
@@ -928,6 +941,7 @@
switch (container) {
case LauncherSettings.Favorites.CONTAINER_DESKTOP:
+ case LauncherSettings.Favorites.CONTAINER_HOTSEAT:
sWorkspaceItems.add(info);
break;
default:
@@ -972,6 +986,7 @@
}
switch (container) {
case LauncherSettings.Favorites.CONTAINER_DESKTOP:
+ case LauncherSettings.Favorites.CONTAINER_HOTSEAT:
sWorkspaceItems.add(folderInfo);
break;
}
@@ -1003,9 +1018,10 @@
appWidgetInfo.spanY = c.getInt(spanYIndex);
container = c.getInt(containerIndex);
- if (container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ if (container != LauncherSettings.Favorites.CONTAINER_DESKTOP &&
+ container != LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
Log.e(TAG, "Widget found where container "
- + "!= CONTAINER_DESKTOP -- ignoring!");
+ + "!= CONTAINER_DESKTOP nor CONTAINER_HOTSEAT - ignoring!");
continue;
}
appWidgetInfo.container = c.getInt(containerIndex);
@@ -1607,12 +1623,10 @@
}
}
- ShortcutInfo addShortcut(Context context, Intent data,
- int screen, int cellX, int cellY, boolean notify) {
-
+ ShortcutInfo addShortcut(Context context, Intent data, long container, int screen,
+ int cellX, int cellY, boolean notify) {
final ShortcutInfo info = infoFromShortcutIntent(context, data, null);
- addItemToDatabase(context, info, LauncherSettings.Favorites.CONTAINER_DESKTOP,
- screen, cellX, cellY, notify);
+ addItemToDatabase(context, info, container, screen, cellX, cellY, notify);
return info;
}
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index 5ffd984..96cc63c 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -65,11 +65,11 @@
private static final boolean LOGD = false;
private static final String DATABASE_NAME = "launcher.db";
-
- private static final int DATABASE_VERSION = 8;
+
+ private static final int DATABASE_VERSION = 9;
static final String AUTHORITY = "com.android.launcher2.settings";
-
+
static final String TABLE_FAVORITES = "favorites";
static final String PARAMETER_NOTIFY = "notify";
@@ -199,7 +199,7 @@
private static final String TAG_SEARCH = "search";
private static final String TAG_APPWIDGET = "appwidget";
private static final String TAG_SHORTCUT = "shortcut";
-
+
private final Context mContext;
private final AppWidgetHost mAppWidgetHost;
private long mMaxId = -1;
@@ -208,7 +208,12 @@
super(context, DATABASE_NAME, null, DATABASE_VERSION);
mContext = context;
mAppWidgetHost = new AppWidgetHost(context, Launcher.APPWIDGET_HOST_ID);
- mMaxId = initializeMaxId(getWritableDatabase());
+
+ // In the case where neither onCreate nor onUpgrade gets called, we read the maxId from
+ // the DB here
+ if (mMaxId == -1) {
+ mMaxId = initializeMaxId(getWritableDatabase());
+ }
}
/**
@@ -254,10 +259,10 @@
mAppWidgetHost.deleteHost();
sendAppWidgetResetNotify();
}
-
+
if (!convertDatabase(db)) {
// Populate favorites table with initial favorites
- loadFavorites(db);
+ loadFavorites(db, ItemInfo.NO_ID);
}
}
@@ -427,6 +432,18 @@
version = 8;
}
+ if (version < 9) {
+ // The max id is not yet set at this point (onUpgrade is triggered in the ctor
+ // before it gets a change to get set, so we need to read it here when we use it)
+ if (mMaxId == -1) {
+ mMaxId = initializeMaxId(db);
+ }
+
+ // Add default hotseat icons
+ loadFavorites(db, LauncherSettings.Favorites.CONTAINER_HOTSEAT);
+ version = 9;
+ }
+
if (version != DATABASE_VERSION) {
Log.w(TAG, "Destroying all old data.");
db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES);
@@ -672,8 +689,9 @@
* Loads the default set of favorite packages from an xml file.
*
* @param db The database to write the values into
+ * @param filterContainerId The specific container id of items to load
*/
- private int loadFavorites(SQLiteDatabase db) {
+ private int loadFavorites(SQLiteDatabase db, long filterContainerId) {
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ContentValues values = new ContentValues();
@@ -700,26 +718,42 @@
TypedArray a = mContext.obtainStyledAttributes(attrs, R.styleable.Favorite);
- values.clear();
- values.put(LauncherSettings.Favorites.CONTAINER,
- LauncherSettings.Favorites.CONTAINER_DESKTOP);
- values.put(LauncherSettings.Favorites.SCREEN,
- a.getString(R.styleable.Favorite_screen));
- values.put(LauncherSettings.Favorites.CELLX,
- a.getString(R.styleable.Favorite_x));
- values.put(LauncherSettings.Favorites.CELLY,
- a.getString(R.styleable.Favorite_y));
+ long container = LauncherSettings.Favorites.CONTAINER_DESKTOP;
+ 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 (TAG_FAVORITE.equals(name)) {
- added = addAppShortcut(db, values, a, packageManager, intent);
- } 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)) {
- added = addUriShortcut(db, values, a);
+ // 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 &&
+ Integer.valueOf(screen) <= 0) {
+ 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);
+
+ System.out.println("Adding item to container: " + container);
+
+ if (TAG_FAVORITE.equals(name)) {
+ added = addAppShortcut(db, values, a, packageManager, intent);
+ } 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)) {
+ added = addUriShortcut(db, values, a);
+ }
}
if (added) i++;
@@ -730,6 +764,8 @@
Log.w(TAG, "Got exception parsing favorites.", e);
} catch (IOException e) {
Log.w(TAG, "Got exception parsing favorites.", e);
+ } catch (RuntimeException e) {
+ Log.w(TAG, "Got exception parsing favorites.", e);
}
return i;
diff --git a/src/com/android/launcher2/LauncherSettings.java b/src/com/android/launcher2/LauncherSettings.java
index c378405..fcacdec 100644
--- a/src/com/android/launcher2/LauncherSettings.java
+++ b/src/com/android/launcher2/LauncherSettings.java
@@ -133,6 +133,7 @@
* The icon is a resource identified by a package name and an integer id.
*/
static final int CONTAINER_DESKTOP = -100;
+ static final int CONTAINER_HOTSEAT = -101;
/**
* The screen holding the favorite (if container is CONTAINER_DESKTOP)
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 9ef1fa8..bed107a 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -161,11 +161,11 @@
protected boolean mIsDataReady = false;
// Scrolling indicator
+ private android.animation.ValueAnimator mScrollIndicatorAnimator;
private ImageView mScrollIndicator;
private ImageView mScrollTrack;
private boolean mHasScrollIndicator = true;
private static final int sScrollIndicatorFadeInDuration = 150;
- private static final int sScrollIndicatorFastFadeOutDuration = 50;
private static final int sScrollIndicatorFadeOutDuration = 650;
private static final int sScrollIndicatorFlashDuration = 650;
@@ -260,10 +260,6 @@
return getChildAt(index);
}
- int getScrollWidth() {
- return getWidth();
- }
-
/**
* Updates the scroll of the current page immediately to its final scroll position. We use this
* in CustomizePagedView to allow tabs to share the same PagedView while resetting the scroll of
@@ -1676,7 +1672,13 @@
if (mScrollIndicator != null) {
// Fade the indicator in
updateScrollingIndicatorPosition();
- mScrollIndicator.animate().alpha(1f).setDuration(sScrollIndicatorFadeInDuration).start();
+ mScrollIndicator.setVisibility(View.VISIBLE);
+ if (mScrollIndicatorAnimator != null) {
+ mScrollIndicatorAnimator.cancel();
+ }
+ mScrollIndicatorAnimator = ObjectAnimator.ofFloat(mScrollIndicator, "alpha", 1f);
+ mScrollIndicatorAnimator.setDuration(sScrollIndicatorFadeInDuration);
+ mScrollIndicatorAnimator.start();
}
}
@@ -1688,11 +1690,41 @@
if (mScrollIndicator != null) {
// Fade the indicator out
updateScrollingIndicatorPosition();
- mScrollIndicator.animate().alpha(0f).setDuration(immediately ?
- sScrollIndicatorFastFadeOutDuration : sScrollIndicatorFadeOutDuration).start();
+ if (mScrollIndicatorAnimator != null) {
+ mScrollIndicatorAnimator.cancel();
+ }
+ if (immediately) {
+ mScrollIndicator.setVisibility(View.GONE);
+ mScrollIndicator.setAlpha(0f);
+ } else {
+ mScrollIndicatorAnimator = ObjectAnimator.ofFloat(mScrollIndicator, "alpha", 0f);
+ mScrollIndicatorAnimator.setDuration(sScrollIndicatorFadeOutDuration);
+ mScrollIndicatorAnimator.addListener(new AnimatorListenerAdapter() {
+ private boolean cancelled = false;
+ @Override
+ public void onAnimationCancel(android.animation.Animator animation) {
+ cancelled = true;
+ }
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ if (!cancelled) {
+ mScrollIndicator.setVisibility(View.GONE);
+ }
+ }
+ });
+ mScrollIndicatorAnimator.start();
+ }
}
}
+ /**
+ * To be overridden by subclasses to determine whether the scroll indicator should stretch to
+ * fill its space on the track or not.
+ */
+ protected boolean hasElasticScrollIndicator() {
+ return false;
+ }
+
private void updateScrollingIndicator() {
if (getChildCount() <= 1) return;
if (!isScrollingIndicatorEnabled()) return;
@@ -1706,16 +1738,35 @@
private void updateScrollingIndicatorPosition() {
if (!isScrollingIndicatorEnabled()) return;
- // We can make the page width smaller to make it look more centered
+ int numPages = getChildCount();
+ int pageWidth = getMeasuredWidth();
+ int maxPageWidth = (numPages * getMeasuredWidth()) + ((numPages - 1) * mPageSpacing);
+ int trackWidth = pageWidth;
+ int indicatorWidth = mScrollIndicator.getMeasuredWidth() -
+ mScrollIndicator.getPaddingLeft() - mScrollIndicator.getPaddingRight();
+ int paddingLeft = 0;
+ int paddingRight = 0;
+
+ // Get the track properties
getScrollingIndicatorTrack();
- int pageWidth = mScrollTrack.getMeasuredWidth() - mScrollTrack.getPaddingLeft() -
- mScrollTrack.getPaddingRight();
- int maxPageWidth = getChildCount() * getMeasuredWidth();
+ if (mScrollTrack != null) {
+ paddingLeft = mScrollTrack.getPaddingLeft();
+ paddingRight = mScrollTrack.getPaddingRight();
+ trackWidth = mScrollTrack.getMeasuredWidth() - paddingLeft - paddingRight;
+ }
+
float offset = (float) getScrollX() / maxPageWidth;
- int indicatorWidth = pageWidth / getChildCount();
- int indicatorCenterOffset = indicatorWidth / 2 - mScrollIndicator.getMeasuredWidth() / 2;
- int indicatorPos = (int) (offset * pageWidth) + mScrollTrack.getPaddingLeft() +
- indicatorCenterOffset;
+ int indicatorSpace = trackWidth / numPages;
+ int indicatorPos = (int) (offset * trackWidth) + paddingLeft;
+ if (hasElasticScrollIndicator()) {
+ if (mScrollIndicator.getMeasuredWidth() != indicatorSpace) {
+ mScrollIndicator.getLayoutParams().width = indicatorSpace;
+ mScrollIndicator.requestLayout();
+ }
+ } else {
+ int indicatorCenterOffset = indicatorSpace / 2 - indicatorWidth / 2;
+ indicatorPos += indicatorCenterOffset;
+ }
mScrollIndicator.setTranslationX(indicatorPos);
mScrollIndicator.invalidate();
}
diff --git a/src/com/android/launcher2/PagedViewWithDraggableItems.java b/src/com/android/launcher2/PagedViewWithDraggableItems.java
index 5fa7be7..287a065 100644
--- a/src/com/android/launcher2/PagedViewWithDraggableItems.java
+++ b/src/com/android/launcher2/PagedViewWithDraggableItems.java
@@ -37,17 +37,19 @@
private boolean mIsDragging;
private boolean mIsDragEnabled;
private float mDragSlopeThreshold;
+ private Launcher mLauncher;
public PagedViewWithDraggableItems(Context context) {
- super(context, null);
+ this(context, null);
}
public PagedViewWithDraggableItems(Context context, AttributeSet attrs) {
- super(context, attrs, 0);
+ this(context, attrs, 0);
}
public PagedViewWithDraggableItems(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+ mLauncher = (Launcher) context;
}
protected boolean beginDragging(View v) {
@@ -102,10 +104,13 @@
if (!v.isInTouchMode()) return false;
// Return early if we are still animating the pages
if (mNextPage != INVALID_PAGE) return false;
+ // When we have exited all apps or are in transition, disregard long clicks
+ if (!mLauncher.isAllAppsCustomizeOpen() ||
+ mLauncher.getWorkspace().isSwitchingState()) return false;
+
return beginDragging(v);
}
-
/*
* Determines if we should change the touch state to start scrolling after the
* user moves their touch point too far.
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index e47f701..b86fa41 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -424,12 +424,8 @@
* @param spanX The number of cells spanned horizontally by the child.
* @param spanY The number of cells spanned vertically by the child.
*/
- void addInScreen(View child, int screen, int x, int y, int spanX, int spanY) {
- addInScreen(child, screen, x, y, spanX, spanY, false);
- }
-
- void addInFullScreen(View child, int screen) {
- addInScreen(child, screen, 0, 0, -1, -1);
+ void addInScreen(View child, long container, int screen, int x, int y, int spanX, int spanY) {
+ addInScreen(child, container, screen, x, y, spanX, spanY, false);
}
/**
@@ -444,14 +440,32 @@
* @param spanY The number of cells spanned vertically by the child.
* @param insert When true, the child is inserted at the beginning of the children list.
*/
- void addInScreen(View child, int screen, int x, int y, int spanX, int spanY, boolean insert) {
- if (screen < 0 || screen >= getChildCount()) {
- Log.e(TAG, "The screen must be >= 0 and < " + getChildCount()
- + " (was " + screen + "); skipping child");
- return;
+ void addInScreen(View child, long container, int screen, int x, int y, int spanX, int spanY,
+ boolean insert) {
+ if (container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ if (screen < 0 || screen >= getChildCount()) {
+ Log.e(TAG, "The screen must be >= 0 and < " + getChildCount()
+ + " (was " + screen + "); skipping child");
+ return;
+ }
}
- final CellLayout group = (CellLayout) getChildAt(screen);
+ final CellLayout layout;
+ if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
+ layout = mLauncher.getHotseat().getLayout();
+
+ if (screen < 0) {
+ screen = mLauncher.getHotseat().getOrderInHotseat(x, y);
+ } else {
+ // Note: We do this to ensure that the hotseat is always laid out in the orientation
+ // of the hotseat in order regardless of which orientation they were added
+ x = mLauncher.getHotseat().getCellXFromOrder(screen);
+ y = mLauncher.getHotseat().getCellYFromOrder(screen);
+ }
+ } else {
+ layout = (CellLayout) getChildAt(screen);
+ }
+
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
if (lp == null) {
lp = new CellLayout.LayoutParams(x, y, spanX, spanY);
@@ -467,9 +481,9 @@
}
// Get the canonical child id to uniquely represent this view in this screen
- int childId = LauncherModel.getCellLayoutChildId(-1, screen, x, y, spanX, spanY);
+ int childId = LauncherModel.getCellLayoutChildId(container, screen, x, y, spanX, spanY);
boolean markCellsAsOccupied = !(child instanceof Folder);
- if (!group.addViewToCellLayout(child, insert ? 0 : -1, childId, lp, markCellsAsOccupied)) {
+ if (!layout.addViewToCellLayout(child, insert ? 0 : -1, childId, lp, markCellsAsOccupied)) {
// TODO: This branch occurs when the workspace is adding views
// outside of the defined grid
// maybe we should be deleting these items from the LauncherModel?
@@ -525,6 +539,10 @@
return (isSmall() || mIsSwitchingState);
}
+ public boolean isSwitchingState() {
+ return mIsSwitchingState;
+ }
+
protected void onWindowVisibilityChanged (int visibility) {
mLauncher.onWindowVisibilityChanged(visibility);
}
@@ -1958,9 +1976,7 @@
}
mDragInfo = cellInfo;
-
- CellLayout current = (CellLayout) getChildAt(cellInfo.screen);
- current.onDragChild(child);
+ child.setVisibility(GONE);
child.clearFocus();
child.setPressed(false);
@@ -1987,8 +2003,7 @@
mLauncher.getDragLayer().getLocationInDragLayer(child, mTempXY);
final int dragLayerX = (int) mTempXY[0] + (child.getWidth() - bmpWidth) / 2;
- int dragLayerY = (int) mTempXY[1] + (child.getHeight() - bmpHeight) / 2;
- dragLayerY -= (child.getHeight() - b.getHeight()) / 2;
+ int dragLayerY = mTempXY[1] - bitmapPadding / 2;
Rect dragRect = null;
if (child instanceof BubbleTextView) {
@@ -1997,6 +2012,7 @@
int left = (bmpWidth - iconSize) / 2;
int right = left + iconSize;
int bottom = top + iconSize;
+ dragLayerY += top;
dragRect = new Rect(left, top, right, bottom);
} else if (child instanceof FolderIcon) {
int previewSize = getResources().getDimensionPixelSize(R.dimen.folder_preview_size);
@@ -2008,17 +2024,15 @@
b.recycle();
}
- void addApplicationShortcut(ShortcutInfo info, int screen, int cellX, int cellY,
- boolean insertAtFirst, int intersectX, int intersectY) {
- final CellLayout cellLayout = (CellLayout) getChildAt(screen);
- View view = mLauncher.createShortcut(R.layout.application, cellLayout, (ShortcutInfo) info);
+ void addApplicationShortcut(ShortcutInfo info, CellLayout target, long container, int screen,
+ int cellX, int cellY, boolean insertAtFirst, int intersectX, int intersectY) {
+ View view = mLauncher.createShortcut(R.layout.application, target, (ShortcutInfo) info);
final int[] cellXY = new int[2];
- cellLayout.findCellForSpanThatIntersects(cellXY, 1, 1, intersectX, intersectY);
- addInScreen(view, screen, cellXY[0], cellXY[1], 1, 1, insertAtFirst);
- LauncherModel.addOrMoveItemInDatabase(mLauncher, info,
- LauncherSettings.Favorites.CONTAINER_DESKTOP, screen,
- cellXY[0], cellXY[1]);
+ target.findCellForSpanThatIntersects(cellXY, 1, 1, intersectX, intersectY);
+ addInScreen(view, container, screen, cellXY[0], cellXY[1], 1, 1, insertAtFirst);
+ LauncherModel.addOrMoveItemInDatabase(mLauncher, info, container, screen, cellXY[0],
+ cellXY[1]);
}
/**
@@ -2051,7 +2065,6 @@
mTargetCell = findNearestArea((int) mDragViewVisualCenter[0],
(int) mDragViewVisualCenter[1], spanX, spanY, mDragTargetLayout, mTargetCell);
-
if (willCreateUserFolder((ItemInfo) d.dragInfo, mDragTargetLayout, mTargetCell, true)) {
return true;
}
@@ -2074,8 +2087,12 @@
boolean considerTimeout) {
View dropOverView = target.getChildAt(targetCell[0], targetCell[1]);
- boolean hasntMoved = mDragInfo != null && (mDragInfo.cellX == targetCell[0] &&
- mDragInfo.cellY == targetCell[1]) && mDragInfo.screen == indexOfChild(target);
+ boolean hasntMoved = false;
+ if (mDragInfo != null) {
+ CellLayout cellParent = getParentCellLayoutForView(mDragInfo.cell);
+ hasntMoved = (mDragInfo.cellX == targetCell[0] &&
+ mDragInfo.cellY == targetCell[1]) && (cellParent == target);
+ }
if (dropOverView == null || hasntMoved || (considerTimeout && !mCreateUserFolderOnDrop)) {
return false;
@@ -2100,11 +2117,15 @@
return false;
}
- boolean createUserFolderIfNecessary(View newView, CellLayout target,
+ boolean createUserFolderIfNecessary(View newView, long container, CellLayout target,
int[] targetCell, boolean external, DragView dragView, Runnable postAnimationRunnable) {
View v = target.getChildAt(targetCell[0], targetCell[1]);
- boolean hasntMoved = mDragInfo != null
- && (mDragInfo.cellX == targetCell[0] && mDragInfo.cellY == targetCell[1]);
+ boolean hasntMoved = false;
+ if (mDragInfo != null) {
+ CellLayout cellParent = getParentCellLayoutForView(mDragInfo.cell);
+ hasntMoved = (mDragInfo.cellX == targetCell[0] &&
+ mDragInfo.cellY == targetCell[1]) && (cellParent == target);
+ }
if (v == null || hasntMoved || !mCreateUserFolderOnDrop) return false;
mCreateUserFolderOnDrop = false;
@@ -2118,16 +2139,15 @@
ShortcutInfo destInfo = (ShortcutInfo) v.getTag();
// if the drag started here, we need to remove it from the workspace
if (!external) {
- int fromScreen = mDragInfo.screen;
- CellLayout sourceLayout = (CellLayout) getChildAt(fromScreen);
- sourceLayout.removeView(newView);
+ getParentCellLayoutForView(mDragInfo.cell).removeView(mDragInfo.cell);
}
Rect folderLocation = new Rect();
float scale = mLauncher.getDragLayer().getDescendantRectRelativeToSelf(v, folderLocation);
target.removeView(v);
- FolderIcon fi = mLauncher.addFolder(screen, targetCell[0], targetCell[1]);
+ FolderIcon fi =
+ mLauncher.addFolder(target, container, screen, targetCell[0], targetCell[1]);
destInfo.cellX = -1;
destInfo.cellY = -1;
sourceInfo.cellX = -1;
@@ -2150,9 +2170,7 @@
// if the drag started here, we need to remove it from the workspace
if (!external) {
- int fromScreen = mDragInfo.screen;
- CellLayout sourceLayout = (CellLayout) getChildAt(fromScreen);
- sourceLayout.removeView(newView);
+ getParentCellLayoutForView(mDragInfo.cell).removeView(mDragInfo.cell);
}
return true;
}
@@ -2166,7 +2184,11 @@
// We want the point to be mapped to the dragTarget.
if (mDragTargetLayout != null) {
- mapPointFromSelfToChild(mDragTargetLayout, mDragViewVisualCenter, null);
+ if (mLauncher.isHotseatLayout(mDragTargetLayout)) {
+ mapPointFromSelfToSibling(mLauncher.getHotseat(), mDragViewVisualCenter);
+ } else {
+ mapPointFromSelfToChild(mDragTargetLayout, mDragViewVisualCenter, null);
+ }
}
// When you are in customization mode and drag to a particular screen, make that the
@@ -2186,11 +2208,23 @@
} else if (mDragInfo != null) {
final View cell = mDragInfo.cell;
- if (dropTargetLayout != null) {
- // Move internally
- final int screen = (mTargetCell[0] < 0) ?
- mDragInfo.screen : indexOfChild(dropTargetLayout);
+ boolean continueDrop = true;
+ if (mLauncher.isHotseatLayout(mDragTargetLayout) && d.dragInfo instanceof ItemInfo) {
+ ItemInfo info = (ItemInfo) d.dragInfo;
+ if (info.spanX > 1 || info.spanY > 1) {
+ continueDrop = false;
+ Toast.makeText(getContext(), R.string.invalid_hotseat_item,
+ Toast.LENGTH_SHORT).show();
+ }
+ }
+ if (continueDrop && dropTargetLayout != null) {
+ // Move internally
+ long container = mLauncher.isHotseatLayout(dropTargetLayout) ?
+ LauncherSettings.Favorites.CONTAINER_HOTSEAT :
+ LauncherSettings.Favorites.CONTAINER_DESKTOP;
+ int screen = (mTargetCell[0] < 0) ?
+ mDragInfo.screen : indexOfChild(dropTargetLayout);
int spanX = mDragInfo != null ? mDragInfo.spanX : 1;
int spanY = mDragInfo != null ? mDragInfo.spanY : 1;
// First we find the cell nearest to point at which the item is
@@ -2199,10 +2233,10 @@
mDragViewVisualCenter[1], spanX, spanY, dropTargetLayout, mTargetCell);
// If the item being dropped is a shortcut and the nearest drop
// cell also contains a shortcut, then create a folder with the two shortcuts.
- boolean dropInscrollArea = mCurrentPage != screen;
+ boolean dropInscrollArea = mCurrentPage != screen && screen > -1;
- if (!dropInscrollArea && createUserFolderIfNecessary(cell, dropTargetLayout,
- mTargetCell, false, d.dragView, null)) {
+ if (!dropInscrollArea && createUserFolderIfNecessary(cell, container,
+ dropTargetLayout, mTargetCell, false, d.dragView, null)) {
return;
}
@@ -2220,25 +2254,26 @@
snapToPage(screen);
}
+
if (mTargetCell[0] >= 0 && mTargetCell[1] >= 0) {
if (screen != mDragInfo.screen) {
// Reparent the view
- ((CellLayout) getChildAt(mDragInfo.screen)).removeView(cell);
- addInScreen(cell, screen, mTargetCell[0], mTargetCell[1], mDragInfo.spanX,
- mDragInfo.spanY);
+ getParentCellLayoutForView(cell).removeView(cell);
+ addInScreen(cell, container, screen, mTargetCell[0], mTargetCell[1],
+ mDragInfo.spanX, mDragInfo.spanY);
}
-
// update the item's position after drop
final ItemInfo info = (ItemInfo) cell.getTag();
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) cell.getLayoutParams();
dropTargetLayout.onMove(cell, mTargetCell[0], mTargetCell[1]);
lp.cellX = mTargetCell[0];
lp.cellY = mTargetCell[1];
- cell.setId(LauncherModel.getCellLayoutChildId(-1, mDragInfo.screen,
+ cell.setId(LauncherModel.getCellLayoutChildId(container, mDragInfo.screen,
mTargetCell[0], mTargetCell[1], mDragInfo.spanX, mDragInfo.spanY));
- if (cell instanceof LauncherAppWidgetHostView) {
+ if (container != LauncherSettings.Favorites.CONTAINER_HOTSEAT &&
+ cell instanceof LauncherAppWidgetHostView) {
final CellLayout cellLayout = dropTargetLayout;
// We post this call so that the widget has a chance to be placed
// in its final location
@@ -2264,9 +2299,8 @@
}
}
- LauncherModel.moveItemInDatabase(mLauncher, info,
- LauncherSettings.Favorites.CONTAINER_DESKTOP, screen,
- lp.cellX, lp.cellY);
+ LauncherModel.moveItemInDatabase(mLauncher, info, container, screen, lp.cellX,
+ lp.cellY);
}
}
@@ -2282,8 +2316,12 @@
}
};
mAnimatingViewIntoPlace = true;
- mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, cell,
- disableHardwareLayersRunnable);
+ if (d.dragView.hasDrawn()) {
+ mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, cell,
+ disableHardwareLayersRunnable);
+ } else {
+ cell.setVisibility(VISIBLE);
+ }
parent.onDropChild(cell);
}
}
@@ -2446,7 +2484,8 @@
final AppWidgetProviderInfo widgetInfo = widgets.get(0).widgetInfo;
final PendingAddWidgetInfo createInfo =
new PendingAddWidgetInfo(widgetInfo, mimeType, data);
- mLauncher.addAppWidgetFromDrop(createInfo, mCurrentPage, null, pos);
+ mLauncher.addAppWidgetFromDrop(createInfo,
+ LauncherSettings.Favorites.CONTAINER_DESKTOP, mCurrentPage, null, pos);
} else {
// Show the widget picker dialog if there is more than one widget
// that can handle this data type
@@ -2507,6 +2546,15 @@
}
/*
+ * Maps a point from the Workspace's coordinate system to another sibling view's. (Workspace
+ * covers the full screen)
+ */
+ void mapPointFromSelfToSibling(View v, float[] xy) {
+ xy[0] = xy[0] - v.getLeft();
+ xy[1] = xy[1] - v.getTop();
+ }
+
+ /*
*
* Convert the 2D coordinate xy from this CellLayout's coordinate space to
* the parent View's coordinate space. The argument xy is modified with the return result.
@@ -2573,7 +2621,7 @@
*
*/
private CellLayout findMatchingPageForDragOver(
- DragView dragView, int originX, int originY, int offsetX, int offsetY, boolean exact) {
+ DragView dragView, float originX, float originY, boolean exact) {
// We loop through all the screens (ie CellLayouts) and see which ones overlap
// with the item being dragged and then choose the one that's closest to the touch point
final int screenCount = getChildCount();
@@ -2581,12 +2629,9 @@
float smallestDistSoFar = Float.MAX_VALUE;
for (int i = 0; i < screenCount; i++) {
- CellLayout cl = (CellLayout)getChildAt(i);
+ CellLayout cl = (CellLayout) getChildAt(i);
- final float[] touchXy = mTempTouchCoordinates;
- touchXy[0] = originX + offsetX;
- touchXy[1] = originY + offsetY;
-
+ final float[] touchXy = {originX, originY};
// Transform the touch coordinates to the CellLayout's local coordinates
// If the touch point is within the bounds of the cell layout, we can return immediately
cl.getMatrix().invert(mTempInverseMatrix);
@@ -2597,15 +2642,15 @@
return cl;
}
- if (!exact && overlaps(cl, dragView, originX, originY, mTempInverseMatrix)) {
+ if (!exact && overlaps(cl, dragView, (int) originX, (int) originY, mTempInverseMatrix)) {
// Get the center of the cell layout in screen coordinates
final float[] cellLayoutCenter = mTempCellLayoutCenterCoordinates;
cellLayoutCenter[0] = cl.getWidth()/2;
cellLayoutCenter[1] = cl.getHeight()/2;
mapPointFromChildToSelf(cl, cellLayoutCenter);
- touchXy[0] = originX + offsetX;
- touchXy[1] = originY + offsetY;
+ touchXy[0] = originX;
+ touchXy[1] = originY;
// Calculate the distance between the center of the CellLayout
// and the touch point
@@ -2657,17 +2702,21 @@
if (mInScrollArea) return;
if (mIsSwitchingState) return;
- CellLayout layout;
+ CellLayout layout = null;
ItemInfo item = (ItemInfo) d.dragInfo;
// Ensure that we have proper spans for the item that we are dropping
if (item.spanX < 0 || item.spanY < 0) throw new RuntimeException("Improper spans found");
+ mDragViewVisualCenter = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset,
+ d.dragView, mDragViewVisualCenter);
+
// Identify whether we have dragged over a side page
if (isSmall()) {
int left = d.x - d.xOffset;
int top = d.y - d.yOffset;
- layout = findMatchingPageForDragOver(d.dragView, left, top, d.xOffset, d.yOffset, true);
+ layout = findMatchingPageForDragOver(d.dragView, mDragViewVisualCenter[0],
+ mDragViewVisualCenter[1], true);
if (layout != mDragTargetLayout) {
// Cancel all intermediate folder states
cleanupFolderCreation(d);
@@ -2690,7 +2739,17 @@
}
}
} else {
- layout = getCurrentDropLayout();
+ // Test to see if we are over the hotseat otherwise just use the current page
+ Rect r = new Rect();
+ if (mLauncher.getHotseat() != null) {
+ mLauncher.getHotseat().getHitRect(r);
+ if (r.contains(d.x, d.y)) {
+ layout = mLauncher.getHotseat().getLayout();
+ }
+ }
+ if (layout == null) {
+ layout = getCurrentDropLayout();
+ }
if (layout != mDragTargetLayout) {
if (mDragTargetLayout != null) {
mDragTargetLayout.setIsDragOverlapping(false);
@@ -2706,11 +2765,12 @@
if (mDragTargetLayout != null) {
final View child = (mDragInfo == null) ? null : mDragInfo.cell;
- mDragViewVisualCenter = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset,
- d.dragView, mDragViewVisualCenter);
-
// We want the point to be mapped to the dragTarget.
- mapPointFromSelfToChild(mDragTargetLayout, mDragViewVisualCenter, null);
+ if (mLauncher.isHotseatLayout(mDragTargetLayout)) {
+ mapPointFromSelfToSibling(mLauncher.getHotseat(), mDragViewVisualCenter);
+ } else {
+ mapPointFromSelfToChild(mDragTargetLayout, mDragViewVisualCenter, null);
+ }
ItemInfo info = (ItemInfo) d.dragInfo;
mTargetCell = findNearestArea((int) mDragViewVisualCenter[0],
@@ -2845,8 +2905,12 @@
spanY = mDragInfo.spanY;
}
+ final long container = mLauncher.isHotseatLayout(cellLayout) ?
+ LauncherSettings.Favorites.CONTAINER_HOTSEAT :
+ LauncherSettings.Favorites.CONTAINER_DESKTOP;
final int screen = indexOfChild(cellLayout);
- if (screen != mCurrentPage && mState != State.SPRING_LOADED) {
+ if (!mLauncher.isHotseatLayout(cellLayout) && screen != mCurrentPage
+ && mState != State.SPRING_LOADED) {
snapToPage(screen);
}
@@ -2863,11 +2927,11 @@
switch (pendingInfo.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
mLauncher.addAppWidgetFromDrop((PendingAddWidgetInfo) pendingInfo,
- screen, mTargetCell, null);
+ container, screen, mTargetCell, null);
break;
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
mLauncher.processShortcutFromDrop(pendingInfo.componentName,
- screen, mTargetCell, null);
+ container, screen, mTargetCell, null);
break;
default:
throw new IllegalStateException("Unknown item type: " +
@@ -2923,8 +2987,8 @@
mTargetCell = findNearestArea((int) touchXY[0], (int) touchXY[1], spanX, spanY,
cellLayout, mTargetCell);
d.postAnimationRunnable = exitSpringLoadedRunnable;
- if (createUserFolderIfNecessary(view, cellLayout, mTargetCell, true, d.dragView,
- d.postAnimationRunnable)) {
+ if (createUserFolderIfNecessary(view, container, cellLayout, mTargetCell, true,
+ d.dragView, d.postAnimationRunnable)) {
return;
}
if (addToExistingFolderIfNecessary(view, cellLayout, mTargetCell, d, true)) {
@@ -2939,15 +3003,14 @@
} else {
cellLayout.findCellForSpan(mTargetCell, 1, 1);
}
- addInScreen(view, indexOfChild(cellLayout), mTargetCell[0],
- mTargetCell[1], info.spanX, info.spanY, insertAtFirst);
+ addInScreen(view, container, screen, mTargetCell[0], mTargetCell[1], info.spanX,
+ info.spanY, insertAtFirst);
cellLayout.onDropChild(view);
cellLayout.animateDrop();
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) view.getLayoutParams();
cellLayout.getChildrenLayout().measureChild(view);
- LauncherModel.addOrMoveItemInDatabase(mLauncher, info,
- LauncherSettings.Favorites.CONTAINER_DESKTOP, screen,
+ LauncherModel.addOrMoveItemInDatabase(mLauncher, info, container, screen,
lp.cellX, lp.cellY);
if (d.dragView != null) {
@@ -3016,8 +3079,7 @@
if (success) {
if (target != this) {
if (mDragInfo != null) {
- final CellLayout cellLayout = (CellLayout) getChildAt(mDragInfo.screen);
- cellLayout.removeView(mDragInfo.cell);
+ getParentCellLayoutForView(mDragInfo.cell).removeView(mDragInfo.cell);
if (mDragInfo.cell instanceof DropTarget) {
mDragController.removeDropTarget((DropTarget) mDragInfo.cell);
}
@@ -3028,17 +3090,18 @@
// calling onDropCompleted(). We call it ourselves here, but maybe this should be
// moved into DragController.cancelDrag().
doDragExit(null);
- ((CellLayout) getChildAt(mDragInfo.screen)).onDropChild(mDragInfo.cell);
+ CellLayout cellLayout;
+ if (mLauncher.isHotseatLayout(target)) {
+ cellLayout = mLauncher.getHotseat().getLayout();
+ } else {
+ cellLayout = (CellLayout) getChildAt(mDragInfo.screen);
+ }
+ cellLayout.onDropChild(mDragInfo.cell);
}
mDragOutline = null;
mDragInfo = null;
}
- @Override
- public void onDragViewVisible() {
- ((View) mDragInfo.cell).setVisibility(View.GONE);
- }
-
public boolean isDropEnabled() {
return true;
}
@@ -3125,15 +3188,58 @@
mInScrollArea = false;
}
- public Folder getFolderForTag(Object tag) {
- final int screenCount = getChildCount();
+ /**
+ * Returns a specific CellLayout
+ */
+ CellLayout getParentCellLayoutForView(View v) {
+ ArrayList<CellLayout> layouts = getWorkspaceAndHotseatCellLayouts();
+ for (CellLayout layout : layouts) {
+ if (layout.getChildrenLayout().indexOfChild(v) > -1) {
+ return layout;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns a list of all the CellLayouts in the workspace.
+ */
+ ArrayList<CellLayout> getWorkspaceAndHotseatCellLayouts() {
+ ArrayList<CellLayout> layouts = new ArrayList<CellLayout>();
+ int screenCount = getChildCount();
for (int screen = 0; screen < screenCount; screen++) {
- ViewGroup currentScreen = ((CellLayout) getChildAt(screen)).getChildrenLayout();
- int count = currentScreen.getChildCount();
+ layouts.add(((CellLayout) getChildAt(screen)));
+ }
+ if (mLauncher.getHotseat() != null) {
+ layouts.add(mLauncher.getHotseat().getLayout());
+ }
+ return layouts;
+ }
+
+ /**
+ * We should only use this to search for specific children. Do not use this method to modify
+ * CellLayoutChildren directly.
+ */
+ ArrayList<CellLayoutChildren> getWorkspaceAndHotseatCellLayoutChildren() {
+ ArrayList<CellLayoutChildren> childrenLayouts = new ArrayList<CellLayoutChildren>();
+ int screenCount = getChildCount();
+ for (int screen = 0; screen < screenCount; screen++) {
+ childrenLayouts.add(((CellLayout) getChildAt(screen)).getChildrenLayout());
+ }
+ if (mLauncher.getHotseat() != null) {
+ childrenLayouts.add(mLauncher.getHotseat().getLayout().getChildrenLayout());
+ }
+ return childrenLayouts;
+ }
+
+ public Folder getFolderForTag(Object tag) {
+ ArrayList<CellLayoutChildren> childrenLayouts = getWorkspaceAndHotseatCellLayoutChildren();
+ for (CellLayoutChildren layout: childrenLayouts) {
+ int count = layout.getChildCount();
for (int i = 0; i < count; i++) {
- View child = currentScreen.getChildAt(i);
+ View child = layout.getChildAt(i);
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
- if (lp.cellHSpan == 4 && lp.cellVSpan == 4 && child instanceof Folder) {
+ if (child instanceof Folder) {
Folder f = (Folder) child;
if (f.getInfo() == tag && f.getInfo().opened) {
return f;
@@ -3145,12 +3251,11 @@
}
public View getViewForTag(Object tag) {
- int screenCount = getChildCount();
- for (int screen = 0; screen < screenCount; screen++) {
- ViewGroup currentScreen = ((CellLayout) getChildAt(screen)).getChildrenLayout();
- int count = currentScreen.getChildCount();
+ ArrayList<CellLayoutChildren> childrenLayouts = getWorkspaceAndHotseatCellLayoutChildren();
+ for (CellLayoutChildren layout: childrenLayouts) {
+ int count = layout.getChildCount();
for (int i = 0; i < count; i++) {
- View child = currentScreen.getChildAt(i);
+ View child = layout.getChildAt(i);
if (child.getTag() == tag) {
return child;
}
@@ -3160,11 +3265,8 @@
}
void clearDropTargets() {
- final int screenCount = getChildCount();
-
- for (int i = 0; i < screenCount; i++) {
- final CellLayout layoutParent = (CellLayout) getChildAt(i);
- final ViewGroup layout = layoutParent.getChildrenLayout();
+ ArrayList<CellLayoutChildren> childrenLayouts = getWorkspaceAndHotseatCellLayoutChildren();
+ for (CellLayoutChildren layout: childrenLayouts) {
int childCount = layout.getChildCount();
for (int j = 0; j < childCount; j++) {
View v = layout.getChildAt(j);
@@ -3185,8 +3287,8 @@
packageNames.add(apps.get(i).componentName.getPackageName());
}
- for (int i = 0; i < screenCount; i++) {
- final CellLayout layoutParent = (CellLayout) getChildAt(i);
+ ArrayList<CellLayout> cellLayouts = getWorkspaceAndHotseatCellLayouts();
+ for (final CellLayout layoutParent: cellLayouts) {
final ViewGroup layout = layoutParent.getChildrenLayout();
// Avoid ANRs by treating each screen separately
@@ -3273,9 +3375,8 @@
}
void updateShortcuts(ArrayList<ApplicationInfo> apps) {
- final int screenCount = getChildCount();
- for (int i = 0; i < screenCount; i++) {
- final ViewGroup layout = ((CellLayout) getChildAt(i)).getChildrenLayout();
+ ArrayList<CellLayoutChildren> childrenLayouts = getWorkspaceAndHotseatCellLayoutChildren();
+ for (CellLayoutChildren layout: childrenLayouts) {
int childCount = layout.getChildCount();
for (int j = 0; j < childCount; j++) {
final View view = layout.getChildAt(j);
@@ -3307,7 +3408,7 @@
void moveToDefaultScreen(boolean animate) {
if (isSmall() || mIsSwitchingState) {
- mLauncher.showWorkspace(animate, (CellLayout)getChildAt(mDefaultPage));
+ mLauncher.showWorkspace(animate, (CellLayout) getChildAt(mDefaultPage));
} else if (animate) {
snapToPage(mDefaultPage);
} else {
@@ -3334,4 +3435,11 @@
public void getLocationInDragLayer(int[] loc) {
mLauncher.getDragLayer().getLocationInDragLayer(this, loc);
}
+
+ /**
+ * Return true because we want the scrolling indicator to stretch to fit the space.
+ */
+ protected boolean hasElasticScrollIndicator() {
+ return true;
+ }
}