first commit

This commit is contained in:
tmarschutz
2025-10-03 11:45:17 +02:00
parent 09821c1c43
commit 5da3f1e071
10571 changed files with 1386578 additions and 1 deletions
@@ -0,0 +1,14 @@
package com.airbnb.lottie;
/* loaded from: classes.dex */
public final class BuildConfig {
@Deprecated
public static final String APPLICATION_ID = "com.airbnb.lottie";
public static final String BUILD_TYPE = "release";
public static final boolean DEBUG = false;
public static final String FLAVOR = "";
public static final String LIBRARY_PACKAGE_NAME = "com.airbnb.lottie";
public static final int VERSION_CODE = -1;
public static final String VERSION_NAME = "";
}
@@ -0,0 +1,63 @@
package com.airbnb.lottie;
import androidx.core.os.TraceCompat;
/* renamed from: com.airbnb.lottie.L */
/* loaded from: classes.dex */
public class C0633L {
private static final int MAX_DEPTH = 20;
public static final String TAG = "LOTTIE";
private static String[] sections;
private static long[] startTimeNs;
public static boolean DBG = false;
private static boolean traceEnabled = false;
private static int traceDepth = 0;
private static int depthPastMaxDepth = 0;
public static void setTraceEnabled(boolean enabled) {
if (traceEnabled == enabled) {
return;
}
traceEnabled = enabled;
if (enabled) {
sections = new String[20];
startTimeNs = new long[20];
}
}
public static void beginSection(String section) {
if (!traceEnabled) {
return;
}
int i = traceDepth;
if (i == 20) {
depthPastMaxDepth++;
return;
}
sections[i] = section;
startTimeNs[i] = System.nanoTime();
TraceCompat.beginSection(section);
traceDepth++;
}
public static float endSection(String section) {
int i = depthPastMaxDepth;
if (i > 0) {
depthPastMaxDepth = i - 1;
return 0.0f;
}
if (!traceEnabled) {
return 0.0f;
}
int i2 = traceDepth - 1;
traceDepth = i2;
if (i2 == -1) {
throw new IllegalStateException("Can't end trace section. There are none.");
}
if (!section.equals(sections[i2])) {
throw new IllegalStateException("Unbalanced trace call " + section + ". Expected " + sections[traceDepth] + ".");
}
TraceCompat.endSection();
return ((float) (System.nanoTime() - startTimeNs[traceDepth])) / 1000000.0f;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
package com.airbnb.lottie;
@Deprecated
/* loaded from: classes.dex */
public interface Cancellable {
void cancel();
}
@@ -0,0 +1,14 @@
package com.airbnb.lottie;
import android.graphics.Typeface;
/* loaded from: classes.dex */
public class FontAssetDelegate {
public Typeface fetchFont(String fontFamily) {
return null;
}
public String getFontPath(String fontFamily) {
return null;
}
}
@@ -0,0 +1,8 @@
package com.airbnb.lottie;
import android.graphics.Bitmap;
/* loaded from: classes.dex */
public interface ImageAssetDelegate {
Bitmap fetchBitmap(LottieImageAsset lottieImageAsset);
}
@@ -0,0 +1,836 @@
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.ColorFilter;
import android.graphics.drawable.Drawable;
import android.os.Build;
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 android.widget.ImageView;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.core.view.ViewCompat;
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.util.HashSet;
import java.util.List;
import java.util.Set;
/* loaded from: classes.dex */
public class LottieAnimationView extends AppCompatImageView {
private String animationName;
private int animationResId;
private boolean autoPlay;
private int buildDrawingCacheDepth;
private boolean cacheComposition;
private LottieComposition composition;
private LottieTask<LottieComposition> compositionTask;
private LottieListener<Throwable> failureListener;
private int fallbackResource;
private boolean isInitialized;
private final LottieListener<LottieComposition> loadedListener;
private final LottieDrawable lottieDrawable;
private Set<LottieOnCompositionLoadedListener> lottieOnCompositionLoadedListeners;
private boolean playAnimationWhenShown;
private RenderMode renderMode;
private boolean wasAnimatingWhenDetached;
private boolean wasAnimatingWhenNotShown;
private final LottieListener<Throwable> wrappedFailureListener;
private static final String TAG = LottieAnimationView.class.getSimpleName();
private static final LottieListener<Throwable> DEFAULT_FAILURE_LISTENER = new LottieListener<Throwable>() { // from class: com.airbnb.lottie.LottieAnimationView.1
@Override // com.airbnb.lottie.LottieListener
public void onResult(Throwable throwable) {
if (Utils.isNetworkException(throwable)) {
Logger.warning("Unable to load composition.", throwable);
return;
}
throw new IllegalStateException("Unable to parse composition", throwable);
}
};
public LottieAnimationView(Context context) {
super(context);
this.loadedListener = new LottieListener<LottieComposition>() { // from class: com.airbnb.lottie.LottieAnimationView.2
@Override // com.airbnb.lottie.LottieListener
public void onResult(LottieComposition composition) {
LottieAnimationView.this.setComposition(composition);
}
};
this.wrappedFailureListener = new LottieListener<Throwable>() { // from class: com.airbnb.lottie.LottieAnimationView.3
@Override // com.airbnb.lottie.LottieListener
public void onResult(Throwable result) {
if (LottieAnimationView.this.fallbackResource != 0) {
LottieAnimationView lottieAnimationView = LottieAnimationView.this;
lottieAnimationView.setImageResource(lottieAnimationView.fallbackResource);
}
LottieListener<Throwable> l = LottieAnimationView.this.failureListener == null ? LottieAnimationView.DEFAULT_FAILURE_LISTENER : LottieAnimationView.this.failureListener;
l.onResult(result);
}
};
this.fallbackResource = 0;
this.lottieDrawable = new LottieDrawable();
this.playAnimationWhenShown = false;
this.wasAnimatingWhenNotShown = false;
this.wasAnimatingWhenDetached = false;
this.autoPlay = false;
this.cacheComposition = true;
this.renderMode = RenderMode.AUTOMATIC;
this.lottieOnCompositionLoadedListeners = new HashSet();
this.buildDrawingCacheDepth = 0;
init(null);
}
public LottieAnimationView(Context context, AttributeSet attrs) {
super(context, attrs);
this.loadedListener = new LottieListener<LottieComposition>() { // from class: com.airbnb.lottie.LottieAnimationView.2
@Override // com.airbnb.lottie.LottieListener
public void onResult(LottieComposition composition) {
LottieAnimationView.this.setComposition(composition);
}
};
this.wrappedFailureListener = new LottieListener<Throwable>() { // from class: com.airbnb.lottie.LottieAnimationView.3
@Override // com.airbnb.lottie.LottieListener
public void onResult(Throwable result) {
if (LottieAnimationView.this.fallbackResource != 0) {
LottieAnimationView lottieAnimationView = LottieAnimationView.this;
lottieAnimationView.setImageResource(lottieAnimationView.fallbackResource);
}
LottieListener<Throwable> l = LottieAnimationView.this.failureListener == null ? LottieAnimationView.DEFAULT_FAILURE_LISTENER : LottieAnimationView.this.failureListener;
l.onResult(result);
}
};
this.fallbackResource = 0;
this.lottieDrawable = new LottieDrawable();
this.playAnimationWhenShown = false;
this.wasAnimatingWhenNotShown = false;
this.wasAnimatingWhenDetached = false;
this.autoPlay = false;
this.cacheComposition = true;
this.renderMode = RenderMode.AUTOMATIC;
this.lottieOnCompositionLoadedListeners = new HashSet();
this.buildDrawingCacheDepth = 0;
init(attrs);
}
public LottieAnimationView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.loadedListener = new LottieListener<LottieComposition>() { // from class: com.airbnb.lottie.LottieAnimationView.2
@Override // com.airbnb.lottie.LottieListener
public void onResult(LottieComposition composition) {
LottieAnimationView.this.setComposition(composition);
}
};
this.wrappedFailureListener = new LottieListener<Throwable>() { // from class: com.airbnb.lottie.LottieAnimationView.3
@Override // com.airbnb.lottie.LottieListener
public void onResult(Throwable result) {
if (LottieAnimationView.this.fallbackResource != 0) {
LottieAnimationView lottieAnimationView = LottieAnimationView.this;
lottieAnimationView.setImageResource(lottieAnimationView.fallbackResource);
}
LottieListener<Throwable> l = LottieAnimationView.this.failureListener == null ? LottieAnimationView.DEFAULT_FAILURE_LISTENER : LottieAnimationView.this.failureListener;
l.onResult(result);
}
};
this.fallbackResource = 0;
this.lottieDrawable = new LottieDrawable();
this.playAnimationWhenShown = false;
this.wasAnimatingWhenNotShown = false;
this.wasAnimatingWhenDetached = false;
this.autoPlay = false;
this.cacheComposition = true;
this.renderMode = RenderMode.AUTOMATIC;
this.lottieOnCompositionLoadedListeners = new HashSet();
this.buildDrawingCacheDepth = 0;
init(attrs);
}
private void init(AttributeSet attrs) {
String url;
TypedArray ta = getContext().obtainStyledAttributes(attrs, C0671R.styleable.LottieAnimationView);
if (!isInEditMode()) {
this.cacheComposition = ta.getBoolean(C0671R.styleable.LottieAnimationView_lottie_cacheComposition, true);
boolean hasRawRes = ta.hasValue(C0671R.styleable.LottieAnimationView_lottie_rawRes);
boolean hasFileName = ta.hasValue(C0671R.styleable.LottieAnimationView_lottie_fileName);
boolean hasUrl = ta.hasValue(C0671R.styleable.LottieAnimationView_lottie_url);
if (hasRawRes && hasFileName) {
throw new IllegalArgumentException("lottie_rawRes and lottie_fileName cannot be used at the same time. Please use only one at once.");
}
if (hasRawRes) {
int rawResId = ta.getResourceId(C0671R.styleable.LottieAnimationView_lottie_rawRes, 0);
if (rawResId != 0) {
setAnimation(rawResId);
}
} else if (hasFileName) {
String fileName = ta.getString(C0671R.styleable.LottieAnimationView_lottie_fileName);
if (fileName != null) {
setAnimation(fileName);
}
} else if (hasUrl && (url = ta.getString(C0671R.styleable.LottieAnimationView_lottie_url)) != null) {
setAnimationFromUrl(url);
}
setFallbackResource(ta.getResourceId(C0671R.styleable.LottieAnimationView_lottie_fallbackRes, 0));
}
if (ta.getBoolean(C0671R.styleable.LottieAnimationView_lottie_autoPlay, false)) {
this.wasAnimatingWhenDetached = true;
this.autoPlay = true;
}
if (ta.getBoolean(C0671R.styleable.LottieAnimationView_lottie_loop, false)) {
this.lottieDrawable.setRepeatCount(-1);
}
if (ta.hasValue(C0671R.styleable.LottieAnimationView_lottie_repeatMode)) {
setRepeatMode(ta.getInt(C0671R.styleable.LottieAnimationView_lottie_repeatMode, 1));
}
if (ta.hasValue(C0671R.styleable.LottieAnimationView_lottie_repeatCount)) {
setRepeatCount(ta.getInt(C0671R.styleable.LottieAnimationView_lottie_repeatCount, -1));
}
if (ta.hasValue(C0671R.styleable.LottieAnimationView_lottie_speed)) {
setSpeed(ta.getFloat(C0671R.styleable.LottieAnimationView_lottie_speed, 1.0f));
}
setImageAssetsFolder(ta.getString(C0671R.styleable.LottieAnimationView_lottie_imageAssetsFolder));
setProgress(ta.getFloat(C0671R.styleable.LottieAnimationView_lottie_progress, 0.0f));
enableMergePathsForKitKatAndAbove(ta.getBoolean(C0671R.styleable.LottieAnimationView_lottie_enableMergePathsForKitKatAndAbove, false));
if (ta.hasValue(C0671R.styleable.LottieAnimationView_lottie_colorFilter)) {
SimpleColorFilter filter = new SimpleColorFilter(ta.getColor(C0671R.styleable.LottieAnimationView_lottie_colorFilter, 0));
KeyPath keyPath = new KeyPath("**");
LottieValueCallback<ColorFilter> callback = new LottieValueCallback<>(filter);
addValueCallback(keyPath, (KeyPath) LottieProperty.COLOR_FILTER, (LottieValueCallback<KeyPath>) callback);
}
if (ta.hasValue(C0671R.styleable.LottieAnimationView_lottie_scale)) {
this.lottieDrawable.setScale(ta.getFloat(C0671R.styleable.LottieAnimationView_lottie_scale, 1.0f));
}
if (ta.hasValue(C0671R.styleable.LottieAnimationView_lottie_renderMode)) {
int renderModeOrdinal = ta.getInt(C0671R.styleable.LottieAnimationView_lottie_renderMode, RenderMode.AUTOMATIC.ordinal());
if (renderModeOrdinal >= RenderMode.values().length) {
renderModeOrdinal = RenderMode.AUTOMATIC.ordinal();
}
setRenderMode(RenderMode.values()[renderModeOrdinal]);
}
if (getScaleType() != null) {
this.lottieDrawable.setScaleType(getScaleType());
}
ta.recycle();
this.lottieDrawable.setSystemAnimationsAreEnabled(Boolean.valueOf(Utils.getAnimationScale(getContext()) != 0.0f));
enableOrDisableHardwareLayer();
this.isInitialized = true;
}
@Override // androidx.appcompat.widget.AppCompatImageView, android.widget.ImageView
public void setImageResource(int resId) {
cancelLoaderTask();
super.setImageResource(resId);
}
@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 bm) {
cancelLoaderTask();
super.setImageBitmap(bm);
}
@Override // android.widget.ImageView, android.view.View, android.graphics.drawable.Drawable.Callback
public void invalidateDrawable(Drawable dr) {
Drawable drawable = getDrawable();
LottieDrawable lottieDrawable = this.lottieDrawable;
if (drawable == lottieDrawable) {
super.invalidateDrawable(lottieDrawable);
} else {
super.invalidateDrawable(dr);
}
}
@Override // android.view.View
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.animationName = this.animationName;
ss.animationResId = this.animationResId;
ss.progress = this.lottieDrawable.getProgress();
ss.isAnimating = this.lottieDrawable.isAnimating() || (!ViewCompat.isAttachedToWindow(this) && this.wasAnimatingWhenDetached);
ss.imageAssetsFolder = this.lottieDrawable.getImageAssetsFolder();
ss.repeatMode = this.lottieDrawable.getRepeatMode();
ss.repeatCount = this.lottieDrawable.getRepeatCount();
return ss;
}
@Override // android.view.View
protected void onRestoreInstanceState(Parcelable state) {
if (!(state instanceof SavedState)) {
super.onRestoreInstanceState(state);
return;
}
SavedState ss = (SavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
String str = ss.animationName;
this.animationName = str;
if (!TextUtils.isEmpty(str)) {
setAnimation(this.animationName);
}
int i = ss.animationResId;
this.animationResId = i;
if (i != 0) {
setAnimation(i);
}
setProgress(ss.progress);
if (ss.isAnimating) {
playAnimation();
}
this.lottieDrawable.setImagesAssetsFolder(ss.imageAssetsFolder);
setRepeatMode(ss.repeatMode);
setRepeatCount(ss.repeatCount);
}
@Override // android.view.View
protected void onVisibilityChanged(View changedView, int visibility) {
if (!this.isInitialized) {
return;
}
if (isShown()) {
if (this.wasAnimatingWhenNotShown) {
resumeAnimation();
} else if (this.playAnimationWhenShown) {
playAnimation();
}
this.wasAnimatingWhenNotShown = false;
this.playAnimationWhenShown = false;
return;
}
if (isAnimating()) {
pauseAnimation();
this.wasAnimatingWhenNotShown = true;
}
}
@Override // android.widget.ImageView, android.view.View
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (this.autoPlay || this.wasAnimatingWhenDetached) {
playAnimation();
this.autoPlay = false;
this.wasAnimatingWhenDetached = false;
}
if (Build.VERSION.SDK_INT < 23) {
onVisibilityChanged(this, getVisibility());
}
}
@Override // android.widget.ImageView, android.view.View
protected void onDetachedFromWindow() {
if (isAnimating()) {
cancelAnimation();
this.wasAnimatingWhenDetached = true;
}
super.onDetachedFromWindow();
}
public void enableMergePathsForKitKatAndAbove(boolean enable) {
this.lottieDrawable.enableMergePathsForKitKatAndAbove(enable);
}
public boolean isMergePathsEnabledForKitKatAndAbove() {
return this.lottieDrawable.isMergePathsEnabledForKitKatAndAbove();
}
public void setCacheComposition(boolean cacheComposition) {
this.cacheComposition = cacheComposition;
}
public void setAnimation(int rawRes) {
LottieTask<LottieComposition> task;
this.animationResId = rawRes;
this.animationName = null;
if (!this.cacheComposition) {
task = LottieCompositionFactory.fromRawRes(getContext(), rawRes, null);
} else {
task = LottieCompositionFactory.fromRawRes(getContext(), rawRes);
}
setCompositionTask(task);
}
public void setAnimation(String assetName) {
this.animationName = assetName;
this.animationResId = 0;
LottieTask<LottieComposition> task = this.cacheComposition ? LottieCompositionFactory.fromAsset(getContext(), assetName) : LottieCompositionFactory.fromAsset(getContext(), assetName, null);
setCompositionTask(task);
}
@Deprecated
public void setAnimationFromJson(String jsonString) {
setAnimationFromJson(jsonString, null);
}
public void setAnimationFromJson(String jsonString, String cacheKey) {
setAnimation(new ByteArrayInputStream(jsonString.getBytes()), cacheKey);
}
public void setAnimation(InputStream stream, String cacheKey) {
setCompositionTask(LottieCompositionFactory.fromJsonInputStream(stream, cacheKey));
}
public void setAnimationFromUrl(String url) {
LottieTask<LottieComposition> task = this.cacheComposition ? LottieCompositionFactory.fromUrl(getContext(), url) : LottieCompositionFactory.fromUrl(getContext(), url, null);
setCompositionTask(task);
}
public void setAnimationFromUrl(String url, String cacheKey) {
LottieTask<LottieComposition> task = LottieCompositionFactory.fromUrl(getContext(), url, cacheKey);
setCompositionTask(task);
}
public void setFailureListener(LottieListener<Throwable> failureListener) {
this.failureListener = failureListener;
}
public void setFallbackResource(int fallbackResource) {
this.fallbackResource = fallbackResource;
}
private void setCompositionTask(LottieTask<LottieComposition> compositionTask) {
clearComposition();
cancelLoaderTask();
this.compositionTask = compositionTask.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 composition) {
if (C0633L.DBG) {
Log.v(TAG, "Set Composition \n" + composition);
}
this.lottieDrawable.setCallback(this);
this.composition = composition;
boolean isNewComposition = this.lottieDrawable.setComposition(composition);
enableOrDisableHardwareLayer();
if (getDrawable() == this.lottieDrawable && !isNewComposition) {
return;
}
onVisibilityChanged(this, getVisibility());
requestLayout();
for (LottieOnCompositionLoadedListener lottieOnCompositionLoadedListener : this.lottieOnCompositionLoadedListeners) {
lottieOnCompositionLoadedListener.onCompositionLoaded(composition);
}
}
public LottieComposition getComposition() {
return this.composition;
}
public boolean hasMasks() {
return this.lottieDrawable.hasMasks();
}
public boolean hasMatte() {
return this.lottieDrawable.hasMatte();
}
public void playAnimation() {
if (isShown()) {
this.lottieDrawable.playAnimation();
enableOrDisableHardwareLayer();
} else {
this.playAnimationWhenShown = true;
}
}
public void resumeAnimation() {
if (isShown()) {
this.lottieDrawable.resumeAnimation();
enableOrDisableHardwareLayer();
} else {
this.playAnimationWhenShown = false;
this.wasAnimatingWhenNotShown = true;
}
}
public void setMinFrame(int startFrame) {
this.lottieDrawable.setMinFrame(startFrame);
}
public float getMinFrame() {
return this.lottieDrawable.getMinFrame();
}
public void setMinProgress(float startProgress) {
this.lottieDrawable.setMinProgress(startProgress);
}
public void setMaxFrame(int endFrame) {
this.lottieDrawable.setMaxFrame(endFrame);
}
public float getMaxFrame() {
return this.lottieDrawable.getMaxFrame();
}
public void setMaxProgress(float endProgress) {
this.lottieDrawable.setMaxProgress(endProgress);
}
public void setMinFrame(String markerName) {
this.lottieDrawable.setMinFrame(markerName);
}
public void setMaxFrame(String markerName) {
this.lottieDrawable.setMaxFrame(markerName);
}
public void setMinAndMaxFrame(String markerName) {
this.lottieDrawable.setMinAndMaxFrame(markerName);
}
public void setMinAndMaxFrame(String startMarkerName, String endMarkerName, boolean playEndMarkerStartFrame) {
this.lottieDrawable.setMinAndMaxFrame(startMarkerName, endMarkerName, playEndMarkerStartFrame);
}
public void setMinAndMaxFrame(int minFrame, int maxFrame) {
this.lottieDrawable.setMinAndMaxFrame(minFrame, maxFrame);
}
public void setMinAndMaxProgress(float minProgress, float maxProgress) {
this.lottieDrawable.setMinAndMaxProgress(minProgress, maxProgress);
}
public void reverseAnimationSpeed() {
this.lottieDrawable.reverseAnimationSpeed();
}
public void setSpeed(float speed) {
this.lottieDrawable.setSpeed(speed);
}
public float getSpeed() {
return this.lottieDrawable.getSpeed();
}
public void addAnimatorUpdateListener(ValueAnimator.AnimatorUpdateListener updateListener) {
this.lottieDrawable.addAnimatorUpdateListener(updateListener);
}
public void removeUpdateListener(ValueAnimator.AnimatorUpdateListener updateListener) {
this.lottieDrawable.removeAnimatorUpdateListener(updateListener);
}
public void removeAllUpdateListeners() {
this.lottieDrawable.removeAllUpdateListeners();
}
public void addAnimatorListener(Animator.AnimatorListener listener) {
this.lottieDrawable.addAnimatorListener(listener);
}
public void removeAnimatorListener(Animator.AnimatorListener listener) {
this.lottieDrawable.removeAnimatorListener(listener);
}
public void removeAllAnimatorListeners() {
this.lottieDrawable.removeAllAnimatorListeners();
}
@Deprecated
public void loop(boolean loop) {
this.lottieDrawable.setRepeatCount(loop ? -1 : 0);
}
public void setRepeatMode(int mode) {
this.lottieDrawable.setRepeatMode(mode);
}
public int getRepeatMode() {
return this.lottieDrawable.getRepeatMode();
}
public void setRepeatCount(int count) {
this.lottieDrawable.setRepeatCount(count);
}
public int getRepeatCount() {
return this.lottieDrawable.getRepeatCount();
}
public boolean isAnimating() {
return this.lottieDrawable.isAnimating();
}
public void setImageAssetsFolder(String imageAssetsFolder) {
this.lottieDrawable.setImagesAssetsFolder(imageAssetsFolder);
}
public String getImageAssetsFolder() {
return this.lottieDrawable.getImageAssetsFolder();
}
public Bitmap updateBitmap(String id, Bitmap bitmap) {
return this.lottieDrawable.updateBitmap(id, bitmap);
}
public void setImageAssetDelegate(ImageAssetDelegate assetDelegate) {
this.lottieDrawable.setImageAssetDelegate(assetDelegate);
}
public void setFontAssetDelegate(FontAssetDelegate assetDelegate) {
this.lottieDrawable.setFontAssetDelegate(assetDelegate);
}
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 property, LottieValueCallback<T> callback) {
this.lottieDrawable.addValueCallback(keyPath, (KeyPath) property, (LottieValueCallback<KeyPath>) callback);
}
public <T> void addValueCallback(KeyPath keyPath, T property, final SimpleLottieValueCallback<T> callback) {
this.lottieDrawable.addValueCallback(keyPath, (KeyPath) property, (LottieValueCallback<KeyPath>) new LottieValueCallback<T>() { // from class: com.airbnb.lottie.LottieAnimationView.4
@Override // com.airbnb.lottie.value.LottieValueCallback
public T getValue(LottieFrameInfo<T> lottieFrameInfo) {
return (T) callback.getValue(lottieFrameInfo);
}
});
}
public void setScale(float scale) {
this.lottieDrawable.setScale(scale);
if (getDrawable() == this.lottieDrawable) {
setImageDrawable(null);
setImageDrawable(this.lottieDrawable);
}
}
public float getScale() {
return this.lottieDrawable.getScale();
}
@Override // android.widget.ImageView
public void setScaleType(ImageView.ScaleType scaleType) {
super.setScaleType(scaleType);
LottieDrawable lottieDrawable = this.lottieDrawable;
if (lottieDrawable != null) {
lottieDrawable.setScaleType(scaleType);
}
}
public void cancelAnimation() {
this.wasAnimatingWhenDetached = false;
this.wasAnimatingWhenNotShown = false;
this.playAnimationWhenShown = false;
this.lottieDrawable.cancelAnimation();
enableOrDisableHardwareLayer();
}
public void pauseAnimation() {
this.autoPlay = false;
this.wasAnimatingWhenDetached = false;
this.wasAnimatingWhenNotShown = false;
this.playAnimationWhenShown = false;
this.lottieDrawable.pauseAnimation();
enableOrDisableHardwareLayer();
}
public void setFrame(int frame) {
this.lottieDrawable.setFrame(frame);
}
public int getFrame() {
return this.lottieDrawable.getFrame();
}
public void setProgress(float progress) {
this.lottieDrawable.setProgress(progress);
}
public float getProgress() {
return this.lottieDrawable.getProgress();
}
public long getDuration() {
if (this.composition != null) {
return r0.getDuration();
}
return 0L;
}
public void setPerformanceTrackingEnabled(boolean enabled) {
this.lottieDrawable.setPerformanceTrackingEnabled(enabled);
}
public PerformanceTracker getPerformanceTracker() {
return this.lottieDrawable.getPerformanceTracker();
}
private void clearComposition() {
this.composition = null;
this.lottieDrawable.clearComposition();
}
public void setSafeMode(boolean safeMode) {
this.lottieDrawable.setSafeMode(safeMode);
}
@Override // android.view.View
public void buildDrawingCache(boolean autoScale) {
C0633L.beginSection("buildDrawingCache");
this.buildDrawingCacheDepth++;
super.buildDrawingCache(autoScale);
if (this.buildDrawingCacheDepth == 1 && getWidth() > 0 && getHeight() > 0 && getLayerType() == 1 && getDrawingCache(autoScale) == null) {
setRenderMode(RenderMode.HARDWARE);
}
this.buildDrawingCacheDepth--;
C0633L.endSection("buildDrawingCache");
}
public void setRenderMode(RenderMode renderMode) {
this.renderMode = renderMode;
enableOrDisableHardwareLayer();
}
public void setApplyingOpacityToLayersEnabled(boolean isApplyingOpacityToLayersEnabled) {
this.lottieDrawable.setApplyingOpacityToLayersEnabled(isApplyingOpacityToLayersEnabled);
}
public void disableExtraScaleModeInFitXY() {
this.lottieDrawable.disableExtraScaleModeInFitXY();
}
/* renamed from: com.airbnb.lottie.LottieAnimationView$5 */
static /* synthetic */ class C06385 {
static final /* synthetic */ int[] $SwitchMap$com$airbnb$lottie$RenderMode;
static {
int[] iArr = new int[RenderMode.values().length];
$SwitchMap$com$airbnb$lottie$RenderMode = iArr;
try {
iArr[RenderMode.HARDWARE.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$com$airbnb$lottie$RenderMode[RenderMode.SOFTWARE.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
$SwitchMap$com$airbnb$lottie$RenderMode[RenderMode.AUTOMATIC.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
}
}
private void enableOrDisableHardwareLayer() {
int layerType = 1;
switch (C06385.$SwitchMap$com$airbnb$lottie$RenderMode[this.renderMode.ordinal()]) {
case 1:
layerType = 2;
break;
case 2:
layerType = 1;
break;
case 3:
boolean useHardwareLayer = true;
LottieComposition lottieComposition = this.composition;
if (lottieComposition != null && lottieComposition.hasDashPattern() && Build.VERSION.SDK_INT < 28) {
useHardwareLayer = false;
} else {
LottieComposition lottieComposition2 = this.composition;
if (lottieComposition2 != null && lottieComposition2.getMaskAndMatteCount() > 4) {
useHardwareLayer = false;
} else if (Build.VERSION.SDK_INT < 21) {
useHardwareLayer = false;
}
}
layerType = useHardwareLayer ? 2 : 1;
break;
}
if (layerType != getLayerType()) {
setLayerType(layerType, null);
}
}
public boolean addLottieOnCompositionLoadedListener(LottieOnCompositionLoadedListener lottieOnCompositionLoadedListener) {
LottieComposition composition = this.composition;
if (composition != null) {
lottieOnCompositionLoadedListener.onCompositionLoaded(composition);
}
return this.lottieOnCompositionLoadedListeners.add(lottieOnCompositionLoadedListener);
}
public boolean removeLottieOnCompositionLoadedListener(LottieOnCompositionLoadedListener lottieOnCompositionLoadedListener) {
return this.lottieOnCompositionLoadedListeners.remove(lottieOnCompositionLoadedListener);
}
public void removeAllLottieOnCompositionLoadedListener() {
this.lottieOnCompositionLoadedListeners.clear();
}
private 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 in) {
return new SavedState(in);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
String animationName;
int animationResId;
String imageAssetsFolder;
boolean isAnimating;
float progress;
int repeatCount;
int repeatMode;
SavedState(Parcelable superState) {
super(superState);
}
private SavedState(Parcel in) {
super(in);
this.animationName = in.readString();
this.progress = in.readFloat();
this.isAnimating = in.readInt() == 1;
this.imageAssetsFolder = in.readString();
this.repeatMode = in.readInt();
this.repeatCount = in.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);
}
}
}
@@ -0,0 +1,260 @@
package com.airbnb.lottie;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Rect;
import androidx.collection.LongSparseArray;
import androidx.collection.SparseArrayCompat;
import com.airbnb.lottie.model.Font;
import com.airbnb.lottie.model.FontCharacter;
import com.airbnb.lottie.model.Marker;
import com.airbnb.lottie.model.layer.Layer;
import com.airbnb.lottie.parser.moshi.JsonReader;
import com.airbnb.lottie.utils.Logger;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class LottieComposition {
private Rect bounds;
private SparseArrayCompat<FontCharacter> characters;
private float endFrame;
private Map<String, Font> fonts;
private float frameRate;
private boolean hasDashPattern;
private Map<String, LottieImageAsset> images;
private LongSparseArray<Layer> layerMap;
private List<Layer> layers;
private List<Marker> markers;
private Map<String, List<Layer>> precomps;
private float startFrame;
private final PerformanceTracker performanceTracker = new PerformanceTracker();
private final HashSet<String> warnings = new HashSet<>();
private int maskAndMatteCount = 0;
public void init(Rect bounds, float startFrame, float endFrame, float frameRate, List<Layer> layers, LongSparseArray<Layer> layerMap, Map<String, List<Layer>> precomps, Map<String, LottieImageAsset> images, SparseArrayCompat<FontCharacter> characters, Map<String, Font> fonts, List<Marker> markers) {
this.bounds = bounds;
this.startFrame = startFrame;
this.endFrame = endFrame;
this.frameRate = frameRate;
this.layers = layers;
this.layerMap = layerMap;
this.precomps = precomps;
this.images = images;
this.characters = characters;
this.fonts = fonts;
this.markers = markers;
}
public void addWarning(String warning) {
Logger.warning(warning);
this.warnings.add(warning);
}
public void setHasDashPattern(boolean hasDashPattern) {
this.hasDashPattern = hasDashPattern;
}
public void incrementMatteOrMaskCount(int amount) {
this.maskAndMatteCount += amount;
}
public boolean hasDashPattern() {
return this.hasDashPattern;
}
public int getMaskAndMatteCount() {
return this.maskAndMatteCount;
}
public ArrayList<String> getWarnings() {
HashSet<String> hashSet = this.warnings;
return new ArrayList<>(Arrays.asList(hashSet.toArray(new String[hashSet.size()])));
}
public void setPerformanceTrackingEnabled(boolean enabled) {
this.performanceTracker.setEnabled(enabled);
}
public PerformanceTracker getPerformanceTracker() {
return this.performanceTracker;
}
public Layer layerModelForId(long id) {
return this.layerMap.get(id);
}
public Rect getBounds() {
return this.bounds;
}
public float getDuration() {
return (getDurationFrames() / this.frameRate) * 1000.0f;
}
public float getStartFrame() {
return this.startFrame;
}
public float getEndFrame() {
return this.endFrame;
}
public float getFrameRate() {
return this.frameRate;
}
public List<Layer> getLayers() {
return this.layers;
}
public List<Layer> getPrecomps(String id) {
return this.precomps.get(id);
}
public SparseArrayCompat<FontCharacter> getCharacters() {
return this.characters;
}
public Map<String, Font> getFonts() {
return this.fonts;
}
public List<Marker> getMarkers() {
return this.markers;
}
public Marker getMarker(String markerName) {
this.markers.size();
for (int i = 0; i < this.markers.size(); i++) {
Marker marker = this.markers.get(i);
if (marker.matchesName(markerName)) {
return marker;
}
}
return null;
}
public boolean hasImages() {
return !this.images.isEmpty();
}
public Map<String, LottieImageAsset> getImages() {
return this.images;
}
public float getDurationFrames() {
return this.endFrame - this.startFrame;
}
public String toString() {
StringBuilder sb = new StringBuilder("LottieComposition:\n");
for (Layer layer : this.layers) {
sb.append(layer.toString("\t"));
}
return sb.toString();
}
@Deprecated
public static class Factory {
private Factory() {
}
@Deprecated
public static Cancellable fromAssetFileName(Context context, String fileName, OnCompositionLoadedListener l) {
ListenerAdapter listener = new ListenerAdapter(l);
LottieCompositionFactory.fromAsset(context, fileName).addListener(listener);
return listener;
}
@Deprecated
public static Cancellable fromRawFile(Context context, int resId, OnCompositionLoadedListener l) {
ListenerAdapter listener = new ListenerAdapter(l);
LottieCompositionFactory.fromRawRes(context, resId).addListener(listener);
return listener;
}
@Deprecated
public static Cancellable fromInputStream(InputStream stream, OnCompositionLoadedListener l) {
ListenerAdapter listener = new ListenerAdapter(l);
LottieCompositionFactory.fromJsonInputStream(stream, null).addListener(listener);
return listener;
}
@Deprecated
public static Cancellable fromJsonString(String jsonString, OnCompositionLoadedListener l) {
ListenerAdapter listener = new ListenerAdapter(l);
LottieCompositionFactory.fromJsonString(jsonString, null).addListener(listener);
return listener;
}
@Deprecated
public static Cancellable fromJsonReader(JsonReader reader, OnCompositionLoadedListener l) {
ListenerAdapter listener = new ListenerAdapter(l);
LottieCompositionFactory.fromJsonReader(reader, null).addListener(listener);
return listener;
}
@Deprecated
public static LottieComposition fromFileSync(Context context, String fileName) {
return LottieCompositionFactory.fromAssetSync(context, fileName).getValue();
}
@Deprecated
public static LottieComposition fromInputStreamSync(InputStream stream) {
return LottieCompositionFactory.fromJsonInputStreamSync(stream, null).getValue();
}
@Deprecated
public static LottieComposition fromInputStreamSync(InputStream stream, boolean close) {
if (close) {
Logger.warning("Lottie now auto-closes input stream!");
}
return LottieCompositionFactory.fromJsonInputStreamSync(stream, null).getValue();
}
@Deprecated
public static LottieComposition fromJsonSync(Resources res, JSONObject json) {
return LottieCompositionFactory.fromJsonSync(json, null).getValue();
}
@Deprecated
public static LottieComposition fromJsonSync(String json) {
return LottieCompositionFactory.fromJsonStringSync(json, null).getValue();
}
@Deprecated
public static LottieComposition fromJsonSync(JsonReader reader) throws IOException {
return LottieCompositionFactory.fromJsonReaderSync(reader, null).getValue();
}
private static final class ListenerAdapter implements LottieListener<LottieComposition>, Cancellable {
private boolean cancelled;
private final OnCompositionLoadedListener listener;
private ListenerAdapter(OnCompositionLoadedListener listener) {
this.cancelled = false;
this.listener = listener;
}
@Override // com.airbnb.lottie.LottieListener
public void onResult(LottieComposition composition) {
if (this.cancelled) {
return;
}
this.listener.onCompositionLoaded(composition);
}
@Override // com.airbnb.lottie.Cancellable
public void cancel() {
this.cancelled = true;
}
}
}
}
@@ -0,0 +1,342 @@
package com.airbnb.lottie;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.airbnb.lottie.model.LottieCompositionCache;
import com.airbnb.lottie.network.NetworkCache;
import com.airbnb.lottie.network.NetworkFetcher;
import com.airbnb.lottie.parser.LottieCompositionMoshiParser;
import com.airbnb.lottie.parser.moshi.JsonReader;
import com.airbnb.lottie.utils.Utils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import okio.Okio;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class LottieCompositionFactory {
private static final Map<String, LottieTask<LottieComposition>> taskCache = new HashMap();
private LottieCompositionFactory() {
}
public static void setMaxCacheSize(int size) {
LottieCompositionCache.getInstance().resize(size);
}
public static void clearCache(Context context) {
taskCache.clear();
LottieCompositionCache.getInstance().clear();
new NetworkCache(context).clear();
}
public static LottieTask<LottieComposition> fromUrl(Context context, String url) {
return fromUrl(context, url, "url_" + url);
}
public static LottieTask<LottieComposition> fromUrl(final Context context, final String url, final String cacheKey) {
return cache(cacheKey, new Callable<LottieResult<LottieComposition>>() { // from class: com.airbnb.lottie.LottieCompositionFactory.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public LottieResult<LottieComposition> call() {
return NetworkFetcher.fetchSync(context, url, cacheKey);
}
});
}
public static LottieResult<LottieComposition> fromUrlSync(Context context, String url) {
return fromUrlSync(context, url, url);
}
public static LottieResult<LottieComposition> fromUrlSync(Context context, String url, String cacheKey) {
return NetworkFetcher.fetchSync(context, url, cacheKey);
}
public static LottieTask<LottieComposition> fromAsset(Context context, String fileName) {
String cacheKey = "asset_" + fileName;
return fromAsset(context, fileName, cacheKey);
}
public static LottieTask<LottieComposition> fromAsset(Context context, final String fileName, final String cacheKey) {
final Context appContext = context.getApplicationContext();
return cache(cacheKey, new Callable<LottieResult<LottieComposition>>() { // from class: com.airbnb.lottie.LottieCompositionFactory.2
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public LottieResult<LottieComposition> call() {
return LottieCompositionFactory.fromAssetSync(appContext, fileName, cacheKey);
}
});
}
public static LottieResult<LottieComposition> fromAssetSync(Context context, String fileName) {
String cacheKey = "asset_" + fileName;
return fromAssetSync(context, fileName, cacheKey);
}
public static LottieResult<LottieComposition> fromAssetSync(Context context, String fileName, String cacheKey) {
try {
if (fileName.endsWith(".zip")) {
return fromZipStreamSync(new ZipInputStream(context.getAssets().open(fileName)), cacheKey);
}
return fromJsonInputStreamSync(context.getAssets().open(fileName), cacheKey);
} catch (IOException e) {
return new LottieResult<>((Throwable) e);
}
}
public static LottieTask<LottieComposition> fromRawRes(Context context, int rawRes) {
return fromRawRes(context, rawRes, rawResCacheKey(context, rawRes));
}
public static LottieTask<LottieComposition> fromRawRes(Context context, final int rawRes, String cacheKey) {
final WeakReference<Context> contextRef = new WeakReference<>(context);
final Context appContext = context.getApplicationContext();
return cache(cacheKey, new Callable<LottieResult<LottieComposition>>() { // from class: com.airbnb.lottie.LottieCompositionFactory.3
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public LottieResult<LottieComposition> call() {
Context originalContext = (Context) contextRef.get();
Context context2 = originalContext != null ? originalContext : appContext;
return LottieCompositionFactory.fromRawResSync(context2, rawRes);
}
});
}
public static LottieResult<LottieComposition> fromRawResSync(Context context, int rawRes) {
return fromRawResSync(context, rawRes, rawResCacheKey(context, rawRes));
}
public static LottieResult<LottieComposition> fromRawResSync(Context context, int rawRes, String cacheKey) {
try {
return fromJsonInputStreamSync(context.getResources().openRawResource(rawRes), cacheKey);
} catch (Resources.NotFoundException e) {
return new LottieResult<>((Throwable) e);
}
}
private static String rawResCacheKey(Context context, int resId) {
StringBuilder sb = new StringBuilder();
sb.append("rawRes");
sb.append(isNightMode(context) ? "_night_" : "_day_");
sb.append(resId);
return sb.toString();
}
private static boolean isNightMode(Context context) {
int nightModeMasked = context.getResources().getConfiguration().uiMode & 48;
return nightModeMasked == 32;
}
public static LottieTask<LottieComposition> fromJsonInputStream(final InputStream stream, final String cacheKey) {
return cache(cacheKey, new Callable<LottieResult<LottieComposition>>() { // from class: com.airbnb.lottie.LottieCompositionFactory.4
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public LottieResult<LottieComposition> call() {
return LottieCompositionFactory.fromJsonInputStreamSync(stream, cacheKey);
}
});
}
public static LottieResult<LottieComposition> fromJsonInputStreamSync(InputStream stream, String cacheKey) {
return fromJsonInputStreamSync(stream, cacheKey, true);
}
private static LottieResult<LottieComposition> fromJsonInputStreamSync(InputStream stream, String cacheKey, boolean close) {
try {
return fromJsonReaderSync(JsonReader.m15of(Okio.buffer(Okio.source(stream))), cacheKey);
} finally {
if (close) {
Utils.closeQuietly(stream);
}
}
}
@Deprecated
public static LottieTask<LottieComposition> fromJson(final JSONObject json, final String cacheKey) {
return cache(cacheKey, new Callable<LottieResult<LottieComposition>>() { // from class: com.airbnb.lottie.LottieCompositionFactory.5
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public LottieResult<LottieComposition> call() {
return LottieCompositionFactory.fromJsonSync(json, cacheKey);
}
});
}
@Deprecated
public static LottieResult<LottieComposition> fromJsonSync(JSONObject json, String cacheKey) {
return fromJsonStringSync(json.toString(), cacheKey);
}
public static LottieTask<LottieComposition> fromJsonString(final String json, final String cacheKey) {
return cache(cacheKey, new Callable<LottieResult<LottieComposition>>() { // from class: com.airbnb.lottie.LottieCompositionFactory.6
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public LottieResult<LottieComposition> call() {
return LottieCompositionFactory.fromJsonStringSync(json, cacheKey);
}
});
}
public static LottieResult<LottieComposition> fromJsonStringSync(String json, String cacheKey) {
ByteArrayInputStream stream = new ByteArrayInputStream(json.getBytes());
return fromJsonReaderSync(JsonReader.m15of(Okio.buffer(Okio.source(stream))), cacheKey);
}
public static LottieTask<LottieComposition> fromJsonReader(final JsonReader reader, final String cacheKey) {
return cache(cacheKey, new Callable<LottieResult<LottieComposition>>() { // from class: com.airbnb.lottie.LottieCompositionFactory.7
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public LottieResult<LottieComposition> call() {
return LottieCompositionFactory.fromJsonReaderSync(JsonReader.this, cacheKey);
}
});
}
public static LottieResult<LottieComposition> fromJsonReaderSync(JsonReader reader, String cacheKey) {
return fromJsonReaderSyncInternal(reader, cacheKey, true);
}
private static LottieResult<LottieComposition> fromJsonReaderSyncInternal(JsonReader reader, String cacheKey, boolean close) {
try {
try {
LottieComposition composition = LottieCompositionMoshiParser.parse(reader);
if (cacheKey != null) {
LottieCompositionCache.getInstance().put(cacheKey, composition);
}
LottieResult<LottieComposition> lottieResult = new LottieResult<>(composition);
if (close) {
Utils.closeQuietly(reader);
}
return lottieResult;
} catch (Exception e) {
LottieResult<LottieComposition> lottieResult2 = new LottieResult<>(e);
if (close) {
Utils.closeQuietly(reader);
}
return lottieResult2;
}
} catch (Throwable th) {
if (close) {
Utils.closeQuietly(reader);
}
throw th;
}
}
public static LottieTask<LottieComposition> fromZipStream(final ZipInputStream inputStream, final String cacheKey) {
return cache(cacheKey, new Callable<LottieResult<LottieComposition>>() { // from class: com.airbnb.lottie.LottieCompositionFactory.8
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public LottieResult<LottieComposition> call() {
return LottieCompositionFactory.fromZipStreamSync(inputStream, cacheKey);
}
});
}
public static LottieResult<LottieComposition> fromZipStreamSync(ZipInputStream inputStream, String cacheKey) {
try {
return fromZipStreamSyncInternal(inputStream, cacheKey);
} finally {
Utils.closeQuietly(inputStream);
}
}
private static LottieResult<LottieComposition> fromZipStreamSyncInternal(ZipInputStream inputStream, String cacheKey) {
LottieComposition composition = null;
Map<String, Bitmap> images = new HashMap<>();
try {
ZipEntry entry = inputStream.getNextEntry();
while (entry != null) {
String entryName = entry.getName();
if (entryName.contains("__MACOSX")) {
inputStream.closeEntry();
} else if (entry.getName().contains(".json")) {
JsonReader reader = JsonReader.m15of(Okio.buffer(Okio.source(inputStream)));
composition = fromJsonReaderSyncInternal(reader, null, false).getValue();
} else {
if (!entryName.contains(".png") && !entryName.contains(".webp")) {
inputStream.closeEntry();
}
String[] splitName = entryName.split("/");
String name = splitName[splitName.length - 1];
images.put(name, BitmapFactory.decodeStream(inputStream));
}
entry = inputStream.getNextEntry();
}
if (composition == null) {
return new LottieResult<>((Throwable) new IllegalArgumentException("Unable to parse composition"));
}
for (Map.Entry<String, Bitmap> e : images.entrySet()) {
LottieImageAsset imageAsset = findImageAssetForFileName(composition, e.getKey());
if (imageAsset != null) {
imageAsset.setBitmap(Utils.resizeBitmapIfNeeded(e.getValue(), imageAsset.getWidth(), imageAsset.getHeight()));
}
}
for (Map.Entry<String, LottieImageAsset> entry2 : composition.getImages().entrySet()) {
if (entry2.getValue().getBitmap() == null) {
return new LottieResult<>((Throwable) new IllegalStateException("There is no image for " + entry2.getValue().getFileName()));
}
}
if (cacheKey != null) {
LottieCompositionCache.getInstance().put(cacheKey, composition);
}
return new LottieResult<>(composition);
} catch (IOException e2) {
return new LottieResult<>((Throwable) e2);
}
}
private static LottieImageAsset findImageAssetForFileName(LottieComposition composition, String fileName) {
for (LottieImageAsset asset : composition.getImages().values()) {
if (asset.getFileName().equals(fileName)) {
return asset;
}
}
return null;
}
private static LottieTask<LottieComposition> cache(final String cacheKey, Callable<LottieResult<LottieComposition>> callable) {
final LottieComposition cachedComposition = cacheKey == null ? null : LottieCompositionCache.getInstance().get(cacheKey);
if (cachedComposition != null) {
return new LottieTask<>(new Callable<LottieResult<LottieComposition>>() { // from class: com.airbnb.lottie.LottieCompositionFactory.9
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.concurrent.Callable
public LottieResult<LottieComposition> call() {
return new LottieResult<>(LottieComposition.this);
}
});
}
if (cacheKey != null) {
Map<String, LottieTask<LottieComposition>> map = taskCache;
if (map.containsKey(cacheKey)) {
return map.get(cacheKey);
}
}
LottieTask<LottieComposition> task = new LottieTask<>(callable);
if (cacheKey != null) {
task.addListener(new LottieListener<LottieComposition>() { // from class: com.airbnb.lottie.LottieCompositionFactory.10
@Override // com.airbnb.lottie.LottieListener
public void onResult(LottieComposition result) {
LottieCompositionFactory.taskCache.remove(cacheKey);
}
});
task.addFailureListener(new LottieListener<Throwable>() { // from class: com.airbnb.lottie.LottieCompositionFactory.11
@Override // com.airbnb.lottie.LottieListener
public void onResult(Throwable result) {
LottieCompositionFactory.taskCache.remove(cacheKey);
}
});
taskCache.put(cacheKey, task);
}
return task;
}
}
@@ -0,0 +1,925 @@
package com.airbnb.lottie;
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.View;
import android.widget.ImageView;
import com.airbnb.lottie.manager.FontAssetManager;
import com.airbnb.lottie.manager.ImageAssetManager;
import com.airbnb.lottie.model.KeyPath;
import com.airbnb.lottie.model.Marker;
import com.airbnb.lottie.model.layer.CompositionLayer;
import com.airbnb.lottie.parser.LayerParser;
import com.airbnb.lottie.utils.Logger;
import com.airbnb.lottie.utils.LottieValueAnimator;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.LottieFrameInfo;
import com.airbnb.lottie.value.LottieValueCallback;
import com.airbnb.lottie.value.SimpleLottieValueCallback;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
/* loaded from: classes.dex */
public class LottieDrawable extends Drawable implements Drawable.Callback, Animatable {
public static final int INFINITE = -1;
public static final int RESTART = 1;
public static final int REVERSE = 2;
private static final String TAG = LottieDrawable.class.getSimpleName();
private int alpha;
private final LottieValueAnimator animator;
private final Set<ColorFilterData> colorFilterData;
private LottieComposition composition;
private CompositionLayer compositionLayer;
private boolean enableMergePaths;
FontAssetDelegate fontAssetDelegate;
private FontAssetManager fontAssetManager;
private ImageAssetDelegate imageAssetDelegate;
private ImageAssetManager imageAssetManager;
private String imageAssetsFolder;
private boolean isApplyingOpacityToLayersEnabled;
private boolean isDirty;
private boolean isExtraScaleEnabled;
private final ArrayList<LazyCompositionTask> lazyCompositionTasks;
private final Matrix matrix = new Matrix();
private boolean performanceTrackingEnabled;
private final ValueAnimator.AnimatorUpdateListener progressUpdateListener;
private boolean safeMode;
private float scale;
private ImageView.ScaleType scaleType;
private boolean systemAnimationsEnabled;
TextDelegate textDelegate;
private interface LazyCompositionTask {
void run(LottieComposition lottieComposition);
}
@Retention(RetentionPolicy.SOURCE)
public @interface RepeatMode {
}
public LottieDrawable() {
LottieValueAnimator lottieValueAnimator = new LottieValueAnimator();
this.animator = lottieValueAnimator;
this.scale = 1.0f;
this.systemAnimationsEnabled = true;
this.safeMode = false;
this.colorFilterData = new HashSet();
this.lazyCompositionTasks = new ArrayList<>();
ValueAnimator.AnimatorUpdateListener animatorUpdateListener = new ValueAnimator.AnimatorUpdateListener() { // from class: com.airbnb.lottie.LottieDrawable.1
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public void onAnimationUpdate(ValueAnimator animation) {
if (LottieDrawable.this.compositionLayer != null) {
LottieDrawable.this.compositionLayer.setProgress(LottieDrawable.this.animator.getAnimatedValueAbsolute());
}
}
};
this.progressUpdateListener = animatorUpdateListener;
this.alpha = 255;
this.isExtraScaleEnabled = true;
this.isDirty = false;
lottieValueAnimator.addUpdateListener(animatorUpdateListener);
}
public boolean hasMasks() {
CompositionLayer compositionLayer = this.compositionLayer;
return compositionLayer != null && compositionLayer.hasMasks();
}
public boolean hasMatte() {
CompositionLayer compositionLayer = this.compositionLayer;
return compositionLayer != null && compositionLayer.hasMatte();
}
public boolean enableMergePathsForKitKatAndAbove() {
return this.enableMergePaths;
}
public void enableMergePathsForKitKatAndAbove(boolean enable) {
if (this.enableMergePaths == enable) {
return;
}
if (Build.VERSION.SDK_INT < 19) {
Logger.warning("Merge paths are not supported pre-Kit Kat.");
return;
}
this.enableMergePaths = enable;
if (this.composition != null) {
buildCompositionLayer();
}
}
public boolean isMergePathsEnabledForKitKatAndAbove() {
return this.enableMergePaths;
}
public void setImagesAssetsFolder(String imageAssetsFolder) {
this.imageAssetsFolder = imageAssetsFolder;
}
public String getImageAssetsFolder() {
return this.imageAssetsFolder;
}
public boolean setComposition(LottieComposition composition) {
if (this.composition == composition) {
return false;
}
this.isDirty = false;
clearComposition();
this.composition = composition;
buildCompositionLayer();
this.animator.setComposition(composition);
setProgress(this.animator.getAnimatedFraction());
setScale(this.scale);
updateBounds();
Iterator<LazyCompositionTask> it = new ArrayList(this.lazyCompositionTasks).iterator();
while (it.hasNext()) {
LazyCompositionTask t = it.next();
t.run(composition);
it.remove();
}
this.lazyCompositionTasks.clear();
composition.setPerformanceTrackingEnabled(this.performanceTrackingEnabled);
Drawable.Callback callback = getCallback();
if (callback instanceof ImageView) {
((ImageView) callback).setImageDrawable(null);
((ImageView) callback).setImageDrawable(this);
return true;
}
return true;
}
public void setPerformanceTrackingEnabled(boolean enabled) {
this.performanceTrackingEnabled = enabled;
LottieComposition lottieComposition = this.composition;
if (lottieComposition != null) {
lottieComposition.setPerformanceTrackingEnabled(enabled);
}
}
public PerformanceTracker getPerformanceTracker() {
LottieComposition lottieComposition = this.composition;
if (lottieComposition != null) {
return lottieComposition.getPerformanceTracker();
}
return null;
}
public void setApplyingOpacityToLayersEnabled(boolean isApplyingOpacityToLayersEnabled) {
this.isApplyingOpacityToLayersEnabled = isApplyingOpacityToLayersEnabled;
}
public void disableExtraScaleModeInFitXY() {
this.isExtraScaleEnabled = false;
}
public boolean isApplyingOpacityToLayersEnabled() {
return this.isApplyingOpacityToLayersEnabled;
}
private void buildCompositionLayer() {
this.compositionLayer = new CompositionLayer(this, LayerParser.parse(this.composition), this.composition.getLayers(), this.composition);
}
public void clearComposition() {
if (this.animator.isRunning()) {
this.animator.cancel();
}
this.composition = null;
this.compositionLayer = null;
this.imageAssetManager = null;
this.animator.clearComposition();
invalidateSelf();
}
public void setSafeMode(boolean safeMode) {
this.safeMode = safeMode;
}
@Override // android.graphics.drawable.Drawable
public void invalidateSelf() {
if (this.isDirty) {
return;
}
this.isDirty = true;
Drawable.Callback callback = getCallback();
if (callback != null) {
callback.invalidateDrawable(this);
}
}
@Override // android.graphics.drawable.Drawable
public void setAlpha(int alpha) {
this.alpha = alpha;
invalidateSelf();
}
@Override // android.graphics.drawable.Drawable
public int getAlpha() {
return this.alpha;
}
@Override // android.graphics.drawable.Drawable
public void setColorFilter(ColorFilter colorFilter) {
Logger.warning("Use addColorFilter instead.");
}
@Override // android.graphics.drawable.Drawable
public int getOpacity() {
return -3;
}
@Override // android.graphics.drawable.Drawable
public void draw(Canvas canvas) {
this.isDirty = false;
C0633L.beginSection("Drawable#draw");
if (this.safeMode) {
try {
drawInternal(canvas);
} catch (Throwable e) {
Logger.error("Lottie crashed in draw!", e);
}
} else {
drawInternal(canvas);
}
C0633L.endSection("Drawable#draw");
}
private void drawInternal(Canvas canvas) {
if (ImageView.ScaleType.FIT_XY == this.scaleType) {
drawWithNewAspectRatio(canvas);
} else {
drawWithOriginalAspectRatio(canvas);
}
}
@Override // android.graphics.drawable.Animatable
public void start() {
playAnimation();
}
@Override // android.graphics.drawable.Animatable
public void stop() {
endAnimation();
}
@Override // android.graphics.drawable.Animatable
public boolean isRunning() {
return isAnimating();
}
public void playAnimation() {
if (this.compositionLayer == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.2
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.playAnimation();
}
});
return;
}
if (this.systemAnimationsEnabled || getRepeatCount() == 0) {
this.animator.playAnimation();
}
if (!this.systemAnimationsEnabled) {
setFrame((int) (getSpeed() < 0.0f ? getMinFrame() : getMaxFrame()));
this.animator.endAnimation();
}
}
public void endAnimation() {
this.lazyCompositionTasks.clear();
this.animator.endAnimation();
}
public void resumeAnimation() {
if (this.compositionLayer == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.3
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.resumeAnimation();
}
});
return;
}
if (this.systemAnimationsEnabled || getRepeatCount() == 0) {
this.animator.resumeAnimation();
}
if (!this.systemAnimationsEnabled) {
setFrame((int) (getSpeed() < 0.0f ? getMinFrame() : getMaxFrame()));
this.animator.endAnimation();
}
}
public void setMinFrame(final int minFrame) {
if (this.composition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.4
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setMinFrame(minFrame);
}
});
} else {
this.animator.setMinFrame(minFrame);
}
}
public float getMinFrame() {
return this.animator.getMinFrame();
}
public void setMinProgress(final float minProgress) {
LottieComposition lottieComposition = this.composition;
if (lottieComposition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.5
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setMinProgress(minProgress);
}
});
} else {
setMinFrame((int) MiscUtils.lerp(lottieComposition.getStartFrame(), this.composition.getEndFrame(), minProgress));
}
}
public void setMaxFrame(final int maxFrame) {
if (this.composition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.6
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setMaxFrame(maxFrame);
}
});
} else {
this.animator.setMaxFrame(maxFrame + 0.99f);
}
}
public float getMaxFrame() {
return this.animator.getMaxFrame();
}
public void setMaxProgress(final float maxProgress) {
LottieComposition lottieComposition = this.composition;
if (lottieComposition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.7
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setMaxProgress(maxProgress);
}
});
} else {
setMaxFrame((int) MiscUtils.lerp(lottieComposition.getStartFrame(), this.composition.getEndFrame(), maxProgress));
}
}
public void setMinFrame(final String markerName) {
LottieComposition lottieComposition = this.composition;
if (lottieComposition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.8
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setMinFrame(markerName);
}
});
return;
}
Marker marker = lottieComposition.getMarker(markerName);
if (marker == null) {
throw new IllegalArgumentException("Cannot find marker with name " + markerName + ".");
}
setMinFrame((int) marker.startFrame);
}
public void setMaxFrame(final String markerName) {
LottieComposition lottieComposition = this.composition;
if (lottieComposition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.9
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setMaxFrame(markerName);
}
});
return;
}
Marker marker = lottieComposition.getMarker(markerName);
if (marker == null) {
throw new IllegalArgumentException("Cannot find marker with name " + markerName + ".");
}
setMaxFrame((int) (marker.startFrame + marker.durationFrames));
}
public void setMinAndMaxFrame(final String markerName) {
LottieComposition lottieComposition = this.composition;
if (lottieComposition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.10
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setMinAndMaxFrame(markerName);
}
});
return;
}
Marker marker = lottieComposition.getMarker(markerName);
if (marker == null) {
throw new IllegalArgumentException("Cannot find marker with name " + markerName + ".");
}
int startFrame = (int) marker.startFrame;
setMinAndMaxFrame(startFrame, ((int) marker.durationFrames) + startFrame);
}
public void setMinAndMaxFrame(final String startMarkerName, final String endMarkerName, final boolean playEndMarkerStartFrame) {
LottieComposition lottieComposition = this.composition;
if (lottieComposition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.11
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setMinAndMaxFrame(startMarkerName, endMarkerName, playEndMarkerStartFrame);
}
});
return;
}
Marker startMarker = lottieComposition.getMarker(startMarkerName);
if (startMarker == null) {
throw new IllegalArgumentException("Cannot find marker with name " + startMarkerName + ".");
}
int startFrame = (int) startMarker.startFrame;
Marker endMarker = this.composition.getMarker(endMarkerName);
if (endMarkerName == null) {
throw new IllegalArgumentException("Cannot find marker with name " + endMarkerName + ".");
}
int endFrame = (int) (endMarker.startFrame + (playEndMarkerStartFrame ? 1.0f : 0.0f));
setMinAndMaxFrame(startFrame, endFrame);
}
public void setMinAndMaxFrame(final int minFrame, final int maxFrame) {
if (this.composition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.12
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setMinAndMaxFrame(minFrame, maxFrame);
}
});
} else {
this.animator.setMinAndMaxFrames(minFrame, maxFrame + 0.99f);
}
}
public void setMinAndMaxProgress(final float minProgress, final float maxProgress) {
LottieComposition lottieComposition = this.composition;
if (lottieComposition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.13
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setMinAndMaxProgress(minProgress, maxProgress);
}
});
} else {
setMinAndMaxFrame((int) MiscUtils.lerp(lottieComposition.getStartFrame(), this.composition.getEndFrame(), minProgress), (int) MiscUtils.lerp(this.composition.getStartFrame(), this.composition.getEndFrame(), maxProgress));
}
}
public void reverseAnimationSpeed() {
this.animator.reverseAnimationSpeed();
}
public void setSpeed(float speed) {
this.animator.setSpeed(speed);
}
public float getSpeed() {
return this.animator.getSpeed();
}
public void addAnimatorUpdateListener(ValueAnimator.AnimatorUpdateListener updateListener) {
this.animator.addUpdateListener(updateListener);
}
public void removeAnimatorUpdateListener(ValueAnimator.AnimatorUpdateListener updateListener) {
this.animator.removeUpdateListener(updateListener);
}
public void removeAllUpdateListeners() {
this.animator.removeAllUpdateListeners();
this.animator.addUpdateListener(this.progressUpdateListener);
}
public void addAnimatorListener(Animator.AnimatorListener listener) {
this.animator.addListener(listener);
}
public void removeAnimatorListener(Animator.AnimatorListener listener) {
this.animator.removeListener(listener);
}
public void removeAllAnimatorListeners() {
this.animator.removeAllListeners();
}
public void setFrame(final int frame) {
if (this.composition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.14
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setFrame(frame);
}
});
} else {
this.animator.setFrame(frame);
}
}
public int getFrame() {
return (int) this.animator.getFrame();
}
public void setProgress(final float progress) {
if (this.composition == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.15
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.setProgress(progress);
}
});
return;
}
C0633L.beginSection("Drawable#setProgress");
this.animator.setFrame(MiscUtils.lerp(this.composition.getStartFrame(), this.composition.getEndFrame(), progress));
C0633L.endSection("Drawable#setProgress");
}
@Deprecated
public void loop(boolean loop) {
this.animator.setRepeatCount(loop ? -1 : 0);
}
public void setRepeatMode(int mode) {
this.animator.setRepeatMode(mode);
}
public int getRepeatMode() {
return this.animator.getRepeatMode();
}
public void setRepeatCount(int count) {
this.animator.setRepeatCount(count);
}
public int getRepeatCount() {
return this.animator.getRepeatCount();
}
public boolean isLooping() {
return this.animator.getRepeatCount() == -1;
}
public boolean isAnimating() {
LottieValueAnimator lottieValueAnimator = this.animator;
if (lottieValueAnimator == null) {
return false;
}
return lottieValueAnimator.isRunning();
}
void setSystemAnimationsAreEnabled(Boolean areEnabled) {
this.systemAnimationsEnabled = areEnabled.booleanValue();
}
public void setScale(float scale) {
this.scale = scale;
updateBounds();
}
public void setImageAssetDelegate(ImageAssetDelegate assetDelegate) {
this.imageAssetDelegate = assetDelegate;
ImageAssetManager imageAssetManager = this.imageAssetManager;
if (imageAssetManager != null) {
imageAssetManager.setDelegate(assetDelegate);
}
}
public void setFontAssetDelegate(FontAssetDelegate assetDelegate) {
this.fontAssetDelegate = assetDelegate;
FontAssetManager fontAssetManager = this.fontAssetManager;
if (fontAssetManager != null) {
fontAssetManager.setDelegate(assetDelegate);
}
}
public void setTextDelegate(TextDelegate textDelegate) {
this.textDelegate = textDelegate;
}
public TextDelegate getTextDelegate() {
return this.textDelegate;
}
public boolean useTextGlyphs() {
return this.textDelegate == null && this.composition.getCharacters().size() > 0;
}
public float getScale() {
return this.scale;
}
public LottieComposition getComposition() {
return this.composition;
}
private void updateBounds() {
if (this.composition == null) {
return;
}
float scale = getScale();
setBounds(0, 0, (int) (this.composition.getBounds().width() * scale), (int) (this.composition.getBounds().height() * scale));
}
public void cancelAnimation() {
this.lazyCompositionTasks.clear();
this.animator.cancel();
}
public void pauseAnimation() {
this.lazyCompositionTasks.clear();
this.animator.pauseAnimation();
}
public float getProgress() {
return this.animator.getAnimatedValueAbsolute();
}
@Override // android.graphics.drawable.Drawable
public int getIntrinsicWidth() {
if (this.composition == null) {
return -1;
}
return (int) (r0.getBounds().width() * getScale());
}
@Override // android.graphics.drawable.Drawable
public int getIntrinsicHeight() {
if (this.composition == null) {
return -1;
}
return (int) (r0.getBounds().height() * getScale());
}
public List<KeyPath> resolveKeyPath(KeyPath keyPath) {
if (this.compositionLayer == null) {
Logger.warning("Cannot resolve KeyPath. Composition is not set yet.");
return Collections.emptyList();
}
List<KeyPath> keyPaths = new ArrayList<>();
this.compositionLayer.resolveKeyPath(keyPath, 0, keyPaths, new KeyPath(new String[0]));
return keyPaths;
}
public <T> void addValueCallback(final KeyPath keyPath, final T property, final LottieValueCallback<T> callback) {
boolean invalidate;
if (this.compositionLayer == null) {
this.lazyCompositionTasks.add(new LazyCompositionTask() { // from class: com.airbnb.lottie.LottieDrawable.16
@Override // com.airbnb.lottie.LottieDrawable.LazyCompositionTask
public void run(LottieComposition composition) {
LottieDrawable.this.addValueCallback(keyPath, (KeyPath) property, (LottieValueCallback<KeyPath>) callback);
}
});
return;
}
if (keyPath.getResolvedElement() != null) {
keyPath.getResolvedElement().addValueCallback(property, callback);
invalidate = true;
} else {
List<KeyPath> elements = resolveKeyPath(keyPath);
for (int i = 0; i < elements.size(); i++) {
elements.get(i).getResolvedElement().addValueCallback(property, callback);
}
invalidate = !elements.isEmpty();
}
if (invalidate) {
invalidateSelf();
if (property == LottieProperty.TIME_REMAP) {
setProgress(getProgress());
}
}
}
public <T> void addValueCallback(KeyPath keyPath, T property, final SimpleLottieValueCallback<T> callback) {
addValueCallback(keyPath, (KeyPath) property, (LottieValueCallback<KeyPath>) new LottieValueCallback<T>() { // from class: com.airbnb.lottie.LottieDrawable.17
@Override // com.airbnb.lottie.value.LottieValueCallback
public T getValue(LottieFrameInfo<T> lottieFrameInfo) {
return (T) callback.getValue(lottieFrameInfo);
}
});
}
public Bitmap updateBitmap(String id, Bitmap bitmap) {
ImageAssetManager bm = getImageAssetManager();
if (bm == null) {
Logger.warning("Cannot update bitmap. Most likely the drawable is not added to a View which prevents Lottie from getting a Context.");
return null;
}
Bitmap ret = bm.updateBitmap(id, bitmap);
invalidateSelf();
return ret;
}
public Bitmap getImageAsset(String id) {
ImageAssetManager bm = getImageAssetManager();
if (bm != null) {
return bm.bitmapForId(id);
}
return null;
}
private ImageAssetManager getImageAssetManager() {
if (getCallback() == null) {
return null;
}
ImageAssetManager imageAssetManager = this.imageAssetManager;
if (imageAssetManager != null && !imageAssetManager.hasSameContext(getContext())) {
this.imageAssetManager = null;
}
if (this.imageAssetManager == null) {
this.imageAssetManager = new ImageAssetManager(getCallback(), this.imageAssetsFolder, this.imageAssetDelegate, this.composition.getImages());
}
return this.imageAssetManager;
}
public Typeface getTypeface(String fontFamily, String style) {
FontAssetManager assetManager = getFontAssetManager();
if (assetManager != null) {
return assetManager.getTypeface(fontFamily, style);
}
return null;
}
private FontAssetManager getFontAssetManager() {
if (getCallback() == null) {
return null;
}
if (this.fontAssetManager == null) {
this.fontAssetManager = new FontAssetManager(getCallback(), this.fontAssetDelegate);
}
return this.fontAssetManager;
}
private Context getContext() {
Drawable.Callback callback = getCallback();
if (callback == null || !(callback instanceof View)) {
return null;
}
return ((View) callback).getContext();
}
@Override // android.graphics.drawable.Drawable.Callback
public void invalidateDrawable(Drawable who) {
Drawable.Callback callback = getCallback();
if (callback == null) {
return;
}
callback.invalidateDrawable(this);
}
@Override // android.graphics.drawable.Drawable.Callback
public void scheduleDrawable(Drawable who, Runnable what, long when) {
Drawable.Callback callback = getCallback();
if (callback == null) {
return;
}
callback.scheduleDrawable(this, what, when);
}
@Override // android.graphics.drawable.Drawable.Callback
public void unscheduleDrawable(Drawable who, Runnable what) {
Drawable.Callback callback = getCallback();
if (callback == null) {
return;
}
callback.unscheduleDrawable(this, what);
}
void setScaleType(ImageView.ScaleType scaleType) {
this.scaleType = scaleType;
}
private float getMaxScale(Canvas canvas) {
float maxScaleX = canvas.getWidth() / this.composition.getBounds().width();
float maxScaleY = canvas.getHeight() / this.composition.getBounds().height();
return Math.min(maxScaleX, maxScaleY);
}
private void drawWithNewAspectRatio(Canvas canvas) {
if (this.compositionLayer == null) {
return;
}
int saveCount = -1;
Rect bounds = getBounds();
float scaleX = bounds.width() / this.composition.getBounds().width();
float scaleY = bounds.height() / this.composition.getBounds().height();
if (this.isExtraScaleEnabled) {
float maxScale = Math.min(scaleX, scaleY);
float extraScale = 1.0f;
if (maxScale < 1.0f) {
extraScale = 1.0f / maxScale;
scaleX /= extraScale;
scaleY /= extraScale;
}
if (extraScale > 1.0f) {
saveCount = canvas.save();
float halfWidth = bounds.width() / 2.0f;
float halfHeight = bounds.height() / 2.0f;
float scaledHalfWidth = halfWidth * maxScale;
float scaledHalfHeight = halfHeight * maxScale;
canvas.translate(halfWidth - scaledHalfWidth, halfHeight - scaledHalfHeight);
canvas.scale(extraScale, extraScale, scaledHalfWidth, scaledHalfHeight);
}
}
this.matrix.reset();
this.matrix.preScale(scaleX, scaleY);
this.compositionLayer.draw(canvas, this.matrix, this.alpha);
if (saveCount > 0) {
canvas.restoreToCount(saveCount);
}
}
private void drawWithOriginalAspectRatio(Canvas canvas) {
if (this.compositionLayer == null) {
return;
}
float scale = this.scale;
float extraScale = 1.0f;
float maxScale = getMaxScale(canvas);
if (scale > maxScale) {
scale = maxScale;
extraScale = this.scale / scale;
}
int saveCount = -1;
if (extraScale > 1.0f) {
saveCount = canvas.save();
float halfWidth = this.composition.getBounds().width() / 2.0f;
float halfHeight = this.composition.getBounds().height() / 2.0f;
float scaledHalfWidth = halfWidth * scale;
float scaledHalfHeight = halfHeight * scale;
canvas.translate((getScale() * halfWidth) - scaledHalfWidth, (getScale() * halfHeight) - scaledHalfHeight);
canvas.scale(extraScale, extraScale, scaledHalfWidth, scaledHalfHeight);
}
this.matrix.reset();
this.matrix.preScale(scale, scale);
this.compositionLayer.draw(canvas, this.matrix, this.alpha);
if (saveCount > 0) {
canvas.restoreToCount(saveCount);
}
}
private static class ColorFilterData {
final ColorFilter colorFilter;
final String contentName;
final String layerName;
ColorFilterData(String layerName, String contentName, ColorFilter colorFilter) {
this.layerName = layerName;
this.contentName = contentName;
this.colorFilter = colorFilter;
}
public int hashCode() {
int hashCode = 17;
String str = this.layerName;
if (str != null) {
hashCode = 17 * 31 * str.hashCode();
}
String str2 = this.contentName;
if (str2 != null) {
return hashCode * 31 * str2.hashCode();
}
return hashCode;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ColorFilterData)) {
return false;
}
ColorFilterData other = (ColorFilterData) obj;
return hashCode() == other.hashCode() && this.colorFilter == other.colorFilter;
}
}
}
@@ -0,0 +1,51 @@
package com.airbnb.lottie;
import android.graphics.Bitmap;
/* loaded from: classes.dex */
public class LottieImageAsset {
private Bitmap bitmap;
private final String dirName;
private final String fileName;
private final int height;
/* renamed from: id */
private final String f116id;
private final int width;
public LottieImageAsset(int width, int height, String id, String fileName, String dirName) {
this.width = width;
this.height = height;
this.f116id = id;
this.fileName = fileName;
this.dirName = dirName;
}
public int getWidth() {
return this.width;
}
public int getHeight() {
return this.height;
}
public String getId() {
return this.f116id;
}
public String getFileName() {
return this.fileName;
}
public String getDirName() {
return this.dirName;
}
public Bitmap getBitmap() {
return this.bitmap;
}
public void setBitmap(Bitmap bitmap) {
this.bitmap = bitmap;
}
}
@@ -0,0 +1,6 @@
package com.airbnb.lottie;
/* loaded from: classes.dex */
public interface LottieListener<T> {
void onResult(T t);
}
@@ -0,0 +1,14 @@
package com.airbnb.lottie;
/* loaded from: classes.dex */
public interface LottieLogger {
void debug(String str);
void debug(String str, Throwable th);
void error(String str, Throwable th);
void warning(String str);
void warning(String str, Throwable th);
}
@@ -0,0 +1,6 @@
package com.airbnb.lottie;
/* loaded from: classes.dex */
public interface LottieOnCompositionLoadedListener {
void onCompositionLoaded(LottieComposition lottieComposition);
}
@@ -0,0 +1,65 @@
package com.airbnb.lottie;
import android.graphics.ColorFilter;
import android.graphics.PointF;
import com.airbnb.lottie.value.ScaleXY;
/* loaded from: classes.dex */
public interface LottieProperty {
public static final ColorFilter COLOR_FILTER;
public static final Float CORNER_RADIUS;
public static final Integer[] GRADIENT_COLOR;
public static final Float POLYSTAR_INNER_RADIUS;
public static final Float POLYSTAR_INNER_ROUNDEDNESS;
public static final Float POLYSTAR_OUTER_RADIUS;
public static final Float POLYSTAR_OUTER_ROUNDEDNESS;
public static final Float POLYSTAR_POINTS;
public static final Float POLYSTAR_ROTATION;
public static final PointF POSITION;
public static final Float REPEATER_COPIES;
public static final Float REPEATER_OFFSET;
public static final Float STROKE_WIDTH;
public static final Float TEXT_SIZE;
public static final Float TEXT_TRACKING;
public static final Float TIME_REMAP;
public static final Float TRANSFORM_END_OPACITY;
public static final Float TRANSFORM_ROTATION;
public static final ScaleXY TRANSFORM_SCALE;
public static final Float TRANSFORM_SKEW;
public static final Float TRANSFORM_SKEW_ANGLE;
public static final Float TRANSFORM_START_OPACITY;
public static final Integer COLOR = 1;
public static final Integer STROKE_COLOR = 2;
public static final Integer TRANSFORM_OPACITY = 3;
public static final Integer OPACITY = 4;
public static final PointF TRANSFORM_ANCHOR_POINT = new PointF();
public static final PointF TRANSFORM_POSITION = new PointF();
public static final PointF ELLIPSE_SIZE = new PointF();
public static final PointF RECTANGLE_SIZE = new PointF();
static {
Float valueOf = Float.valueOf(0.0f);
CORNER_RADIUS = valueOf;
POSITION = new PointF();
TRANSFORM_SCALE = new ScaleXY();
TRANSFORM_ROTATION = Float.valueOf(1.0f);
TRANSFORM_SKEW = valueOf;
TRANSFORM_SKEW_ANGLE = valueOf;
STROKE_WIDTH = Float.valueOf(2.0f);
TEXT_TRACKING = Float.valueOf(3.0f);
REPEATER_COPIES = Float.valueOf(4.0f);
REPEATER_OFFSET = Float.valueOf(5.0f);
POLYSTAR_POINTS = Float.valueOf(6.0f);
POLYSTAR_ROTATION = Float.valueOf(7.0f);
POLYSTAR_INNER_RADIUS = Float.valueOf(8.0f);
POLYSTAR_OUTER_RADIUS = Float.valueOf(9.0f);
POLYSTAR_INNER_ROUNDEDNESS = Float.valueOf(10.0f);
POLYSTAR_OUTER_ROUNDEDNESS = Float.valueOf(11.0f);
TRANSFORM_START_OPACITY = Float.valueOf(12.0f);
TRANSFORM_END_OPACITY = Float.valueOf(12.1f);
TIME_REMAP = Float.valueOf(13.0f);
TEXT_SIZE = Float.valueOf(14.0f);
COLOR_FILTER = new ColorFilter();
GRADIENT_COLOR = new Integer[0];
}
}
@@ -0,0 +1,48 @@
package com.airbnb.lottie;
import java.util.Arrays;
/* loaded from: classes.dex */
public final class LottieResult<V> {
private final Throwable exception;
private final V value;
public LottieResult(V value) {
this.value = value;
this.exception = null;
}
public LottieResult(Throwable exception) {
this.exception = exception;
this.value = null;
}
public V getValue() {
return this.value;
}
public Throwable getException() {
return this.exception;
}
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof LottieResult)) {
return false;
}
LottieResult<?> that = (LottieResult) o;
if (getValue() != null && getValue().equals(that.getValue())) {
return true;
}
if (getException() == null || that.getException() == null) {
return false;
}
return getException().toString().equals(getException().toString());
}
public int hashCode() {
return Arrays.hashCode(new Object[]{getValue(), getException()});
}
}
@@ -0,0 +1,132 @@
package com.airbnb.lottie;
import android.os.Handler;
import android.os.Looper;
import com.airbnb.lottie.utils.Logger;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
/* loaded from: classes.dex */
public class LottieTask<T> {
public static Executor EXECUTOR = Executors.newCachedThreadPool();
private final Set<LottieListener<Throwable>> failureListeners;
private final Handler handler;
private volatile LottieResult<T> result;
private final Set<LottieListener<T>> successListeners;
public LottieTask(Callable<LottieResult<T>> runnable) {
this(runnable, false);
}
LottieTask(Callable<LottieResult<T>> runnable, boolean runNow) {
this.successListeners = new LinkedHashSet(1);
this.failureListeners = new LinkedHashSet(1);
this.handler = new Handler(Looper.getMainLooper());
this.result = null;
if (runNow) {
try {
setResult(runnable.call());
return;
} catch (Throwable e) {
setResult(new LottieResult<>(e));
return;
}
}
EXECUTOR.execute(new LottieFutureTask(runnable));
}
/* JADX INFO: Access modifiers changed from: private */
public void setResult(LottieResult<T> result) {
if (this.result != null) {
throw new IllegalStateException("A task may only be set once.");
}
this.result = result;
notifyListeners();
}
public synchronized LottieTask<T> addListener(LottieListener<T> listener) {
if (this.result != null && this.result.getValue() != null) {
listener.onResult(this.result.getValue());
}
this.successListeners.add(listener);
return this;
}
public synchronized LottieTask<T> removeListener(LottieListener<T> listener) {
this.successListeners.remove(listener);
return this;
}
public synchronized LottieTask<T> addFailureListener(LottieListener<Throwable> listener) {
if (this.result != null && this.result.getException() != null) {
listener.onResult(this.result.getException());
}
this.failureListeners.add(listener);
return this;
}
public synchronized LottieTask<T> removeFailureListener(LottieListener<Throwable> listener) {
this.failureListeners.remove(listener);
return this;
}
private void notifyListeners() {
this.handler.post(new Runnable() { // from class: com.airbnb.lottie.LottieTask.1
@Override // java.lang.Runnable
public void run() {
if (LottieTask.this.result != null) {
LottieResult<T> result = LottieTask.this.result;
if (result.getValue() != null) {
LottieTask.this.notifySuccessListeners(result.getValue());
} else {
LottieTask.this.notifyFailureListeners(result.getException());
}
}
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized void notifySuccessListeners(T value) {
List<LottieListener<T>> listenersCopy = new ArrayList<>(this.successListeners);
for (LottieListener<T> l : listenersCopy) {
l.onResult(value);
}
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized void notifyFailureListeners(Throwable e) {
List<LottieListener<Throwable>> listenersCopy = new ArrayList<>(this.failureListeners);
if (listenersCopy.isEmpty()) {
Logger.warning("Lottie encountered an error but no failure listener was added:", e);
return;
}
for (LottieListener<Throwable> l : listenersCopy) {
l.onResult(e);
}
}
private class LottieFutureTask extends FutureTask<LottieResult<T>> {
LottieFutureTask(Callable<LottieResult<T>> callable) {
super(callable);
}
@Override // java.util.concurrent.FutureTask
protected void done() {
if (!isCancelled()) {
try {
LottieTask.this.setResult(get());
} catch (InterruptedException | ExecutionException e) {
LottieTask.this.setResult(new LottieResult((Throwable) e));
}
}
}
}
}
@@ -0,0 +1,7 @@
package com.airbnb.lottie;
@Deprecated
/* loaded from: classes.dex */
public interface OnCompositionLoadedListener {
void onCompositionLoaded(LottieComposition lottieComposition);
}
@@ -0,0 +1,95 @@
package com.airbnb.lottie;
import android.util.Log;
import androidx.collection.ArraySet;
import androidx.core.util.Pair;
import com.airbnb.lottie.utils.MeanCalculator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public class PerformanceTracker {
private boolean enabled = false;
private final Set<FrameListener> frameListeners = new ArraySet();
private final Map<String, MeanCalculator> layerRenderTimes = new HashMap();
private final Comparator<Pair<String, Float>> floatComparator = new Comparator<Pair<String, Float>>() { // from class: com.airbnb.lottie.PerformanceTracker.1
@Override // java.util.Comparator
public int compare(Pair<String, Float> o1, Pair<String, Float> o2) {
float r1 = o1.second.floatValue();
float r2 = o2.second.floatValue();
if (r2 > r1) {
return 1;
}
if (r1 > r2) {
return -1;
}
return 0;
}
};
public interface FrameListener {
void onFrameRendered(float f);
}
void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void recordRenderTime(String layerName, float millis) {
if (!this.enabled) {
return;
}
MeanCalculator meanCalculator = this.layerRenderTimes.get(layerName);
if (meanCalculator == null) {
meanCalculator = new MeanCalculator();
this.layerRenderTimes.put(layerName, meanCalculator);
}
meanCalculator.add(millis);
if (layerName.equals("__container")) {
for (FrameListener listener : this.frameListeners) {
listener.onFrameRendered(millis);
}
}
}
public void addFrameListener(FrameListener frameListener) {
this.frameListeners.add(frameListener);
}
public void removeFrameListener(FrameListener frameListener) {
this.frameListeners.remove(frameListener);
}
public void clearRenderTimes() {
this.layerRenderTimes.clear();
}
public void logRenderTimes() {
if (!this.enabled) {
return;
}
List<Pair<String, Float>> sortedRenderTimes = getSortedRenderTimes();
Log.d(C0633L.TAG, "Render times:");
for (int i = 0; i < sortedRenderTimes.size(); i++) {
Pair<String, Float> layer = sortedRenderTimes.get(i);
Log.d(C0633L.TAG, String.format("\t\t%30s:%.2f", layer.first, layer.second));
}
}
public List<Pair<String, Float>> getSortedRenderTimes() {
if (!this.enabled) {
return Collections.emptyList();
}
List<Pair<String, Float>> sortedRenderTimes = new ArrayList<>(this.layerRenderTimes.size());
for (Map.Entry<String, MeanCalculator> e : this.layerRenderTimes.entrySet()) {
sortedRenderTimes.add(new Pair<>(e.getKey(), Float.valueOf(e.getValue().getMean())));
}
Collections.sort(sortedRenderTimes, this.floatComparator);
return sortedRenderTimes;
}
}
@@ -0,0 +1,8 @@
package com.airbnb.lottie;
/* loaded from: classes.dex */
public enum RenderMode {
AUTOMATIC,
HARDWARE,
SOFTWARE
}
@@ -0,0 +1,11 @@
package com.airbnb.lottie;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
/* loaded from: classes.dex */
public class SimpleColorFilter extends PorterDuffColorFilter {
public SimpleColorFilter(int color) {
super(color, PorterDuff.Mode.SRC_ATOP);
}
}
@@ -0,0 +1,78 @@
package com.airbnb.lottie;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public class TextDelegate {
private final LottieAnimationView animationView;
private boolean cacheText;
private final LottieDrawable drawable;
private final Map<String, String> stringMap;
TextDelegate() {
this.stringMap = new HashMap();
this.cacheText = true;
this.animationView = null;
this.drawable = null;
}
public TextDelegate(LottieAnimationView animationView) {
this.stringMap = new HashMap();
this.cacheText = true;
this.animationView = animationView;
this.drawable = null;
}
public TextDelegate(LottieDrawable drawable) {
this.stringMap = new HashMap();
this.cacheText = true;
this.drawable = drawable;
this.animationView = null;
}
private String getText(String input) {
return input;
}
public void setText(String input, String output) {
this.stringMap.put(input, output);
invalidate();
}
public void setCacheText(boolean cacheText) {
this.cacheText = cacheText;
}
public void invalidateText(String input) {
this.stringMap.remove(input);
invalidate();
}
public void invalidateAllText() {
this.stringMap.clear();
invalidate();
}
public final String getTextInternal(String input) {
if (this.cacheText && this.stringMap.containsKey(input)) {
return this.stringMap.get(input);
}
String text = getText(input);
if (this.cacheText) {
this.stringMap.put(input, text);
}
return text;
}
private void invalidate() {
LottieAnimationView lottieAnimationView = this.animationView;
if (lottieAnimationView != null) {
lottieAnimationView.invalidate();
}
LottieDrawable lottieDrawable = this.drawable;
if (lottieDrawable != null) {
lottieDrawable.invalidateSelf();
}
}
}
@@ -0,0 +1,29 @@
package com.airbnb.lottie.animation;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.os.LocaleList;
/* loaded from: classes.dex */
public class LPaint extends Paint {
public LPaint() {
}
public LPaint(int flags) {
super(flags);
}
public LPaint(PorterDuff.Mode porterDuffMode) {
setXfermode(new PorterDuffXfermode(porterDuffMode));
}
public LPaint(int flags, PorterDuff.Mode porterDuffMode) {
super(flags);
setXfermode(new PorterDuffXfermode(porterDuffMode));
}
@Override // android.graphics.Paint
public void setTextLocales(LocaleList locales) {
}
}
@@ -0,0 +1,315 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.DashPathEffect;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.RectF;
import com.airbnb.lottie.C0633L;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.animation.LPaint;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.FloatKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.IntegerKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.ValueCallbackKeyframeAnimation;
import com.airbnb.lottie.model.KeyPath;
import com.airbnb.lottie.model.animatable.AnimatableFloatValue;
import com.airbnb.lottie.model.animatable.AnimatableIntegerValue;
import com.airbnb.lottie.model.content.ShapeTrimPath;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.utils.Utils;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public abstract class BaseStrokeContent implements BaseKeyframeAnimation.AnimationListener, KeyPathElementContent, DrawingContent {
private BaseKeyframeAnimation<ColorFilter, ColorFilter> colorFilterAnimation;
private final List<BaseKeyframeAnimation<?, Float>> dashPatternAnimations;
private final BaseKeyframeAnimation<?, Float> dashPatternOffsetAnimation;
private final float[] dashPatternValues;
protected final BaseLayer layer;
private final LottieDrawable lottieDrawable;
private final BaseKeyframeAnimation<?, Integer> opacityAnimation;
final Paint paint;
private final BaseKeyframeAnimation<?, Float> widthAnimation;
/* renamed from: pm */
private final PathMeasure f118pm = new PathMeasure();
private final Path path = new Path();
private final Path trimPathPath = new Path();
private final RectF rect = new RectF();
private final List<PathGroup> pathGroups = new ArrayList();
BaseStrokeContent(LottieDrawable lottieDrawable, BaseLayer layer, Paint.Cap cap, Paint.Join join, float miterLimit, AnimatableIntegerValue opacity, AnimatableFloatValue width, List<AnimatableFloatValue> dashPattern, AnimatableFloatValue offset) {
LPaint lPaint = new LPaint(1);
this.paint = lPaint;
this.lottieDrawable = lottieDrawable;
this.layer = layer;
lPaint.setStyle(Paint.Style.STROKE);
lPaint.setStrokeCap(cap);
lPaint.setStrokeJoin(join);
lPaint.setStrokeMiter(miterLimit);
this.opacityAnimation = opacity.createAnimation();
this.widthAnimation = width.createAnimation();
if (offset == null) {
this.dashPatternOffsetAnimation = null;
} else {
this.dashPatternOffsetAnimation = offset.createAnimation();
}
this.dashPatternAnimations = new ArrayList(dashPattern.size());
this.dashPatternValues = new float[dashPattern.size()];
for (int i = 0; i < dashPattern.size(); i++) {
this.dashPatternAnimations.add(dashPattern.get(i).createAnimation());
}
layer.addAnimation(this.opacityAnimation);
layer.addAnimation(this.widthAnimation);
for (int i2 = 0; i2 < this.dashPatternAnimations.size(); i2++) {
layer.addAnimation(this.dashPatternAnimations.get(i2));
}
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation = this.dashPatternOffsetAnimation;
if (baseKeyframeAnimation != null) {
layer.addAnimation(baseKeyframeAnimation);
}
this.opacityAnimation.addUpdateListener(this);
this.widthAnimation.addUpdateListener(this);
for (int i3 = 0; i3 < dashPattern.size(); i3++) {
this.dashPatternAnimations.get(i3).addUpdateListener(this);
}
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation2 = this.dashPatternOffsetAnimation;
if (baseKeyframeAnimation2 != null) {
baseKeyframeAnimation2.addUpdateListener(this);
}
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener
public void onValueChanged() {
this.lottieDrawable.invalidateSelf();
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
TrimPathContent trimPathContentBefore = null;
for (int i = contentsBefore.size() - 1; i >= 0; i--) {
Content content = contentsBefore.get(i);
if ((content instanceof TrimPathContent) && ((TrimPathContent) content).getType() == ShapeTrimPath.Type.INDIVIDUALLY) {
trimPathContentBefore = (TrimPathContent) content;
}
}
if (trimPathContentBefore != null) {
trimPathContentBefore.addListener(this);
}
PathGroup currentPathGroup = null;
for (int i2 = contentsAfter.size() - 1; i2 >= 0; i2--) {
Content content2 = contentsAfter.get(i2);
if ((content2 instanceof TrimPathContent) && ((TrimPathContent) content2).getType() == ShapeTrimPath.Type.INDIVIDUALLY) {
if (currentPathGroup != null) {
this.pathGroups.add(currentPathGroup);
}
currentPathGroup = new PathGroup((TrimPathContent) content2);
((TrimPathContent) content2).addListener(this);
} else if (content2 instanceof PathContent) {
if (currentPathGroup == null) {
currentPathGroup = new PathGroup(trimPathContentBefore);
}
currentPathGroup.paths.add((PathContent) content2);
}
}
if (currentPathGroup != null) {
this.pathGroups.add(currentPathGroup);
}
}
@Override // com.airbnb.lottie.animation.content.DrawingContent
public void draw(Canvas canvas, Matrix parentMatrix, int parentAlpha) {
C0633L.beginSection("StrokeContent#draw");
if (Utils.hasZeroScaleAxis(parentMatrix)) {
C0633L.endSection("StrokeContent#draw");
return;
}
int alpha = (int) ((((parentAlpha / 255.0f) * ((IntegerKeyframeAnimation) this.opacityAnimation).getIntValue()) / 100.0f) * 255.0f);
this.paint.setAlpha(MiscUtils.clamp(alpha, 0, 255));
this.paint.setStrokeWidth(((FloatKeyframeAnimation) this.widthAnimation).getFloatValue() * Utils.getScale(parentMatrix));
if (this.paint.getStrokeWidth() <= 0.0f) {
C0633L.endSection("StrokeContent#draw");
return;
}
applyDashPatternIfNeeded(parentMatrix);
BaseKeyframeAnimation<ColorFilter, ColorFilter> baseKeyframeAnimation = this.colorFilterAnimation;
if (baseKeyframeAnimation != null) {
this.paint.setColorFilter(baseKeyframeAnimation.getValue());
}
for (int i = 0; i < this.pathGroups.size(); i++) {
PathGroup pathGroup = this.pathGroups.get(i);
if (pathGroup.trimPath != null) {
applyTrimPath(canvas, pathGroup, parentMatrix);
} else {
C0633L.beginSection("StrokeContent#buildPath");
this.path.reset();
for (int j = pathGroup.paths.size() - 1; j >= 0; j--) {
this.path.addPath(((PathContent) pathGroup.paths.get(j)).getPath(), parentMatrix);
}
C0633L.endSection("StrokeContent#buildPath");
C0633L.beginSection("StrokeContent#drawPath");
canvas.drawPath(this.path, this.paint);
C0633L.endSection("StrokeContent#drawPath");
}
}
C0633L.endSection("StrokeContent#draw");
}
private void applyTrimPath(Canvas canvas, PathGroup pathGroup, Matrix parentMatrix) {
float startValue;
float endValue;
float startValue2;
C0633L.beginSection("StrokeContent#applyTrimPath");
if (pathGroup.trimPath == null) {
C0633L.endSection("StrokeContent#applyTrimPath");
return;
}
this.path.reset();
for (int j = pathGroup.paths.size() - 1; j >= 0; j--) {
this.path.addPath(((PathContent) pathGroup.paths.get(j)).getPath(), parentMatrix);
}
this.f118pm.setPath(this.path, false);
float totalLength = this.f118pm.getLength();
while (this.f118pm.nextContour()) {
totalLength += this.f118pm.getLength();
}
float offsetLength = (pathGroup.trimPath.getOffset().getValue().floatValue() * totalLength) / 360.0f;
float startLength = ((pathGroup.trimPath.getStart().getValue().floatValue() * totalLength) / 100.0f) + offsetLength;
float endLength = ((pathGroup.trimPath.getEnd().getValue().floatValue() * totalLength) / 100.0f) + offsetLength;
float currentLength = 0.0f;
for (int j2 = pathGroup.paths.size() - 1; j2 >= 0; j2--) {
this.trimPathPath.set(((PathContent) pathGroup.paths.get(j2)).getPath());
this.trimPathPath.transform(parentMatrix);
this.f118pm.setPath(this.trimPathPath, false);
float length = this.f118pm.getLength();
if (endLength > totalLength && endLength - totalLength < currentLength + length && currentLength < endLength - totalLength) {
if (startLength > totalLength) {
startValue2 = (startLength - totalLength) / length;
} else {
startValue2 = 0.0f;
}
float endValue2 = Math.min((endLength - totalLength) / length, 1.0f);
Utils.applyTrimPathIfNeeded(this.trimPathPath, startValue2, endValue2, 0.0f);
canvas.drawPath(this.trimPathPath, this.paint);
} else if (currentLength + length >= startLength && currentLength <= endLength) {
if (currentLength + length <= endLength && startLength < currentLength) {
canvas.drawPath(this.trimPathPath, this.paint);
} else {
if (startLength < currentLength) {
startValue = 0.0f;
} else {
float startValue3 = startLength - currentLength;
startValue = startValue3 / length;
}
if (endLength > currentLength + length) {
endValue = 1.0f;
} else {
float endValue3 = endLength - currentLength;
endValue = endValue3 / length;
}
Utils.applyTrimPathIfNeeded(this.trimPathPath, startValue, endValue, 0.0f);
canvas.drawPath(this.trimPathPath, this.paint);
}
}
currentLength += length;
}
C0633L.endSection("StrokeContent#applyTrimPath");
}
@Override // com.airbnb.lottie.animation.content.DrawingContent
public void getBounds(RectF outBounds, Matrix parentMatrix, boolean applyParents) {
C0633L.beginSection("StrokeContent#getBounds");
this.path.reset();
for (int i = 0; i < this.pathGroups.size(); i++) {
PathGroup pathGroup = this.pathGroups.get(i);
for (int j = 0; j < pathGroup.paths.size(); j++) {
this.path.addPath(((PathContent) pathGroup.paths.get(j)).getPath(), parentMatrix);
}
}
this.path.computeBounds(this.rect, false);
float width = ((FloatKeyframeAnimation) this.widthAnimation).getFloatValue();
RectF rectF = this.rect;
rectF.set(rectF.left - (width / 2.0f), this.rect.top - (width / 2.0f), this.rect.right + (width / 2.0f), this.rect.bottom + (width / 2.0f));
outBounds.set(this.rect);
outBounds.set(outBounds.left - 1.0f, outBounds.top - 1.0f, outBounds.right + 1.0f, outBounds.bottom + 1.0f);
C0633L.endSection("StrokeContent#getBounds");
}
private void applyDashPatternIfNeeded(Matrix parentMatrix) {
C0633L.beginSection("StrokeContent#applyDashPattern");
if (this.dashPatternAnimations.isEmpty()) {
C0633L.endSection("StrokeContent#applyDashPattern");
return;
}
float scale = Utils.getScale(parentMatrix);
for (int i = 0; i < this.dashPatternAnimations.size(); i++) {
this.dashPatternValues[i] = this.dashPatternAnimations.get(i).getValue().floatValue();
if (i % 2 == 0) {
float[] fArr = this.dashPatternValues;
if (fArr[i] < 1.0f) {
fArr[i] = 1.0f;
}
} else {
float[] fArr2 = this.dashPatternValues;
if (fArr2[i] < 0.1f) {
fArr2[i] = 0.1f;
}
}
float[] fArr3 = this.dashPatternValues;
fArr3[i] = fArr3[i] * scale;
}
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation = this.dashPatternOffsetAnimation;
float offset = baseKeyframeAnimation == null ? 0.0f : baseKeyframeAnimation.getValue().floatValue() * scale;
this.paint.setPathEffect(new DashPathEffect(this.dashPatternValues, offset));
C0633L.endSection("StrokeContent#applyDashPattern");
}
@Override // com.airbnb.lottie.model.KeyPathElement
public void resolveKeyPath(KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath) {
MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this);
}
@Override // com.airbnb.lottie.model.KeyPathElement
public <T> void addValueCallback(T property, LottieValueCallback<T> callback) {
if (property == LottieProperty.OPACITY) {
this.opacityAnimation.setValueCallback(callback);
return;
}
if (property == LottieProperty.STROKE_WIDTH) {
this.widthAnimation.setValueCallback(callback);
return;
}
if (property == LottieProperty.COLOR_FILTER) {
BaseKeyframeAnimation<ColorFilter, ColorFilter> baseKeyframeAnimation = this.colorFilterAnimation;
if (baseKeyframeAnimation != null) {
this.layer.removeAnimation(baseKeyframeAnimation);
}
if (callback == null) {
this.colorFilterAnimation = null;
return;
}
ValueCallbackKeyframeAnimation valueCallbackKeyframeAnimation = new ValueCallbackKeyframeAnimation(callback);
this.colorFilterAnimation = valueCallbackKeyframeAnimation;
valueCallbackKeyframeAnimation.addUpdateListener(this);
this.layer.addAnimation(this.colorFilterAnimation);
}
}
private static final class PathGroup {
private final List<PathContent> paths;
private final TrimPathContent trimPath;
private PathGroup(TrimPathContent trimPath) {
this.paths = new ArrayList();
this.trimPath = trimPath;
}
}
}
@@ -0,0 +1,21 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Path;
import com.airbnb.lottie.utils.Utils;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class CompoundTrimPathContent {
private List<TrimPathContent> contents = new ArrayList();
void addTrimPath(TrimPathContent trimPath) {
this.contents.add(trimPath);
}
public void apply(Path path) {
for (int i = this.contents.size() - 1; i >= 0; i--) {
Utils.applyTrimPathIfNeeded(path, this.contents.get(i));
}
}
}
@@ -0,0 +1,10 @@
package com.airbnb.lottie.animation.content;
import java.util.List;
/* loaded from: classes.dex */
public interface Content {
String getName();
void setContents(List<Content> list, List<Content> list2);
}
@@ -0,0 +1,245 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.LPaint;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.TransformKeyframeAnimation;
import com.airbnb.lottie.model.KeyPath;
import com.airbnb.lottie.model.KeyPathElement;
import com.airbnb.lottie.model.animatable.AnimatableTransform;
import com.airbnb.lottie.model.content.ContentModel;
import com.airbnb.lottie.model.content.ShapeGroup;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.utils.Utils;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class ContentGroup implements DrawingContent, PathContent, BaseKeyframeAnimation.AnimationListener, KeyPathElement {
private final List<Content> contents;
private final boolean hidden;
private final LottieDrawable lottieDrawable;
private final Matrix matrix;
private final String name;
private Paint offScreenPaint;
private RectF offScreenRectF;
private final Path path;
private List<PathContent> pathContents;
private final RectF rect;
private TransformKeyframeAnimation transformAnimation;
private static List<Content> contentsFromModels(LottieDrawable drawable, BaseLayer layer, List<ContentModel> contentModels) {
List<Content> contents = new ArrayList<>(contentModels.size());
for (int i = 0; i < contentModels.size(); i++) {
Content content = contentModels.get(i).toContent(drawable, layer);
if (content != null) {
contents.add(content);
}
}
return contents;
}
static AnimatableTransform findTransform(List<ContentModel> contentModels) {
for (int i = 0; i < contentModels.size(); i++) {
ContentModel contentModel = contentModels.get(i);
if (contentModel instanceof AnimatableTransform) {
return (AnimatableTransform) contentModel;
}
}
return null;
}
public ContentGroup(LottieDrawable lottieDrawable, BaseLayer layer, ShapeGroup shapeGroup) {
this(lottieDrawable, layer, shapeGroup.getName(), shapeGroup.isHidden(), contentsFromModels(lottieDrawable, layer, shapeGroup.getItems()), findTransform(shapeGroup.getItems()));
}
ContentGroup(LottieDrawable lottieDrawable, BaseLayer layer, String name, boolean hidden, List<Content> contents, AnimatableTransform transform) {
this.offScreenPaint = new LPaint();
this.offScreenRectF = new RectF();
this.matrix = new Matrix();
this.path = new Path();
this.rect = new RectF();
this.name = name;
this.lottieDrawable = lottieDrawable;
this.hidden = hidden;
this.contents = contents;
if (transform != null) {
TransformKeyframeAnimation createAnimation = transform.createAnimation();
this.transformAnimation = createAnimation;
createAnimation.addAnimationsToLayer(layer);
this.transformAnimation.addListener(this);
}
List<GreedyContent> greedyContents = new ArrayList<>();
for (int i = contents.size() - 1; i >= 0; i--) {
Content content = contents.get(i);
if (content instanceof GreedyContent) {
greedyContents.add((GreedyContent) content);
}
}
int i2 = greedyContents.size();
for (int i3 = i2 - 1; i3 >= 0; i3--) {
greedyContents.get(i3).absorbContent(contents.listIterator(contents.size()));
}
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener
public void onValueChanged() {
this.lottieDrawable.invalidateSelf();
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
List<Content> myContentsBefore = new ArrayList<>(contentsBefore.size() + this.contents.size());
myContentsBefore.addAll(contentsBefore);
for (int i = this.contents.size() - 1; i >= 0; i--) {
Content content = this.contents.get(i);
content.setContents(myContentsBefore, this.contents.subList(0, i));
myContentsBefore.add(content);
}
}
List<PathContent> getPathList() {
if (this.pathContents == null) {
this.pathContents = new ArrayList();
for (int i = 0; i < this.contents.size(); i++) {
Content content = this.contents.get(i);
if (content instanceof PathContent) {
this.pathContents.add((PathContent) content);
}
}
}
return this.pathContents;
}
Matrix getTransformationMatrix() {
TransformKeyframeAnimation transformKeyframeAnimation = this.transformAnimation;
if (transformKeyframeAnimation != null) {
return transformKeyframeAnimation.getMatrix();
}
this.matrix.reset();
return this.matrix;
}
@Override // com.airbnb.lottie.animation.content.PathContent
public Path getPath() {
this.matrix.reset();
TransformKeyframeAnimation transformKeyframeAnimation = this.transformAnimation;
if (transformKeyframeAnimation != null) {
this.matrix.set(transformKeyframeAnimation.getMatrix());
}
this.path.reset();
if (this.hidden) {
return this.path;
}
for (int i = this.contents.size() - 1; i >= 0; i--) {
Content content = this.contents.get(i);
if (content instanceof PathContent) {
this.path.addPath(((PathContent) content).getPath(), this.matrix);
}
}
return this.path;
}
@Override // com.airbnb.lottie.animation.content.DrawingContent
public void draw(Canvas canvas, Matrix parentMatrix, int parentAlpha) {
int opacity;
if (this.hidden) {
return;
}
this.matrix.set(parentMatrix);
TransformKeyframeAnimation transformKeyframeAnimation = this.transformAnimation;
if (transformKeyframeAnimation != null) {
this.matrix.preConcat(transformKeyframeAnimation.getMatrix());
int opacity2 = this.transformAnimation.getOpacity() == null ? 100 : this.transformAnimation.getOpacity().getValue().intValue();
opacity = (int) ((((opacity2 / 100.0f) * parentAlpha) / 255.0f) * 255.0f);
} else {
opacity = parentAlpha;
}
boolean isRenderingWithOffScreen = this.lottieDrawable.isApplyingOpacityToLayersEnabled() && hasTwoOrMoreDrawableContent() && opacity != 255;
if (isRenderingWithOffScreen) {
this.offScreenRectF.set(0.0f, 0.0f, 0.0f, 0.0f);
getBounds(this.offScreenRectF, this.matrix, true);
this.offScreenPaint.setAlpha(opacity);
Utils.saveLayerCompat(canvas, this.offScreenRectF, this.offScreenPaint);
}
int childAlpha = isRenderingWithOffScreen ? 255 : opacity;
for (int i = this.contents.size() - 1; i >= 0; i--) {
Object content = this.contents.get(i);
if (content instanceof DrawingContent) {
((DrawingContent) content).draw(canvas, this.matrix, childAlpha);
}
}
if (isRenderingWithOffScreen) {
canvas.restore();
}
}
private boolean hasTwoOrMoreDrawableContent() {
int drawableContentCount = 0;
for (int i = 0; i < this.contents.size(); i++) {
if ((this.contents.get(i) instanceof DrawingContent) && (drawableContentCount = drawableContentCount + 1) >= 2) {
return true;
}
}
return false;
}
@Override // com.airbnb.lottie.animation.content.DrawingContent
public void getBounds(RectF outBounds, Matrix parentMatrix, boolean applyParents) {
this.matrix.set(parentMatrix);
TransformKeyframeAnimation transformKeyframeAnimation = this.transformAnimation;
if (transformKeyframeAnimation != null) {
this.matrix.preConcat(transformKeyframeAnimation.getMatrix());
}
this.rect.set(0.0f, 0.0f, 0.0f, 0.0f);
for (int i = this.contents.size() - 1; i >= 0; i--) {
Content content = this.contents.get(i);
if (content instanceof DrawingContent) {
((DrawingContent) content).getBounds(this.rect, this.matrix, applyParents);
outBounds.union(this.rect);
}
}
}
@Override // com.airbnb.lottie.model.KeyPathElement
public void resolveKeyPath(KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath) {
if (!keyPath.matches(getName(), depth)) {
return;
}
if (!"__container".equals(getName())) {
currentPartialKeyPath = currentPartialKeyPath.addKey(getName());
if (keyPath.fullyResolvesTo(getName(), depth)) {
accumulator.add(currentPartialKeyPath.resolve(this));
}
}
if (keyPath.propagateToChildren(getName(), depth)) {
int newDepth = keyPath.incrementDepthBy(getName(), depth) + depth;
for (int i = 0; i < this.contents.size(); i++) {
Content content = this.contents.get(i);
if (content instanceof KeyPathElement) {
KeyPathElement element = (KeyPathElement) content;
element.resolveKeyPath(keyPath, newDepth, accumulator, currentPartialKeyPath);
}
}
}
}
@Override // com.airbnb.lottie.model.KeyPathElement
public <T> void addValueCallback(T property, LottieValueCallback<T> callback) {
TransformKeyframeAnimation transformKeyframeAnimation = this.transformAnimation;
if (transformKeyframeAnimation != null) {
transformKeyframeAnimation.applyValueCallback(property, callback);
}
}
}
@@ -0,0 +1,12 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.RectF;
/* loaded from: classes.dex */
public interface DrawingContent extends Content {
void draw(Canvas canvas, Matrix matrix, int i);
void getBounds(RectF rectF, Matrix matrix, boolean z);
}
@@ -0,0 +1,119 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Path;
import android.graphics.PointF;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.model.KeyPath;
import com.airbnb.lottie.model.content.CircleShape;
import com.airbnb.lottie.model.content.ShapeTrimPath;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.List;
/* loaded from: classes.dex */
public class EllipseContent implements PathContent, BaseKeyframeAnimation.AnimationListener, KeyPathElementContent {
private static final float ELLIPSE_CONTROL_POINT_PERCENTAGE = 0.55228f;
private final CircleShape circleShape;
private boolean isPathValid;
private final LottieDrawable lottieDrawable;
private final String name;
private final BaseKeyframeAnimation<?, PointF> positionAnimation;
private final BaseKeyframeAnimation<?, PointF> sizeAnimation;
private final Path path = new Path();
private CompoundTrimPathContent trimPaths = new CompoundTrimPathContent();
public EllipseContent(LottieDrawable lottieDrawable, BaseLayer layer, CircleShape circleShape) {
this.name = circleShape.getName();
this.lottieDrawable = lottieDrawable;
BaseKeyframeAnimation<PointF, PointF> createAnimation = circleShape.getSize().createAnimation();
this.sizeAnimation = createAnimation;
BaseKeyframeAnimation<PointF, PointF> createAnimation2 = circleShape.getPosition().createAnimation();
this.positionAnimation = createAnimation2;
this.circleShape = circleShape;
layer.addAnimation(createAnimation);
layer.addAnimation(createAnimation2);
createAnimation.addUpdateListener(this);
createAnimation2.addUpdateListener(this);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener
public void onValueChanged() {
invalidate();
}
private void invalidate() {
this.isPathValid = false;
this.lottieDrawable.invalidateSelf();
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
for (int i = 0; i < contentsBefore.size(); i++) {
Content content = contentsBefore.get(i);
if ((content instanceof TrimPathContent) && ((TrimPathContent) content).getType() == ShapeTrimPath.Type.SIMULTANEOUSLY) {
TrimPathContent trimPath = (TrimPathContent) content;
this.trimPaths.addTrimPath(trimPath);
trimPath.addListener(this);
}
}
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
@Override // com.airbnb.lottie.animation.content.PathContent
public Path getPath() {
if (this.isPathValid) {
return this.path;
}
this.path.reset();
if (this.circleShape.isHidden()) {
this.isPathValid = true;
return this.path;
}
PointF size = this.sizeAnimation.getValue();
float halfWidth = size.x / 2.0f;
float halfHeight = size.y / 2.0f;
float cpW = halfWidth * ELLIPSE_CONTROL_POINT_PERCENTAGE;
float cpH = halfHeight * ELLIPSE_CONTROL_POINT_PERCENTAGE;
this.path.reset();
if (this.circleShape.isReversed()) {
this.path.moveTo(0.0f, -halfHeight);
this.path.cubicTo(0.0f - cpW, -halfHeight, -halfWidth, 0.0f - cpH, -halfWidth, 0.0f);
this.path.cubicTo(-halfWidth, cpH + 0.0f, 0.0f - cpW, halfHeight, 0.0f, halfHeight);
this.path.cubicTo(cpW + 0.0f, halfHeight, halfWidth, cpH + 0.0f, halfWidth, 0.0f);
this.path.cubicTo(halfWidth, 0.0f - cpH, cpW + 0.0f, -halfHeight, 0.0f, -halfHeight);
} else {
this.path.moveTo(0.0f, -halfHeight);
this.path.cubicTo(cpW + 0.0f, -halfHeight, halfWidth, 0.0f - cpH, halfWidth, 0.0f);
this.path.cubicTo(halfWidth, cpH + 0.0f, cpW + 0.0f, halfHeight, 0.0f, halfHeight);
this.path.cubicTo(0.0f - cpW, halfHeight, -halfWidth, cpH + 0.0f, -halfWidth, 0.0f);
this.path.cubicTo(-halfWidth, 0.0f - cpH, 0.0f - cpW, -halfHeight, 0.0f, -halfHeight);
}
PointF position = this.positionAnimation.getValue();
this.path.offset(position.x, position.y);
this.path.close();
this.trimPaths.apply(this.path);
this.isPathValid = true;
return this.path;
}
@Override // com.airbnb.lottie.model.KeyPathElement
public void resolveKeyPath(KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath) {
MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this);
}
@Override // com.airbnb.lottie.model.KeyPathElement
public <T> void addValueCallback(T property, LottieValueCallback<T> callback) {
if (property == LottieProperty.ELLIPSE_SIZE) {
this.sizeAnimation.setValueCallback(callback);
} else if (property == LottieProperty.POSITION) {
this.positionAnimation.setValueCallback(callback);
}
}
}
@@ -0,0 +1,143 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import com.airbnb.lottie.C0633L;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.animation.LPaint;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.ColorKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.ValueCallbackKeyframeAnimation;
import com.airbnb.lottie.model.KeyPath;
import com.airbnb.lottie.model.content.ShapeFill;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class FillContent implements DrawingContent, BaseKeyframeAnimation.AnimationListener, KeyPathElementContent {
private final BaseKeyframeAnimation<Integer, Integer> colorAnimation;
private BaseKeyframeAnimation<ColorFilter, ColorFilter> colorFilterAnimation;
private final boolean hidden;
private final BaseLayer layer;
private final LottieDrawable lottieDrawable;
private final String name;
private final BaseKeyframeAnimation<Integer, Integer> opacityAnimation;
private final Paint paint;
private final Path path;
private final List<PathContent> paths;
public FillContent(LottieDrawable lottieDrawable, BaseLayer layer, ShapeFill fill) {
Path path = new Path();
this.path = path;
this.paint = new LPaint(1);
this.paths = new ArrayList();
this.layer = layer;
this.name = fill.getName();
this.hidden = fill.isHidden();
this.lottieDrawable = lottieDrawable;
if (fill.getColor() == null || fill.getOpacity() == null) {
this.colorAnimation = null;
this.opacityAnimation = null;
return;
}
path.setFillType(fill.getFillType());
BaseKeyframeAnimation<Integer, Integer> createAnimation = fill.getColor().createAnimation();
this.colorAnimation = createAnimation;
createAnimation.addUpdateListener(this);
layer.addAnimation(createAnimation);
BaseKeyframeAnimation<Integer, Integer> createAnimation2 = fill.getOpacity().createAnimation();
this.opacityAnimation = createAnimation2;
createAnimation2.addUpdateListener(this);
layer.addAnimation(createAnimation2);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener
public void onValueChanged() {
this.lottieDrawable.invalidateSelf();
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
for (int i = 0; i < contentsAfter.size(); i++) {
Content content = contentsAfter.get(i);
if (content instanceof PathContent) {
this.paths.add((PathContent) content);
}
}
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
@Override // com.airbnb.lottie.animation.content.DrawingContent
public void draw(Canvas canvas, Matrix parentMatrix, int parentAlpha) {
if (this.hidden) {
return;
}
C0633L.beginSection("FillContent#draw");
this.paint.setColor(((ColorKeyframeAnimation) this.colorAnimation).getIntValue());
int alpha = (int) ((((parentAlpha / 255.0f) * this.opacityAnimation.getValue().intValue()) / 100.0f) * 255.0f);
this.paint.setAlpha(MiscUtils.clamp(alpha, 0, 255));
BaseKeyframeAnimation<ColorFilter, ColorFilter> baseKeyframeAnimation = this.colorFilterAnimation;
if (baseKeyframeAnimation != null) {
this.paint.setColorFilter(baseKeyframeAnimation.getValue());
}
this.path.reset();
for (int i = 0; i < this.paths.size(); i++) {
this.path.addPath(this.paths.get(i).getPath(), parentMatrix);
}
canvas.drawPath(this.path, this.paint);
C0633L.endSection("FillContent#draw");
}
@Override // com.airbnb.lottie.animation.content.DrawingContent
public void getBounds(RectF outBounds, Matrix parentMatrix, boolean applyParents) {
this.path.reset();
for (int i = 0; i < this.paths.size(); i++) {
this.path.addPath(this.paths.get(i).getPath(), parentMatrix);
}
this.path.computeBounds(outBounds, false);
outBounds.set(outBounds.left - 1.0f, outBounds.top - 1.0f, outBounds.right + 1.0f, outBounds.bottom + 1.0f);
}
@Override // com.airbnb.lottie.model.KeyPathElement
public void resolveKeyPath(KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath) {
MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this);
}
@Override // com.airbnb.lottie.model.KeyPathElement
public <T> void addValueCallback(T property, LottieValueCallback<T> callback) {
if (property == LottieProperty.COLOR) {
this.colorAnimation.setValueCallback(callback);
return;
}
if (property == LottieProperty.OPACITY) {
this.opacityAnimation.setValueCallback(callback);
return;
}
if (property == LottieProperty.COLOR_FILTER) {
BaseKeyframeAnimation<ColorFilter, ColorFilter> baseKeyframeAnimation = this.colorFilterAnimation;
if (baseKeyframeAnimation != null) {
this.layer.removeAnimation(baseKeyframeAnimation);
}
if (callback == null) {
this.colorFilterAnimation = null;
return;
}
ValueCallbackKeyframeAnimation valueCallbackKeyframeAnimation = new ValueCallbackKeyframeAnimation(callback);
this.colorFilterAnimation = valueCallbackKeyframeAnimation;
valueCallbackKeyframeAnimation.addUpdateListener(this);
this.layer.addAnimation(this.colorFilterAnimation);
}
}
}
@@ -0,0 +1,262 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.RadialGradient;
import android.graphics.RectF;
import android.graphics.Shader;
import androidx.collection.LongSparseArray;
import com.airbnb.lottie.C0633L;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.animation.LPaint;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.ValueCallbackKeyframeAnimation;
import com.airbnb.lottie.model.KeyPath;
import com.airbnb.lottie.model.content.GradientColor;
import com.airbnb.lottie.model.content.GradientFill;
import com.airbnb.lottie.model.content.GradientType;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class GradientFillContent implements DrawingContent, BaseKeyframeAnimation.AnimationListener, KeyPathElementContent {
private static final int CACHE_STEPS_MS = 32;
private final RectF boundsRect;
private final int cacheSteps;
private final BaseKeyframeAnimation<GradientColor, GradientColor> colorAnimation;
private ValueCallbackKeyframeAnimation colorCallbackAnimation;
private BaseKeyframeAnimation<ColorFilter, ColorFilter> colorFilterAnimation;
private final BaseKeyframeAnimation<PointF, PointF> endPointAnimation;
private final boolean hidden;
private final BaseLayer layer;
private final LottieDrawable lottieDrawable;
private final String name;
private final BaseKeyframeAnimation<Integer, Integer> opacityAnimation;
private final Paint paint;
private final Path path;
private final List<PathContent> paths;
private final BaseKeyframeAnimation<PointF, PointF> startPointAnimation;
private final GradientType type;
private final LongSparseArray<LinearGradient> linearGradientCache = new LongSparseArray<>();
private final LongSparseArray<RadialGradient> radialGradientCache = new LongSparseArray<>();
public GradientFillContent(LottieDrawable lottieDrawable, BaseLayer layer, GradientFill fill) {
Path path = new Path();
this.path = path;
this.paint = new LPaint(1);
this.boundsRect = new RectF();
this.paths = new ArrayList();
this.layer = layer;
this.name = fill.getName();
this.hidden = fill.isHidden();
this.lottieDrawable = lottieDrawable;
this.type = fill.getGradientType();
path.setFillType(fill.getFillType());
this.cacheSteps = (int) (lottieDrawable.getComposition().getDuration() / 32.0f);
BaseKeyframeAnimation<GradientColor, GradientColor> createAnimation = fill.getGradientColor().createAnimation();
this.colorAnimation = createAnimation;
createAnimation.addUpdateListener(this);
layer.addAnimation(createAnimation);
BaseKeyframeAnimation<Integer, Integer> createAnimation2 = fill.getOpacity().createAnimation();
this.opacityAnimation = createAnimation2;
createAnimation2.addUpdateListener(this);
layer.addAnimation(createAnimation2);
BaseKeyframeAnimation<PointF, PointF> createAnimation3 = fill.getStartPoint().createAnimation();
this.startPointAnimation = createAnimation3;
createAnimation3.addUpdateListener(this);
layer.addAnimation(createAnimation3);
BaseKeyframeAnimation<PointF, PointF> createAnimation4 = fill.getEndPoint().createAnimation();
this.endPointAnimation = createAnimation4;
createAnimation4.addUpdateListener(this);
layer.addAnimation(createAnimation4);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener
public void onValueChanged() {
this.lottieDrawable.invalidateSelf();
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
for (int i = 0; i < contentsAfter.size(); i++) {
Content content = contentsAfter.get(i);
if (content instanceof PathContent) {
this.paths.add((PathContent) content);
}
}
}
@Override // com.airbnb.lottie.animation.content.DrawingContent
public void draw(Canvas canvas, Matrix parentMatrix, int parentAlpha) {
Shader shader;
if (this.hidden) {
return;
}
C0633L.beginSection("GradientFillContent#draw");
this.path.reset();
for (int i = 0; i < this.paths.size(); i++) {
this.path.addPath(this.paths.get(i).getPath(), parentMatrix);
}
this.path.computeBounds(this.boundsRect, false);
if (this.type == GradientType.LINEAR) {
shader = getLinearGradient();
} else {
shader = getRadialGradient();
}
shader.setLocalMatrix(parentMatrix);
this.paint.setShader(shader);
BaseKeyframeAnimation<ColorFilter, ColorFilter> baseKeyframeAnimation = this.colorFilterAnimation;
if (baseKeyframeAnimation != null) {
this.paint.setColorFilter(baseKeyframeAnimation.getValue());
}
int alpha = (int) ((((parentAlpha / 255.0f) * this.opacityAnimation.getValue().intValue()) / 100.0f) * 255.0f);
this.paint.setAlpha(MiscUtils.clamp(alpha, 0, 255));
canvas.drawPath(this.path, this.paint);
C0633L.endSection("GradientFillContent#draw");
}
@Override // com.airbnb.lottie.animation.content.DrawingContent
public void getBounds(RectF outBounds, Matrix parentMatrix, boolean applyParents) {
this.path.reset();
for (int i = 0; i < this.paths.size(); i++) {
this.path.addPath(this.paths.get(i).getPath(), parentMatrix);
}
this.path.computeBounds(outBounds, false);
outBounds.set(outBounds.left - 1.0f, outBounds.top - 1.0f, outBounds.right + 1.0f, outBounds.bottom + 1.0f);
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
private LinearGradient getLinearGradient() {
int gradientHash = getGradientHash();
LinearGradient gradient = this.linearGradientCache.get(gradientHash);
if (gradient != null) {
return gradient;
}
PointF startPoint = this.startPointAnimation.getValue();
PointF endPoint = this.endPointAnimation.getValue();
GradientColor gradientColor = this.colorAnimation.getValue();
int[] colors = applyDynamicColorsIfNeeded(gradientColor.getColors());
float[] positions = gradientColor.getPositions();
LinearGradient gradient2 = new LinearGradient(startPoint.x, startPoint.y, endPoint.x, endPoint.y, colors, positions, Shader.TileMode.CLAMP);
this.linearGradientCache.put(gradientHash, gradient2);
return gradient2;
}
private RadialGradient getRadialGradient() {
float r;
int gradientHash = getGradientHash();
RadialGradient gradient = this.radialGradientCache.get(gradientHash);
if (gradient != null) {
return gradient;
}
PointF startPoint = this.startPointAnimation.getValue();
PointF endPoint = this.endPointAnimation.getValue();
GradientColor gradientColor = this.colorAnimation.getValue();
int[] colors = applyDynamicColorsIfNeeded(gradientColor.getColors());
float[] positions = gradientColor.getPositions();
float x0 = startPoint.x;
float y0 = startPoint.y;
float x1 = endPoint.x;
float y1 = endPoint.y;
float r2 = (float) Math.hypot(x1 - x0, y1 - y0);
if (r2 > 0.0f) {
r = r2;
} else {
r = 0.001f;
}
RadialGradient gradient2 = new RadialGradient(x0, y0, r, colors, positions, Shader.TileMode.CLAMP);
this.radialGradientCache.put(gradientHash, gradient2);
return gradient2;
}
private int getGradientHash() {
int startPointProgress = Math.round(this.startPointAnimation.getProgress() * this.cacheSteps);
int endPointProgress = Math.round(this.endPointAnimation.getProgress() * this.cacheSteps);
int colorProgress = Math.round(this.colorAnimation.getProgress() * this.cacheSteps);
int hash = 17;
if (startPointProgress != 0) {
hash = 17 * 31 * startPointProgress;
}
if (endPointProgress != 0) {
hash = hash * 31 * endPointProgress;
}
if (colorProgress != 0) {
return hash * 31 * colorProgress;
}
return hash;
}
private int[] applyDynamicColorsIfNeeded(int[] colors) {
ValueCallbackKeyframeAnimation valueCallbackKeyframeAnimation = this.colorCallbackAnimation;
if (valueCallbackKeyframeAnimation != null) {
Integer[] dynamicColors = (Integer[]) valueCallbackKeyframeAnimation.getValue();
if (colors.length == dynamicColors.length) {
for (int i = 0; i < colors.length; i++) {
colors[i] = dynamicColors[i].intValue();
}
} else {
colors = new int[dynamicColors.length];
for (int i2 = 0; i2 < dynamicColors.length; i2++) {
colors[i2] = dynamicColors[i2].intValue();
}
}
}
return colors;
}
@Override // com.airbnb.lottie.model.KeyPathElement
public void resolveKeyPath(KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath) {
MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.airbnb.lottie.model.KeyPathElement
public <T> void addValueCallback(T property, LottieValueCallback<T> callback) {
if (property == LottieProperty.OPACITY) {
this.opacityAnimation.setValueCallback(callback);
return;
}
if (property == LottieProperty.COLOR_FILTER) {
BaseKeyframeAnimation<ColorFilter, ColorFilter> baseKeyframeAnimation = this.colorFilterAnimation;
if (baseKeyframeAnimation != null) {
this.layer.removeAnimation(baseKeyframeAnimation);
}
if (callback == null) {
this.colorFilterAnimation = null;
return;
}
ValueCallbackKeyframeAnimation valueCallbackKeyframeAnimation = new ValueCallbackKeyframeAnimation(callback);
this.colorFilterAnimation = valueCallbackKeyframeAnimation;
valueCallbackKeyframeAnimation.addUpdateListener(this);
this.layer.addAnimation(this.colorFilterAnimation);
return;
}
if (property == LottieProperty.GRADIENT_COLOR) {
ValueCallbackKeyframeAnimation valueCallbackKeyframeAnimation2 = this.colorCallbackAnimation;
if (valueCallbackKeyframeAnimation2 != null) {
this.layer.removeAnimation(valueCallbackKeyframeAnimation2);
}
if (callback == null) {
this.colorCallbackAnimation = null;
return;
}
ValueCallbackKeyframeAnimation valueCallbackKeyframeAnimation3 = new ValueCallbackKeyframeAnimation(callback);
this.colorCallbackAnimation = valueCallbackKeyframeAnimation3;
valueCallbackKeyframeAnimation3.addUpdateListener(this);
this.layer.addAnimation(this.colorCallbackAnimation);
}
}
}
@@ -0,0 +1,173 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.RadialGradient;
import android.graphics.RectF;
import android.graphics.Shader;
import androidx.collection.LongSparseArray;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.ValueCallbackKeyframeAnimation;
import com.airbnb.lottie.model.content.GradientColor;
import com.airbnb.lottie.model.content.GradientStroke;
import com.airbnb.lottie.model.content.GradientType;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.value.LottieValueCallback;
/* loaded from: classes.dex */
public class GradientStrokeContent extends BaseStrokeContent {
private static final int CACHE_STEPS_MS = 32;
private final RectF boundsRect;
private final int cacheSteps;
private final BaseKeyframeAnimation<GradientColor, GradientColor> colorAnimation;
private ValueCallbackKeyframeAnimation colorCallbackAnimation;
private final BaseKeyframeAnimation<PointF, PointF> endPointAnimation;
private final boolean hidden;
private final LongSparseArray<LinearGradient> linearGradientCache;
private final String name;
private final LongSparseArray<RadialGradient> radialGradientCache;
private final BaseKeyframeAnimation<PointF, PointF> startPointAnimation;
private final GradientType type;
public GradientStrokeContent(LottieDrawable lottieDrawable, BaseLayer layer, GradientStroke stroke) {
super(lottieDrawable, layer, stroke.getCapType().toPaintCap(), stroke.getJoinType().toPaintJoin(), stroke.getMiterLimit(), stroke.getOpacity(), stroke.getWidth(), stroke.getLineDashPattern(), stroke.getDashOffset());
this.linearGradientCache = new LongSparseArray<>();
this.radialGradientCache = new LongSparseArray<>();
this.boundsRect = new RectF();
this.name = stroke.getName();
this.type = stroke.getGradientType();
this.hidden = stroke.isHidden();
this.cacheSteps = (int) (lottieDrawable.getComposition().getDuration() / 32.0f);
BaseKeyframeAnimation<GradientColor, GradientColor> createAnimation = stroke.getGradientColor().createAnimation();
this.colorAnimation = createAnimation;
createAnimation.addUpdateListener(this);
layer.addAnimation(createAnimation);
BaseKeyframeAnimation<PointF, PointF> createAnimation2 = stroke.getStartPoint().createAnimation();
this.startPointAnimation = createAnimation2;
createAnimation2.addUpdateListener(this);
layer.addAnimation(createAnimation2);
BaseKeyframeAnimation<PointF, PointF> createAnimation3 = stroke.getEndPoint().createAnimation();
this.endPointAnimation = createAnimation3;
createAnimation3.addUpdateListener(this);
layer.addAnimation(createAnimation3);
}
@Override // com.airbnb.lottie.animation.content.BaseStrokeContent, com.airbnb.lottie.animation.content.DrawingContent
public void draw(Canvas canvas, Matrix parentMatrix, int parentAlpha) {
Shader shader;
if (this.hidden) {
return;
}
getBounds(this.boundsRect, parentMatrix, false);
if (this.type == GradientType.LINEAR) {
shader = getLinearGradient();
} else {
shader = getRadialGradient();
}
shader.setLocalMatrix(parentMatrix);
this.paint.setShader(shader);
super.draw(canvas, parentMatrix, parentAlpha);
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
private LinearGradient getLinearGradient() {
int gradientHash = getGradientHash();
LinearGradient gradient = this.linearGradientCache.get(gradientHash);
if (gradient != null) {
return gradient;
}
PointF startPoint = this.startPointAnimation.getValue();
PointF endPoint = this.endPointAnimation.getValue();
GradientColor gradientColor = this.colorAnimation.getValue();
int[] colors = applyDynamicColorsIfNeeded(gradientColor.getColors());
float[] positions = gradientColor.getPositions();
float x0 = startPoint.x;
float y0 = startPoint.y;
float x1 = endPoint.x;
LinearGradient gradient2 = new LinearGradient(x0, y0, x1, endPoint.y, colors, positions, Shader.TileMode.CLAMP);
this.linearGradientCache.put(gradientHash, gradient2);
return gradient2;
}
private RadialGradient getRadialGradient() {
int gradientHash = getGradientHash();
RadialGradient gradient = this.radialGradientCache.get(gradientHash);
if (gradient != null) {
return gradient;
}
PointF startPoint = this.startPointAnimation.getValue();
PointF endPoint = this.endPointAnimation.getValue();
GradientColor gradientColor = this.colorAnimation.getValue();
int[] colors = applyDynamicColorsIfNeeded(gradientColor.getColors());
float[] positions = gradientColor.getPositions();
float x0 = startPoint.x;
float y0 = startPoint.y;
float x1 = endPoint.x;
float y1 = endPoint.y;
RadialGradient gradient2 = new RadialGradient(x0, y0, (float) Math.hypot(x1 - x0, y1 - y0), colors, positions, Shader.TileMode.CLAMP);
this.radialGradientCache.put(gradientHash, gradient2);
return gradient2;
}
private int getGradientHash() {
int startPointProgress = Math.round(this.startPointAnimation.getProgress() * this.cacheSteps);
int endPointProgress = Math.round(this.endPointAnimation.getProgress() * this.cacheSteps);
int colorProgress = Math.round(this.colorAnimation.getProgress() * this.cacheSteps);
int hash = 17;
if (startPointProgress != 0) {
hash = 17 * 31 * startPointProgress;
}
if (endPointProgress != 0) {
hash = hash * 31 * endPointProgress;
}
if (colorProgress != 0) {
return hash * 31 * colorProgress;
}
return hash;
}
private int[] applyDynamicColorsIfNeeded(int[] colors) {
ValueCallbackKeyframeAnimation valueCallbackKeyframeAnimation = this.colorCallbackAnimation;
if (valueCallbackKeyframeAnimation != null) {
Integer[] dynamicColors = (Integer[]) valueCallbackKeyframeAnimation.getValue();
if (colors.length == dynamicColors.length) {
for (int i = 0; i < colors.length; i++) {
colors[i] = dynamicColors[i].intValue();
}
} else {
colors = new int[dynamicColors.length];
for (int i2 = 0; i2 < dynamicColors.length; i2++) {
colors[i2] = dynamicColors[i2].intValue();
}
}
}
return colors;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.airbnb.lottie.animation.content.BaseStrokeContent, com.airbnb.lottie.model.KeyPathElement
public <T> void addValueCallback(T property, LottieValueCallback<T> callback) {
super.addValueCallback(property, callback);
if (property == LottieProperty.GRADIENT_COLOR) {
if (this.colorCallbackAnimation != null) {
this.layer.removeAnimation(this.colorCallbackAnimation);
}
if (callback == null) {
this.colorCallbackAnimation = null;
return;
}
ValueCallbackKeyframeAnimation valueCallbackKeyframeAnimation = new ValueCallbackKeyframeAnimation(callback);
this.colorCallbackAnimation = valueCallbackKeyframeAnimation;
valueCallbackKeyframeAnimation.addUpdateListener(this);
this.layer.addAnimation(this.colorCallbackAnimation);
}
}
}
@@ -0,0 +1,8 @@
package com.airbnb.lottie.animation.content;
import java.util.ListIterator;
/* loaded from: classes.dex */
interface GreedyContent {
void absorbContent(ListIterator<Content> listIterator);
}
@@ -0,0 +1,7 @@
package com.airbnb.lottie.animation.content;
import com.airbnb.lottie.model.KeyPathElement;
/* loaded from: classes.dex */
public interface KeyPathElementContent extends KeyPathElement, Content {
}
@@ -0,0 +1,145 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Path;
import android.os.Build;
import com.airbnb.lottie.model.content.MergePaths;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
/* loaded from: classes.dex */
public class MergePathsContent implements PathContent, GreedyContent {
private final MergePaths mergePaths;
private final String name;
private final Path firstPath = new Path();
private final Path remainderPath = new Path();
private final Path path = new Path();
private final List<PathContent> pathContents = new ArrayList();
public MergePathsContent(MergePaths mergePaths) {
if (Build.VERSION.SDK_INT < 19) {
throw new IllegalStateException("Merge paths are not supported pre-KitKat.");
}
this.name = mergePaths.getName();
this.mergePaths = mergePaths;
}
@Override // com.airbnb.lottie.animation.content.GreedyContent
public void absorbContent(ListIterator<Content> contents) {
while (contents.hasPrevious() && contents.previous() != this) {
}
while (contents.hasPrevious()) {
Content content = contents.previous();
if (content instanceof PathContent) {
this.pathContents.add((PathContent) content);
contents.remove();
}
}
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
for (int i = 0; i < this.pathContents.size(); i++) {
this.pathContents.get(i).setContents(contentsBefore, contentsAfter);
}
}
@Override // com.airbnb.lottie.animation.content.PathContent
public Path getPath() {
this.path.reset();
if (this.mergePaths.isHidden()) {
return this.path;
}
switch (C06731.f119x7df623d1[this.mergePaths.getMode().ordinal()]) {
case 1:
addPaths();
break;
case 2:
opFirstPathWithRest(Path.Op.UNION);
break;
case 3:
opFirstPathWithRest(Path.Op.REVERSE_DIFFERENCE);
break;
case 4:
opFirstPathWithRest(Path.Op.INTERSECT);
break;
case 5:
opFirstPathWithRest(Path.Op.XOR);
break;
}
return this.path;
}
/* renamed from: com.airbnb.lottie.animation.content.MergePathsContent$1 */
static /* synthetic */ class C06731 {
/* renamed from: $SwitchMap$com$airbnb$lottie$model$content$MergePaths$MergePathsMode */
static final /* synthetic */ int[] f119x7df623d1;
static {
int[] iArr = new int[MergePaths.MergePathsMode.values().length];
f119x7df623d1 = iArr;
try {
iArr[MergePaths.MergePathsMode.MERGE.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
f119x7df623d1[MergePaths.MergePathsMode.ADD.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
try {
f119x7df623d1[MergePaths.MergePathsMode.SUBTRACT.ordinal()] = 3;
} catch (NoSuchFieldError e3) {
}
try {
f119x7df623d1[MergePaths.MergePathsMode.INTERSECT.ordinal()] = 4;
} catch (NoSuchFieldError e4) {
}
try {
f119x7df623d1[MergePaths.MergePathsMode.EXCLUDE_INTERSECTIONS.ordinal()] = 5;
} catch (NoSuchFieldError e5) {
}
}
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
private void addPaths() {
for (int i = 0; i < this.pathContents.size(); i++) {
this.path.addPath(this.pathContents.get(i).getPath());
}
}
private void opFirstPathWithRest(Path.Op op) {
this.remainderPath.reset();
this.firstPath.reset();
for (int i = this.pathContents.size() - 1; i >= 1; i--) {
PathContent content = this.pathContents.get(i);
if (content instanceof ContentGroup) {
List<PathContent> pathList = ((ContentGroup) content).getPathList();
for (int j = pathList.size() - 1; j >= 0; j--) {
Path path = pathList.get(j).getPath();
path.transform(((ContentGroup) content).getTransformationMatrix());
this.remainderPath.addPath(path);
}
} else {
this.remainderPath.addPath(content.getPath());
}
}
PathContent lastContent = this.pathContents.get(0);
if (lastContent instanceof ContentGroup) {
List<PathContent> pathList2 = ((ContentGroup) lastContent).getPathList();
for (int j2 = 0; j2 < pathList2.size(); j2++) {
Path path2 = pathList2.get(j2).getPath();
path2.transform(((ContentGroup) lastContent).getTransformationMatrix());
this.firstPath.addPath(path2);
}
} else {
this.firstPath.set(lastContent.getPath());
}
this.path.op(this.firstPath, this.remainderPath, op);
}
}
@@ -0,0 +1,5 @@
package com.airbnb.lottie.animation.content;
/* loaded from: classes.dex */
public interface ModifierContent {
}
@@ -0,0 +1,8 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Path;
/* loaded from: classes.dex */
interface PathContent extends Content {
Path getPath();
}
@@ -0,0 +1,266 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Path;
import android.graphics.PointF;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.model.KeyPath;
import com.airbnb.lottie.model.content.PolystarShape;
import com.airbnb.lottie.model.content.ShapeTrimPath;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.List;
/* loaded from: classes.dex */
public class PolystarContent implements PathContent, BaseKeyframeAnimation.AnimationListener, KeyPathElementContent {
private static final float POLYGON_MAGIC_NUMBER = 0.25f;
private static final float POLYSTAR_MAGIC_NUMBER = 0.47829f;
private final boolean hidden;
private final BaseKeyframeAnimation<?, Float> innerRadiusAnimation;
private final BaseKeyframeAnimation<?, Float> innerRoundednessAnimation;
private boolean isPathValid;
private final LottieDrawable lottieDrawable;
private final String name;
private final BaseKeyframeAnimation<?, Float> outerRadiusAnimation;
private final BaseKeyframeAnimation<?, Float> outerRoundednessAnimation;
private final BaseKeyframeAnimation<?, Float> pointsAnimation;
private final BaseKeyframeAnimation<?, PointF> positionAnimation;
private final BaseKeyframeAnimation<?, Float> rotationAnimation;
private final PolystarShape.Type type;
private final Path path = new Path();
private CompoundTrimPathContent trimPaths = new CompoundTrimPathContent();
public PolystarContent(LottieDrawable lottieDrawable, BaseLayer layer, PolystarShape polystarShape) {
this.lottieDrawable = lottieDrawable;
this.name = polystarShape.getName();
PolystarShape.Type type = polystarShape.getType();
this.type = type;
this.hidden = polystarShape.isHidden();
BaseKeyframeAnimation<Float, Float> createAnimation = polystarShape.getPoints().createAnimation();
this.pointsAnimation = createAnimation;
BaseKeyframeAnimation<PointF, PointF> createAnimation2 = polystarShape.getPosition().createAnimation();
this.positionAnimation = createAnimation2;
BaseKeyframeAnimation<Float, Float> createAnimation3 = polystarShape.getRotation().createAnimation();
this.rotationAnimation = createAnimation3;
BaseKeyframeAnimation<Float, Float> createAnimation4 = polystarShape.getOuterRadius().createAnimation();
this.outerRadiusAnimation = createAnimation4;
BaseKeyframeAnimation<Float, Float> createAnimation5 = polystarShape.getOuterRoundedness().createAnimation();
this.outerRoundednessAnimation = createAnimation5;
if (type == PolystarShape.Type.STAR) {
this.innerRadiusAnimation = polystarShape.getInnerRadius().createAnimation();
this.innerRoundednessAnimation = polystarShape.getInnerRoundedness().createAnimation();
} else {
this.innerRadiusAnimation = null;
this.innerRoundednessAnimation = null;
}
layer.addAnimation(createAnimation);
layer.addAnimation(createAnimation2);
layer.addAnimation(createAnimation3);
layer.addAnimation(createAnimation4);
layer.addAnimation(createAnimation5);
if (type == PolystarShape.Type.STAR) {
layer.addAnimation(this.innerRadiusAnimation);
layer.addAnimation(this.innerRoundednessAnimation);
}
createAnimation.addUpdateListener(this);
createAnimation2.addUpdateListener(this);
createAnimation3.addUpdateListener(this);
createAnimation4.addUpdateListener(this);
createAnimation5.addUpdateListener(this);
if (type == PolystarShape.Type.STAR) {
this.innerRadiusAnimation.addUpdateListener(this);
this.innerRoundednessAnimation.addUpdateListener(this);
}
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener
public void onValueChanged() {
invalidate();
}
private void invalidate() {
this.isPathValid = false;
this.lottieDrawable.invalidateSelf();
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
for (int i = 0; i < contentsBefore.size(); i++) {
Content content = contentsBefore.get(i);
if ((content instanceof TrimPathContent) && ((TrimPathContent) content).getType() == ShapeTrimPath.Type.SIMULTANEOUSLY) {
TrimPathContent trimPath = (TrimPathContent) content;
this.trimPaths.addTrimPath(trimPath);
trimPath.addListener(this);
}
}
}
@Override // com.airbnb.lottie.animation.content.PathContent
public Path getPath() {
if (this.isPathValid) {
return this.path;
}
this.path.reset();
if (this.hidden) {
this.isPathValid = true;
return this.path;
}
switch (C06741.$SwitchMap$com$airbnb$lottie$model$content$PolystarShape$Type[this.type.ordinal()]) {
case 1:
createStarPath();
break;
case 2:
createPolygonPath();
break;
}
this.path.close();
this.trimPaths.apply(this.path);
this.isPathValid = true;
return this.path;
}
/* renamed from: com.airbnb.lottie.animation.content.PolystarContent$1 */
static /* synthetic */ class C06741 {
static final /* synthetic */ int[] $SwitchMap$com$airbnb$lottie$model$content$PolystarShape$Type;
static {
int[] iArr = new int[PolystarShape.Type.values().length];
$SwitchMap$com$airbnb$lottie$model$content$PolystarShape$Type = iArr;
try {
iArr[PolystarShape.Type.STAR.ordinal()] = 1;
} catch (NoSuchFieldError e) {
}
try {
$SwitchMap$com$airbnb$lottie$model$content$PolystarShape$Type[PolystarShape.Type.POLYGON.ordinal()] = 2;
} catch (NoSuchFieldError e2) {
}
}
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
/* JADX WARN: Removed duplicated region for block: B:28:0x0118 */
/* JADX WARN: Removed duplicated region for block: B:33:0x0145 */
/* JADX WARN: Removed duplicated region for block: B:38:0x0238 */
/* JADX WARN: Removed duplicated region for block: B:41:0x023a */
/* JADX WARN: Removed duplicated region for block: B:45:0x01a4 */
/* JADX WARN: Removed duplicated region for block: B:47:0x01ab */
/* JADX WARN: Removed duplicated region for block: B:50:0x01b4 */
/* JADX WARN: Removed duplicated region for block: B:53:0x01bd */
/* JADX WARN: Removed duplicated region for block: B:56:0x01e5 */
/* JADX WARN: Removed duplicated region for block: B:63:0x0210 */
/* JADX WARN: Removed duplicated region for block: B:64:0x01c0 */
/* JADX WARN: Removed duplicated region for block: B:65:0x01b7 */
/* JADX WARN: Removed duplicated region for block: B:66:0x01ae */
/* JADX WARN: Removed duplicated region for block: B:67:0x01a7 */
/* JADX WARN: Removed duplicated region for block: B:69:0x0125 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void createStarPath() {
/*
Method dump skipped, instructions count: 620
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.airbnb.lottie.animation.content.PolystarContent.createStarPath():void");
}
private void createPolygonPath() {
int points;
double currentAngle;
float anglePerPoint;
double numPoints;
int points2 = (int) Math.floor(this.pointsAnimation.getValue().floatValue());
double currentAngle2 = Math.toRadians((this.rotationAnimation == null ? 0.0d : r2.getValue().floatValue()) - 90.0d);
float anglePerPoint2 = (float) (6.283185307179586d / points2);
float roundedness = this.outerRoundednessAnimation.getValue().floatValue() / 100.0f;
float radius = this.outerRadiusAnimation.getValue().floatValue();
float x = (float) (radius * Math.cos(currentAngle2));
float y = (float) (radius * Math.sin(currentAngle2));
this.path.moveTo(x, y);
double currentAngle3 = currentAngle2 + anglePerPoint2;
double numPoints2 = Math.ceil(points2);
int i = 0;
while (i < numPoints2) {
float previousX = x;
float previousY = y;
x = (float) (radius * Math.cos(currentAngle3));
y = (float) (radius * Math.sin(currentAngle3));
if (roundedness != 0.0f) {
numPoints = numPoints2;
double numPoints3 = previousX;
float cp1Theta = (float) (Math.atan2(previousY, numPoints3) - 1.5707963267948966d);
float cp1Dx = (float) Math.cos(cp1Theta);
float cp1Dy = (float) Math.sin(cp1Theta);
points = points2;
currentAngle = currentAngle3;
anglePerPoint = anglePerPoint2;
float cp2Theta = (float) (Math.atan2(y, x) - 1.5707963267948966d);
float cp2Dx = (float) Math.cos(cp2Theta);
float cp2Dy = (float) Math.sin(cp2Theta);
float cp1x = radius * roundedness * POLYGON_MAGIC_NUMBER * cp1Dx;
float cp1y = radius * roundedness * POLYGON_MAGIC_NUMBER * cp1Dy;
float cp2x = radius * roundedness * POLYGON_MAGIC_NUMBER * cp2Dx;
float cp2y = radius * roundedness * POLYGON_MAGIC_NUMBER * cp2Dy;
this.path.cubicTo(previousX - cp1x, previousY - cp1y, x + cp2x, y + cp2y, x, y);
} else {
points = points2;
currentAngle = currentAngle3;
anglePerPoint = anglePerPoint2;
numPoints = numPoints2;
this.path.lineTo(x, y);
}
float anglePerPoint3 = anglePerPoint;
currentAngle3 = currentAngle + anglePerPoint3;
i++;
anglePerPoint2 = anglePerPoint3;
points2 = points;
numPoints2 = numPoints;
}
PointF position = this.positionAnimation.getValue();
this.path.offset(position.x, position.y);
this.path.close();
}
@Override // com.airbnb.lottie.model.KeyPathElement
public void resolveKeyPath(KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath) {
MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this);
}
@Override // com.airbnb.lottie.model.KeyPathElement
public <T> void addValueCallback(T property, LottieValueCallback<T> callback) {
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation;
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation2;
if (property == LottieProperty.POLYSTAR_POINTS) {
this.pointsAnimation.setValueCallback(callback);
return;
}
if (property == LottieProperty.POLYSTAR_ROTATION) {
this.rotationAnimation.setValueCallback(callback);
return;
}
if (property == LottieProperty.POSITION) {
this.positionAnimation.setValueCallback(callback);
return;
}
if (property == LottieProperty.POLYSTAR_INNER_RADIUS && (baseKeyframeAnimation2 = this.innerRadiusAnimation) != null) {
baseKeyframeAnimation2.setValueCallback(callback);
return;
}
if (property == LottieProperty.POLYSTAR_OUTER_RADIUS) {
this.outerRadiusAnimation.setValueCallback(callback);
return;
}
if (property == LottieProperty.POLYSTAR_INNER_ROUNDEDNESS && (baseKeyframeAnimation = this.innerRoundednessAnimation) != null) {
baseKeyframeAnimation.setValueCallback(callback);
} else if (property == LottieProperty.POLYSTAR_OUTER_ROUNDEDNESS) {
this.outerRoundednessAnimation.setValueCallback(callback);
}
}
}
@@ -0,0 +1,138 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.RectF;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.FloatKeyframeAnimation;
import com.airbnb.lottie.model.KeyPath;
import com.airbnb.lottie.model.content.RectangleShape;
import com.airbnb.lottie.model.content.ShapeTrimPath;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.List;
/* loaded from: classes.dex */
public class RectangleContent implements BaseKeyframeAnimation.AnimationListener, KeyPathElementContent, PathContent {
private final BaseKeyframeAnimation<?, Float> cornerRadiusAnimation;
private final boolean hidden;
private boolean isPathValid;
private final LottieDrawable lottieDrawable;
private final String name;
private final BaseKeyframeAnimation<?, PointF> positionAnimation;
private final BaseKeyframeAnimation<?, PointF> sizeAnimation;
private final Path path = new Path();
private final RectF rect = new RectF();
private CompoundTrimPathContent trimPaths = new CompoundTrimPathContent();
public RectangleContent(LottieDrawable lottieDrawable, BaseLayer layer, RectangleShape rectShape) {
this.name = rectShape.getName();
this.hidden = rectShape.isHidden();
this.lottieDrawable = lottieDrawable;
BaseKeyframeAnimation<PointF, PointF> createAnimation = rectShape.getPosition().createAnimation();
this.positionAnimation = createAnimation;
BaseKeyframeAnimation<PointF, PointF> createAnimation2 = rectShape.getSize().createAnimation();
this.sizeAnimation = createAnimation2;
BaseKeyframeAnimation<Float, Float> createAnimation3 = rectShape.getCornerRadius().createAnimation();
this.cornerRadiusAnimation = createAnimation3;
layer.addAnimation(createAnimation);
layer.addAnimation(createAnimation2);
layer.addAnimation(createAnimation3);
createAnimation.addUpdateListener(this);
createAnimation2.addUpdateListener(this);
createAnimation3.addUpdateListener(this);
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener
public void onValueChanged() {
invalidate();
}
private void invalidate() {
this.isPathValid = false;
this.lottieDrawable.invalidateSelf();
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
for (int i = 0; i < contentsBefore.size(); i++) {
Content content = contentsBefore.get(i);
if ((content instanceof TrimPathContent) && ((TrimPathContent) content).getType() == ShapeTrimPath.Type.SIMULTANEOUSLY) {
TrimPathContent trimPath = (TrimPathContent) content;
this.trimPaths.addTrimPath(trimPath);
trimPath.addListener(this);
}
}
}
@Override // com.airbnb.lottie.animation.content.PathContent
public Path getPath() {
if (this.isPathValid) {
return this.path;
}
this.path.reset();
if (this.hidden) {
this.isPathValid = true;
return this.path;
}
PointF size = this.sizeAnimation.getValue();
float halfWidth = size.x / 2.0f;
float halfHeight = size.y / 2.0f;
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation = this.cornerRadiusAnimation;
float radius = baseKeyframeAnimation == null ? 0.0f : ((FloatKeyframeAnimation) baseKeyframeAnimation).getFloatValue();
float maxRadius = Math.min(halfWidth, halfHeight);
if (radius > maxRadius) {
radius = maxRadius;
}
PointF position = this.positionAnimation.getValue();
this.path.moveTo(position.x + halfWidth, (position.y - halfHeight) + radius);
this.path.lineTo(position.x + halfWidth, (position.y + halfHeight) - radius);
if (radius > 0.0f) {
this.rect.set((position.x + halfWidth) - (radius * 2.0f), (position.y + halfHeight) - (radius * 2.0f), position.x + halfWidth, position.y + halfHeight);
this.path.arcTo(this.rect, 0.0f, 90.0f, false);
}
this.path.lineTo((position.x - halfWidth) + radius, position.y + halfHeight);
if (radius > 0.0f) {
this.rect.set(position.x - halfWidth, (position.y + halfHeight) - (radius * 2.0f), (position.x - halfWidth) + (radius * 2.0f), position.y + halfHeight);
this.path.arcTo(this.rect, 90.0f, 90.0f, false);
}
this.path.lineTo(position.x - halfWidth, (position.y - halfHeight) + radius);
if (radius > 0.0f) {
this.rect.set(position.x - halfWidth, position.y - halfHeight, (position.x - halfWidth) + (radius * 2.0f), (position.y - halfHeight) + (radius * 2.0f));
this.path.arcTo(this.rect, 180.0f, 90.0f, false);
}
this.path.lineTo((position.x + halfWidth) - radius, position.y - halfHeight);
if (radius > 0.0f) {
this.rect.set((position.x + halfWidth) - (radius * 2.0f), position.y - halfHeight, position.x + halfWidth, (position.y - halfHeight) + (2.0f * radius));
this.path.arcTo(this.rect, 270.0f, 90.0f, false);
}
this.path.close();
this.trimPaths.apply(this.path);
this.isPathValid = true;
return this.path;
}
@Override // com.airbnb.lottie.model.KeyPathElement
public void resolveKeyPath(KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath) {
MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this);
}
@Override // com.airbnb.lottie.model.KeyPathElement
public <T> void addValueCallback(T property, LottieValueCallback<T> callback) {
if (property == LottieProperty.RECTANGLE_SIZE) {
this.sizeAnimation.setValueCallback(callback);
} else if (property == LottieProperty.POSITION) {
this.positionAnimation.setValueCallback(callback);
} else if (property == LottieProperty.CORNER_RADIUS) {
this.cornerRadiusAnimation.setValueCallback(callback);
}
}
}
@@ -0,0 +1,132 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Path;
import android.graphics.RectF;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.TransformKeyframeAnimation;
import com.airbnb.lottie.model.KeyPath;
import com.airbnb.lottie.model.content.Repeater;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
/* loaded from: classes.dex */
public class RepeaterContent implements DrawingContent, PathContent, GreedyContent, BaseKeyframeAnimation.AnimationListener, KeyPathElementContent {
private ContentGroup contentGroup;
private final BaseKeyframeAnimation<Float, Float> copies;
private final boolean hidden;
private final BaseLayer layer;
private final LottieDrawable lottieDrawable;
private final String name;
private final BaseKeyframeAnimation<Float, Float> offset;
private final TransformKeyframeAnimation transform;
private final Matrix matrix = new Matrix();
private final Path path = new Path();
public RepeaterContent(LottieDrawable lottieDrawable, BaseLayer layer, Repeater repeater) {
this.lottieDrawable = lottieDrawable;
this.layer = layer;
this.name = repeater.getName();
this.hidden = repeater.isHidden();
BaseKeyframeAnimation<Float, Float> createAnimation = repeater.getCopies().createAnimation();
this.copies = createAnimation;
layer.addAnimation(createAnimation);
createAnimation.addUpdateListener(this);
BaseKeyframeAnimation<Float, Float> createAnimation2 = repeater.getOffset().createAnimation();
this.offset = createAnimation2;
layer.addAnimation(createAnimation2);
createAnimation2.addUpdateListener(this);
TransformKeyframeAnimation createAnimation3 = repeater.getTransform().createAnimation();
this.transform = createAnimation3;
createAnimation3.addAnimationsToLayer(layer);
createAnimation3.addListener(this);
}
@Override // com.airbnb.lottie.animation.content.GreedyContent
public void absorbContent(ListIterator<Content> contentsIter) {
if (this.contentGroup != null) {
return;
}
while (contentsIter.hasPrevious() && contentsIter.previous() != this) {
}
List<Content> contents = new ArrayList<>();
while (contentsIter.hasPrevious()) {
contents.add(contentsIter.previous());
contentsIter.remove();
}
Collections.reverse(contents);
this.contentGroup = new ContentGroup(this.lottieDrawable, this.layer, "Repeater", this.hidden, contents, null);
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
this.contentGroup.setContents(contentsBefore, contentsAfter);
}
@Override // com.airbnb.lottie.animation.content.PathContent
public Path getPath() {
Path contentPath = this.contentGroup.getPath();
this.path.reset();
float copies = this.copies.getValue().floatValue();
float offset = this.offset.getValue().floatValue();
for (int i = ((int) copies) - 1; i >= 0; i--) {
this.matrix.set(this.transform.getMatrixForRepeater(i + offset));
this.path.addPath(contentPath, this.matrix);
}
return this.path;
}
@Override // com.airbnb.lottie.animation.content.DrawingContent
public void draw(Canvas canvas, Matrix parentMatrix, int alpha) {
float copies = this.copies.getValue().floatValue();
float offset = this.offset.getValue().floatValue();
float startOpacity = this.transform.getStartOpacity().getValue().floatValue() / 100.0f;
float endOpacity = this.transform.getEndOpacity().getValue().floatValue() / 100.0f;
for (int i = ((int) copies) - 1; i >= 0; i--) {
this.matrix.set(parentMatrix);
this.matrix.preConcat(this.transform.getMatrixForRepeater(i + offset));
float newAlpha = alpha * MiscUtils.lerp(startOpacity, endOpacity, i / copies);
this.contentGroup.draw(canvas, this.matrix, (int) newAlpha);
}
}
@Override // com.airbnb.lottie.animation.content.DrawingContent
public void getBounds(RectF outBounds, Matrix parentMatrix, boolean applyParents) {
this.contentGroup.getBounds(outBounds, parentMatrix, applyParents);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener
public void onValueChanged() {
this.lottieDrawable.invalidateSelf();
}
@Override // com.airbnb.lottie.model.KeyPathElement
public void resolveKeyPath(KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath) {
MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this);
}
@Override // com.airbnb.lottie.model.KeyPathElement
public <T> void addValueCallback(T property, LottieValueCallback<T> callback) {
if (this.transform.applyValueCallback(property, callback)) {
return;
}
if (property == LottieProperty.REPEATER_COPIES) {
this.copies.setValueCallback(callback);
} else if (property == LottieProperty.REPEATER_OFFSET) {
this.offset.setValueCallback(callback);
}
}
}
@@ -0,0 +1,75 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Path;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.model.content.ShapeData;
import com.airbnb.lottie.model.content.ShapePath;
import com.airbnb.lottie.model.content.ShapeTrimPath;
import com.airbnb.lottie.model.layer.BaseLayer;
import java.util.List;
/* loaded from: classes.dex */
public class ShapeContent implements PathContent, BaseKeyframeAnimation.AnimationListener {
private final boolean hidden;
private boolean isPathValid;
private final LottieDrawable lottieDrawable;
private final String name;
private final BaseKeyframeAnimation<?, Path> shapeAnimation;
private final Path path = new Path();
private CompoundTrimPathContent trimPaths = new CompoundTrimPathContent();
public ShapeContent(LottieDrawable lottieDrawable, BaseLayer layer, ShapePath shape) {
this.name = shape.getName();
this.hidden = shape.isHidden();
this.lottieDrawable = lottieDrawable;
BaseKeyframeAnimation<ShapeData, Path> createAnimation = shape.getShapePath().createAnimation();
this.shapeAnimation = createAnimation;
layer.addAnimation(createAnimation);
createAnimation.addUpdateListener(this);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener
public void onValueChanged() {
invalidate();
}
private void invalidate() {
this.isPathValid = false;
this.lottieDrawable.invalidateSelf();
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
for (int i = 0; i < contentsBefore.size(); i++) {
Content content = contentsBefore.get(i);
if ((content instanceof TrimPathContent) && ((TrimPathContent) content).getType() == ShapeTrimPath.Type.SIMULTANEOUSLY) {
TrimPathContent trimPath = (TrimPathContent) content;
this.trimPaths.addTrimPath(trimPath);
trimPath.addListener(this);
}
}
}
@Override // com.airbnb.lottie.animation.content.PathContent
public Path getPath() {
if (this.isPathValid) {
return this.path;
}
this.path.reset();
if (this.hidden) {
this.isPathValid = true;
return this.path;
}
this.path.set(this.shapeAnimation.getValue());
this.path.setFillType(Path.FillType.EVEN_ODD);
this.trimPaths.apply(this.path);
this.isPathValid = true;
return this.path;
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
}
@@ -0,0 +1,73 @@
package com.airbnb.lottie.animation.content;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.ColorKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.ValueCallbackKeyframeAnimation;
import com.airbnb.lottie.model.content.ShapeStroke;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.value.LottieValueCallback;
/* loaded from: classes.dex */
public class StrokeContent extends BaseStrokeContent {
private final BaseKeyframeAnimation<Integer, Integer> colorAnimation;
private BaseKeyframeAnimation<ColorFilter, ColorFilter> colorFilterAnimation;
private final boolean hidden;
private final BaseLayer layer;
private final String name;
public StrokeContent(LottieDrawable lottieDrawable, BaseLayer layer, ShapeStroke stroke) {
super(lottieDrawable, layer, stroke.getCapType().toPaintCap(), stroke.getJoinType().toPaintJoin(), stroke.getMiterLimit(), stroke.getOpacity(), stroke.getWidth(), stroke.getLineDashPattern(), stroke.getDashOffset());
this.layer = layer;
this.name = stroke.getName();
this.hidden = stroke.isHidden();
BaseKeyframeAnimation<Integer, Integer> createAnimation = stroke.getColor().createAnimation();
this.colorAnimation = createAnimation;
createAnimation.addUpdateListener(this);
layer.addAnimation(createAnimation);
}
@Override // com.airbnb.lottie.animation.content.BaseStrokeContent, com.airbnb.lottie.animation.content.DrawingContent
public void draw(Canvas canvas, Matrix parentMatrix, int parentAlpha) {
if (this.hidden) {
return;
}
this.paint.setColor(((ColorKeyframeAnimation) this.colorAnimation).getIntValue());
if (this.colorFilterAnimation != null) {
this.paint.setColorFilter(this.colorFilterAnimation.getValue());
}
super.draw(canvas, parentMatrix, parentAlpha);
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
@Override // com.airbnb.lottie.animation.content.BaseStrokeContent, com.airbnb.lottie.model.KeyPathElement
public <T> void addValueCallback(T property, LottieValueCallback<T> callback) {
super.addValueCallback(property, callback);
if (property == LottieProperty.STROKE_COLOR) {
this.colorAnimation.setValueCallback(callback);
return;
}
if (property == LottieProperty.COLOR_FILTER) {
BaseKeyframeAnimation<ColorFilter, ColorFilter> baseKeyframeAnimation = this.colorFilterAnimation;
if (baseKeyframeAnimation != null) {
this.layer.removeAnimation(baseKeyframeAnimation);
}
if (callback == null) {
this.colorFilterAnimation = null;
return;
}
ValueCallbackKeyframeAnimation valueCallbackKeyframeAnimation = new ValueCallbackKeyframeAnimation(callback);
this.colorFilterAnimation = valueCallbackKeyframeAnimation;
valueCallbackKeyframeAnimation.addUpdateListener(this);
this.layer.addAnimation(this.colorAnimation);
}
}
}
@@ -0,0 +1,76 @@
package com.airbnb.lottie.animation.content;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.model.content.ShapeTrimPath;
import com.airbnb.lottie.model.layer.BaseLayer;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class TrimPathContent implements Content, BaseKeyframeAnimation.AnimationListener {
private final BaseKeyframeAnimation<?, Float> endAnimation;
private final boolean hidden;
private final List<BaseKeyframeAnimation.AnimationListener> listeners = new ArrayList();
private final String name;
private final BaseKeyframeAnimation<?, Float> offsetAnimation;
private final BaseKeyframeAnimation<?, Float> startAnimation;
private final ShapeTrimPath.Type type;
public TrimPathContent(BaseLayer layer, ShapeTrimPath trimPath) {
this.name = trimPath.getName();
this.hidden = trimPath.isHidden();
this.type = trimPath.getType();
BaseKeyframeAnimation<Float, Float> createAnimation = trimPath.getStart().createAnimation();
this.startAnimation = createAnimation;
BaseKeyframeAnimation<Float, Float> createAnimation2 = trimPath.getEnd().createAnimation();
this.endAnimation = createAnimation2;
BaseKeyframeAnimation<Float, Float> createAnimation3 = trimPath.getOffset().createAnimation();
this.offsetAnimation = createAnimation3;
layer.addAnimation(createAnimation);
layer.addAnimation(createAnimation2);
layer.addAnimation(createAnimation3);
createAnimation.addUpdateListener(this);
createAnimation2.addUpdateListener(this);
createAnimation3.addUpdateListener(this);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener
public void onValueChanged() {
for (int i = 0; i < this.listeners.size(); i++) {
this.listeners.get(i).onValueChanged();
}
}
@Override // com.airbnb.lottie.animation.content.Content
public void setContents(List<Content> contentsBefore, List<Content> contentsAfter) {
}
@Override // com.airbnb.lottie.animation.content.Content
public String getName() {
return this.name;
}
void addListener(BaseKeyframeAnimation.AnimationListener listener) {
this.listeners.add(listener);
}
ShapeTrimPath.Type getType() {
return this.type;
}
public BaseKeyframeAnimation<?, Float> getStart() {
return this.startAnimation;
}
public BaseKeyframeAnimation<?, Float> getEnd() {
return this.endAnimation;
}
public BaseKeyframeAnimation<?, Float> getOffset() {
return this.offsetAnimation;
}
public boolean isHidden() {
return this.hidden;
}
}
@@ -0,0 +1,2 @@
package com.airbnb.lottie.animation.content;
@@ -0,0 +1,298 @@
package com.airbnb.lottie.animation.keyframe;
import com.airbnb.lottie.C0633L;
import com.airbnb.lottie.value.Keyframe;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public abstract class BaseKeyframeAnimation<K, A> {
private final KeyframesWrapper<K> keyframesWrapper;
protected LottieValueCallback<A> valueCallback;
final List<AnimationListener> listeners = new ArrayList(1);
private boolean isDiscrete = false;
protected float progress = 0.0f;
private A cachedGetValue = null;
private float cachedStartDelayProgress = -1.0f;
private float cachedEndProgress = -1.0f;
public interface AnimationListener {
void onValueChanged();
}
private interface KeyframesWrapper<T> {
Keyframe<T> getCurrentKeyframe();
float getEndProgress();
float getStartDelayProgress();
boolean isCachedValueEnabled(float f);
boolean isEmpty();
boolean isValueChanged(float f);
}
abstract A getValue(Keyframe<K> keyframe, float f);
BaseKeyframeAnimation(List<? extends Keyframe<K>> keyframes) {
this.keyframesWrapper = wrap(keyframes);
}
public void setIsDiscrete() {
this.isDiscrete = true;
}
public void addUpdateListener(AnimationListener listener) {
this.listeners.add(listener);
}
public void setProgress(float progress) {
if (this.keyframesWrapper.isEmpty()) {
return;
}
if (progress < getStartDelayProgress()) {
progress = getStartDelayProgress();
} else if (progress > getEndProgress()) {
progress = getEndProgress();
}
if (progress == this.progress) {
return;
}
this.progress = progress;
if (this.keyframesWrapper.isValueChanged(progress)) {
notifyListeners();
}
}
public void notifyListeners() {
for (int i = 0; i < this.listeners.size(); i++) {
this.listeners.get(i).onValueChanged();
}
}
protected Keyframe<K> getCurrentKeyframe() {
C0633L.beginSection("BaseKeyframeAnimation#getCurrentKeyframe");
Keyframe<K> keyframe = this.keyframesWrapper.getCurrentKeyframe();
C0633L.endSection("BaseKeyframeAnimation#getCurrentKeyframe");
return keyframe;
}
float getLinearCurrentKeyframeProgress() {
if (this.isDiscrete) {
return 0.0f;
}
Keyframe<K> keyframe = getCurrentKeyframe();
if (keyframe.isStatic()) {
return 0.0f;
}
float progressIntoFrame = this.progress - keyframe.getStartProgress();
float keyframeProgress = keyframe.getEndProgress() - keyframe.getStartProgress();
return progressIntoFrame / keyframeProgress;
}
protected float getInterpolatedCurrentKeyframeProgress() {
Keyframe<K> keyframe = getCurrentKeyframe();
if (keyframe.isStatic()) {
return 0.0f;
}
return keyframe.interpolator.getInterpolation(getLinearCurrentKeyframeProgress());
}
private float getStartDelayProgress() {
if (this.cachedStartDelayProgress == -1.0f) {
this.cachedStartDelayProgress = this.keyframesWrapper.getStartDelayProgress();
}
return this.cachedStartDelayProgress;
}
float getEndProgress() {
if (this.cachedEndProgress == -1.0f) {
this.cachedEndProgress = this.keyframesWrapper.getEndProgress();
}
return this.cachedEndProgress;
}
public A getValue() {
float progress = getInterpolatedCurrentKeyframeProgress();
if (this.valueCallback == null && this.keyframesWrapper.isCachedValueEnabled(progress)) {
return this.cachedGetValue;
}
Keyframe<K> keyframe = getCurrentKeyframe();
A value = getValue(keyframe, progress);
this.cachedGetValue = value;
return value;
}
public float getProgress() {
return this.progress;
}
public void setValueCallback(LottieValueCallback<A> valueCallback) {
LottieValueCallback<A> lottieValueCallback = this.valueCallback;
if (lottieValueCallback != null) {
lottieValueCallback.setAnimation(null);
}
this.valueCallback = valueCallback;
if (valueCallback != null) {
valueCallback.setAnimation(this);
}
}
private static <T> KeyframesWrapper<T> wrap(List<? extends Keyframe<T>> keyframes) {
if (keyframes.isEmpty()) {
return new EmptyKeyframeWrapper();
}
if (keyframes.size() == 1) {
return new SingleKeyframeWrapper(keyframes);
}
return new KeyframesWrapperImpl(keyframes);
}
private static final class EmptyKeyframeWrapper<T> implements KeyframesWrapper<T> {
private EmptyKeyframeWrapper() {
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public boolean isEmpty() {
return true;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public boolean isValueChanged(float progress) {
return false;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public Keyframe<T> getCurrentKeyframe() {
throw new IllegalStateException("not implemented");
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public float getStartDelayProgress() {
return 0.0f;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public float getEndProgress() {
return 1.0f;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public boolean isCachedValueEnabled(float interpolatedProgress) {
throw new IllegalStateException("not implemented");
}
}
private static final class SingleKeyframeWrapper<T> implements KeyframesWrapper<T> {
private float cachedInterpolatedProgress = -1.0f;
private final Keyframe<T> keyframe;
SingleKeyframeWrapper(List<? extends Keyframe<T>> keyframes) {
this.keyframe = keyframes.get(0);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public boolean isEmpty() {
return false;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public boolean isValueChanged(float progress) {
return !this.keyframe.isStatic();
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public Keyframe<T> getCurrentKeyframe() {
return this.keyframe;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public float getStartDelayProgress() {
return this.keyframe.getStartProgress();
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public float getEndProgress() {
return this.keyframe.getEndProgress();
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public boolean isCachedValueEnabled(float interpolatedProgress) {
if (this.cachedInterpolatedProgress == interpolatedProgress) {
return true;
}
this.cachedInterpolatedProgress = interpolatedProgress;
return false;
}
}
private static final class KeyframesWrapperImpl<T> implements KeyframesWrapper<T> {
private Keyframe<T> cachedCurrentKeyframe = null;
private float cachedInterpolatedProgress = -1.0f;
private Keyframe<T> currentKeyframe = findKeyframe(0.0f);
private final List<? extends Keyframe<T>> keyframes;
KeyframesWrapperImpl(List<? extends Keyframe<T>> keyframes) {
this.keyframes = keyframes;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public boolean isEmpty() {
return false;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public boolean isValueChanged(float progress) {
if (this.currentKeyframe.containsProgress(progress)) {
return !this.currentKeyframe.isStatic();
}
this.currentKeyframe = findKeyframe(progress);
return true;
}
private Keyframe<T> findKeyframe(float progress) {
List<? extends Keyframe<T>> list = this.keyframes;
Keyframe<T> keyframe = list.get(list.size() - 1);
if (progress >= keyframe.getStartProgress()) {
return keyframe;
}
for (int i = this.keyframes.size() - 2; i >= 1; i--) {
Keyframe<T> keyframe2 = this.keyframes.get(i);
if (this.currentKeyframe != keyframe2 && keyframe2.containsProgress(progress)) {
return keyframe2;
}
}
return this.keyframes.get(0);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public Keyframe<T> getCurrentKeyframe() {
return this.currentKeyframe;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public float getStartDelayProgress() {
return this.keyframes.get(0).getStartProgress();
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public float getEndProgress() {
return this.keyframes.get(r0.size() - 1).getEndProgress();
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.KeyframesWrapper
public boolean isCachedValueEnabled(float interpolatedProgress) {
Keyframe<T> keyframe = this.cachedCurrentKeyframe;
Keyframe<T> keyframe2 = this.currentKeyframe;
if (keyframe == keyframe2 && this.cachedInterpolatedProgress == interpolatedProgress) {
return true;
}
this.cachedCurrentKeyframe = keyframe2;
this.cachedInterpolatedProgress = interpolatedProgress;
return false;
}
}
}
@@ -0,0 +1,40 @@
package com.airbnb.lottie.animation.keyframe;
import com.airbnb.lottie.utils.GammaEvaluator;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class ColorKeyframeAnimation extends KeyframeAnimation<Integer> {
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
/* bridge */ /* synthetic */ Object getValue(Keyframe keyframe, float f) {
return getValue((Keyframe<Integer>) keyframe, f);
}
public ColorKeyframeAnimation(List<Keyframe<Integer>> keyframes) {
super(keyframes);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
Integer getValue(Keyframe<Integer> keyframe, float keyframeProgress) {
return Integer.valueOf(getIntValue(keyframe, keyframeProgress));
}
public int getIntValue(Keyframe<Integer> keyframe, float keyframeProgress) {
Integer value;
if (keyframe.startValue == null || keyframe.endValue == null) {
throw new IllegalStateException("Missing values for keyframe.");
}
int startColor = keyframe.startValue.intValue();
int endColor = keyframe.endValue.intValue();
if (this.valueCallback != null && (value = (Integer) this.valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame.floatValue(), Integer.valueOf(startColor), Integer.valueOf(endColor), keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress())) != null) {
return value.intValue();
}
return GammaEvaluator.evaluate(MiscUtils.clamp(keyframeProgress, 0.0f, 1.0f), startColor, endColor);
}
public int getIntValue() {
return getIntValue(getCurrentKeyframe(), getInterpolatedCurrentKeyframeProgress());
}
}
@@ -0,0 +1,37 @@
package com.airbnb.lottie.animation.keyframe;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class FloatKeyframeAnimation extends KeyframeAnimation<Float> {
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
/* bridge */ /* synthetic */ Object getValue(Keyframe keyframe, float f) {
return getValue((Keyframe<Float>) keyframe, f);
}
public FloatKeyframeAnimation(List<Keyframe<Float>> keyframes) {
super(keyframes);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
Float getValue(Keyframe<Float> keyframe, float keyframeProgress) {
return Float.valueOf(getFloatValue(keyframe, keyframeProgress));
}
float getFloatValue(Keyframe<Float> keyframe, float keyframeProgress) {
Float value;
if (keyframe.startValue == null || keyframe.endValue == null) {
throw new IllegalStateException("Missing values for keyframe.");
}
if (this.valueCallback != null && (value = (Float) this.valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame.floatValue(), keyframe.startValue, keyframe.endValue, keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress())) != null) {
return value.floatValue();
}
return MiscUtils.lerp(keyframe.getStartValueFloat(), keyframe.getEndValueFloat(), keyframeProgress);
}
public float getFloatValue() {
return getFloatValue(getCurrentKeyframe(), getInterpolatedCurrentKeyframeProgress());
}
}
@@ -0,0 +1,28 @@
package com.airbnb.lottie.animation.keyframe;
import com.airbnb.lottie.model.content.GradientColor;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class GradientColorKeyframeAnimation extends KeyframeAnimation<GradientColor> {
private final GradientColor gradientColor;
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
/* bridge */ /* synthetic */ Object getValue(Keyframe keyframe, float f) {
return getValue((Keyframe<GradientColor>) keyframe, f);
}
public GradientColorKeyframeAnimation(List<Keyframe<GradientColor>> keyframes) {
super(keyframes);
GradientColor startValue = keyframes.get(0).startValue;
int size = startValue != null ? startValue.getSize() : 0;
this.gradientColor = new GradientColor(new float[size], new int[size]);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
GradientColor getValue(Keyframe<GradientColor> keyframe, float keyframeProgress) {
this.gradientColor.lerp(keyframe.startValue, keyframe.endValue, keyframeProgress);
return this.gradientColor;
}
}
@@ -0,0 +1,37 @@
package com.airbnb.lottie.animation.keyframe;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class IntegerKeyframeAnimation extends KeyframeAnimation<Integer> {
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
/* bridge */ /* synthetic */ Object getValue(Keyframe keyframe, float f) {
return getValue((Keyframe<Integer>) keyframe, f);
}
public IntegerKeyframeAnimation(List<Keyframe<Integer>> keyframes) {
super(keyframes);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
Integer getValue(Keyframe<Integer> keyframe, float keyframeProgress) {
return Integer.valueOf(getIntValue(keyframe, keyframeProgress));
}
int getIntValue(Keyframe<Integer> keyframe, float keyframeProgress) {
Integer value;
if (keyframe.startValue == null || keyframe.endValue == null) {
throw new IllegalStateException("Missing values for keyframe.");
}
if (this.valueCallback != null && (value = (Integer) this.valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame.floatValue(), keyframe.startValue, keyframe.endValue, keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress())) != null) {
return value.intValue();
}
return MiscUtils.lerp(keyframe.getStartValueInt(), keyframe.getEndValueInt(), keyframeProgress);
}
public int getIntValue() {
return getIntValue(getCurrentKeyframe(), getInterpolatedCurrentKeyframeProgress());
}
}
@@ -0,0 +1,11 @@
package com.airbnb.lottie.animation.keyframe;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
abstract class KeyframeAnimation<T> extends BaseKeyframeAnimation<T, T> {
KeyframeAnimation(List<? extends Keyframe<T>> keyframes) {
super(keyframes);
}
}
@@ -0,0 +1,38 @@
package com.airbnb.lottie.animation.keyframe;
import android.graphics.Path;
import com.airbnb.lottie.model.animatable.AnimatableIntegerValue;
import com.airbnb.lottie.model.content.Mask;
import com.airbnb.lottie.model.content.ShapeData;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class MaskKeyframeAnimation {
private final List<BaseKeyframeAnimation<ShapeData, Path>> maskAnimations;
private final List<Mask> masks;
private final List<BaseKeyframeAnimation<Integer, Integer>> opacityAnimations;
public MaskKeyframeAnimation(List<Mask> masks) {
this.masks = masks;
this.maskAnimations = new ArrayList(masks.size());
this.opacityAnimations = new ArrayList(masks.size());
for (int i = 0; i < masks.size(); i++) {
this.maskAnimations.add(masks.get(i).getMaskPath().createAnimation());
AnimatableIntegerValue opacity = masks.get(i).getOpacity();
this.opacityAnimations.add(opacity.createAnimation());
}
}
public List<Mask> getMasks() {
return this.masks;
}
public List<BaseKeyframeAnimation<ShapeData, Path>> getMaskAnimations() {
return this.maskAnimations;
}
public List<BaseKeyframeAnimation<Integer, Integer>> getOpacityAnimations() {
return this.opacityAnimations;
}
}
@@ -0,0 +1,31 @@
package com.airbnb.lottie.animation.keyframe;
import android.graphics.Path;
import android.graphics.PointF;
import com.airbnb.lottie.LottieComposition;
import com.airbnb.lottie.utils.Utils;
import com.airbnb.lottie.value.Keyframe;
/* loaded from: classes.dex */
public class PathKeyframe extends Keyframe<PointF> {
private Path path;
private final Keyframe<PointF> pointKeyFrame;
public PathKeyframe(LottieComposition composition, Keyframe<PointF> keyframe) {
super(composition, keyframe.startValue, keyframe.endValue, keyframe.interpolator, keyframe.startFrame, keyframe.endFrame);
this.pointKeyFrame = keyframe;
createPath();
}
/* JADX WARN: Multi-variable type inference failed */
public void createPath() {
boolean equals = (this.endValue == 0 || this.startValue == 0 || !((PointF) this.startValue).equals(((PointF) this.endValue).x, ((PointF) this.endValue).y)) ? false : true;
if (this.endValue != 0 && !equals) {
this.path = Utils.createPath((PointF) this.startValue, (PointF) this.endValue, this.pointKeyFrame.pathCp1, this.pointKeyFrame.pathCp2);
}
}
Path getPath() {
return this.path;
}
}
@@ -0,0 +1,51 @@
package com.airbnb.lottie.animation.keyframe;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.PointF;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class PathKeyframeAnimation extends KeyframeAnimation<PointF> {
private PathMeasure pathMeasure;
private PathKeyframe pathMeasureKeyframe;
private final PointF point;
private final float[] pos;
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public /* bridge */ /* synthetic */ Object getValue(Keyframe keyframe, float f) {
return getValue((Keyframe<PointF>) keyframe, f);
}
public PathKeyframeAnimation(List<? extends Keyframe<PointF>> keyframes) {
super(keyframes);
this.point = new PointF();
this.pos = new float[2];
this.pathMeasure = new PathMeasure();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public PointF getValue(Keyframe<PointF> keyframe, float keyframeProgress) {
PointF value;
PathKeyframe pathKeyframe = (PathKeyframe) keyframe;
Path path = pathKeyframe.getPath();
if (path == null) {
return keyframe.startValue;
}
if (this.valueCallback != null && (value = (PointF) this.valueCallback.getValueInternal(pathKeyframe.startFrame, pathKeyframe.endFrame.floatValue(), pathKeyframe.startValue, pathKeyframe.endValue, getLinearCurrentKeyframeProgress(), keyframeProgress, getProgress())) != null) {
return value;
}
if (this.pathMeasureKeyframe != pathKeyframe) {
this.pathMeasure.setPath(path, false);
this.pathMeasureKeyframe = pathKeyframe;
}
PathMeasure pathMeasure = this.pathMeasure;
pathMeasure.getPosTan(pathMeasure.getLength() * keyframeProgress, this.pos, null);
PointF pointF = this.point;
float[] fArr = this.pos;
pointF.set(fArr[0], fArr[1]);
return this.point;
}
}
@@ -0,0 +1,35 @@
package com.airbnb.lottie.animation.keyframe;
import android.graphics.PointF;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class PointKeyframeAnimation extends KeyframeAnimation<PointF> {
private final PointF point;
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public /* bridge */ /* synthetic */ Object getValue(Keyframe keyframe, float f) {
return getValue((Keyframe<PointF>) keyframe, f);
}
public PointKeyframeAnimation(List<Keyframe<PointF>> keyframes) {
super(keyframes);
this.point = new PointF();
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public PointF getValue(Keyframe<PointF> keyframe, float keyframeProgress) {
PointF value;
if (keyframe.startValue == null || keyframe.endValue == null) {
throw new IllegalStateException("Missing values for keyframe.");
}
PointF startPoint = keyframe.startValue;
PointF endPoint = keyframe.endValue;
if (this.valueCallback != null && (value = (PointF) this.valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame.floatValue(), startPoint, endPoint, keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress())) != null) {
return value;
}
this.point.set(startPoint.x + ((endPoint.x - startPoint.x) * keyframeProgress), startPoint.y + ((endPoint.y - startPoint.y) * keyframeProgress));
return this.point;
}
}
@@ -0,0 +1,36 @@
package com.airbnb.lottie.animation.keyframe;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.Keyframe;
import com.airbnb.lottie.value.ScaleXY;
import java.util.List;
/* loaded from: classes.dex */
public class ScaleKeyframeAnimation extends KeyframeAnimation<ScaleXY> {
private final ScaleXY scaleXY;
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public /* bridge */ /* synthetic */ Object getValue(Keyframe keyframe, float f) {
return getValue((Keyframe<ScaleXY>) keyframe, f);
}
public ScaleKeyframeAnimation(List<Keyframe<ScaleXY>> keyframes) {
super(keyframes);
this.scaleXY = new ScaleXY();
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public ScaleXY getValue(Keyframe<ScaleXY> keyframe, float keyframeProgress) {
ScaleXY value;
if (keyframe.startValue == null || keyframe.endValue == null) {
throw new IllegalStateException("Missing values for keyframe.");
}
ScaleXY startTransform = keyframe.startValue;
ScaleXY endTransform = keyframe.endValue;
if (this.valueCallback != null && (value = (ScaleXY) this.valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame.floatValue(), startTransform, endTransform, keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress())) != null) {
return value;
}
this.scaleXY.set(MiscUtils.lerp(startTransform.getScaleX(), endTransform.getScaleX(), keyframeProgress), MiscUtils.lerp(startTransform.getScaleY(), endTransform.getScaleY(), keyframeProgress));
return this.scaleXY;
}
}
@@ -0,0 +1,29 @@
package com.airbnb.lottie.animation.keyframe;
import android.graphics.Path;
import com.airbnb.lottie.model.content.ShapeData;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class ShapeKeyframeAnimation extends BaseKeyframeAnimation<ShapeData, Path> {
private final Path tempPath;
private final ShapeData tempShapeData;
public ShapeKeyframeAnimation(List<Keyframe<ShapeData>> keyframes) {
super(keyframes);
this.tempShapeData = new ShapeData();
this.tempPath = new Path();
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public Path getValue(Keyframe<ShapeData> keyframe, float keyframeProgress) {
ShapeData startShapeData = keyframe.startValue;
ShapeData endShapeData = keyframe.endValue;
this.tempShapeData.interpolateBetween(startShapeData, endShapeData, keyframeProgress);
MiscUtils.getPathFromData(this.tempShapeData, this.tempPath);
return this.tempPath;
}
}
@@ -0,0 +1,43 @@
package com.airbnb.lottie.animation.keyframe;
import android.graphics.PointF;
import com.airbnb.lottie.value.Keyframe;
import java.util.Collections;
/* loaded from: classes.dex */
public class SplitDimensionPathKeyframeAnimation extends BaseKeyframeAnimation<PointF, PointF> {
private final PointF point;
private final BaseKeyframeAnimation<Float, Float> xAnimation;
private final BaseKeyframeAnimation<Float, Float> yAnimation;
public SplitDimensionPathKeyframeAnimation(BaseKeyframeAnimation<Float, Float> xAnimation, BaseKeyframeAnimation<Float, Float> yAnimation) {
super(Collections.emptyList());
this.point = new PointF();
this.xAnimation = xAnimation;
this.yAnimation = yAnimation;
setProgress(getProgress());
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public void setProgress(float progress) {
this.xAnimation.setProgress(progress);
this.yAnimation.setProgress(progress);
this.point.set(this.xAnimation.getValue().floatValue(), this.yAnimation.getValue().floatValue());
for (int i = 0; i < this.listeners.size(); i++) {
this.listeners.get(i).onValueChanged();
}
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public PointF getValue() {
return getValue((Keyframe<PointF>) null, 0.0f);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: Can't rename method to resolve collision */
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public PointF getValue(Keyframe<PointF> keyframe, float keyframeProgress) {
return this.point;
}
}
@@ -0,0 +1,22 @@
package com.airbnb.lottie.animation.keyframe;
import com.airbnb.lottie.model.DocumentData;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class TextKeyframeAnimation extends KeyframeAnimation<DocumentData> {
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
/* bridge */ /* synthetic */ Object getValue(Keyframe keyframe, float f) {
return getValue((Keyframe<DocumentData>) keyframe, f);
}
public TextKeyframeAnimation(List<Keyframe<DocumentData>> keyframes) {
super(keyframes);
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
DocumentData getValue(Keyframe<DocumentData> keyframe, float keyframeProgress) {
return keyframe.startValue;
}
}
@@ -0,0 +1,346 @@
package com.airbnb.lottie.animation.keyframe;
import android.graphics.Matrix;
import android.graphics.PointF;
import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.model.animatable.AnimatableTransform;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.value.Keyframe;
import com.airbnb.lottie.value.LottieValueCallback;
import com.airbnb.lottie.value.ScaleXY;
import java.util.Collections;
/* loaded from: classes.dex */
public class TransformKeyframeAnimation {
private BaseKeyframeAnimation<PointF, PointF> anchorPoint;
private BaseKeyframeAnimation<?, Float> endOpacity;
private final Matrix matrix = new Matrix();
private BaseKeyframeAnimation<Integer, Integer> opacity;
private BaseKeyframeAnimation<?, PointF> position;
private BaseKeyframeAnimation<Float, Float> rotation;
private BaseKeyframeAnimation<ScaleXY, ScaleXY> scale;
private FloatKeyframeAnimation skew;
private FloatKeyframeAnimation skewAngle;
private final Matrix skewMatrix1;
private final Matrix skewMatrix2;
private final Matrix skewMatrix3;
private final float[] skewValues;
private BaseKeyframeAnimation<?, Float> startOpacity;
public TransformKeyframeAnimation(AnimatableTransform animatableTransform) {
this.anchorPoint = animatableTransform.getAnchorPoint() == null ? null : animatableTransform.getAnchorPoint().createAnimation();
this.position = animatableTransform.getPosition() == null ? null : animatableTransform.getPosition().createAnimation();
this.scale = animatableTransform.getScale() == null ? null : animatableTransform.getScale().createAnimation();
this.rotation = animatableTransform.getRotation() == null ? null : animatableTransform.getRotation().createAnimation();
FloatKeyframeAnimation floatKeyframeAnimation = animatableTransform.getSkew() == null ? null : (FloatKeyframeAnimation) animatableTransform.getSkew().createAnimation();
this.skew = floatKeyframeAnimation;
if (floatKeyframeAnimation != null) {
this.skewMatrix1 = new Matrix();
this.skewMatrix2 = new Matrix();
this.skewMatrix3 = new Matrix();
this.skewValues = new float[9];
} else {
this.skewMatrix1 = null;
this.skewMatrix2 = null;
this.skewMatrix3 = null;
this.skewValues = null;
}
this.skewAngle = animatableTransform.getSkewAngle() == null ? null : (FloatKeyframeAnimation) animatableTransform.getSkewAngle().createAnimation();
if (animatableTransform.getOpacity() != null) {
this.opacity = animatableTransform.getOpacity().createAnimation();
}
if (animatableTransform.getStartOpacity() != null) {
this.startOpacity = animatableTransform.getStartOpacity().createAnimation();
} else {
this.startOpacity = null;
}
if (animatableTransform.getEndOpacity() != null) {
this.endOpacity = animatableTransform.getEndOpacity().createAnimation();
} else {
this.endOpacity = null;
}
}
public void addAnimationsToLayer(BaseLayer layer) {
layer.addAnimation(this.opacity);
layer.addAnimation(this.startOpacity);
layer.addAnimation(this.endOpacity);
layer.addAnimation(this.anchorPoint);
layer.addAnimation(this.position);
layer.addAnimation(this.scale);
layer.addAnimation(this.rotation);
layer.addAnimation(this.skew);
layer.addAnimation(this.skewAngle);
}
public void addListener(BaseKeyframeAnimation.AnimationListener listener) {
BaseKeyframeAnimation<Integer, Integer> baseKeyframeAnimation = this.opacity;
if (baseKeyframeAnimation != null) {
baseKeyframeAnimation.addUpdateListener(listener);
}
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation2 = this.startOpacity;
if (baseKeyframeAnimation2 != null) {
baseKeyframeAnimation2.addUpdateListener(listener);
}
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation3 = this.endOpacity;
if (baseKeyframeAnimation3 != null) {
baseKeyframeAnimation3.addUpdateListener(listener);
}
BaseKeyframeAnimation<PointF, PointF> baseKeyframeAnimation4 = this.anchorPoint;
if (baseKeyframeAnimation4 != null) {
baseKeyframeAnimation4.addUpdateListener(listener);
}
BaseKeyframeAnimation<?, PointF> baseKeyframeAnimation5 = this.position;
if (baseKeyframeAnimation5 != null) {
baseKeyframeAnimation5.addUpdateListener(listener);
}
BaseKeyframeAnimation<ScaleXY, ScaleXY> baseKeyframeAnimation6 = this.scale;
if (baseKeyframeAnimation6 != null) {
baseKeyframeAnimation6.addUpdateListener(listener);
}
BaseKeyframeAnimation<Float, Float> baseKeyframeAnimation7 = this.rotation;
if (baseKeyframeAnimation7 != null) {
baseKeyframeAnimation7.addUpdateListener(listener);
}
FloatKeyframeAnimation floatKeyframeAnimation = this.skew;
if (floatKeyframeAnimation != null) {
floatKeyframeAnimation.addUpdateListener(listener);
}
FloatKeyframeAnimation floatKeyframeAnimation2 = this.skewAngle;
if (floatKeyframeAnimation2 != null) {
floatKeyframeAnimation2.addUpdateListener(listener);
}
}
public void setProgress(float progress) {
BaseKeyframeAnimation<Integer, Integer> baseKeyframeAnimation = this.opacity;
if (baseKeyframeAnimation != null) {
baseKeyframeAnimation.setProgress(progress);
}
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation2 = this.startOpacity;
if (baseKeyframeAnimation2 != null) {
baseKeyframeAnimation2.setProgress(progress);
}
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation3 = this.endOpacity;
if (baseKeyframeAnimation3 != null) {
baseKeyframeAnimation3.setProgress(progress);
}
BaseKeyframeAnimation<PointF, PointF> baseKeyframeAnimation4 = this.anchorPoint;
if (baseKeyframeAnimation4 != null) {
baseKeyframeAnimation4.setProgress(progress);
}
BaseKeyframeAnimation<?, PointF> baseKeyframeAnimation5 = this.position;
if (baseKeyframeAnimation5 != null) {
baseKeyframeAnimation5.setProgress(progress);
}
BaseKeyframeAnimation<ScaleXY, ScaleXY> baseKeyframeAnimation6 = this.scale;
if (baseKeyframeAnimation6 != null) {
baseKeyframeAnimation6.setProgress(progress);
}
BaseKeyframeAnimation<Float, Float> baseKeyframeAnimation7 = this.rotation;
if (baseKeyframeAnimation7 != null) {
baseKeyframeAnimation7.setProgress(progress);
}
FloatKeyframeAnimation floatKeyframeAnimation = this.skew;
if (floatKeyframeAnimation != null) {
floatKeyframeAnimation.setProgress(progress);
}
FloatKeyframeAnimation floatKeyframeAnimation2 = this.skewAngle;
if (floatKeyframeAnimation2 != null) {
floatKeyframeAnimation2.setProgress(progress);
}
}
public BaseKeyframeAnimation<?, Integer> getOpacity() {
return this.opacity;
}
public BaseKeyframeAnimation<?, Float> getStartOpacity() {
return this.startOpacity;
}
public BaseKeyframeAnimation<?, Float> getEndOpacity() {
return this.endOpacity;
}
public Matrix getMatrix() {
float rotation;
this.matrix.reset();
BaseKeyframeAnimation<?, PointF> baseKeyframeAnimation = this.position;
if (baseKeyframeAnimation != null) {
PointF position = baseKeyframeAnimation.getValue();
if (position.x != 0.0f || position.y != 0.0f) {
this.matrix.preTranslate(position.x, position.y);
}
}
BaseKeyframeAnimation<Float, Float> baseKeyframeAnimation2 = this.rotation;
if (baseKeyframeAnimation2 != null) {
if (baseKeyframeAnimation2 instanceof ValueCallbackKeyframeAnimation) {
rotation = baseKeyframeAnimation2.getValue().floatValue();
} else {
rotation = ((FloatKeyframeAnimation) baseKeyframeAnimation2).getFloatValue();
}
if (rotation != 0.0f) {
this.matrix.preRotate(rotation);
}
}
if (this.skew != null) {
float mCos = this.skewAngle == null ? 0.0f : (float) Math.cos(Math.toRadians((-r0.getFloatValue()) + 90.0f));
float mSin = this.skewAngle == null ? 1.0f : (float) Math.sin(Math.toRadians((-r4.getFloatValue()) + 90.0f));
float aTan = (float) Math.tan(Math.toRadians(this.skew.getFloatValue()));
clearSkewValues();
float[] fArr = this.skewValues;
fArr[0] = mCos;
fArr[1] = mSin;
fArr[3] = -mSin;
fArr[4] = mCos;
fArr[8] = 1.0f;
this.skewMatrix1.setValues(fArr);
clearSkewValues();
float[] fArr2 = this.skewValues;
fArr2[0] = 1.0f;
fArr2[3] = aTan;
fArr2[4] = 1.0f;
fArr2[8] = 1.0f;
this.skewMatrix2.setValues(fArr2);
clearSkewValues();
float[] fArr3 = this.skewValues;
fArr3[0] = mCos;
fArr3[1] = -mSin;
fArr3[3] = mSin;
fArr3[4] = mCos;
fArr3[8] = 1.0f;
this.skewMatrix3.setValues(fArr3);
this.skewMatrix2.preConcat(this.skewMatrix1);
this.skewMatrix3.preConcat(this.skewMatrix2);
this.matrix.preConcat(this.skewMatrix3);
}
BaseKeyframeAnimation<ScaleXY, ScaleXY> baseKeyframeAnimation3 = this.scale;
if (baseKeyframeAnimation3 != null) {
ScaleXY scaleTransform = baseKeyframeAnimation3.getValue();
if (scaleTransform.getScaleX() != 1.0f || scaleTransform.getScaleY() != 1.0f) {
this.matrix.preScale(scaleTransform.getScaleX(), scaleTransform.getScaleY());
}
}
BaseKeyframeAnimation<PointF, PointF> baseKeyframeAnimation4 = this.anchorPoint;
if (baseKeyframeAnimation4 != null) {
PointF anchorPoint = baseKeyframeAnimation4.getValue();
if (anchorPoint.x != 0.0f || anchorPoint.y != 0.0f) {
this.matrix.preTranslate(-anchorPoint.x, -anchorPoint.y);
}
}
return this.matrix;
}
private void clearSkewValues() {
for (int i = 0; i < 9; i++) {
this.skewValues[i] = 0.0f;
}
}
public Matrix getMatrixForRepeater(float amount) {
BaseKeyframeAnimation<?, PointF> baseKeyframeAnimation = this.position;
PointF position = baseKeyframeAnimation == null ? null : baseKeyframeAnimation.getValue();
BaseKeyframeAnimation<ScaleXY, ScaleXY> baseKeyframeAnimation2 = this.scale;
ScaleXY scale = baseKeyframeAnimation2 == null ? null : baseKeyframeAnimation2.getValue();
this.matrix.reset();
if (position != null) {
this.matrix.preTranslate(position.x * amount, position.y * amount);
}
if (scale != null) {
this.matrix.preScale((float) Math.pow(scale.getScaleX(), amount), (float) Math.pow(scale.getScaleY(), amount));
}
BaseKeyframeAnimation<Float, Float> baseKeyframeAnimation3 = this.rotation;
if (baseKeyframeAnimation3 != null) {
float rotation = baseKeyframeAnimation3.getValue().floatValue();
BaseKeyframeAnimation<PointF, PointF> baseKeyframeAnimation4 = this.anchorPoint;
PointF anchorPoint = baseKeyframeAnimation4 != null ? baseKeyframeAnimation4.getValue() : null;
this.matrix.preRotate(rotation * amount, anchorPoint == null ? 0.0f : anchorPoint.x, anchorPoint != null ? anchorPoint.y : 0.0f);
}
return this.matrix;
}
public <T> boolean applyValueCallback(T property, LottieValueCallback<T> callback) {
FloatKeyframeAnimation floatKeyframeAnimation;
FloatKeyframeAnimation floatKeyframeAnimation2;
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation;
BaseKeyframeAnimation<?, Float> baseKeyframeAnimation2;
if (property == LottieProperty.TRANSFORM_ANCHOR_POINT) {
BaseKeyframeAnimation<PointF, PointF> baseKeyframeAnimation3 = this.anchorPoint;
if (baseKeyframeAnimation3 == null) {
this.anchorPoint = new ValueCallbackKeyframeAnimation(callback, new PointF());
return true;
}
baseKeyframeAnimation3.setValueCallback(callback);
return true;
}
if (property == LottieProperty.TRANSFORM_POSITION) {
BaseKeyframeAnimation<?, PointF> baseKeyframeAnimation4 = this.position;
if (baseKeyframeAnimation4 == null) {
this.position = new ValueCallbackKeyframeAnimation(callback, new PointF());
return true;
}
baseKeyframeAnimation4.setValueCallback(callback);
return true;
}
if (property == LottieProperty.TRANSFORM_SCALE) {
BaseKeyframeAnimation<ScaleXY, ScaleXY> baseKeyframeAnimation5 = this.scale;
if (baseKeyframeAnimation5 == null) {
this.scale = new ValueCallbackKeyframeAnimation(callback, new ScaleXY());
return true;
}
baseKeyframeAnimation5.setValueCallback(callback);
return true;
}
if (property == LottieProperty.TRANSFORM_ROTATION) {
BaseKeyframeAnimation<Float, Float> baseKeyframeAnimation6 = this.rotation;
if (baseKeyframeAnimation6 == null) {
this.rotation = new ValueCallbackKeyframeAnimation(callback, Float.valueOf(0.0f));
return true;
}
baseKeyframeAnimation6.setValueCallback(callback);
return true;
}
if (property == LottieProperty.TRANSFORM_OPACITY) {
BaseKeyframeAnimation<Integer, Integer> baseKeyframeAnimation7 = this.opacity;
if (baseKeyframeAnimation7 == null) {
this.opacity = new ValueCallbackKeyframeAnimation(callback, 100);
return true;
}
baseKeyframeAnimation7.setValueCallback(callback);
return true;
}
if (property == LottieProperty.TRANSFORM_START_OPACITY && (baseKeyframeAnimation2 = this.startOpacity) != null) {
if (baseKeyframeAnimation2 == null) {
this.startOpacity = new ValueCallbackKeyframeAnimation(callback, 100);
return true;
}
baseKeyframeAnimation2.setValueCallback(callback);
return true;
}
if (property == LottieProperty.TRANSFORM_END_OPACITY && (baseKeyframeAnimation = this.endOpacity) != null) {
if (baseKeyframeAnimation == null) {
this.endOpacity = new ValueCallbackKeyframeAnimation(callback, 100);
return true;
}
baseKeyframeAnimation.setValueCallback(callback);
return true;
}
if (property == LottieProperty.TRANSFORM_SKEW && (floatKeyframeAnimation2 = this.skew) != null) {
if (floatKeyframeAnimation2 == null) {
this.skew = new FloatKeyframeAnimation(Collections.singletonList(new Keyframe(Float.valueOf(0.0f))));
}
this.skew.setValueCallback(callback);
return true;
}
if (property == LottieProperty.TRANSFORM_SKEW_ANGLE && (floatKeyframeAnimation = this.skewAngle) != null) {
if (floatKeyframeAnimation == null) {
this.skewAngle = new FloatKeyframeAnimation(Collections.singletonList(new Keyframe(Float.valueOf(0.0f))));
}
this.skewAngle.setValueCallback(callback);
return true;
}
return false;
}
}
@@ -0,0 +1,52 @@
package com.airbnb.lottie.animation.keyframe;
import com.airbnb.lottie.value.Keyframe;
import com.airbnb.lottie.value.LottieFrameInfo;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.Collections;
/* loaded from: classes.dex */
public class ValueCallbackKeyframeAnimation<K, A> extends BaseKeyframeAnimation<K, A> {
private final LottieFrameInfo<A> frameInfo;
private final A valueCallbackValue;
public ValueCallbackKeyframeAnimation(LottieValueCallback<A> valueCallback) {
this(valueCallback, null);
}
public ValueCallbackKeyframeAnimation(LottieValueCallback<A> valueCallback, A valueCallbackValue) {
super(Collections.emptyList());
this.frameInfo = new LottieFrameInfo<>();
setValueCallback(valueCallback);
this.valueCallbackValue = valueCallbackValue;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public void setProgress(float progress) {
this.progress = progress;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
float getEndProgress() {
return 1.0f;
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public void notifyListeners() {
if (this.valueCallback != null) {
super.notifyListeners();
}
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
public A getValue() {
LottieValueCallback<A> lottieValueCallback = this.valueCallback;
A a = this.valueCallbackValue;
return lottieValueCallback.getValueInternal(0.0f, 0.0f, a, a, getProgress(), getProgress(), getProgress());
}
@Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation
A getValue(Keyframe<K> keyframe, float keyframeProgress) {
return getValue();
}
}
@@ -0,0 +1,2 @@
package com.airbnb.lottie.animation.keyframe;
@@ -0,0 +1,2 @@
package com.airbnb.lottie.animation;
@@ -0,0 +1,91 @@
package com.airbnb.lottie.manager;
import android.content.res.AssetManager;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.view.View;
import com.airbnb.lottie.FontAssetDelegate;
import com.airbnb.lottie.model.MutablePair;
import com.airbnb.lottie.utils.Logger;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public class FontAssetManager {
private final AssetManager assetManager;
private FontAssetDelegate delegate;
private final MutablePair<String> tempPair = new MutablePair<>();
private final Map<MutablePair<String>, Typeface> fontMap = new HashMap();
private final Map<String, Typeface> fontFamilies = new HashMap();
private String defaultFontFileExtension = ".ttf";
public FontAssetManager(Drawable.Callback callback, FontAssetDelegate delegate) {
this.delegate = delegate;
if (!(callback instanceof View)) {
Logger.warning("LottieDrawable must be inside of a view for images to work.");
this.assetManager = null;
} else {
this.assetManager = ((View) callback).getContext().getAssets();
}
}
public void setDelegate(FontAssetDelegate assetDelegate) {
this.delegate = assetDelegate;
}
public void setDefaultFontFileExtension(String defaultFontFileExtension) {
this.defaultFontFileExtension = defaultFontFileExtension;
}
public Typeface getTypeface(String fontFamily, String style) {
this.tempPair.set(fontFamily, style);
Typeface typeface = this.fontMap.get(this.tempPair);
if (typeface != null) {
return typeface;
}
Typeface typefaceWithDefaultStyle = getFontFamily(fontFamily);
Typeface typeface2 = typefaceForStyle(typefaceWithDefaultStyle, style);
this.fontMap.put(this.tempPair, typeface2);
return typeface2;
}
private Typeface getFontFamily(String fontFamily) {
String path;
Typeface defaultTypeface = this.fontFamilies.get(fontFamily);
if (defaultTypeface != null) {
return defaultTypeface;
}
Typeface typeface = null;
FontAssetDelegate fontAssetDelegate = this.delegate;
if (fontAssetDelegate != null) {
typeface = fontAssetDelegate.fetchFont(fontFamily);
}
FontAssetDelegate fontAssetDelegate2 = this.delegate;
if (fontAssetDelegate2 != null && typeface == null && (path = fontAssetDelegate2.getFontPath(fontFamily)) != null) {
typeface = Typeface.createFromAsset(this.assetManager, path);
}
if (typeface == null) {
String path2 = "fonts/" + fontFamily + this.defaultFontFileExtension;
typeface = Typeface.createFromAsset(this.assetManager, path2);
}
this.fontFamilies.put(fontFamily, typeface);
return typeface;
}
private Typeface typefaceForStyle(Typeface typeface, String style) {
int styleInt = 0;
boolean containsItalic = style.contains("Italic");
boolean containsBold = style.contains("Bold");
if (containsItalic && containsBold) {
styleInt = 3;
} else if (containsItalic) {
styleInt = 2;
} else if (containsBold) {
styleInt = 1;
}
if (typeface.getStyle() == styleInt) {
return typeface;
}
return Typeface.create(typeface, styleInt);
}
}
@@ -0,0 +1,113 @@
package com.airbnb.lottie.manager;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.Base64;
import android.view.View;
import com.airbnb.lottie.ImageAssetDelegate;
import com.airbnb.lottie.LottieImageAsset;
import com.airbnb.lottie.utils.Logger;
import com.airbnb.lottie.utils.Utils;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public class ImageAssetManager {
private static final Object bitmapHashLock = new Object();
private final Context context;
private ImageAssetDelegate delegate;
private final Map<String, LottieImageAsset> imageAssets;
private String imagesFolder;
public ImageAssetManager(Drawable.Callback callback, String imagesFolder, ImageAssetDelegate delegate, Map<String, LottieImageAsset> imageAssets) {
this.imagesFolder = imagesFolder;
if (!TextUtils.isEmpty(imagesFolder)) {
if (this.imagesFolder.charAt(r0.length() - 1) != '/') {
this.imagesFolder += '/';
}
}
if (!(callback instanceof View)) {
Logger.warning("LottieDrawable must be inside of a view for images to work.");
this.imageAssets = new HashMap();
this.context = null;
} else {
this.context = ((View) callback).getContext();
this.imageAssets = imageAssets;
setDelegate(delegate);
}
}
public void setDelegate(ImageAssetDelegate assetDelegate) {
this.delegate = assetDelegate;
}
public Bitmap updateBitmap(String id, Bitmap bitmap) {
if (bitmap == null) {
LottieImageAsset asset = this.imageAssets.get(id);
Bitmap ret = asset.getBitmap();
asset.setBitmap(null);
return ret;
}
Bitmap prevBitmap = this.imageAssets.get(id).getBitmap();
putBitmap(id, bitmap);
return prevBitmap;
}
public Bitmap bitmapForId(String id) {
LottieImageAsset asset = this.imageAssets.get(id);
if (asset == null) {
return null;
}
Bitmap bitmap = asset.getBitmap();
if (bitmap != null) {
return bitmap;
}
ImageAssetDelegate imageAssetDelegate = this.delegate;
if (imageAssetDelegate != null) {
Bitmap bitmap2 = imageAssetDelegate.fetchBitmap(asset);
if (bitmap2 != null) {
putBitmap(id, bitmap2);
}
return bitmap2;
}
String filename = asset.getFileName();
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inScaled = true;
opts.inDensity = 160;
if (filename.startsWith("data:") && filename.indexOf("base64,") > 0) {
try {
byte[] data = Base64.decode(filename.substring(filename.indexOf(44) + 1), 0);
return putBitmap(id, BitmapFactory.decodeByteArray(data, 0, data.length, opts));
} catch (IllegalArgumentException e) {
Logger.warning("data URL did not have correct base64 format.", e);
return null;
}
}
try {
if (TextUtils.isEmpty(this.imagesFolder)) {
throw new IllegalStateException("You must set an images folder before loading an image. Set it with LottieComposition#setImagesFolder or LottieDrawable#setImagesFolder");
}
InputStream is = this.context.getAssets().open(this.imagesFolder + filename);
return putBitmap(id, Utils.resizeBitmapIfNeeded(BitmapFactory.decodeStream(is, null, opts), asset.getWidth(), asset.getHeight()));
} catch (IOException e2) {
Logger.warning("Unable to open asset.", e2);
return null;
}
}
public boolean hasSameContext(Context context) {
return (context == null && this.context == null) || this.context.equals(context);
}
private Bitmap putBitmap(String key, Bitmap bitmap) {
synchronized (bitmapHashLock) {
this.imageAssets.get(key).setBitmap(bitmap);
}
return bitmap;
}
}
@@ -0,0 +1,2 @@
package com.airbnb.lottie.manager;
@@ -0,0 +1,46 @@
package com.airbnb.lottie.model;
import android.graphics.PointF;
/* loaded from: classes.dex */
public class CubicCurveData {
private final PointF controlPoint1;
private final PointF controlPoint2;
private final PointF vertex;
public CubicCurveData() {
this.controlPoint1 = new PointF();
this.controlPoint2 = new PointF();
this.vertex = new PointF();
}
public CubicCurveData(PointF controlPoint1, PointF controlPoint2, PointF vertex) {
this.controlPoint1 = controlPoint1;
this.controlPoint2 = controlPoint2;
this.vertex = vertex;
}
public void setControlPoint1(float x, float y) {
this.controlPoint1.set(x, y);
}
public PointF getControlPoint1() {
return this.controlPoint1;
}
public void setControlPoint2(float x, float y) {
this.controlPoint2.set(x, y);
}
public PointF getControlPoint2() {
return this.controlPoint2;
}
public void setVertex(float x, float y) {
this.vertex.set(x, y);
}
public PointF getVertex() {
return this.vertex;
}
}
@@ -0,0 +1,43 @@
package com.airbnb.lottie.model;
/* loaded from: classes.dex */
public class DocumentData {
public final float baselineShift;
public final int color;
public final String fontName;
public final Justification justification;
public final float lineHeight;
public final float size;
public final int strokeColor;
public final boolean strokeOverFill;
public final float strokeWidth;
public final String text;
public final int tracking;
public enum Justification {
LEFT_ALIGN,
RIGHT_ALIGN,
CENTER
}
public DocumentData(String text, String fontName, float size, Justification justification, int tracking, float lineHeight, float baselineShift, int color, int strokeColor, float strokeWidth, boolean strokeOverFill) {
this.text = text;
this.fontName = fontName;
this.size = size;
this.justification = justification;
this.tracking = tracking;
this.lineHeight = lineHeight;
this.baselineShift = baselineShift;
this.color = color;
this.strokeColor = strokeColor;
this.strokeWidth = strokeWidth;
this.strokeOverFill = strokeOverFill;
}
public int hashCode() {
int result = this.text.hashCode();
int result2 = (((((int) ((((result * 31) + this.fontName.hashCode()) * 31) + this.size)) * 31) + this.justification.ordinal()) * 31) + this.tracking;
long temp = Float.floatToRawIntBits(this.lineHeight);
return (((result2 * 31) + ((int) ((temp >>> 32) ^ temp))) * 31) + this.color;
}
}
@@ -0,0 +1,32 @@
package com.airbnb.lottie.model;
/* loaded from: classes.dex */
public class Font {
private final float ascent;
private final String family;
private final String name;
private final String style;
public Font(String family, String name, String style, float ascent) {
this.family = family;
this.name = name;
this.style = style;
this.ascent = ascent;
}
public String getFamily() {
return this.family;
}
public String getName() {
return this.name;
}
public String getStyle() {
return this.style;
}
float getAscent() {
return this.ascent;
}
}
@@ -0,0 +1,48 @@
package com.airbnb.lottie.model;
import com.airbnb.lottie.model.content.ShapeGroup;
import java.util.List;
/* loaded from: classes.dex */
public class FontCharacter {
private final char character;
private final String fontFamily;
private final List<ShapeGroup> shapes;
private final double size;
private final String style;
private final double width;
public static int hashFor(char character, String fontFamily, String style) {
int result = (0 * 31) + character;
return (((result * 31) + fontFamily.hashCode()) * 31) + style.hashCode();
}
public FontCharacter(List<ShapeGroup> shapes, char character, double size, double width, String style, String fontFamily) {
this.shapes = shapes;
this.character = character;
this.size = size;
this.width = width;
this.style = style;
this.fontFamily = fontFamily;
}
public List<ShapeGroup> getShapes() {
return this.shapes;
}
double getSize() {
return this.size;
}
public double getWidth() {
return this.width;
}
String getStyle() {
return this.style;
}
public int hashCode() {
return hashFor(this.character, this.fontFamily, this.style);
}
}
@@ -0,0 +1,106 @@
package com.airbnb.lottie.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/* loaded from: classes.dex */
public class KeyPath {
private final List<String> keys;
private KeyPathElement resolvedElement;
public KeyPath(String... keys) {
this.keys = Arrays.asList(keys);
}
private KeyPath(KeyPath keyPath) {
this.keys = new ArrayList(keyPath.keys);
this.resolvedElement = keyPath.resolvedElement;
}
public KeyPath addKey(String key) {
KeyPath newKeyPath = new KeyPath(this);
newKeyPath.keys.add(key);
return newKeyPath;
}
public KeyPath resolve(KeyPathElement element) {
KeyPath keyPath = new KeyPath(this);
keyPath.resolvedElement = element;
return keyPath;
}
public KeyPathElement getResolvedElement() {
return this.resolvedElement;
}
public boolean matches(String key, int depth) {
if (isContainer(key)) {
return true;
}
if (depth >= this.keys.size()) {
return false;
}
return this.keys.get(depth).equals(key) || this.keys.get(depth).equals("**") || this.keys.get(depth).equals("*");
}
public int incrementDepthBy(String key, int depth) {
if (isContainer(key)) {
return 0;
}
if (this.keys.get(depth).equals("**")) {
return (depth != this.keys.size() - 1 && this.keys.get(depth + 1).equals(key)) ? 2 : 0;
}
return 1;
}
public boolean fullyResolvesTo(String key, int depth) {
if (depth >= this.keys.size()) {
return false;
}
boolean isLastDepth = depth == this.keys.size() - 1;
String keyAtDepth = this.keys.get(depth);
boolean isGlobstar = keyAtDepth.equals("**");
if (!isGlobstar) {
boolean matches = keyAtDepth.equals(key) || keyAtDepth.equals("*");
return (isLastDepth || (depth == this.keys.size() + (-2) && endsWithGlobstar())) && matches;
}
boolean isGlobstarButNextKeyMatches = !isLastDepth && this.keys.get(depth + 1).equals(key);
if (isGlobstarButNextKeyMatches) {
return depth == this.keys.size() + (-2) || (depth == this.keys.size() + (-3) && endsWithGlobstar());
}
if (isLastDepth) {
return true;
}
if (depth + 1 < this.keys.size() - 1) {
return false;
}
return this.keys.get(depth + 1).equals(key);
}
public boolean propagateToChildren(String key, int depth) {
return "__container".equals(key) || depth < this.keys.size() - 1 || this.keys.get(depth).equals("**");
}
private boolean isContainer(String key) {
return "__container".equals(key);
}
private boolean endsWithGlobstar() {
return this.keys.get(r0.size() - 1).equals("**");
}
public String keysToString() {
return this.keys.toString();
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("KeyPath{keys=");
sb.append(this.keys);
sb.append(",resolved=");
sb.append(this.resolvedElement != null);
sb.append('}');
return sb.toString();
}
}
@@ -0,0 +1,11 @@
package com.airbnb.lottie.model;
import com.airbnb.lottie.value.LottieValueCallback;
import java.util.List;
/* loaded from: classes.dex */
public interface KeyPathElement {
<T> void addValueCallback(T t, LottieValueCallback<T> lottieValueCallback);
void resolveKeyPath(KeyPath keyPath, int i, List<KeyPath> list, KeyPath keyPath2);
}
@@ -0,0 +1,39 @@
package com.airbnb.lottie.model;
import androidx.collection.LruCache;
import com.airbnb.lottie.LottieComposition;
/* loaded from: classes.dex */
public class LottieCompositionCache {
private static final LottieCompositionCache INSTANCE = new LottieCompositionCache();
private final LruCache<String, LottieComposition> cache = new LruCache<>(20);
public static LottieCompositionCache getInstance() {
return INSTANCE;
}
LottieCompositionCache() {
}
public LottieComposition get(String cacheKey) {
if (cacheKey == null) {
return null;
}
return this.cache.get(cacheKey);
}
public void put(String cacheKey, LottieComposition composition) {
if (cacheKey == null) {
return;
}
this.cache.put(cacheKey, composition);
}
public void clear() {
this.cache.evictAll();
}
public void resize(int size) {
this.cache.resize(size);
}
}
@@ -0,0 +1,28 @@
package com.airbnb.lottie.model;
/* loaded from: classes.dex */
public class Marker {
private static String CARRIAGE_RETURN = "\r";
public final float durationFrames;
private final String name;
public final float startFrame;
public Marker(String name, float startFrame, float durationFrames) {
this.name = name;
this.durationFrames = durationFrames;
this.startFrame = startFrame;
}
public boolean matchesName(String name) {
if (this.name.equalsIgnoreCase(name)) {
return true;
}
if (this.name.endsWith(CARRIAGE_RETURN)) {
String str = this.name;
if (str.substring(0, str.length() - 1).equalsIgnoreCase(name)) {
return true;
}
}
return false;
}
}
@@ -0,0 +1,37 @@
package com.airbnb.lottie.model;
import androidx.core.util.Pair;
/* loaded from: classes.dex */
public class MutablePair<T> {
T first;
T second;
public void set(T first, T second) {
this.first = first;
this.second = second;
}
public boolean equals(Object o) {
if (!(o instanceof Pair)) {
return false;
}
Pair<?, ?> p = (Pair) o;
return objectsEqual(p.first, this.first) && objectsEqual(p.second, this.second);
}
private static boolean objectsEqual(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}
public int hashCode() {
T t = this.first;
int hashCode = t == null ? 0 : t.hashCode();
T t2 = this.second;
return hashCode ^ (t2 != null ? t2.hashCode() : 0);
}
public String toString() {
return "Pair{" + String.valueOf(this.first) + " " + String.valueOf(this.second) + "}";
}
}
@@ -0,0 +1,33 @@
package com.airbnb.lottie.model.animatable;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.ColorKeyframeAnimation;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatableColorValue extends BaseAnimatableValue<Integer, Integer> {
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ List getKeyframes() {
return super.getKeyframes();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ boolean isStatic() {
return super.isStatic();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
public AnimatableColorValue(List<Keyframe<Integer>> keyframes) {
super((List) keyframes);
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public BaseKeyframeAnimation<Integer, Integer> createAnimation() {
return new ColorKeyframeAnimation(this.keyframes);
}
}
@@ -0,0 +1,37 @@
package com.airbnb.lottie.model.animatable;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.FloatKeyframeAnimation;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatableFloatValue extends BaseAnimatableValue<Float, Float> {
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ List getKeyframes() {
return super.getKeyframes();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ boolean isStatic() {
return super.isStatic();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
AnimatableFloatValue() {
super(Float.valueOf(0.0f));
}
public AnimatableFloatValue(List<Keyframe<Float>> keyframes) {
super((List) keyframes);
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public BaseKeyframeAnimation<Float, Float> createAnimation() {
return new FloatKeyframeAnimation(this.keyframes);
}
}
@@ -0,0 +1,34 @@
package com.airbnb.lottie.model.animatable;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.GradientColorKeyframeAnimation;
import com.airbnb.lottie.model.content.GradientColor;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatableGradientColorValue extends BaseAnimatableValue<GradientColor, GradientColor> {
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ List getKeyframes() {
return super.getKeyframes();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ boolean isStatic() {
return super.isStatic();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
public AnimatableGradientColorValue(List<Keyframe<GradientColor>> keyframes) {
super((List) keyframes);
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public BaseKeyframeAnimation<GradientColor, GradientColor> createAnimation() {
return new GradientColorKeyframeAnimation(this.keyframes);
}
}
@@ -0,0 +1,37 @@
package com.airbnb.lottie.model.animatable;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.IntegerKeyframeAnimation;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatableIntegerValue extends BaseAnimatableValue<Integer, Integer> {
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ List getKeyframes() {
return super.getKeyframes();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ boolean isStatic() {
return super.isStatic();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
public AnimatableIntegerValue() {
super(100);
}
public AnimatableIntegerValue(List<Keyframe<Integer>> keyframes) {
super((List) keyframes);
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public BaseKeyframeAnimation<Integer, Integer> createAnimation() {
return new IntegerKeyframeAnimation(this.keyframes);
}
}
@@ -0,0 +1,40 @@
package com.airbnb.lottie.model.animatable;
import android.graphics.PointF;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.PathKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.PointKeyframeAnimation;
import com.airbnb.lottie.value.Keyframe;
import java.util.Collections;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatablePathValue implements AnimatableValue<PointF, PointF> {
private final List<Keyframe<PointF>> keyframes;
public AnimatablePathValue() {
this.keyframes = Collections.singletonList(new Keyframe(new PointF(0.0f, 0.0f)));
}
public AnimatablePathValue(List<Keyframe<PointF>> keyframes) {
this.keyframes = keyframes;
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public List<Keyframe<PointF>> getKeyframes() {
return this.keyframes;
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public boolean isStatic() {
return this.keyframes.size() == 1 && this.keyframes.get(0).isStatic();
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public BaseKeyframeAnimation<PointF, PointF> createAnimation() {
if (this.keyframes.get(0).isStatic()) {
return new PointKeyframeAnimation(this.keyframes);
}
return new PathKeyframeAnimation(this.keyframes);
}
}
@@ -0,0 +1,34 @@
package com.airbnb.lottie.model.animatable;
import android.graphics.PointF;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.PointKeyframeAnimation;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatablePointValue extends BaseAnimatableValue<PointF, PointF> {
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ List getKeyframes() {
return super.getKeyframes();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ boolean isStatic() {
return super.isStatic();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
public AnimatablePointValue(List<Keyframe<PointF>> keyframes) {
super((List) keyframes);
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public BaseKeyframeAnimation<PointF, PointF> createAnimation() {
return new PointKeyframeAnimation(this.keyframes);
}
}
@@ -0,0 +1,42 @@
package com.airbnb.lottie.model.animatable;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.ScaleKeyframeAnimation;
import com.airbnb.lottie.value.Keyframe;
import com.airbnb.lottie.value.ScaleXY;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatableScaleValue extends BaseAnimatableValue<ScaleXY, ScaleXY> {
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ List getKeyframes() {
return super.getKeyframes();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ boolean isStatic() {
return super.isStatic();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
AnimatableScaleValue() {
this(new ScaleXY(1.0f, 1.0f));
}
public AnimatableScaleValue(ScaleXY value) {
super(value);
}
public AnimatableScaleValue(List<Keyframe<ScaleXY>> keyframes) {
super((List) keyframes);
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public BaseKeyframeAnimation<ScaleXY, ScaleXY> createAnimation() {
return new ScaleKeyframeAnimation(this.keyframes);
}
}
@@ -0,0 +1,35 @@
package com.airbnb.lottie.model.animatable;
import android.graphics.Path;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.ShapeKeyframeAnimation;
import com.airbnb.lottie.model.content.ShapeData;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatableShapeValue extends BaseAnimatableValue<ShapeData, Path> {
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ List getKeyframes() {
return super.getKeyframes();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ boolean isStatic() {
return super.isStatic();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
public AnimatableShapeValue(List<Keyframe<ShapeData>> keyframes) {
super((List) keyframes);
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public BaseKeyframeAnimation<ShapeData, Path> createAnimation() {
return new ShapeKeyframeAnimation(this.keyframes);
}
}
@@ -0,0 +1,33 @@
package com.airbnb.lottie.model.animatable;
import android.graphics.PointF;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.animation.keyframe.SplitDimensionPathKeyframeAnimation;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatableSplitDimensionPathValue implements AnimatableValue<PointF, PointF> {
private final AnimatableFloatValue animatableXDimension;
private final AnimatableFloatValue animatableYDimension;
public AnimatableSplitDimensionPathValue(AnimatableFloatValue animatableXDimension, AnimatableFloatValue animatableYDimension) {
this.animatableXDimension = animatableXDimension;
this.animatableYDimension = animatableYDimension;
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public List<Keyframe<PointF>> getKeyframes() {
throw new UnsupportedOperationException("Cannot call getKeyframes on AnimatableSplitDimensionPathValue.");
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public boolean isStatic() {
return this.animatableXDimension.isStatic() && this.animatableYDimension.isStatic();
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public BaseKeyframeAnimation<PointF, PointF> createAnimation() {
return new SplitDimensionPathKeyframeAnimation(this.animatableXDimension.createAnimation(), this.animatableYDimension.createAnimation());
}
}
@@ -0,0 +1,33 @@
package com.airbnb.lottie.model.animatable;
import com.airbnb.lottie.animation.keyframe.TextKeyframeAnimation;
import com.airbnb.lottie.model.DocumentData;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public class AnimatableTextFrame extends BaseAnimatableValue<DocumentData, DocumentData> {
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ List getKeyframes() {
return super.getKeyframes();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue, com.airbnb.lottie.model.animatable.AnimatableValue
public /* bridge */ /* synthetic */ boolean isStatic() {
return super.isStatic();
}
@Override // com.airbnb.lottie.model.animatable.BaseAnimatableValue
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
public AnimatableTextFrame(List<Keyframe<DocumentData>> keyframes) {
super((List) keyframes);
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public TextKeyframeAnimation createAnimation() {
return new TextKeyframeAnimation(this.keyframes);
}
}
@@ -0,0 +1,16 @@
package com.airbnb.lottie.model.animatable;
/* loaded from: classes.dex */
public class AnimatableTextProperties {
public final AnimatableColorValue color;
public final AnimatableColorValue stroke;
public final AnimatableFloatValue strokeWidth;
public final AnimatableFloatValue tracking;
public AnimatableTextProperties(AnimatableColorValue color, AnimatableColorValue stroke, AnimatableFloatValue strokeWidth, AnimatableFloatValue tracking) {
this.color = color;
this.stroke = stroke;
this.strokeWidth = strokeWidth;
this.tracking = tracking;
}
}
@@ -0,0 +1,83 @@
package com.airbnb.lottie.model.animatable;
import android.graphics.PointF;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.animation.content.ModifierContent;
import com.airbnb.lottie.animation.keyframe.TransformKeyframeAnimation;
import com.airbnb.lottie.model.content.ContentModel;
import com.airbnb.lottie.model.layer.BaseLayer;
/* loaded from: classes.dex */
public class AnimatableTransform implements ModifierContent, ContentModel {
private final AnimatablePathValue anchorPoint;
private final AnimatableFloatValue endOpacity;
private final AnimatableIntegerValue opacity;
private final AnimatableValue<PointF, PointF> position;
private final AnimatableFloatValue rotation;
private final AnimatableScaleValue scale;
private final AnimatableFloatValue skew;
private final AnimatableFloatValue skewAngle;
private final AnimatableFloatValue startOpacity;
public AnimatableTransform() {
this(null, null, null, null, null, null, null, null, null);
}
public AnimatableTransform(AnimatablePathValue anchorPoint, AnimatableValue<PointF, PointF> position, AnimatableScaleValue scale, AnimatableFloatValue rotation, AnimatableIntegerValue opacity, AnimatableFloatValue startOpacity, AnimatableFloatValue endOpacity, AnimatableFloatValue skew, AnimatableFloatValue skewAngle) {
this.anchorPoint = anchorPoint;
this.position = position;
this.scale = scale;
this.rotation = rotation;
this.opacity = opacity;
this.startOpacity = startOpacity;
this.endOpacity = endOpacity;
this.skew = skew;
this.skewAngle = skewAngle;
}
public AnimatablePathValue getAnchorPoint() {
return this.anchorPoint;
}
public AnimatableValue<PointF, PointF> getPosition() {
return this.position;
}
public AnimatableScaleValue getScale() {
return this.scale;
}
public AnimatableFloatValue getRotation() {
return this.rotation;
}
public AnimatableIntegerValue getOpacity() {
return this.opacity;
}
public AnimatableFloatValue getStartOpacity() {
return this.startOpacity;
}
public AnimatableFloatValue getEndOpacity() {
return this.endOpacity;
}
public AnimatableFloatValue getSkew() {
return this.skew;
}
public AnimatableFloatValue getSkewAngle() {
return this.skewAngle;
}
public TransformKeyframeAnimation createAnimation() {
return new TransformKeyframeAnimation(this);
}
@Override // com.airbnb.lottie.model.content.ContentModel
public Content toContent(LottieDrawable drawable, BaseLayer layer) {
return null;
}
}
@@ -0,0 +1,14 @@
package com.airbnb.lottie.model.animatable;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
import com.airbnb.lottie.value.Keyframe;
import java.util.List;
/* loaded from: classes.dex */
public interface AnimatableValue<K, A> {
BaseKeyframeAnimation<K, A> createAnimation();
List<Keyframe<K>> getKeyframes();
boolean isStatic();
}
@@ -0,0 +1,38 @@
package com.airbnb.lottie.model.animatable;
import com.airbnb.lottie.value.Keyframe;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/* loaded from: classes.dex */
abstract class BaseAnimatableValue<V, O> implements AnimatableValue<V, O> {
final List<Keyframe<V>> keyframes;
BaseAnimatableValue(V value) {
this(Collections.singletonList(new Keyframe(value)));
}
BaseAnimatableValue(List<Keyframe<V>> keyframes) {
this.keyframes = keyframes;
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public List<Keyframe<V>> getKeyframes() {
return this.keyframes;
}
@Override // com.airbnb.lottie.model.animatable.AnimatableValue
public boolean isStatic() {
return this.keyframes.isEmpty() || (this.keyframes.size() == 1 && this.keyframes.get(0).isStatic());
}
public String toString() {
StringBuilder sb = new StringBuilder();
if (!this.keyframes.isEmpty()) {
sb.append("values=");
sb.append(Arrays.toString(this.keyframes.toArray()));
}
return sb.toString();
}
}
@@ -0,0 +1,2 @@
package com.airbnb.lottie.model.animatable;
@@ -0,0 +1,51 @@
package com.airbnb.lottie.model.content;
import android.graphics.PointF;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.animation.content.EllipseContent;
import com.airbnb.lottie.model.animatable.AnimatablePointValue;
import com.airbnb.lottie.model.animatable.AnimatableValue;
import com.airbnb.lottie.model.layer.BaseLayer;
/* loaded from: classes.dex */
public class CircleShape implements ContentModel {
private final boolean hidden;
private final boolean isReversed;
private final String name;
private final AnimatableValue<PointF, PointF> position;
private final AnimatablePointValue size;
public CircleShape(String name, AnimatableValue<PointF, PointF> position, AnimatablePointValue size, boolean isReversed, boolean hidden) {
this.name = name;
this.position = position;
this.size = size;
this.isReversed = isReversed;
this.hidden = hidden;
}
@Override // com.airbnb.lottie.model.content.ContentModel
public Content toContent(LottieDrawable drawable, BaseLayer layer) {
return new EllipseContent(drawable, layer, this);
}
public String getName() {
return this.name;
}
public AnimatableValue<PointF, PointF> getPosition() {
return this.position;
}
public AnimatablePointValue getSize() {
return this.size;
}
public boolean isReversed() {
return this.isReversed;
}
public boolean isHidden() {
return this.hidden;
}
}
@@ -0,0 +1,10 @@
package com.airbnb.lottie.model.content;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.model.layer.BaseLayer;
/* loaded from: classes.dex */
public interface ContentModel {
Content toContent(LottieDrawable lottieDrawable, BaseLayer baseLayer);
}
@@ -0,0 +1,37 @@
package com.airbnb.lottie.model.content;
import com.airbnb.lottie.utils.GammaEvaluator;
import com.airbnb.lottie.utils.MiscUtils;
/* loaded from: classes.dex */
public class GradientColor {
private final int[] colors;
private final float[] positions;
public GradientColor(float[] positions, int[] colors) {
this.positions = positions;
this.colors = colors;
}
public float[] getPositions() {
return this.positions;
}
public int[] getColors() {
return this.colors;
}
public int getSize() {
return this.colors.length;
}
public void lerp(GradientColor gc1, GradientColor gc2, float progress) {
if (gc1.colors.length != gc2.colors.length) {
throw new IllegalArgumentException("Cannot interpolate between gradients. Lengths vary (" + gc1.colors.length + " vs " + gc2.colors.length + ")");
}
for (int i = 0; i < gc1.colors.length; i++) {
this.positions[i] = MiscUtils.lerp(gc1.positions[i], gc2.positions[i], progress);
this.colors[i] = GammaEvaluator.evaluate(progress, gc1.colors[i], gc2.colors[i]);
}
}
}
@@ -0,0 +1,83 @@
package com.airbnb.lottie.model.content;
import android.graphics.Path;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.animation.content.GradientFillContent;
import com.airbnb.lottie.model.animatable.AnimatableFloatValue;
import com.airbnb.lottie.model.animatable.AnimatableGradientColorValue;
import com.airbnb.lottie.model.animatable.AnimatableIntegerValue;
import com.airbnb.lottie.model.animatable.AnimatablePointValue;
import com.airbnb.lottie.model.layer.BaseLayer;
/* loaded from: classes.dex */
public class GradientFill implements ContentModel {
private final AnimatablePointValue endPoint;
private final Path.FillType fillType;
private final AnimatableGradientColorValue gradientColor;
private final GradientType gradientType;
private final boolean hidden;
private final AnimatableFloatValue highlightAngle;
private final AnimatableFloatValue highlightLength;
private final String name;
private final AnimatableIntegerValue opacity;
private final AnimatablePointValue startPoint;
public GradientFill(String name, GradientType gradientType, Path.FillType fillType, AnimatableGradientColorValue gradientColor, AnimatableIntegerValue opacity, AnimatablePointValue startPoint, AnimatablePointValue endPoint, AnimatableFloatValue highlightLength, AnimatableFloatValue highlightAngle, boolean hidden) {
this.gradientType = gradientType;
this.fillType = fillType;
this.gradientColor = gradientColor;
this.opacity = opacity;
this.startPoint = startPoint;
this.endPoint = endPoint;
this.name = name;
this.highlightLength = highlightLength;
this.highlightAngle = highlightAngle;
this.hidden = hidden;
}
public String getName() {
return this.name;
}
public GradientType getGradientType() {
return this.gradientType;
}
public Path.FillType getFillType() {
return this.fillType;
}
public AnimatableGradientColorValue getGradientColor() {
return this.gradientColor;
}
public AnimatableIntegerValue getOpacity() {
return this.opacity;
}
public AnimatablePointValue getStartPoint() {
return this.startPoint;
}
public AnimatablePointValue getEndPoint() {
return this.endPoint;
}
AnimatableFloatValue getHighlightLength() {
return this.highlightLength;
}
AnimatableFloatValue getHighlightAngle() {
return this.highlightAngle;
}
public boolean isHidden() {
return this.hidden;
}
@Override // com.airbnb.lottie.model.content.ContentModel
public Content toContent(LottieDrawable drawable, BaseLayer layer) {
return new GradientFillContent(drawable, layer, this);
}
}
@@ -0,0 +1,102 @@
package com.airbnb.lottie.model.content;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.animation.content.GradientStrokeContent;
import com.airbnb.lottie.model.animatable.AnimatableFloatValue;
import com.airbnb.lottie.model.animatable.AnimatableGradientColorValue;
import com.airbnb.lottie.model.animatable.AnimatableIntegerValue;
import com.airbnb.lottie.model.animatable.AnimatablePointValue;
import com.airbnb.lottie.model.content.ShapeStroke;
import com.airbnb.lottie.model.layer.BaseLayer;
import java.util.List;
/* loaded from: classes.dex */
public class GradientStroke implements ContentModel {
private final ShapeStroke.LineCapType capType;
private final AnimatableFloatValue dashOffset;
private final AnimatablePointValue endPoint;
private final AnimatableGradientColorValue gradientColor;
private final GradientType gradientType;
private final boolean hidden;
private final ShapeStroke.LineJoinType joinType;
private final List<AnimatableFloatValue> lineDashPattern;
private final float miterLimit;
private final String name;
private final AnimatableIntegerValue opacity;
private final AnimatablePointValue startPoint;
private final AnimatableFloatValue width;
public GradientStroke(String name, GradientType gradientType, AnimatableGradientColorValue gradientColor, AnimatableIntegerValue opacity, AnimatablePointValue startPoint, AnimatablePointValue endPoint, AnimatableFloatValue width, ShapeStroke.LineCapType capType, ShapeStroke.LineJoinType joinType, float miterLimit, List<AnimatableFloatValue> lineDashPattern, AnimatableFloatValue dashOffset, boolean hidden) {
this.name = name;
this.gradientType = gradientType;
this.gradientColor = gradientColor;
this.opacity = opacity;
this.startPoint = startPoint;
this.endPoint = endPoint;
this.width = width;
this.capType = capType;
this.joinType = joinType;
this.miterLimit = miterLimit;
this.lineDashPattern = lineDashPattern;
this.dashOffset = dashOffset;
this.hidden = hidden;
}
public String getName() {
return this.name;
}
public GradientType getGradientType() {
return this.gradientType;
}
public AnimatableGradientColorValue getGradientColor() {
return this.gradientColor;
}
public AnimatableIntegerValue getOpacity() {
return this.opacity;
}
public AnimatablePointValue getStartPoint() {
return this.startPoint;
}
public AnimatablePointValue getEndPoint() {
return this.endPoint;
}
public AnimatableFloatValue getWidth() {
return this.width;
}
public ShapeStroke.LineCapType getCapType() {
return this.capType;
}
public ShapeStroke.LineJoinType getJoinType() {
return this.joinType;
}
public List<AnimatableFloatValue> getLineDashPattern() {
return this.lineDashPattern;
}
public AnimatableFloatValue getDashOffset() {
return this.dashOffset;
}
public float getMiterLimit() {
return this.miterLimit;
}
public boolean isHidden() {
return this.hidden;
}
@Override // com.airbnb.lottie.model.content.ContentModel
public Content toContent(LottieDrawable drawable, BaseLayer layer) {
return new GradientStrokeContent(drawable, layer, this);
}
}
@@ -0,0 +1,7 @@
package com.airbnb.lottie.model.content;
/* loaded from: classes.dex */
public enum GradientType {
LINEAR,
RADIAL
}
@@ -0,0 +1,42 @@
package com.airbnb.lottie.model.content;
import com.airbnb.lottie.model.animatable.AnimatableIntegerValue;
import com.airbnb.lottie.model.animatable.AnimatableShapeValue;
/* loaded from: classes.dex */
public class Mask {
private final boolean inverted;
private final MaskMode maskMode;
private final AnimatableShapeValue maskPath;
private final AnimatableIntegerValue opacity;
public enum MaskMode {
MASK_MODE_ADD,
MASK_MODE_SUBTRACT,
MASK_MODE_INTERSECT,
MASK_MODE_NONE
}
public Mask(MaskMode maskMode, AnimatableShapeValue maskPath, AnimatableIntegerValue opacity, boolean inverted) {
this.maskMode = maskMode;
this.maskPath = maskPath;
this.opacity = opacity;
this.inverted = inverted;
}
public MaskMode getMaskMode() {
return this.maskMode;
}
public AnimatableShapeValue getMaskPath() {
return this.maskPath;
}
public AnimatableIntegerValue getOpacity() {
return this.opacity;
}
public boolean isInverted() {
return this.inverted;
}
}
@@ -0,0 +1,70 @@
package com.airbnb.lottie.model.content;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.animation.content.MergePathsContent;
import com.airbnb.lottie.model.layer.BaseLayer;
import com.airbnb.lottie.utils.Logger;
/* loaded from: classes.dex */
public class MergePaths implements ContentModel {
private final boolean hidden;
private final MergePathsMode mode;
private final String name;
public enum MergePathsMode {
MERGE,
ADD,
SUBTRACT,
INTERSECT,
EXCLUDE_INTERSECTIONS;
public static MergePathsMode forId(int id) {
switch (id) {
case 1:
return MERGE;
case 2:
return ADD;
case 3:
return SUBTRACT;
case 4:
return INTERSECT;
case 5:
return EXCLUDE_INTERSECTIONS;
default:
return MERGE;
}
}
}
public MergePaths(String name, MergePathsMode mode, boolean hidden) {
this.name = name;
this.mode = mode;
this.hidden = hidden;
}
public String getName() {
return this.name;
}
public MergePathsMode getMode() {
return this.mode;
}
public boolean isHidden() {
return this.hidden;
}
@Override // com.airbnb.lottie.model.content.ContentModel
public Content toContent(LottieDrawable drawable, BaseLayer layer) {
if (!drawable.enableMergePathsForKitKatAndAbove()) {
Logger.warning("Animation contains merge paths but they are disabled.");
return null;
}
return new MergePathsContent(this);
}
public String toString() {
return "MergePaths{mode=" + this.mode + '}';
}
}
@@ -0,0 +1,101 @@
package com.airbnb.lottie.model.content;
import android.graphics.PointF;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.animation.content.PolystarContent;
import com.airbnb.lottie.model.animatable.AnimatableFloatValue;
import com.airbnb.lottie.model.animatable.AnimatableValue;
import com.airbnb.lottie.model.layer.BaseLayer;
/* loaded from: classes.dex */
public class PolystarShape implements ContentModel {
private final boolean hidden;
private final AnimatableFloatValue innerRadius;
private final AnimatableFloatValue innerRoundedness;
private final String name;
private final AnimatableFloatValue outerRadius;
private final AnimatableFloatValue outerRoundedness;
private final AnimatableFloatValue points;
private final AnimatableValue<PointF, PointF> position;
private final AnimatableFloatValue rotation;
private final Type type;
public enum Type {
STAR(1),
POLYGON(2);
private final int value;
Type(int value) {
this.value = value;
}
public static Type forValue(int value) {
for (Type type : values()) {
if (type.value == value) {
return type;
}
}
return null;
}
}
public PolystarShape(String name, Type type, AnimatableFloatValue points, AnimatableValue<PointF, PointF> position, AnimatableFloatValue rotation, AnimatableFloatValue innerRadius, AnimatableFloatValue outerRadius, AnimatableFloatValue innerRoundedness, AnimatableFloatValue outerRoundedness, boolean hidden) {
this.name = name;
this.type = type;
this.points = points;
this.position = position;
this.rotation = rotation;
this.innerRadius = innerRadius;
this.outerRadius = outerRadius;
this.innerRoundedness = innerRoundedness;
this.outerRoundedness = outerRoundedness;
this.hidden = hidden;
}
public String getName() {
return this.name;
}
public Type getType() {
return this.type;
}
public AnimatableFloatValue getPoints() {
return this.points;
}
public AnimatableValue<PointF, PointF> getPosition() {
return this.position;
}
public AnimatableFloatValue getRotation() {
return this.rotation;
}
public AnimatableFloatValue getInnerRadius() {
return this.innerRadius;
}
public AnimatableFloatValue getOuterRadius() {
return this.outerRadius;
}
public AnimatableFloatValue getInnerRoundedness() {
return this.innerRoundedness;
}
public AnimatableFloatValue getOuterRoundedness() {
return this.outerRoundedness;
}
public boolean isHidden() {
return this.hidden;
}
@Override // com.airbnb.lottie.model.content.ContentModel
public Content toContent(LottieDrawable drawable, BaseLayer layer) {
return new PolystarContent(drawable, layer, this);
}
}
@@ -0,0 +1,56 @@
package com.airbnb.lottie.model.content;
import android.graphics.PointF;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.animation.content.RectangleContent;
import com.airbnb.lottie.model.animatable.AnimatableFloatValue;
import com.airbnb.lottie.model.animatable.AnimatablePointValue;
import com.airbnb.lottie.model.animatable.AnimatableValue;
import com.airbnb.lottie.model.layer.BaseLayer;
/* loaded from: classes.dex */
public class RectangleShape implements ContentModel {
private final AnimatableFloatValue cornerRadius;
private final boolean hidden;
private final String name;
private final AnimatableValue<PointF, PointF> position;
private final AnimatablePointValue size;
public RectangleShape(String name, AnimatableValue<PointF, PointF> position, AnimatablePointValue size, AnimatableFloatValue cornerRadius, boolean hidden) {
this.name = name;
this.position = position;
this.size = size;
this.cornerRadius = cornerRadius;
this.hidden = hidden;
}
public String getName() {
return this.name;
}
public AnimatableFloatValue getCornerRadius() {
return this.cornerRadius;
}
public AnimatablePointValue getSize() {
return this.size;
}
public AnimatableValue<PointF, PointF> getPosition() {
return this.position;
}
public boolean isHidden() {
return this.hidden;
}
@Override // com.airbnb.lottie.model.content.ContentModel
public Content toContent(LottieDrawable drawable, BaseLayer layer) {
return new RectangleContent(drawable, layer, this);
}
public String toString() {
return "RectangleShape{position=" + this.position + ", size=" + this.size + '}';
}
}
@@ -0,0 +1,50 @@
package com.airbnb.lottie.model.content;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.animation.content.RepeaterContent;
import com.airbnb.lottie.model.animatable.AnimatableFloatValue;
import com.airbnb.lottie.model.animatable.AnimatableTransform;
import com.airbnb.lottie.model.layer.BaseLayer;
/* loaded from: classes.dex */
public class Repeater implements ContentModel {
private final AnimatableFloatValue copies;
private final boolean hidden;
private final String name;
private final AnimatableFloatValue offset;
private final AnimatableTransform transform;
public Repeater(String name, AnimatableFloatValue copies, AnimatableFloatValue offset, AnimatableTransform transform, boolean hidden) {
this.name = name;
this.copies = copies;
this.offset = offset;
this.transform = transform;
this.hidden = hidden;
}
public String getName() {
return this.name;
}
public AnimatableFloatValue getCopies() {
return this.copies;
}
public AnimatableFloatValue getOffset() {
return this.offset;
}
public AnimatableTransform getTransform() {
return this.transform;
}
public boolean isHidden() {
return this.hidden;
}
@Override // com.airbnb.lottie.model.content.ContentModel
public Content toContent(LottieDrawable drawable, BaseLayer layer) {
return new RepeaterContent(drawable, layer, this);
}
}

Some files were not shown because too many files have changed in this diff Show More