Fix bug where first page Folder text stays transparent.

This can happen where you drag a new item to a Folder that has
a full first page.

Bug: 36022385
Bug: 35064148
Change-Id: I092a79a13b7f779f09ee7a79488a16fe8bfbc2fd
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index 2813321..d14bb40 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -69,7 +69,7 @@
     private final FolderIcon.PreviewItemDrawingParams mTmpParams =
             new FolderIcon.PreviewItemDrawingParams(0, 0, 0, 0);
 
-    private final Property<View, Float> SCALE_PROPERTY =
+    private static final Property<View, Float> SCALE_PROPERTY =
             new Property<View, Float>(Float.class, "scale") {
                 @Override
                 public Float get(View view) {
@@ -83,7 +83,7 @@
                 }
             };
 
-    private final Property<List<BubbleTextView>, Integer> ITEMS_TEXT_COLOR_PROPERTY =
+    private static final Property<List<BubbleTextView>, Integer> ITEMS_TEXT_COLOR_PROPERTY =
             new Property<List<BubbleTextView>, Integer>(Integer.class, "textColor") {
                 @Override
                 public Integer get(List<BubbleTextView> items) {
@@ -92,7 +92,11 @@
 
                 @Override
                 public void set(List<BubbleTextView> items, Integer color) {
-                    setItemsTextColor(items, color);
+                    int size = items.size();
+
+                    for (int i = 0; i < size; ++i) {
+                        items.get(i).setTextColor(color);
+                    }
                 }
             };
 
@@ -192,7 +196,8 @@
         // Initialize the Folder items' text.
         final List<BubbleTextView> itemsOnCurrentPage = mFolder.getItemsOnCurrentPage();
         final int finalTextColor = Themes.getAttrColor(mContext, android.R.attr.textColorSecondary);
-        setItemsTextColor(itemsOnCurrentPage, isOpening ? Color.TRANSPARENT : finalTextColor);
+        ITEMS_TEXT_COLOR_PROPERTY.set(itemsOnCurrentPage, isOpening ? Color.TRANSPARENT
+                : finalTextColor);
 
         // Create the animators.
         AnimatorSet a = LauncherAnimUtils.createAnimatorSet();
@@ -235,6 +240,14 @@
         Rect endRect = new Rect(0, 0, lp.width, lp.height);
         a.play(getRevealAnimator(isOpening, initialSize / 2f, startRect, endRect));
 
+        a.addListener(new AnimatorListenerAdapter() {
+            @Override
+            public void onAnimationEnd(Animator animation) {
+                super.onAnimationEnd(animation);
+                ITEMS_TEXT_COLOR_PROPERTY.set(itemsOnCurrentPage, finalTextColor);
+            }
+        });
+
         addPreviewItemAnimatorsToSet(a, isOpening, folderScale, nudgeOffsetX);
         return a;
     }
@@ -322,12 +335,4 @@
             });
         }
     }
-
-    private void setItemsTextColor(List<BubbleTextView> items, int color) {
-        int size = items.size();
-
-        for (int i = 0; i < size; ++i) {
-            items.get(i).setTextColor(color);
-        }
-    }
 }