diff options
author | Winson Chung <winsonc@google.com> | 2013-09-18 18:26:31 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2013-09-20 17:22:05 -0700 |
commit | af40f205d7f0c5f73a92ff5d9b8e9602dbde58c0 (patch) | |
tree | 0f36e6018c23e408c1dd846a9ef5ce063478fb65 | |
parent | 477828cc83b60a17eb9b6fc8ee08b4abbc3d2fb1 (diff) | |
download | android_packages_apps_Trebuchet-af40f205d7f0c5f73a92ff5d9b8e9602dbde58c0.tar.gz android_packages_apps_Trebuchet-af40f205d7f0c5f73a92ff5d9b8e9602dbde58c0.tar.bz2 android_packages_apps_Trebuchet-af40f205d7f0c5f73a92ff5d9b8e9602dbde58c0.zip |
Initial changes to restore clings.
Change-Id: Ie23e6e9f39679e8d35955a4a7db804d03f8b4d3f
61 files changed, 596 insertions, 375 deletions
diff --git a/proguard.flags b/proguard.flags index 806105f3b..9b59b217e 100644 --- a/proguard.flags +++ b/proguard.flags @@ -7,6 +7,7 @@ public void onClickConfigureButton(android.view.View); public void onClickAllAppsButton(android.view.View); public void onClickAppMarketButton(android.view.View); + public void dismissFirstRunCling(android.view.View); public void dismissWorkspaceCling(android.view.View); public void dismissAllAppsCling(android.view.View); } diff --git a/res/drawable-hdpi/btn_cling_normal.9.png b/res/drawable-hdpi/btn_cling_normal.9.png Binary files differdeleted file mode 100644 index aea8beb3e..000000000 --- a/res/drawable-hdpi/btn_cling_normal.9.png +++ /dev/null diff --git a/res/drawable-hdpi/btn_cling_pressed.9.png b/res/drawable-hdpi/btn_cling_pressed.9.png Binary files differdeleted file mode 100644 index ebefd20ad..000000000 --- a/res/drawable-hdpi/btn_cling_pressed.9.png +++ /dev/null diff --git a/res/drawable-hdpi/cling.9.png b/res/drawable-hdpi/cling.9.png Binary files differnew file mode 100644 index 000000000..42a889fb1 --- /dev/null +++ b/res/drawable-hdpi/cling.9.png diff --git a/res/drawable-hdpi/cling.png b/res/drawable-hdpi/cling.png Binary files differdeleted file mode 100644 index d60579940..000000000 --- a/res/drawable-hdpi/cling.png +++ /dev/null diff --git a/res/drawable-hdpi/cling_arrow_down.png b/res/drawable-hdpi/cling_arrow_down.png Binary files differnew file mode 100644 index 000000000..4f521eadc --- /dev/null +++ b/res/drawable-hdpi/cling_arrow_down.png diff --git a/res/drawable-hdpi/cling_arrow_left.png b/res/drawable-hdpi/cling_arrow_left.png Binary files differnew file mode 100644 index 000000000..13764c9e2 --- /dev/null +++ b/res/drawable-hdpi/cling_arrow_left.png diff --git a/res/drawable-hdpi/cling_arrow_right.png b/res/drawable-hdpi/cling_arrow_right.png Binary files differnew file mode 100644 index 000000000..be522441d --- /dev/null +++ b/res/drawable-hdpi/cling_arrow_right.png diff --git a/res/drawable-hdpi/cling_arrow_up.png b/res/drawable-hdpi/cling_arrow_up.png Binary files differnew file mode 100644 index 000000000..83b5b3783 --- /dev/null +++ b/res/drawable-hdpi/cling_arrow_up.png diff --git a/res/drawable-hdpi/cling_button.9.png b/res/drawable-hdpi/cling_button.9.png Binary files differnew file mode 100644 index 000000000..4dbe56433 --- /dev/null +++ b/res/drawable-hdpi/cling_button.9.png diff --git a/res/drawable-hdpi/cling_button_pressed.9.png b/res/drawable-hdpi/cling_button_pressed.9.png Binary files differnew file mode 100644 index 000000000..2a85cabfa --- /dev/null +++ b/res/drawable-hdpi/cling_button_pressed.9.png diff --git a/res/drawable-mdpi/btn_cling_normal.9.png b/res/drawable-mdpi/btn_cling_normal.9.png Binary files differdeleted file mode 100644 index 43a407e03..000000000 --- a/res/drawable-mdpi/btn_cling_normal.9.png +++ /dev/null diff --git a/res/drawable-mdpi/btn_cling_pressed.9.png b/res/drawable-mdpi/btn_cling_pressed.9.png Binary files differdeleted file mode 100644 index bf0c8cbb4..000000000 --- a/res/drawable-mdpi/btn_cling_pressed.9.png +++ /dev/null diff --git a/res/drawable-mdpi/cling.9.png b/res/drawable-mdpi/cling.9.png Binary files differnew file mode 100644 index 000000000..f6f730d86 --- /dev/null +++ b/res/drawable-mdpi/cling.9.png diff --git a/res/drawable-mdpi/cling.png b/res/drawable-mdpi/cling.png Binary files differdeleted file mode 100644 index fba3a0787..000000000 --- a/res/drawable-mdpi/cling.png +++ /dev/null diff --git a/res/drawable-mdpi/cling_arrow_down.png b/res/drawable-mdpi/cling_arrow_down.png Binary files differnew file mode 100644 index 000000000..58e66fbb2 --- /dev/null +++ b/res/drawable-mdpi/cling_arrow_down.png diff --git a/res/drawable-mdpi/cling_arrow_left.png b/res/drawable-mdpi/cling_arrow_left.png Binary files differnew file mode 100644 index 000000000..023c71705 --- /dev/null +++ b/res/drawable-mdpi/cling_arrow_left.png diff --git a/res/drawable-mdpi/cling_arrow_right.png b/res/drawable-mdpi/cling_arrow_right.png Binary files differnew file mode 100644 index 000000000..cf0eb1047 --- /dev/null +++ b/res/drawable-mdpi/cling_arrow_right.png diff --git a/res/drawable-mdpi/cling_arrow_up.png b/res/drawable-mdpi/cling_arrow_up.png Binary files differnew file mode 100644 index 000000000..9b0e6b7ae --- /dev/null +++ b/res/drawable-mdpi/cling_arrow_up.png diff --git a/res/drawable-mdpi/cling_button.9.png b/res/drawable-mdpi/cling_button.9.png Binary files differnew file mode 100644 index 000000000..38de60aee --- /dev/null +++ b/res/drawable-mdpi/cling_button.9.png diff --git a/res/drawable-mdpi/cling_button_pressed.9.png b/res/drawable-mdpi/cling_button_pressed.9.png Binary files differnew file mode 100644 index 000000000..c60837d2a --- /dev/null +++ b/res/drawable-mdpi/cling_button_pressed.9.png diff --git a/res/drawable-xhdpi/btn_cling_normal.9.png b/res/drawable-xhdpi/btn_cling_normal.9.png Binary files differdeleted file mode 100644 index 35511d6f9..000000000 --- a/res/drawable-xhdpi/btn_cling_normal.9.png +++ /dev/null diff --git a/res/drawable-xhdpi/btn_cling_pressed.9.png b/res/drawable-xhdpi/btn_cling_pressed.9.png Binary files differdeleted file mode 100644 index a38b40fa9..000000000 --- a/res/drawable-xhdpi/btn_cling_pressed.9.png +++ /dev/null diff --git a/res/drawable-xhdpi/cling.9.png b/res/drawable-xhdpi/cling.9.png Binary files differnew file mode 100644 index 000000000..9cc03c92c --- /dev/null +++ b/res/drawable-xhdpi/cling.9.png diff --git a/res/drawable-xhdpi/cling.png b/res/drawable-xhdpi/cling.png Binary files differdeleted file mode 100644 index 1cee1de51..000000000 --- a/res/drawable-xhdpi/cling.png +++ /dev/null diff --git a/res/drawable-xhdpi/cling_arrow_down.png b/res/drawable-xhdpi/cling_arrow_down.png Binary files differnew file mode 100644 index 000000000..ee1093340 --- /dev/null +++ b/res/drawable-xhdpi/cling_arrow_down.png diff --git a/res/drawable-xhdpi/cling_arrow_left.png b/res/drawable-xhdpi/cling_arrow_left.png Binary files differnew file mode 100644 index 000000000..cffbcf3ce --- /dev/null +++ b/res/drawable-xhdpi/cling_arrow_left.png diff --git a/res/drawable-xhdpi/cling_arrow_right.png b/res/drawable-xhdpi/cling_arrow_right.png Binary files differnew file mode 100644 index 000000000..d880d67f0 --- /dev/null +++ b/res/drawable-xhdpi/cling_arrow_right.png diff --git a/res/drawable-xhdpi/cling_arrow_up.png b/res/drawable-xhdpi/cling_arrow_up.png Binary files differnew file mode 100644 index 000000000..fd2c60c31 --- /dev/null +++ b/res/drawable-xhdpi/cling_arrow_up.png diff --git a/res/drawable-xhdpi/cling_button.9.png b/res/drawable-xhdpi/cling_button.9.png Binary files differnew file mode 100644 index 000000000..1c93bc41f --- /dev/null +++ b/res/drawable-xhdpi/cling_button.9.png diff --git a/res/drawable-xhdpi/cling_button_pressed.9.png b/res/drawable-xhdpi/cling_button_pressed.9.png Binary files differnew file mode 100644 index 000000000..b5d4aaea5 --- /dev/null +++ b/res/drawable-xhdpi/cling_button_pressed.9.png diff --git a/res/drawable-xxhdpi/btn_cling_normal.9.png b/res/drawable-xxhdpi/btn_cling_normal.9.png Binary files differdeleted file mode 100644 index f5e80326e..000000000 --- a/res/drawable-xxhdpi/btn_cling_normal.9.png +++ /dev/null diff --git a/res/drawable-xxhdpi/btn_cling_pressed.9.png b/res/drawable-xxhdpi/btn_cling_pressed.9.png Binary files differdeleted file mode 100644 index c507dd734..000000000 --- a/res/drawable-xxhdpi/btn_cling_pressed.9.png +++ /dev/null diff --git a/res/drawable-xxhdpi/cling.9.png b/res/drawable-xxhdpi/cling.9.png Binary files differnew file mode 100644 index 000000000..3dcf12130 --- /dev/null +++ b/res/drawable-xxhdpi/cling.9.png diff --git a/res/drawable-xxhdpi/cling.png b/res/drawable-xxhdpi/cling.png Binary files differdeleted file mode 100644 index 9446ea4bd..000000000 --- a/res/drawable-xxhdpi/cling.png +++ /dev/null diff --git a/res/drawable-xxhdpi/cling_arrow_down.png b/res/drawable-xxhdpi/cling_arrow_down.png Binary files differnew file mode 100644 index 000000000..48c4f06fa --- /dev/null +++ b/res/drawable-xxhdpi/cling_arrow_down.png diff --git a/res/drawable-xxhdpi/cling_arrow_left.png b/res/drawable-xxhdpi/cling_arrow_left.png Binary files differnew file mode 100644 index 000000000..8760d05da --- /dev/null +++ b/res/drawable-xxhdpi/cling_arrow_left.png diff --git a/res/drawable-xxhdpi/cling_arrow_right.png b/res/drawable-xxhdpi/cling_arrow_right.png Binary files differnew file mode 100644 index 000000000..356ba178c --- /dev/null +++ b/res/drawable-xxhdpi/cling_arrow_right.png diff --git a/res/drawable-xxhdpi/cling_arrow_up.png b/res/drawable-xxhdpi/cling_arrow_up.png Binary files differnew file mode 100644 index 000000000..4cb805f45 --- /dev/null +++ b/res/drawable-xxhdpi/cling_arrow_up.png diff --git a/res/drawable-xxhdpi/cling_button.9.png b/res/drawable-xxhdpi/cling_button.9.png Binary files differnew file mode 100644 index 000000000..4f68a03ff --- /dev/null +++ b/res/drawable-xxhdpi/cling_button.9.png diff --git a/res/drawable-xxhdpi/cling_button_pressed.9.png b/res/drawable-xxhdpi/cling_button_pressed.9.png Binary files differnew file mode 100644 index 000000000..4bc033764 --- /dev/null +++ b/res/drawable-xxhdpi/cling_button_pressed.9.png diff --git a/res/drawable/cling_button_bg.xml b/res/drawable/cling_button_bg.xml index 3809cdecb..7bf6ce79f 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="@drawable/btn_cling_pressed" /> - <item android:drawable="@drawable/btn_cling_normal" /> + <item android:state_pressed="true" android:drawable="@drawable/cling_button_pressed" /> + <item android:drawable="@drawable/cling_button" /> </selector> diff --git a/res/layout-land/first_run_cling.xml b/res/layout-land/first_run_cling.xml new file mode 100644 index 000000000..f82738096 --- /dev/null +++ b/res/layout-land/first_run_cling.xml @@ -0,0 +1,84 @@ +<?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.launcher3.Cling + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" + android:layout_width="match_parent" + android:layout_height="match_parent" + launcher:drawIdentifier="first_run_portrait"> + <FrameLayout + android:id="@+id/content" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <LinearLayout + android:id="@+id/bubble_content" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:orientation="vertical"> + <TextView + style="@style/ClingAltTitleText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:text="@string/first_run_cling_title" + android:textColor="#49C0EC" + android:textSize="32sp" /> + <TextView + style="@style/ClingAltTitleText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/first_run_cling_description" + android:textColor="#80000000" + android:textSize="16sp" /> + </LinearLayout> + <TextView + style="@style/ClingHintText" + android:layout_width="160dp" + android:layout_height="wrap_content" + android:layout_gravity="top|end" + android:layout_marginEnd="10dp" + android:layout_marginTop="80dp" + android:text="@string/first_run_cling_search_bar_hint" + android:visibility="gone" /> + <TextView + style="@style/ClingHintText" + android:layout_width="160dp" + android:layout_height="wrap_content" + android:layout_gravity="top" + android:layout_marginStart="10dp" + android:layout_marginTop="100dp" + android:text="@string/first_run_cling_custom_content_hint" + android:visibility="gone" /> + <TextView + style="@style/ClingHintText" + android:layout_width="160dp" + android:layout_height="wrap_content" + android:layout_gravity="bottom|end" + android:layout_marginEnd="10dp" + android:layout_marginBottom="100dp" + android:text="@string/first_run_cling_create_screens_hint" + android:visibility="gone" /> + </FrameLayout> + <Button + style="@style/ClingButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="15dp" + android:layout_marginEnd="20dp" + android:layout_gravity="bottom|end" + android:onClick="dismissFirstRunCling" /> +</com.android.launcher3.Cling> diff --git a/res/layout-land/folder_cling.xml b/res/layout-land/folder_cling.xml index 275edeead..171e39554 100644 --- a/res/layout-land/folder_cling.xml +++ b/res/layout-land/folder_cling.xml @@ -16,33 +16,50 @@ <com.android.launcher3.Cling xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" - launcher:drawIdentifier="folder_landscape"> + launcher:drawIdentifier="folder_portrait"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginStart="20dp" - android:layout_marginTop="20dp"> + android:layout_marginStart="10dp" + android:layout_marginEnd="10dp" + android:layout_marginTop="40dp" + android:layout_marginBottom="20dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> - <TextView - style="@style/ClingTitleText" - android:id="@+id/folder_cling_title" - android:text="@string/folder_cling_title" /> - <TextView - style="@style/ClingText" - android:id="@+id/folder_cling_create_folder" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/folder_cling_create_folder" /> + android:paddingLeft="20dp" + android:paddingRight="20dp" + android:paddingTop="20dp" + android:paddingBottom="20dp" + android:orientation="vertical" + android:background="@drawable/cling"> + <TextView + style="@style/ClingTitleText" + android:id="@+id/folder_cling_title" + android:text="@string/folder_cling_title" /> + <TextView + style="@style/ClingText" + android:id="@+id/folder_cling_create_folder" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/folder_cling_create_folder" /> + </LinearLayout> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:src="@drawable/cling_arrow_down" /> </LinearLayout> </FrameLayout> <Button style="@style/ClingButton" android:id="@+id/cling_dismiss" android:layout_marginBottom="15dp" - android:layout_marginEnd="10dp" + android:layout_marginEnd="20dp" android:layout_gravity="bottom|end" android:onClick="dismissFolderCling" /> </com.android.launcher3.Cling> diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml index faf410be5..2b9a9f3e8 100644 --- a/res/layout-land/launcher.xml +++ b/res/layout-land/launcher.xml @@ -57,6 +57,11 @@ <!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure that it is still visible during the transition to AllApps and doesn't overlay on top of that view. --> + <include layout="@layout/first_run_cling" + android:id="@+id/first_run_cling" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:visibility="gone" /> <include layout="@layout/workspace_cling" android:id="@+id/workspace_cling" android:layout_width="match_parent" diff --git a/res/layout-land/workspace_cling.xml b/res/layout-land/workspace_cling.xml index 8bd9e351f..08fb8cf23 100644 --- a/res/layout-land/workspace_cling.xml +++ b/res/layout-land/workspace_cling.xml @@ -18,42 +18,54 @@ xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" android:layout_width="match_parent" android:layout_height="match_parent" - launcher:drawIdentifier="workspace_landscape"> + launcher:drawIdentifier="workspace_portrait"> <FrameLayout + android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginStart="40dp" - android:layout_marginTop="40dp"> + android:layout_marginStart="25dp" + android:layout_marginEnd="25dp" + android:layout_marginTop="20dp" + android:layout_marginBottom="100dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_marginBottom="40dp" android:orientation="vertical"> - <TextView - style="@style/ClingTitleText" + <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/workspace_cling_title" /> - <TextView - style="@style/ClingText" + android:layout_gravity="center_horizontal" + android:src="@drawable/cling_arrow_up" /> + <LinearLayout + android:paddingLeft="20dp" + android:paddingRight="20dp" + android:paddingTop="20dp" + android:paddingBottom="20dp" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/workspace_cling_move_item" /> + android:orientation="vertical" + android:background="@drawable/cling"> + <TextView + style="@style/ClingTitleText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/workspace_cling_title" /> + <TextView + style="@style/ClingText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/workspace_cling_move_item" /> + </LinearLayout> </LinearLayout> </FrameLayout> - <TextView - style="@style/ClingText" - android:layout_width="180dp" - android:layout_height="wrap_content" - android:layout_marginEnd="130dp" - android:layout_gravity="end|center_vertical" - android:gravity="end" - android:text="@string/workspace_cling_open_all_apps" /> <Button style="@style/ClingButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="15dp" - android:layout_marginEnd="10dp" + android:layout_marginEnd="20dp" android:layout_gravity="bottom|end" android:onClick="dismissWorkspaceCling" /> </com.android.launcher3.Cling> diff --git a/res/layout-port/first_run_cling.xml b/res/layout-port/first_run_cling.xml new file mode 100644 index 000000000..cdc49b9cb --- /dev/null +++ b/res/layout-port/first_run_cling.xml @@ -0,0 +1,83 @@ +<?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.launcher3.Cling + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" + android:layout_width="match_parent" + android:layout_height="match_parent" + launcher:drawIdentifier="first_run_portrait"> + <FrameLayout + android:id="@+id/content" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <LinearLayout + android:id="@+id/bubble_content" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:orientation="vertical"> + <TextView + style="@style/ClingAltTitleText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="10dp" + android:text="@string/first_run_cling_title" + android:textColor="#49C0EC" + android:textSize="30sp" /> + <TextView + style="@style/ClingAltTitleText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/first_run_cling_description" + android:textColor="#80000000" + android:textSize="16sp" /> + </LinearLayout> + <TextView + style="@style/ClingHintText" + android:layout_width="160dp" + android:layout_height="wrap_content" + android:layout_gravity="top|end" + android:layout_marginEnd="10dp" + android:layout_marginTop="80dp" + android:text="@string/first_run_cling_search_bar_hint" /> + <TextView + style="@style/ClingHintText" + android:layout_width="160dp" + android:layout_height="wrap_content" + android:layout_gravity="top" + android:layout_marginStart="10dp" + android:layout_marginTop="100dp" + android:text="@string/first_run_cling_custom_content_hint" /> + <TextView + style="@style/ClingHintText" + android:layout_width="160dp" + android:layout_height="wrap_content" + android:layout_gravity="bottom|end" + android:layout_marginEnd="10dp" + android:layout_marginBottom="100dp" + android:drawableEnd="@drawable/cling_arrow_right" + android:text="@string/first_run_cling_create_screens_hint" /> + </FrameLayout> + <Button + style="@style/ClingButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="15dp" + android:layout_marginEnd="20dp" + android:layout_gravity="bottom|end" + android:onClick="dismissFirstRunCling" /> +</com.android.launcher3.Cling> diff --git a/res/layout-port/folder_cling.xml b/res/layout-port/folder_cling.xml index b91578fdb..bd4b5e2b1 100644 --- a/res/layout-port/folder_cling.xml +++ b/res/layout-port/folder_cling.xml @@ -21,29 +21,45 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginStart="20dp" - android:layout_marginEnd="10dp" - android:layout_marginTop="@dimen/folderClingMarginTop"> + android:layout_marginEnd="20dp" + android:layout_marginTop="10dp" + android:layout_marginBottom="10dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> - <TextView - style="@style/ClingTitleText" - android:id="@+id/folder_cling_title" - android:text="@string/folder_cling_title" /> - <TextView - style="@style/ClingText" - android:id="@+id/folder_cling_create_folder" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/folder_cling_create_folder" /> + android:paddingLeft="20dp" + android:paddingRight="20dp" + android:paddingTop="20dp" + android:paddingBottom="20dp" + android:orientation="vertical" + android:background="@drawable/cling"> + <TextView + style="@style/ClingTitleText" + android:id="@+id/folder_cling_title" + android:text="@string/folder_cling_title" /> + <TextView + style="@style/ClingText" + android:id="@+id/folder_cling_create_folder" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/folder_cling_create_folder" /> + </LinearLayout> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:src="@drawable/cling_arrow_down" /> </LinearLayout> </FrameLayout> <Button style="@style/ClingButton" android:id="@+id/cling_dismiss" android:layout_marginBottom="15dp" - android:layout_marginEnd="10dp" + android:layout_marginEnd="20dp" android:layout_gravity="bottom|end" android:onClick="dismissFolderCling" /> </com.android.launcher3.Cling> diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml index 9844a370c..faef7a594 100644 --- a/res/layout-port/launcher.xml +++ b/res/layout-port/launcher.xml @@ -64,6 +64,11 @@ <!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure that it is still visible during the transition to AllApps and doesn't overlay on top of that view. --> + <include layout="@layout/first_run_cling" + android:id="@+id/first_run_cling" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:visibility="gone" /> <include layout="@layout/workspace_cling" android:id="@+id/workspace_cling" android:layout_width="match_parent" diff --git a/res/layout-port/workspace_cling.xml b/res/layout-port/workspace_cling.xml index 052e1a091..38d385896 100644 --- a/res/layout-port/workspace_cling.xml +++ b/res/layout-port/workspace_cling.xml @@ -20,43 +20,51 @@ android:layout_height="match_parent" launcher:drawIdentifier="workspace_portrait"> <FrameLayout + android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginStart="20dp" - android:layout_marginEnd="20dp" - android:layout_marginTop="90dp"> + android:layout_marginStart="25dp" + android:layout_marginEnd="25dp" + android:layout_marginTop="20dp" + android:layout_marginBottom="120dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_gravity="bottom" android:orientation="vertical"> - <TextView - style="@style/ClingTitleText" + <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/workspace_cling_title" /> - <TextView - style="@style/ClingText" + android:layout_gravity="center_horizontal" + android:src="@drawable/cling_arrow_up" /> + <LinearLayout + android:paddingLeft="20dp" + android:paddingRight="20dp" + android:paddingTop="20dp" + android:paddingBottom="20dp" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/workspace_cling_move_item" /> + android:orientation="vertical" + android:background="@drawable/cling"> + <TextView + style="@style/ClingTitleText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/workspace_cling_title" /> + <TextView + style="@style/ClingText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/workspace_cling_move_item" /> + </LinearLayout> </LinearLayout> </FrameLayout> - <TextView - style="@style/ClingText" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="20dp" - android:layout_marginEnd="20dp" - android:layout_marginBottom="130dp" - android:layout_gravity="bottom" - android:gravity="center" - android:text="@string/workspace_cling_open_all_apps" /> <Button style="@style/ClingButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="15dp" - android:layout_marginEnd="10dp" + android:layout_marginEnd="20dp" android:layout_gravity="bottom|end" android:onClick="dismissWorkspaceCling" /> </com.android.launcher3.Cling> diff --git a/res/layout-sw720dp/folder_cling.xml b/res/layout-sw720dp/folder_cling.xml deleted file mode 100644 index 4193838ca..000000000 --- a/res/layout-sw720dp/folder_cling.xml +++ /dev/null @@ -1,46 +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.launcher3.Cling - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" - launcher:drawIdentifier="folder_large"> - <FrameLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginStart="@dimen/cling_text_block_offset_x" - android:layout_marginTop="@dimen/cling_text_block_offset_y"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - <TextView - style="@style/ClingTitleText" - android:id="@+id/folder_cling_title" - android:text="@string/folder_cling_title" /> - <TextView - style="@style/ClingText" - android:id="@+id/folder_cling_create_folder" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/folder_cling_create_folder" /> - <Button - style="@style/ClingButton" - android:id="@+id/cling_dismiss" - android:layout_marginTop="15dp" - android:onClick="dismissFolderCling" /> - </LinearLayout> - </FrameLayout> -</com.android.launcher3.Cling> diff --git a/res/layout-sw720dp/launcher.xml b/res/layout-sw720dp/launcher.xml index fee0198ed..951e63a39 100644 --- a/res/layout-sw720dp/launcher.xml +++ b/res/layout-sw720dp/launcher.xml @@ -65,6 +65,11 @@ <!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure that it is still visible during the transition to AllApps and doesn't overlay on top of that view. --> + <include layout="@layout/first_run_cling" + android:id="@+id/first_run_cling" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:visibility="gone" /> <include layout="@layout/workspace_cling" android:id="@+id/workspace_cling" android:layout_width="match_parent" diff --git a/res/layout-sw720dp/workspace_cling.xml b/res/layout-sw720dp/workspace_cling.xml deleted file mode 100644 index 052e1a091..000000000 --- a/res/layout-sw720dp/workspace_cling.xml +++ /dev/null @@ -1,62 +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.launcher3.Cling - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" - android:layout_width="match_parent" - android:layout_height="match_parent" - launcher:drawIdentifier="workspace_portrait"> - <FrameLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginStart="20dp" - android:layout_marginEnd="20dp" - android:layout_marginTop="90dp"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - <TextView - style="@style/ClingTitleText" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/workspace_cling_title" /> - <TextView - style="@style/ClingText" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/workspace_cling_move_item" /> - </LinearLayout> - </FrameLayout> - <TextView - style="@style/ClingText" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="20dp" - android:layout_marginEnd="20dp" - android:layout_marginBottom="130dp" - android:layout_gravity="bottom" - android:gravity="center" - android:text="@string/workspace_cling_open_all_apps" /> - <Button - style="@style/ClingButton" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="15dp" - android:layout_marginEnd="10dp" - android:layout_gravity="bottom|end" - android:onClick="dismissWorkspaceCling" /> -</com.android.launcher3.Cling> diff --git a/res/values/strings.xml b/res/values/strings.xml index 6b9b07056..8406302c1 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -226,21 +226,27 @@ s --> <!-- Clings --> <!-- The title text for the workspace cling [CHAR_LIMIT=none] --> - <string name="workspace_cling_title">Make yourself at home</string> + <string name="first_run_cling_title">Welcome!</string> <!-- The description of how to use the workspace [CHAR_LIMIT=none] --> - <string name="workspace_cling_move_item">You can put your favorite 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 circle.</string> + <string name="first_run_cling_description">Make yourself at Home</string> + <!-- The description of how to use the workspace [CHAR_LIMIT=none] --> + <string name="first_run_cling_custom_content_hint"></string> + <!-- The description of how to use the workspace [CHAR_LIMIT=none] --> + <string name="first_run_cling_search_bar_hint"></string> + <!-- The description of how to use the workspace [CHAR_LIMIT=none] --> + <string name="first_run_cling_create_screens_hint">Create more screens for apps and folders</string> + <!-- The title text for the workspace cling [CHAR_LIMIT=none] --> + <string name="workspace_cling_title">Organize your space</string> + <!-- The description of how to use the workspace [CHAR_LIMIT=none] --> + <string name="workspace_cling_move_item">Touch & hold background to manage wallpaper, widgets and settings</string> <!-- The title text for the All Apps cling [CHAR_LIMIT=none] --> <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 to your Home screen, touch & 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 & hold it.</string> + <string name="folder_cling_title">Create new folders for your apps</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> + <string name="folder_cling_create_folder">Touch & hold an app, then move it on top of another app icon</string> <!-- The text on the button to dismiss a cling [CHAR_LIMIT=none] --> <string name="cling_dismiss">OK</string> <!-- Error message on dummy custom cling layout [DO NOT TRANSLATE] --> diff --git a/res/values/styles.xml b/res/values/styles.xml index 48b9dbc9f..e6bb9359b 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -35,34 +35,45 @@ <style name="ClingButton"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> - <item name="android:paddingTop">10dp</item> + <item name="android:paddingTop">15dp</item> <item name="android:paddingBottom">15dp</item> - <item name="android:paddingStart">35dp</item> - <item name="android:paddingEnd">35dp</item> + <item name="android:paddingStart">50dp</item> + <item name="android:paddingEnd">50dp</item> <item name="android:text">@string/cling_dismiss</item> + <item name="android:textColor">#ffffff</item> <item name="android:textStyle">bold</item> + <item name="android:textSize">16sp</item> <item name="android:background">@drawable/cling_button_bg</item> </style> <style name="ClingTitleText"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_marginBottom">5dp</item> - <item name="android:textSize">23sp</item> + <item name="android:textSize">22sp</item> + <item name="android:textColor">#ffffff</item> + <item name="android:fontFamily">sans-serif-condensed</item> + </style> + <style name="ClingAltTitleText"> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:textSize">24sp</item> <item name="android:textColor">#49C0EC</item> - <item name="android:shadowColor">#000000</item> - <item name="android:shadowDy">2</item> - <item name="android:shadowRadius">2.0</item> + <item name="android:fontFamily">sans-serif-condensed</item> </style> <style name="ClingText"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> - <item name="android:textSize">15sp</item> - <item name="android:textColor">#FFFFFF</item> - <item name="android:shadowColor">#000000</item> - <item name="android:shadowDy">2</item> - <item name="android:shadowRadius">2.0</item> + <item name="android:textSize">16sp</item> + <item name="android:textColor">#80000000</item> <item name="android:lineSpacingMultiplier">1.1</item> </style> + <style name="ClingHintText"> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:textSize">18sp</item> + <item name="android:textColor">#80ffffff</item> + <item name="android:fontFamily">sans-serif-condensed</item> + </style> <style name="WorkspaceIcon"> <item name="android:layout_width">match_parent</item> diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java index a36f44459..213e50a67 100644 --- a/src/com/android/launcher3/AppsCustomizePagedView.java +++ b/src/com/android/launcher3/AppsCustomizePagedView.java @@ -411,7 +411,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 + offset[0]; pos[1] += offset[1] - mLauncher.getDragLayer().getPaddingTop(); - mLauncher.showFirstRunAllAppsCling(pos); } } @@ -792,9 +791,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen public void run() { // We don't enter spring-loaded mode if the drag has been cancelled if (mLauncher.getDragController().isDragging()) { - // Dismiss the cling - mLauncher.dismissAllAppsCling(null); - // Reset the alpha on the dragged icon before we drag resetDrawableState(); diff --git a/src/com/android/launcher3/AppsCustomizeTabHost.java b/src/com/android/launcher3/AppsCustomizeTabHost.java index 8aef864b4..89e74b218 100644 --- a/src/com/android/launcher3/AppsCustomizeTabHost.java +++ b/src/com/android/launcher3/AppsCustomizeTabHost.java @@ -403,6 +403,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona if (animated) { enableAndBuildHardwareLayer(); } + + // Dismiss the workspace cling + l.dismissWorkspaceCling(null); } @Override @@ -419,8 +422,6 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona } if (!toWorkspace) { - // Dismiss the workspace cling - l.dismissWorkspaceCling(null); // Show the all apps cling (if not already shown) mAppsCustomizePane.showAllAppsCling(); // Make sure adjacent pages are loaded (we wait until after the transition to diff --git a/src/com/android/launcher3/Cling.java b/src/com/android/launcher3/Cling.java index add6da51d..963702ae2 100644 --- a/src/com/android/launcher3/Cling.java +++ b/src/com/android/launcher3/Cling.java @@ -16,6 +16,9 @@ package com.android.launcher3; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; @@ -31,40 +34,42 @@ import android.util.DisplayMetrics; import android.view.FocusFinder; import android.view.MotionEvent; import android.view.View; +import android.view.animation.AccelerateInterpolator; import android.widget.FrameLayout; -public class Cling extends FrameLayout { +public class Cling extends FrameLayout implements Insettable, View.OnLongClickListener { - 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"; + static final String FIRST_RUN_CLING_DISMISSED_KEY = "cling_gel.first_run.dismissed"; + static final String WORKSPACE_CLING_DISMISSED_KEY = "cling_gel.workspace.dismissed"; + static final String FOLDER_CLING_DISMISSED_KEY = "cling_gel.folder.dismissed"; + + private static String FIRST_RUN_PORTRAIT = "first_run_portrait"; + private static String FIRST_RUN_LANDSCAPE = "first_run_landscape"; private static String WORKSPACE_PORTRAIT = "workspace_portrait"; private static String WORKSPACE_LANDSCAPE = "workspace_landscape"; private static String WORKSPACE_LARGE = "workspace_large"; private static String WORKSPACE_CUSTOM = "workspace_custom"; - private static String ALLAPPS_PORTRAIT = "all_apps_portrait"; - private static String ALLAPPS_LANDSCAPE = "all_apps_landscape"; - private static String ALLAPPS_LARGE = "all_apps_large"; - private static String FOLDER_PORTRAIT = "folder_portrait"; private static String FOLDER_LANDSCAPE = "folder_landscape"; private static String FOLDER_LARGE = "folder_large"; + private static float FIRST_RUN_CIRCLE_BUFFER_DPS = 40; + private static float WORKSPACE_INNER_CIRCLE_RADIUS_DPS = 50; + private static float WORKSPACE_OUTER_CIRCLE_RADIUS_DPS = 60; + private static float WORKSPACE_CIRCLE_Y_OFFSET_DPS = 30; + 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 mButtonBarHeight; - private float mRevealRadius; - private int[] mPositionData; private Paint mErasePaint; + private Paint mBubblePaint; + private Paint mDotPaint; + + private final Rect mInsets = new Rect(); public Cling(Context context) { this(context, null, 0); @@ -82,60 +87,116 @@ public class Cling extends FrameLayout { a.recycle(); setClickable(true); + } void init(Launcher l, int[] positionData) { if (!mIsInitialized) { mLauncher = l; - mPositionData = positionData; - - Resources r = getContext().getResources(); - LauncherAppState app = LauncherAppState.getInstance(); - DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); - - mPunchThroughGraphic = r.getDrawable(R.drawable.cling); - mPunchThroughGraphicCenterRadius = - r.getDimensionPixelSize(R.dimen.clingPunchThroughGraphicCenterRadius); - mAppIconSize = grid.iconSizePx; - mRevealRadius = grid.iconSizePx * 1f; - mButtonBarHeight = grid.hotseatBarHeightPx; + setOnLongClickListener(this); mErasePaint = new Paint(); mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY)); mErasePaint.setColor(0xFFFFFF); mErasePaint.setAlpha(0); + mErasePaint.setAntiAlias(true); + + mBubblePaint = new Paint(); + mBubblePaint.setColor(0xFFFFFF); + mBubblePaint.setAntiAlias(true); + + mDotPaint = new Paint(); + mDotPaint.setColor(0x72BBED); + mDotPaint.setAntiAlias(true); mIsInitialized = true; } } + void show(boolean animate, int duration) { + setVisibility(View.VISIBLE); + setLayerType(View.LAYER_TYPE_HARDWARE, null); + if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) || + mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || + mDrawIdentifier.equals(WORKSPACE_LARGE) || + mDrawIdentifier.equals(WORKSPACE_CUSTOM)) { + View content = getContent(); + content.setAlpha(0f); + content.animate() + .alpha(1f) + .setDuration(duration) + .setListener(new AnimatorListenerAdapter() { + public void onAnimationEnd(Animator animation) { + }; + }) + .start(); + setAlpha(1f); + } else { + if (animate) { + buildLayer(); + setAlpha(0f); + animate() + .alpha(1f) + .setInterpolator(new AccelerateInterpolator()) + .setDuration(duration) + .start(); + } else { + setAlpha(1f); + } + } + setFocusableInTouchMode(true); + post(new Runnable() { + public void run() { + setFocusable(true); + requestFocus(); + } + }); + } + + void hide(final int duration, final Runnable postCb) { + if (mDrawIdentifier.equals(FIRST_RUN_PORTRAIT) || + mDrawIdentifier.equals(FIRST_RUN_LANDSCAPE)) { + View content = getContent(); + ObjectAnimator anim = LauncherAnimUtils.ofFloat(content, "alpha", 0f); + anim.setDuration(duration); + anim.addListener(new AnimatorListenerAdapter() { + public void onAnimationEnd(Animator animation) { + // We are about to trigger the workspace cling, so don't do anything else + setVisibility(View.GONE); + postCb.run(); + }; + }); + anim.start(); + } else { + ObjectAnimator anim = LauncherAnimUtils.ofFloat(this, "alpha", 0f); + anim.setDuration(duration); + anim.addListener(new AnimatorListenerAdapter() { + public void onAnimationEnd(Animator animation) { + setVisibility(View.GONE); + postCb.run(); + }; + }); + anim.start(); + } + } + void cleanup() { mBackground = null; - mPunchThroughGraphic = null; - mHandTouchGraphic = null; mIsInitialized = false; } - public String getDrawIdentifier() { - return mDrawIdentifier; + @Override + public void setInsets(Rect insets) { + mInsets.set(insets); + setPadding(insets.left, insets.top, insets.right, insets.bottom); } - private int[] getPunchThroughPositions() { - 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(WORKSPACE_LARGE)) { - final float scale = LauncherAppState.getInstance().getScreenDensity(); - final int cornerXOffset = (int) (scale * 15); - final int cornerYOffset = (int) (scale * 10); - return new int[]{getMeasuredWidth() - cornerXOffset, cornerYOffset}; - } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) || - mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) || - mDrawIdentifier.equals(ALLAPPS_LARGE)) { - return mPositionData; - } - return new int[]{-1, -1}; + View getContent() { + return findViewById(R.id.content); + } + + String getDrawIdentifier() { + return mDrawIdentifier; } @Override @@ -153,30 +214,12 @@ public class Cling extends FrameLayout { return (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) || mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || mDrawIdentifier.equals(WORKSPACE_LARGE) - || mDrawIdentifier.equals(ALLAPPS_PORTRAIT) - || mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) - || mDrawIdentifier.equals(ALLAPPS_LARGE) || mDrawIdentifier.equals(WORKSPACE_CUSTOM)); } @Override public boolean onTouchEvent(android.view.MotionEvent event) { - if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) || - mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || - mDrawIdentifier.equals(WORKSPACE_LARGE) || - mDrawIdentifier.equals(ALLAPPS_PORTRAIT) || - mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) || - mDrawIdentifier.equals(ALLAPPS_LARGE)) { - - int[] positions = getPunchThroughPositions(); - for (int i = 0; i < positions.length; i += 2) { - double diff = Math.sqrt(Math.pow(event.getX() - positions[i], 2) + - Math.pow(event.getY() - positions[i + 1], 2)); - if (diff < mRevealRadius) { - return false; - } - } - } else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) || + if (mDrawIdentifier.equals(FOLDER_PORTRAIT) || mDrawIdentifier.equals(FOLDER_LANDSCAPE) || mDrawIdentifier.equals(FOLDER_LARGE)) { Folder f = mLauncher.getWorkspace().getOpenFolder(); @@ -188,81 +231,94 @@ public class Cling extends FrameLayout { } } } - return true; + return super.onTouchEvent(event); }; @Override + public boolean onLongClick(View v) { + if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) || + mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || + mDrawIdentifier.equals(WORKSPACE_LARGE)) { + mLauncher.dismissWorkspaceCling(null); + return true; + } + return false; + } + + @Override protected void dispatchDraw(Canvas canvas) { if (mIsInitialized) { - DisplayMetrics metrics = new DisplayMetrics(); - mLauncher.getWindowManager().getDefaultDisplay().getMetrics(metrics); - - // Initialize the draw buffer (to allow punching through) - Bitmap b = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(), - Bitmap.Config.ARGB_8888); - Canvas c = new Canvas(b); + canvas.save(); - // Draw the background + // Get the background override if there is one if (mBackground == null) { - if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) || - mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || - mDrawIdentifier.equals(WORKSPACE_LARGE)) { - mBackground = getResources().getDrawable(R.drawable.bg_cling1); - } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) || - mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) || - mDrawIdentifier.equals(ALLAPPS_LARGE)) { - mBackground = getResources().getDrawable(R.drawable.bg_cling2); - } else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) || - mDrawIdentifier.equals(FOLDER_LANDSCAPE)) { - mBackground = getResources().getDrawable(R.drawable.bg_cling3); - } else if (mDrawIdentifier.equals(FOLDER_LARGE)) { - mBackground = getResources().getDrawable(R.drawable.bg_cling4); - } else if (mDrawIdentifier.equals(WORKSPACE_CUSTOM)) { + if (mDrawIdentifier.equals(WORKSPACE_CUSTOM)) { mBackground = getResources().getDrawable(R.drawable.bg_cling5); } } + // Draw the background + Bitmap eraseBg = null; + Canvas eraseCanvas = null; if (mBackground != null) { mBackground.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight()); - mBackground.draw(c); + mBackground.draw(canvas); + } else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) || + mDrawIdentifier.equals(FOLDER_LANDSCAPE) || + mDrawIdentifier.equals(FOLDER_LARGE)) { + canvas.drawColor(0xcc000000); + } else if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) || + mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || + mDrawIdentifier.equals(WORKSPACE_LARGE)) { + // Initialize the draw buffer (to allow punching through) + eraseBg = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(), + Bitmap.Config.ARGB_8888); + eraseCanvas = new Canvas(eraseBg); + eraseCanvas.drawColor(0xdd000000); } else { - c.drawColor(0x99000000); + canvas.drawColor(0xdd000000); } - int cx = -1; - int cy = -1; - float scale = mRevealRadius / mPunchThroughGraphicCenterRadius; - int dw = (int) (scale * mPunchThroughGraphic.getIntrinsicWidth()); - int dh = (int) (scale * mPunchThroughGraphic.getIntrinsicHeight()); - - // Determine where to draw the punch through graphic - int[] positions = getPunchThroughPositions(); - for (int i = 0; i < positions.length; i += 2) { - cx = positions[i]; - cy = positions[i + 1]; - if (cx > -1 && cy > -1) { - c.drawCircle(cx, cy, mRevealRadius, mErasePaint); - mPunchThroughGraphic.setBounds(cx - dw/2, cy - dh/2, cx + dw/2, cy + dh/2); - mPunchThroughGraphic.draw(c); - } + // Draw everything else + DisplayMetrics metrics = new DisplayMetrics(); + mLauncher.getWindowManager().getDefaultDisplay().getMetrics(metrics); + float alpha = getAlpha(); + View content = getContent(); + if (content != null) { + alpha *= content.getAlpha(); } - - // Draw the hand graphic in All Apps - if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT) || - mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) || - mDrawIdentifier.equals(ALLAPPS_LARGE)) { - 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); + if (mDrawIdentifier.equals(FIRST_RUN_PORTRAIT) || + mDrawIdentifier.equals(FIRST_RUN_LANDSCAPE)) { + // Draw the white circle + View bubbleContent = findViewById(R.id.bubble_content); + Rect bubbleRect = new Rect(); + bubbleContent.getGlobalVisibleRect(bubbleRect); + mBubblePaint.setAlpha((int) (255 * alpha)); + float buffer = DynamicGrid.pxFromDp(FIRST_RUN_CIRCLE_BUFFER_DPS, metrics); + canvas.drawCircle(metrics.widthPixels / 2, + bubbleRect.centerY(), + (bubbleContent.getMeasuredWidth() + buffer) / 2, + mBubblePaint); + } else if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) || + mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || + mDrawIdentifier.equals(WORKSPACE_LARGE)) { + int offset = DynamicGrid.pxFromDp(WORKSPACE_CIRCLE_Y_OFFSET_DPS, metrics); + mErasePaint.setAlpha((int) (128)); + eraseCanvas.drawCircle(metrics.widthPixels / 2, + metrics.heightPixels / 2 - offset, + DynamicGrid.pxFromDp(WORKSPACE_OUTER_CIRCLE_RADIUS_DPS, metrics), + mErasePaint); + mErasePaint.setAlpha(0); + eraseCanvas.drawCircle(metrics.widthPixels / 2, + metrics.heightPixels / 2 - offset, + DynamicGrid.pxFromDp(WORKSPACE_INNER_CIRCLE_RADIUS_DPS, metrics), + mErasePaint); + canvas.drawBitmap(eraseBg, 0, 0, null); + eraseCanvas.setBitmap(null); + eraseBg = null; } - canvas.drawBitmap(b, 0, 0, null); - c.setBitmap(null); - b = null; + + canvas.restore(); } // Draw the rest of the cling diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java index 6e101750f..664a99cd0 100644 --- a/src/com/android/launcher3/DynamicGrid.java +++ b/src/com/android/launcher3/DynamicGrid.java @@ -328,10 +328,12 @@ class DeviceProfile { return height / countY; } + boolean isPhone() { + return !isTablet && !isLargeTablet; + } boolean isTablet() { return isTablet; } - boolean isLargeTablet() { return isLargeTablet; } diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index 47fc6c3f4..9ee3f6454 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -453,6 +453,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList Cling cling = mLauncher.showFirstRunFoldersCling(); if (cling != null) { cling.bringToFront(); + bringToFront(); } setFocusOnFirstChild(); } @@ -878,11 +879,13 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList float scale = parent.getDescendantRectRelativeToSelf(mFolderIcon, mTempRect); + LauncherAppState app = LauncherAppState.getInstance(); + DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + int centerX = (int) (mTempRect.left + mTempRect.width() * scale / 2); int centerY = (int) (mTempRect.top + mTempRect.height() * scale / 2); int centeredLeft = centerX - width / 2; int centeredTop = centerY - height / 2; - int currentPage = mLauncher.getWorkspace().getCurrentPage(); // In case the workspace is scrolling, we need to use the final scroll to compute // the folders bounds. @@ -900,8 +903,11 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList bounds.left + bounds.width() - width); int top = Math.min(Math.max(bounds.top, centeredTop), bounds.top + bounds.height() - height); - // If the folder doesn't fit within the bounds, center it about the desired bounds - if (width >= bounds.width()) { + if (grid.isPhone() && (grid.availableWidthPx - width) < grid.iconSizePx) { + // Center the folder if it is full (on phones only) + left = (grid.availableWidthPx - width) / 2; + } else if (width >= bounds.width()) { + // If the folder doesn't fit within the bounds, center it about the desired bounds left = bounds.left + (bounds.width() - width) / 2; } if (height >= bounds.height()) { diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 89d4cb379..3bbb39ee3 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -202,8 +202,8 @@ public 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 SHOW_CLING_DURATION = 550; - private static final int DISMISS_CLING_DURATION = 250; + private static final int SHOW_CLING_DURATION = 250; + private static final int DISMISS_CLING_DURATION = 200; private static final Object sLock = new Object(); private static int sScreen = DEFAULT_SCREEN; @@ -422,7 +422,6 @@ public class Launcher extends Activity setContentView(R.layout.launcher); setupViews(); grid.layout(this); - showFirstRunWorkspaceCling(); registerContentObservers(); @@ -464,6 +463,8 @@ public class Launcher extends Activity // On large interfaces, we want the screen to auto-rotate based on the current orientation unlockScreenOrientation(true); + + showFirstRunCling(); } protected void onUserLeaveHint() { @@ -4080,47 +4081,30 @@ public class Launcher extends Activity return true; } - private Cling initCling(int clingId, int[] positionData, boolean animate, int delay) { + private Cling initCling(int clingId, int[] positionData, boolean animate, + boolean dimNavBarVisibilty) { final 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 AccelerateInterpolator()) - .setDuration(SHOW_CLING_DURATION) - .setStartDelay(delay) - .start(); - } else { - cling.setAlpha(1f); + cling.show(animate, SHOW_CLING_DURATION); + + if (dimNavBarVisibilty) { + cling.setSystemUiVisibility(cling.getSystemUiVisibility() | + View.SYSTEM_UI_FLAG_LOW_PROFILE); } - cling.setFocusableInTouchMode(true); - cling.post(new Runnable() { - public void run() { - cling.setFocusable(true); - cling.requestFocus(); - } - }); - mHideFromAccessibilityHelper.setImportantForAccessibilityToNo( - mDragLayer, clingId == R.id.all_apps_cling); } return cling; } - private void dismissCling(final Cling cling, final String flag, int duration) { + private void dismissCling(final Cling cling, final Runnable postAnimationCb, + final String flag, int duration, boolean restoreNavBarVisibilty) { // To catch cases where siblings of top-level views are made invisible, just check whether // the cling is directly set to GONE before dismissing it. if (cling != null && cling.getVisibility() != View.GONE) { - ObjectAnimator anim = LauncherAnimUtils.ofFloat(cling, "alpha", 0f); - anim.setDuration(duration); - anim.addListener(new AnimatorListenerAdapter() { - public void onAnimationEnd(Animator animation) { - cling.setVisibility(View.GONE); + final Runnable cleanUpClingCb = new Runnable() { + public void run() { cling.cleanup(); + /* // We should update the shared preferences on a background thread new Thread("dismissClingThread") { public void run() { @@ -4129,10 +4113,23 @@ public class Launcher extends Activity editor.commit(); } }.start(); - }; - }); - anim.start(); + */ + if (postAnimationCb != null) { + postAnimationCb.run(); + } + } + }; + if (duration <= 0) { + cleanUpClingCb.run(); + } else { + cling.hide(duration, cleanUpClingCb); + } mHideFromAccessibilityHelper.restoreImportantForAccessibility(mDragLayer); + + if (restoreNavBarVisibilty) { + cling.setSystemUiVisibility(cling.getSystemUiVisibility() & + ~View.SYSTEM_UI_FLAG_LOW_PROFILE); + } } } @@ -4162,10 +4159,9 @@ public class Launcher extends Activity return false; } - public void showFirstRunWorkspaceCling() { - // Enable the clings only if they have not been dismissed before + public void showFirstRunCling() { if (isClingsEnabled() && - !mSharedPrefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false) && + !mSharedPrefs.getBoolean(Cling.FIRST_RUN_CLING_DISMISSED_KEY, false) && !skipCustomClingIfNoAccounts() ) { // If we're not using the default workspace layout, replace workspace cling // with a custom workspace cling (usually specified in an overlay) @@ -4181,25 +4177,27 @@ public class Launcher extends Activity clingParent.addView(customCling, clingIndex); customCling.setId(R.id.workspace_cling); } - initCling(R.id.workspace_cling, null, false, 0); + initCling(R.id.first_run_cling, null, false, true); } else { - removeCling(R.id.workspace_cling); + removeCling(R.id.first_run_cling); } } - public void showFirstRunAllAppsCling(int[] position) { + + public void showFirstRunWorkspaceCling() { // Enable the clings only if they have not been dismissed before if (isClingsEnabled() && - !mSharedPrefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) { - initCling(R.id.all_apps_cling, position, true, 0); + !mSharedPrefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) { + initCling(R.id.workspace_cling, null, false, true); } else { - removeCling(R.id.all_apps_cling); + removeCling(R.id.workspace_cling); } } public Cling showFirstRunFoldersCling() { // Enable the clings only if they have not been dismissed before if (isClingsEnabled() && !mSharedPrefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) { - return initCling(R.id.folder_cling, null, true, 0); + Cling cling = initCling(R.id.folder_cling, null, true, true); + return cling; } else { removeCling(R.id.folder_cling); return null; @@ -4215,17 +4213,34 @@ public class Launcher extends Activity } return false; } + public void dismissFirstRunCling(View v) { + Cling cling = (Cling) findViewById(R.id.first_run_cling); + Runnable cb = new Runnable() { + public void run() { + // Show the workspace cling next + showFirstRunWorkspaceCling(); + } + }; + dismissCling(cling, cb, Cling.FIRST_RUN_CLING_DISMISSED_KEY, + DISMISS_CLING_DURATION, false); + } public void dismissWorkspaceCling(View v) { Cling cling = (Cling) findViewById(R.id.workspace_cling); - 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, Cling.ALLAPPS_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION); + Runnable cb = null; + if (v == null) { + cb = new Runnable() { + public void run() { + mWorkspace.enterOverviewMode(); + } + }; + } + dismissCling(cling, cb, Cling.WORKSPACE_CLING_DISMISSED_KEY, + DISMISS_CLING_DURATION, true); } public void dismissFolderCling(View v) { Cling cling = (Cling) findViewById(R.id.folder_cling); - dismissCling(cling, Cling.FOLDER_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION); + dismissCling(cling, null, Cling.FOLDER_CLING_DISMISSED_KEY, + DISMISS_CLING_DURATION, true); } /** |