86 lines
3.7 KiB
Java
86 lines
3.7 KiB
Java
package c.i.a.g.l;
|
|
|
|
import android.animation.Animator;
|
|
import android.animation.AnimatorSet;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.transition.TransitionValues;
|
|
import androidx.transition.Visibility;
|
|
import com.google.android.material.animation.AnimationUtils;
|
|
import com.google.android.material.animation.AnimatorSetCompat;
|
|
import com.google.android.material.transition.VisibilityAnimatorProvider;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
/* compiled from: MaterialVisibility */
|
|
public abstract class h<P extends VisibilityAnimatorProvider> extends Visibility {
|
|
private final List<VisibilityAnimatorProvider> additionalAnimatorProviders = new ArrayList();
|
|
private final P primaryAnimatorProvider;
|
|
@Nullable
|
|
private VisibilityAnimatorProvider secondaryAnimatorProvider;
|
|
|
|
public h(P p, @Nullable VisibilityAnimatorProvider visibilityAnimatorProvider) {
|
|
this.primaryAnimatorProvider = p;
|
|
this.secondaryAnimatorProvider = visibilityAnimatorProvider;
|
|
setInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR);
|
|
}
|
|
|
|
private static void addAnimatorIfNeeded(List<Animator> list, @Nullable VisibilityAnimatorProvider visibilityAnimatorProvider, ViewGroup viewGroup, View view, boolean z2) {
|
|
if (visibilityAnimatorProvider != null) {
|
|
Animator createAppear = z2 ? visibilityAnimatorProvider.createAppear(viewGroup, view) : visibilityAnimatorProvider.createDisappear(viewGroup, view);
|
|
if (createAppear != null) {
|
|
list.add(createAppear);
|
|
}
|
|
}
|
|
}
|
|
|
|
private Animator createAnimator(ViewGroup viewGroup, View view, boolean z2) {
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
|
ArrayList arrayList = new ArrayList();
|
|
addAnimatorIfNeeded(arrayList, this.primaryAnimatorProvider, viewGroup, view, z2);
|
|
addAnimatorIfNeeded(arrayList, this.secondaryAnimatorProvider, viewGroup, view, z2);
|
|
for (VisibilityAnimatorProvider visibilityAnimatorProvider : this.additionalAnimatorProviders) {
|
|
addAnimatorIfNeeded(arrayList, visibilityAnimatorProvider, viewGroup, view, z2);
|
|
}
|
|
AnimatorSetCompat.playTogether(animatorSet, arrayList);
|
|
return animatorSet;
|
|
}
|
|
|
|
public void addAdditionalAnimatorProvider(@NonNull VisibilityAnimatorProvider visibilityAnimatorProvider) {
|
|
this.additionalAnimatorProviders.add(visibilityAnimatorProvider);
|
|
}
|
|
|
|
public void clearAdditionalAnimatorProvider() {
|
|
this.additionalAnimatorProviders.clear();
|
|
}
|
|
|
|
@NonNull
|
|
public P getPrimaryAnimatorProvider() {
|
|
return this.primaryAnimatorProvider;
|
|
}
|
|
|
|
@Nullable
|
|
public VisibilityAnimatorProvider getSecondaryAnimatorProvider() {
|
|
return this.secondaryAnimatorProvider;
|
|
}
|
|
|
|
@Override // androidx.transition.Visibility
|
|
public Animator onAppear(ViewGroup viewGroup, View view, TransitionValues transitionValues, TransitionValues transitionValues2) {
|
|
return createAnimator(viewGroup, view, true);
|
|
}
|
|
|
|
@Override // androidx.transition.Visibility
|
|
public Animator onDisappear(ViewGroup viewGroup, View view, TransitionValues transitionValues, TransitionValues transitionValues2) {
|
|
return createAnimator(viewGroup, view, false);
|
|
}
|
|
|
|
public boolean removeAdditionalAnimatorProvider(@NonNull VisibilityAnimatorProvider visibilityAnimatorProvider) {
|
|
return this.additionalAnimatorProviders.remove(visibilityAnimatorProvider);
|
|
}
|
|
|
|
public void setSecondaryAnimatorProvider(@Nullable VisibilityAnimatorProvider visibilityAnimatorProvider) {
|
|
this.secondaryAnimatorProvider = visibilityAnimatorProvider;
|
|
}
|
|
}
|