83 lines
2.9 KiB
Java
83 lines
2.9 KiB
Java
package androidx.transition;
|
|
|
|
import android.animation.Animator;
|
|
import android.animation.AnimatorListenerAdapter;
|
|
import android.animation.ObjectAnimator;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import androidx.core.view.ViewCompat;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class Fade extends Visibility {
|
|
|
|
private static class FadeAnimatorListener extends AnimatorListenerAdapter {
|
|
private final View a;
|
|
private boolean b = false;
|
|
|
|
FadeAnimatorListener(View view) {
|
|
this.a = view;
|
|
}
|
|
|
|
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
|
public void onAnimationEnd(Animator animator) {
|
|
ViewUtils.a(this.a, 1.0f);
|
|
if (this.b) {
|
|
this.a.setLayerType(0, null);
|
|
}
|
|
}
|
|
|
|
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
|
public void onAnimationStart(Animator animator) {
|
|
if (ViewCompat.u(this.a) && this.a.getLayerType() == 0) {
|
|
this.b = true;
|
|
this.a.setLayerType(2, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
public Fade(int i) {
|
|
a(i);
|
|
}
|
|
|
|
private Animator a(final View view, float f, float f2) {
|
|
if (f == f2) {
|
|
return null;
|
|
}
|
|
ViewUtils.a(view, f);
|
|
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, ViewUtils.d, f2);
|
|
ofFloat.addListener(new FadeAnimatorListener(view));
|
|
a(new TransitionListenerAdapter(this) { // from class: androidx.transition.Fade.1
|
|
@Override // androidx.transition.Transition.TransitionListener
|
|
public void c(Transition transition) {
|
|
ViewUtils.a(view, 1.0f);
|
|
ViewUtils.a(view);
|
|
transition.b(this);
|
|
}
|
|
});
|
|
return ofFloat;
|
|
}
|
|
|
|
@Override // androidx.transition.Visibility
|
|
public Animator b(ViewGroup viewGroup, View view, TransitionValues transitionValues, TransitionValues transitionValues2) {
|
|
ViewUtils.e(view);
|
|
return a(view, a(transitionValues, 1.0f), 0.0f);
|
|
}
|
|
|
|
@Override // androidx.transition.Visibility, androidx.transition.Transition
|
|
public void c(TransitionValues transitionValues) {
|
|
super.c(transitionValues);
|
|
transitionValues.a.put("android:fade:transitionAlpha", Float.valueOf(ViewUtils.c(transitionValues.b)));
|
|
}
|
|
|
|
@Override // androidx.transition.Visibility
|
|
public Animator a(ViewGroup viewGroup, View view, TransitionValues transitionValues, TransitionValues transitionValues2) {
|
|
float a = a(transitionValues, 0.0f);
|
|
return a(view, a != 1.0f ? a : 0.0f, 1.0f);
|
|
}
|
|
|
|
private static float a(TransitionValues transitionValues, float f) {
|
|
Float f2;
|
|
return (transitionValues == null || (f2 = (Float) transitionValues.a.get("android:fade:transitionAlpha")) == null) ? f : f2.floatValue();
|
|
}
|
|
}
|