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
This commit is contained in:
Jon Miranda
2017-03-07 08:03:40 -08:00
parent 4717011626
commit 39f817e60a

View File

@@ -69,7 +69,7 @@ public class FolderAnimationManager {
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 @@ public class FolderAnimationManager {
}
};
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 @@ public class FolderAnimationManager {
@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 @@ public class FolderAnimationManager {
// 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 @@ 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<BubbleTextView> items, int color) {
int size = items.size();
for (int i = 0; i < size; ++i) {
items.get(i).setTextColor(color);
}
}
}