435 lines
14 KiB
Java
435 lines
14 KiB
Java
package androidx.core.view;
|
|
|
|
import android.animation.Animator;
|
|
import android.animation.AnimatorListenerAdapter;
|
|
import android.animation.ValueAnimator;
|
|
import android.annotation.SuppressLint;
|
|
import android.view.View;
|
|
import android.view.animation.Interpolator;
|
|
import java.lang.ref.WeakReference;
|
|
public final class ViewPropertyAnimatorCompat {
|
|
public static final int LISTENER_TAG_ID = 2113929216;
|
|
public Runnable mEndAction = null;
|
|
public int mOldLayerType = -1;
|
|
public Runnable mStartAction = null;
|
|
private WeakReference<View> mView;
|
|
|
|
/* renamed from: androidx.core.view.ViewPropertyAnimatorCompat$1 reason: invalid class name */
|
|
public class AnonymousClass1 extends AnimatorListenerAdapter {
|
|
public final /* synthetic */ ViewPropertyAnimatorListener val$listener;
|
|
public final /* synthetic */ View val$view;
|
|
|
|
public AnonymousClass1(ViewPropertyAnimatorListener viewPropertyAnimatorListener, View view) {
|
|
this.val$listener = viewPropertyAnimatorListener;
|
|
this.val$view = view;
|
|
}
|
|
|
|
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
|
public void onAnimationCancel(Animator animator) {
|
|
this.val$listener.onAnimationCancel(this.val$view);
|
|
}
|
|
|
|
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
|
public void onAnimationEnd(Animator animator) {
|
|
this.val$listener.onAnimationEnd(this.val$view);
|
|
}
|
|
|
|
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
|
public void onAnimationStart(Animator animator) {
|
|
this.val$listener.onAnimationStart(this.val$view);
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.core.view.ViewPropertyAnimatorCompat$2 reason: invalid class name */
|
|
public class AnonymousClass2 implements ValueAnimator.AnimatorUpdateListener {
|
|
public final /* synthetic */ ViewPropertyAnimatorUpdateListener val$listener;
|
|
public final /* synthetic */ View val$view;
|
|
|
|
public AnonymousClass2(ViewPropertyAnimatorUpdateListener viewPropertyAnimatorUpdateListener, View view) {
|
|
this.val$listener = viewPropertyAnimatorUpdateListener;
|
|
this.val$view = view;
|
|
}
|
|
|
|
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
|
|
public void onAnimationUpdate(ValueAnimator valueAnimator) {
|
|
this.val$listener.onAnimationUpdate(this.val$view);
|
|
}
|
|
}
|
|
|
|
public static class ViewPropertyAnimatorListenerApi14 implements ViewPropertyAnimatorListener {
|
|
public boolean mAnimEndCalled;
|
|
public ViewPropertyAnimatorCompat mVpa;
|
|
|
|
public ViewPropertyAnimatorListenerApi14(ViewPropertyAnimatorCompat viewPropertyAnimatorCompat) {
|
|
this.mVpa = viewPropertyAnimatorCompat;
|
|
}
|
|
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
|
public void onAnimationCancel(View view) {
|
|
Object tag = view.getTag(ViewPropertyAnimatorCompat.LISTENER_TAG_ID);
|
|
ViewPropertyAnimatorListener viewPropertyAnimatorListener = tag instanceof ViewPropertyAnimatorListener ? (ViewPropertyAnimatorListener) tag : null;
|
|
if (viewPropertyAnimatorListener != null) {
|
|
viewPropertyAnimatorListener.onAnimationCancel(view);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
|
@SuppressLint({"WrongConstant"})
|
|
public void onAnimationEnd(View view) {
|
|
int i = this.mVpa.mOldLayerType;
|
|
ViewPropertyAnimatorListener viewPropertyAnimatorListener = null;
|
|
if (i > -1) {
|
|
view.setLayerType(i, null);
|
|
this.mVpa.mOldLayerType = -1;
|
|
}
|
|
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.mVpa;
|
|
Runnable runnable = viewPropertyAnimatorCompat.mEndAction;
|
|
if (runnable != null) {
|
|
viewPropertyAnimatorCompat.mEndAction = null;
|
|
runnable.run();
|
|
}
|
|
Object tag = view.getTag(ViewPropertyAnimatorCompat.LISTENER_TAG_ID);
|
|
if (tag instanceof ViewPropertyAnimatorListener) {
|
|
viewPropertyAnimatorListener = (ViewPropertyAnimatorListener) tag;
|
|
}
|
|
if (viewPropertyAnimatorListener != null) {
|
|
viewPropertyAnimatorListener.onAnimationEnd(view);
|
|
}
|
|
this.mAnimEndCalled = true;
|
|
}
|
|
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
|
public void onAnimationStart(View view) {
|
|
this.mAnimEndCalled = false;
|
|
ViewPropertyAnimatorListener viewPropertyAnimatorListener = null;
|
|
if (this.mVpa.mOldLayerType > -1) {
|
|
view.setLayerType(2, null);
|
|
}
|
|
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.mVpa;
|
|
Runnable runnable = viewPropertyAnimatorCompat.mStartAction;
|
|
if (runnable != null) {
|
|
viewPropertyAnimatorCompat.mStartAction = null;
|
|
runnable.run();
|
|
}
|
|
Object tag = view.getTag(ViewPropertyAnimatorCompat.LISTENER_TAG_ID);
|
|
if (tag instanceof ViewPropertyAnimatorListener) {
|
|
viewPropertyAnimatorListener = (ViewPropertyAnimatorListener) tag;
|
|
}
|
|
if (viewPropertyAnimatorListener != null) {
|
|
viewPropertyAnimatorListener.onAnimationStart(view);
|
|
}
|
|
}
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat(View view) {
|
|
this.mView = new WeakReference<>(view);
|
|
}
|
|
|
|
private void setListenerInternal(View view, ViewPropertyAnimatorListener viewPropertyAnimatorListener) {
|
|
if (viewPropertyAnimatorListener != null) {
|
|
view.animate().setListener(new AnonymousClass1(viewPropertyAnimatorListener, view));
|
|
} else {
|
|
view.animate().setListener(null);
|
|
}
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat alpha(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().alpha(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat alphaBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().alphaBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public void cancel() {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().cancel();
|
|
}
|
|
}
|
|
|
|
public long getDuration() {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
return view.animate().getDuration();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public Interpolator getInterpolator() {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
return (Interpolator) view.animate().getInterpolator();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public long getStartDelay() {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
return view.animate().getStartDelay();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat rotation(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().rotation(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat rotationBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().rotationBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat rotationX(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().rotationX(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat rotationXBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().rotationXBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat rotationY(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().rotationY(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat rotationYBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().rotationYBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat scaleX(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().scaleX(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat scaleXBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().scaleXBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat scaleY(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().scaleY(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat scaleYBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().scaleYBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat setDuration(long j) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().setDuration(j);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat setInterpolator(Interpolator interpolator) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().setInterpolator(interpolator);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat setListener(ViewPropertyAnimatorListener viewPropertyAnimatorListener) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
setListenerInternal(view, viewPropertyAnimatorListener);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat setStartDelay(long j) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().setStartDelay(j);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat setUpdateListener(ViewPropertyAnimatorUpdateListener viewPropertyAnimatorUpdateListener) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
AnonymousClass2 r1 = null;
|
|
if (viewPropertyAnimatorUpdateListener != null) {
|
|
r1 = new AnonymousClass2(viewPropertyAnimatorUpdateListener, view);
|
|
}
|
|
view.animate().setUpdateListener(r1);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public void start() {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().start();
|
|
}
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat translationX(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().translationX(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat translationXBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().translationXBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat translationY(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().translationY(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat translationYBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().translationYBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat translationZ(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().translationZ(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat translationZBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().translationZBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat withEndAction(Runnable runnable) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().withEndAction(runnable);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
@SuppressLint({"WrongConstant"})
|
|
public ViewPropertyAnimatorCompat withLayer() {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().withLayer();
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat withStartAction(Runnable runnable) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().withStartAction(runnable);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat x(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().x(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat xBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().xBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat y(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().y(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat yBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().yBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat z(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().z(f);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ViewPropertyAnimatorCompat zBy(float f) {
|
|
View view = this.mView.get();
|
|
if (view != null) {
|
|
view.animate().zBy(f);
|
|
}
|
|
return this;
|
|
}
|
|
}
|