Merge "Updating Clings. (5057945, 5056643)" into ics-factoryrom

This commit is contained in:
Adam Cohen
2011-09-19 11:45:52 -07:00
committed by Android (Google) Code Review
54 changed files with 515 additions and 334 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 B

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 255 B

+2 -2
View File
@@ -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>
+24 -20
View File
@@ -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>
+57
View File
@@ -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>
+6
View File
@@ -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>
+33 -27
View File
@@ -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>
+19 -16
View File
@@ -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>
+58
View File
@@ -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>
+6
View File
@@ -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>
+31 -25
View File
@@ -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>
+2
View File
@@ -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"
+2
View File
@@ -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 -->
+2
View File
@@ -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>
+4
View File
@@ -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
-3
View File
@@ -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>
+12 -7
View File
@@ -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>
+7 -6
View File
@@ -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>
@@ -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())
@@ -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);
}
}
}
+111 -185
View File
@@ -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;
View mWorkspaceDesc1;
View mWorkspaceDesc2;
View mAllAppsDesc;
private Paint mErasePaint;
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);
};
}
+1 -1
View File
@@ -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)) {
+2
View File
@@ -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];
+100 -36
View File
@@ -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);
cling.setVisibility(View.VISIBLE);
}
return true;
}
private void dismissCling(final Cling cling, final String flag) {
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, 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);
}
+2 -2
View File
@@ -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 =
@@ -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));