From 39f817e60a4a32f5eb4dc38233446bc5e6f22657 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 7 Mar 2017 08:03:40 -0800 Subject: [PATCH] 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 --- .../folder/FolderAnimationManager.java | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java index 28133219f1..d14bb40eca 100644 --- a/src/com/android/launcher3/folder/FolderAnimationManager.java +++ b/src/com/android/launcher3/folder/FolderAnimationManager.java @@ -69,7 +69,7 @@ public class FolderAnimationManager { private final FolderIcon.PreviewItemDrawingParams mTmpParams = new FolderIcon.PreviewItemDrawingParams(0, 0, 0, 0); - private final Property SCALE_PROPERTY = + private static final Property SCALE_PROPERTY = new Property(Float.class, "scale") { @Override public Float get(View view) { @@ -83,7 +83,7 @@ public class FolderAnimationManager { } }; - private final Property, Integer> ITEMS_TEXT_COLOR_PROPERTY = + private static final Property, Integer> ITEMS_TEXT_COLOR_PROPERTY = new Property, Integer>(Integer.class, "textColor") { @Override public Integer get(List items) { @@ -92,7 +92,11 @@ public class FolderAnimationManager { @Override public void set(List 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 @@ public class FolderAnimationManager { // Initialize the Folder items' text. final List 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 @@ public class FolderAnimationManager { 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 @@ public class FolderAnimationManager { }); } } - - private void setItemsTextColor(List items, int color) { - int size = items.size(); - - for (int i = 0; i < size; ++i) { - items.get(i).setTextColor(color); - } - } }