879 lines
34 KiB
Java
879 lines
34 KiB
Java
|
package com.airbnb.lottie;
|
||
|
|
||
|
import android.animation.Animator;
|
||
|
import android.animation.ValueAnimator;
|
||
|
import android.content.Context;
|
||
|
import android.content.res.TypedArray;
|
||
|
import android.graphics.Bitmap;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import android.os.Parcel;
|
||
|
import android.os.Parcelable;
|
||
|
import android.text.TextUtils;
|
||
|
import android.util.AttributeSet;
|
||
|
import android.view.View;
|
||
|
import androidx.appcompat.widget.AppCompatImageView;
|
||
|
import com.airbnb.lottie.model.KeyPath;
|
||
|
import com.airbnb.lottie.utils.Logger;
|
||
|
import com.airbnb.lottie.utils.Utils;
|
||
|
import com.airbnb.lottie.value.LottieFrameInfo;
|
||
|
import com.airbnb.lottie.value.LottieValueCallback;
|
||
|
import com.airbnb.lottie.value.SimpleLottieValueCallback;
|
||
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||
|
import java.io.ByteArrayInputStream;
|
||
|
import java.io.InputStream;
|
||
|
import java.util.HashSet;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
import java.util.Set;
|
||
|
import java.util.concurrent.Callable;
|
||
|
import o.AgY;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class LottieAnimationView extends AppCompatImageView {
|
||
|
private static final LottieListener<Throwable> DEFAULT_FAILURE_LISTENER = new LottieListener() { // from class: com.airbnb.lottie.LottieAnimationView$$ExternalSyntheticLambda2
|
||
|
@Override // com.airbnb.lottie.LottieListener
|
||
|
public final void onResult(Object obj) {
|
||
|
LottieAnimationView.lambda$static$0((Throwable) obj);
|
||
|
}
|
||
|
};
|
||
|
private static final String TAG = "LottieAnimationView";
|
||
|
private String animationName;
|
||
|
private int animationResId;
|
||
|
private boolean autoPlay;
|
||
|
private boolean cacheComposition;
|
||
|
private LottieComposition composition;
|
||
|
private LottieTask<LottieComposition> compositionTask;
|
||
|
private LottieListener<Throwable> failureListener;
|
||
|
private int fallbackResource;
|
||
|
private boolean ignoreUnschedule;
|
||
|
private final LottieListener<LottieComposition> loadedListener;
|
||
|
private final LottieDrawable lottieDrawable;
|
||
|
private final Set<LottieOnCompositionLoadedListener> lottieOnCompositionLoadedListeners;
|
||
|
private final Set<UserActionTaken> userActionsTaken;
|
||
|
private final LottieListener<Throwable> wrappedFailureListener;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes.dex */
|
||
|
public enum UserActionTaken {
|
||
|
SET_ANIMATION,
|
||
|
SET_PROGRESS,
|
||
|
SET_REPEAT_MODE,
|
||
|
SET_REPEAT_COUNT,
|
||
|
SET_IMAGE_ASSETS,
|
||
|
PLAY_OPTION
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static /* synthetic */ void lambda$static$0(Throwable th) {
|
||
|
if (Utils.isNetworkException(th)) {
|
||
|
Logger.warning("Unable to load composition.", th);
|
||
|
return;
|
||
|
}
|
||
|
throw new IllegalStateException("Unable to parse composition", th);
|
||
|
}
|
||
|
|
||
|
public LottieAnimationView(Context context) {
|
||
|
super(context);
|
||
|
this.loadedListener = new LottieListener(this) { // from class: com.airbnb.lottie.LottieAnimationView$$ExternalSyntheticLambda1
|
||
|
public final LottieAnimationView f$0;
|
||
|
|
||
|
@Override // com.airbnb.lottie.LottieListener
|
||
|
public final void onResult(Object obj) {
|
||
|
this.f$0.setComposition((LottieComposition) obj);
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.f$0 = this;
|
||
|
}
|
||
|
};
|
||
|
this.wrappedFailureListener = new LottieListener<Throwable>(this) { // from class: com.airbnb.lottie.LottieAnimationView.1
|
||
|
final LottieAnimationView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // com.airbnb.lottie.LottieListener
|
||
|
public void onResult(Throwable th) {
|
||
|
LottieListener lottieListener;
|
||
|
if (this.this$0.fallbackResource != 0) {
|
||
|
LottieAnimationView lottieAnimationView = this.this$0;
|
||
|
lottieAnimationView.setImageResource(lottieAnimationView.fallbackResource);
|
||
|
}
|
||
|
if (this.this$0.failureListener != null) {
|
||
|
lottieListener = this.this$0.failureListener;
|
||
|
} else {
|
||
|
lottieListener = LottieAnimationView.DEFAULT_FAILURE_LISTENER;
|
||
|
}
|
||
|
lottieListener.onResult(th);
|
||
|
}
|
||
|
};
|
||
|
this.fallbackResource = 0;
|
||
|
this.lottieDrawable = new LottieDrawable();
|
||
|
this.ignoreUnschedule = false;
|
||
|
this.autoPlay = false;
|
||
|
this.cacheComposition = true;
|
||
|
this.userActionsTaken = new HashSet();
|
||
|
this.lottieOnCompositionLoadedListeners = new HashSet();
|
||
|
init(null, R.attr.lottieAnimationViewStyle);
|
||
|
}
|
||
|
|
||
|
public LottieAnimationView(Context context, AttributeSet attributeSet) {
|
||
|
super(context, attributeSet);
|
||
|
this.loadedListener = new LottieListener(this) { // from class: com.airbnb.lottie.LottieAnimationView$$ExternalSyntheticLambda1
|
||
|
public final LottieAnimationView f$0;
|
||
|
|
||
|
@Override // com.airbnb.lottie.LottieListener
|
||
|
public final void onResult(Object obj) {
|
||
|
this.f$0.setComposition((LottieComposition) obj);
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.f$0 = this;
|
||
|
}
|
||
|
};
|
||
|
this.wrappedFailureListener = new LottieListener<Throwable>(this) { // from class: com.airbnb.lottie.LottieAnimationView.1
|
||
|
final LottieAnimationView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // com.airbnb.lottie.LottieListener
|
||
|
public void onResult(Throwable th) {
|
||
|
LottieListener lottieListener;
|
||
|
if (this.this$0.fallbackResource != 0) {
|
||
|
LottieAnimationView lottieAnimationView = this.this$0;
|
||
|
lottieAnimationView.setImageResource(lottieAnimationView.fallbackResource);
|
||
|
}
|
||
|
if (this.this$0.failureListener != null) {
|
||
|
lottieListener = this.this$0.failureListener;
|
||
|
} else {
|
||
|
lottieListener = LottieAnimationView.DEFAULT_FAILURE_LISTENER;
|
||
|
}
|
||
|
lottieListener.onResult(th);
|
||
|
}
|
||
|
};
|
||
|
this.fallbackResource = 0;
|
||
|
this.lottieDrawable = new LottieDrawable();
|
||
|
this.ignoreUnschedule = false;
|
||
|
this.autoPlay = false;
|
||
|
this.cacheComposition = true;
|
||
|
this.userActionsTaken = new HashSet();
|
||
|
this.lottieOnCompositionLoadedListeners = new HashSet();
|
||
|
init(attributeSet, R.attr.lottieAnimationViewStyle);
|
||
|
}
|
||
|
|
||
|
public LottieAnimationView(Context context, AttributeSet attributeSet, int i) {
|
||
|
super(context, attributeSet, i);
|
||
|
this.loadedListener = new LottieListener(this) { // from class: com.airbnb.lottie.LottieAnimationView$$ExternalSyntheticLambda1
|
||
|
public final LottieAnimationView f$0;
|
||
|
|
||
|
@Override // com.airbnb.lottie.LottieListener
|
||
|
public final void onResult(Object obj) {
|
||
|
this.f$0.setComposition((LottieComposition) obj);
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.f$0 = this;
|
||
|
}
|
||
|
};
|
||
|
this.wrappedFailureListener = new LottieListener<Throwable>(this) { // from class: com.airbnb.lottie.LottieAnimationView.1
|
||
|
final LottieAnimationView this$0;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // com.airbnb.lottie.LottieListener
|
||
|
public void onResult(Throwable th) {
|
||
|
LottieListener lottieListener;
|
||
|
if (this.this$0.fallbackResource != 0) {
|
||
|
LottieAnimationView lottieAnimationView = this.this$0;
|
||
|
lottieAnimationView.setImageResource(lottieAnimationView.fallbackResource);
|
||
|
}
|
||
|
if (this.this$0.failureListener != null) {
|
||
|
lottieListener = this.this$0.failureListener;
|
||
|
} else {
|
||
|
lottieListener = LottieAnimationView.DEFAULT_FAILURE_LISTENER;
|
||
|
}
|
||
|
lottieListener.onResult(th);
|
||
|
}
|
||
|
};
|
||
|
this.fallbackResource = 0;
|
||
|
this.lottieDrawable = new LottieDrawable();
|
||
|
this.ignoreUnschedule = false;
|
||
|
this.autoPlay = false;
|
||
|
this.cacheComposition = true;
|
||
|
this.userActionsTaken = new HashSet();
|
||
|
this.lottieOnCompositionLoadedListeners = new HashSet();
|
||
|
init(attributeSet, i);
|
||
|
}
|
||
|
|
||
|
private void init(AttributeSet attributeSet, int i) {
|
||
|
String string;
|
||
|
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, R.styleable.LottieAnimationView, i, 0);
|
||
|
this.cacheComposition = obtainStyledAttributes.getBoolean(R.styleable.LottieAnimationView_lottie_cacheComposition, true);
|
||
|
boolean hasValue = obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_rawRes);
|
||
|
boolean hasValue2 = obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_fileName);
|
||
|
boolean hasValue3 = obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_url);
|
||
|
if (hasValue && hasValue2) {
|
||
|
throw new IllegalArgumentException("lottie_rawRes and lottie_fileName cannot be used at the same time. Please use only one at once.");
|
||
|
}
|
||
|
if (hasValue) {
|
||
|
int resourceId = obtainStyledAttributes.getResourceId(R.styleable.LottieAnimationView_lottie_rawRes, 0);
|
||
|
if (resourceId != 0) {
|
||
|
setAnimation(resourceId);
|
||
|
}
|
||
|
} else if (hasValue2) {
|
||
|
String string2 = obtainStyledAttributes.getString(R.styleable.LottieAnimationView_lottie_fileName);
|
||
|
if (string2 != null) {
|
||
|
setAnimation(string2);
|
||
|
}
|
||
|
} else if (hasValue3 && (string = obtainStyledAttributes.getString(R.styleable.LottieAnimationView_lottie_url)) != null) {
|
||
|
setAnimationFromUrl(string);
|
||
|
}
|
||
|
setFallbackResource(obtainStyledAttributes.getResourceId(R.styleable.LottieAnimationView_lottie_fallbackRes, 0));
|
||
|
if (obtainStyledAttributes.getBoolean(R.styleable.LottieAnimationView_lottie_autoPlay, false)) {
|
||
|
this.autoPlay = true;
|
||
|
}
|
||
|
if (obtainStyledAttributes.getBoolean(R.styleable.LottieAnimationView_lottie_loop, false)) {
|
||
|
this.lottieDrawable.setRepeatCount(-1);
|
||
|
}
|
||
|
if (obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_repeatMode)) {
|
||
|
setRepeatMode(obtainStyledAttributes.getInt(R.styleable.LottieAnimationView_lottie_repeatMode, 1));
|
||
|
}
|
||
|
if (obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_repeatCount)) {
|
||
|
setRepeatCount(obtainStyledAttributes.getInt(R.styleable.LottieAnimationView_lottie_repeatCount, -1));
|
||
|
}
|
||
|
if (obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_speed)) {
|
||
|
setSpeed(obtainStyledAttributes.getFloat(R.styleable.LottieAnimationView_lottie_speed, 1.0f));
|
||
|
}
|
||
|
if (obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_clipToCompositionBounds)) {
|
||
|
setClipToCompositionBounds(obtainStyledAttributes.getBoolean(R.styleable.LottieAnimationView_lottie_clipToCompositionBounds, true));
|
||
|
}
|
||
|
setImageAssetsFolder(obtainStyledAttributes.getString(R.styleable.LottieAnimationView_lottie_imageAssetsFolder));
|
||
|
setProgress(obtainStyledAttributes.getFloat(R.styleable.LottieAnimationView_lottie_progress, BitmapDescriptorFactory.HUE_RED));
|
||
|
enableMergePathsForKitKatAndAbove(obtainStyledAttributes.getBoolean(R.styleable.LottieAnimationView_lottie_enableMergePathsForKitKatAndAbove, false));
|
||
|
if (obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_colorFilter)) {
|
||
|
addValueCallback(new KeyPath("**"), (KeyPath) LottieProperty.COLOR_FILTER, (LottieValueCallback<KeyPath>) new LottieValueCallback(new SimpleColorFilter(AgY.dS_(getContext(), obtainStyledAttributes.getResourceId(R.styleable.LottieAnimationView_lottie_colorFilter, -1)).getDefaultColor())));
|
||
|
}
|
||
|
if (obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_renderMode)) {
|
||
|
int i2 = obtainStyledAttributes.getInt(R.styleable.LottieAnimationView_lottie_renderMode, RenderMode.AUTOMATIC.ordinal());
|
||
|
if (i2 >= RenderMode.values().length) {
|
||
|
i2 = RenderMode.AUTOMATIC.ordinal();
|
||
|
}
|
||
|
setRenderMode(RenderMode.values()[i2]);
|
||
|
}
|
||
|
setIgnoreDisabledSystemAnimations(obtainStyledAttributes.getBoolean(R.styleable.LottieAnimationView_lottie_ignoreDisabledSystemAnimations, false));
|
||
|
obtainStyledAttributes.recycle();
|
||
|
this.lottieDrawable.setSystemAnimationsAreEnabled(Boolean.valueOf(Utils.getAnimationScale(getContext()) != BitmapDescriptorFactory.HUE_RED));
|
||
|
}
|
||
|
|
||
|
@Override // androidx.appcompat.widget.AppCompatImageView, android.widget.ImageView
|
||
|
public void setImageResource(int i) {
|
||
|
cancelLoaderTask();
|
||
|
super.setImageResource(i);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.appcompat.widget.AppCompatImageView, android.widget.ImageView
|
||
|
public void setImageDrawable(Drawable drawable) {
|
||
|
cancelLoaderTask();
|
||
|
super.setImageDrawable(drawable);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.appcompat.widget.AppCompatImageView, android.widget.ImageView
|
||
|
public void setImageBitmap(Bitmap bitmap) {
|
||
|
cancelLoaderTask();
|
||
|
super.setImageBitmap(bitmap);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public void unscheduleDrawable(Drawable drawable) {
|
||
|
LottieDrawable lottieDrawable;
|
||
|
if (!this.ignoreUnschedule && drawable == (lottieDrawable = this.lottieDrawable) && lottieDrawable.isAnimating()) {
|
||
|
pauseAnimation();
|
||
|
} else if (!this.ignoreUnschedule && (drawable instanceof LottieDrawable)) {
|
||
|
LottieDrawable lottieDrawable2 = (LottieDrawable) drawable;
|
||
|
if (lottieDrawable2.isAnimating()) {
|
||
|
lottieDrawable2.pauseAnimation();
|
||
|
}
|
||
|
}
|
||
|
super.unscheduleDrawable(drawable);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
public void invalidate() {
|
||
|
super.invalidate();
|
||
|
Drawable drawable = getDrawable();
|
||
|
if ((drawable instanceof LottieDrawable) && ((LottieDrawable) drawable).getRenderMode() == RenderMode.SOFTWARE) {
|
||
|
this.lottieDrawable.invalidateSelf();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.widget.ImageView, android.view.View, android.graphics.drawable.Drawable.Callback
|
||
|
public void invalidateDrawable(Drawable drawable) {
|
||
|
Drawable drawable2 = getDrawable();
|
||
|
LottieDrawable lottieDrawable = this.lottieDrawable;
|
||
|
if (drawable2 == lottieDrawable) {
|
||
|
super.invalidateDrawable(lottieDrawable);
|
||
|
} else {
|
||
|
super.invalidateDrawable(drawable);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected Parcelable onSaveInstanceState() {
|
||
|
SavedState savedState = new SavedState(super.onSaveInstanceState());
|
||
|
savedState.animationName = this.animationName;
|
||
|
savedState.animationResId = this.animationResId;
|
||
|
savedState.progress = this.lottieDrawable.getProgress();
|
||
|
savedState.isAnimating = this.lottieDrawable.isAnimatingOrWillAnimateOnVisible();
|
||
|
savedState.imageAssetsFolder = this.lottieDrawable.getImageAssetsFolder();
|
||
|
savedState.repeatMode = this.lottieDrawable.getRepeatMode();
|
||
|
savedState.repeatCount = this.lottieDrawable.getRepeatCount();
|
||
|
return savedState;
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected void onRestoreInstanceState(Parcelable parcelable) {
|
||
|
int i;
|
||
|
if (!(parcelable instanceof SavedState)) {
|
||
|
super.onRestoreInstanceState(parcelable);
|
||
|
return;
|
||
|
}
|
||
|
SavedState savedState = (SavedState) parcelable;
|
||
|
super.onRestoreInstanceState(savedState.getSuperState());
|
||
|
this.animationName = savedState.animationName;
|
||
|
if (!this.userActionsTaken.contains(UserActionTaken.SET_ANIMATION) && !TextUtils.isEmpty(this.animationName)) {
|
||
|
setAnimation(this.animationName);
|
||
|
}
|
||
|
this.animationResId = savedState.animationResId;
|
||
|
if (!this.userActionsTaken.contains(UserActionTaken.SET_ANIMATION) && (i = this.animationResId) != 0) {
|
||
|
setAnimation(i);
|
||
|
}
|
||
|
if (!this.userActionsTaken.contains(UserActionTaken.SET_PROGRESS)) {
|
||
|
setProgress(savedState.progress);
|
||
|
}
|
||
|
if (!this.userActionsTaken.contains(UserActionTaken.PLAY_OPTION) && savedState.isAnimating) {
|
||
|
playAnimation();
|
||
|
}
|
||
|
if (!this.userActionsTaken.contains(UserActionTaken.SET_IMAGE_ASSETS)) {
|
||
|
setImageAssetsFolder(savedState.imageAssetsFolder);
|
||
|
}
|
||
|
if (!this.userActionsTaken.contains(UserActionTaken.SET_REPEAT_MODE)) {
|
||
|
setRepeatMode(savedState.repeatMode);
|
||
|
}
|
||
|
if (this.userActionsTaken.contains(UserActionTaken.SET_REPEAT_COUNT)) {
|
||
|
return;
|
||
|
}
|
||
|
setRepeatCount(savedState.repeatCount);
|
||
|
}
|
||
|
|
||
|
@Override // android.widget.ImageView, android.view.View
|
||
|
protected void onAttachedToWindow() {
|
||
|
super.onAttachedToWindow();
|
||
|
if (isInEditMode() || !this.autoPlay) {
|
||
|
return;
|
||
|
}
|
||
|
this.lottieDrawable.playAnimation();
|
||
|
}
|
||
|
|
||
|
public void setIgnoreDisabledSystemAnimations(boolean z) {
|
||
|
this.lottieDrawable.setIgnoreDisabledSystemAnimations(z);
|
||
|
}
|
||
|
|
||
|
public void enableMergePathsForKitKatAndAbove(boolean z) {
|
||
|
this.lottieDrawable.enableMergePathsForKitKatAndAbove(z);
|
||
|
}
|
||
|
|
||
|
public boolean isMergePathsEnabledForKitKatAndAbove() {
|
||
|
return this.lottieDrawable.isMergePathsEnabledForKitKatAndAbove();
|
||
|
}
|
||
|
|
||
|
public void setClipToCompositionBounds(boolean z) {
|
||
|
this.lottieDrawable.setClipToCompositionBounds(z);
|
||
|
}
|
||
|
|
||
|
public boolean getClipToCompositionBounds() {
|
||
|
return this.lottieDrawable.getClipToCompositionBounds();
|
||
|
}
|
||
|
|
||
|
public void setOutlineMasksAndMattes(boolean z) {
|
||
|
this.lottieDrawable.setOutlineMasksAndMattes(z);
|
||
|
}
|
||
|
|
||
|
public void setAnimation(int i) {
|
||
|
this.animationResId = i;
|
||
|
this.animationName = null;
|
||
|
setCompositionTask(fromRawRes(i));
|
||
|
}
|
||
|
|
||
|
private LottieTask<LottieComposition> fromRawRes(final int i) {
|
||
|
if (isInEditMode()) {
|
||
|
return new LottieTask<>(new Callable(this, i) { // from class: com.airbnb.lottie.LottieAnimationView$$ExternalSyntheticLambda0
|
||
|
public final LottieAnimationView f$0;
|
||
|
public final int f$1;
|
||
|
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
public final Object call() {
|
||
|
return this.f$0.m20lambda$fromRawRes$1$comairbnblottieLottieAnimationView(this.f$1);
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.f$0 = this;
|
||
|
this.f$1 = i;
|
||
|
}
|
||
|
}, true);
|
||
|
}
|
||
|
return this.cacheComposition ? LottieCompositionFactory.fromRawRes(getContext(), i) : LottieCompositionFactory.fromRawRes(getContext(), i, null);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$fromRawRes$1$com-airbnb-lottie-LottieAnimationView, reason: not valid java name */
|
||
|
public /* synthetic */ LottieResult m20lambda$fromRawRes$1$comairbnblottieLottieAnimationView(int i) throws Exception {
|
||
|
return this.cacheComposition ? LottieCompositionFactory.fromRawResSync(getContext(), i) : LottieCompositionFactory.fromRawResSync(getContext(), i, null);
|
||
|
}
|
||
|
|
||
|
public void setAnimation(String str) {
|
||
|
this.animationName = str;
|
||
|
this.animationResId = 0;
|
||
|
setCompositionTask(fromAssets(str));
|
||
|
}
|
||
|
|
||
|
private LottieTask<LottieComposition> fromAssets(final String str) {
|
||
|
if (isInEditMode()) {
|
||
|
return new LottieTask<>(new Callable(this, str) { // from class: com.airbnb.lottie.LottieAnimationView$$ExternalSyntheticLambda3
|
||
|
public final LottieAnimationView f$0;
|
||
|
public final String f$1;
|
||
|
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
public final Object call() {
|
||
|
return this.f$0.m19lambda$fromAssets$2$comairbnblottieLottieAnimationView(this.f$1);
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.f$0 = this;
|
||
|
this.f$1 = str;
|
||
|
}
|
||
|
}, true);
|
||
|
}
|
||
|
return this.cacheComposition ? LottieCompositionFactory.fromAsset(getContext(), str) : LottieCompositionFactory.fromAsset(getContext(), str, null);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$fromAssets$2$com-airbnb-lottie-LottieAnimationView, reason: not valid java name */
|
||
|
public /* synthetic */ LottieResult m19lambda$fromAssets$2$comairbnblottieLottieAnimationView(String str) throws Exception {
|
||
|
return this.cacheComposition ? LottieCompositionFactory.fromAssetSync(getContext(), str) : LottieCompositionFactory.fromAssetSync(getContext(), str, null);
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public void setAnimationFromJson(String str) {
|
||
|
setAnimationFromJson(str, null);
|
||
|
}
|
||
|
|
||
|
public void setAnimationFromJson(String str, String str2) {
|
||
|
setAnimation(new ByteArrayInputStream(str.getBytes()), str2);
|
||
|
}
|
||
|
|
||
|
public void setAnimation(InputStream inputStream, String str) {
|
||
|
setCompositionTask(LottieCompositionFactory.fromJsonInputStream(inputStream, str));
|
||
|
}
|
||
|
|
||
|
public void setAnimationFromUrl(String str) {
|
||
|
setCompositionTask(this.cacheComposition ? LottieCompositionFactory.fromUrl(getContext(), str) : LottieCompositionFactory.fromUrl(getContext(), str, null));
|
||
|
}
|
||
|
|
||
|
public void setAnimationFromUrl(String str, String str2) {
|
||
|
setCompositionTask(LottieCompositionFactory.fromUrl(getContext(), str, str2));
|
||
|
}
|
||
|
|
||
|
private void setCompositionTask(LottieTask<LottieComposition> lottieTask) {
|
||
|
this.userActionsTaken.add(UserActionTaken.SET_ANIMATION);
|
||
|
clearComposition();
|
||
|
cancelLoaderTask();
|
||
|
this.compositionTask = lottieTask.addListener(this.loadedListener).addFailureListener(this.wrappedFailureListener);
|
||
|
}
|
||
|
|
||
|
private void cancelLoaderTask() {
|
||
|
LottieTask<LottieComposition> lottieTask = this.compositionTask;
|
||
|
if (lottieTask != null) {
|
||
|
lottieTask.removeListener(this.loadedListener);
|
||
|
this.compositionTask.removeFailureListener(this.wrappedFailureListener);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setComposition(LottieComposition lottieComposition) {
|
||
|
boolean z = L.DBG;
|
||
|
this.lottieDrawable.setCallback(this);
|
||
|
this.composition = lottieComposition;
|
||
|
this.ignoreUnschedule = true;
|
||
|
boolean composition = this.lottieDrawable.setComposition(lottieComposition);
|
||
|
this.ignoreUnschedule = false;
|
||
|
if (getDrawable() != this.lottieDrawable || composition) {
|
||
|
if (!composition) {
|
||
|
setLottieDrawable();
|
||
|
}
|
||
|
onVisibilityChanged(this, getVisibility());
|
||
|
requestLayout();
|
||
|
Iterator<LottieOnCompositionLoadedListener> it = this.lottieOnCompositionLoadedListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
it.next().onCompositionLoaded(lottieComposition);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public boolean hasMasks() {
|
||
|
return this.lottieDrawable.hasMasks();
|
||
|
}
|
||
|
|
||
|
public boolean hasMatte() {
|
||
|
return this.lottieDrawable.hasMatte();
|
||
|
}
|
||
|
|
||
|
public void playAnimation() {
|
||
|
this.userActionsTaken.add(UserActionTaken.PLAY_OPTION);
|
||
|
this.lottieDrawable.playAnimation();
|
||
|
}
|
||
|
|
||
|
public void resumeAnimation() {
|
||
|
this.userActionsTaken.add(UserActionTaken.PLAY_OPTION);
|
||
|
this.lottieDrawable.resumeAnimation();
|
||
|
}
|
||
|
|
||
|
public void setMinFrame(int i) {
|
||
|
this.lottieDrawable.setMinFrame(i);
|
||
|
}
|
||
|
|
||
|
public float getMinFrame() {
|
||
|
return this.lottieDrawable.getMinFrame();
|
||
|
}
|
||
|
|
||
|
public void setMinProgress(float f) {
|
||
|
this.lottieDrawable.setMinProgress(f);
|
||
|
}
|
||
|
|
||
|
public void setMaxFrame(int i) {
|
||
|
this.lottieDrawable.setMaxFrame(i);
|
||
|
}
|
||
|
|
||
|
public float getMaxFrame() {
|
||
|
return this.lottieDrawable.getMaxFrame();
|
||
|
}
|
||
|
|
||
|
public void setMaxProgress(float f) {
|
||
|
this.lottieDrawable.setMaxProgress(f);
|
||
|
}
|
||
|
|
||
|
public void setMinFrame(String str) {
|
||
|
this.lottieDrawable.setMinFrame(str);
|
||
|
}
|
||
|
|
||
|
public void setMaxFrame(String str) {
|
||
|
this.lottieDrawable.setMaxFrame(str);
|
||
|
}
|
||
|
|
||
|
public void setMinAndMaxFrame(String str) {
|
||
|
this.lottieDrawable.setMinAndMaxFrame(str);
|
||
|
}
|
||
|
|
||
|
public void setMinAndMaxFrame(String str, String str2, boolean z) {
|
||
|
this.lottieDrawable.setMinAndMaxFrame(str, str2, z);
|
||
|
}
|
||
|
|
||
|
public void setMinAndMaxFrame(int i, int i2) {
|
||
|
this.lottieDrawable.setMinAndMaxFrame(i, i2);
|
||
|
}
|
||
|
|
||
|
public void setMinAndMaxProgress(float f, float f2) {
|
||
|
this.lottieDrawable.setMinAndMaxProgress(f, f2);
|
||
|
}
|
||
|
|
||
|
public void reverseAnimationSpeed() {
|
||
|
this.lottieDrawable.reverseAnimationSpeed();
|
||
|
}
|
||
|
|
||
|
public void setSpeed(float f) {
|
||
|
this.lottieDrawable.setSpeed(f);
|
||
|
}
|
||
|
|
||
|
public float getSpeed() {
|
||
|
return this.lottieDrawable.getSpeed();
|
||
|
}
|
||
|
|
||
|
public void addAnimatorUpdateListener(ValueAnimator.AnimatorUpdateListener animatorUpdateListener) {
|
||
|
this.lottieDrawable.addAnimatorUpdateListener(animatorUpdateListener);
|
||
|
}
|
||
|
|
||
|
public void removeUpdateListener(ValueAnimator.AnimatorUpdateListener animatorUpdateListener) {
|
||
|
this.lottieDrawable.removeAnimatorUpdateListener(animatorUpdateListener);
|
||
|
}
|
||
|
|
||
|
public void removeAllUpdateListeners() {
|
||
|
this.lottieDrawable.removeAllUpdateListeners();
|
||
|
}
|
||
|
|
||
|
public void addAnimatorListener(Animator.AnimatorListener animatorListener) {
|
||
|
this.lottieDrawable.addAnimatorListener(animatorListener);
|
||
|
}
|
||
|
|
||
|
public void removeAnimatorListener(Animator.AnimatorListener animatorListener) {
|
||
|
this.lottieDrawable.removeAnimatorListener(animatorListener);
|
||
|
}
|
||
|
|
||
|
public void removeAllAnimatorListeners() {
|
||
|
this.lottieDrawable.removeAllAnimatorListeners();
|
||
|
}
|
||
|
|
||
|
public void addAnimatorPauseListener(Animator.AnimatorPauseListener animatorPauseListener) {
|
||
|
this.lottieDrawable.addAnimatorPauseListener(animatorPauseListener);
|
||
|
}
|
||
|
|
||
|
public void removeAnimatorPauseListener(Animator.AnimatorPauseListener animatorPauseListener) {
|
||
|
this.lottieDrawable.removeAnimatorPauseListener(animatorPauseListener);
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public void loop(boolean z) {
|
||
|
this.lottieDrawable.setRepeatCount(z ? -1 : 0);
|
||
|
}
|
||
|
|
||
|
public void setRepeatMode(int i) {
|
||
|
this.userActionsTaken.add(UserActionTaken.SET_REPEAT_MODE);
|
||
|
this.lottieDrawable.setRepeatMode(i);
|
||
|
}
|
||
|
|
||
|
public int getRepeatMode() {
|
||
|
return this.lottieDrawable.getRepeatMode();
|
||
|
}
|
||
|
|
||
|
public void setRepeatCount(int i) {
|
||
|
this.userActionsTaken.add(UserActionTaken.SET_REPEAT_COUNT);
|
||
|
this.lottieDrawable.setRepeatCount(i);
|
||
|
}
|
||
|
|
||
|
public int getRepeatCount() {
|
||
|
return this.lottieDrawable.getRepeatCount();
|
||
|
}
|
||
|
|
||
|
public boolean isAnimating() {
|
||
|
return this.lottieDrawable.isAnimating();
|
||
|
}
|
||
|
|
||
|
public void setImageAssetsFolder(String str) {
|
||
|
this.lottieDrawable.setImagesAssetsFolder(str);
|
||
|
}
|
||
|
|
||
|
public String getImageAssetsFolder() {
|
||
|
return this.lottieDrawable.getImageAssetsFolder();
|
||
|
}
|
||
|
|
||
|
public void setMaintainOriginalImageBounds(boolean z) {
|
||
|
this.lottieDrawable.setMaintainOriginalImageBounds(z);
|
||
|
}
|
||
|
|
||
|
public boolean getMaintainOriginalImageBounds() {
|
||
|
return this.lottieDrawable.getMaintainOriginalImageBounds();
|
||
|
}
|
||
|
|
||
|
public Bitmap updateBitmap(String str, Bitmap bitmap) {
|
||
|
return this.lottieDrawable.updateBitmap(str, bitmap);
|
||
|
}
|
||
|
|
||
|
public void setImageAssetDelegate(ImageAssetDelegate imageAssetDelegate) {
|
||
|
this.lottieDrawable.setImageAssetDelegate(imageAssetDelegate);
|
||
|
}
|
||
|
|
||
|
public void setFontAssetDelegate(FontAssetDelegate fontAssetDelegate) {
|
||
|
this.lottieDrawable.setFontAssetDelegate(fontAssetDelegate);
|
||
|
}
|
||
|
|
||
|
public void setTextDelegate(TextDelegate textDelegate) {
|
||
|
this.lottieDrawable.setTextDelegate(textDelegate);
|
||
|
}
|
||
|
|
||
|
public List<KeyPath> resolveKeyPath(KeyPath keyPath) {
|
||
|
return this.lottieDrawable.resolveKeyPath(keyPath);
|
||
|
}
|
||
|
|
||
|
public <T> void addValueCallback(KeyPath keyPath, T t, LottieValueCallback<T> lottieValueCallback) {
|
||
|
this.lottieDrawable.addValueCallback(keyPath, (KeyPath) t, (LottieValueCallback<KeyPath>) lottieValueCallback);
|
||
|
}
|
||
|
|
||
|
public <T> void addValueCallback(KeyPath keyPath, T t, SimpleLottieValueCallback<T> simpleLottieValueCallback) {
|
||
|
this.lottieDrawable.addValueCallback(keyPath, (KeyPath) t, (LottieValueCallback<KeyPath>) new LottieValueCallback<T>(this, simpleLottieValueCallback) { // from class: com.airbnb.lottie.LottieAnimationView.2
|
||
|
final LottieAnimationView this$0;
|
||
|
final SimpleLottieValueCallback val$callback;
|
||
|
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
this.val$callback = simpleLottieValueCallback;
|
||
|
}
|
||
|
|
||
|
@Override // com.airbnb.lottie.value.LottieValueCallback
|
||
|
public T getValue(LottieFrameInfo<T> lottieFrameInfo) {
|
||
|
return (T) this.val$callback.getValue(lottieFrameInfo);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public void cancelAnimation() {
|
||
|
this.userActionsTaken.add(UserActionTaken.PLAY_OPTION);
|
||
|
this.lottieDrawable.cancelAnimation();
|
||
|
}
|
||
|
|
||
|
public void pauseAnimation() {
|
||
|
this.autoPlay = false;
|
||
|
this.lottieDrawable.pauseAnimation();
|
||
|
}
|
||
|
|
||
|
public void setFrame(int i) {
|
||
|
this.lottieDrawable.setFrame(i);
|
||
|
}
|
||
|
|
||
|
public int getFrame() {
|
||
|
return this.lottieDrawable.getFrame();
|
||
|
}
|
||
|
|
||
|
public void setProgress(float f) {
|
||
|
this.userActionsTaken.add(UserActionTaken.SET_PROGRESS);
|
||
|
this.lottieDrawable.setProgress(f);
|
||
|
}
|
||
|
|
||
|
public float getProgress() {
|
||
|
return this.lottieDrawable.getProgress();
|
||
|
}
|
||
|
|
||
|
public long getDuration() {
|
||
|
if (this.composition != null) {
|
||
|
return r0.getDuration();
|
||
|
}
|
||
|
return 0L;
|
||
|
}
|
||
|
|
||
|
public void setPerformanceTrackingEnabled(boolean z) {
|
||
|
this.lottieDrawable.setPerformanceTrackingEnabled(z);
|
||
|
}
|
||
|
|
||
|
public PerformanceTracker getPerformanceTracker() {
|
||
|
return this.lottieDrawable.getPerformanceTracker();
|
||
|
}
|
||
|
|
||
|
private void clearComposition() {
|
||
|
this.composition = null;
|
||
|
this.lottieDrawable.clearComposition();
|
||
|
}
|
||
|
|
||
|
public void setSafeMode(boolean z) {
|
||
|
this.lottieDrawable.setSafeMode(z);
|
||
|
}
|
||
|
|
||
|
public void setRenderMode(RenderMode renderMode) {
|
||
|
this.lottieDrawable.setRenderMode(renderMode);
|
||
|
}
|
||
|
|
||
|
public RenderMode getRenderMode() {
|
||
|
return this.lottieDrawable.getRenderMode();
|
||
|
}
|
||
|
|
||
|
public void setApplyingOpacityToLayersEnabled(boolean z) {
|
||
|
this.lottieDrawable.setApplyingOpacityToLayersEnabled(z);
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public void disableExtraScaleModeInFitXY() {
|
||
|
this.lottieDrawable.disableExtraScaleModeInFitXY();
|
||
|
}
|
||
|
|
||
|
public boolean addLottieOnCompositionLoadedListener(LottieOnCompositionLoadedListener lottieOnCompositionLoadedListener) {
|
||
|
LottieComposition lottieComposition = this.composition;
|
||
|
if (lottieComposition != null) {
|
||
|
lottieOnCompositionLoadedListener.onCompositionLoaded(lottieComposition);
|
||
|
}
|
||
|
return this.lottieOnCompositionLoadedListeners.add(lottieOnCompositionLoadedListener);
|
||
|
}
|
||
|
|
||
|
public boolean removeLottieOnCompositionLoadedListener(LottieOnCompositionLoadedListener lottieOnCompositionLoadedListener) {
|
||
|
return this.lottieOnCompositionLoadedListeners.remove(lottieOnCompositionLoadedListener);
|
||
|
}
|
||
|
|
||
|
public void removeAllLottieOnCompositionLoadedListener() {
|
||
|
this.lottieOnCompositionLoadedListeners.clear();
|
||
|
}
|
||
|
|
||
|
private void setLottieDrawable() {
|
||
|
boolean isAnimating = isAnimating();
|
||
|
setImageDrawable(null);
|
||
|
setImageDrawable(this.lottieDrawable);
|
||
|
if (isAnimating) {
|
||
|
this.lottieDrawable.resumeAnimation();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes.dex */
|
||
|
public static class SavedState extends View.BaseSavedState {
|
||
|
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { // from class: com.airbnb.lottie.LottieAnimationView.SavedState.1
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // android.os.Parcelable.Creator
|
||
|
public SavedState createFromParcel(Parcel parcel) {
|
||
|
return new SavedState(parcel);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // android.os.Parcelable.Creator
|
||
|
public SavedState[] newArray(int i) {
|
||
|
return new SavedState[i];
|
||
|
}
|
||
|
};
|
||
|
String animationName;
|
||
|
int animationResId;
|
||
|
String imageAssetsFolder;
|
||
|
boolean isAnimating;
|
||
|
float progress;
|
||
|
int repeatCount;
|
||
|
int repeatMode;
|
||
|
|
||
|
SavedState(Parcelable parcelable) {
|
||
|
super(parcelable);
|
||
|
}
|
||
|
|
||
|
private SavedState(Parcel parcel) {
|
||
|
super(parcel);
|
||
|
this.animationName = parcel.readString();
|
||
|
this.progress = parcel.readFloat();
|
||
|
this.isAnimating = parcel.readInt() == 1;
|
||
|
this.imageAssetsFolder = parcel.readString();
|
||
|
this.repeatMode = parcel.readInt();
|
||
|
this.repeatCount = parcel.readInt();
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View.BaseSavedState, android.view.AbsSavedState, android.os.Parcelable
|
||
|
public void writeToParcel(Parcel parcel, int i) {
|
||
|
super.writeToParcel(parcel, i);
|
||
|
parcel.writeString(this.animationName);
|
||
|
parcel.writeFloat(this.progress);
|
||
|
parcel.writeInt(this.isAnimating ? 1 : 0);
|
||
|
parcel.writeString(this.imageAssetsFolder);
|
||
|
parcel.writeInt(this.repeatMode);
|
||
|
parcel.writeInt(this.repeatCount);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setFallbackResource(int i) {
|
||
|
this.fallbackResource = i;
|
||
|
}
|
||
|
|
||
|
public void setFailureListener(LottieListener<Throwable> lottieListener) {
|
||
|
this.failureListener = lottieListener;
|
||
|
}
|
||
|
|
||
|
public void setCacheComposition(boolean z) {
|
||
|
this.cacheComposition = z;
|
||
|
}
|
||
|
|
||
|
public LottieComposition getComposition() {
|
||
|
return this.composition;
|
||
|
}
|
||
|
}
|