package com.google.android.material.internal; import android.animation.Animator; import android.animation.ValueAnimator; import android.view.ViewGroup; import android.widget.TextView; import androidx.transition.Transition; import androidx.transition.TransitionValues; import java.util.Map; /* loaded from: classes2.dex */ public class TextScale extends Transition { private static final String PROPNAME_SCALE = "android:textscale:scale"; @Override // androidx.transition.Transition public void captureStartValues(TransitionValues transitionValues) { captureValues(transitionValues); } @Override // androidx.transition.Transition public void captureEndValues(TransitionValues transitionValues) { captureValues(transitionValues); } private void captureValues(TransitionValues transitionValues) { if (transitionValues.view instanceof TextView) { transitionValues.values.put(PROPNAME_SCALE, Float.valueOf(((TextView) transitionValues.view).getScaleX())); } } @Override // androidx.transition.Transition public Animator createAnimator(ViewGroup viewGroup, TransitionValues transitionValues, TransitionValues transitionValues2) { if (transitionValues == null || transitionValues2 == null || !(transitionValues.view instanceof TextView) || !(transitionValues2.view instanceof TextView)) { return null; } final TextView textView = (TextView) transitionValues2.view; Map map = transitionValues.values; Map map2 = transitionValues2.values; float floatValue = map.get(PROPNAME_SCALE) != null ? ((Float) map.get(PROPNAME_SCALE)).floatValue() : 1.0f; float floatValue2 = map2.get(PROPNAME_SCALE) != null ? ((Float) map2.get(PROPNAME_SCALE)).floatValue() : 1.0f; if (floatValue == floatValue2) { return null; } ValueAnimator ofFloat = ValueAnimator.ofFloat(floatValue, floatValue2); ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.internal.TextScale.1 @Override // android.animation.ValueAnimator.AnimatorUpdateListener public void onAnimationUpdate(ValueAnimator valueAnimator) { float floatValue3 = ((Float) valueAnimator.getAnimatedValue()).floatValue(); textView.setScaleX(floatValue3); textView.setScaleY(floatValue3); } }); return ofFloat; } }