mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 01:22:33 -06:00
869 lines
34 KiB
Java
869 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.Typeface;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import android.os.Parcel;
|
||
|
import android.os.Parcelable;
|
||
|
import android.text.TextUtils;
|
||
|
import android.util.AttributeSet;
|
||
|
import android.util.Log;
|
||
|
import android.view.View;
|
||
|
import androidx.appcompat.content.res.AppCompatResources;
|
||
|
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 java.io.ByteArrayInputStream;
|
||
|
import java.io.InputStream;
|
||
|
import java.lang.ref.WeakReference;
|
||
|
import java.util.HashSet;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
import java.util.Set;
|
||
|
import java.util.concurrent.Callable;
|
||
|
import java.util.zip.ZipInputStream;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class LottieAnimationView extends AppCompatImageView {
|
||
|
private static final LottieListener<Throwable> DEFAULT_FAILURE_LISTENER = new LottieListener() { // from class: com.airbnb.lottie.LottieAnimationView$$ExternalSyntheticLambda1
|
||
|
@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: private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public enum UserActionTaken {
|
||
|
SET_ANIMATION,
|
||
|
SET_PROGRESS,
|
||
|
SET_REPEAT_MODE,
|
||
|
SET_REPEAT_COUNT,
|
||
|
SET_IMAGE_ASSETS,
|
||
|
PLAY_OPTION
|
||
|
}
|
||
|
|
||
|
public LottieComposition getComposition() {
|
||
|
return this.composition;
|
||
|
}
|
||
|
|
||
|
public void setCacheComposition(boolean z) {
|
||
|
this.cacheComposition = z;
|
||
|
}
|
||
|
|
||
|
public void setFailureListener(LottieListener<Throwable> lottieListener) {
|
||
|
this.failureListener = lottieListener;
|
||
|
}
|
||
|
|
||
|
public void setFallbackResource(int i) {
|
||
|
this.fallbackResource = i;
|
||
|
}
|
||
|
|
||
|
/* 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);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
private static class WeakSuccessListener implements LottieListener<LottieComposition> {
|
||
|
private final WeakReference<LottieAnimationView> targetReference;
|
||
|
|
||
|
public WeakSuccessListener(LottieAnimationView lottieAnimationView) {
|
||
|
this.targetReference = new WeakReference<>(lottieAnimationView);
|
||
|
}
|
||
|
|
||
|
@Override // com.airbnb.lottie.LottieListener
|
||
|
public void onResult(LottieComposition lottieComposition) {
|
||
|
LottieAnimationView lottieAnimationView = this.targetReference.get();
|
||
|
if (lottieAnimationView == null) {
|
||
|
return;
|
||
|
}
|
||
|
lottieAnimationView.setComposition(lottieComposition);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
private static class WeakFailureListener implements LottieListener<Throwable> {
|
||
|
private final WeakReference<LottieAnimationView> targetReference;
|
||
|
|
||
|
public WeakFailureListener(LottieAnimationView lottieAnimationView) {
|
||
|
this.targetReference = new WeakReference<>(lottieAnimationView);
|
||
|
}
|
||
|
|
||
|
@Override // com.airbnb.lottie.LottieListener
|
||
|
public void onResult(Throwable th) {
|
||
|
LottieAnimationView lottieAnimationView = this.targetReference.get();
|
||
|
if (lottieAnimationView == null) {
|
||
|
return;
|
||
|
}
|
||
|
if (lottieAnimationView.fallbackResource != 0) {
|
||
|
lottieAnimationView.setImageResource(lottieAnimationView.fallbackResource);
|
||
|
}
|
||
|
(lottieAnimationView.failureListener == null ? LottieAnimationView.DEFAULT_FAILURE_LISTENER : lottieAnimationView.failureListener).onResult(th);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public LottieAnimationView(Context context) {
|
||
|
super(context);
|
||
|
this.loadedListener = new WeakSuccessListener(this);
|
||
|
this.wrappedFailureListener = new WeakFailureListener(this);
|
||
|
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 WeakSuccessListener(this);
|
||
|
this.wrappedFailureListener = new WeakFailureListener(this);
|
||
|
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 WeakSuccessListener(this);
|
||
|
this.wrappedFailureListener = new WeakFailureListener(this);
|
||
|
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));
|
||
|
}
|
||
|
if (obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_clipTextToBoundingBox)) {
|
||
|
setClipTextToBoundingBox(obtainStyledAttributes.getBoolean(R.styleable.LottieAnimationView_lottie_clipTextToBoundingBox, false));
|
||
|
}
|
||
|
if (obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_defaultFontFileExtension)) {
|
||
|
setDefaultFontFileExtension(obtainStyledAttributes.getString(R.styleable.LottieAnimationView_lottie_defaultFontFileExtension));
|
||
|
}
|
||
|
setImageAssetsFolder(obtainStyledAttributes.getString(R.styleable.LottieAnimationView_lottie_imageAssetsFolder));
|
||
|
setProgressInternal(obtainStyledAttributes.getFloat(R.styleable.LottieAnimationView_lottie_progress, 0.0f), obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_progress));
|
||
|
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(AppCompatResources.getColorStateList(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]);
|
||
|
}
|
||
|
if (obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_asyncUpdates)) {
|
||
|
int i3 = obtainStyledAttributes.getInt(R.styleable.LottieAnimationView_lottie_asyncUpdates, AsyncUpdates.AUTOMATIC.ordinal());
|
||
|
if (i3 >= RenderMode.values().length) {
|
||
|
i3 = AsyncUpdates.AUTOMATIC.ordinal();
|
||
|
}
|
||
|
setAsyncUpdates(AsyncUpdates.values()[i3]);
|
||
|
}
|
||
|
setIgnoreDisabledSystemAnimations(obtainStyledAttributes.getBoolean(R.styleable.LottieAnimationView_lottie_ignoreDisabledSystemAnimations, false));
|
||
|
if (obtainStyledAttributes.hasValue(R.styleable.LottieAnimationView_lottie_useCompositionFrameRate)) {
|
||
|
setUseCompositionFrameRate(obtainStyledAttributes.getBoolean(R.styleable.LottieAnimationView_lottie_useCompositionFrameRate, false));
|
||
|
}
|
||
|
obtainStyledAttributes.recycle();
|
||
|
this.lottieDrawable.setSystemAnimationsAreEnabled(Boolean.valueOf(Utils.getAnimationScale(getContext()) != 0.0f));
|
||
|
}
|
||
|
|
||
|
@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)) {
|
||
|
setProgressInternal(savedState.progress, false);
|
||
|
}
|
||
|
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 setUseCompositionFrameRate(boolean z) {
|
||
|
this.lottieDrawable.setUseCompositionFrameRate(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() { // from class: com.airbnb.lottie.LottieAnimationView$$ExternalSyntheticLambda0
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
public final Object call() {
|
||
|
return LottieAnimationView.this.m5343lambda$fromRawRes$1$comairbnblottieLottieAnimationView(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 m5343lambda$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() { // from class: com.airbnb.lottie.LottieAnimationView$$ExternalSyntheticLambda2
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
public final Object call() {
|
||
|
return LottieAnimationView.this.m5342lambda$fromAssets$2$comairbnblottieLottieAnimationView(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 m5342lambda$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 setAnimation(ZipInputStream zipInputStream, String str) {
|
||
|
setCompositionTask(LottieCompositionFactory.fromZipStream(zipInputStream, 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) {
|
||
|
LottieResult<LottieComposition> result = lottieTask.getResult();
|
||
|
if (result == null || result.getValue() != this.composition) {
|
||
|
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) {
|
||
|
if (L.DBG) {
|
||
|
Log.v(TAG, "Set Composition \n" + lottieComposition);
|
||
|
}
|
||
|
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 setDefaultFontFileExtension(String str) {
|
||
|
this.lottieDrawable.setDefaultFontFileExtension(str);
|
||
|
}
|
||
|
|
||
|
public void setFontAssetDelegate(FontAssetDelegate fontAssetDelegate) {
|
||
|
this.lottieDrawable.setFontAssetDelegate(fontAssetDelegate);
|
||
|
}
|
||
|
|
||
|
public void setFontMap(Map<String, Typeface> map) {
|
||
|
this.lottieDrawable.setFontMap(map);
|
||
|
}
|
||
|
|
||
|
public void setTextDelegate(TextDelegate textDelegate) {
|
||
|
this.lottieDrawable.setTextDelegate(textDelegate);
|
||
|
}
|
||
|
|
||
|
public List<KeyPath> resolveKeyPath(KeyPath keyPath) {
|
||
|
return this.lottieDrawable.resolveKeyPath(keyPath);
|
||
|
}
|
||
|
|
||
|
public <T> void clearValueCallback(KeyPath keyPath, T t) {
|
||
|
this.lottieDrawable.addValueCallback(keyPath, (KeyPath) t, (LottieValueCallback<KeyPath>) null);
|
||
|
}
|
||
|
|
||
|
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, final SimpleLottieValueCallback<T> simpleLottieValueCallback) {
|
||
|
this.lottieDrawable.addValueCallback(keyPath, (KeyPath) t, (LottieValueCallback<KeyPath>) new LottieValueCallback<T>() { // from class: com.airbnb.lottie.LottieAnimationView.1
|
||
|
@Override // com.airbnb.lottie.value.LottieValueCallback
|
||
|
public T getValue(LottieFrameInfo<T> lottieFrameInfo) {
|
||
|
return (T) simpleLottieValueCallback.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) {
|
||
|
setProgressInternal(f, true);
|
||
|
}
|
||
|
|
||
|
private void setProgressInternal(float f, boolean z) {
|
||
|
if (z) {
|
||
|
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 r2.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 AsyncUpdates getAsyncUpdates() {
|
||
|
return this.lottieDrawable.getAsyncUpdates();
|
||
|
}
|
||
|
|
||
|
public boolean getAsyncUpdatesEnabled() {
|
||
|
return this.lottieDrawable.getAsyncUpdatesEnabled();
|
||
|
}
|
||
|
|
||
|
public void setAsyncUpdates(AsyncUpdates asyncUpdates) {
|
||
|
this.lottieDrawable.setAsyncUpdates(asyncUpdates);
|
||
|
}
|
||
|
|
||
|
public void setApplyingOpacityToLayersEnabled(boolean z) {
|
||
|
this.lottieDrawable.setApplyingOpacityToLayersEnabled(z);
|
||
|
}
|
||
|
|
||
|
public boolean getClipTextToBoundingBox() {
|
||
|
return this.lottieDrawable.getClipTextToBoundingBox();
|
||
|
}
|
||
|
|
||
|
public void setClipTextToBoundingBox(boolean z) {
|
||
|
this.lottieDrawable.setClipTextToBoundingBox(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: private */
|
||
|
/* loaded from: classes2.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);
|
||
|
}
|
||
|
}
|
||
|
}
|