merge in ics-release history after reset to master
diff --git a/res/drawable-hdpi/app_market_generic.png b/res/drawable-hdpi/app_market_generic.png
deleted file mode 100644
index 117453c..0000000
--- a/res/drawable-hdpi/app_market_generic.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/default_widget_preview_holo.9.png b/res/drawable-hdpi/default_widget_preview_holo.9.png
new file mode 100644
index 0000000..ecf5deb
--- /dev/null
+++ b/res/drawable-hdpi/default_widget_preview_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/gardening_crosshairs.png b/res/drawable-hdpi/gardening_crosshairs.png
index 409bb5d..5f83592 100644
--- a/res/drawable-hdpi/gardening_crosshairs.png
+++ b/res/drawable-hdpi/gardening_crosshairs.png
Binary files differ
diff --git a/res/drawable-hdpi/homescreen_blue_normal_holo.9.png b/res/drawable-hdpi/homescreen_blue_normal_holo.9.png
new file mode 100644
index 0000000..ece2afd
--- /dev/null
+++ b/res/drawable-hdpi/homescreen_blue_normal_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/homescreen_blue_strong_holo.9.png b/res/drawable-hdpi/homescreen_blue_strong_holo.9.png
new file mode 100644
index 0000000..3407107
--- /dev/null
+++ b/res/drawable-hdpi/homescreen_blue_strong_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/homescreen_green_normal_holo.9.png b/res/drawable-hdpi/homescreen_green_normal_holo.9.png
new file mode 100644
index 0000000..7332c3b
--- /dev/null
+++ b/res/drawable-hdpi/homescreen_green_normal_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/homescreen_green_strong_holo.9.png b/res/drawable-hdpi/homescreen_green_strong_holo.9.png
new file mode 100644
index 0000000..190c6cc
--- /dev/null
+++ b/res/drawable-hdpi/homescreen_green_strong_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/homescreen_large_blue.9.png b/res/drawable-hdpi/homescreen_large_blue.9.png
deleted file mode 100644
index 416514d..0000000
--- a/res/drawable-hdpi/homescreen_large_blue.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/homescreen_large_blue_strong.9.png b/res/drawable-hdpi/homescreen_large_blue_strong.9.png
deleted file mode 100644
index d7e32e7..0000000
--- a/res/drawable-hdpi/homescreen_large_blue_strong.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/homescreen_large_green.9.png b/res/drawable-hdpi/homescreen_large_green.9.png
deleted file mode 100644
index 60042c2..0000000
--- a/res/drawable-hdpi/homescreen_large_green.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/homescreen_large_green_strong.9.png b/res/drawable-hdpi/homescreen_large_green_strong.9.png
deleted file mode 100644
index c40b98e..0000000
--- a/res/drawable-hdpi/homescreen_large_green_strong.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/hotseat_scrubber_holo.9.png b/res/drawable-hdpi/hotseat_scrubber_holo.9.png
new file mode 100644
index 0000000..78b540d
--- /dev/null
+++ b/res/drawable-hdpi/hotseat_scrubber_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/hotseat_track_holo.9.png b/res/drawable-hdpi/hotseat_track_holo.9.png
new file mode 100644
index 0000000..ca495ff
--- /dev/null
+++ b/res/drawable-hdpi/hotseat_track_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_home_delete_holo_dark.png b/res/drawable-hdpi/ic_home_delete_holo_dark.png
deleted file mode 100644
index 9d64278..0000000
--- a/res/drawable-hdpi/ic_home_delete_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_home_delete_hover_holo_dark.png b/res/drawable-hdpi/ic_home_delete_hover_holo_dark.png
deleted file mode 100644
index 60d5b15..0000000
--- a/res/drawable-hdpi/ic_home_delete_hover_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_home_info_holo_dark.png b/res/drawable-hdpi/ic_home_info_holo_dark.png
deleted file mode 100644
index 02df4e1..0000000
--- a/res/drawable-hdpi/ic_home_info_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_info_active_holo.png b/res/drawable-hdpi/ic_launcher_info_active_holo.png
new file mode 100644
index 0000000..83ca112
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_info_active_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_info_normal_holo.png b/res/drawable-hdpi/ic_launcher_info_normal_holo.png
new file mode 100644
index 0000000..25fb1ac
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_info_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_market_holo.png b/res/drawable-hdpi/ic_launcher_market_holo.png
new file mode 100644
index 0000000..dc78251
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_market_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_trashcan_active_holo.png b/res/drawable-hdpi/ic_launcher_trashcan_active_holo.png
new file mode 100644
index 0000000..51f0298
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_trashcan_active_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_trashcan_normal_holo.png b/res/drawable-hdpi/ic_launcher_trashcan_normal_holo.png
new file mode 100644
index 0000000..27a4b5e
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_trashcan_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/page_hover_left.9.png b/res/drawable-hdpi/page_hover_left.9.png
deleted file mode 100644
index 1bf1565..0000000
--- a/res/drawable-hdpi/page_hover_left.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/page_hover_left_holo.9.png b/res/drawable-hdpi/page_hover_left_holo.9.png
new file mode 100644
index 0000000..0f405a5
--- /dev/null
+++ b/res/drawable-hdpi/page_hover_left_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/page_hover_right.9.png b/res/drawable-hdpi/page_hover_right.9.png
deleted file mode 100644
index 7995f69..0000000
--- a/res/drawable-hdpi/page_hover_right.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/page_hover_right_holo.9.png b/res/drawable-hdpi/page_hover_right_holo.9.png
new file mode 100644
index 0000000..b7b4c56
--- /dev/null
+++ b/res/drawable-hdpi/page_hover_right_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/paged_view_indicator.9.png b/res/drawable-hdpi/paged_view_indicator.9.png
deleted file mode 100644
index 9fd357a..0000000
--- a/res/drawable-hdpi/paged_view_indicator.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/portal_container_holo.9.png b/res/drawable-hdpi/portal_container_holo.9.png
index e2a1bd5..ab846f6 100644
--- a/res/drawable-hdpi/portal_container_holo.9.png
+++ b/res/drawable-hdpi/portal_container_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/app_market_generic.png b/res/drawable-mdpi/app_market_generic.png
deleted file mode 100644
index 6eb5497..0000000
--- a/res/drawable-mdpi/app_market_generic.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/default_widget_preview.9.png b/res/drawable-mdpi/default_widget_preview.9.png
deleted file mode 100644
index ed9c6ee..0000000
--- a/res/drawable-mdpi/default_widget_preview.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/default_widget_preview_holo.9.png b/res/drawable-mdpi/default_widget_preview_holo.9.png
new file mode 100644
index 0000000..d8e1196
--- /dev/null
+++ b/res/drawable-mdpi/default_widget_preview_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/gardening_crosshairs.png b/res/drawable-mdpi/gardening_crosshairs.png
index 338c832..2845fe4 100644
--- a/res/drawable-mdpi/gardening_crosshairs.png
+++ b/res/drawable-mdpi/gardening_crosshairs.png
Binary files differ
diff --git a/res/drawable-mdpi/homescreen_blue_normal_holo.9.png b/res/drawable-mdpi/homescreen_blue_normal_holo.9.png
new file mode 100644
index 0000000..fef82bb
--- /dev/null
+++ b/res/drawable-mdpi/homescreen_blue_normal_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/homescreen_blue_strong_holo.9.png b/res/drawable-mdpi/homescreen_blue_strong_holo.9.png
new file mode 100644
index 0000000..fdd9dbb
--- /dev/null
+++ b/res/drawable-mdpi/homescreen_blue_strong_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/homescreen_green_normal_holo.9.png b/res/drawable-mdpi/homescreen_green_normal_holo.9.png
new file mode 100644
index 0000000..dad34d8
--- /dev/null
+++ b/res/drawable-mdpi/homescreen_green_normal_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/homescreen_green_strong_holo.9.png b/res/drawable-mdpi/homescreen_green_strong_holo.9.png
new file mode 100644
index 0000000..901bf4c
--- /dev/null
+++ b/res/drawable-mdpi/homescreen_green_strong_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/homescreen_large_blue.9.png b/res/drawable-mdpi/homescreen_large_blue.9.png
deleted file mode 100644
index 5e7e61f..0000000
--- a/res/drawable-mdpi/homescreen_large_blue.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/homescreen_large_green.9.png b/res/drawable-mdpi/homescreen_large_green.9.png
deleted file mode 100644
index 2f83bac..0000000
--- a/res/drawable-mdpi/homescreen_large_green.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/homescreen_large_green_strong.9.png b/res/drawable-mdpi/homescreen_large_green_strong.9.png
deleted file mode 100644
index 1e14502..0000000
--- a/res/drawable-mdpi/homescreen_large_green_strong.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/hotseat_scrubber_holo.9.png b/res/drawable-mdpi/hotseat_scrubber_holo.9.png
new file mode 100644
index 0000000..8b7e109
--- /dev/null
+++ b/res/drawable-mdpi/hotseat_scrubber_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/hotseat_track_holo.9.png b/res/drawable-mdpi/hotseat_track_holo.9.png
new file mode 100644
index 0000000..a542cb7
--- /dev/null
+++ b/res/drawable-mdpi/hotseat_track_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_home_delete_holo_dark.png b/res/drawable-mdpi/ic_home_delete_holo_dark.png
deleted file mode 100644
index 647fd80..0000000
--- a/res/drawable-mdpi/ic_home_delete_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_home_delete_hover_holo_dark.png b/res/drawable-mdpi/ic_home_delete_hover_holo_dark.png
deleted file mode 100644
index 06b62e2..0000000
--- a/res/drawable-mdpi/ic_home_delete_hover_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_home_info_holo_dark.png b/res/drawable-mdpi/ic_home_info_holo_dark.png
deleted file mode 100644
index c34f443..0000000
--- a/res/drawable-mdpi/ic_home_info_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_info_active_holo.png b/res/drawable-mdpi/ic_launcher_info_active_holo.png
new file mode 100644
index 0000000..d05de74
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_info_active_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_info_normal_holo.png b/res/drawable-mdpi/ic_launcher_info_normal_holo.png
new file mode 100644
index 0000000..6a07cc9
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_info_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_market_holo.png b/res/drawable-mdpi/ic_launcher_market_holo.png
new file mode 100644
index 0000000..cacb374
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_market_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_trashcan_active_holo.png b/res/drawable-mdpi/ic_launcher_trashcan_active_holo.png
new file mode 100644
index 0000000..244fe27
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_trashcan_active_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_trashcan_normal_holo.png b/res/drawable-mdpi/ic_launcher_trashcan_normal_holo.png
new file mode 100644
index 0000000..bd5db08
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_trashcan_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/page_hover_left.9.png b/res/drawable-mdpi/page_hover_left.9.png
deleted file mode 100644
index 5d5e0c8..0000000
--- a/res/drawable-mdpi/page_hover_left.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/page_hover_left_holo.9.png b/res/drawable-mdpi/page_hover_left_holo.9.png
new file mode 100644
index 0000000..b9368fb
--- /dev/null
+++ b/res/drawable-mdpi/page_hover_left_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/page_hover_right.9.png b/res/drawable-mdpi/page_hover_right.9.png
deleted file mode 100644
index 1545bfe..0000000
--- a/res/drawable-mdpi/page_hover_right.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/page_hover_right_holo.9.png b/res/drawable-mdpi/page_hover_right_holo.9.png
new file mode 100644
index 0000000..53ba807
--- /dev/null
+++ b/res/drawable-mdpi/page_hover_right_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/portal_container_holo.9.png b/res/drawable-mdpi/portal_container_holo.9.png
index 7eef5d7..56a5b87 100644
--- a/res/drawable-mdpi/portal_container_holo.9.png
+++ b/res/drawable-mdpi/portal_container_holo.9.png
Binary files differ
diff --git a/res/drawable/delete_zone_selector.xml b/res/drawable/delete_target_selector.xml
similarity index 83%
rename from res/drawable/delete_zone_selector.xml
rename to res/drawable/delete_target_selector.xml
index e2b37f4..229942e 100644
--- a/res/drawable/delete_zone_selector.xml
+++ b/res/drawable/delete_target_selector.xml
@@ -19,6 +19,6 @@
-->
<transition xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/ic_home_delete_holo_dark" />
- <item android:drawable="@drawable/ic_home_delete_hover_holo_dark" />
+ <item android:drawable="@drawable/ic_launcher_trashcan_normal_holo" />
+ <item android:drawable="@drawable/ic_launcher_trashcan_active_holo" />
</transition>
diff --git a/res/drawable/delete_zone_selector.xml b/res/drawable/info_target_selector.xml
similarity index 78%
copy from res/drawable/delete_zone_selector.xml
copy to res/drawable/info_target_selector.xml
index e2b37f4..f3a7016 100644
--- a/res/drawable/delete_zone_selector.xml
+++ b/res/drawable/info_target_selector.xml
@@ -2,7 +2,7 @@
<!--
/*
**
-** Copyright 2007, The Android Open Source Project
+** Copyright 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.
@@ -19,6 +19,6 @@
-->
<transition xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/ic_home_delete_holo_dark" />
- <item android:drawable="@drawable/ic_home_delete_hover_holo_dark" />
+ <item android:drawable="@drawable/ic_launcher_info_normal_holo" />
+ <item android:drawable="@drawable/ic_launcher_info_active_holo" />
</transition>
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 3c5e0df..d2f52c8 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -39,6 +39,14 @@
<include android:id="@+id/cell4" layout="@layout/workspace_screen" />
<include android:id="@+id/cell5" layout="@layout/workspace_screen" />
</com.android.launcher2.Workspace>
+
+ <ImageView
+ android:id="@+id/paged_view_indicator_track"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:scaleType="fitXY"
+ android:src="@drawable/hotseat_track_holo" />
<ImageView
android:id="@+id/paged_view_indicator"
android:layout_width="wrap_content"
@@ -47,7 +55,7 @@
android:visibility="gone"
android:alpha="0"
android:scaleType="fitXY"
- android:src="@drawable/paged_view_indicator" />
+ android:src="@drawable/hotseat_scrubber_holo" />
<include layout="@layout/qsb_bar"
android:id="@+id/qsb_bar"
diff --git a/res/layout-large/button_bar.xml b/res/layout-large/button_bar.xml
index a060761..8d7f5df 100644
--- a/res/layout-large/button_bar.xml
+++ b/res/layout-large/button_bar.xml
@@ -136,7 +136,7 @@
android:id="@+id/delete_zone"
android:text="@string/delete_zone_label_workspace"
android:drawablePadding="@dimen/delete_zone_drawable_padding"
- android:drawableLeft="@drawable/delete_zone_selector"
+ android:drawableLeft="@drawable/delete_target_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/configure_button"
diff --git a/res/layout-large/qsb_bar.xml b/res/layout-large/qsb_bar.xml
index 421ace2..b600eda 100644
--- a/res/layout-large/qsb_bar.xml
+++ b/res/layout-large/qsb_bar.xml
@@ -113,7 +113,7 @@
style="@style/DropTargetButton"
android:id="@+id/delete_target_text"
android:text="@string/delete_zone_label_workspace"
- android:drawableLeft="@drawable/delete_zone_selector" />
+ android:drawableLeft="@drawable/delete_target_selector" />
</com.android.launcher2.DeleteDropTarget>
<com.android.launcher2.InfoDropTarget
@@ -125,7 +125,7 @@
style="@style/DropTargetButton"
android:id="@+id/info_target_text"
android:text="@string/info_target_label"
- android:drawableLeft="@drawable/ic_home_info_holo_dark" />
+ android:drawableLeft="@drawable/info_target_selector" />
</com.android.launcher2.InfoDropTarget>
</LinearLayout>
</com.android.launcher2.SearchDropTargetBar>
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index d2b9275..acb3b47 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -37,16 +37,25 @@
<include android:id="@+id/cell4" layout="@layout/workspace_screen" />
<include android:id="@+id/cell5" layout="@layout/workspace_screen" />
</com.android.launcher2.Workspace>
+
+ <ImageView
+ android:id="@+id/paged_view_indicator_track"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:layout_marginBottom="@dimen/button_bar_height"
+ android:scaleType="fitXY"
+ android:src="@drawable/hotseat_track_holo" />
<ImageView
android:id="@+id/paged_view_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
+ android:layout_marginBottom="@dimen/button_bar_height"
android:visibility="gone"
- android:paddingBottom="@dimen/button_bar_height"
android:alpha="0"
android:scaleType="fitXY"
- android:src="@drawable/paged_view_indicator" />
+ android:src="@drawable/hotseat_scrubber_holo" />
<include layout="@layout/qsb_bar"
android:id="@+id/qsb_bar"
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index 8b1bd39..ecb10ec 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -73,7 +73,15 @@
launcher:widgetCellWidthGap="@dimen/apps_customize_widget_cell_width_gap"
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:widgetCountY="@integer/apps_customize_widget_cell_count_y"
+ launcher:maxGap="@dimen/workspace_max_gap" />
+ <ImageView
+ android:id="@+id/paged_view_indicator_track"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:scaleType="fitXY"
+ android:src="@drawable/hotseat_track_holo" />
<ImageView
android:id="@+id/paged_view_indicator"
android:layout_width="wrap_content"
@@ -82,7 +90,7 @@
android:visibility="gone"
android:alpha="0"
android:scaleType="fitXY"
- android:src="@drawable/paged_view_indicator" />
+ android:src="@drawable/hotseat_scrubber_holo" />
</FrameLayout>
</LinearLayout>
</com.android.launcher2.AppsCustomizeTabHost>
diff --git a/res/layout/qsb_bar.xml b/res/layout/qsb_bar.xml
index cb97b01..21043b4 100644
--- a/res/layout/qsb_bar.xml
+++ b/res/layout/qsb_bar.xml
@@ -74,7 +74,7 @@
style="@style/DropTargetButton"
android:id="@+id/delete_target_text"
android:text="@string/delete_zone_label_workspace"
- android:drawableLeft="@drawable/delete_zone_selector" />
+ android:drawableLeft="@drawable/delete_target_selector" />
</com.android.launcher2.DeleteDropTarget>
<com.android.launcher2.InfoDropTarget
@@ -86,7 +86,7 @@
style="@style/DropTargetButton"
android:id="@+id/info_target_text"
android:text="@string/info_target_label"
- android:drawableLeft="@drawable/ic_home_info_holo_dark" />
+ android:drawableLeft="@drawable/info_target_selector" />
</com.android.launcher2.InfoDropTarget>
</LinearLayout>
</com.android.launcher2.SearchDropTargetBar>
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index 4540c15..278da54 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -31,12 +31,12 @@
<integer name="all_apps_view_cellCountX">6</integer>
<integer name="all_apps_view_cellCountY">3</integer>
- <dimen name="all_apps_view_pageLayoutWidthGap">10dp</dimen>
- <dimen name="all_apps_view_pageLayoutHeightGap">5dp</dimen>
- <dimen name="all_apps_view_pageLayoutPaddingTop">4dp</dimen>
- <dimen name="all_apps_view_pageLayoutPaddingBottom">4dp</dimen>
- <dimen name="all_apps_view_pageLayoutPaddingLeft">2dp</dimen>
- <dimen name="all_apps_view_pageLayoutPaddingRight">2dp</dimen>
+ <dimen name="all_apps_view_pageLayoutWidthGap">-1dp</dimen>
+ <dimen name="all_apps_view_pageLayoutHeightGap">-1dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingTop">5dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingBottom">5dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingLeft">5dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingRight">5dp</dimen>
<!-- AppsCustomize -->
<dimen name="apps_customize_widget_cell_width_gap">30dp</dimen>
diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml
index 8b423dd..945699b 100644
--- a/res/values-port/dimens.xml
+++ b/res/values-port/dimens.xml
@@ -29,12 +29,12 @@
<integer name="all_apps_view_cellCountX">4</integer>
<integer name="all_apps_view_cellCountY">5</integer>
- <dimen name="all_apps_view_pageLayoutWidthGap">0dp</dimen>
- <dimen name="all_apps_view_pageLayoutHeightGap">8dp</dimen>
+ <dimen name="all_apps_view_pageLayoutWidthGap">-1dp</dimen>
+ <dimen name="all_apps_view_pageLayoutHeightGap">-1dp</dimen>
<dimen name="all_apps_view_pageLayoutPaddingTop">15dp</dimen>
<dimen name="all_apps_view_pageLayoutPaddingBottom">15dp</dimen>
- <dimen name="all_apps_view_pageLayoutPaddingLeft">0dp</dimen>
- <dimen name="all_apps_view_pageLayoutPaddingRight">0dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingLeft">5dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingRight">5dp</dimen>
<dimen name="apps_customize_widget_cell_width_gap">20dp</dimen>
<dimen name="apps_customize_widget_cell_height_gap">10dp</dimen>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index fd7b21c..ae73b04 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -20,8 +20,8 @@
<resources>
<!-- The color tints to apply to the text and drag view when hovering
over the delete target or the info target -->
- <color name="delete_target_hover_tint">#D4FF3600</color>
- <color name="info_target_hover_tint">#D40078FF</color>
+ <color name="delete_target_hover_tint">#DAFF0000</color>
+ <color name="info_target_hover_tint">#DA0099CC</color>
<color name="window_background">#FF191919</color>
<color name="grid_dark_background">#EB191919</color>
diff --git a/res/values/config.xml b/res/values/config.xml
index 70ee423..5b73769 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -67,7 +67,7 @@
<integer name="config_dropAnimMaxDuration">400</integer>
<!-- The duration of the UserFolder opening and closing animation -->
- <integer name="config_folderAnimDuration">100</integer>
+ <integer name="config_folderAnimDuration">120</integer>
<!-- The distance at which the animation should take the max duration -->
<integer name="config_dropAnimMaxDist">800</integer>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 52110bd..2a54981 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -32,8 +32,8 @@
<dimen name="app_icon_size">56dp</dimen>
<dimen name="apps_customize_cell_width">72dp</dimen>
<dimen name="apps_customize_cell_height">72dp</dimen>
- <!-- In portrat/normal, we peek only 1/8th the app cell width -->
- <dimen name="apps_customize_peek_width">9dp</dimen>
+ <dimen name="apps_customize_peek_width">0dp</dimen>
+ <dimen name="apps_customize_max_gap">18dp</dimen>
<dimen name="apps_customize_widget_cell_width_gap">10dp</dimen>
<dimen name="apps_customize_widget_cell_height_gap">10dp</dimen>
<dimen name="title_texture_width">120px</dimen>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 54a2e42..2a4af44 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -204,7 +204,7 @@
// Save the default widget preview background
Resources resources = context.getResources();
- mDefaultWidgetBackground = resources.getDrawable(R.drawable.default_widget_preview);
+ mDefaultWidgetBackground = resources.getDrawable(R.drawable.default_widget_preview_holo);
mAppIconSize = getResources().getDimensionPixelSize(R.dimen.app_icon_size);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, 0, 0);
@@ -283,6 +283,10 @@
mShortcutCountX = Math.max(1, (int) Math.round(mCellCountX / 2f));
mShortcutCountY = Math.max(1, (int) Math.round(mCellCountY / 2f));
+ // Force a measure to update recalculate the gaps
+ int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
+ int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
+ mWidgetSpacingLayout.measure(widthSpec, heightSpec);
mContentWidth = mWidgetSpacingLayout.getContentWidth();
invalidatePageData();
@@ -537,7 +541,7 @@
// expected page width, so we can actually optimize by hiding all the TextView-based
// children that are expensive to measure, and let that happen naturally later.
setVisibilityOnChildren(layout, View.GONE);
- int widthSpec = MeasureSpec.makeMeasureSpec(getPageContentWidth(), MeasureSpec.AT_MOST);
+ int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
layout.setMinimumWidth(getPageContentWidth());
layout.measure(widthSpec, heightSpec);
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 587a3eb..2623586 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -152,6 +152,12 @@
ObjectAnimator anim = ObjectAnimator.ofFloat(mAppsCustomizePane, "alpha", 1f);
anim.setDuration(duration);
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(android.animation.Animator animation) {
+ mAppsCustomizePane.flashScrollingIndicator();
+ }
+ });
anim.start();
}
});
@@ -212,5 +218,7 @@
if (animation != null) {
setLayerType(LAYER_TYPE_NONE, null);
}
+
+ mAppsCustomizePane.flashScrollingIndicator();
}
}
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 68e9edb..a9cdb87 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -153,7 +153,6 @@
mWidthGap = a.getDimensionPixelSize(R.styleable.CellLayout_widthGap, 0);
mHeightGap = a.getDimensionPixelSize(R.styleable.CellLayout_heightGap, 0);
mMaxGap = a.getDimensionPixelSize(R.styleable.CellLayout_maxGap, 0);
-
mCountX = LauncherModel.getCellCountX();
mCountY = LauncherModel.getCellCountY();
mOccupied = new boolean[mCountX][mCountY];
@@ -164,9 +163,9 @@
final Resources res = getResources();
- mNormalBackground = res.getDrawable(R.drawable.homescreen_large_blue);
- mActiveBackground = res.getDrawable(R.drawable.homescreen_large_green);
- mActiveGlowBackground = res.getDrawable(R.drawable.homescreen_large_green_strong);
+ mNormalBackground = res.getDrawable(R.drawable.homescreen_blue_normal_holo);
+ mActiveBackground = res.getDrawable(R.drawable.homescreen_green_normal_holo);
+ mActiveGlowBackground = res.getDrawable(R.drawable.homescreen_green_strong_holo);
mNormalBackgroundMini = res.getDrawable(R.drawable.homescreen_small_blue);
mNormalGlowBackgroundMini = res.getDrawable(R.drawable.homescreen_small_blue_strong);
@@ -1384,13 +1383,11 @@
*
* @param child The child that is being dropped
*/
- void onDropChild(View child, boolean animate) {
+ void onDropChild(View child) {
if (child != null) {
LayoutParams lp = (LayoutParams) child.getLayoutParams();
lp.isDragging = false;
lp.dropped = true;
- lp.animateDrop = animate;
- child.setVisibility(animate ? View.INVISIBLE : View.VISIBLE);
child.requestLayout();
}
}
@@ -1717,22 +1714,8 @@
@ViewDebug.ExportedProperty
int y;
- /**
- * The old X coordinate of this item, relative to its current parent.
- * Used to animate the item into its new position.
- */
- int oldX;
-
- /**
- * The old Y coordinate of this item, relative to its current parent.
- * Used to animate the item into its new position.
- */
- int oldY;
-
boolean dropped;
- boolean animateDrop;
-
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);
cellHSpan = 1;
diff --git a/src/com/android/launcher2/CellLayoutChildren.java b/src/com/android/launcher2/CellLayoutChildren.java
index 1caecc0..615740e 100644
--- a/src/com/android/launcher2/CellLayoutChildren.java
+++ b/src/com/android/launcher2/CellLayoutChildren.java
@@ -117,15 +117,6 @@
WallpaperManager.COMMAND_DROP,
cellXY[0] + childLeft + lp.width / 2,
cellXY[1] + childTop + lp.height / 2, 0, null);
-
- if (lp.animateDrop) {
- lp.animateDrop = false;
-
- // This call does not result in a requestLayout(), but at one point did.
- // We need to be cautious about any method calls within the layout pass
- // to insure we don't leave the view tree in a bad state.
- ((Workspace) mParent.getParent()).animateViewIntoPosition(child);
- }
}
}
}
diff --git a/src/com/android/launcher2/DeleteDropTarget.java b/src/com/android/launcher2/DeleteDropTarget.java
index a30c03e..6e01bc0 100644
--- a/src/com/android/launcher2/DeleteDropTarget.java
+++ b/src/com/android/launcher2/DeleteDropTarget.java
@@ -16,16 +16,14 @@
package com.android.launcher2;
-import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
+import android.graphics.drawable.TransitionDrawable;
import android.util.AttributeSet;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.TextView;
import com.android.launcher.R;
@@ -33,6 +31,7 @@
public class DeleteDropTarget extends ButtonDropTarget {
private TextView mText;
+ private TransitionDrawable mDrawable;
private int mHoverColor = 0xFFFF0000;
public DeleteDropTarget(Context context, AttributeSet attrs) {
@@ -55,8 +54,8 @@
mHoverColor = r.getColor(R.color.delete_target_hover_tint);
mHoverPaint.setColorFilter(new PorterDuffColorFilter(
mHoverColor, PorterDuff.Mode.SRC_ATOP));
- setBackgroundColor(mHoverColor);
- getBackground().setAlpha(0);
+ mDrawable = (TransitionDrawable) mText.getCompoundDrawables()[0];
+ mDrawable.setCrossFadeEnabled(true);
// Remove the text in the Phone UI in landscape
int orientation = getResources().getConfiguration().orientation;
@@ -127,18 +126,13 @@
public void onDragEnter(DragObject d) {
super.onDragEnter(d);
- ObjectAnimator anim = ObjectAnimator.ofInt(getBackground(), "alpha",
- Color.alpha(mHoverColor));
- anim.setDuration(mTransitionDuration);
- anim.start();
+ mDrawable.startTransition(mTransitionDuration);
}
public void onDragExit(DragObject d) {
super.onDragExit(d);
- ObjectAnimator anim = ObjectAnimator.ofInt(getBackground(), "alpha", 0);
- anim.setDuration(mTransitionDuration);
- anim.start();
+ mDrawable.resetTransition();
}
public void onDrop(DragObject d) {
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 5b1b20a..ca72ce9 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -81,9 +81,6 @@
/** Info about the screen for clamping. */
private DisplayMetrics mDisplayMetrics = new DisplayMetrics();
- /** Original view that is being dragged. */
- private View mOriginator;
-
/** the area at the edge of the screen that makes the workspace go left
* or right while you're dragging.
*/
@@ -178,8 +175,6 @@
*/
public void startDrag(View v, DragSource source, Object dragInfo, int dragAction,
Rect dragRegion) {
- mOriginator = v;
-
Bitmap b = getViewBitmap(v);
if (b == null) {
@@ -214,8 +209,6 @@
*/
public void startDrag(View v, Bitmap bmp, DragSource source, Object dragInfo, int dragAction,
Rect dragRegion) {
- mOriginator = v;
-
int[] loc = mCoordinatesTemp;
v.getLocationOnScreen(loc);
int screenX = loc[0];
@@ -383,9 +376,6 @@
private void endDrag() {
if (mDragging) {
mDragging = false;
- if (mOriginator != null) {
- mOriginator.setVisibility(View.VISIBLE);
- }
for (DragListener listener : mListeners) {
listener.onDragEnd();
}
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index 0cdfd28..d76b902 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -16,17 +16,29 @@
package com.android.launcher2;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.TimeInterpolator;
+import android.animation.ValueAnimator;
+import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
+import android.content.res.Resources;
import android.graphics.Bitmap;
+import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewParent;
+import android.view.animation.DecelerateInterpolator;
+import android.view.animation.Interpolator;
+import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
+import com.android.launcher.R;
+
import java.util.ArrayList;
/**
@@ -36,12 +48,21 @@
private DragController mDragController;
private int[] mTmpXY = new int[2];
+ private int mXDown, mYDown;
+ private Launcher mLauncher;
+
// Variables relating to resizing widgets
private final ArrayList<AppWidgetResizeFrame> mResizeFrames =
new ArrayList<AppWidgetResizeFrame>();
private AppWidgetResizeFrame mCurrentResizeFrame;
- private int mXDown, mYDown;
- private Launcher mLauncher;
+
+ // Variables relating to animation of views after drop
+ private ValueAnimator mDropAnim = null;
+ private TimeInterpolator mQuintEaseOutInterpolator = new DecelerateInterpolator(2.5f);
+ private View mDropView = null;
+ private int[] mDropViewPos = new int[2];
+ private float mDropViewScale;
+ private float mDropViewAlpha;
/**
* Used to create a new DragLayer from XML.
@@ -148,16 +169,37 @@
public void getDescendantRectRelativeToSelf(View descendant, Rect r) {
descendant.getHitRect(r);
+ mTmpXY[0] = 0;
+ mTmpXY[1] = 0;
+ getDescendantCoordRelativeToSelf(descendant, mTmpXY);
+ r.offset(mTmpXY[0], mTmpXY[1]);
+ }
+ public void getDescendantCoordRelativeToSelf(View descendant, int[] coord) {
ViewParent viewParent = descendant.getParent();
while (viewParent instanceof View && viewParent != this) {
final View view = (View)viewParent;
- r.offset(view.getLeft() + (int) (view.getTranslationX() + 0.5f) - view.getScrollX(),
- view.getTop() + (int) (view.getTranslationY() + 0.5f) - view.getScrollY());
+ coord[0] += view.getLeft() + (int) (view.getTranslationX() + 0.5f) - view.getScrollX();
+ coord[1] += view.getTop() + (int) (view.getTranslationY() + 0.5f) - view.getScrollY();
viewParent = view.getParent();
}
}
+ public void getViewRectRelativeToSelf(View v, Rect r) {
+ int[] loc = new int[2];
+ getLocationOnScreen(loc);
+ int x = loc[0];
+ int y = loc[1];
+
+ v.getLocationOnScreen(loc);
+ int vX = loc[0];
+ int vY = loc[1];
+
+ int left = vX - x;
+ int top = vY - y;
+ r.set(left, top, left + v.getMeasuredWidth(), top + v.getMeasuredHeight());
+ }
+
@Override
public boolean dispatchUnhandledMove(View focused, int direction) {
return mDragController.dispatchUnhandledMove(focused, direction);
@@ -267,4 +309,118 @@
resizeFrame.snapToWidget(false);
}
+
+ public void animateViewIntoPosition(DragView dragView, final View child) {
+ ((CellLayoutChildren) child.getParent()).measureChild(child);
+ CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
+
+ Rect r = new Rect();
+ getViewRectRelativeToSelf(dragView, r);
+
+ int coord[] = new int[2];
+ coord[0] = lp.x;
+ coord[1] = lp.y;
+ getDescendantCoordRelativeToSelf(child, coord);
+
+ final int fromX = r.left + (dragView.getWidth() - child.getMeasuredWidth()) / 2;
+ final int fromY = r.top + (dragView.getHeight() - child.getMeasuredHeight()) / 2;
+ child.setVisibility(INVISIBLE);
+ animateViewIntoPosition(child, fromX, fromY, coord[0], coord[1]);
+ }
+
+ private void animateViewIntoPosition(final View view, final int fromX, final int fromY,
+ final int toX, final int toY) {
+ Rect from = new Rect(fromX, fromY, fromX + view.getMeasuredWidth(), fromY + view.getMeasuredHeight());
+ Rect to = new Rect(toX, toY, toX + view.getMeasuredWidth(), toY + view.getMeasuredHeight());
+ animateView(view, from, to, 1f, -1);
+ }
+
+ public void animateView(final View view, final Rect from, final Rect to,
+ final float finalAlpha, int duration) {
+ animateView(view, from, to, finalAlpha, 1.0f, duration, null, null);
+ }
+
+ public void animateView(final View view, final Rect from, final Rect to, final float finalAlpha,
+ final float finalScale, int duration, final Interpolator motionInterpolator,
+ final Interpolator alphaInterpolator) {
+ // Calculate the duration of the animation based on the object's distance
+ final float dist = (float) Math.sqrt(Math.pow(to.left - from.left, 2) +
+ Math.pow(to.top - from.top, 2));
+ final Resources res = getResources();
+ final float maxDist = (float) res.getInteger(R.integer.config_dropAnimMaxDist);
+
+ // If duration < 0, this is a cue to compute the duration based on the distance
+ if (duration < 0) {
+ duration = res.getInteger(R.integer.config_dropAnimMaxDuration);
+ if (dist < maxDist) {
+ duration *= mQuintEaseOutInterpolator.getInterpolation(dist / maxDist);
+ }
+ }
+
+ if (mDropAnim != null) {
+ mDropAnim.end();
+ }
+
+ mDropView = view;
+ final float initialAlpha = view.getAlpha();
+ mDropAnim = new ValueAnimator();
+ if (alphaInterpolator == null || motionInterpolator == null) {
+ mDropAnim.setInterpolator(mQuintEaseOutInterpolator);
+ }
+
+ mDropAnim.setDuration(duration);
+ mDropAnim.setFloatValues(0.0f, 1.0f);
+ mDropAnim.removeAllUpdateListeners();
+ mDropAnim.addUpdateListener(new AnimatorUpdateListener() {
+ public void onAnimationUpdate(ValueAnimator animation) {
+ final float percent = (Float) animation.getAnimatedValue();
+ // Invalidate the old position
+ int width = view.getMeasuredWidth();
+ int height = view.getMeasuredHeight();
+ invalidate(mDropViewPos[0], mDropViewPos[1],
+ mDropViewPos[0] + width, mDropViewPos[1] + height);
+
+ float alphaPercent = alphaInterpolator == null ? percent :
+ alphaInterpolator.getInterpolation(percent);
+ float motionPercent = motionInterpolator == null ? percent :
+ motionInterpolator.getInterpolation(percent);
+
+ mDropViewPos[0] = from.left + (int) ((to.left - from.left) * motionPercent);
+ mDropViewPos[1] = from.top + (int) ((to.top - from.top) * motionPercent);
+ mDropViewScale = percent * finalScale + (1 - percent);
+ mDropViewAlpha = alphaPercent * finalAlpha + (1 - alphaPercent) * initialAlpha;
+ invalidate(mDropViewPos[0], mDropViewPos[1],
+ mDropViewPos[0] + width, mDropViewPos[1] + height);
+ }
+ });
+ mDropAnim.addListener(new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ if (mDropView != null) {
+ mDropView.setVisibility(View.VISIBLE);
+ mDropView = null;
+ }
+ }
+ });
+ mDropAnim.start();
+ }
+
+ @Override
+ protected void dispatchDraw(Canvas canvas) {
+ super.dispatchDraw(canvas);
+ if (mDropView != null) {
+ // We are animating an item that was just dropped on the home screen.
+ // Render its View in the current animation position.
+ canvas.save(Canvas.MATRIX_SAVE_FLAG);
+ final int xPos = mDropViewPos[0] - mDropView.getScrollX();
+ final int yPos = mDropViewPos[1] - mDropView.getScrollY();
+ int width = mDropView.getMeasuredWidth();
+ int height = mDropView.getMeasuredHeight();
+ canvas.translate(xPos, yPos);
+ canvas.translate((1 - mDropViewScale) * width / 2, (1 - mDropViewScale) * height / 2);
+ canvas.scale(mDropViewScale, mDropViewScale);
+ mDropView.setAlpha(mDropViewAlpha);
+ mDropView.draw(canvas);
+ canvas.restore();
+ }
+ }
}
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index b02e22b..d4dc785 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -195,6 +195,16 @@
invalidate();
}
+ @Override
+ public void setAlpha(float alpha) {
+ super.setAlpha(alpha);
+ if (mPaint == null) {
+ mPaint = new Paint();
+ }
+ mPaint.setAlpha((int) (255 * alpha));
+ invalidate();
+ }
+
/**
* Create a window containing this view and show it.
*
@@ -227,7 +237,7 @@
mAnim.start();
}
-
+
/**
* Move the window containing this view.
*
@@ -242,7 +252,11 @@
}
void remove() {
- mWindowManager.removeView(this);
+ post(new Runnable() {
+ public void run() {
+ mWindowManager.removeView(DragView.this);
+ }
+ });
}
int[] getPosition(int[] result) {
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index da859cb..13815ad 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -86,6 +86,7 @@
private int mMaxCountX;
private int mMaxCountY;
private Rect mNewSize = new Rect();
+ private Rect mIconRect = new Rect();
private ArrayList<View> mItemsInReadingOrder = new ArrayList<View>();
private Drawable mIconDrawable;
boolean mItemsInvalidated = false;
@@ -134,6 +135,7 @@
if (sHintText == null) {
sHintText = res.getString(R.string.folder_hint_text);
}
+ setLayerType(LAYER_TYPE_HARDWARE, null);
}
@Override
@@ -141,7 +143,6 @@
super.onFinishInflate();
mContent = (CellLayout) findViewById(R.id.folder_content);
mContent.setGridSize(0, 0);
- mContent.enableHardwareLayers();
mFolderName = (TextView) findViewById(R.id.folder_name);
// We find out how tall the text view wants to be (it is set to wrap_content), so that
@@ -224,12 +225,16 @@
mEmptyCell[0] = item.cellX;
mEmptyCell[1] = item.cellY;
mCurrentDragView = v;
- mContent.removeView(mCurrentDragView);
- mInfo.remove(item);
+
}
return true;
}
+ public void onDragViewVisible() {
+ mContent.removeView(mCurrentDragView);
+ mInfo.remove(mCurrentDragInfo);
+ }
+
public boolean isEditingName() {
return mIsEditingName;
}
@@ -294,9 +299,6 @@
mDragController = dragController;
}
- public void onDragViewVisible() {
- }
-
void setLauncher(Launcher launcher) {
mLauncher = launcher;
}
@@ -371,9 +373,8 @@
* to its associated FolderIcon. This allows for a seamless transition into the expanded state.
*/
private void positionAndSizeAsIcon() {
- if (!(getParent() instanceof CellLayoutChildren)) return;
+ if (!(getParent() instanceof DragLayer)) return;
- DragLayer.LayoutParams iconLp = (DragLayer.LayoutParams) mFolderIcon.getLayoutParams();
DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
if (mMode == PARTIAL_GROW) {
@@ -381,19 +382,19 @@
setScaleY(0.8f);
setAlpha(0f);
} else {
- lp.width = iconLp.width;
- lp.height = iconLp.height;
- lp.x = iconLp.x;
- lp.y = iconLp.y;
+ mLauncher.getDragLayer().getDescendantRectRelativeToSelf(mFolderIcon, mIconRect);
+ lp.width = mIconRect.width();
+ lp.height = mIconRect.height();
+ lp.x = mIconRect.left;
+ lp.y = mIconRect.top;
mContent.setAlpha(0);
}
mState = STATE_SMALL;
}
public void animateOpen() {
- if (mState != STATE_SMALL) {
- positionAndSizeAsIcon();
- }
+ positionAndSizeAsIcon();
+
if (!(getParent() instanceof DragLayer)) return;
ObjectAnimator oa;
@@ -448,13 +449,12 @@
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.9f);
oa = ObjectAnimator.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
} else {
- DragLayer.LayoutParams iconLp = (DragLayer.LayoutParams) mFolderIcon.getLayoutParams();
DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
- PropertyValuesHolder width = PropertyValuesHolder.ofInt("width", iconLp.width);
- PropertyValuesHolder height = PropertyValuesHolder.ofInt("height", iconLp.height);
- PropertyValuesHolder x = PropertyValuesHolder.ofInt("x",iconLp.x);
- PropertyValuesHolder y = PropertyValuesHolder.ofInt("y", iconLp.y);
+ PropertyValuesHolder width = PropertyValuesHolder.ofInt("width", mIconRect.width());
+ PropertyValuesHolder height = PropertyValuesHolder.ofInt("height", mIconRect.height());
+ PropertyValuesHolder x = PropertyValuesHolder.ofInt("x", mIconRect.left);
+ PropertyValuesHolder y = PropertyValuesHolder.ofInt("y", mIconRect.top);
oa = ObjectAnimator.ofPropertyValuesHolder(lp, width, height, x, y);
oa.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
@@ -542,7 +542,6 @@
public void onDragEnter(DragObject d) {
mPreviousTargetCell[0] = -1;
mPreviousTargetCell[1] = -1;
- mContent.onDragEnter();
mOnExitAlarm.cancelAlarm();
}
@@ -645,14 +644,18 @@
OnAlarmListener mOnExitAlarmListener = new OnAlarmListener() {
public void onAlarm(Alarm alarm) {
- mLauncher.closeFolder();
- mCurrentDragInfo = null;
- mCurrentDragView = null;
- mSuppressOnAdd = false;
- mRearrangeOnClose = true;
+ completeDragExit();
}
};
+ private void completeDragExit() {
+ mLauncher.closeFolder();
+ mCurrentDragInfo = null;
+ mCurrentDragView = null;
+ mSuppressOnAdd = false;
+ mRearrangeOnClose = true;
+ }
+
public void onDragExit(DragObject d) {
// We only close the folder if this is a true drag exit, ie. not because a drop
// has occurred above the folder.
@@ -661,7 +664,6 @@
mOnExitAlarm.setAlarm(ON_EXIT_CLOSE_DELAY);
}
mReorderAlarm.cancelAlarm();
- mContent.onDragExit();
}
public void onDropCompleted(View target, DragObject d, boolean success) {
@@ -675,6 +677,11 @@
}
}
// TODO: if the drag fails, we need to re-add the item
+ } else {
+ if (target != this) {
+ mOnExitAlarm.cancelAlarm();
+ completeDragExit();
+ }
}
}
@@ -744,6 +751,12 @@
int left = Math.min(Math.max(0, centeredLeft), parentWidth - width);
int top = Math.min(Math.max(0, centeredTop), parentHeight - height);
+ if (width >= parentWidth) {
+ left = (parentWidth - width) / 2;
+ }
+ if (height >= parentHeight) {
+ top = (parentHeight - height) / 2;
+ }
int folderPivotX = width / 2 + (centeredLeft - left);
int folderPivotY = height / 2 + (centeredTop - top);
@@ -841,7 +854,7 @@
LauncherSettings.Favorites.CONTAINER_DESKTOP, mInfo.screen,
mInfo.cellX, mInfo.cellY);
}
- LauncherModel.deleteFolderContentsFromDatabase(mLauncher, mInfo, true);
+ LauncherModel.deleteItemFromDatabase(mLauncher, mInfo);
// Add the last remaining child to the workspace in place of the folder
if (finalItem != null) {
@@ -870,9 +883,9 @@
si.cellX = lp.cellX = mEmptyCell[0];
si.cellX = lp.cellY = mEmptyCell[1];
mContent.addViewToCellLayout(mCurrentDragView, -1, (int)item.id, lp, true);
- mSuppressOnAdd = true;
- mItemsInvalidated = true;
+ mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, mCurrentDragView);
setupContentDimension(getItemCount());
+ mSuppressOnAdd = true;
}
mInfo.add(item);
}
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index bae2fd7..aff8761 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -25,11 +25,14 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.PorterDuff;
+import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -276,17 +279,30 @@
mFolderRingAnimator.animateToNaturalState();
}
- public void onDrop(Object dragInfo) {
+ public void onDrop(DragObject d) {
ShortcutInfo item;
- if (dragInfo instanceof ApplicationInfo) {
+ if (d.dragInfo instanceof ApplicationInfo) {
// Came from all apps -- make a copy
- item = ((ApplicationInfo) dragInfo).makeShortcut();
+ item = ((ApplicationInfo) d.dragInfo).makeShortcut();
} else {
- item = (ShortcutInfo) dragInfo;
+ item = (ShortcutInfo) d.dragInfo;
}
item.cellX = -1;
item.cellY = -1;
addItem(item);
+ DragLayer dragLayer = mLauncher.getDragLayer();
+ Rect from = new Rect();
+ dragLayer.getViewRectRelativeToSelf(d.dragView, from);
+ Rect to = new Rect();
+ dragLayer.getDescendantRectRelativeToSelf(this, to);
+
+ int previewSize = FolderRingAnimator.sPreviewSize;
+ int vanishingPointX = (int) (previewSize * 0.7);
+ int vanishingPointY = (int) (previewSize * (1 - 0.88f));
+ to.offset(vanishingPointX - previewSize / 2 , vanishingPointY - previewSize / 2);
+
+ dragLayer.animateView(d.dragView, from, to, 0f, 0.2f, 400, new DecelerateInterpolator(2),
+ new AccelerateInterpolator(2));
}
public DropTarget getDropTargetDelegate(DragObject d) {
@@ -323,20 +339,17 @@
float maxPerspectiveShift = baselineSize * PERSPECTIVE_SHIFT_FACTOR;
ArrayList<View> items = mFolder.getItemsInReadingOrder(false);
- int firstItemIndex = Math.max(0, items.size() - NUM_ITEMS_IN_PREVIEW);
int xShift = (mOriginalWidth - 2 * halfAvailableSpace) / 2;
int yShift = previewPadding;
canvas.translate(xShift, yShift);
- for (int i = firstItemIndex; i < items.size(); i++) {
- int index = i - firstItemIndex;
- index += Math.max(0, NUM_ITEMS_IN_PREVIEW - items.size());
+ int nItemsInPreview = Math.min(items.size(), NUM_ITEMS_IN_PREVIEW);
+ for (int i = nItemsInPreview - 1; i >= 0; i--) {
+ int index = NUM_ITEMS_IN_PREVIEW - i - 1;
float r = (index * 1.0f) / (NUM_ITEMS_IN_PREVIEW - 1);
float scale = (1 - PERSPECTIVE_SCALE_FACTOR * (1 - r));
- //r = (float) Math.pow(r, 2);
-
float offset = (1 - r) * maxPerspectiveShift;
float scaledSize = scale * baselineSize;
float scaleOffsetCorrection = (1 - scale) * baselineSize;
diff --git a/src/com/android/launcher2/InfoDropTarget.java b/src/com/android/launcher2/InfoDropTarget.java
index 76a6bf9..c7812e3 100644
--- a/src/com/android/launcher2/InfoDropTarget.java
+++ b/src/com/android/launcher2/InfoDropTarget.java
@@ -16,14 +16,13 @@
package com.android.launcher2;
-import android.animation.ObjectAnimator;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
+import android.graphics.drawable.TransitionDrawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
@@ -33,6 +32,7 @@
public class InfoDropTarget extends ButtonDropTarget {
private TextView mText;
+ private TransitionDrawable mDrawable;
private int mHoverColor = 0xFF0000FF;
public InfoDropTarget(Context context, AttributeSet attrs) {
@@ -54,8 +54,8 @@
mHoverColor = r.getColor(R.color.info_target_hover_tint);
mHoverPaint.setColorFilter(new PorterDuffColorFilter(
mHoverColor, PorterDuff.Mode.SRC_ATOP));
- setBackgroundColor(mHoverColor);
- getBackground().setAlpha(0);
+ mDrawable = (TransitionDrawable) mText.getCompoundDrawables()[0];
+ mDrawable.setCrossFadeEnabled(true);
// Remove the text in the Phone UI in landscape
int orientation = getResources().getConfiguration().orientation;
@@ -109,17 +109,12 @@
public void onDragEnter(DragObject d) {
super.onDragEnter(d);
- ObjectAnimator anim = ObjectAnimator.ofInt(getBackground(), "alpha",
- Color.alpha(mHoverColor));
- anim.setDuration(mTransitionDuration);
- anim.start();
+ mDrawable.startTransition(mTransitionDuration);
}
public void onDragExit(DragObject d) {
super.onDragExit(d);
- ObjectAnimator anim = ObjectAnimator.ofInt(getBackground(), "alpha", 0);
- anim.setDuration(mTransitionDuration);
- anim.start();
+ mDrawable.resetTransition();
}
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index b52a4f7..36ff2b2 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -39,12 +39,12 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.content.Intent.ShortcutIconResource;
import android.content.IntentFilter;
+import android.content.Intent.ShortcutIconResource;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -78,9 +78,9 @@
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
+import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
-import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
@@ -433,6 +433,10 @@
}
}
+ public DragLayer getDragLayer() {
+ return mDragLayer;
+ }
+
static int getScreen() {
synchronized (sLock) {
return sScreen;
@@ -2383,6 +2387,10 @@
toView.setTranslationY(0.0f);
toView.setVisibility(View.VISIBLE);
toView.bringToFront();
+
+ // Hide the workspace scrollbar
+ mWorkspace.hideScrollingIndicator(true);
+ mWorkspace.hideScrollIndicatorTrack();
}
@Override
public void onAnimationEnd(Animator animation) {
@@ -2414,6 +2422,10 @@
if (toView instanceof LauncherTransitionable) {
((LauncherTransitionable) toView).onLauncherTransitionStart(null);
((LauncherTransitionable) toView).onLauncherTransitionEnd(null);
+
+ // Hide the workspace scrollbar
+ mWorkspace.hideScrollingIndicator(true);
+ mWorkspace.hideScrollIndicatorTrack();
}
}
}
@@ -2471,6 +2483,10 @@
fromView.setVisibility(View.GONE);
if (fromView instanceof LauncherTransitionable) {
((LauncherTransitionable) fromView).onLauncherTransitionEnd(alphaAnim);
+
+ // Show the workspace scrollbar
+ mWorkspace.showScrollIndicatorTrack();
+ mWorkspace.flashScrollingIndicator();
}
}
});
@@ -2482,6 +2498,10 @@
if (fromView instanceof LauncherTransitionable) {
((LauncherTransitionable) fromView).onLauncherTransitionStart(null);
((LauncherTransitionable) fromView).onLauncherTransitionEnd(null);
+
+ // Show the workspace scrollbar
+ mWorkspace.showScrollIndicatorTrack();
+ mWorkspace.flashScrollingIndicator();
}
}
}
@@ -2728,22 +2748,8 @@
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
ComponentName activityName = searchManager.getGlobalSearchActivity();
if (activityName != null) {
- // In landscape mode on the Phone UI, we only have enough space to show the magnifying
- // glass icon
- boolean iconLoaded = false;
- if (!LauncherApplication.isScreenLarge()) {
- // TODO-APPS_CUSTOMIZE: Remove when the QSB fixes itself?
- int orientation = getResources().getConfiguration().orientation;
- if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
- searchButton.setImageResource(R.drawable.ic_generic_search);
- iconLoaded = true;
- sGlobalSearchIcon = null;
- }
- }
- if (!iconLoaded) {
- sGlobalSearchIcon = updateButtonWithIconFromExternalActivity(
- R.id.search_button, activityName, R.drawable.ic_generic_search);
- }
+ sGlobalSearchIcon = updateButtonWithIconFromExternalActivity(
+ R.id.search_button, activityName, R.drawable.ic_generic_search);
searchButton.setVisibility(View.VISIBLE);
searchDivider.setVisibility(View.VISIBLE);
} else {
@@ -2789,7 +2795,7 @@
if (activityName != null) {
mAppMarketIntent = intent;
sAppMarketIcon = updateTextButtonWithIconFromExternalActivity(
- R.id.market_button, activityName, R.drawable.app_market_generic);
+ R.id.market_button, activityName, R.drawable.ic_launcher_market_holo);
marketButton.setVisibility(View.VISIBLE);
// Remove the shop icon text in the Phone UI
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 9ca2f90..a90d32f 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -162,10 +162,12 @@
// Scrolling indicator
private ImageView mScrollIndicator;
+ private ImageView mScrollTrack;
private boolean mHasScrollIndicator = true;
private static final int sScrollIndicatorFadeInDuration = 150;
private static final int sScrollIndicatorFastFadeOutDuration = 50;
private static final int sScrollIndicatorFadeOutDuration = 650;
+ private static final int sScrollIndicatorFlashDuration = 650;
// If set, will defer loading associated pages until the scrolling settles
private boolean mDeferLoadAssociatedPagesUntilScrollCompletes;
@@ -1606,8 +1608,6 @@
}
if (mContentIsRefreshable) {
- hideScrollingIndicator(true);
-
// Update all the pages
syncPages();
@@ -1644,6 +1644,16 @@
return true;
}
+ protected void flashScrollingIndicator() {
+ showScrollingIndicator();
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ hideScrollingIndicator(false);
+ }
+ }, sScrollIndicatorFlashDuration);
+ }
+
protected void showScrollingIndicator() {
if (LauncherApplication.isScreenLarge()) return;
if (getChildCount() <= 1) return;
@@ -1651,13 +1661,9 @@
getScrollingIndicator();
if (mScrollIndicator != null) {
- // Update the width of the indicator to the approx. width of each page in the full bar
- mScrollIndicator.getLayoutParams().width = getPageWidthForScrollingIndicator() / getChildCount();
- mScrollIndicator.requestLayout();
-
// Fade the indicator in
updateScrollingIndicatorPosition();
- mScrollIndicator.animate().alpha(1f).setDuration(sScrollIndicatorFadeInDuration);
+ mScrollIndicator.animate().alpha(1f).setDuration(sScrollIndicatorFadeInDuration).start();
}
}
@@ -1671,7 +1677,7 @@
// Fade the indicator out
updateScrollingIndicatorPosition();
mScrollIndicator.animate().alpha(0f).setDuration(immediately ?
- sScrollIndicatorFastFadeOutDuration : sScrollIndicatorFadeOutDuration);
+ sScrollIndicatorFastFadeOutDuration : sScrollIndicatorFadeOutDuration).start();
}
}
@@ -1700,6 +1706,33 @@
int indicatorCenterOffset = indicatorWidth / 2 - mScrollIndicator.getMeasuredWidth() / 2;
int indicatorPos = (int) (offset * pageWidth) + pageOffset + indicatorCenterOffset;
mScrollIndicator.setTranslationX(indicatorPos);
+ mScrollIndicator.invalidate();
+ }
+
+ private ImageView getScrollingIndicatorTrack() {
+ if (mScrollTrack == null) {
+ ViewGroup parent = (ViewGroup) getParent();
+ mScrollTrack = (ImageView) (parent.findViewById(R.id.paged_view_indicator_track));
+ }
+ return mScrollTrack;
+ }
+
+ public void showScrollIndicatorTrack() {
+ if (!LauncherApplication.isScreenLarge()) {
+ getScrollingIndicatorTrack();
+ if (mScrollTrack != null) {
+ mScrollTrack.setVisibility(View.VISIBLE);
+ }
+ }
+ }
+
+ public void hideScrollIndicatorTrack() {
+ if (!LauncherApplication.isScreenLarge()) {
+ getScrollingIndicatorTrack();
+ if (mScrollTrack != null) {
+ mScrollTrack.setVisibility(View.GONE);
+ }
+ }
}
/* Accessibility */
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 9c37c01..fc1b012 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
@@ -36,10 +37,13 @@
private int mCellCountX;
private int mCellCountY;
+ private int mOriginalCellWidth;
+ private int mOriginalCellHeight;
private int mCellWidth;
private int mCellHeight;
private int mWidthGap;
private int mHeightGap;
+ private int mMaxGap;
private float mPeekWidth;
protected PagedViewCellLayoutChildren mChildren;
private PagedViewCellLayoutChildren mHolographicChildren;
@@ -61,12 +65,15 @@
// setup default cell parameters
Resources resources = context.getResources();
- mCellWidth = resources.getDimensionPixelSize(R.dimen.apps_customize_cell_width);
- mCellHeight = resources.getDimensionPixelSize(R.dimen.apps_customize_cell_height);
+ mOriginalCellWidth = mCellWidth =
+ resources.getDimensionPixelSize(R.dimen.apps_customize_cell_width);
+ mOriginalCellHeight = mCellHeight =
+ resources.getDimensionPixelSize(R.dimen.apps_customize_cell_height);
mPeekWidth = resources.getDimensionPixelSize(R.dimen.apps_customize_peek_width);
mCellCountX = LauncherModel.getCellCountX();
mCellCountY = LauncherModel.getCellCountY();
mWidthGap = mHeightGap = -1;
+ mMaxGap = resources.getDimensionPixelSize(R.dimen.apps_customize_max_gap);
mChildren = new PagedViewCellLayoutChildren(context);
mChildren.setCellDimensions(mCellWidth, mCellHeight);
@@ -214,53 +221,47 @@
throw new RuntimeException("CellLayout cannot have UNSPECIFIED dimensions");
}
- final int cellWidth = mCellWidth;
- final int cellHeight = mCellHeight;
+
int numWidthGaps = mCellCountX - 1;
int numHeightGaps = mCellCountY - 1;
- int vSpaceLeft = heightSpecSize - mPaddingTop
- - mPaddingBottom - (cellHeight * mCellCountY);
- int heightGap = (numHeightGaps <= 0) ? 0 : (vSpaceLeft / numHeightGaps);
+ if (mWidthGap < 0 || mHeightGap < 0) {
+ int hSpace = widthSpecSize - mPaddingLeft - mPaddingRight;
+ int vSpace = heightSpecSize - mPaddingTop - mPaddingBottom;
+ int hFreeSpace = hSpace - (mCellCountX * mOriginalCellWidth);
+ int vFreeSpace = vSpace - (mCellCountY * mOriginalCellHeight);
+ mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
+ mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0);
- int hSpaceLeft = widthSpecSize - mPaddingLeft
- - mPaddingRight - (cellWidth * mCellCountX);
- int widthGap = (numWidthGaps <= 0) ? 0 : (hSpaceLeft / numWidthGaps);
-
- // center it around the min gaps
- int minGap = Math.min(widthGap, heightGap);
- /*
- if (minGap < heightGap) {
- // vertical space has shrunken, so change padding accordingly
- paddingTop += ((heightGap - minGap) * (mCellCountY - 1)) / 2;
- } else if (minGap < widthGap) {
- // horizontal space has shrunken, so change padding accordingly
- paddingLeft += ((widthGap - minGap) * (mCellCountX - 1)) / 2;
- }
- */
- if (mWidthGap > -1 && mHeightGap > -1) {
- widthGap = mWidthGap;
- heightGap = mHeightGap;
- } else {
- widthGap = heightGap = minGap;
+ mChildren.setGap(mWidthGap, mHeightGap);
+ mHolographicChildren.setGap(mWidthGap, mHeightGap);
}
- int newWidth = (mCellCountX * cellWidth) + ((mCellCountX - 1) * widthGap);
- int newHeight = (mCellCountY * cellHeight) + ((mCellCountY - 1) * heightGap);
+ // Initial values correspond to widthSpecMode == MeasureSpec.EXACTLY
+ int newWidth = widthSpecSize;
+ int newHeight = heightSpecSize;
+ if (widthSpecMode == MeasureSpec.AT_MOST) {
+ newWidth = mPaddingLeft + mPaddingRight + (mCellCountX * mCellWidth) +
+ ((mCellCountX - 1) * mWidthGap);
+ newHeight = mPaddingTop + mPaddingBottom + (mCellCountY * mCellHeight) +
+ ((mCellCountY - 1) * mHeightGap);
+ setMeasuredDimension(newWidth, newHeight);
+ }
final int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
int childWidthMeasureSpec =
- MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY);
+ MeasureSpec.makeMeasureSpec(newWidth - mPaddingLeft -
+ mPaddingRight, MeasureSpec.EXACTLY);
int childheightMeasureSpec =
- MeasureSpec.makeMeasureSpec(newHeight, MeasureSpec.EXACTLY);
+ MeasureSpec.makeMeasureSpec(newHeight - mPaddingTop -
+ mPaddingBottom, MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
}
- setMeasuredDimension(newWidth + mPaddingLeft + mPaddingRight,
- newHeight + mPaddingTop + mPaddingBottom);
+ setMeasuredDimension(newWidth, newHeight);
}
int getContentWidth() {
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index e53768d..60b915b 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -16,17 +16,13 @@
package com.android.launcher2;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
import android.animation.Animator;
-import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
+import android.animation.Animator.AnimatorListener;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.app.AlertDialog;
import android.app.WallpaperManager;
@@ -45,7 +41,6 @@
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
-import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region.Op;
@@ -69,6 +64,10 @@
import com.android.launcher2.FolderIcon.FolderRingAnimator;
import com.android.launcher2.InstallWidgetReceiver.WidgetMimeTypeHandlerData;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
/**
* The workspace is a wide area with a wallpaper and a finite number of pages.
* Each page contains a number of icons, folders or widgets the user can
@@ -181,11 +180,6 @@
private final Rect mTempRect = new Rect();
private final int[] mTempXY = new int[2];
- private ValueAnimator mDropAnim = null;
- private TimeInterpolator mQuintEaseOutInterpolator = new DecelerateInterpolator(2.5f);
- private View mDropView = null;
- private int[] mDropViewPos = new int[] { -1, -1 };
-
// Paint used to draw external drop outline
private final Paint mExternalDragOutlinePaint = new Paint();
@@ -415,7 +409,7 @@
* @return The open folder on the current screen, or null if there is none
*/
Folder getOpenFolder() {
- DragLayer dragLayer = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
+ DragLayer dragLayer = mLauncher.getDragLayer();
int count = dragLayer.getChildCount();
for (int i = 0; i < count; i++) {
View child = dragLayer.getChildAt(i);
@@ -1246,26 +1240,15 @@
final CellLayout rightPage = (CellLayout) getChildAt(mCurrentPage + 1);
if (leftPage != null && leftPage.getIsDragOverlapping()) {
- final Drawable d = getResources().getDrawable(R.drawable.page_hover_left);
+ final Drawable d = getResources().getDrawable(R.drawable.page_hover_left_holo);
d.setBounds(mScrollX, padding, mScrollX + d.getIntrinsicWidth(), height - padding);
d.draw(canvas);
} else if (rightPage != null && rightPage.getIsDragOverlapping()) {
- final Drawable d = getResources().getDrawable(R.drawable.page_hover_right);
+ final Drawable d = getResources().getDrawable(R.drawable.page_hover_right_holo);
d.setBounds(mScrollX + width - d.getIntrinsicWidth(), padding, mScrollX + width, height - padding);
d.draw(canvas);
}
}
-
- if (mDropView != null) {
- // We are animating an item that was just dropped on the home screen.
- // Render its View in the current animation position.
- canvas.save(Canvas.MATRIX_SAVE_FLAG);
- final int xPos = mDropViewPos[0] - mDropView.getScrollX();
- final int yPos = mDropViewPos[1] - mDropView.getScrollY();
- canvas.translate(xPos, yPos);
- mDropView.draw(canvas);
- canvas.restore();
- }
}
}
@@ -1398,9 +1381,6 @@
// Stop any scrolling, move to the current page right away
setCurrentPage((mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage);
- // Hide the scrollbar
- hideScrollingIndicator(true);
-
CellLayout currentPage = (CellLayout) getChildAt(mCurrentPage);
if (currentPage == null) {
Log.w(TAG, "currentPage is NULL! mCurrentPage " + mCurrentPage
@@ -1761,7 +1741,7 @@
}
public void exitWidgetResizeMode() {
- DragLayer dragLayer = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
+ DragLayer dragLayer = mLauncher.getDragLayer();
dragLayer.clearAllResizeFrames();
}
@@ -1980,8 +1960,7 @@
v.getDrawingRect(clipRect);
// For a TextView, adjust the clip rect so that we don't include the text label
- if (v instanceof FolderIcon) {
- } else if (v instanceof BubbleTextView) {
+ if (v instanceof BubbleTextView) {
final BubbleTextView tv = (BubbleTextView) v;
clipRect.bottom = tv.getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V +
tv.getLayout().getLineTop(0);
@@ -1989,6 +1968,8 @@
final TextView tv = (TextView) v;
clipRect.bottom = tv.getExtendedPaddingTop() - tv.getCompoundDrawablePadding() +
tv.getLayout().getLineTop(0);
+ } else if (v instanceof FolderIcon) {
+ clipRect.bottom = getResources().getDimensionPixelSize(R.dimen.folder_preview_size);
}
// Draw the View into the bitmap.
@@ -2118,13 +2099,16 @@
final int screenY = (int) mTempXY[1] + (child.getHeight() - bmpHeight) / 2;
Rect dragRect = null;
- if ((child instanceof BubbleTextView) && !(child instanceof FolderIcon)) {
+ if (child instanceof BubbleTextView) {
int iconSize = getResources().getDimensionPixelSize(R.dimen.app_icon_size);
int top = child.getPaddingTop();
int left = (bmpWidth - iconSize) / 2;
int right = left + iconSize;
int bottom = top + iconSize;
dragRect = new Rect(left, top, right, bottom);
+ } else if (child instanceof FolderIcon) {
+ int previewSize = getResources().getDimensionPixelSize(R.dimen.folder_preview_size);
+ dragRect = new Rect(0, 0, child.getWidth(), previewSize);
}
mLauncher.lockScreenOrientation();
@@ -2146,98 +2130,6 @@
cellXY[0], cellXY[1]);
}
- private void setPositionForDropAnimation(
- View dragView, int dragViewX, int dragViewY, View parent, View child) {
- final CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
-
- // Based on the position of the drag view, find the top left of the original view
- int viewX = dragViewX + (dragView.getWidth() - child.getMeasuredWidth()) / 2;
- int viewY = dragViewY + (dragView.getHeight() - child.getMeasuredHeight()) / 2;
-
- CellLayout layout = (CellLayout) parent;
-
- // Set its old pos (in the new parent's coordinates); it will be animated
- // in animateViewIntoPosition after the next layout pass
- lp.oldX = viewX - (layout.getLeft() + layout.getPaddingLeft() - mScrollX);
- lp.oldY = viewY - (layout.getTop() + layout.getPaddingTop() - mScrollY);
- }
-
- public void animateViewIntoPosition(final View view, final int fromX, final int fromY,
- final int dX, final int dY, final Runnable animationEndRunnable) {
-
- // Calculate the duration of the animation based on the object's distance
- final float dist = (float) Math.sqrt(dX*dX + dY*dY);
- final Resources res = getResources();
- final float maxDist = (float) res.getInteger(R.integer.config_dropAnimMaxDist);
- int duration = res.getInteger(R.integer.config_dropAnimMaxDuration);
- if (dist < maxDist) {
- duration *= mQuintEaseOutInterpolator.getInterpolation(dist / maxDist);
- }
-
- if (mDropAnim != null) {
- mDropAnim.end();
- }
- mDropAnim = new ValueAnimator();
- mDropAnim.setInterpolator(mQuintEaseOutInterpolator);
-
- // The view is invisible during the animation; we render it manually.
- mDropAnim.addListener(new AnimatorListenerAdapter() {
- public void onAnimationStart(Animator animation) {
- // Set this here so that we don't render it until the animation begins
- mDropView = view;
- }
-
- public void onAnimationEnd(Animator animation) {
- animationEndRunnable.run();
- }
- });
-
- mDropAnim.setDuration(duration);
- mDropAnim.setFloatValues(0.0f, 1.0f);
- mDropAnim.removeAllUpdateListeners();
- mDropAnim.addUpdateListener(new AnimatorUpdateListener() {
- public void onAnimationUpdate(ValueAnimator animation) {
- final float percent = (Float) animation.getAnimatedValue();
- // Invalidate the old position
- invalidate(mDropViewPos[0], mDropViewPos[1],
- mDropViewPos[0] + view.getWidth(), mDropViewPos[1] + view.getHeight());
-
- mDropViewPos[0] = fromX + (int) (percent * dX + 0.5f);
- mDropViewPos[1] = fromY + (int) (percent * dY + 0.5f);
- invalidate(mDropViewPos[0], mDropViewPos[1],
- mDropViewPos[0] + view.getWidth(), mDropViewPos[1] + view.getHeight());
- }
- });
-
- mDropAnim.start();
- }
-
- /*
- * We should be careful that this method cannot result in any synchronous requestLayout()
- * calls, as it is called from onLayout().
- */
- public void animateViewIntoPosition(final View view) {
- final CellLayout parent = (CellLayout) view.getParent().getParent();
- final CellLayout.LayoutParams lp = (CellLayout.LayoutParams) view.getLayoutParams();
-
- // Convert the animation params to be relative to the Workspace, not the CellLayout
- final int fromX = lp.oldX + parent.getLeft() + parent.getPaddingLeft();
- final int fromY = lp.oldY + parent.getTop() + parent.getPaddingTop();
-
- final int dx = lp.x - lp.oldX;
- final int dy = lp.y - lp.oldY;
-
- Runnable animationEndRunnable = new Runnable() {
- public void run() {
- if (mDropView != null) {
- mDropView.setVisibility(View.VISIBLE);
- mDropView = null;
- }
- }
- };
- animateViewIntoPosition(view, fromX, fromY, dx, dy, animationEndRunnable);
- }
-
/**
* {@inheritDoc}
*/
@@ -2345,12 +2237,12 @@
}
boolean addToExistingFolderIfNecessary(View newView, CellLayout target, int[] targetCell,
- Object dragInfo, boolean external) {
+ DragObject d, boolean external) {
View dropOverView = target.getChildAt(targetCell[0], targetCell[1]);
if (dropOverView instanceof FolderIcon) {
FolderIcon fi = (FolderIcon) dropOverView;
- if (fi.acceptDrop(dragInfo)) {
- fi.onDrop(dragInfo);
+ if (fi.acceptDrop(d.dragInfo)) {
+ fi.onDrop(d);
// if the drag started here, we need to remove it from the workspace
if (!external) {
@@ -2386,7 +2278,7 @@
if (d.dragSource != this) {
final int[] touchXY = new int[] { (int) mDragViewVisualCenter[0],
(int) mDragViewVisualCenter[1] };
- onDropExternal(touchXY, d.dragInfo, dropTargetLayout, false, d.dragView);
+ onDropExternal(touchXY, d.dragInfo, dropTargetLayout, false, d);
} else if (mDragInfo != null) {
final View cell = mDragInfo.cell;
@@ -2410,8 +2302,7 @@
return;
}
- if (addToExistingFolderIfNecessary(cell, dropTargetLayout, mTargetCell,
- d.dragInfo, false)) {
+ if (addToExistingFolderIfNecessary(cell, dropTargetLayout, mTargetCell, d, false)) {
return;
}
@@ -2453,8 +2344,7 @@
if (pinfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE) {
final Runnable resizeRunnable = new Runnable() {
public void run() {
- DragLayer dragLayer =
- (DragLayer) mLauncher.findViewById(R.id.drag_layer);
+ DragLayer dragLayer = mLauncher.getDragLayer();
dragLayer.addResizeFrame(info, hostView, cellLayout);
}
};
@@ -2478,13 +2368,10 @@
final CellLayout parent = (CellLayout) cell.getParent().getParent();
- int loc[] = new int[2];
- getViewLocationRelativeToSelf(d.dragView, loc);
-
// Prepare it to be animated into its new position
// This must be called after the view has been re-parented
- setPositionForDropAnimation(d.dragView, loc[0], loc[1], parent, cell);
- parent.onDropChild(cell, true);
+ mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, cell);
+ parent.onDropChild(cell);
}
}
@@ -3045,7 +2932,7 @@
* to add an item to one of the workspace screens.
*/
private void onDropExternal(int[] touchXY, Object dragInfo,
- CellLayout cellLayout, boolean insertAtFirst, DragView dragView) {
+ CellLayout cellLayout, boolean insertAtFirst, DragObject d) {
int screen = indexOfChild(cellLayout);
if (screen != mCurrentPage && mShrinkState != ShrinkState.SPRING_LOADED) {
snapToPage(screen);
@@ -3098,7 +2985,7 @@
if (createUserFolderIfNecessary(view, cellLayout, mTargetCell, true)) {
return;
}
- if (addToExistingFolderIfNecessary(view, cellLayout, mTargetCell, dragInfo, true)) {
+ if (addToExistingFolderIfNecessary(view, cellLayout, mTargetCell, d, true)) {
return;
}
}
@@ -3112,22 +2999,18 @@
}
addInScreen(view, indexOfChild(cellLayout), mTargetCell[0],
mTargetCell[1], info.spanX, info.spanY, insertAtFirst);
- cellLayout.onDropChild(view, false);
+ cellLayout.onDropChild(view);
cellLayout.animateDrop();
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) view.getLayoutParams();
cellLayout.getChildrenLayout().measureChild(view);
- if (dragView != null) {
- // we have the visual center of the drag view, we need to find the actual
- // left and top of the dragView.
- int loc[] = new int[2];
- getViewLocationRelativeToSelf(dragView, loc);
- setPositionForDropAnimation(dragView, loc[0], loc[1], cellLayout, view);
- }
-
LauncherModel.addOrMoveItemInDatabase(mLauncher, info,
LauncherSettings.Favorites.CONTAINER_DESKTOP, screen,
lp.cellX, lp.cellY);
+
+ if (d.dragView != null) {
+ mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, view);
+ }
}
}
@@ -3195,7 +3078,7 @@
// calling onDropCompleted(). We call it ourselves here, but maybe this should be
// moved into DragController.cancelDrag().
doDragExit(null);
- ((CellLayout) getChildAt(mDragInfo.screen)).onDropChild(mDragInfo.cell, false);
+ ((CellLayout) getChildAt(mDragInfo.screen)).onDropChild(mDragInfo.cell);
}
mLauncher.unlockScreenOrientation();
mDragOutline = null;