Merge "Updating fling to delete anim" into ub-launcher3-burnaby
diff --git a/res/layout/widget_cell.xml b/res/layout/widget_cell.xml
index cb1c812..ab23b84 100644
--- a/res/layout/widget_cell.xml
+++ b/res/layout/widget_cell.xml
@@ -44,7 +44,7 @@
             android:ellipsize="end"
             android:fadingEdge="horizontal"
 
-            android:textColor="#FFFFFFFF"
+            android:textColor="@color/widgets_view_item_text_color"
             android:textSize="16sp"
             android:textAlignment="viewStart"
             android:fontFamily="sans-serif-condensed"
@@ -61,7 +61,7 @@
             android:layout_marginLeft="5dp"
             android:layout_weight="0"
             android:gravity="start"
-            android:textColor="#FFFFFFFF"
+            android:textColor="@color/widgets_view_item_text_color"
             android:textSize="16sp"
             android:textAlignment="viewStart"
             android:fontFamily="sans-serif-condensed"
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 9695b26..0c3714b 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -42,6 +42,7 @@
     <color name="apps_view_section_text_color">#009688</color>
 
     <!-- Widgetss view -->
-    <color name="widgets_view_section_text_color">#009688</color>
+    <color name="widgets_view_section_text_color">#FFFFFF</color>
+    <color name="widgets_view_item_text_color">#C4C4C4</color>
     <color name="widgets_cell_color">#263238</color>
 </resources>
diff --git a/src/com/android/launcher3/AlphabeticalAppsList.java b/src/com/android/launcher3/AlphabeticalAppsList.java
index 2ee5a62..c7ee2e9 100644
--- a/src/com/android/launcher3/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/AlphabeticalAppsList.java
@@ -254,7 +254,7 @@
         int length = apps.size();
         for (int i = 0; i < length; ++i) {
             AppInfo info = apps.get(i);
-            if (info.user.equals(info.user)
+            if (info.user.equals(targetInfo.user)
                     && info.intent.getComponent().equals(targetComponent)) {
                 return i;
             }
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 4af3fc6..a282805 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -704,9 +704,15 @@
         if (mInfo.opened) {
             mLauncher.closeFolder();
             mRearrangeOnClose = true;
+        } else if (mState == STATE_ANIMATING) {
+            mRearrangeOnClose = true;
         } else {
             rearrangeChildren();
+            clearDragInfo();
         }
+    }
+
+    private void clearDragInfo() {
         mCurrentDragInfo = null;
         mCurrentDragView = null;
         mSuppressOnAdd = false;
@@ -1038,6 +1044,7 @@
             }
         }
         mSuppressFolderDeletion = false;
+        clearDragInfo();
     }
 
     @Thunk void replaceFolderWithFinalItem() {
diff --git a/src/com/android/launcher3/FolderInfo.java b/src/com/android/launcher3/FolderInfo.java
index 69b2ae7..80b1564 100644
--- a/src/com/android/launcher3/FolderInfo.java
+++ b/src/com/android/launcher3/FolderInfo.java
@@ -33,7 +33,6 @@
 
     /**
      * The folder is locked in sorted mode
-     * @deprecated
      */
     public static final int FLAG_ITEMS_SORTED = 0x00000001;
 
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 97a2830..9570735 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -881,22 +881,22 @@
      * TODO: Throw exception is above condition is not met.
      */
     @Thunk static boolean shortcutExists(Context context, Intent intent, UserHandleCompat user) {
-        final Intent intentWithPkg, intentWithoutPkg;
+        final String intentWithPkg, intentWithoutPkg;
         final String packageName;
         if (intent.getComponent() != null) {
             // If component is not null, an intent with null package will produce
             // the same result and should also be a match.
             packageName = intent.getComponent().getPackageName();
             if (intent.getPackage() != null) {
-                intentWithPkg = intent;
-                intentWithoutPkg = new Intent(intent).setPackage(null);
+                intentWithPkg = intent.toUri(0);
+                intentWithoutPkg = new Intent(intent).setPackage(null).toUri(0);
             } else {
-                intentWithPkg = new Intent(intent).setPackage(packageName);
-                intentWithoutPkg = intent;
+                intentWithPkg = new Intent(intent).setPackage(packageName).toUri(0);
+                intentWithoutPkg = intent.toUri(0);
             }
         } else {
-            intentWithPkg = intent;
-            intentWithoutPkg = intent;
+            intentWithPkg = intent.toUri(0);
+            intentWithoutPkg = intent.toUri(0);
             packageName = intent.getPackage();
         }
 
@@ -904,9 +904,11 @@
             for (ItemInfo item : sBgItemsIdMap) {
                 if (item instanceof ShortcutInfo) {
                     ShortcutInfo info = (ShortcutInfo) item;
-                    if (intentWithPkg.equals(info.getIntent())
-                            || intentWithoutPkg.equals(info.getIntent())) {
-                        return true;
+                    if (info.getIntent() != null && info.user.equals(user)) {
+                        String s = info.getIntent().toUri(0);
+                        if (intentWithPkg.equals(s) || intentWithoutPkg.equals(s)) {
+                            return true;
+                        }
                     }
                 }
             }
diff --git a/src/com/android/launcher3/widget/WidgetsListAdapter.java b/src/com/android/launcher3/widget/WidgetsListAdapter.java
index 051a3ab..a7728a1 100644
--- a/src/com/android/launcher3/widget/WidgetsListAdapter.java
+++ b/src/com/android/launcher3/widget/WidgetsListAdapter.java
@@ -161,10 +161,6 @@
 
     @Override
     public void onViewRecycled(WidgetsRowViewHolder holder) {
-        if (DEBUG) {
-            Log.v(TAG, String.format("onViewDetachedFromWindow, [pos=%d]",
-                    holder.getAdapterPosition()));
-        }
         ViewGroup row = ((ViewGroup) holder.getContent().findViewById(R.id.widgets_cell_list));
 
         for (int i = 0; i < row.getChildCount(); i++) {