summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/bg_cling1.pngbin0 -> 659 bytes
-rw-r--r--res/drawable-hdpi/bg_cling2.pngbin0 -> 638 bytes
-rw-r--r--res/drawable-hdpi/bg_cling3.pngbin0 -> 769 bytes
-rw-r--r--res/drawable-hdpi/btn_cling_normal.9.pngbin0 -> 333 bytes
-rw-r--r--res/drawable-hdpi/btn_cling_pressed.9.pngbin0 -> 467 bytes
-rw-r--r--res/drawable-hdpi/hand.pngbin0 -> 17399 bytes
-rw-r--r--res/drawable-hdpi/hotseat_bg_panel.9.pngbin223 -> 213 bytes
-rw-r--r--res/drawable-hdpi/search_bg_panel.9.pngbin224 -> 219 bytes
-rw-r--r--res/drawable-land-hdpi/hotseat_bg_panel.9.pngbin184 -> 171 bytes
-rw-r--r--res/drawable-land-hdpi/search_bg_panel.9.pngbin185 -> 178 bytes
-rw-r--r--res/drawable-land-mdpi/hotseat_bg_panel.9.pngbin172 -> 167 bytes
-rw-r--r--res/drawable-land-mdpi/search_bg_panel.9.pngbin171 -> 170 bytes
-rw-r--r--res/drawable-land-xhdpi/hotseat_bg_panel.9.pngbin198 -> 190 bytes
-rw-r--r--res/drawable-land-xhdpi/search_bg_panel.9.pngbin198 -> 189 bytes
-rw-r--r--res/drawable-mdpi/bg_cling1.pngbin0 -> 535 bytes
-rw-r--r--res/drawable-mdpi/bg_cling2.pngbin0 -> 517 bytes
-rw-r--r--res/drawable-mdpi/bg_cling3.pngbin0 -> 617 bytes
-rw-r--r--res/drawable-mdpi/btn_cling_normal.9.pngbin0 -> 245 bytes
-rw-r--r--res/drawable-mdpi/btn_cling_pressed.9.pngbin0 -> 370 bytes
-rw-r--r--res/drawable-mdpi/hand.pngbin0 -> 10128 bytes
-rw-r--r--res/drawable-mdpi/hotseat_bg_panel.9.pngbin194 -> 197 bytes
-rw-r--r--res/drawable-mdpi/search_bg_panel.9.pngbin185 -> 196 bytes
-rw-r--r--res/drawable-xhdpi/bg_cling1.pngbin0 -> 955 bytes
-rw-r--r--res/drawable-xhdpi/bg_cling2.pngbin0 -> 949 bytes
-rw-r--r--res/drawable-xhdpi/bg_cling3.pngbin0 -> 1059 bytes
-rw-r--r--res/drawable-xhdpi/btn_cling_normal.9.pngbin0 -> 400 bytes
-rw-r--r--res/drawable-xhdpi/btn_cling_pressed.9.pngbin0 -> 601 bytes
-rw-r--r--res/drawable-xhdpi/hand.pngbin0 -> 27249 bytes
-rw-r--r--res/drawable-xhdpi/hotseat_bg_panel.9.pngbin256 -> 251 bytes
-rw-r--r--res/drawable-xhdpi/search_bg_panel.9.pngbin250 -> 255 bytes
-rw-r--r--res/drawable/cling_button_bg.xml4
-rw-r--r--res/layout-land/all_apps_cling.xml44
-rw-r--r--res/layout-land/folder_cling.xml57
-rw-r--r--res/layout-land/launcher.xml6
-rw-r--r--res/layout-land/workspace_cling.xml60
-rw-r--r--res/layout-port/all_apps_cling.xml35
-rw-r--r--res/layout-port/folder_cling.xml58
-rw-r--r--res/layout-port/launcher.xml6
-rw-r--r--res/layout-port/workspace_cling.xml56
-rw-r--r--res/layout/apps_customize_pane.xml2
-rw-r--r--res/values-land/dimens.xml2
-rw-r--r--res/values-port/dimens.xml2
-rw-r--r--res/values/attrs.xml4
-rw-r--r--res/values/colors.xml3
-rw-r--r--res/values/strings.xml19
-rw-r--r--res/values/styles.xml13
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java17
-rw-r--r--src/com/android/launcher2/AppsCustomizeTabHost.java13
-rw-r--r--src/com/android/launcher2/Cling.java296
-rw-r--r--src/com/android/launcher2/DragLayer.java2
-rw-r--r--src/com/android/launcher2/Folder.java2
-rw-r--r--src/com/android/launcher2/Launcher.java132
-rw-r--r--src/com/android/launcher2/PagedView.java4
-rw-r--r--src/com/android/launcher2/PagedViewCellLayout.java8
54 files changed, 513 insertions, 332 deletions
diff --git a/res/drawable-hdpi/bg_cling1.png b/res/drawable-hdpi/bg_cling1.png
new file mode 100644
index 000000000..0e1553299
--- /dev/null
+++ b/res/drawable-hdpi/bg_cling1.png
Binary files differ
diff --git a/res/drawable-hdpi/bg_cling2.png b/res/drawable-hdpi/bg_cling2.png
new file mode 100644
index 000000000..e65d9a21c
--- /dev/null
+++ b/res/drawable-hdpi/bg_cling2.png
Binary files differ
diff --git a/res/drawable-hdpi/bg_cling3.png b/res/drawable-hdpi/bg_cling3.png
new file mode 100644
index 000000000..ea71fbdb3
--- /dev/null
+++ b/res/drawable-hdpi/bg_cling3.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_cling_normal.9.png b/res/drawable-hdpi/btn_cling_normal.9.png
new file mode 100644
index 000000000..aea8beb3e
--- /dev/null
+++ b/res/drawable-hdpi/btn_cling_normal.9.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_cling_pressed.9.png b/res/drawable-hdpi/btn_cling_pressed.9.png
new file mode 100644
index 000000000..ebefd20ad
--- /dev/null
+++ b/res/drawable-hdpi/btn_cling_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi/hand.png b/res/drawable-hdpi/hand.png
new file mode 100644
index 000000000..4a73f2ba7
--- /dev/null
+++ b/res/drawable-hdpi/hand.png
Binary files differ
diff --git a/res/drawable-hdpi/hotseat_bg_panel.9.png b/res/drawable-hdpi/hotseat_bg_panel.9.png
index 955b0e830..3c25e0e81 100644
--- a/res/drawable-hdpi/hotseat_bg_panel.9.png
+++ b/res/drawable-hdpi/hotseat_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-hdpi/search_bg_panel.9.png b/res/drawable-hdpi/search_bg_panel.9.png
index af5066f04..c868b2fc9 100644
--- a/res/drawable-hdpi/search_bg_panel.9.png
+++ b/res/drawable-hdpi/search_bg_panel.9.png
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
index 318234f64..90177f850 100644
--- a/res/drawable-land-hdpi/hotseat_bg_panel.9.png
+++ b/res/drawable-land-hdpi/hotseat_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-land-hdpi/search_bg_panel.9.png b/res/drawable-land-hdpi/search_bg_panel.9.png
index f574e27a9..3642ea54f 100644
--- a/res/drawable-land-hdpi/search_bg_panel.9.png
+++ b/res/drawable-land-hdpi/search_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
index 3dbb38610..83c4a552b 100644
--- a/res/drawable-land-mdpi/hotseat_bg_panel.9.png
+++ b/res/drawable-land-mdpi/hotseat_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-land-mdpi/search_bg_panel.9.png b/res/drawable-land-mdpi/search_bg_panel.9.png
index e6da3097e..ce3a7e457 100644
--- a/res/drawable-land-mdpi/search_bg_panel.9.png
+++ b/res/drawable-land-mdpi/search_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-land-xhdpi/hotseat_bg_panel.9.png b/res/drawable-land-xhdpi/hotseat_bg_panel.9.png
index 5824aa500..8718040c1 100644
--- a/res/drawable-land-xhdpi/hotseat_bg_panel.9.png
+++ b/res/drawable-land-xhdpi/hotseat_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-land-xhdpi/search_bg_panel.9.png b/res/drawable-land-xhdpi/search_bg_panel.9.png
index fdda3cf0d..ca2b3652d 100644
--- a/res/drawable-land-xhdpi/search_bg_panel.9.png
+++ b/res/drawable-land-xhdpi/search_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-mdpi/bg_cling1.png b/res/drawable-mdpi/bg_cling1.png
new file mode 100644
index 000000000..f284412a7
--- /dev/null
+++ b/res/drawable-mdpi/bg_cling1.png
Binary files differ
diff --git a/res/drawable-mdpi/bg_cling2.png b/res/drawable-mdpi/bg_cling2.png
new file mode 100644
index 000000000..0052dc29d
--- /dev/null
+++ b/res/drawable-mdpi/bg_cling2.png
Binary files differ
diff --git a/res/drawable-mdpi/bg_cling3.png b/res/drawable-mdpi/bg_cling3.png
new file mode 100644
index 000000000..fabdf7a0d
--- /dev/null
+++ b/res/drawable-mdpi/bg_cling3.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_cling_normal.9.png b/res/drawable-mdpi/btn_cling_normal.9.png
new file mode 100644
index 000000000..43a407e03
--- /dev/null
+++ b/res/drawable-mdpi/btn_cling_normal.9.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_cling_pressed.9.png b/res/drawable-mdpi/btn_cling_pressed.9.png
new file mode 100644
index 000000000..bf0c8cbb4
--- /dev/null
+++ b/res/drawable-mdpi/btn_cling_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi/hand.png b/res/drawable-mdpi/hand.png
new file mode 100644
index 000000000..eb280e328
--- /dev/null
+++ b/res/drawable-mdpi/hand.png
Binary files differ
diff --git a/res/drawable-mdpi/hotseat_bg_panel.9.png b/res/drawable-mdpi/hotseat_bg_panel.9.png
index 7c31ee2c8..338db2c61 100644
--- a/res/drawable-mdpi/hotseat_bg_panel.9.png
+++ b/res/drawable-mdpi/hotseat_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-mdpi/search_bg_panel.9.png b/res/drawable-mdpi/search_bg_panel.9.png
index 277d2ce7b..81f01ceba 100644
--- a/res/drawable-mdpi/search_bg_panel.9.png
+++ b/res/drawable-mdpi/search_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/bg_cling1.png b/res/drawable-xhdpi/bg_cling1.png
new file mode 100644
index 000000000..b71351a32
--- /dev/null
+++ b/res/drawable-xhdpi/bg_cling1.png
Binary files differ
diff --git a/res/drawable-xhdpi/bg_cling2.png b/res/drawable-xhdpi/bg_cling2.png
new file mode 100644
index 000000000..ad78dfeb0
--- /dev/null
+++ b/res/drawable-xhdpi/bg_cling2.png
Binary files differ
diff --git a/res/drawable-xhdpi/bg_cling3.png b/res/drawable-xhdpi/bg_cling3.png
new file mode 100644
index 000000000..ae04195c4
--- /dev/null
+++ b/res/drawable-xhdpi/bg_cling3.png
Binary files differ
diff --git a/res/drawable-xhdpi/btn_cling_normal.9.png b/res/drawable-xhdpi/btn_cling_normal.9.png
new file mode 100644
index 000000000..35511d6f9
--- /dev/null
+++ b/res/drawable-xhdpi/btn_cling_normal.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/btn_cling_pressed.9.png b/res/drawable-xhdpi/btn_cling_pressed.9.png
new file mode 100644
index 000000000..a38b40fa9
--- /dev/null
+++ b/res/drawable-xhdpi/btn_cling_pressed.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/hand.png b/res/drawable-xhdpi/hand.png
new file mode 100644
index 000000000..aaaad3792
--- /dev/null
+++ b/res/drawable-xhdpi/hand.png
Binary files differ
diff --git a/res/drawable-xhdpi/hotseat_bg_panel.9.png b/res/drawable-xhdpi/hotseat_bg_panel.9.png
index 570d929c2..cc3d0bc47 100644
--- a/res/drawable-xhdpi/hotseat_bg_panel.9.png
+++ b/res/drawable-xhdpi/hotseat_bg_panel.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/search_bg_panel.9.png b/res/drawable-xhdpi/search_bg_panel.9.png
index 5f007c973..3cd534f95 100644
--- a/res/drawable-xhdpi/search_bg_panel.9.png
+++ b/res/drawable-xhdpi/search_bg_panel.9.png
Binary files differ
diff --git a/res/drawable/cling_button_bg.xml b/res/drawable/cling_button_bg.xml
index 791250b7d..3809cdecb 100644
--- a/res/drawable/cling_button_bg.xml
+++ b/res/drawable/cling_button_bg.xml
@@ -15,6 +15,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@color/cling_button_pressed" />
- <item android:drawable="@color/cling_button" />
+ <item android:state_pressed="true" android:drawable="@drawable/btn_cling_pressed" />
+ <item android:drawable="@drawable/btn_cling_normal" />
</selector>
diff --git a/res/layout-land/all_apps_cling.xml b/res/layout-land/all_apps_cling.xml
index 95d88b00c..e89d4c178 100644
--- a/res/layout-land/all_apps_cling.xml
+++ b/res/layout-land/all_apps_cling.xml
@@ -16,29 +16,33 @@
<com.android.launcher2.Cling
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- launcher:drawIdentifier="all_apps_landscape"
- android:background="#CA000000">
+ launcher:drawIdentifier="all_apps_landscape">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginLeft="20dp"
- android:layout_marginTop="50dp">
- <TextView
- style="@style/ClingTitleText"
- android:id="@+id/all_apps_cling_title"
- android:layout_marginTop="0dp"
- android:text="@string/all_apps_cling_title" />
- <TextView
- style="@style/ClingText"
- android:id="@+id/all_apps_cling_add_item"
- android:layout_width="280dp"
+ android:layout_marginLeft="40dp"
+ android:layout_marginTop="40dp">
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="45dp"
- android:text="@string/all_apps_cling_add_item" />
- <Button
- style="@style/ClingButton"
- android:id="@+id/cling_dismiss"
- android:layout_marginTop="100dp"
- android:onClick="dismissAllAppsCling" />
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/all_apps_cling_title"
+ android:text="@string/all_apps_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/all_apps_cling_add_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/all_apps_cling_add_item" />
+ </LinearLayout>
</FrameLayout>
+ <Button
+ style="@style/ClingButton"
+ android:id="@+id/cling_dismiss"
+ android:layout_marginBottom="15dp"
+ android:layout_marginRight="10dp"
+ android:layout_gravity="bottom|right"
+ android:onClick="dismissAllAppsCling" />
</com.android.launcher2.Cling>
diff --git a/res/layout-land/folder_cling.xml b/res/layout-land/folder_cling.xml
new file mode 100644
index 000000000..91d34ad03
--- /dev/null
+++ b/res/layout-land/folder_cling.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.android.launcher2.Cling
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ launcher:drawIdentifier="folder_landscape">
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="40dp"
+ android:layout_marginTop="40dp">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/folder_cling_title"
+ android:text="@string/folder_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/folder_cling_move_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/folder_cling_move_item" />
+ </LinearLayout>
+ </FrameLayout>
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/folder_cling_create_folder"
+ android:layout_width="340dp"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="40dp"
+ android:layout_marginBottom="40dp"
+ android:layout_gravity="bottom"
+ android:text="@string/folder_cling_create_folder" />
+ <Button
+ style="@style/ClingButton"
+ android:id="@+id/cling_dismiss"
+ android:layout_marginBottom="15dp"
+ android:layout_marginRight="10dp"
+ android:layout_gravity="bottom|right"
+ android:onClick="dismissFolderCling" />
+</com.android.launcher2.Cling>
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 2b25bbb70..084b1636a 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -87,4 +87,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
+
+ <include layout="@layout/folder_cling"
+ android:id="@+id/folder_cling"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone" />
</com.android.launcher2.DragLayer>
diff --git a/res/layout-land/workspace_cling.xml b/res/layout-land/workspace_cling.xml
index fa8550760..dca393727 100644
--- a/res/layout-land/workspace_cling.xml
+++ b/res/layout-land/workspace_cling.xml
@@ -16,36 +16,42 @@
<com.android.launcher2.Cling
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- launcher:drawIdentifier="workspace_landscape"
- android:background="#AA000000">
+ launcher:drawIdentifier="workspace_landscape">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginLeft="20dp"
- android:layout_marginTop="20dp">
- <TextView
- style="@style/ClingTitleText"
- android:id="@+id/workspace_cling_title"
- android:layout_marginTop="0dp"
- android:text="@string/workspace_cling_title" />
- <TextView
- style="@style/ClingText"
- android:id="@+id/workspace_cling_move_item"
- android:layout_width="285dp"
+ android:layout_marginLeft="40dp"
+ android:layout_marginTop="40dp">
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="50dp"
- android:text="@string/workspace_cling_move_item" />
- <TextView
- style="@style/ClingText"
- android:id="@+id/workspace_cling_open_all_apps"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:layout_marginTop="100dp"
- android:text="@string/workspace_cling_open_all_apps" />
- <Button
- style="@style/ClingButton"
- android:id="@+id/cling_dismiss"
- android:layout_marginTop="160dp"
- android:onClick="dismissWorkspaceCling" />
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/workspace_cling_title"
+ android:text="@string/workspace_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/workspace_cling_move_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/workspace_cling_move_item" />
+ </LinearLayout>
</FrameLayout>
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/workspace_cling_open_all_apps"
+ android:layout_width="180dp"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="130dp"
+ android:layout_gravity="right|center_vertical"
+ android:gravity="right"
+ android:text="@string/workspace_cling_open_all_apps" />
+ <Button
+ style="@style/ClingButton"
+ android:id="@+id/cling_dismiss"
+ android:layout_marginBottom="15dp"
+ android:layout_marginRight="10dp"
+ android:layout_gravity="bottom|right"
+ android:onClick="dismissWorkspaceCling" />
</com.android.launcher2.Cling> \ No newline at end of file
diff --git a/res/layout-port/all_apps_cling.xml b/res/layout-port/all_apps_cling.xml
index cd702ed1a..e0dcf8165 100644
--- a/res/layout-port/all_apps_cling.xml
+++ b/res/layout-port/all_apps_cling.xml
@@ -16,30 +16,33 @@
<com.android.launcher2.Cling
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- launcher:drawIdentifier="all_apps_portrait"
- android:background="#CA000000">
+ launcher:drawIdentifier="all_apps_portrait">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
- android:layout_marginTop="50dp">
- <TextView
- style="@style/ClingTitleText"
- android:id="@+id/all_apps_cling_title"
- android:layout_marginTop="0dp"
- android:text="@string/all_apps_cling_title" />
- <TextView
- style="@style/ClingText"
- android:id="@+id/all_apps_cling_add_item"
- android:layout_width="280dp"
+ android:layout_marginTop="90dp">
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="45dp"
- android:text="@string/all_apps_cling_add_item" />
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/all_apps_cling_title"
+ android:text="@string/all_apps_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/all_apps_cling_add_item"
+ android:layout_width="285dp"
+ android:layout_height="wrap_content"
+ android:text="@string/all_apps_cling_add_item" />
+ </LinearLayout>
</FrameLayout>
<Button
style="@style/ClingButton"
android:id="@+id/cling_dismiss"
- android:layout_marginBottom="40dp"
- android:layout_gravity="center_horizontal|bottom"
+ android:layout_marginBottom="15dp"
+ android:layout_marginRight="10dp"
+ android:layout_gravity="bottom|right"
android:onClick="dismissAllAppsCling" />
</com.android.launcher2.Cling>
diff --git a/res/layout-port/folder_cling.xml b/res/layout-port/folder_cling.xml
new file mode 100644
index 000000000..d2374bf61
--- /dev/null
+++ b/res/layout-port/folder_cling.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.android.launcher2.Cling
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ launcher:drawIdentifier="folder_portrait">
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="20dp"
+ android:layout_marginTop="100dp">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/folder_cling_title"
+ android:text="@string/folder_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/folder_cling_move_item"
+ android:layout_width="285dp"
+ android:layout_height="wrap_content"
+ android:text="@string/folder_cling_move_item" />
+ </LinearLayout>
+ </FrameLayout>
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/folder_cling_create_folder"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="20dp"
+ android:layout_marginBottom="65dp"
+ android:layout_gravity="bottom"
+ android:text="@string/folder_cling_create_folder" />
+ <Button
+ style="@style/ClingButton"
+ android:id="@+id/cling_dismiss"
+ android:layout_marginBottom="15dp"
+ android:layout_marginRight="10dp"
+ android:layout_gravity="bottom|right"
+ android:onClick="dismissFolderCling" />
+</com.android.launcher2.Cling>
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index 963770076..061d8e39b 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -81,4 +81,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
+
+ <include layout="@layout/folder_cling"
+ android:id="@+id/folder_cling"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone" />
</com.android.launcher2.DragLayer>
diff --git a/res/layout-port/workspace_cling.xml b/res/layout-port/workspace_cling.xml
index 8c4a0b3b0..d5aff8af8 100644
--- a/res/layout-port/workspace_cling.xml
+++ b/res/layout-port/workspace_cling.xml
@@ -16,36 +16,42 @@
<com.android.launcher2.Cling
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- launcher:drawIdentifier="workspace_portrait"
- android:background="#AA000000">
+ launcher:drawIdentifier="workspace_portrait">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginTop="90dp">
- <TextView
- style="@style/ClingTitleText"
- android:id="@+id/workspace_cling_title"
- android:layout_marginTop="0dp"
- android:text="@string/workspace_cling_title" />
- <TextView
- style="@style/ClingText"
- android:id="@+id/workspace_cling_move_item"
- android:layout_width="285dp"
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="50dp"
- android:text="@string/workspace_cling_move_item" />
- <TextView
- style="@style/ClingText"
- android:id="@+id/workspace_cling_open_all_apps"
- android:layout_width="200dp"
- android:layout_height="wrap_content"
- android:layout_marginTop="100dp"
- android:text="@string/workspace_cling_open_all_apps" />
- <Button
- style="@style/ClingButton"
- android:id="@+id/cling_dismiss"
- android:layout_marginTop="160dp"
- android:onClick="dismissWorkspaceCling" />
+ android:orientation="vertical">
+ <TextView
+ style="@style/ClingTitleText"
+ android:id="@+id/workspace_cling_title"
+ android:text="@string/workspace_cling_title" />
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/workspace_cling_move_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/workspace_cling_move_item" />
+ </LinearLayout>
</FrameLayout>
+ <TextView
+ style="@style/ClingText"
+ android:id="@+id/workspace_cling_open_all_apps"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="130dp"
+ android:layout_gravity="bottom"
+ android:gravity="center"
+ android:text="@string/workspace_cling_open_all_apps" />
+ <Button
+ style="@style/ClingButton"
+ android:id="@+id/cling_dismiss"
+ android:layout_marginBottom="15dp"
+ android:layout_marginRight="10dp"
+ android:layout_gravity="bottom|right"
+ android:onClick="dismissWorkspaceCling" />
</com.android.launcher2.Cling> \ No newline at end of file
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index 75b0e7ba8..27f2efea6 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -62,6 +62,8 @@
launcher:widgetCellHeightGap="@dimen/apps_customize_widget_cell_height_gap"
launcher:widgetCountX="@integer/apps_customize_widget_cell_count_x"
launcher:widgetCountY="@integer/apps_customize_widget_cell_count_y"
+ launcher:clingFocusedX="@integer/apps_customize_cling_focused_x"
+ launcher:clingFocusedY="@integer/apps_customize_cling_focused_y"
launcher:maxGap="@dimen/workspace_max_gap" />
<ImageView
android:id="@+id/animation_buffer"
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 52c52f18b..353265003 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -64,6 +64,8 @@
<dimen name="apps_customize_widget_cell_height_gap">5dp</dimen>
<integer name="apps_customize_widget_cell_count_x">3</integer>
<integer name="apps_customize_widget_cell_count_y">2</integer>
+ <integer name="apps_customize_cling_focused_x">2</integer>
+ <integer name="apps_customize_cling_focused_y">1</integer>
<!-- Folders -->
<!-- The size of the image which sits behind the preview of the folder contents -->
diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml
index 5632fcd3e..1c8282d33 100644
--- a/res/values-port/dimens.xml
+++ b/res/values-port/dimens.xml
@@ -32,6 +32,8 @@
<dimen name="apps_customize_pageLayoutPaddingBottom">10dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingLeft">5dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingRight">5dp</dimen>
+ <integer name="apps_customize_cling_focused_x">1</integer>
+ <integer name="apps_customize_cling_focused_y">2</integer>
<dimen name="apps_customize_widget_cell_width_gap">20dp</dimen>
<dimen name="apps_customize_widget_cell_height_gap">10dp</dimen>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 6c0bc1467..800aeaa5c 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -131,6 +131,10 @@
<attr name="widgetCountX" format="integer" />
<!-- Number of widgets vertically -->
<attr name="widgetCountY" format="integer" />
+ <!-- The x index of the item to be focused in the cling -->
+ <attr name="clingFocusedX" format="integer" />
+ <!-- The y index of the item to be focused in the cling -->
+ <attr name="clingFocusedY" format="integer" />
</declare-styleable>
<!-- HandleView specific attributes. These attributes are used to customize
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 2389f8e4f..ece0fd895 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -32,7 +32,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="cling_button">#BA49C0EC</color>
- <color name="cling_button_pressed">#FF49C0EC</color>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 78c4b2952..2ade5c8e6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -234,16 +234,21 @@ s -->
<!-- Clings -->
<!-- The title text for the workspace cling [CHAR_LIMIT=none] -->
- <string name="workspace_cling_title">Welcome Home!</string>
- <!-- The description of how to pick up and move an item on the workspace [CHAR_LIMIT=none] -->
- <string name="workspace_cling_move_item">To move an app or widget, touch &amp; hold, then reposition it.</string>
+ <string name="workspace_cling_title">Make yourself at home</string>
+ <!-- The description of how to use the workspace [CHAR_LIMIT=none] -->
+ <string name="workspace_cling_move_item">You can put your favourite apps here.</string>
<!-- The description of how to open all apps from the workspace [CHAR_LIMIT=none] -->
- <string name="workspace_cling_open_all_apps">To see all your apps, touch the All Apps button.</string>
+ <string name="workspace_cling_open_all_apps">To see all your apps, touch the circle.</string>
<!-- The title text for the All Apps cling [CHAR_LIMIT=none] -->
- <string name="all_apps_cling_title">Here are all your apps</string>
+ <string name="all_apps_cling_title">Choose some apps</string>
<!-- The description of how to pick up and add an item to the workspace [CHAR_LIMIT=none] -->
- <string name="all_apps_cling_add_item">To add an app or widget to your home screen, touch &amp; hold, then position it.</string>
-
+ <string name="all_apps_cling_add_item">To add an app to your home screen, touch &amp; hold it.</string>
+ <!-- The title text for the Folder cling [CHAR_LIMIT=none] -->
+ <string name="folder_cling_title">Organize your apps with folders</string>
+ <!-- The description of how to move an app [CHAR_LIMIT=none] -->
+ <string name="folder_cling_move_item">To move an app, touch &amp; hold it.</string>
+ <!-- The description of how to create a folder [CHAR_LIMIT=none] -->
+ <string name="folder_cling_create_folder">To make a new folder on your home screen, stack one app on top of another.</string>
<!-- The text on the button to dismiss a cling [CHAR_LIMIT=none] -->
<string name="cling_dismiss">OK</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 9372dbeef..19a05a0a1 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -28,10 +28,10 @@
<style name="ClingButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
- <item name="android:paddingTop">14dp</item>
- <item name="android:paddingBottom">14dp</item>
- <item name="android:paddingLeft">58dp</item>
- <item name="android:paddingRight">58dp</item>
+ <item name="android:paddingTop">10dp</item>
+ <item name="android:paddingBottom">15dp</item>
+ <item name="android:paddingLeft">35dp</item>
+ <item name="android:paddingRight">35dp</item>
<item name="android:text">@string/cling_dismiss</item>
<item name="android:textStyle">bold</item>
<item name="android:background">@drawable/cling_button_bg</item>
@@ -39,7 +39,8 @@
<style name="ClingTitleText">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
- <item name="android:textSize">28sp</item>
+ <item name="android:layout_marginBottom">5dp</item>
+ <item name="android:textSize">23sp</item>
<item name="android:textColor">#49C0EC</item>
<item name="android:shadowColor">#000000</item>
<item name="android:shadowDy">2</item>
@@ -145,7 +146,7 @@
<item name="android:paddingRight">25dp</item>
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:textSize">16sp</item>
- <item name="android:shadowColor">#DD000000</item>
+ <item name="android:shadowColor">#FF000000</item>
<item name="android:shadowDx">0.0</item>
<item name="android:shadowDy">1.0</item>
<item name="android:shadowRadius">4.0</item>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index b208e884f..96859d371 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -174,6 +174,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
private ArrayList<ApplicationInfo> mApps;
private ArrayList<Object> mWidgets;
+ // Cling
+ private int mClingFocusedX;
+ private int mClingFocusedY;
+
// Caching
private Canvas mCanvas;
private Drawable mDefaultWidgetBackground;
@@ -234,6 +238,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
a.getDimensionPixelSize(R.styleable.AppsCustomizePagedView_widgetCellHeightGap, 0);
mWidgetCountX = a.getInt(R.styleable.AppsCustomizePagedView_widgetCountX, 2);
mWidgetCountY = a.getInt(R.styleable.AppsCustomizePagedView_widgetCountY, 2);
+ mClingFocusedX = a.getInt(R.styleable.AppsCustomizePagedView_clingFocusedX, 0);
+ mClingFocusedY = a.getInt(R.styleable.AppsCustomizePagedView_clingFocusedY, 0);
a.recycle();
mWidgetSpacingLayout = new PagedViewCellLayout(getContext());
@@ -375,6 +381,14 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mContentWidth = mWidgetSpacingLayout.getContentWidth();
invalidatePageData(Math.max(0, mRestorePage));
mRestorePage = -1;
+
+ int[] offset = new int[2];
+ int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY);
+ mLauncher.getDragLayer().getLocationInDragLayer(this, offset);
+ pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 + offset[0];
+ pos[1] += (getMeasuredHeight() - mWidgetSpacingLayout.getMeasuredHeight()) / 2 + offset[1];
+ mLauncher.showFirstRunAllAppsCling(pos);
+
}
@Override
@@ -533,6 +547,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
@Override
protected boolean beginDragging(View v) {
+ // Dismiss the cling
+ mLauncher.dismissAllAppsCling(null);
+
if (!super.beginDragging(v)) return false;
// Go into spring loaded mode (must happen before we startDrag())
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 124cf7332..8b7b95612 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -271,7 +271,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
/* LauncherTransitionable overrides */
@Override
- public void onLauncherTransitionStart(Animator animation, boolean toWorkspace) {
+ public void onLauncherTransitionStart(Launcher l, Animator animation, boolean toWorkspace) {
mInTransition = true;
// isHardwareAccelerated() checks if we're attached to a window and if that
// window is HW accelerated-- we were sometimes not attached to a window
@@ -294,14 +294,19 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
}
@Override
- public void onLauncherTransitionEnd(Animator animation, boolean toWorkspace) {
+ public void onLauncherTransitionEnd(Launcher l, Animator animation, boolean toWorkspace) {
mInTransition = false;
if (animation != null) {
setLayerType(LAYER_TYPE_NONE, null);
}
- if (!toWorkspace && !LauncherApplication.isScreenLarge()) {
- mAppsCustomizePane.hideScrollingIndicator(false);
+ if (!toWorkspace) {
+ // Dismiss the cling if necessary
+ l.dismissWorkspaceCling(null);
+
+ if (!LauncherApplication.isScreenLarge()) {
+ mAppsCustomizePane.hideScrollingIndicator(false);
+ }
}
}
diff --git a/src/com/android/launcher2/Cling.java b/src/com/android/launcher2/Cling.java
index ae8dd4319..4f37cb9e0 100644
--- a/src/com/android/launcher2/Cling.java
+++ b/src/com/android/launcher2/Cling.java
@@ -19,9 +19,12 @@ package com.android.launcher2;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
-import android.graphics.Point;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffXfermode;
+import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
@@ -32,23 +35,36 @@ import com.android.launcher.R;
public class Cling extends FrameLayout {
+ static final String WORKSPACE_CLING_DISMISSED_KEY = "cling.workspace.dismissed";
+ static final String ALLAPPS_CLING_DISMISSED_KEY = "cling.allapps.dismissed";
+ static final String FOLDER_CLING_DISMISSED_KEY = "cling.folder.dismissed";
+
private static String WORKSPACE_PORTRAIT = "workspace_portrait";
private static String WORKSPACE_LANDSCAPE = "workspace_landscape";
private static String ALLAPPS_PORTRAIT = "all_apps_portrait";
private static String ALLAPPS_LANDSCAPE = "all_apps_landscape";
+ private static String FOLDER_PORTRAIT = "folder_portrait";
+ private static String FOLDER_LANDSCAPE = "folder_landscape";
private Launcher mLauncher;
private boolean mIsInitialized;
private String mDrawIdentifier;
+ private Drawable mBackground;
private Drawable mPunchThroughGraphic;
+ private Drawable mHandTouchGraphic;
private int mPunchThroughGraphicCenterRadius;
private int mAppIconSize;
private int mTabBarHeight;
private int mTabBarHorizontalPadding;
+ private int mButtonBarHeight;
+ private float mRevealRadius;
+ private int[] mPositionData;
+
+ private Paint mErasePaint;
- View mWorkspaceDesc1;
- View mWorkspaceDesc2;
- View mAllAppsDesc;
+ private View mWorkspaceDesc1;
+ private View mWorkspaceDesc2;
+ private View mAllAppsDesc;
public Cling(Context context) {
this(context, null, 0);
@@ -66,238 +82,148 @@ public class Cling extends FrameLayout {
a.recycle();
}
- void init(Launcher l) {
+ void init(Launcher l, int[] positionData) {
if (!mIsInitialized) {
mLauncher = l;
+ mPositionData = positionData;
Resources r = getContext().getResources();
mPunchThroughGraphic = r.getDrawable(R.drawable.cling);
mPunchThroughGraphicCenterRadius =
r.getDimensionPixelSize(R.dimen.clingPunchThroughGraphicCenterRadius);
mAppIconSize = r.getDimensionPixelSize(R.dimen.app_icon_size);
+ mRevealRadius = mAppIconSize * 1f;
mTabBarHeight = r.getDimensionPixelSize(R.dimen.apps_customize_tab_bar_height);
mTabBarHorizontalPadding =
r.getDimensionPixelSize(R.dimen.toolbar_button_horizontal_padding);
+ mButtonBarHeight = r.getDimensionPixelSize(R.dimen.button_bar_height);
mWorkspaceDesc1 = findViewById(R.id.workspace_cling_move_item);
mWorkspaceDesc2 = findViewById(R.id.workspace_cling_open_all_apps);
mAllAppsDesc = findViewById(R.id.all_apps_cling_add_item);
+
+ mErasePaint = new Paint();
+ mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
+ mErasePaint.setColor(0xFFFFFF);
+ mErasePaint.setAlpha(0);
+
mIsInitialized = true;
}
}
void cleanup() {
+ mBackground = null;
mPunchThroughGraphic = null;
+ mHandTouchGraphic = null;
+ mIsInitialized = false;
+ }
+
+ private int[] getPunchThroughPosition() {
+ if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) {
+ return new int[]{getMeasuredWidth() / 2, getMeasuredHeight() - (mButtonBarHeight / 2)};
+ } else if (mDrawIdentifier.equals(WORKSPACE_LANDSCAPE)) {
+ return new int[]{getMeasuredWidth() - (mButtonBarHeight / 2), getMeasuredHeight() / 2};
+ } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
+ mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
+ return mPositionData;
+ }
+ return new int[]{-1, -1};
}
@Override
public boolean onTouchEvent(android.view.MotionEvent event) {
- // Do nothing
+ if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) ||
+ mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) ||
+ mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
+ mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
+ int[] pos = getPunchThroughPosition();
+ double diff = Math.sqrt(Math.pow(event.getX() - pos[0], 2) +
+ Math.pow(event.getY() - pos[1], 2));
+ if (diff < mRevealRadius) {
+ if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) {
+ // Do nothing
+ } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT)) {
+ // Do nothing
+ }
+ return false;
+ }
+ } else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) ||
+ mDrawIdentifier.equals(FOLDER_LANDSCAPE)) {
+ Folder f = mLauncher.getWorkspace().getOpenFolder();
+ if (f != null) {
+ Rect r = new Rect();
+ f.getHitRect(r);
+ if (r.contains((int) event.getX(), (int) event.getY())) {
+ return false;
+ }
+ }
+ }
return true;
};
@Override
protected void dispatchDraw(Canvas canvas) {
- // Draw the rest of the cling
- super.dispatchDraw(canvas);
-
if (mIsInitialized) {
DisplayMetrics metrics = new DisplayMetrics();
mLauncher.getWindowManager().getDefaultDisplay().getMetrics(metrics);
- int dotRadius = (int) (6f * metrics.density);
-
- Paint p = new Paint();
- p.setAntiAlias(true);
- p.setColor(0xFF49C0EC);
-
- if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) {
- /* Draw the all apps line */ {
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
- mWorkspaceDesc2.getLayoutParams();
- int[] loc = new int[2];
- mWorkspaceDesc2.getLocationInWindow(loc);
- int x = loc[0];
- int xOffset = (int) (10f * metrics.density);
- int y = loc[1];
- int yOffset = (int) (30f * metrics.density);
- int w = mWorkspaceDesc2.getWidth();
- int h = mWorkspaceDesc2.getHeight();
-
- Point p1 = new Point(x + w + xOffset, y - (2 * dotRadius));
- Point p2 = new Point(getMeasuredWidth() / 2, getMeasuredHeight() -
- mAppIconSize / 2 - yOffset);
- canvas.drawCircle(p1.x, p1.y, dotRadius, p);
- canvas.drawCircle(p2.x, p2.y, dotRadius, p);
-
- Point p3 = new Point(p1.x, (int) (p1.y + (p2.y - p1.y) * 0.30f));
- Point p4 = new Point(p2.x, (int) (p1.y + (p2.y - p1.y) * 0.55f));
- canvas.drawLine(p1.x, p1.y, p3.x, p3.y, p);
- canvas.drawLine(p3.x, p3.y, p4.x, p4.y, p);
- canvas.drawLine(p4.x, p4.y, p2.x, p2.y, p);
- }
-
- /* Draw the move line */ {
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
- mWorkspaceDesc1.getLayoutParams();
- int[] loc = new int[2];
- mWorkspaceDesc1.getLocationInWindow(loc);
- int x = loc[0];
- int y = loc[1];
- int w = mWorkspaceDesc1.getWidth();
- int h = mWorkspaceDesc1.getHeight();
-
- Point p1 = new Point(x + w, y - (2 * dotRadius));
- Point p2 = new Point(x + w, getMeasuredHeight() - (4 * mAppIconSize));
- canvas.drawCircle(p1.x, p1.y, dotRadius, p);
- canvas.drawCircle(p2.x, p2.y, dotRadius, p);
- canvas.drawLine(p1.x, p1.y, p2.x, p2.y, p);
- }
- } else if (mDrawIdentifier.equals(WORKSPACE_LANDSCAPE)) {
- int xOffset = (int) (1.5f * mAppIconSize);
- /* Draw the all apps line */ {
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
- mWorkspaceDesc2.getLayoutParams();
- int[] loc = new int[2];
- mWorkspaceDesc2.getLocationInWindow(loc);
- int x = loc[0];
- int y = loc[1];
- int w = mWorkspaceDesc2.getWidth();
- int h = mWorkspaceDesc2.getHeight();
-
- Point p1 = new Point(x + w, y - (2 * dotRadius));
- Point p2 = new Point(getMeasuredWidth() - xOffset,
- getMeasuredHeight() / 2);
- canvas.drawCircle(p1.x, p1.y, dotRadius, p);
- canvas.drawCircle(p2.x, p2.y, dotRadius, p);
-
- Point p3 = new Point((int) (p1.x + (p2.x - p1.x) * 0.6f), p1.y);
- Point p4 = new Point((int) (p1.x + (p2.x - p1.x) * 0.75f), p2.y);
- canvas.drawLine(p1.x, p1.y, p3.x, p3.y, p);
- canvas.drawLine(p3.x, p3.y, p4.x, p4.y, p);
- canvas.drawLine(p4.x, p4.y, p2.x, p2.y, p);
- }
- /* Draw the move line */ {
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
- mWorkspaceDesc1.getLayoutParams();
- int[] loc = new int[2];
- mWorkspaceDesc1.getLocationInWindow(loc);
- int x = loc[0];
- int y = loc[1];
- int w = mWorkspaceDesc1.getWidth();
- int h = mWorkspaceDesc1.getHeight();
-
- Point p1 = new Point(x + w, y - (2 * dotRadius));
- Point p2 = new Point(getMeasuredWidth() - xOffset, y - (2 * dotRadius));
- canvas.drawCircle(p1.x, p1.y, dotRadius, p);
- canvas.drawCircle(p2.x, p2.y, dotRadius, p);
- canvas.drawLine(p1.x, p1.y, p2.x, p2.y, p);
- }
- } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT)) {
- float r = mAppIconSize * 1.1f;
- float scale = r / mPunchThroughGraphicCenterRadius;
- int dw = (int) (scale * mPunchThroughGraphic.getIntrinsicWidth());
- int dh = (int) (scale * mPunchThroughGraphic.getIntrinsicHeight());
- int cx = getMeasuredWidth() / 2;
- int cy = mTabBarHeight + ((getMeasuredHeight() - mTabBarHeight) / 2);
- mPunchThroughGraphic.setBounds(cx - dw/2, cy - dh/2, cx + dw/2, cy + dh/2);
- mPunchThroughGraphic.draw(canvas);
-
- /* Draw the line */ {
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
- mAllAppsDesc.getLayoutParams();
- int[] loc = new int[2];
- mAllAppsDesc.getLocationInWindow(loc);
- int x = loc[0];
- int y = loc[1];
- int yOffset = (int) (2.5f * metrics.density);
- int w = mAllAppsDesc.getWidth();
- int h = mAllAppsDesc.getHeight();
-
- Point p1 = new Point(getMeasuredWidth() / 2, y + h + yOffset);
- Point p2 = new Point(cx, cy);
- canvas.drawCircle(p1.x, p1.y, dotRadius, p);
- canvas.drawCircle(p2.x, p2.y, dotRadius, p);
- canvas.drawLine(p1.x, p1.y, p2.x, p2.y, p);
- }
- } else if (mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
- float r = mAppIconSize * 1.1f;
- float scale = r / mPunchThroughGraphicCenterRadius;
- int dw = (int) (scale * mPunchThroughGraphic.getIntrinsicWidth());
- int dh = (int) (scale * mPunchThroughGraphic.getIntrinsicHeight());
- int cx = getMeasuredWidth() / 2 + getMeasuredWidth() / 4;
- int cy = mTabBarHeight + ((getMeasuredHeight() - mTabBarHeight) / 2);
- mPunchThroughGraphic.setBounds(cx - dw/2, cy - dh/2, cx + dw/2, cy + dh/2);
- mPunchThroughGraphic.draw(canvas);
-
- /* Draw the line */ {
- FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
- mAllAppsDesc.getLayoutParams();
- int[] loc = new int[2];
- mAllAppsDesc.getLocationInWindow(loc);
- int x = loc[0];
- int y = loc[1];
- int w = mAllAppsDesc.getWidth();
- int h = mAllAppsDesc.getHeight();
-
- Point p1 = new Point(x + w, y);
- Point p2 = new Point(cx, cy);
- canvas.drawCircle(p1.x, p1.y, dotRadius, p);
- canvas.drawCircle(p2.x, p2.y, dotRadius, p);
- canvas.drawLine(p1.x, p1.y, p2.x, p2.y, p);
- }
- }
-
- /*
// Draw the background
Bitmap b = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(),
Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
- c.drawColor(0xD4000000);
- Paint p = new Paint();
- p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
- p.setColor(0xFFFFFF);
- p.setAlpha(0);
+
+ // Draw the background
+ if (mBackground == null) {
+ if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) {
+ mBackground = getResources().getDrawable(R.drawable.bg_cling1);
+ } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT)) {
+ mBackground = getResources().getDrawable(R.drawable.bg_cling2);
+ } else if (mDrawIdentifier.equals(FOLDER_PORTRAIT)) {
+ mBackground = getResources().getDrawable(R.drawable.bg_cling3);
+ }
+ }
+ if (mBackground != null) {
+ mBackground.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
+ mBackground.draw(c);
+ } else {
+ c.drawColor(0x99000000);
+ }
int cx = -1;
int cy = -1;
- float r = mAppIconSize * 1.4f;
- float scale = r / mPunchThroughGraphicCenterRadius;
+ float scale = mRevealRadius / mPunchThroughGraphicCenterRadius;
int dw = (int) (scale * mPunchThroughGraphic.getIntrinsicWidth());
int dh = (int) (scale * mPunchThroughGraphic.getIntrinsicHeight());
- if (mDrawIdentifier.equals("workspace_portrait")) {
- cx = getMeasuredWidth() / 2;
- cy = getMeasuredHeight() - mAppIconSize / 2;
- } else if (mDrawIdentifier.equals("workspace_landscape")) {
- cx = getMeasuredWidth() - mAppIconSize / 2;
- cy = getMeasuredHeight() / 2;
- } else if (mDrawIdentifier.equals("large_workspace_landscape") ||
- mDrawIdentifier.equals("large_workspace_portrait")) {
- cx = getMeasuredWidth() - mTabBarHorizontalPadding;
- cy = 0;
- } else if (mDrawIdentifier.equals("all_apps_portrait")) {
- cx = getMeasuredWidth() / 2;
- cy = mTabBarHeight + ((getMeasuredHeight() - mTabBarHeight) / 2);
- } else if (mDrawIdentifier.equals("all_apps_landscape")) {
- cx = getMeasuredWidth() / 2 + getMeasuredWidth() / 4;
- cy = mTabBarHeight + ((getMeasuredHeight() - mTabBarHeight) / 2);
- } else if (mDrawIdentifier.equals("large_all_apps_portrait")) {
- cx = getMeasuredWidth() / 2;
- cy = mTabBarHeight + (int) ((getMeasuredHeight() - mTabBarHeight) * 2f / 5f);
- } else if (mDrawIdentifier.equals("large_all_apps_landscape")) {
- cx = getMeasuredWidth() / 2 + getMeasuredWidth() / 6;
- cy = mTabBarHeight + (int) ((getMeasuredHeight() - mTabBarHeight) * 2f / 5f);
- }
+ // Determine where to draw the punch through graphic
+ int[] pos = getPunchThroughPosition();
+ cx = pos[0];
+ cy = pos[1];
if (cx > -1 && cy > -1) {
- c.drawCircle(cx, cy, r, p);
+ c.drawCircle(cx, cy, mRevealRadius, mErasePaint);
mPunchThroughGraphic.setBounds(cx - dw/2, cy - dh/2, cx + dw/2, cy + dh/2);
mPunchThroughGraphic.draw(c);
}
+
+ // Draw the hand graphic in All Apps
+ if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) ||
+ mDrawIdentifier.equals(ALLAPPS_LANDSCAPE)) {
+ if (mHandTouchGraphic == null) {
+ mHandTouchGraphic = getResources().getDrawable(R.drawable.hand);
+ }
+ int offset = -mAppIconSize / 4;
+ mHandTouchGraphic.setBounds(cx + offset, cy + offset,
+ cx + mHandTouchGraphic.getIntrinsicWidth() + offset,
+ cy + mHandTouchGraphic.getIntrinsicHeight() + offset);
+ mHandTouchGraphic.draw(c);
+ }
+
canvas.drawBitmap(b, 0, 0, null);
c.setBitmap(null);
b = null;
- */
}
+
+ // Draw the rest of the cling
+ super.dispatchDraw(canvas);
};
}
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index d0d4bad6e..28ef6a59f 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -108,7 +108,7 @@ public class DragLayer extends FrameLayout {
}
Folder currentFolder = mLauncher.getWorkspace().getOpenFolder();
- if (currentFolder != null && intercept) {
+ if (currentFolder != null && !mLauncher.isFolderClingVisible() && intercept) {
if (currentFolder.isEditingName()) {
getDescendantRectRelativeToSelf(currentFolder.getEditTextRegion(), hitRect);
if (!hitRect.contains(x, y)) {
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index a0342cf06..a1aa670c5 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -208,6 +208,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
return false;
}
+ mLauncher.dismissFolderCling(null);
+
mLauncher.getWorkspace().onDragStartedWithItem(v);
mLauncher.getWorkspace().beginDragShared(v, this);
mIconDrawable = ((TextView) v).getCompoundDrawables()[1];
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 29f3f252b..482f08630 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -75,11 +75,12 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
+import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
-import android.view.View.OnLongClickListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AccelerateDecelerateInterpolator;
+import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
import android.widget.Advanceable;
@@ -161,7 +162,8 @@ public final class Launcher extends Activity
static final int APPWIDGET_HOST_ID = 1024;
private static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 300;
private static final int EXIT_SPRINGLOADED_MODE_LONG_TIMEOUT = 600;
- private static final int DISMISS_CLING_DURATION = 300;
+ private static final int SHOW_CLING_DURATION = 250;
+ private static final int DISMISS_CLING_DURATION = 250;
private static final Object sLock = new Object();
private static int sScreen = DEFAULT_SCREEN;
@@ -271,7 +273,7 @@ public final class Launcher extends Activity
checkForLocaleChange();
setContentView(R.layout.launcher);
setupViews();
- enableClingsIfNecessary();
+ showFirstRunWorkspaceCling();
registerContentObservers();
@@ -1770,6 +1772,8 @@ public final class Launcher extends Activity
final FolderInfo info = folderIcon.mInfo;
Folder openFolder = mWorkspace.getFolderForTag(info);
+ Cling cling = showFirstRunFoldersCling();
+
// If the folder info reports that the associated folder is open, then verify that
// it is actually opened. There have been a few instances where this gets out of sync.
if (info.opened && openFolder == null) {
@@ -1798,6 +1802,10 @@ public final class Launcher extends Activity
}
}
}
+
+ if (cling != null) {
+ cling.bringToFront();
+ }
}
private void growAndFadeOutFolderIcon(FolderIcon fi) {
@@ -1874,6 +1882,9 @@ public final class Launcher extends Activity
Folder folder = mWorkspace.getOpenFolder();
if (folder != null) {
closeFolder(folder);
+
+ // Dismiss the folder cling
+ dismissFolderCling(null);
}
}
@@ -2119,6 +2130,7 @@ public final class Launcher extends Activity
*/
private void cameraZoomOut(State toState, boolean animated, final boolean springLoaded) {
final Resources res = getResources();
+ final Launcher instance = this;
final int duration = res.getInteger(R.integer.config_appsCustomizeZoomInTime);
final int fadeDuration = res.getInteger(R.integer.config_appsCustomizeFadeInTime);
@@ -2159,7 +2171,8 @@ public final class Launcher extends Activity
alphaAnim.start();
if (toView instanceof LauncherTransitionable) {
- ((LauncherTransitionable) toView).onLauncherTransitionStart(scaleAnim, false);
+ ((LauncherTransitionable) toView).onLauncherTransitionStart(instance, scaleAnim,
+ false);
}
scaleAnim.addListener(new AnimatorListenerAdapter() {
boolean animationCancelled = false;
@@ -2181,7 +2194,8 @@ public final class Launcher extends Activity
toView.setScaleX(1.0f);
toView.setScaleY(1.0f);
if (toView instanceof LauncherTransitionable) {
- ((LauncherTransitionable) toView).onLauncherTransitionEnd(scaleAnim, false);
+ ((LauncherTransitionable) toView).onLauncherTransitionEnd(instance,
+ scaleAnim, false);
}
if (!springLoaded && !LauncherApplication.isScreenLarge()) {
@@ -2214,8 +2228,8 @@ public final class Launcher extends Activity
toView.setVisibility(View.VISIBLE);
toView.bringToFront();
if (toView instanceof LauncherTransitionable) {
- ((LauncherTransitionable) toView).onLauncherTransitionStart(null, false);
- ((LauncherTransitionable) toView).onLauncherTransitionEnd(null, false);
+ ((LauncherTransitionable) toView).onLauncherTransitionStart(instance, null, false);
+ ((LauncherTransitionable) toView).onLauncherTransitionEnd(instance, null, false);
if (!springLoaded && !LauncherApplication.isScreenLarge()) {
// Hide the workspace scrollbar
@@ -2235,6 +2249,7 @@ public final class Launcher extends Activity
*/
private void cameraZoomIn(State fromState, boolean animated, final boolean springLoaded) {
Resources res = getResources();
+ final Launcher instance = this;
final int duration = res.getInteger(R.integer.config_appsCustomizeZoomOutTime);
final float scaleFactor = (float)
@@ -2270,7 +2285,8 @@ public final class Launcher extends Activity
}
});
if (fromView instanceof LauncherTransitionable) {
- ((LauncherTransitionable) fromView).onLauncherTransitionStart(alphaAnim, true);
+ ((LauncherTransitionable) fromView).onLauncherTransitionStart(instance, alphaAnim,
+ true);
}
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
@@ -2278,7 +2294,8 @@ public final class Launcher extends Activity
updateWallpaperVisibility(true);
fromView.setVisibility(View.GONE);
if (fromView instanceof LauncherTransitionable) {
- ((LauncherTransitionable) fromView).onLauncherTransitionEnd(alphaAnim,true);
+ ((LauncherTransitionable) fromView).onLauncherTransitionEnd(instance,
+ alphaAnim, true);
}
mWorkspace.hideScrollingIndicator(false);
}
@@ -2289,8 +2306,8 @@ public final class Launcher extends Activity
} else {
fromView.setVisibility(View.GONE);
if (fromView instanceof LauncherTransitionable) {
- ((LauncherTransitionable) fromView).onLauncherTransitionStart(null, true);
- ((LauncherTransitionable) fromView).onLauncherTransitionEnd(null, true);
+ ((LauncherTransitionable) fromView).onLauncherTransitionStart(instance, null, true);
+ ((LauncherTransitionable) fromView).onLauncherTransitionEnd(instance, null, true);
}
}
}
@@ -3067,33 +3084,40 @@ public final class Launcher extends Activity
}
/* Cling related */
- private static final String WORKSPACE_CLING_DISMISSED_KEY = "cling.workspace.dismissed";
- private static final String ALLAPPS_CLING_DISMISSED_KEY = "cling.allapps.dismissed";
- private void enableClingsIfNecessary() {
+ private static final String PREFS_KEY = "com.android.launcher2.prefs";
+ private boolean isClingsEnabled() {
// TEMPORARY: DISABLE CLINGS ON LARGE UI
- if (LauncherApplication.isScreenLarge()) return;
-
+ if (LauncherApplication.isScreenLarge()) return false;
// disable clings when running in a test harness
- if(ActivityManager.isRunningInTestHarness()) return;
+ if(ActivityManager.isRunningInTestHarness()) return false;
- // Enable the clings only if they have not been dismissed before
- SharedPreferences prefs =
- getSharedPreferences("com.android.launcher2.prefs", Context.MODE_PRIVATE);
- if (!prefs.getBoolean(WORKSPACE_CLING_DISMISSED_KEY, false)) {
- Cling cling = (Cling) findViewById(R.id.workspace_cling);
- cling.init(this);
- cling.setVisibility(View.VISIBLE);
- }
- if (!prefs.getBoolean(ALLAPPS_CLING_DISMISSED_KEY, false)) {
- Cling cling = (Cling) findViewById(R.id.all_apps_cling);
- cling.init(this);
+ return true;
+ }
+ private Cling initCling(int clingId, int[] positionData, boolean animate, int delay) {
+ Cling cling = (Cling) findViewById(clingId);
+ if (cling != null) {
+ cling.init(this, positionData);
cling.setVisibility(View.VISIBLE);
+ cling.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ if (animate) {
+ cling.buildLayer();
+ cling.setAlpha(0f);
+ cling.animate()
+ .alpha(1f)
+ .setInterpolator(new DecelerateInterpolator())
+ .setDuration(SHOW_CLING_DURATION)
+ .setStartDelay(delay)
+ .start();
+ } else {
+ cling.setAlpha(1f);
+ }
}
+ return cling;
}
- private void dismissCling(final Cling cling, final String flag) {
+ private void dismissCling(final Cling cling, final String flag, int duration) {
if (cling != null) {
ObjectAnimator anim = ObjectAnimator.ofFloat(cling, "alpha", 0f);
- anim.setDuration(DISMISS_CLING_DURATION);
+ anim.setDuration(duration);
anim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator animation) {
cling.setVisibility(View.GONE);
@@ -3108,13 +3132,53 @@ public final class Launcher extends Activity
anim.start();
}
}
+ public void showFirstRunWorkspaceCling() {
+ if (!isClingsEnabled()) return;
+
+ // Enable the clings only if they have not been dismissed before
+ SharedPreferences prefs =
+ getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
+ if (!prefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) {
+ initCling(R.id.workspace_cling, null, false, 0);
+ }
+ }
+ public void showFirstRunAllAppsCling(int[] position) {
+ if (!isClingsEnabled()) return;
+
+ // Enable the clings only if they have not been dismissed before
+ SharedPreferences prefs =
+ getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
+ if (!prefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) {
+ initCling(R.id.all_apps_cling, position, true, 0);
+ }
+ }
+ public Cling showFirstRunFoldersCling() {
+ if (!isClingsEnabled()) return null;
+
+ // Enable the clings only if they have not been dismissed before
+ SharedPreferences prefs =
+ getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
+ Cling cling = null;
+ if (!prefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) {
+ cling = initCling(R.id.folder_cling, null, true, 0);
+ }
+ return cling;
+ }
+ public boolean isFolderClingVisible() {
+ Cling cling = (Cling) findViewById(R.id.folder_cling);
+ return cling.getVisibility() == View.VISIBLE;
+ }
public void dismissWorkspaceCling(View v) {
Cling cling = (Cling) findViewById(R.id.workspace_cling);
- dismissCling(cling, WORKSPACE_CLING_DISMISSED_KEY);
+ dismissCling(cling, Cling.WORKSPACE_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION);
}
public void dismissAllAppsCling(View v) {
Cling cling = (Cling) findViewById(R.id.all_apps_cling);
- dismissCling(cling, ALLAPPS_CLING_DISMISSED_KEY);
+ dismissCling(cling, Cling.ALLAPPS_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION);
+ }
+ public void dismissFolderCling(View v) {
+ Cling cling = (Cling) findViewById(R.id.folder_cling);
+ dismissCling(cling, Cling.FOLDER_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION);
}
/**
@@ -3138,6 +3202,6 @@ public final class Launcher extends Activity
}
interface LauncherTransitionable {
- void onLauncherTransitionStart(Animator animation, boolean toWorkspace);
- void onLauncherTransitionEnd(Animator animation, boolean toWorkspace);
+ void onLauncherTransitionStart(Launcher l, Animator animation, boolean toWorkspace);
+ void onLauncherTransitionEnd(Launcher l, Animator animation, boolean toWorkspace);
}
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 9a105d104..d7e9e06e0 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -204,9 +204,9 @@ public abstract class PagedView extends ViewGroup {
mPageLayoutPaddingRight = a.getDimensionPixelSize(
R.styleable.PagedView_pageLayoutPaddingRight, 0);
mPageLayoutWidthGap = a.getDimensionPixelSize(
- R.styleable.PagedView_pageLayoutWidthGap, -1);
+ R.styleable.PagedView_pageLayoutWidthGap, 0);
mPageLayoutHeightGap = a.getDimensionPixelSize(
- R.styleable.PagedView_pageLayoutHeightGap, -1);
+ R.styleable.PagedView_pageLayoutHeightGap, 0);
mScrollIndicatorPaddingLeft =
a.getDimensionPixelSize(R.styleable.PagedView_scrollIndicatorPaddingLeft, 0);
mScrollIndicatorPaddingRight =
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 29dc3521b..5e87b46d2 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -352,6 +352,14 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
return n;
}
+ /** Returns an estimated center position of the cell at the specified index */
+ public int[] estimateCellPosition(int x, int y) {
+ return new int[] {
+ mPaddingLeft + (x * mCellWidth) + (x * mWidthGap) + (mCellWidth / 2),
+ mPaddingTop + (y * mCellHeight) + (y * mHeightGap) + (mCellHeight / 2)
+ };
+ }
+
public void calculateCellCount(int width, int height, int maxCellCountX, int maxCellCountY) {
mCellCountX = Math.min(maxCellCountX, estimateCellHSpan(width));
mCellCountY = Math.min(maxCellCountY, estimateCellVSpan(height));