Merge "Enabling accessibility drag and drop in folder" into ub-launcher3-burnaby
diff --git a/proguard.flags b/proguard.flags
index e2a4b5b..6eb5948 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -65,4 +65,8 @@
-keep class com.android.launcher3.AppsContainerRecyclerView {
public void setFastScrollerAlpha(float);
public float getFastScrollerAlpha();
-}
\ No newline at end of file
+}
+
+-keep class com.android.launcher3.ButtonDropTarget {
+ public int getTextColor();
+}
diff --git a/res/drawable-hdpi/ic_launcher_clear_active_holo.png b/res/drawable-hdpi/ic_launcher_clear_active_holo.png
deleted file mode 100644
index cdd0052..0000000
--- a/res/drawable-hdpi/ic_launcher_clear_active_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_clear_normal_holo.png b/res/drawable-hdpi/ic_launcher_clear_normal_holo.png
deleted file mode 100644
index 84549ff..0000000
--- a/res/drawable-hdpi/ic_launcher_clear_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_info_active.png b/res/drawable-hdpi/ic_launcher_info_active.png
new file mode 100644
index 0000000..f7a3b68
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_info_active.png
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
deleted file mode 100644
index c534e56..0000000
--- a/res/drawable-hdpi/ic_launcher_info_active_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_info_normal.png b/res/drawable-hdpi/ic_launcher_info_normal.png
new file mode 100644
index 0000000..780d796
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_info_normal.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
deleted file mode 100644
index c9bcd7f..0000000
--- a/res/drawable-hdpi/ic_launcher_info_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_remove_active.png b/res/drawable-hdpi/ic_launcher_remove_active.png
new file mode 100644
index 0000000..e53de0d
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_remove_active.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_remove_normal.png b/res/drawable-hdpi/ic_launcher_remove_normal.png
new file mode 100644
index 0000000..91e19ca
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_remove_normal.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
deleted file mode 100644
index 82b1b59..0000000
--- a/res/drawable-hdpi/ic_launcher_trashcan_active_holo.png
+++ /dev/null
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
deleted file mode 100644
index 3fc2e83..0000000
--- a/res/drawable-hdpi/ic_launcher_trashcan_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_uninstall_active.png b/res/drawable-hdpi/ic_launcher_uninstall_active.png
new file mode 100644
index 0000000..22b97ee
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_uninstall_active.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_uninstall_normal.png b/res/drawable-hdpi/ic_launcher_uninstall_normal.png
new file mode 100644
index 0000000..7aea5d0
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher_uninstall_normal.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_clear_active_holo.png b/res/drawable-mdpi/ic_launcher_clear_active_holo.png
deleted file mode 100644
index 2683bea..0000000
--- a/res/drawable-mdpi/ic_launcher_clear_active_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_clear_normal_holo.png b/res/drawable-mdpi/ic_launcher_clear_normal_holo.png
deleted file mode 100644
index 219f3e5..0000000
--- a/res/drawable-mdpi/ic_launcher_clear_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_info_active.png b/res/drawable-mdpi/ic_launcher_info_active.png
new file mode 100644
index 0000000..ea71272
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_info_active.png
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
deleted file mode 100644
index f84b4a6..0000000
--- a/res/drawable-mdpi/ic_launcher_info_active_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_info_normal.png b/res/drawable-mdpi/ic_launcher_info_normal.png
new file mode 100644
index 0000000..8c60159
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_info_normal.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
deleted file mode 100644
index eac578f..0000000
--- a/res/drawable-mdpi/ic_launcher_info_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_remove_active.png b/res/drawable-mdpi/ic_launcher_remove_active.png
new file mode 100644
index 0000000..f36cfdd
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_remove_active.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_remove_normal.png b/res/drawable-mdpi/ic_launcher_remove_normal.png
new file mode 100644
index 0000000..60829b9
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_remove_normal.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
deleted file mode 100644
index 0350e55..0000000
--- a/res/drawable-mdpi/ic_launcher_trashcan_active_holo.png
+++ /dev/null
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
deleted file mode 100644
index 799b62f..0000000
--- a/res/drawable-mdpi/ic_launcher_trashcan_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_uninstall_active.png b/res/drawable-mdpi/ic_launcher_uninstall_active.png
new file mode 100644
index 0000000..e4ee911
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_uninstall_active.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher_uninstall_normal.png b/res/drawable-mdpi/ic_launcher_uninstall_normal.png
new file mode 100644
index 0000000..aefbc69
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher_uninstall_normal.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_clear_active_holo.png b/res/drawable-xhdpi/ic_launcher_clear_active_holo.png
deleted file mode 100644
index 1a7e53d..0000000
--- a/res/drawable-xhdpi/ic_launcher_clear_active_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_clear_normal_holo.png b/res/drawable-xhdpi/ic_launcher_clear_normal_holo.png
deleted file mode 100644
index d4965d9..0000000
--- a/res/drawable-xhdpi/ic_launcher_clear_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_info_active.png b/res/drawable-xhdpi/ic_launcher_info_active.png
new file mode 100644
index 0000000..b438f9e
--- /dev/null
+++ b/res/drawable-xhdpi/ic_launcher_info_active.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_info_active_holo.png b/res/drawable-xhdpi/ic_launcher_info_active_holo.png
deleted file mode 100644
index b8cdbc4..0000000
--- a/res/drawable-xhdpi/ic_launcher_info_active_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_info_normal.png b/res/drawable-xhdpi/ic_launcher_info_normal.png
new file mode 100644
index 0000000..5c49816
--- /dev/null
+++ b/res/drawable-xhdpi/ic_launcher_info_normal.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_info_normal_holo.png b/res/drawable-xhdpi/ic_launcher_info_normal_holo.png
deleted file mode 100644
index f503fb8..0000000
--- a/res/drawable-xhdpi/ic_launcher_info_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_remove_active.png b/res/drawable-xhdpi/ic_launcher_remove_active.png
new file mode 100644
index 0000000..14ac79d
--- /dev/null
+++ b/res/drawable-xhdpi/ic_launcher_remove_active.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_remove_normal.png b/res/drawable-xhdpi/ic_launcher_remove_normal.png
new file mode 100644
index 0000000..8188805
--- /dev/null
+++ b/res/drawable-xhdpi/ic_launcher_remove_normal.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_trashcan_active_holo.png b/res/drawable-xhdpi/ic_launcher_trashcan_active_holo.png
deleted file mode 100644
index c155274..0000000
--- a/res/drawable-xhdpi/ic_launcher_trashcan_active_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_trashcan_normal_holo.png b/res/drawable-xhdpi/ic_launcher_trashcan_normal_holo.png
deleted file mode 100644
index 2ec7ad9..0000000
--- a/res/drawable-xhdpi/ic_launcher_trashcan_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_uninstall_active.png b/res/drawable-xhdpi/ic_launcher_uninstall_active.png
new file mode 100644
index 0000000..2c19b32
--- /dev/null
+++ b/res/drawable-xhdpi/ic_launcher_uninstall_active.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher_uninstall_normal.png b/res/drawable-xhdpi/ic_launcher_uninstall_normal.png
new file mode 100644
index 0000000..a093f28
--- /dev/null
+++ b/res/drawable-xhdpi/ic_launcher_uninstall_normal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_clear_active_holo.png b/res/drawable-xxhdpi/ic_launcher_clear_active_holo.png
deleted file mode 100644
index 95cf841..0000000
--- a/res/drawable-xxhdpi/ic_launcher_clear_active_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_clear_normal_holo.png b/res/drawable-xxhdpi/ic_launcher_clear_normal_holo.png
deleted file mode 100644
index b0f5a27..0000000
--- a/res/drawable-xxhdpi/ic_launcher_clear_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_info_active.png b/res/drawable-xxhdpi/ic_launcher_info_active.png
new file mode 100644
index 0000000..d354dd3
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_launcher_info_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_info_active_holo.png b/res/drawable-xxhdpi/ic_launcher_info_active_holo.png
deleted file mode 100644
index 57f332a..0000000
--- a/res/drawable-xxhdpi/ic_launcher_info_active_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_info_normal.png b/res/drawable-xxhdpi/ic_launcher_info_normal.png
new file mode 100644
index 0000000..c270be2
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_launcher_info_normal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_info_normal_holo.png b/res/drawable-xxhdpi/ic_launcher_info_normal_holo.png
deleted file mode 100644
index 94f0955..0000000
--- a/res/drawable-xxhdpi/ic_launcher_info_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_remove_active.png b/res/drawable-xxhdpi/ic_launcher_remove_active.png
new file mode 100644
index 0000000..9df4404
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_launcher_remove_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_remove_normal.png b/res/drawable-xxhdpi/ic_launcher_remove_normal.png
new file mode 100644
index 0000000..5bc8f0c
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_launcher_remove_normal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_trashcan_active_holo.png b/res/drawable-xxhdpi/ic_launcher_trashcan_active_holo.png
deleted file mode 100644
index 3bb098c..0000000
--- a/res/drawable-xxhdpi/ic_launcher_trashcan_active_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_trashcan_normal_holo.png b/res/drawable-xxhdpi/ic_launcher_trashcan_normal_holo.png
deleted file mode 100644
index 550cc5b..0000000
--- a/res/drawable-xxhdpi/ic_launcher_trashcan_normal_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_uninstall_active.png b/res/drawable-xxhdpi/ic_launcher_uninstall_active.png
new file mode 100644
index 0000000..db7d339
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_launcher_uninstall_active.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher_uninstall_normal.png b/res/drawable-xxhdpi/ic_launcher_uninstall_normal.png
new file mode 100644
index 0000000..4fce55b
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_launcher_uninstall_normal.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_launcher_info_active.png b/res/drawable-xxxhdpi/ic_launcher_info_active.png
new file mode 100644
index 0000000..162e23d
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_launcher_info_active.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_launcher_info_normal.png b/res/drawable-xxxhdpi/ic_launcher_info_normal.png
new file mode 100644
index 0000000..270e15d
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_launcher_info_normal.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_launcher_remove_active.png b/res/drawable-xxxhdpi/ic_launcher_remove_active.png
new file mode 100644
index 0000000..c0b8ea2
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_launcher_remove_active.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_launcher_remove_normal.png b/res/drawable-xxxhdpi/ic_launcher_remove_normal.png
new file mode 100644
index 0000000..ed96c55
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_launcher_remove_normal.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_launcher_uninstall_active.png b/res/drawable-xxxhdpi/ic_launcher_uninstall_active.png
new file mode 100644
index 0000000..75896f3
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_launcher_uninstall_active.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_launcher_uninstall_normal.png b/res/drawable-xxxhdpi/ic_launcher_uninstall_normal.png
new file mode 100644
index 0000000..61490b9
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_launcher_uninstall_normal.png
Binary files differ
diff --git a/res/drawable/info_target_selector.xml b/res/drawable/info_target_selector.xml
index f3a7016..51caece 100644
--- a/res/drawable/info_target_selector.xml
+++ b/res/drawable/info_target_selector.xml
@@ -19,6 +19,6 @@
-->
<transition xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/ic_launcher_info_normal_holo" />
- <item android:drawable="@drawable/ic_launcher_info_active_holo" />
+ <item android:drawable="@drawable/ic_launcher_info_normal" />
+ <item android:drawable="@drawable/ic_launcher_info_active" />
</transition>
diff --git a/res/drawable/remove_target_selector.xml b/res/drawable/remove_target_selector.xml
index 5e071fb..9025e8a 100644
--- a/res/drawable/remove_target_selector.xml
+++ b/res/drawable/remove_target_selector.xml
@@ -19,6 +19,6 @@
-->
<transition xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/ic_launcher_clear_normal_holo" />
- <item android:drawable="@drawable/ic_launcher_clear_active_holo" />
+ <item android:drawable="@drawable/ic_launcher_remove_normal" />
+ <item android:drawable="@drawable/ic_launcher_remove_active" />
</transition>
diff --git a/res/drawable/uninstall_target_selector.xml b/res/drawable/uninstall_target_selector.xml
index 229942e..175cc20 100644
--- a/res/drawable/uninstall_target_selector.xml
+++ b/res/drawable/uninstall_target_selector.xml
@@ -19,6 +19,6 @@
-->
<transition xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/ic_launcher_trashcan_normal_holo" />
- <item android:drawable="@drawable/ic_launcher_trashcan_active_holo" />
+ <item android:drawable="@drawable/ic_launcher_uninstall_normal" />
+ <item android:drawable="@drawable/ic_launcher_uninstall_active" />
</transition>
diff --git a/res/layout/add_list_item.xml b/res/layout/add_list_item.xml
deleted file mode 100644
index e937d7b..0000000
--- a/res/layout/add_list_item.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:gravity="center_vertical"
- android:drawablePadding="14dip"
- android:paddingLeft="15dip"
- android:paddingRight="15dip" />
diff --git a/res/layout/rename_folder.xml b/res/layout/rename_folder.xml
deleted file mode 100644
index 21a335c..0000000
--- a/res/layout/rename_folder.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="20dip"
- android:orientation="vertical">
-
- <TextView
- android:id="@+id/label"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:text="@string/rename_folder_label"
- android:gravity="start"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- <EditText
- android:id="@+id/folder_name"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:scrollHorizontally="true"
- android:autoText="false"
- android:capitalize="none"
- android:gravity="fill_horizontal"
- android:maxLength="30"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
-</LinearLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 58a4d4c..9695b26 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -20,8 +20,9 @@
<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">#DAFF0000</color>
- <color name="info_target_hover_tint">#DA0099CC</color>
+ <color name="delete_target_hover_tint">#DAC1C1C1</color>
+ <color name="uninstall_target_hover_tint">#DAF0592B</color>
+ <color name="info_target_hover_tint">#DA009688</color>
<color name="cling_scrim_background">#80000000</color>
<color name="bubble_dark_background">#20000000</color>
diff --git a/res/values/config.xml b/res/values/config.xml
index 47394a1..7ce4059 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -55,9 +55,6 @@
<integer name="config_appsCustomizeDragSlopeThreshold">150</integer>
<!-- Workspace -->
- <!-- The transition duration for the background of the drop targets -->
- <integer name="config_dropTargetBgTransitionDuration">0</integer>
-
<!-- The duration (in ms) of the fade animation on the object outlines, used when
we are dragging objects around on the home screen. -->
<integer name="config_dragOutlineFadeTime">900</integer>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3b94eb3..a5a681a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -34,8 +34,6 @@
<string name="application_name">Launcher3</string>
<!-- Accessibility-facing application name -->
<string name="home">Home</string>
- <!-- Name for all applications running as this uid. -->
- <string name="uid_name">Android Core Apps</string>
<!-- Default folder name -->
<string name="folder_name"></string>
<!-- Work folder name -->
@@ -48,10 +46,6 @@
<string name="safemode_shortcut_error">Downloaded app disabled in Safe mode</string>
<!-- SafeMode widget error string -->
<string name="safemode_widget_error">Widgets disabled in Safe mode</string>
- <!-- Labels for the tabs in the customize drawer -->
- <string name="widgets_tab_label">Widgets</string>
-
- <string name="widget_adder">Widgets</string>
<string name="toggle_weight_watcher">Show Mem</string>
@@ -62,17 +56,6 @@
<!-- There is a special version of this format string for Farsi -->
<string name="widget_dims_format">%1$d \u00d7 %2$d</string>
- <!-- External-drop widget pick label format string [CHAR_LIMIT=25] -->
- <string name="external_drop_widget_pick_format" translatable="false">%1$s (%2$d \u00d7 %3$d)</string>
- <!-- External-drop widget error string. This is the error that is shown
- when you drag and item into the homescreen and it is unable to fit,
- or an error is encountered. [CHAR_LIMIT=50] -->
- <string name="external_drop_widget_error">Couldn\'t drop item on this Home screen.</string>
- <!-- External-drop widget pick title. This is shown as the title of the
- dialog which allows you to pick which widgets to handle a particular
- drop if there are multiple choices. [CHAR_LIMIT=35] -->
- <string name="external_drop_widget_pick_title">Choose widget to create</string>
-
<!-- Apps view -->
<!-- Search bar text in the apps view. [CHAR_LIMIT=50] -->
<string name="apps_view_search_bar_hint">Search Apps</string>
@@ -81,54 +64,18 @@
<!-- No-search-results text. [CHAR_LIMIT=50] -->
<string name="apps_view_no_search_results">No Apps found matching \"<xliff:g id="query" example="Android">%1$s</xliff:g>\"</string>
- <!-- Folders -->
+ <!-- Drag and drop -->
<skip />
- <!-- Label of Folder name field in Rename folder dialog box -->
- <string name="rename_folder_label">Folder name</string>
- <!-- Title of dialog box -->
- <string name="rename_folder_title">Rename folder</string>
- <!-- Buttons in Rename folder dialog box -->
- <string name="rename_action">OK</string>
- <!-- Buttons in Rename folder dialog box -->
- <string name="cancel_action">Cancel</string>
-
- <!-- Shortcuts -->
- <skip />
- <!-- Title of dialog box -->
- <string name="menu_item_add_item">Add to Home screen</string>
- <!-- Options in "Add to Home" dialog box; Title of the group containing the list of all apps -->
- <string name="group_applications">Apps</string>
- <!-- Options in "Add to Home" dialog box; Title of the group containing the list of all shortcut
-s -->
- <string name="group_shortcuts">Shortcuts</string>
- <!-- Options in "Add to Home" dialog box; Title of the group containing the list of all widgets/gadgets -->
- <string name="group_widgets">Widgets</string>
- <!-- Error message when user has filled all their home screens -->
- <string name="completely_out_of_space">No more room on your Home screens.</string>
<!-- Error message when user has filled a home screen -->
<string name="out_of_space">No more room on this Home screen.</string>
<!-- Error message when user has filled the hotseat -->
<string name="hotseat_out_of_space">No more room in the Favorites tray</string>
- <!-- Error message when user tries to drop an invalid item on the hotseat -->
- <string name="invalid_hotseat_item">This widget is too large for the Favorites tray</string>
- <!-- Message displayed when a shortcut is created by an external application -->
- <string name="shortcut_installed">Shortcut \"<xliff:g id="name" example="Browser">%s</xliff:g>\" created.</string>
- <!-- Message displayed when an external application attemps to create a shortcut that already exists -->
- <string name="shortcut_duplicate">Shortcut \"<xliff:g id="name" example="Browser">%s</xliff:g>\" already exists.</string>
-
- <!-- Title of dialog when user is selecting shortcut to add to homescreen -->
- <string name="title_select_shortcut">Choose shortcut</string>
- <!-- Title of dialog when user is selecting an application to add to homescreen -->
- <string name="title_select_application">Choose app</string>
<!-- All applications label -->
<string name="all_apps_button_label">Apps</string>
<!-- Label for button in all applications label to go back home (to the workspace / desktop)
for accessibilty (spoken when the button gets focus). -->
<string name="all_apps_home_button_label">Home</string>
- <!-- Label for trash icon in All Apps. The icon/widget will become completely unavailable on the
- device. [CHAR_LIMIT=30]-->
- <string name="delete_zone_label_all_apps">Uninstall</string>
<!-- Label for delete drop target. [CHAR_LIMIT=20] -->
<string name="delete_target_label">Remove</string>
@@ -137,35 +84,6 @@
<!-- Label for the info icon. [CHAR_LIMIT=20] -->
<string name="info_target_label">App info</string>
- <!-- Accessibility: AllApps button -->
- <string name="accessibility_all_apps_button">Apps</string>
- <!-- Accessibility: Delete button -->
- <string name="accessibility_delete_button">Remove</string>
-
- <!-- Label for trash icon in All Apps, when an updated system app is selected. The update will
- be uninstalled. [CHAR_LIMIT=30] -->
- <string name="delete_zone_label_all_apps_system_app">Uninstall update</string>
-
- <!-- URL pointing to help text. If empty, no link to help will be created [DO NOT TRANSLATE] -->
- <string name="help_url" translatable="false"></string>
-
- <!-- Strings for the contextual action bar (CAB) in All Apps -->
- <skip />
- <!-- Describes the button for uninstalling the currently selected application.
- Text is not displayed, but provided for accessibility. [CHAR_LIMIT=none] -->
- <string name="cab_menu_delete_app">Uninstall app</string>
- <!-- Describes the button for getting details/info about currently selected application.
- Text is not displayed, but provided for accessibility. [CHAR_LIMIT=none] -->
- <string name="cab_menu_app_info">App details</string>
- <!-- Appears in the CAB when an app is selected in All Apps or Customize mode. [CHAR_LIMIT=50] -->
- <string name="cab_app_selection_text">1 app selected</string>
- <!-- Appears in the CAB when a widget is selected in Customize mode. [CHAR_LIMIT=50] -->
- <string name="cab_widget_selection_text">1 widget selected</string>
- <!-- Appears in the CAB when a folder is selected in Customize mode. [CHAR_LIMIT=50] -->
- <string name="cab_folder_selection_text">1 folder selected</string>
- <!-- Appears in the CAB when a shortcut is selected in Customize mode. [CHAR_LIMIT=50] -->
- <string name="cab_shortcut_selection_text">1 shortcut selected</string>
-
<!-- Permissions: -->
<skip />
<!-- Permission short label -->
@@ -196,9 +114,6 @@
<!-- Text to inform the user that they can't uninstall a system application -->
<string name="uninstall_system_app_text">This is a system app and can\'t be uninstalled.</string>
- <!-- Title of the Android Dreams (screensaver) module -->
- <string name="dream_name">Rocket Launcher</string>
-
<!-- Default folder title -->
<string name="folder_hint_text">Unnamed Folder</string>
@@ -212,22 +127,10 @@
<string name="default_scroll_format">Page %1$d of %2$d</string>
<!-- The format string for Workspace page scroll text [CHAR_LIMIT=none] -->
<string name="workspace_scroll_format">Home screen %1$d of %2$d</string>
- <!-- The format string for AppsCustomize Apps page scroll text [CHAR_LIMIT=none] -->
- <string name="apps_customize_apps_scroll_format">Apps page %1$d of %2$d</string>
- <!-- The format string for AppsCustomize Apps page scroll text [CHAR_LIMIT=none] -->
- <string name="apps_customize_widgets_scroll_format">Widgets page %1$d of %2$d</string>
<!-- Clings -->
<!-- The title text for the workspace cling [CHAR_LIMIT=30] -->
<string name="first_run_cling_title">Welcome</string>
- <!-- The description of how to use the workspace [CHAR_LIMIT=60] -->
- <string name="first_run_cling_description">Make yourself at home.</string>
- <!-- The description of how to use the workspace [CHAR_LIMIT=60] -->
- <string name="first_run_cling_custom_content_hint"></string>
- <!-- The description of how to use the workspace [CHAR_LIMIT=60] -->
- <string name="first_run_cling_search_bar_hint"></string>
- <!-- The description of how to use the workspace [CHAR_LIMIT=60] -->
- <string name="first_run_cling_create_screens_hint">Create more screens for apps and folders</string>
<!-- The title text for the migration cling [CHAR_LIMIT=30] -->
<string name="migration_cling_title">Copy your app icons</string>
<!-- The description of what migration does [CHAR_LIMIT=70] -->
@@ -236,24 +139,14 @@
<string name="migration_cling_copy_apps">COPY ICONS</string>
<!-- The description of the button to use the default launcher layout [CHAR_LIMIT=30] -->
<string name="migration_cling_use_default">START FRESH</string>
- <!-- The title text for the workspace cling [CHAR_LIMIT=30] -->
- <string name="workspace_cling_title">Organize your space</string>
- <!-- The description of how to use the workspace [CHAR_LIMIT=70] -->
- <string name="workspace_cling_move_item">Touch & hold background to manage wallpaper, widgets and settings.</string>
<!-- The title text for workspace longpress action [CHAR_LIMIT=40] -->
<string name="workspace_cling_longpress_title">Wallpapers, widgets, & settings</string>
<!-- The description of how to use the workspace [CHAR_LIMIT=70] -->
<string name="workspace_cling_longpress_description">Touch & hold background to customize</string>
<!-- The description of the button to dismiss the cling [CHAR_LIMIT=30] -->
<string name="workspace_cling_longpress_dismiss">GOT IT</string>
- <!-- The title text for the Folder cling [CHAR_LIMIT=30] -->
- <string name="folder_cling_title">Here\'s a folder</string>
- <!-- The description of how to create a folder [CHAR_LIMIT=70] -->
- <string name="folder_cling_create_folder">To create one like this, touch & hold an app, then move it over another.</string>
<!-- The text on the button to dismiss a cling [CHAR_LIMIT=30] -->
<string name="cling_dismiss">OK</string>
- <!-- Error message on dummy custom cling layout [DO NOT TRANSLATE] -->
- <string name="dummy_custom_cling_error_message">Error: custom workspace layout passed in but custom cling was not overwritten</string>
<!-- Folder accessibility -->
<!-- The format string for when a folder is opened, speaks the dimensions -->
diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java
index daa07d0..7cf002e 100644
--- a/src/com/android/launcher3/ButtonDropTarget.java
+++ b/src/com/android/launcher3/ButtonDropTarget.java
@@ -16,14 +16,16 @@
package com.android.launcher3;
+import android.animation.ObjectAnimator;
+import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
-import android.content.res.Resources;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
+import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
@@ -42,8 +44,6 @@
private static int DRAG_VIEW_DROP_DURATION = 285;
- protected final int mTransitionDuration;
-
protected Launcher mLauncher;
private int mBottomDragPadding;
protected TextView mText;
@@ -58,16 +58,15 @@
protected ColorStateList mOriginalTextColor;
protected TransitionDrawable mDrawable;
+ private ObjectAnimator mCurrentColorAnim;
+
public ButtonDropTarget(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public ButtonDropTarget(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
-
- Resources r = getResources();
- mTransitionDuration = r.getInteger(R.integer.config_dropTargetBgTransitionDuration);
- mBottomDragPadding = r.getDimensionPixelSize(R.dimen.drop_target_drag_padding);
+ mBottomDragPadding = getResources().getDimensionPixelSize(R.dimen.drop_target_drag_padding);
}
@Override
@@ -123,8 +122,13 @@
@Override
public final void onDragEnter(DragObject d) {
d.dragView.setColor(mHoverColor);
- mDrawable.startTransition(mTransitionDuration);
- setTextColor(mHoverColor);
+ if (Utilities.isLmpOrAbove()) {
+ mDrawable.startTransition(DragView.COLOR_CHANGE_DURATION);
+ animateTextColor(mHoverColor);
+ } else {
+ mDrawable.startTransition(0);
+ setTextColor(mHoverColor);
+ }
}
@Override
@@ -133,8 +137,23 @@
}
protected void resetHoverColor() {
- mDrawable.resetTransition();
- setTextColor(mOriginalTextColor);
+ if (Utilities.isLmpOrAbove()) {
+ mDrawable.reverseTransition(DragView.COLOR_CHANGE_DURATION);
+ animateTextColor(mOriginalTextColor.getDefaultColor());
+ } else {
+ mDrawable.resetTransition();
+ setTextColor(mOriginalTextColor);
+ }
+ }
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ private void animateTextColor(int targetColor) {
+ if (mCurrentColorAnim != null) {
+ mCurrentColorAnim.cancel();
+ }
+ mCurrentColorAnim = ObjectAnimator.ofArgb(this, "textColor", targetColor);
+ mCurrentColorAnim.setDuration(DragView.COLOR_CHANGE_DURATION);
+ mCurrentColorAnim.start();
}
@Override
@@ -152,6 +171,10 @@
public final void onDragStart(DragSource source, Object info, int dragAction) {
mActive = supportsDrop(source, info);
mDrawable.resetTransition();
+ if (mCurrentColorAnim != null) {
+ mCurrentColorAnim.cancel();
+ mCurrentColorAnim = null;
+ }
setTextColor(mOriginalTextColor);
((ViewGroup) getParent()).setVisibility(mActive ? View.VISIBLE : View.GONE);
}
@@ -274,4 +297,8 @@
LauncherAppState.getInstance().getAccessibilityDelegate()
.handleAccessibleDrop(this, null, getAccessibilityDropConfirmation());
}
+
+ public int getTextColor() {
+ return getTextColors().getDefaultColor();
+ }
}
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index f5d2f7d..94f2275 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -3048,4 +3048,8 @@
public boolean lastDownOnOccupiedCell() {
return mLastDownOnOccupiedCell;
}
+
+ public boolean findVacantCell(int spanX, int spanY, int[] outXY) {
+ return Utilities.findVacantCell(outXY, spanX, spanY, mCountX, mCountY, mOccupied);
+ }
}
diff --git a/src/com/android/launcher3/DragView.java b/src/com/android/launcher3/DragView.java
index b1a6266..a4b6704 100644
--- a/src/com/android/launcher3/DragView.java
+++ b/src/com/android/launcher3/DragView.java
@@ -16,22 +16,30 @@
package com.android.launcher3;
+import android.animation.FloatArrayEvaluator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
+import android.annotation.TargetApi;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ColorMatrix;
+import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.Point;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
+import android.os.Build;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import com.android.launcher3.util.Thunk;
+import java.util.Arrays;
+
public class DragView extends View {
+ public static int COLOR_CHANGE_DURATION = 200;
+
@Thunk static float sDragAlpha = 1f;
private Bitmap mBitmap;
@@ -54,6 +62,9 @@
// size. This is ignored for non-icons.
private float mIntrinsicIconScale = 1f;
+ private float[] mCurrentFilter;
+ private ValueAnimator mFilterAnimator;
+
/**
* Construct the drag view.
* <p>
@@ -229,11 +240,50 @@
mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
}
if (color != 0) {
- mPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP));
+ ColorMatrix m1 = new ColorMatrix();
+ m1.setSaturation(0);
+
+ ColorMatrix m2 = new ColorMatrix();
+ m2.setScale(Color.red(color) / 255f, Color.green(color) / 255f,
+ Color.blue(color) / 255f, Color.alpha(color) / 255f);
+ m1.postConcat(m2);
+
+ if (Utilities.isLmpOrAbove()) {
+ animateFilterTo(m1.getArray());
+ } else {
+ mPaint.setColorFilter(new ColorMatrixColorFilter(m1));
+ invalidate();
+ }
} else {
- mPaint.setColorFilter(null);
+ if (!Utilities.isLmpOrAbove() || mCurrentFilter == null) {
+ mPaint.setColorFilter(null);
+ invalidate();
+ } else {
+ animateFilterTo(new ColorMatrix().getArray());
+ }
}
- invalidate();
+ }
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ private void animateFilterTo(float[] targetFilter) {
+ float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
+ mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);
+
+ if (mFilterAnimator != null) {
+ mFilterAnimator.cancel();
+ }
+ mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
+ oldFilter, targetFilter);
+ mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
+ mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {
+
+ @Override
+ public void onAnimationUpdate(ValueAnimator animation) {
+ mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
+ invalidate();
+ }
+ });
+ mFilterAnimator.start();
}
public boolean hasDrawn() {
@@ -301,4 +351,3 @@
}
}
}
-
diff --git a/src/com/android/launcher3/FolderPagedView.java b/src/com/android/launcher3/FolderPagedView.java
index c68ef72..a07a3dc 100644
--- a/src/com/android/launcher3/FolderPagedView.java
+++ b/src/com/android/launcher3/FolderPagedView.java
@@ -95,6 +95,7 @@
mIconCache = app.getIconCache();
rtlLayout = getResources().getConfiguration().getLayoutDirection() == LAYOUT_DIRECTION_RTL;
+ setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
}
public void setFolder(Folder folder) {
@@ -237,6 +238,7 @@
CellLayout page = new CellLayout(getContext());
page.setCellDimensions(grid.folderCellWidthPx, grid.folderCellHeightPx);
page.getShortcutsAndWidgets().setMotionEventSplittingEnabled(false);
+ page.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
page.setInvertIfRtl(true);
page.setGridSize(mGridCountX, mGridCountY);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 8c920f0..2ef5d0a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3546,9 +3546,9 @@
text.clear();
// Populate event with a fake title based on the current state.
if (mState == State.APPS) {
- text.add("Apps");
+ text.add(getString(R.string.all_apps_button_label));
} else if (mState == State.WIDGETS) {
- text.add("Widgets");
+ text.add(getString(R.string.widget_button_text));
} else {
text.add(getString(R.string.all_apps_home_button_label));
}
@@ -3702,19 +3702,6 @@
}
}
- @Override
- public void bindAddPendingItem(final PendingAddItemInfo info, final long container,
- final long screenId, final int[] cell, final int spanX, final int spanY) {
- showWorkspace(true, new Runnable() {
-
- @Override
- public void run() {
- mWorkspace.snapToPage(mWorkspace.getPageIndexForScreenId(screenId));
- addPendingItem(info, container, screenId, cell, spanX, spanY);
- }
- });
- }
-
private boolean shouldShowWeightWatcher() {
String spKey = LauncherAppState.getSharedPreferencesKey();
SharedPreferences sp = getSharedPreferences(spKey, Context.MODE_PRIVATE);
diff --git a/src/com/android/launcher3/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/LauncherAccessibilityDelegate.java
index 4255fa4..a527db4 100644
--- a/src/com/android/launcher3/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/LauncherAccessibilityDelegate.java
@@ -5,13 +5,13 @@
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
+import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import android.view.View.AccessibilityDelegate;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
-import com.android.launcher3.LauncherModel.ScreenPosProvider;
import com.android.launcher3.util.Thunk;
import java.util.ArrayList;
@@ -19,11 +19,13 @@
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class LauncherAccessibilityDelegate extends AccessibilityDelegate {
- public static final int REMOVE = R.id.action_remove;
- public static final int INFO = R.id.action_info;
- public static final int UNINSTALL = R.id.action_uninstall;
- public static final int ADD_TO_WORKSPACE = R.id.action_add_to_workspace;
- public static final int MOVE = R.id.action_move;
+ private static final String TAG = "LauncherAccessibilityDelegate";
+
+ private static final int REMOVE = R.id.action_remove;
+ private static final int INFO = R.id.action_info;
+ private static final int UNINSTALL = R.id.action_uninstall;
+ private static final int ADD_TO_WORKSPACE = R.id.action_add_to_workspace;
+ private static final int MOVE = R.id.action_move;
public enum DragType {
ICON,
@@ -37,8 +39,7 @@
public View item;
}
- private final SparseArray<AccessibilityAction> mActions =
- new SparseArray<AccessibilityAction>();
+ private final SparseArray<AccessibilityAction> mActions = new SparseArray<>();
@Thunk final Launcher mLauncher;
private DragInfo mDragInfo = null;
@@ -57,7 +58,6 @@
launcher.getText(R.string.action_add_to_workspace)));
mActions.put(MOVE, new AccessibilityAction(MOVE,
launcher.getText(R.string.action_move)));
-
}
@Override
@@ -94,7 +94,7 @@
return super.performAccessibilityAction(host, action, args);
}
- public boolean performAction(View host, ItemInfo item, int action) {
+ public boolean performAction(View host, final ItemInfo item, int action) {
if (action == REMOVE) {
if (DeleteDropTarget.removeWorkspaceOrFolderItem(mLauncher, item, host)) {
announceConfirmation(R.string.item_removed);
@@ -109,32 +109,32 @@
} else if (action == MOVE) {
beginAccessibleDrag(host, item);
} else if (action == ADD_TO_WORKSPACE) {
- final int preferredPage = mLauncher.getWorkspace().getCurrentPage();
- final ScreenPosProvider screenProvider = new ScreenPosProvider() {
+ final int[] coordinates = new int[2];
+ final long screenId = findSpaceOnWorkspace(item, coordinates);
+ mLauncher.showWorkspace(true, new Runnable() {
@Override
- public int getScreenIndex(ArrayList<Long> screenIDs) {
- return preferredPage;
- }
- };
- if (item instanceof AppInfo) {
- final ArrayList<ItemInfo> addShortcuts = new ArrayList<ItemInfo>();
- addShortcuts.add(((AppInfo) item).makeShortcut());
- mLauncher.showWorkspace(true, new Runnable() {
- @Override
- public void run() {
- mLauncher.getModel().addAndBindAddedWorkspaceItems(
- mLauncher, addShortcuts, screenProvider, 0, true);
- announceConfirmation(R.string.item_added_to_workspace);
+ public void run() {
+ if (item instanceof AppInfo) {
+ ShortcutInfo info = ((AppInfo) item).makeShortcut();
+ LauncherModel.addItemToDatabase(mLauncher, info,
+ LauncherSettings.Favorites.CONTAINER_DESKTOP,
+ screenId, coordinates[0], coordinates[1]);
+
+ ArrayList<ItemInfo> itemList = new ArrayList<>();
+ itemList.add(info);
+ mLauncher.bindItems(itemList, 0, itemList.size(), true);
+ } else if (item instanceof PendingAddItemInfo) {
+ PendingAddItemInfo info = (PendingAddItemInfo) item;
+ Workspace workspace = mLauncher.getWorkspace();
+ workspace.snapToPage(workspace.getPageIndexForScreenId(screenId));
+ mLauncher.addPendingItem(info, LauncherSettings.Favorites.CONTAINER_DESKTOP,
+ screenId, coordinates, info.spanX, info.spanY);
}
- });
- return true;
- } else if (item instanceof PendingAddItemInfo) {
- mLauncher.getModel().addAndBindPendingItem(
- mLauncher, (PendingAddItemInfo) item, screenProvider, 0);
- announceConfirmation(R.string.item_added_to_workspace);
- return true;
- }
+ announceConfirmation(R.string.item_added_to_workspace);
+ }
+ });
+ return true;
}
return false;
}
@@ -243,4 +243,41 @@
void enableAccessibleDrag(boolean enable);
}
+
+ /**
+ * Find empty space on the workspace and returns the screenId.
+ */
+ private long findSpaceOnWorkspace(ItemInfo info, int[] outCoordinates) {
+ Workspace workspace = mLauncher.getWorkspace();
+ ArrayList<Long> workspaceScreens = workspace.getScreenOrder();
+ long screenId;
+
+ // First check if there is space on the current screen.
+ int screenIndex = workspace.getCurrentPage();
+ screenId = workspaceScreens.get(screenIndex);
+ CellLayout layout = (CellLayout) workspace.getPageAt(screenIndex);
+
+ boolean found = layout.findCellForSpan(outCoordinates, info.spanX, info.spanY);
+ screenIndex = workspace.hasCustomContent() ? 1 : 0;
+ while (!found && screenIndex < workspaceScreens.size()) {
+ screenId = workspaceScreens.get(screenIndex);
+ layout = (CellLayout) workspace.getPageAt(screenIndex);
+ found = layout.findCellForSpan(outCoordinates, info.spanX, info.spanY);
+ screenIndex++;
+ }
+
+ if (found) {
+ return screenId;
+ }
+
+ workspace.addExtraEmptyScreen();
+ screenId = workspace.commitExtraEmptyScreen();
+ layout = workspace.getScreenWithId(screenId);
+ found = layout.findCellForSpan(outCoordinates, info.spanX, info.spanY);
+
+ if (!found) {
+ Log.wtf(TAG, "Not enough space on an empty screen");
+ }
+ return screenId;
+ }
}
diff --git a/src/com/android/launcher3/LauncherBackupHelper.java b/src/com/android/launcher3/LauncherBackupHelper.java
index 064f436..92bbb40 100644
--- a/src/com/android/launcher3/LauncherBackupHelper.java
+++ b/src/com/android/launcher3/LauncherBackupHelper.java
@@ -88,11 +88,6 @@
/** widgets contain previews, which are very large, dribble them out */
private static final int MAX_WIDGETS_PER_PASS = 5;
- private static final int IMAGE_COMPRESSION_QUALITY = 75;
-
- private static final Bitmap.CompressFormat IMAGE_FORMAT =
- android.graphics.Bitmap.CompressFormat.PNG;
-
private static final String[] FAVORITE_PROJECTION = {
Favorites._ID, // 0
Favorites.MODIFIED, // 1
@@ -969,10 +964,7 @@
private Resource packIcon(int dpi, Bitmap icon) {
Resource res = new Resource();
res.dpi = dpi;
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- if (icon.compress(IMAGE_FORMAT, IMAGE_COMPRESSION_QUALITY, os)) {
- res.data = os.toByteArray();
- }
+ res.data = Utilities.flattenBitmap(icon);
return res;
}
@@ -990,20 +982,14 @@
widget.icon = new Resource();
Drawable fullResIcon = iconCache.getFullResIcon(provider.getPackageName(), info.icon);
Bitmap icon = Utilities.createIconBitmap(fullResIcon, mContext);
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- if (icon.compress(IMAGE_FORMAT, IMAGE_COMPRESSION_QUALITY, os)) {
- widget.icon.data = os.toByteArray();
- widget.icon.dpi = dpi;
- }
+ widget.icon.data = Utilities.flattenBitmap(icon);
+ widget.icon.dpi = dpi;
}
if (info.previewImage != 0) {
widget.preview = new Resource();
Bitmap preview = previewLoader.generateWidgetPreview(info, previewWidth, null);
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- if (preview.compress(IMAGE_FORMAT, IMAGE_COMPRESSION_QUALITY, os)) {
- widget.preview.data = os.toByteArray();
- widget.preview.dpi = dpi;
- }
+ widget.preview.data = Utilities.flattenBitmap(preview);
+ widget.preview.dpi = dpi;
}
return widget;
}
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 00afd98..97a2830 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -35,7 +35,6 @@
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
-import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
@@ -203,18 +202,12 @@
public boolean isAllAppsButtonRank(int rank);
public void onPageBoundSynchronously(int page);
public void dumpLogsToLocalData();
- public void bindAddPendingItem(PendingAddItemInfo info, long container, long screenId,
- int[] cell, int spanX, int spanY);
}
public interface ItemInfoFilter {
public boolean filterItem(ItemInfo parent, ItemInfo info, ComponentName cn);
}
- public interface ScreenPosProvider {
- int getScreenIndex(ArrayList<Long> screenIDs);
- }
-
LauncherModel(LauncherAppState app, IconCache iconCache, AppFilter appFilter) {
Context context = app.getContext();
@@ -406,19 +399,7 @@
runOnWorkerThread(r);
}
- public void addAndBindAddedWorkspaceItems(final Context context,
- final ArrayList<ItemInfo> workspaceApps) {
- addAndBindAddedWorkspaceItems(context, workspaceApps,
- new ScreenPosProvider() {
-
- @Override
- public int getScreenIndex(ArrayList<Long> screenIDs) {
- return screenIDs.isEmpty() ? 0 : 1;
- }
- }, 1, false);
- }
-
- private static boolean findNextAvailableIconSpaceInScreen(ArrayList<Rect> occupiedPos,
+ private static boolean findNextAvailableIconSpaceInScreen(ArrayList<ItemInfo> occupiedPos,
int[] xy, int spanX, int spanY) {
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
@@ -426,9 +407,11 @@
final int yCount = (int) grid.numRows;
boolean[][] occupied = new boolean[xCount][yCount];
if (occupiedPos != null) {
- for (Rect r : occupiedPos) {
- for (int x = r.left; 0 <= x && x < r.right && x < xCount; x++) {
- for (int y = r.top; 0 <= y && y < r.bottom && y < yCount; y++) {
+ for (ItemInfo r : occupiedPos) {
+ int right = r.cellX + r.spanX;
+ int bottom = r.cellY + r.spanY;
+ for (int x = r.cellX; 0 <= x && x < right && x < xCount; x++) {
+ for (int y = r.cellY; 0 <= y && y < bottom && y < yCount; y++) {
occupied[x][y] = true;
}
}
@@ -443,53 +426,24 @@
*/
@Thunk static Pair<Long, int[]> findSpaceForItem(
Context context,
- ScreenPosProvider preferredScreen,
- int fallbackStartScreen,
ArrayList<Long> workspaceScreens,
ArrayList<Long> addedWorkspaceScreensFinal,
int spanX, int spanY) {
- // Load position of items which are on the desktop. We can't use sBgItemsIdMap because
- // loadWorkspace() may not have been called.
- final ContentResolver cr = context.getContentResolver();
- Cursor c = cr.query(LauncherSettings.Favorites.CONTENT_URI,
- new String[] {
- LauncherSettings.Favorites.SCREEN,
- LauncherSettings.Favorites.CELLX,
- LauncherSettings.Favorites.CELLY,
- LauncherSettings.Favorites.SPANX,
- LauncherSettings.Favorites.SPANY,
- LauncherSettings.Favorites.CONTAINER
- },
- "container=?",
- new String[] { Integer.toString(LauncherSettings.Favorites.CONTAINER_DESKTOP) },
- null);
+ LongSparseArray<ArrayList<ItemInfo>> screenItems = new LongSparseArray<>();
- final int screenIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.SCREEN);
- final int cellXIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.CELLX);
- final int cellYIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.CELLY);
- final int spanXIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.SPANX);
- final int spanYIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.SPANY);
- LongSparseArray<ArrayList<Rect>> screenItems = new LongSparseArray<ArrayList<Rect>>();
- try {
- while (c.moveToNext()) {
- Rect rect = new Rect();
- rect.left = c.getInt(cellXIndex);
- rect.top = c.getInt(cellYIndex);
- rect.right = rect.left + Math.max(1, c.getInt(spanXIndex));
- rect.bottom = rect.top + Math.max(1, c.getInt(spanYIndex));
-
- long screenId = c.getInt(screenIndex);
- ArrayList<Rect> items = screenItems.get(screenId);
- if (items == null) {
- items = new ArrayList<Rect>();
- screenItems.put(screenId, items);
+ // Use sBgItemsIdMap as all the items are already loaded.
+ // TODO: Throw exception is above condition is not met.
+ synchronized (sBgLock) {
+ for (ItemInfo info : sBgItemsIdMap) {
+ if (info.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ ArrayList<ItemInfo> items = screenItems.get(info.screenId);
+ if (items == null) {
+ items = new ArrayList<>();
+ screenItems.put(info.screenId, items);
+ }
+ items.add(info);
}
- items.add(rect);
}
- } catch (Exception e) {
- screenItems.clear();
- } finally {
- c.close();
}
// Find appropriate space for the item.
@@ -499,7 +453,7 @@
int screenCount = workspaceScreens.size();
// First check the preferred screen.
- int preferredScreenIndex = preferredScreen.getScreenIndex(workspaceScreens);
+ int preferredScreenIndex = workspaceScreens.isEmpty() ? 0 : 1;
if (preferredScreenIndex < screenCount) {
screenId = workspaceScreens.get(preferredScreenIndex);
found = findNextAvailableIconSpaceInScreen(
@@ -507,8 +461,8 @@
}
if (!found) {
- // Search on any of the screens.
- for (int screen = fallbackStartScreen; screen < screenCount; screen++) {
+ // Search on any of the screens starting from the first screen.
+ for (int screen = 1; screen < screenCount; screen++) {
screenId = workspaceScreens.get(screen);
if (findNextAvailableIconSpaceInScreen(
screenItems.get(screenId), cordinates, spanX, spanY)) {
@@ -538,59 +492,9 @@
/**
* Adds the provided items to the workspace.
- * @param preferredScreen the screen where we should try to add the app first
- * @param fallbackStartScreen the screen to start search for empty space if
- * preferredScreen is not available.
- */
- public void addAndBindPendingItem(
- final Context context,
- final PendingAddItemInfo addInfo,
- final ScreenPosProvider preferredScreen,
- final int fallbackStartScreen) {
- final Callbacks callbacks = getCallback();
- // Process the newly added applications and add them to the database first
- Runnable r = new Runnable() {
- public void run() {
- final ArrayList<Long> addedWorkspaceScreensFinal = new ArrayList<Long>();
- ArrayList<Long> workspaceScreens = loadWorkspaceScreensDb(context);
-
- // Find appropriate space for the item.
- Pair<Long, int[]> coords = findSpaceForItem(context, preferredScreen,
- fallbackStartScreen, workspaceScreens, addedWorkspaceScreensFinal,
- addInfo.spanX,
- addInfo.spanY);
- final long screenId = coords.first;
- final int[] cordinates = coords.second;
-
- // Update the workspace screens
- updateWorkspaceScreenOrder(context, workspaceScreens);
- runOnMainThread(new Runnable() {
- public void run() {
- Callbacks cb = getCallback();
- if (callbacks == cb && cb != null) {
- cb.bindAddScreens(addedWorkspaceScreensFinal);
- cb.bindAddPendingItem(addInfo,
- LauncherSettings.Favorites.CONTAINER_DESKTOP,
- screenId, cordinates, addInfo.spanX, addInfo.spanY);
- }
- }
- });
- }
- };
- runOnWorkerThread(r);
- }
-
- /**
- * Adds the provided items to the workspace.
- * @param preferredScreen the screen where we should try to add the app first
- * @param fallbackStartScreen the screen to start search for empty space if
- * preferredScreen is not available.
*/
public void addAndBindAddedWorkspaceItems(final Context context,
- final ArrayList<ItemInfo> workspaceApps,
- final ScreenPosProvider preferredScreen,
- final int fallbackStartScreen,
- final boolean allowDuplicate) {
+ final ArrayList<ItemInfo> workspaceApps) {
final Callbacks callbacks = getCallback();
if (workspaceApps.isEmpty()) {
return;
@@ -607,7 +511,7 @@
ArrayList<Long> workspaceScreens = loadWorkspaceScreensDb(context);
synchronized(sBgLock) {
for (ItemInfo item : workspaceApps) {
- if (!allowDuplicate && item instanceof ShortcutInfo) {
+ if (item instanceof ShortcutInfo) {
// Short-circuit this logic if the icon exists somewhere on the workspace
if (shortcutExists(context, item.getIntent(), item.user)) {
continue;
@@ -615,8 +519,8 @@
}
// Find appropriate space for the item.
- Pair<Long, int[]> coords = findSpaceForItem(context, preferredScreen,
- fallbackStartScreen, workspaceScreens, addedWorkspaceScreensFinal,
+ Pair<Long, int[]> coords = findSpaceForItem(context,
+ workspaceScreens, addedWorkspaceScreensFinal,
1, 1);
long screenId = coords.first;
int[] cordinates = coords.second;
diff --git a/src/com/android/launcher3/UninstallDropTarget.java b/src/com/android/launcher3/UninstallDropTarget.java
index 4c52d7e..c351135 100644
--- a/src/com/android/launcher3/UninstallDropTarget.java
+++ b/src/com/android/launcher3/UninstallDropTarget.java
@@ -26,7 +26,7 @@
protected void onFinishInflate() {
super.onFinishInflate();
// Get the hover color
- mHoverColor = getResources().getColor(R.color.delete_target_hover_tint);
+ mHoverColor = getResources().getColor(R.color.uninstall_target_hover_tint);
setDrawable(R.drawable.uninstall_target_selector);
}