Convert BubbleTextView Alpha to use spring animation

Flag: com.android.launcher3.enable_expressive_folder_expansion
Bug: 387543793
Test: Manually verifying


Change-Id: Ibadedb1fef2542a4b8373ab3a4557c10c8752a77
This commit is contained in:
Charlie Anderson authored and Pun Butrach committed 2026-10-26 00:00:31 +07:00
1 parent 8be1c0f469
commit ea06691a37
2 files changed
+20 -11

No files matched your search

@@ -62,6 +62,7 @@ import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
import android.text.style.ImageSpan;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.util.Log;
import android.util.Property;
import android.util.TypedValue;
@@ -169,15 +170,15 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
}
};
public static final Property<BubbleTextView, Float> TEXT_ALPHA_PROPERTY
= new Property<BubbleTextView, Float>(Float.class, "textAlpha") {
public static final FloatProperty<BubbleTextView> TEXT_ALPHA_PROPERTY
= new FloatProperty<BubbleTextView>("textAlpha") {
@Override
public Float get(BubbleTextView bubbleTextView) {
return bubbleTextView.mTextAlpha;
}
@Override
public void set(BubbleTextView bubbleTextView, Float alpha) {
public void setValue(BubbleTextView bubbleTextView, float alpha) {
bubbleTextView.setTextAlpha(alpha);
}
};
@@ -82,7 +82,7 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
return FolderSpringAnimatorSet(animatorSet)
}
private fun playSpringAnimation(
private fun <T : View> playSpringAnimation(
context: Context,
animatorSet: AnimatorSet,
isOpening: Boolean,
@@ -92,8 +92,8 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
startValue: Float,
endValue: Float,
minVisibleChange: Float,
property: Property<View, Float>,
view: View,
property: Property<T, Float>,
view: T,
) {
val animatorBuilder =
SpringAnimationBuilder(context)
@@ -398,11 +398,19 @@ class FolderSpringAnimatorSet(val animatorSet: AnimatorSet) {
if (isOpening) {
titleText.setTextVisibility(false)
}
val anim =
titleText.createTextAlphaAnimator(isOpening).apply {
startDelay = (if (isOpening) iconDelay + 100 else iconDelay).toLong()
}
animatorSet.play(anim)
playSpringAnimation(
context = context,
animatorSet = animatorSet,
isOpening = isOpening,
startDelay = if (isOpening) iconDelay + 100 else iconDelay,
stiffness = STIFFNESS_ALPHA,
damping = DAMPING_ALPHA,
startValue = 0f,
endValue = 1f,
minVisibleChange = MIN_VISIBLE_CHANGE_ALPHA,
property = BubbleTextView.TEXT_ALPHA_PROPERTY,
view = titleText,
)
if (!itemsInPreview.contains(icon)) {
playSpringAnimation(
context = context,