Reformated lottie Java code
diff --git a/lottie/src/main/java/com/airbnb/lottie/ImageAssetDelegate.java b/lottie/src/main/java/com/airbnb/lottie/ImageAssetDelegate.java index 2335ae2..659a014 100644 --- a/lottie/src/main/java/com/airbnb/lottie/ImageAssetDelegate.java +++ b/lottie/src/main/java/com/airbnb/lottie/ImageAssetDelegate.java
@@ -1,6 +1,7 @@ package com.airbnb.lottie; import android.graphics.Bitmap; + import androidx.annotation.Nullable; /**
diff --git a/lottie/src/main/java/com/airbnb/lottie/L.java b/lottie/src/main/java/com/airbnb/lottie/L.java index e0365e6..7dbc35c 100644 --- a/lottie/src/main/java/com/airbnb/lottie/L.java +++ b/lottie/src/main/java/com/airbnb/lottie/L.java
@@ -2,18 +2,18 @@ import android.content.Context; -import com.airbnb.lottie.network.LottieNetworkCacheProvider; +import androidx.annotation.NonNull; +import androidx.annotation.RestrictTo; +import androidx.core.os.TraceCompat; + import com.airbnb.lottie.network.DefaultLottieNetworkFetcher; +import com.airbnb.lottie.network.LottieNetworkCacheProvider; import com.airbnb.lottie.network.LottieNetworkFetcher; import com.airbnb.lottie.network.NetworkCache; import com.airbnb.lottie.network.NetworkFetcher; import java.io.File; -import androidx.annotation.NonNull; -import androidx.annotation.RestrictTo; -import androidx.core.os.TraceCompat; - @RestrictTo(RestrictTo.Scope.LIBRARY) public class L {
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java b/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java index eef6012..a34478f 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java
@@ -1,5 +1,7 @@ package com.airbnb.lottie; +import static com.airbnb.lottie.RenderMode.HARDWARE; + import android.animation.Animator; import android.animation.ValueAnimator; import android.content.Context; @@ -43,8 +45,6 @@ import java.util.Set; import java.util.concurrent.Callable; -import static com.airbnb.lottie.RenderMode.HARDWARE; - /** * This view will load, deserialize, and display an After Effects animation exported with * bodymovin (https://github.com/bodymovin/bodymovin). @@ -52,12 +52,12 @@ * You may set the animation in one of two ways: * 1) Attrs: {@link R.styleable#LottieAnimationView_lottie_fileName} * 2) Programmatically: - * {@link #setAnimation(String)} - * {@link #setAnimation(int)} - * {@link #setAnimation(InputStream, String)} - * {@link #setAnimationFromJson(String, String)} - * {@link #setAnimationFromUrl(String)} - * {@link #setComposition(LottieComposition)} + * {@link #setAnimation(String)} + * {@link #setAnimation(int)} + * {@link #setAnimation(InputStream, String)} + * {@link #setAnimationFromJson(String, String)} + * {@link #setAnimationFromUrl(String)} + * {@link #setComposition(LottieComposition)} * <p> * You can set a default cache strategy with {@link R.attr#lottie_cacheComposition}. * <p> @@ -127,7 +127,9 @@ private int buildDrawingCacheDepth = 0; @Nullable private LottieTask<LottieComposition> compositionTask; - /** Can be null because it is created async */ + /** + * Can be null because it is created async + */ @Nullable private LottieComposition composition; public LottieAnimationView(Context context) { @@ -362,7 +364,7 @@ /** * Allows ignoring system animations settings, therefore allowing animations to run even if they are disabled. - * + * <p> * Defaults to false. * * @param ignore if true animations will run even when they are disabled in the system settings. @@ -373,7 +375,7 @@ /** * Enable this to get merge path support for devices running KitKat (19) and above. - * + * <p> * Merge paths currently don't work if the the operand shape is entirely contained within the * first shape. If you need to cut out one shape from another shape, use an even-odd fill type * instead of using merge paths. @@ -392,9 +394,9 @@ /** * If set to true, all future compositions that are set will be cached so that they don't need to be parsed * next time they are loaded. This won't apply to compositions that have already been loaded. - * + * <p> * Defaults to true. - * + * <p> * {@link R.attr#lottie_cacheComposition} */ public void setCacheComposition(boolean cacheComposition) { @@ -404,7 +406,7 @@ /** * Enable this to debug slow animations by outlining masks and mattes. The performance overhead of the masks and mattes will * be proportional to the surface area of all of the masks/mattes combined. - * + * <p> * DO NOT leave this enabled in production. */ public void setOutlineMasksAndMattes(boolean outline) { @@ -485,13 +487,14 @@ } /** - * Load a lottie animation from a url. The url can be a json file or a zip file. Use a zip file if you have images. Simply zip them together and lottie + * Load a lottie animation from a url. The url can be a json file or a zip file. Use a zip file if you have images. Simply zip them together and + * lottie * will unzip and link the images automatically. - * + * <p> * Under the hood, Lottie uses Java HttpURLConnection because it doesn't require any transitive networking dependencies. It will download the file * to the application cache under a temporary name. If the file successfully parses to a composition, it will rename the temporary file to one that * can be accessed immediately for subsequent requests. If the file does not parse to a composition, the temporary file will be deleted. - * + * <p> * You can replace the default network stack or cache handling with a global {@link LottieConfig} * * @see LottieConfig.Builder @@ -504,13 +507,14 @@ } /** - * Load a lottie animation from a url. The url can be a json file or a zip file. Use a zip file if you have images. Simply zip them together and lottie + * Load a lottie animation from a url. The url can be a json file or a zip file. Use a zip file if you have images. Simply zip them together and + * lottie * will unzip and link the images automatically. - * + * <p> * Under the hood, Lottie uses Java HttpURLConnection because it doesn't require any transitive networking dependencies. It will download the file * to the application cache under a temporary name. If the file successfully parses to a composition, it will rename the temporary file to one that * can be accessed immediately for subsequent requests. If the file does not parse to a composition, the temporary file will be deleted. - * + * <p> * You can replace the default network stack or cache handling with a global {@link LottieConfig} * * @see LottieConfig.Builder @@ -524,15 +528,15 @@ /** * Set a default failure listener that will be called if any of the setAnimation APIs fail for any reason. * This can be used to replace the default behavior. - * + * <p> * The default behavior will log any network errors and rethrow all other exceptions. - * + * <p> * If you are loading an animation from the network, errors may occur if your user has no internet. * You can use this listener to retry the download or you can have it default to an error drawable * with {@link #setFallbackResource(int)}. - * + * <p> * Unless you are using {@link #setAnimationFromUrl(String)}, errors are unexpected. - * + * <p> * Set the listener to null to revert to the default behavior. */ public void setFailureListener(@Nullable LottieListener<Throwable> failureListener) { @@ -543,7 +547,7 @@ * Set a drawable that will be rendered if the LottieComposition fails to load for any reason. * Unless you are using {@link #setAnimationFromUrl(String)}, this is an unexpected error and * you should handle it with {@link #setFailureListener(LottieListener)}. - * + * <p> * If this is a network animation, you may use this to show an error to the user or * you can use a failure listener to retry the download. */ @@ -555,8 +559,8 @@ clearComposition(); cancelLoaderTask(); this.compositionTask = compositionTask - .addListener(loadedListener) - .addFailureListener(wrappedFailureListener); + .addListener(loadedListener) + .addFailureListener(wrappedFailureListener); } private void cancelLoaderTask() { @@ -599,7 +603,7 @@ requestLayout(); for (LottieOnCompositionLoadedListener lottieOnCompositionLoadedListener : lottieOnCompositionLoadedListeners) { - lottieOnCompositionLoadedListener.onCompositionLoaded(composition); + lottieOnCompositionLoadedListener.onCompositionLoaded(composition); } } @@ -674,7 +678,7 @@ /** * Sets the maximum frame that the animation will end at when playing or looping. - * + * <p> * The value will be clamped to the composition bounds. For example, setting Integer.MAX_VALUE would result in the same * thing as composition.endFrame. */ @@ -698,6 +702,7 @@ /** * Sets the minimum frame to the start time of the specified marker. + * * @throws IllegalArgumentException if the marker is not found. */ public void setMinFrame(String markerName) { @@ -706,6 +711,7 @@ /** * Sets the maximum frame to the start time + duration of the specified marker. + * * @throws IllegalArgumentException if the marker is not found. */ public void setMaxFrame(String markerName) { @@ -715,6 +721,7 @@ /** * Sets the minimum and maximum frame to the start time and start time + duration * of the specified marker. + * * @throws IllegalArgumentException if the marker is not found. */ public void setMinAndMaxFrame(String markerName) { @@ -753,6 +760,7 @@ /** * Reverses the current animation speed. This does NOT play the animation. + * * @see #setSpeed(float) * @see #playAnimation() * @see #resumeAnimation() @@ -868,10 +876,10 @@ * If you use image assets, you must explicitly specify the folder in assets/ in which they are * located because bodymovin uses the name filenames across all compositions (img_#). * Do NOT rename the images themselves. - * + * <p> * If your images are located in src/main/assets/airbnb_loader/ then call * `setImageAssetsFolder("airbnb_loader/");`. - * + * <p> * Be wary if you are using many images, however. Lottie is designed to work with vector shapes * from After Effects. If your images look like they could be represented with vector shapes, * see if it is possible to convert them to shape layers and re-export your animation. Check @@ -902,7 +910,7 @@ * Use this if you can't bundle images with your app. This may be useful if you download the * animations from the network or have the images saved to an SD Card. In that case, Lottie * will defer the loading of the bitmap to this delegate. - * + * <p> * Be wary if you are using many images, however. Lottie is designed to work with vector shapes * from After Effects. If your images look like they could be represented with vector shapes, * see if it is possible to convert them to shape layers and re-export your animation. Check @@ -930,7 +938,7 @@ /** * Takes a {@link KeyPath}, potentially with wildcards or globstars and resolve it to a list of * zero or more actual {@link KeyPath Keypaths} that exist in the current animation. - * + * <p> * If you want to set value callbacks for any of these values, it is recommended to use the * returned {@link KeyPath} objects because they will be internally resolved to their content * and won't trigger a tree walk of the animation contents when applied. @@ -942,7 +950,7 @@ /** * Add a property callback for the specified {@link KeyPath}. This {@link KeyPath} can resolve * to multiple contents. In that case, the callback's value will apply to all of them. - * + * <p> * Internally, this will check if the {@link KeyPath} has already been resolved with * {@link #resolveKeyPath(KeyPath)} and will resolve it if it hasn't. */ @@ -967,12 +975,12 @@ /** * Set the scale on the current composition. The only cost of this function is re-rendering the * current frame so you may call it frequent to scale something up or down. - * + * <p> * The smaller the animation is, the better the performance will be. You may find that scaling an * animation down then rendering it in a larger ImageView and letting ImageView scale it back up * with a scaleType such as centerInside will yield better performance with little perceivable * quality loss. - * + * <p> * You can also use a fixed view width/height in conjunction with the normal ImageView * scaleTypes centerCrop and centerInside. */ @@ -1052,10 +1060,10 @@ * If you are experiencing a device specific crash that happens during drawing, you can set this to true * for those devices. If set to true, draw will be wrapped with a try/catch which will cause Lottie to * render an empty frame rather than crash your app. - * + * <p> * Ideally, you will never need this and the vast majority of apps and animations won't. However, you may use * this for very specific cases if absolutely necessary. - * + * <p> * There is no XML attr for this because it should be set programmatically and only for specific devices that * are known to be problematic. */ @@ -1088,10 +1096,10 @@ * Lottie defaults to Automatic which will use hardware acceleration unless: * 1) There are dash paths and the device is pre-Pie. * 2) There are more than 4 masks and mattes and the device is pre-Pie. - * Hardware acceleration is generally faster for those devices unless - * there are many large mattes and masks in which case there is a ton - * of GPU uploadTexture thrashing which makes it much slower. - * + * Hardware acceleration is generally faster for those devices unless + * there are many large mattes and masks in which case there is a ton + * of GPU uploadTexture thrashing which makes it much slower. + * <p> * In most cases, hardware rendering will be faster, even if you have mattes and masks. * However, if you have multiple mattes and masks (especially large ones) then you * should test both render modes. You should also test on pre-Pie and Pie+ devices
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieComposition.java b/lottie/src/main/java/com/airbnb/lottie/LottieComposition.java index a613902..6dfd5fa 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieComposition.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieComposition.java
@@ -3,6 +3,7 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Rect; + import androidx.annotation.Nullable; import androidx.annotation.RawRes; import androidx.annotation.RestrictTo; @@ -29,9 +30,9 @@ /** * After Effects/Bodymovin composition model. This is the serialized model from which the * animation will be created. - * + * <p> * To create one, use {@link LottieCompositionFactory}. - * + * <p> * It can be used with a {@link com.airbnb.lottie.LottieAnimationView} or * {@link com.airbnb.lottie.LottieDrawable}. */ @@ -41,7 +42,9 @@ private final HashSet<String> warnings = new HashSet<>(); private Map<String, List<Layer>> precomps; private Map<String, LottieImageAsset> images; - /** Map of font names to fonts */ + /** + * Map of font names to fonts + */ private Map<String, Font> fonts; private List<Marker> markers; private SparseArrayCompat<FontCharacter> characters; @@ -234,10 +237,10 @@ */ @SuppressWarnings("deprecation") @Deprecated - public static Cancellable fromRawFile(Context context, @RawRes int resId, OnCompositionLoadedListener l) { - ListenerAdapter listener = new ListenerAdapter(l); - LottieCompositionFactory.fromRawRes(context, resId).addListener(listener); - return listener; + public static Cancellable fromRawFile(Context context, @RawRes int resId, OnCompositionLoadedListener l) { + ListenerAdapter listener = new ListenerAdapter(l); + LottieCompositionFactory.fromRawRes(context, resId).addListener(listener); + return listener; } /**
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java b/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java index b263543..c2ee26f 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java
@@ -1,11 +1,19 @@ package com.airbnb.lottie; +import static com.airbnb.lottie.utils.Utils.closeQuietly; +import static okio.Okio.buffer; +import static okio.Okio.source; + import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import androidx.annotation.Nullable; +import androidx.annotation.RawRes; +import androidx.annotation.WorkerThread; + import com.airbnb.lottie.model.LottieCompositionCache; import com.airbnb.lottie.parser.LottieCompositionMoshiParser; import com.airbnb.lottie.parser.moshi.JsonReader; @@ -24,16 +32,9 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import androidx.annotation.Nullable; -import androidx.annotation.RawRes; -import androidx.annotation.WorkerThread; import okio.BufferedSource; import okio.Okio; -import static com.airbnb.lottie.utils.Utils.closeQuietly; -import static okio.Okio.buffer; -import static okio.Okio.source; - /** * Helpers to create or cache a LottieComposition. * <p> @@ -54,7 +55,7 @@ * reference magic bytes for zip compressed files. * useful to determine if an InputStream is a zip file or not */ - private static final byte[] MAGIC = new byte[] { 0x50, 0x4b, 0x03, 0x04 }; + private static final byte[] MAGIC = new byte[]{0x50, 0x4b, 0x03, 0x04}; private LottieCompositionFactory() { @@ -486,9 +487,10 @@ try { BufferedSource peek = inputSource.peek(); - for (byte b: MAGIC) { - if(peek.readByte() != b) + for (byte b : MAGIC) { + if (peek.readByte() != b) { return false; + } } peek.close(); return true;
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieConfig.java b/lottie/src/main/java/com/airbnb/lottie/LottieConfig.java index e82e868..6a6fa8d 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieConfig.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieConfig.java
@@ -1,16 +1,16 @@ package com.airbnb.lottie; -import com.airbnb.lottie.network.LottieNetworkFetcher; -import com.airbnb.lottie.network.LottieNetworkCacheProvider; - -import java.io.File; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.airbnb.lottie.network.LottieNetworkCacheProvider; +import com.airbnb.lottie.network.LottieNetworkFetcher; + +import java.io.File; + /** * Class for custom library configuration. - * + * <p> * This should be constructed with {@link LottieConfig.Builder} */ public class LottieConfig {
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java b/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java index ce5cd47..8bfecd9 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java
@@ -16,6 +16,14 @@ import android.view.View; import android.widget.ImageView; +import androidx.annotation.FloatRange; +import androidx.annotation.IntDef; +import androidx.annotation.IntRange; +import androidx.annotation.MainThread; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; + import com.airbnb.lottie.manager.FontAssetManager; import com.airbnb.lottie.manager.ImageAssetManager; import com.airbnb.lottie.model.KeyPath; @@ -36,14 +44,6 @@ import java.util.Iterator; import java.util.List; -import androidx.annotation.FloatRange; -import androidx.annotation.IntDef; -import androidx.annotation.IntRange; -import androidx.annotation.MainThread; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.RequiresApi; - /** * This can be used to show an lottie animation in any place that would normally take a drawable. * @@ -67,7 +67,7 @@ private boolean safeMode = false; private final ArrayList<LazyCompositionTask> lazyCompositionTasks = new ArrayList<>(); - private final ValueAnimator.AnimatorUpdateListener progressUpdateListener = new ValueAnimator.AnimatorUpdateListener() { + private final ValueAnimator.AnimatorUpdateListener progressUpdateListener = new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { if (compositionLayer != null) { @@ -250,7 +250,7 @@ /** * Enable this to debug slow animations by outlining masks and mattes. The performance overhead of the masks and mattes will * be proportional to the surface area of all of the masks/mattes combined. - * + * <p> * DO NOT leave this enabled in production. */ public void setOutlineMasksAndMattes(boolean outline) { @@ -330,7 +330,7 @@ * If you are experiencing a device specific crash that happens during drawing, you can set this to true * for those devices. If set to true, draw will be wrapped with a try/catch which will cause Lottie to * render an empty frame rather than crash your app. - * + * <p> * Ideally, you will never need this and the vast majority of apps and animations won't. However, you may use * this for very specific cases if absolutely necessary. */ @@ -530,7 +530,7 @@ /** * Sets the maximum frame that the animation will end at when playing or looping. - * + * <p> * The value will be clamped to the composition bounds. For example, setting Integer.MAX_VALUE would result in the same * thing as composition.endFrame. */ @@ -572,6 +572,7 @@ /** * Sets the minimum frame to the start time of the specified marker. + * * @throws IllegalArgumentException if the marker is not found. */ public void setMinFrame(final String markerName) { @@ -593,6 +594,7 @@ /** * Sets the maximum frame to the start time + duration of the specified marker. + * * @throws IllegalArgumentException if the marker is not found. */ public void setMaxFrame(final String markerName) { @@ -615,6 +617,7 @@ /** * Sets the minimum and maximum frame to the start time and start time + duration * of the specified marker. + * * @throws IllegalArgumentException if the marker is not found. */ public void setMinAndMaxFrame(final String markerName) { @@ -758,10 +761,14 @@ } @RequiresApi(api = Build.VERSION_CODES.KITKAT) - public void addAnimatorPauseListener(Animator.AnimatorPauseListener listener) { animator.addPauseListener(listener); } + public void addAnimatorPauseListener(Animator.AnimatorPauseListener listener) { + animator.addPauseListener(listener); + } @RequiresApi(api = Build.VERSION_CODES.KITKAT) - public void removeAnimatorPauseListener(Animator.AnimatorPauseListener listener) { animator.removePauseListener(listener); } + public void removeAnimatorPauseListener(Animator.AnimatorPauseListener listener) { + animator.removePauseListener(listener); + } /** * Sets the progress to the specified frame. @@ -882,7 +889,7 @@ /** * Allows ignoring system animations settings, therefore allowing animations to run even if they are disabled. - * + * <p> * Defaults to false. * * @param ignore if true animations will run even when they are disabled in the system settings. @@ -1050,7 +1057,7 @@ * drawable.addValueCallback(yourKeyPath, LottieProperty.COLOR) { yourColor } */ public <T> void addValueCallback(KeyPath keyPath, T property, - final SimpleLottieValueCallback<T> callback) { + final SimpleLottieValueCallback<T> callback) { addValueCallback(keyPath, property, new LottieValueCallback<T>() { @Override public T getValue(LottieFrameInfo<T> frameInfo) {
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieImageAsset.java b/lottie/src/main/java/com/airbnb/lottie/LottieImageAsset.java index dc0961c..faa7e9e 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieImageAsset.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieImageAsset.java
@@ -1,6 +1,7 @@ package com.airbnb.lottie; import android.graphics.Bitmap; + import androidx.annotation.Nullable; import androidx.annotation.RestrictTo; @@ -13,7 +14,9 @@ private final String id; private final String fileName; private final String dirName; - /** Pre-set a bitmap for this asset */ + /** + * Pre-set a bitmap for this asset + */ @Nullable private Bitmap bitmap; @RestrictTo(RestrictTo.Scope.LIBRARY)
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieProperty.java b/lottie/src/main/java/com/airbnb/lottie/LottieProperty.java index 2982d65..98dea45 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieProperty.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieProperty.java
@@ -3,114 +3,162 @@ import android.graphics.ColorFilter; import android.graphics.PointF; -import com.airbnb.lottie.value.ScaleXY; import com.airbnb.lottie.value.LottieValueCallback; +import com.airbnb.lottie.value.ScaleXY; /** * Property values are the same type as the generic type of their corresponding * {@link LottieValueCallback}. With this, we can use generics to maintain type safety * of the callbacks. - * + * <p> * Supported properties: * Transform: - * {@link #TRANSFORM_ANCHOR_POINT} - * {@link #TRANSFORM_POSITION} - * {@link #TRANSFORM_OPACITY} - * {@link #TRANSFORM_SCALE} - * {@link #TRANSFORM_ROTATION} - * {@link #TRANSFORM_SKEW} - * {@link #TRANSFORM_SKEW_ANGLE} - * + * {@link #TRANSFORM_ANCHOR_POINT} + * {@link #TRANSFORM_POSITION} + * {@link #TRANSFORM_OPACITY} + * {@link #TRANSFORM_SCALE} + * {@link #TRANSFORM_ROTATION} + * {@link #TRANSFORM_SKEW} + * {@link #TRANSFORM_SKEW_ANGLE} + * <p> * Fill: - * {@link #COLOR} (non-gradient) - * {@link #OPACITY} - * {@link #COLOR_FILTER} - * + * {@link #COLOR} (non-gradient) + * {@link #OPACITY} + * {@link #COLOR_FILTER} + * <p> * Stroke: - * {@link #COLOR} (non-gradient) - * {@link #STROKE_WIDTH} - * {@link #OPACITY} - * {@link #COLOR_FILTER} - * + * {@link #COLOR} (non-gradient) + * {@link #STROKE_WIDTH} + * {@link #OPACITY} + * {@link #COLOR_FILTER} + * <p> * Ellipse: - * {@link #POSITION} - * {@link #ELLIPSE_SIZE} - * + * {@link #POSITION} + * {@link #ELLIPSE_SIZE} + * <p> * Polystar: - * {@link #POLYSTAR_POINTS} - * {@link #POLYSTAR_ROTATION} - * {@link #POSITION} - * {@link #POLYSTAR_INNER_RADIUS} (star) - * {@link #POLYSTAR_OUTER_RADIUS} - * {@link #POLYSTAR_INNER_ROUNDEDNESS} (star) - * {@link #POLYSTAR_OUTER_ROUNDEDNESS} - * + * {@link #POLYSTAR_POINTS} + * {@link #POLYSTAR_ROTATION} + * {@link #POSITION} + * {@link #POLYSTAR_INNER_RADIUS} (star) + * {@link #POLYSTAR_OUTER_RADIUS} + * {@link #POLYSTAR_INNER_ROUNDEDNESS} (star) + * {@link #POLYSTAR_OUTER_ROUNDEDNESS} + * <p> * Repeater: - * All transform properties - * {@link #REPEATER_COPIES} - * {@link #REPEATER_OFFSET} - * {@link #TRANSFORM_ROTATION} - * {@link #TRANSFORM_START_OPACITY} - * {@link #TRANSFORM_END_OPACITY} - * + * All transform properties + * {@link #REPEATER_COPIES} + * {@link #REPEATER_OFFSET} + * {@link #TRANSFORM_ROTATION} + * {@link #TRANSFORM_START_OPACITY} + * {@link #TRANSFORM_END_OPACITY} + * <p> * Layers: - * All transform properties - * {@link #TIME_REMAP} (composition layers only) + * All transform properties + * {@link #TIME_REMAP} (composition layers only) */ public interface LottieProperty { - /** ColorInt **/ + /** + * ColorInt + **/ Integer COLOR = 1; Integer STROKE_COLOR = 2; - /** Opacity value are 0-100 to match after effects **/ + /** + * Opacity value are 0-100 to match after effects + **/ Integer TRANSFORM_OPACITY = 3; - /** [0,100] */ + /** + * [0,100] + */ Integer OPACITY = 4; - /** In Px */ + /** + * In Px + */ PointF TRANSFORM_ANCHOR_POINT = new PointF(); - /** In Px */ + /** + * In Px + */ PointF TRANSFORM_POSITION = new PointF(); - /** When split dimensions is enabled. In Px */ + /** + * When split dimensions is enabled. In Px + */ Float TRANSFORM_POSITION_X = 15f; - /** When split dimensions is enabled. In Px */ + /** + * When split dimensions is enabled. In Px + */ Float TRANSFORM_POSITION_Y = 16f; - /** In Px */ + /** + * In Px + */ PointF ELLIPSE_SIZE = new PointF(); - /** In Px */ + /** + * In Px + */ PointF RECTANGLE_SIZE = new PointF(); - /** In degrees */ + /** + * In degrees + */ Float CORNER_RADIUS = 0f; - /** In Px */ + /** + * In Px + */ PointF POSITION = new PointF(); ScaleXY TRANSFORM_SCALE = new ScaleXY(); - /** In degrees */ + /** + * In degrees + */ Float TRANSFORM_ROTATION = 1f; - /** 0-85 */ + /** + * 0-85 + */ Float TRANSFORM_SKEW = 0f; - /** In degrees */ + /** + * In degrees + */ Float TRANSFORM_SKEW_ANGLE = 0f; - /** In Px */ + /** + * In Px + */ Float STROKE_WIDTH = 2f; Float TEXT_TRACKING = 3f; Float REPEATER_COPIES = 4f; Float REPEATER_OFFSET = 5f; Float POLYSTAR_POINTS = 6f; - /** In degrees */ + /** + * In degrees + */ Float POLYSTAR_ROTATION = 7f; - /** In Px */ + /** + * In Px + */ Float POLYSTAR_INNER_RADIUS = 8f; - /** In Px */ + /** + * In Px + */ Float POLYSTAR_OUTER_RADIUS = 9f; - /** [0,100] */ + /** + * [0,100] + */ Float POLYSTAR_INNER_ROUNDEDNESS = 10f; - /** [0,100] */ + /** + * [0,100] + */ Float POLYSTAR_OUTER_ROUNDEDNESS = 11f; - /** [0,100] */ + /** + * [0,100] + */ Float TRANSFORM_START_OPACITY = 12f; - /** [0,100] */ + /** + * [0,100] + */ Float TRANSFORM_END_OPACITY = 12.1f; - /** The time value in seconds */ + /** + * The time value in seconds + */ Float TIME_REMAP = 13f; - /** In Dp */ + /** + * In Dp + */ Float TEXT_SIZE = 14f; ColorFilter COLOR_FILTER = new ColorFilter();
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieResult.java b/lottie/src/main/java/com/airbnb/lottie/LottieResult.java index 5ebefe7..b0f2f5c 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieResult.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieResult.java
@@ -6,7 +6,7 @@ /** * Contains class to hold the resulting value of an async task or an exception if it failed. - * + * <p> * Either value or exception will be non-null. */ public final class LottieResult<V> {
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieTask.java b/lottie/src/main/java/com/airbnb/lottie/LottieTask.java index c922228..2b9e914 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieTask.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieTask.java
@@ -2,6 +2,7 @@ import android.os.Handler; import android.os.Looper; + import androidx.annotation.Nullable; import androidx.annotation.RestrictTo; @@ -21,7 +22,7 @@ * Helper to run asynchronous tasks with a result. * Results can be obtained with {@link #addListener(LottieListener)}. * Failures can be obtained with {@link #addFailureListener(LottieListener)}. - * + * <p> * A task will produce a single result or a single failure. */ public class LottieTask<T> { @@ -29,7 +30,7 @@ /** * Set this to change the executor that LottieTasks are run on. This will be the executor that composition parsing and url * fetching happens on. - * + * <p> * You may change this to run deserialization synchronously for testing. */ @SuppressWarnings("WeakerAccess") @@ -50,8 +51,7 @@ /** * runNow is only used for testing. */ - @RestrictTo(RestrictTo.Scope.LIBRARY) - LottieTask(Callable<LottieResult<T>> runnable, boolean runNow) { + @RestrictTo(RestrictTo.Scope.LIBRARY) LottieTask(Callable<LottieResult<T>> runnable, boolean runNow) { if (runNow) { try { setResult(runnable.call()); @@ -73,6 +73,7 @@ /** * Add a task listener. If the task has completed, the listener will be called synchronously. + * * @return the task for call chaining. */ public synchronized LottieTask<T> addListener(LottieListener<T> listener) { @@ -87,6 +88,7 @@ /** * Remove a given task listener. The task will continue to execute so you can re-add * a listener if neccesary. + * * @return the task for call chaining. */ public synchronized LottieTask<T> removeListener(LottieListener<T> listener) { @@ -97,6 +99,7 @@ /** * Add a task failure listener. This will only be called in the even that an exception * occurs. If an exception has already occurred, the listener will be called immediately. + * * @return the task for call chaining. */ public synchronized LottieTask<T> addFailureListener(LottieListener<Throwable> listener) { @@ -111,6 +114,7 @@ /** * Remove a given task failure listener. The task will continue to execute so you can re-add * a listener if neccesary. + * * @return the task for call chaining. */ public synchronized LottieTask<T> removeFailureListener(LottieListener<Throwable> listener) {
diff --git a/lottie/src/main/java/com/airbnb/lottie/PerformanceTracker.java b/lottie/src/main/java/com/airbnb/lottie/PerformanceTracker.java index d16c671..0f3f4a8 100644 --- a/lottie/src/main/java/com/airbnb/lottie/PerformanceTracker.java +++ b/lottie/src/main/java/com/airbnb/lottie/PerformanceTracker.java
@@ -1,8 +1,9 @@ package com.airbnb.lottie; +import android.util.Log; + import androidx.collection.ArraySet; import androidx.core.util.Pair; -import android.util.Log; import com.airbnb.lottie.utils.MeanCalculator; @@ -25,17 +26,17 @@ private final Map<String, MeanCalculator> layerRenderTimes = new HashMap<>(); private final Comparator<Pair<String, Float>> floatComparator = new Comparator<Pair<String, Float>>() { - @Override public int compare(Pair<String, Float> o1, Pair<String, Float> o2) { - float r1 = o1.second; - float r2 = o2.second; - if (r2 > r1) { - return 1; - } else if (r1 > r2) { - return -1; - } - return 0; - } - }; + @Override public int compare(Pair<String, Float> o1, Pair<String, Float> o2) { + float r1 = o1.second; + float r2 = o2.second; + if (r2 > r1) { + return 1; + } else if (r1 > r2) { + return -1; + } + return 0; + } + }; void setEnabled(boolean enabled) { this.enabled = enabled;
diff --git a/lottie/src/main/java/com/airbnb/lottie/RenderMode.java b/lottie/src/main/java/com/airbnb/lottie/RenderMode.java index b19c0eb..8003ce9 100644 --- a/lottie/src/main/java/com/airbnb/lottie/RenderMode.java +++ b/lottie/src/main/java/com/airbnb/lottie/RenderMode.java
@@ -7,7 +7,7 @@ * @see LottieAnimationView#setRenderMode(RenderMode) for more information. */ public enum RenderMode { - AUTOMATIC, - HARDWARE, - SOFTWARE + AUTOMATIC, + HARDWARE, + SOFTWARE }
diff --git a/lottie/src/main/java/com/airbnb/lottie/SimpleColorFilter.java b/lottie/src/main/java/com/airbnb/lottie/SimpleColorFilter.java index c6a21ef..bce3a19 100644 --- a/lottie/src/main/java/com/airbnb/lottie/SimpleColorFilter.java +++ b/lottie/src/main/java/com/airbnb/lottie/SimpleColorFilter.java
@@ -2,6 +2,7 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; + import androidx.annotation.ColorInt; /**
diff --git a/lottie/src/main/java/com/airbnb/lottie/TextDelegate.java b/lottie/src/main/java/com/airbnb/lottie/TextDelegate.java index 1682f97..f352c0a 100644 --- a/lottie/src/main/java/com/airbnb/lottie/TextDelegate.java +++ b/lottie/src/main/java/com/airbnb/lottie/TextDelegate.java
@@ -9,7 +9,7 @@ /** * Extend this class to replace animation text with custom text. This can be useful to handle * translations. - * + * <p> * The only method you should have to override is {@link #getText(String)}. */ public class TextDelegate { @@ -22,8 +22,7 @@ /** * This normally needs to be able to invalidate the view/drawable but not for the test. */ - @VisibleForTesting - TextDelegate() { + @VisibleForTesting TextDelegate() { animationView = null; drawable = null; }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/LPaint.java b/lottie/src/main/java/com/airbnb/lottie/animation/LPaint.java index 93869aa..ea8f1e8 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/LPaint.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/LPaint.java
@@ -13,26 +13,26 @@ * setComposition. */ public class LPaint extends Paint { - public LPaint() { - super(); - } + public LPaint() { + super(); + } - public LPaint(int flags) { - super(flags); - } + public LPaint(int flags) { + super(flags); + } - public LPaint(PorterDuff.Mode porterDuffMode) { - super(); - setXfermode(new PorterDuffXfermode(porterDuffMode)); - } + public LPaint(PorterDuff.Mode porterDuffMode) { + super(); + setXfermode(new PorterDuffXfermode(porterDuffMode)); + } - public LPaint(int flags, PorterDuff.Mode porterDuffMode) { - super(flags); - setXfermode(new PorterDuffXfermode(porterDuffMode)); - } + public LPaint(int flags, PorterDuff.Mode porterDuffMode) { + super(flags); + setXfermode(new PorterDuffXfermode(porterDuffMode)); + } - @Override - public void setTextLocales(@NonNull LocaleList locales) { - // Do nothing. - } + @Override + public void setTextLocales(@NonNull LocaleList locales) { + // Do nothing. + } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/BaseStrokeContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/BaseStrokeContent.java index 813a8aa..dd42f82 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/BaseStrokeContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/BaseStrokeContent.java
@@ -1,5 +1,7 @@ package com.airbnb.lottie.animation.content; +import static com.airbnb.lottie.utils.MiscUtils.clamp; + import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.DashPathEffect; @@ -8,6 +10,7 @@ import android.graphics.Path; import android.graphics.PathMeasure; import android.graphics.RectF; + import androidx.annotation.CallSuper; import androidx.annotation.Nullable; @@ -31,8 +34,6 @@ import java.util.ArrayList; import java.util.List; -import static com.airbnb.lottie.utils.MiscUtils.clamp; - public abstract class BaseStrokeContent implements BaseKeyframeAnimation.AnimationListener, KeyPathElementContent, DrawingContent {
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/CompoundTrimPathContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/CompoundTrimPathContent.java index f69c633..aefc869 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/CompoundTrimPathContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/CompoundTrimPathContent.java
@@ -8,15 +8,15 @@ import java.util.List; public class CompoundTrimPathContent { - private List<TrimPathContent> contents = new ArrayList<>(); + private List<TrimPathContent> contents = new ArrayList<>(); - void addTrimPath(TrimPathContent trimPath) { - contents.add(trimPath); - } + void addTrimPath(TrimPathContent trimPath) { + contents.add(trimPath); + } - public void apply(Path path) { - for (int i = contents.size() - 1; i >= 0; i--) { - Utils.applyTrimPathIfNeeded(path, contents.get(i)); - } + public void apply(Path path) { + for (int i = contents.size() - 1; i >= 0; i--) { + Utils.applyTrimPathIfNeeded(path, contents.get(i)); } + } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/ContentGroup.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/ContentGroup.java index ebe2ad5..4af6907 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/ContentGroup.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/ContentGroup.java
@@ -6,6 +6,8 @@ import android.graphics.Path; import android.graphics.RectF; +import androidx.annotation.Nullable; + import com.airbnb.lottie.LottieDrawable; import com.airbnb.lottie.animation.LPaint; import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation; @@ -22,8 +24,6 @@ import java.util.ArrayList; import java.util.List; -import androidx.annotation.Nullable; - public class ContentGroup implements DrawingContent, PathContent, BaseKeyframeAnimation.AnimationListener, KeyPathElement {
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/DrawingContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/DrawingContent.java index efdba44..c6501e3 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/DrawingContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/DrawingContent.java
@@ -6,5 +6,6 @@ public interface DrawingContent extends Content { void draw(Canvas canvas, Matrix parentMatrix, int alpha); + void getBounds(RectF outBounds, Matrix parentMatrix, boolean applyParents); }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/FillContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/FillContent.java index 56420f9..a4b7d95 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/FillContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/FillContent.java
@@ -1,11 +1,14 @@ package com.airbnb.lottie.animation.content; +import static com.airbnb.lottie.utils.MiscUtils.clamp; + 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 androidx.annotation.Nullable; import com.airbnb.lottie.L; @@ -24,8 +27,6 @@ import java.util.ArrayList; import java.util.List; -import static com.airbnb.lottie.utils.MiscUtils.clamp; - public class FillContent implements DrawingContent, BaseKeyframeAnimation.AnimationListener, KeyPathElementContent { private final Path path = new Path(); @@ -44,7 +45,7 @@ name = fill.getName(); hidden = fill.isHidden(); this.lottieDrawable = lottieDrawable; - if (fill.getColor() == null || fill.getOpacity() == null ) { + if (fill.getColor() == null || fill.getOpacity() == null) { colorAnimation = null; opacityAnimation = null; return;
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/GradientFillContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/GradientFillContent.java index 740819d..8ff32fd 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/GradientFillContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/GradientFillContent.java
@@ -1,5 +1,7 @@ package com.airbnb.lottie.animation.content; +import static com.airbnb.lottie.utils.MiscUtils.clamp; + import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.LinearGradient; @@ -10,6 +12,7 @@ import android.graphics.RadialGradient; import android.graphics.RectF; import android.graphics.Shader; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.collection.LongSparseArray; @@ -31,8 +34,6 @@ import java.util.ArrayList; import java.util.List; -import static com.airbnb.lottie.utils.MiscUtils.clamp; - public class GradientFillContent implements DrawingContent, BaseKeyframeAnimation.AnimationListener, KeyPathElementContent { /** @@ -239,29 +240,29 @@ layer.removeAnimation(colorFilterAnimation); } - if (callback == null) { - colorFilterAnimation = null; - } else { - colorFilterAnimation = - new ValueCallbackKeyframeAnimation<>((LottieValueCallback<ColorFilter>) callback); - colorFilterAnimation.addUpdateListener(this); - layer.addAnimation(colorFilterAnimation); - } - } else if (property == LottieProperty.GRADIENT_COLOR) { + if (callback == null) { + colorFilterAnimation = null; + } else { + colorFilterAnimation = + new ValueCallbackKeyframeAnimation<>((LottieValueCallback<ColorFilter>) callback); + colorFilterAnimation.addUpdateListener(this); + layer.addAnimation(colorFilterAnimation); + } + } else if (property == LottieProperty.GRADIENT_COLOR) { if (colorCallbackAnimation != null) { layer.removeAnimation(colorCallbackAnimation); } - if (callback == null) { - colorCallbackAnimation = null; - } else { - //noinspection rawtypes - linearGradientCache.clear(); - radialGradientCache.clear(); - colorCallbackAnimation = new ValueCallbackKeyframeAnimation<>(callback); - colorCallbackAnimation.addUpdateListener(this); - layer.addAnimation(colorCallbackAnimation); - } + if (callback == null) { + colorCallbackAnimation = null; + } else { + //noinspection rawtypes + linearGradientCache.clear(); + radialGradientCache.clear(); + colorCallbackAnimation = new ValueCallbackKeyframeAnimation<>(callback); + colorCallbackAnimation.addUpdateListener(this); + layer.addAnimation(colorCallbackAnimation); + } } } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/GradientStrokeContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/GradientStrokeContent.java index 351171c..b8f0555 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/GradientStrokeContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/GradientStrokeContent.java
@@ -7,6 +7,7 @@ import android.graphics.RadialGradient; import android.graphics.RectF; import android.graphics.Shader; + import androidx.annotation.Nullable; import androidx.collection.LongSparseArray;
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/GreedyContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/GreedyContent.java index 0cc02bd..8686511 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/GreedyContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/GreedyContent.java
@@ -11,7 +11,7 @@ /** * An iterator of contents that can be used to take ownership of contents. If ownership is taken, * the content should be removed from the iterator. - * + * <p> * The contents should be iterated by calling hasPrevious() and previous() so that the list of * contents is traversed from bottom to top which is the correct order for handling AE logic. */
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/MergePathsContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/MergePathsContent.java index e53c4e5..b69d713 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/MergePathsContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/MergePathsContent.java
@@ -31,7 +31,8 @@ @Override public void absorbContent(ListIterator<Content> contents) { // Fast forward the iterator until after this content. //noinspection StatementWithEmptyBody - while (contents.hasPrevious() && contents.previous() != this) {} + while (contents.hasPrevious() && contents.previous() != this) { + } while (contents.hasPrevious()) { Content content = contents.previous(); if (content instanceof PathContent) {
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/PathContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/PathContent.java index 031d7ef..c7f6bfc 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/PathContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/PathContent.java
@@ -2,8 +2,6 @@ import android.graphics.Path; -import com.airbnb.lottie.animation.content.Content; - interface PathContent extends Content { Path getPath(); }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/PolystarContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/PolystarContent.java index c13c63f..dc9ab8f 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/PolystarContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/PolystarContent.java
@@ -2,6 +2,7 @@ import android.graphics.Path; import android.graphics.PointF; + import androidx.annotation.Nullable; import com.airbnb.lottie.LottieDrawable; @@ -231,7 +232,7 @@ } } - path.cubicTo(previousX - cp1x,previousY - cp1y, x + cp2x, y + cp2y, x, y); + path.cubicTo(previousX - cp1x, previousY - cp1y, x + cp2x, y + cp2y, x, y); } currentAngle += dTheta; @@ -285,7 +286,7 @@ float cp1y = radius * roundedness * POLYGON_MAGIC_NUMBER * cp1Dy; float cp2x = radius * roundedness * POLYGON_MAGIC_NUMBER * cp2Dx; float cp2y = radius * roundedness * POLYGON_MAGIC_NUMBER * cp2Dy; - path.cubicTo(previousX - cp1x,previousY - cp1y, x + cp2x, y + cp2y, x, y); + path.cubicTo(previousX - cp1x, previousY - cp1y, x + cp2x, y + cp2y, x, y); } else { path.lineTo(x, y); }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/RectangleContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/RectangleContent.java index 919695a..f40d20e 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/RectangleContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/RectangleContent.java
@@ -4,6 +4,8 @@ import android.graphics.PointF; import android.graphics.RectF; +import androidx.annotation.Nullable; + import com.airbnb.lottie.LottieDrawable; import com.airbnb.lottie.LottieProperty; import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation; @@ -17,8 +19,6 @@ import java.util.List; -import androidx.annotation.Nullable; - public class RectangleContent implements BaseKeyframeAnimation.AnimationListener, KeyPathElementContent, PathContent { private final Path path = new Path(); @@ -156,7 +156,7 @@ @Override public void resolveKeyPath(KeyPath keyPath, int depth, List<KeyPath> accumulator, - KeyPath currentPartialKeyPath) { + KeyPath currentPartialKeyPath) { MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this); }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/RepeaterContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/RepeaterContent.java index e3f426c..8b6d122 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/RepeaterContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/RepeaterContent.java
@@ -4,6 +4,7 @@ import android.graphics.Matrix; import android.graphics.Path; import android.graphics.RectF; + import androidx.annotation.Nullable; import com.airbnb.lottie.LottieDrawable; @@ -73,7 +74,8 @@ } // Fast forward the iterator until after this content. //noinspection StatementWithEmptyBody - while (contentsIter.hasPrevious() && contentsIter.previous() != this) {} + while (contentsIter.hasPrevious() && contentsIter.previous() != this) { + } List<Content> contents = new ArrayList<>(); while (contentsIter.hasPrevious()) { contents.add(contentsIter.previous());
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/StrokeContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/StrokeContent.java index 4e4900e..212aa55 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/StrokeContent.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/StrokeContent.java
@@ -1,8 +1,11 @@ package com.airbnb.lottie.animation.content; +import static com.airbnb.lottie.LottieProperty.STROKE_COLOR; + import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Matrix; + import androidx.annotation.Nullable; import com.airbnb.lottie.LottieDrawable; @@ -14,8 +17,6 @@ import com.airbnb.lottie.model.layer.BaseLayer; import com.airbnb.lottie.value.LottieValueCallback; -import static com.airbnb.lottie.LottieProperty.STROKE_COLOR; - public class StrokeContent extends BaseStrokeContent { private final BaseLayer layer;
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/package-info.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/package-info.java index 0ef11ae..24cec40 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/content/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.animation.content; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/BaseKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/BaseKeyframeAnimation.java index 118b85a..d9ca3bc 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/BaseKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/BaseKeyframeAnimation.java
@@ -1,5 +1,9 @@ package com.airbnb.lottie.animation.keyframe; +import androidx.annotation.FloatRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.airbnb.lottie.L; import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.value.LottieValueCallback; @@ -7,10 +11,6 @@ import java.util.ArrayList; import java.util.List; -import androidx.annotation.FloatRange; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - /** * @param <K> Keyframe type * @param <A> Animation type @@ -110,18 +110,18 @@ @FloatRange(from = 0f, to = 1f) private float getStartDelayProgress() { - if (cachedStartDelayProgress == -1f) { - cachedStartDelayProgress = keyframesWrapper.getStartDelayProgress(); - } - return cachedStartDelayProgress; + if (cachedStartDelayProgress == -1f) { + cachedStartDelayProgress = keyframesWrapper.getStartDelayProgress(); + } + return cachedStartDelayProgress; } @FloatRange(from = 0f, to = 1f) float getEndProgress() { - if (cachedEndProgress == -1f) { - cachedEndProgress = keyframesWrapper.getEndProgress(); - } - return cachedEndProgress; + if (cachedEndProgress == -1f) { + cachedEndProgress = keyframesWrapper.getEndProgress(); + } + return cachedEndProgress; } public A getValue() { @@ -337,7 +337,7 @@ @Override public boolean isCachedValueEnabled(float progress) { if (cachedCurrentKeyframe == currentKeyframe - && cachedInterpolatedProgress == progress) { + && cachedInterpolatedProgress == progress) { return true; } cachedCurrentKeyframe = currentKeyframe;
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ColorKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ColorKeyframeAnimation.java index 79447e8..6303075 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ColorKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ColorKeyframeAnimation.java
@@ -30,7 +30,7 @@ if (valueCallback != null) { //noinspection ConstantConditions Integer value = valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame, startColor, - endColor, keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress()); + endColor, keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress()); if (value != null) { return value; }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/FloatKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/FloatKeyframeAnimation.java index 7a19378..1a8908f 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/FloatKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/FloatKeyframeAnimation.java
@@ -1,7 +1,7 @@ package com.airbnb.lottie.animation.keyframe; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.utils.MiscUtils; +import com.airbnb.lottie.value.Keyframe; import java.util.List; @@ -26,8 +26,8 @@ if (valueCallback != null) { //noinspection ConstantConditions Float value = valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame, - keyframe.startValue, keyframe.endValue, - keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress()); + keyframe.startValue, keyframe.endValue, + keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress()); if (value != null) { return value; }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/GradientColorKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/GradientColorKeyframeAnimation.java index e992e57..c4c1a51 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/GradientColorKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/GradientColorKeyframeAnimation.java
@@ -1,7 +1,7 @@ package com.airbnb.lottie.animation.keyframe; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.model.content.GradientColor; +import com.airbnb.lottie.value.Keyframe; import java.util.List;
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/IntegerKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/IntegerKeyframeAnimation.java index c67da0f..18cc944 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/IntegerKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/IntegerKeyframeAnimation.java
@@ -1,7 +1,7 @@ package com.airbnb.lottie.animation.keyframe; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.utils.MiscUtils; +import com.airbnb.lottie.value.Keyframe; import java.util.List; @@ -27,8 +27,8 @@ if (valueCallback != null) { //noinspection ConstantConditions Integer value = valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame, - keyframe.startValue, keyframe.endValue, - keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress()); + keyframe.startValue, keyframe.endValue, + keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress()); if (value != null) { return value; }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/PathKeyframe.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/PathKeyframe.java index 18be2de..aea1529 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/PathKeyframe.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/PathKeyframe.java
@@ -2,11 +2,12 @@ import android.graphics.Path; import android.graphics.PointF; + import androidx.annotation.Nullable; import com.airbnb.lottie.LottieComposition; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.utils.Utils; +import com.airbnb.lottie.value.Keyframe; public class PathKeyframe extends Keyframe<PointF> { @Nullable private Path path; @@ -30,7 +31,9 @@ } } - /** This will be null if the startValue and endValue are the same. */ + /** + * This will be null if the startValue and endValue are the same. + */ @Nullable Path getPath() { return path; }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/PathKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/PathKeyframeAnimation.java index 0702c2f..b4f1663 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/PathKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/PathKeyframeAnimation.java
@@ -27,8 +27,8 @@ if (valueCallback != null) { PointF value = valueCallback.getValueInternal(pathKeyframe.startFrame, pathKeyframe.endFrame, - pathKeyframe.startValue, pathKeyframe.endValue, getLinearCurrentKeyframeProgress(), - keyframeProgress, getProgress()); + pathKeyframe.startValue, pathKeyframe.endValue, getLinearCurrentKeyframeProgress(), + keyframeProgress, getProgress()); if (value != null) { return value; }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ScaleKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ScaleKeyframeAnimation.java index a236e47..724e433 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ScaleKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ScaleKeyframeAnimation.java
@@ -1,8 +1,8 @@ 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 com.airbnb.lottie.utils.MiscUtils; import java.util.List; @@ -24,8 +24,8 @@ if (valueCallback != null) { //noinspection ConstantConditions ScaleXY value = valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame, - startTransform, endTransform, - keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress()); + startTransform, endTransform, + keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress()); if (value != null) { return value; }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ShapeKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ShapeKeyframeAnimation.java index fe4a901..07e0fce 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ShapeKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ShapeKeyframeAnimation.java
@@ -2,9 +2,9 @@ import android.graphics.Path; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.model.content.ShapeData; import com.airbnb.lottie.utils.MiscUtils; +import com.airbnb.lottie.value.Keyframe; import java.util.List;
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/SplitDimensionPathKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/SplitDimensionPathKeyframeAnimation.java index fd0afe8..6d3cf46 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/SplitDimensionPathKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/SplitDimensionPathKeyframeAnimation.java
@@ -2,13 +2,13 @@ import android.graphics.PointF; +import androidx.annotation.Nullable; + import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.value.LottieValueCallback; import java.util.Collections; -import androidx.annotation.Nullable; - public class SplitDimensionPathKeyframeAnimation extends BaseKeyframeAnimation<PointF, PointF> { private final PointF point = new PointF(); private final PointF pointWithCallbackValues = new PointF(); @@ -70,10 +70,11 @@ if (xValueCallback != null) { Keyframe<Float> xKeyframe = xAnimation.getCurrentKeyframe(); if (xKeyframe != null) { - float progress = xAnimation.getInterpolatedCurrentKeyframeProgress(); - Float endFrame = xKeyframe.endFrame; - xCallbackValue = xValueCallback.getValueInternal(xKeyframe.startFrame, endFrame == null ? xKeyframe.startFrame : endFrame, xKeyframe.startValue, - xKeyframe.endValue, keyframeProgress, keyframeProgress, progress); + float progress = xAnimation.getInterpolatedCurrentKeyframeProgress(); + Float endFrame = xKeyframe.endFrame; + xCallbackValue = + xValueCallback.getValueInternal(xKeyframe.startFrame, endFrame == null ? xKeyframe.startFrame : endFrame, xKeyframe.startValue, + xKeyframe.endValue, keyframeProgress, keyframeProgress, progress); } } if (yValueCallback != null) { @@ -81,8 +82,9 @@ if (yKeyframe != null) { float progress = yAnimation.getInterpolatedCurrentKeyframeProgress(); Float endFrame = yKeyframe.endFrame; - yCallbackValue = yValueCallback.getValueInternal(yKeyframe.startFrame, endFrame == null ? yKeyframe.startFrame : endFrame, yKeyframe.startValue, - yKeyframe.endValue, keyframeProgress, keyframeProgress, progress); + yCallbackValue = + yValueCallback.getValueInternal(yKeyframe.startFrame, endFrame == null ? yKeyframe.startFrame : endFrame, yKeyframe.startValue, + yKeyframe.endValue, keyframeProgress, keyframeProgress, progress); } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/TextKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/TextKeyframeAnimation.java index 0c09f94..d2bcc6a 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/TextKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/TextKeyframeAnimation.java
@@ -1,7 +1,7 @@ package com.airbnb.lottie.animation.keyframe; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.model.DocumentData; +import com.airbnb.lottie.value.Keyframe; import java.util.List; @@ -11,9 +11,10 @@ } @Override DocumentData getValue(Keyframe<DocumentData> keyframe, float keyframeProgress) { - if (keyframeProgress != 1.0f || keyframe.endValue == null) + if (keyframeProgress != 1.0f || keyframe.endValue == null) { return keyframe.startValue; - else + } else { return keyframe.endValue; + } } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/TransformKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/TransformKeyframeAnimation.java index a05354c..4483fbb 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/TransformKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/TransformKeyframeAnimation.java
@@ -1,18 +1,5 @@ package com.airbnb.lottie.animation.keyframe; -import android.graphics.Matrix; -import android.graphics.PointF; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.airbnb.lottie.value.Keyframe; -import com.airbnb.lottie.value.LottieValueCallback; -import com.airbnb.lottie.value.ScaleXY; -import com.airbnb.lottie.model.animatable.AnimatableTransform; -import com.airbnb.lottie.model.layer.BaseLayer; - -import java.util.Collections; - import static com.airbnb.lottie.LottieProperty.TRANSFORM_ANCHOR_POINT; import static com.airbnb.lottie.LottieProperty.TRANSFORM_END_OPACITY; import static com.airbnb.lottie.LottieProperty.TRANSFORM_OPACITY; @@ -25,6 +12,20 @@ import static com.airbnb.lottie.LottieProperty.TRANSFORM_SKEW_ANGLE; import static com.airbnb.lottie.LottieProperty.TRANSFORM_START_OPACITY; +import android.graphics.Matrix; +import android.graphics.PointF; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +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; + public class TransformKeyframeAnimation { private final Matrix matrix = new Matrix(); private final Matrix skewMatrix1; @@ -121,7 +122,7 @@ } } - public void setProgress(float progress) { + public void setProgress(float progress) { if (opacity != null) { opacity.setProgress(progress); } @@ -176,7 +177,7 @@ if (rotation != null) { float rotation; if (this.rotation instanceof ValueCallbackKeyframeAnimation) { - rotation = this.rotation.getValue(); + rotation = this.rotation.getValue(); } else { rotation = ((FloatKeyframeAnimation) this.rotation).getFloatValue(); }
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ValueCallbackKeyframeAnimation.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ValueCallbackKeyframeAnimation.java index 704ba69..79a1583 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ValueCallbackKeyframeAnimation.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/ValueCallbackKeyframeAnimation.java
@@ -1,6 +1,7 @@ package com.airbnb.lottie.animation.keyframe; import androidx.annotation.Nullable; + import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.value.LottieFrameInfo; import com.airbnb.lottie.value.LottieValueCallback;
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/package-info.java b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/package-info.java index fe27111..7b7e10a 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/keyframe/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.animation.keyframe; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/package-info.java b/lottie/src/main/java/com/airbnb/lottie/animation/package-info.java index 5b8b264..fb0fff4 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.animation; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/manager/FontAssetManager.java b/lottie/src/main/java/com/airbnb/lottie/manager/FontAssetManager.java index 360893b..9e0de5e 100644 --- a/lottie/src/main/java/com/airbnb/lottie/manager/FontAssetManager.java +++ b/lottie/src/main/java/com/airbnb/lottie/manager/FontAssetManager.java
@@ -3,12 +3,11 @@ import android.content.res.AssetManager; import android.graphics.Typeface; import android.graphics.drawable.Drawable; -import androidx.annotation.Nullable; -import android.util.Log; import android.view.View; +import androidx.annotation.Nullable; + import com.airbnb.lottie.FontAssetDelegate; -import com.airbnb.lottie.L; import com.airbnb.lottie.model.MutablePair; import com.airbnb.lottie.utils.Logger; @@ -18,9 +17,13 @@ public class FontAssetManager { private final MutablePair<String> tempPair = new MutablePair<>(); - /** Pair is (fontName, fontStyle) */ + /** + * Pair is (fontName, fontStyle) + */ private final Map<MutablePair<String>, Typeface> fontMap = new HashMap<>(); - /** Map of font families to their fonts. Necessary to create a font with a different style */ + /** + * Map of font families to their fonts. Necessary to create a font with a different style + */ private final Map<String, Typeface> fontFamilies = new HashMap<>(); private final AssetManager assetManager; @Nullable private FontAssetDelegate delegate; @@ -43,9 +46,9 @@ /** * Sets the default file extension (include the `.`). - * + * <p> * e.g. `.ttf` `.otf` - * + * <p> * Defaults to `.ttf` */ @SuppressWarnings("unused") public void setDefaultFontFileExtension(String defaultFontFileExtension) {
diff --git a/lottie/src/main/java/com/airbnb/lottie/manager/ImageAssetManager.java b/lottie/src/main/java/com/airbnb/lottie/manager/ImageAssetManager.java index 20d239e..7182b70 100644 --- a/lottie/src/main/java/com/airbnb/lottie/manager/ImageAssetManager.java +++ b/lottie/src/main/java/com/airbnb/lottie/manager/ImageAssetManager.java
@@ -4,11 +4,12 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.Drawable; -import androidx.annotation.Nullable; import android.text.TextUtils; import android.util.Base64; import android.view.View; +import androidx.annotation.Nullable; + import com.airbnb.lottie.ImageAssetDelegate; import com.airbnb.lottie.LottieImageAsset; import com.airbnb.lottie.utils.Logger;
diff --git a/lottie/src/main/java/com/airbnb/lottie/manager/package-info.java b/lottie/src/main/java/com/airbnb/lottie/manager/package-info.java index 87a0854..23aa8c7 100644 --- a/lottie/src/main/java/com/airbnb/lottie/manager/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/manager/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.manager; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/CubicCurveData.java b/lottie/src/main/java/com/airbnb/lottie/model/CubicCurveData.java index f150ff2..63cfeee 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/CubicCurveData.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/CubicCurveData.java
@@ -1,10 +1,11 @@ package com.airbnb.lottie.model; -import android.graphics.PointF; -import androidx.annotation.RestrictTo; - import static androidx.annotation.RestrictTo.Scope.LIBRARY; +import android.graphics.PointF; + +import androidx.annotation.RestrictTo; + @RestrictTo(LIBRARY) public class CubicCurveData { private final PointF controlPoint1;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/DocumentData.java b/lottie/src/main/java/com/airbnb/lottie/model/DocumentData.java index 969eea8..87122b4 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/DocumentData.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/DocumentData.java
@@ -1,10 +1,10 @@ package com.airbnb.lottie.model; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; + import androidx.annotation.ColorInt; import androidx.annotation.RestrictTo; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; - @RestrictTo(LIBRARY) public class DocumentData {
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/Font.java b/lottie/src/main/java/com/airbnb/lottie/model/Font.java index 89be53f..9c74ff0 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/Font.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/Font.java
@@ -1,9 +1,9 @@ package com.airbnb.lottie.model; -import androidx.annotation.RestrictTo; - import static androidx.annotation.RestrictTo.Scope.LIBRARY; +import androidx.annotation.RestrictTo; + @RestrictTo(LIBRARY) public class Font {
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/FontCharacter.java b/lottie/src/main/java/com/airbnb/lottie/model/FontCharacter.java index e09fbbd..00ab42a 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/FontCharacter.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/FontCharacter.java
@@ -1,13 +1,13 @@ package com.airbnb.lottie.model; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; + import androidx.annotation.RestrictTo; import com.airbnb.lottie.model.content.ShapeGroup; import java.util.List; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; - @RestrictTo(LIBRARY) public class FontCharacter {
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/KeyPath.java b/lottie/src/main/java/com/airbnb/lottie/model/KeyPath.java index 64fe09f..6d9cad1 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/KeyPath.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/KeyPath.java
@@ -13,33 +13,33 @@ * The keypath can contain wildcards ('*') with match exactly 1 item. * or globstars ('**') which match 0 or more items. or KeyPath.COMPOSITION * to represent the root composition layer. - * + * <p> * For example, if your content were arranged like this: * Gabriel (Shape Layer) - * Body (Shape Group) - * Left Hand (Shape) - * Fill (Fill) - * Transform (Transform) - * ... + * Body (Shape Group) + * Left Hand (Shape) + * Fill (Fill) + * Transform (Transform) + * ... * Brandon (Shape Layer) - * Body (Shape Group) - * Left Hand (Shape) - * Fill (Fill) - * Transform (Transform) - * ... - * - * + * Body (Shape Group) + * Left Hand (Shape) + * Fill (Fill) + * Transform (Transform) + * ... + * <p> + * <p> * You could: - * Match Gabriel left hand fill: - * new KeyPath("Gabriel", "Body", "Left Hand", "Fill"); - * Match Gabriel and Brandon's left hand fill: - * new KeyPath("*", "Body", Left Hand", "Fill"); - * Match anything with the name Fill: - * new KeyPath("**", "Fill"); - * Target the the root composition layer: - * KeyPath.COMPOSITION - * - * + * Match Gabriel left hand fill: + * new KeyPath("Gabriel", "Body", "Left Hand", "Fill"); + * Match Gabriel and Brandon's left hand fill: + * new KeyPath("*", "Body", Left Hand", "Fill"); + * Match anything with the name Fill: + * new KeyPath("**", "Fill"); + * Target the the root composition layer: + * KeyPath.COMPOSITION + * <p> + * <p> * NOTE: Content that are part of merge paths or repeaters cannot currently be resolved with * a {@link KeyPath}. This may be fixed in the future. */ @@ -124,7 +124,7 @@ /** * For a given key and depth, returns how much the depth should be incremented by when * resolving a keypath to children. - * + * <p> * This can be 0 or 2 when there is a globstar and the next key either matches or doesn't match * the current key. */
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/KeyPathElement.java b/lottie/src/main/java/com/airbnb/lottie/model/KeyPathElement.java index b3a095f..e43f600 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/KeyPathElement.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/KeyPathElement.java
@@ -1,5 +1,7 @@ package com.airbnb.lottie.model; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; + import androidx.annotation.Nullable; import androidx.annotation.RestrictTo; @@ -7,8 +9,6 @@ import java.util.List; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; - /** * Any item that can be a part of a {@link KeyPath} should implement this. */ @@ -17,14 +17,14 @@ /** * Called recursively during keypath resolution. - * + * <p> * The overridden method should just call: - * MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this); + * MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this); * - * @param keyPath The full keypath being resolved. - * @param depth The current depth that this element should be checked at in the keypath. - * @param accumulator A list of fully resolved keypaths. If this element fully matches the - * keypath then it should add itself to this list. + * @param keyPath The full keypath being resolved. + * @param depth The current depth that this element should be checked at in the keypath. + * @param accumulator A list of fully resolved keypaths. If this element fully matches the + * keypath then it should add itself to this list. * @param currentPartialKeyPath A keypath that contains all parent element of this one. * This element should create a copy of this and append itself * with KeyPath#addKey when it adds itself to the accumulator
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/LottieCompositionCache.java b/lottie/src/main/java/com/airbnb/lottie/model/LottieCompositionCache.java index c219f75..cfa897b 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/LottieCompositionCache.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/LottieCompositionCache.java
@@ -18,8 +18,7 @@ private final LruCache<String, LottieComposition> cache = new LruCache<>(20); - @VisibleForTesting - LottieCompositionCache() { + @VisibleForTesting LottieCompositionCache() { } @Nullable
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/MutablePair.java b/lottie/src/main/java/com/airbnb/lottie/model/MutablePair.java index e116601..dbb6b2a 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/MutablePair.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/MutablePair.java
@@ -1,13 +1,14 @@ package com.airbnb.lottie.model; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; + import androidx.annotation.Nullable; import androidx.annotation.RestrictTo; import androidx.core.util.Pair; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; - /** * Non final version of {@link Pair} + * * @param <T> */ @RestrictTo(LIBRARY) @@ -26,7 +27,7 @@ * * @param o the {@link Pair} to which this one is to be checked for equality * @return true if the underlying objects of the Pair are both considered - * equal + * equal */ @Override public boolean equals(Object o) {
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableColorValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableColorValue.java index b1ff407..fee7b66 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableColorValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableColorValue.java
@@ -1,8 +1,8 @@ package com.airbnb.lottie.model.animatable; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation; import com.airbnb.lottie.animation.keyframe.ColorKeyframeAnimation; +import com.airbnb.lottie.value.Keyframe; import java.util.List;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableFloatValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableFloatValue.java index 54671df..a73da37 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableFloatValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableFloatValue.java
@@ -1,8 +1,8 @@ package com.airbnb.lottie.model.animatable; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation; import com.airbnb.lottie.animation.keyframe.FloatKeyframeAnimation; +import com.airbnb.lottie.value.Keyframe; import java.util.List;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableGradientColorValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableGradientColorValue.java index 3524b69..027c6c6 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableGradientColorValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableGradientColorValue.java
@@ -1,9 +1,9 @@ package com.airbnb.lottie.model.animatable; -import com.airbnb.lottie.value.Keyframe; 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;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableIntegerValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableIntegerValue.java index 16d1df2..494e766 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableIntegerValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableIntegerValue.java
@@ -1,8 +1,8 @@ package com.airbnb.lottie.model.animatable; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation; import com.airbnb.lottie.animation.keyframe.IntegerKeyframeAnimation; +import com.airbnb.lottie.value.Keyframe; import java.util.List;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatablePathValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatablePathValue.java index f106234..bf8dddd 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatablePathValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatablePathValue.java
@@ -2,10 +2,10 @@ import android.graphics.PointF; -import com.airbnb.lottie.value.Keyframe; 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;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatablePointValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatablePointValue.java index 897b4b8..867040a 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatablePointValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatablePointValue.java
@@ -2,9 +2,9 @@ import android.graphics.PointF; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation; import com.airbnb.lottie.animation.keyframe.PointKeyframeAnimation; +import com.airbnb.lottie.value.Keyframe; import java.util.List;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableScaleValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableScaleValue.java index 0ead463..c168e5e 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableScaleValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableScaleValue.java
@@ -1,8 +1,8 @@ package com.airbnb.lottie.model.animatable; -import com.airbnb.lottie.value.Keyframe; 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;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableShapeValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableShapeValue.java index c309563..d88dacf 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableShapeValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableShapeValue.java
@@ -2,10 +2,10 @@ import android.graphics.Path; -import com.airbnb.lottie.value.Keyframe; 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;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableSplitDimensionPathValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableSplitDimensionPathValue.java index 1242270..f046b53 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableSplitDimensionPathValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableSplitDimensionPathValue.java
@@ -6,7 +6,6 @@ import com.airbnb.lottie.animation.keyframe.SplitDimensionPathKeyframeAnimation; import com.airbnb.lottie.value.Keyframe; -import java.util.ArrayList; import java.util.List; public class AnimatableSplitDimensionPathValue implements AnimatableValue<PointF, PointF> {
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTextFrame.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTextFrame.java index 372a347..231a296 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTextFrame.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTextFrame.java
@@ -1,8 +1,8 @@ package com.airbnb.lottie.model.animatable; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.animation.keyframe.TextKeyframeAnimation; import com.airbnb.lottie.model.DocumentData; +import com.airbnb.lottie.value.Keyframe; import java.util.List;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTransform.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTransform.java index ba5fe69..2fb5ac9 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTransform.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTransform.java
@@ -1,7 +1,9 @@ package com.airbnb.lottie.model.animatable; import android.graphics.PointF; + import androidx.annotation.Nullable; + import com.airbnb.lottie.LottieDrawable; import com.airbnb.lottie.animation.content.Content; import com.airbnb.lottie.animation.content.ModifierContent;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableValue.java index 8cbf9a6..9dcf176 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableValue.java
@@ -7,6 +7,8 @@ public interface AnimatableValue<K, A> { List<Keyframe<K>> getKeyframes(); + boolean isStatic(); + BaseKeyframeAnimation<K, A> createAnimation(); }
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/BaseAnimatableValue.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/BaseAnimatableValue.java index 4f930ae..6a5f6a7 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/BaseAnimatableValue.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/BaseAnimatableValue.java
@@ -1,7 +1,5 @@ package com.airbnb.lottie.model.animatable; -import android.graphics.PointF; - import com.airbnb.lottie.value.Keyframe; import java.util.Arrays;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/package-info.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/package-info.java index b64d3a6..407730c 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.model.animatable; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/CircleShape.java b/lottie/src/main/java/com/airbnb/lottie/model/content/CircleShape.java index 64adcba..9d7add6 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/CircleShape.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/CircleShape.java
@@ -17,7 +17,7 @@ private final boolean hidden; public CircleShape(String name, AnimatableValue<PointF, PointF> position, - AnimatablePointValue size, boolean isReversed, boolean hidden) { + AnimatablePointValue size, boolean isReversed, boolean hidden) { this.name = name; this.position = position; this.size = size;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/GradientFill.java b/lottie/src/main/java/com/airbnb/lottie/model/content/GradientFill.java index cd25721..fde5123 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/GradientFill.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/GradientFill.java
@@ -1,6 +1,7 @@ package com.airbnb.lottie.model.content; import android.graphics.Path; + import androidx.annotation.Nullable; import com.airbnb.lottie.LottieDrawable; @@ -26,10 +27,10 @@ private final boolean hidden; public GradientFill(String name, GradientType gradientType, Path.FillType fillType, - AnimatableGradientColorValue gradientColor, - AnimatableIntegerValue opacity, AnimatablePointValue startPoint, - AnimatablePointValue endPoint, AnimatableFloatValue highlightLength, - AnimatableFloatValue highlightAngle, boolean hidden) { + AnimatableGradientColorValue gradientColor, + AnimatableIntegerValue opacity, AnimatablePointValue startPoint, + AnimatablePointValue endPoint, AnimatableFloatValue highlightLength, + AnimatableFloatValue highlightAngle, boolean hidden) { this.gradientType = gradientType; this.fillType = fillType; this.gradientColor = gradientColor;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/GradientStroke.java b/lottie/src/main/java/com/airbnb/lottie/model/content/GradientStroke.java index d9b27a5..837277c 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/GradientStroke.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/GradientStroke.java
@@ -30,12 +30,12 @@ private final boolean hidden; 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, - @Nullable AnimatableFloatValue dashOffset, boolean hidden) { + AnimatableGradientColorValue gradientColor, + AnimatableIntegerValue opacity, AnimatablePointValue startPoint, + AnimatablePointValue endPoint, AnimatableFloatValue width, ShapeStroke.LineCapType capType, + ShapeStroke.LineJoinType joinType, float miterLimit, + List<AnimatableFloatValue> lineDashPattern, + @Nullable AnimatableFloatValue dashOffset, boolean hidden) { this.name = name; this.gradientType = gradientType; this.gradientColor = gradientColor;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/MergePaths.java b/lottie/src/main/java/com/airbnb/lottie/model/content/MergePaths.java index 3d1184d..f8d4453 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/MergePaths.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/MergePaths.java
@@ -68,6 +68,6 @@ @Override public String toString() { - return "MergePaths{" + "mode=" + mode + '}'; + return "MergePaths{" + "mode=" + mode + '}'; } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/PolystarShape.java b/lottie/src/main/java/com/airbnb/lottie/model/content/PolystarShape.java index f719a1f..1ebab06 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/PolystarShape.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/PolystarShape.java
@@ -42,10 +42,10 @@ private final boolean hidden; public PolystarShape(String name, Type type, AnimatableFloatValue points, - AnimatableValue<PointF, PointF> position, - AnimatableFloatValue rotation, AnimatableFloatValue innerRadius, - AnimatableFloatValue outerRadius, AnimatableFloatValue innerRoundedness, - AnimatableFloatValue outerRoundedness, boolean hidden) { + 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;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/RectangleShape.java b/lottie/src/main/java/com/airbnb/lottie/model/content/RectangleShape.java index 90c0db9..6edd030 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/RectangleShape.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/RectangleShape.java
@@ -6,7 +6,6 @@ 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;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/Repeater.java b/lottie/src/main/java/com/airbnb/lottie/model/content/Repeater.java index f8938f8..f031aa7 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/Repeater.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/Repeater.java
@@ -17,7 +17,7 @@ private final boolean hidden; public Repeater(String name, AnimatableFloatValue copies, AnimatableFloatValue offset, - AnimatableTransform transform, boolean hidden) { + AnimatableTransform transform, boolean hidden) { this.name = name; this.copies = copies; this.offset = offset;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeData.java b/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeData.java index 5c0cdba..97d381c 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeData.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeData.java
@@ -1,6 +1,7 @@ package com.airbnb.lottie.model.content; import android.graphics.PointF; + import androidx.annotation.FloatRange; import com.airbnb.lottie.model.CubicCurveData; @@ -56,7 +57,7 @@ Logger.warning("Curves must have the same number of control points. Shape 1: " + shapeData1.getCurves().size() + "\tShape 2: " + shapeData2.getCurves().size()); } - + int points = Math.min(shapeData1.getCurves().size(), shapeData2.getCurves().size()); if (curves.size() < points) { for (int i = curves.size(); i < points; i++) {
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeFill.java b/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeFill.java index 26e75d2..f992d10 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeFill.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeFill.java
@@ -1,6 +1,7 @@ package com.airbnb.lottie.model.content; import android.graphics.Path; + import androidx.annotation.Nullable; import com.airbnb.lottie.LottieDrawable; @@ -19,7 +20,7 @@ private final boolean hidden; public ShapeFill(String name, boolean fillEnabled, Path.FillType fillType, - @Nullable AnimatableColorValue color, @Nullable AnimatableIntegerValue opacity, boolean hidden) { + @Nullable AnimatableColorValue color, @Nullable AnimatableIntegerValue opacity, boolean hidden) { this.name = name; this.fillEnabled = fillEnabled; this.fillType = fillType;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeStroke.java b/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeStroke.java index 240158e..dacb6be 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeStroke.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeStroke.java
@@ -1,6 +1,7 @@ package com.airbnb.lottie.model.content; import android.graphics.Paint; + import androidx.annotation.Nullable; import com.airbnb.lottie.LottieDrawable; @@ -62,9 +63,9 @@ private final boolean hidden; public ShapeStroke(String name, @Nullable AnimatableFloatValue offset, - List<AnimatableFloatValue> lineDashPattern, AnimatableColorValue color, - AnimatableIntegerValue opacity, AnimatableFloatValue width, LineCapType capType, - LineJoinType joinType, float miterLimit, boolean hidden) { + List<AnimatableFloatValue> lineDashPattern, AnimatableColorValue color, + AnimatableIntegerValue opacity, AnimatableFloatValue width, LineCapType capType, + LineJoinType joinType, float miterLimit, boolean hidden) { this.name = name; this.offset = offset; this.lineDashPattern = lineDashPattern;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeTrimPath.java b/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeTrimPath.java index aae9099..bf75948 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeTrimPath.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/ShapeTrimPath.java
@@ -32,7 +32,7 @@ private final boolean hidden; public ShapeTrimPath(String name, Type type, AnimatableFloatValue start, - AnimatableFloatValue end, AnimatableFloatValue offset, boolean hidden) { + AnimatableFloatValue end, AnimatableFloatValue offset, boolean hidden) { this.name = name; this.type = type; this.start = start;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/content/package-info.java b/lottie/src/main/java/com/airbnb/lottie/model/content/package-info.java index 4a474d3..3278a49 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/content/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/content/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.model.content; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java index f287299..8078b0f 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java
@@ -1,11 +1,19 @@ package com.airbnb.lottie.model.layer; -import android.graphics.*; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffXfermode; +import android.graphics.RectF; import android.os.Build; import androidx.annotation.CallSuper; import androidx.annotation.FloatRange; import androidx.annotation.Nullable; + import com.airbnb.lottie.L; import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.LottieDrawable; @@ -131,7 +139,7 @@ /** * Enable this to debug slow animations by outlining masks and mattes. The performance overhead of the masks and mattes will * be proportional to the surface area of all of the masks/mattes combined. - * + * <p> * DO NOT leave this enabled in production. */ void setOutlineMasksAndMattes(boolean outline) {
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/CompositionLayer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/CompositionLayer.java index 33361ed..11632bd 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/layer/CompositionLayer.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/CompositionLayer.java
@@ -5,6 +5,10 @@ import android.graphics.Paint; import android.graphics.RectF; +import androidx.annotation.FloatRange; +import androidx.annotation.Nullable; +import androidx.collection.LongSparseArray; + import com.airbnb.lottie.L; import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.LottieDrawable; @@ -19,10 +23,6 @@ import java.util.ArrayList; import java.util.List; -import androidx.annotation.FloatRange; -import androidx.annotation.Nullable; -import androidx.collection.LongSparseArray; - public class CompositionLayer extends BaseLayer { @Nullable private BaseKeyframeAnimation<Float, Float> timeRemapping; private final List<BaseLayer> layers = new ArrayList<>();
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/ImageLayer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/ImageLayer.java index f7e9186..fa855ae 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/layer/ImageLayer.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/ImageLayer.java
@@ -7,6 +7,7 @@ import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -44,7 +45,7 @@ canvas.concat(parentMatrix); src.set(0, 0, bitmap.getWidth(), bitmap.getHeight()); dst.set(0, 0, (int) (bitmap.getWidth() * density), (int) (bitmap.getHeight() * density)); - canvas.drawBitmap(bitmap, src, dst , paint); + canvas.drawBitmap(bitmap, src, dst, paint); canvas.restore(); } @@ -67,14 +68,14 @@ @Override public <T> void addValueCallback(T property, @Nullable LottieValueCallback<T> callback) { super.addValueCallback(property, callback); - if (property == LottieProperty.COLOR_FILTER) { - if (callback == null) { - colorFilterAnimation = null; - } else { - //noinspection unchecked - colorFilterAnimation = - new ValueCallbackKeyframeAnimation<>((LottieValueCallback<ColorFilter>) callback); - } + if (property == LottieProperty.COLOR_FILTER) { + if (callback == null) { + colorFilterAnimation = null; + } else { + //noinspection unchecked + colorFilterAnimation = + new ValueCallbackKeyframeAnimation<>((LottieValueCallback<ColorFilter>) callback); + } } } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/Layer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/Layer.java index 6b55581..ec144e7 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/layer/Layer.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/Layer.java
@@ -3,13 +3,13 @@ import androidx.annotation.Nullable; import com.airbnb.lottie.LottieComposition; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.model.animatable.AnimatableFloatValue; import com.airbnb.lottie.model.animatable.AnimatableTextFrame; import com.airbnb.lottie.model.animatable.AnimatableTextProperties; import com.airbnb.lottie.model.animatable.AnimatableTransform; import com.airbnb.lottie.model.content.ContentModel; import com.airbnb.lottie.model.content.Mask; +import com.airbnb.lottie.value.Keyframe; import java.util.List; import java.util.Locale; @@ -59,12 +59,12 @@ private final boolean hidden; public Layer(List<ContentModel> shapes, LottieComposition composition, String layerName, long layerId, - LayerType layerType, long parentId, @Nullable String refId, List<Mask> masks, - AnimatableTransform transform, int solidWidth, int solidHeight, int solidColor, - float timeStretch, float startFrame, int preCompWidth, int preCompHeight, - @Nullable AnimatableTextFrame text, @Nullable AnimatableTextProperties textProperties, - List<Keyframe<Float>> inOutKeyframes, MatteType matteType, - @Nullable AnimatableFloatValue timeRemapping, boolean hidden) { + LayerType layerType, long parentId, @Nullable String refId, List<Mask> masks, + AnimatableTransform transform, int solidWidth, int solidHeight, int solidColor, + float timeStretch, float startFrame, int preCompWidth, int preCompHeight, + @Nullable AnimatableTextFrame text, @Nullable AnimatableTextProperties textProperties, + List<Keyframe<Float>> inOutKeyframes, MatteType matteType, + @Nullable AnimatableFloatValue timeRemapping, boolean hidden) { this.shapes = shapes; this.composition = composition; this.layerName = layerName;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/ShapeLayer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/ShapeLayer.java index eeea415..e44fc99 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/layer/ShapeLayer.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/ShapeLayer.java
@@ -3,6 +3,7 @@ import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.RectF; + import androidx.annotation.NonNull; import com.airbnb.lottie.LottieDrawable;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/SolidLayer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/SolidLayer.java index 73f85f6..993e1b3 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/layer/SolidLayer.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/SolidLayer.java
@@ -7,6 +7,7 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.RectF; + import androidx.annotation.Nullable; import com.airbnb.lottie.LottieDrawable;
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/TextLayer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/TextLayer.java index 76da86a..d15c537 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/layer/TextLayer.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/TextLayer.java
@@ -7,8 +7,10 @@ import android.graphics.Path; import android.graphics.RectF; import android.graphics.Typeface; + import androidx.annotation.Nullable; import androidx.collection.LongSparseArray; + import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.LottieDrawable; import com.airbnb.lottie.LottieProperty; @@ -461,7 +463,7 @@ } if (callback == null) { - colorCallbackAnimation = null; + colorCallbackAnimation = null; } else { colorCallbackAnimation = new ValueCallbackKeyframeAnimation<>((LottieValueCallback<Integer>) callback); colorCallbackAnimation.addUpdateListener(this);
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/package-info.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/package-info.java index 58db6e7..761ae4b 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/layer/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.model.layer; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/network/DefaultLottieFetchResult.java b/lottie/src/main/java/com/airbnb/lottie/network/DefaultLottieFetchResult.java index 9a408ef..06dac3a 100644 --- a/lottie/src/main/java/com/airbnb/lottie/network/DefaultLottieFetchResult.java +++ b/lottie/src/main/java/com/airbnb/lottie/network/DefaultLottieFetchResult.java
@@ -1,5 +1,8 @@ package com.airbnb.lottie.network; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.airbnb.lottie.utils.Logger; import java.io.BufferedReader; @@ -8,9 +11,6 @@ import java.io.InputStreamReader; import java.net.HttpURLConnection; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - public class DefaultLottieFetchResult implements LottieFetchResult { @NonNull
diff --git a/lottie/src/main/java/com/airbnb/lottie/network/DefaultLottieNetworkFetcher.java b/lottie/src/main/java/com/airbnb/lottie/network/DefaultLottieNetworkFetcher.java index 68b2ac9..df4c348 100644 --- a/lottie/src/main/java/com/airbnb/lottie/network/DefaultLottieNetworkFetcher.java +++ b/lottie/src/main/java/com/airbnb/lottie/network/DefaultLottieNetworkFetcher.java
@@ -1,11 +1,11 @@ package com.airbnb.lottie.network; +import androidx.annotation.NonNull; + import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; -import androidx.annotation.NonNull; - public class DefaultLottieNetworkFetcher implements LottieNetworkFetcher { @Override
diff --git a/lottie/src/main/java/com/airbnb/lottie/network/LottieFetchResult.java b/lottie/src/main/java/com/airbnb/lottie/network/LottieFetchResult.java index 5a1a762..cae68d5 100644 --- a/lottie/src/main/java/com/airbnb/lottie/network/LottieFetchResult.java +++ b/lottie/src/main/java/com/airbnb/lottie/network/LottieFetchResult.java
@@ -1,12 +1,12 @@ package com.airbnb.lottie.network; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import java.io.Closeable; import java.io.IOException; import java.io.InputStream; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - /** * The result of the operation of obtaining a Lottie animation */ @@ -17,21 +17,18 @@ boolean isSuccessful(); /** - * * @return Received content stream */ @NonNull InputStream bodyByteStream() throws IOException; /** - * * @return Type of content received */ @Nullable String contentType(); /** - * * @return Operation error */ @Nullable
diff --git a/lottie/src/main/java/com/airbnb/lottie/network/LottieNetworkCacheProvider.java b/lottie/src/main/java/com/airbnb/lottie/network/LottieNetworkCacheProvider.java index 8258ba6..00a11b3 100644 --- a/lottie/src/main/java/com/airbnb/lottie/network/LottieNetworkCacheProvider.java +++ b/lottie/src/main/java/com/airbnb/lottie/network/LottieNetworkCacheProvider.java
@@ -1,12 +1,13 @@ package com.airbnb.lottie.network; -import java.io.File; - import androidx.annotation.NonNull; +import java.io.File; + /** * Interface for providing the custom cache directory where animations downloaded via url are saved. + * * @see com.airbnb.lottie.Lottie#initialize */ public interface LottieNetworkCacheProvider {
diff --git a/lottie/src/main/java/com/airbnb/lottie/network/LottieNetworkFetcher.java b/lottie/src/main/java/com/airbnb/lottie/network/LottieNetworkFetcher.java index a607d51..4b940bf 100644 --- a/lottie/src/main/java/com/airbnb/lottie/network/LottieNetworkFetcher.java +++ b/lottie/src/main/java/com/airbnb/lottie/network/LottieNetworkFetcher.java
@@ -1,19 +1,20 @@ package com.airbnb.lottie.network; -import java.io.IOException; - import androidx.annotation.NonNull; import androidx.annotation.WorkerThread; +import java.io.IOException; + /** * Implement this interface to handle network fetching manually when animations are requested via url. By default, Lottie will use an - * {@link java.net.HttpURLConnection} under the hood but this enables you to hook into your own network stack. By default, Lottie will also handle caching the + * {@link java.net.HttpURLConnection} under the hood but this enables you to hook into your own network stack. By default, Lottie will also handle + * caching the * animations but if you want to provide your own cache directory, you may implement {@link LottieNetworkCacheProvider}. * * @see com.airbnb.lottie.Lottie#initialize */ public interface LottieNetworkFetcher { - @WorkerThread - @NonNull - LottieFetchResult fetchSync(@NonNull String url) throws IOException; + @WorkerThread + @NonNull + LottieFetchResult fetchSync(@NonNull String url) throws IOException; }
diff --git a/lottie/src/main/java/com/airbnb/lottie/network/NetworkCache.java b/lottie/src/main/java/com/airbnb/lottie/network/NetworkCache.java index f0f29e1..f07ca24 100644 --- a/lottie/src/main/java/com/airbnb/lottie/network/NetworkCache.java +++ b/lottie/src/main/java/com/airbnb/lottie/network/NetworkCache.java
@@ -44,7 +44,7 @@ /** * If the animation doesn't exist in the cache, null will be returned. - * + * <p> * Once the animation is successfully parsed, {@link #renameTempFile(FileExtension)} must be * called to move the file from a temporary location to its permanent cache location so it can * be used in the future. @@ -154,6 +154,6 @@ } private static String filenameForUrl(String url, FileExtension extension, boolean isTemp) { - return "lottie_cache_" + url.replaceAll("\\W+", "") + (isTemp ? extension.tempExtension(): extension.extension); + return "lottie_cache_" + url.replaceAll("\\W+", "") + (isTemp ? extension.tempExtension() : extension.extension); } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/network/NetworkFetcher.java b/lottie/src/main/java/com/airbnb/lottie/network/NetworkFetcher.java index 75a8ab6..21bbcb5 100644 --- a/lottie/src/main/java/com/airbnb/lottie/network/NetworkFetcher.java +++ b/lottie/src/main/java/com/airbnb/lottie/network/NetworkFetcher.java
@@ -2,6 +2,10 @@ import android.util.Pair; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.WorkerThread; + import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.LottieCompositionFactory; import com.airbnb.lottie.LottieResult; @@ -11,13 +15,8 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; - import java.util.zip.ZipInputStream; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.WorkerThread; - public class NetworkFetcher { @NonNull
diff --git a/lottie/src/main/java/com/airbnb/lottie/network/package-info.java b/lottie/src/main/java/com/airbnb/lottie/network/package-info.java index 7a014de..c012bd9 100644 --- a/lottie/src/main/java/com/airbnb/lottie/network/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/network/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.network; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/AnimatablePathValueParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/AnimatablePathValueParser.java index be41074..c3acfb3 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/AnimatablePathValueParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/AnimatablePathValueParser.java
@@ -3,13 +3,13 @@ import android.graphics.PointF; import com.airbnb.lottie.LottieComposition; -import com.airbnb.lottie.parser.moshi.JsonReader; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.model.animatable.AnimatableFloatValue; import com.airbnb.lottie.model.animatable.AnimatablePathValue; import com.airbnb.lottie.model.animatable.AnimatableSplitDimensionPathValue; import com.airbnb.lottie.model.animatable.AnimatableValue; +import com.airbnb.lottie.parser.moshi.JsonReader; import com.airbnb.lottie.utils.Utils; +import com.airbnb.lottie.value.Keyframe; import java.io.IOException; import java.util.ArrayList; @@ -23,7 +23,8 @@ "y" ); - private AnimatablePathValueParser() {} + private AnimatablePathValueParser() { + } public static AnimatablePathValue parse( JsonReader reader, LottieComposition composition) throws IOException {
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/AnimatableTextPropertiesParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/AnimatableTextPropertiesParser.java index 1d3d0b9..fe485ee 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/AnimatableTextPropertiesParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/AnimatableTextPropertiesParser.java
@@ -18,7 +18,8 @@ "t" ); - private AnimatableTextPropertiesParser() {} + private AnimatableTextPropertiesParser() { + } public static AnimatableTextProperties parse( JsonReader reader, LottieComposition composition) throws IOException {
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/AnimatableTransformParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/AnimatableTransformParser.java index 7053a0b..309a8b9 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/AnimatableTransformParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/AnimatableTransformParser.java
@@ -1,7 +1,7 @@ package com.airbnb.lottie.parser; import android.graphics.PointF; -import android.util.JsonToken; + import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.model.animatable.AnimatableFloatValue; import com.airbnb.lottie.model.animatable.AnimatableIntegerValue; @@ -60,9 +60,9 @@ case 0: anchorPoint = AnimatablePathValueParser.parse(reader, composition); break; - default: - reader.skipName(); - reader.skipValue(); + default: + reader.skipName(); + reader.skipValue(); } } reader.endObject();
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/CircleShapeParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/CircleShapeParser.java index 5d55aa3..b07ae92 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/CircleShapeParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/CircleShapeParser.java
@@ -20,7 +20,8 @@ "d" ); - private CircleShapeParser() {} + private CircleShapeParser() { + } static CircleShape parse( JsonReader reader, LottieComposition composition, int d) throws IOException {
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/ColorParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/ColorParser.java index 5468245..9d3836b 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/ColorParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/ColorParser.java
@@ -1,7 +1,6 @@ package com.airbnb.lottie.parser; import android.graphics.Color; -import android.util.JsonToken; import com.airbnb.lottie.parser.moshi.JsonReader; @@ -10,7 +9,8 @@ public class ColorParser implements ValueParser<Integer> { public static final ColorParser INSTANCE = new ColorParser(); - private ColorParser() {} + private ColorParser() { + } @Override public Integer parse(JsonReader reader, float scale) throws IOException { boolean isArray = reader.peek() == JsonReader.Token.BEGIN_ARRAY; @@ -37,7 +37,9 @@ // It appears as if sometimes, Telegram Lottie stickers are exported with rgb [0,1] and a [0,255]. // This shouldn't happen but we can gracefully handle it when it does. // https://github.com/airbnb/lottie-android/issues/1478 - if (a <= 1) a *= 255; + if (a <= 1) { + a *= 255; + } } return Color.argb((int) a, (int) r, (int) g, (int) b);
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/ContentModelParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/ContentModelParser.java index 63d5f17..bd6918b 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/ContentModelParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/ContentModelParser.java
@@ -1,6 +1,7 @@ package com.airbnb.lottie.parser; import androidx.annotation.Nullable; + import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.model.content.ContentModel; import com.airbnb.lottie.parser.moshi.JsonReader;
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/FloatParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/FloatParser.java index 7995201..ed9d420 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/FloatParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/FloatParser.java
@@ -8,7 +8,8 @@ public class FloatParser implements ValueParser<Float> { public static final FloatParser INSTANCE = new FloatParser(); - private FloatParser() {} + private FloatParser() { + } @Override public Float parse(JsonReader reader, float scale) throws IOException { return JsonUtils.valueFromObject(reader) * scale;
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/FontParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/FontParser.java index d155db5..f655b9e 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/FontParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/FontParser.java
@@ -13,7 +13,8 @@ "ascent" ); - private FontParser() {} + private FontParser() { + } static Font parse(JsonReader reader) throws IOException { String family = null;
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/GradientColorParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/GradientColorParser.java index 37e96df..3899b0f 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/GradientColorParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/GradientColorParser.java
@@ -2,6 +2,8 @@ import android.graphics.Color; +import androidx.annotation.IntRange; + import com.airbnb.lottie.model.content.GradientColor; import com.airbnb.lottie.parser.moshi.JsonReader; import com.airbnb.lottie.utils.MiscUtils; @@ -10,8 +12,6 @@ import java.util.ArrayList; import java.util.List; -import androidx.annotation.IntRange; - public class GradientColorParser implements com.airbnb.lottie.parser.ValueParser<GradientColor> { /** * The number of colors if it exists in the json or -1 if it doesn't (legacy bodymovin)
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/GradientFillParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/GradientFillParser.java index 879b5a6..db9b4ae 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/GradientFillParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/GradientFillParser.java
@@ -30,7 +30,8 @@ "k" ); - private GradientFillParser() {} + private GradientFillParser() { + } static GradientFill parse( JsonReader reader, LottieComposition composition) throws IOException {
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/GradientStrokeParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/GradientStrokeParser.java index 818acea..4643bf3 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/GradientStrokeParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/GradientStrokeParser.java
@@ -19,7 +19,9 @@ class GradientStrokeParser { - private GradientStrokeParser() {} + private GradientStrokeParser() { + } + private static JsonReader.Options NAMES = JsonReader.Options.of( "nm", "g",
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/IntegerParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/IntegerParser.java index 2ed12a4..68957d1 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/IntegerParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/IntegerParser.java
@@ -7,7 +7,8 @@ public class IntegerParser implements ValueParser<Integer> { public static final IntegerParser INSTANCE = new IntegerParser(); - private IntegerParser() {} + private IntegerParser() { + } @Override public Integer parse(JsonReader reader, float scale) throws IOException { return Math.round(JsonUtils.valueFromObject(reader) * scale);
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/JsonUtils.java b/lottie/src/main/java/com/airbnb/lottie/parser/JsonUtils.java index 7cd7709..d33ff8b 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/JsonUtils.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/JsonUtils.java
@@ -2,8 +2,8 @@ import android.graphics.Color; import android.graphics.PointF; + import androidx.annotation.ColorInt; -import android.util.JsonToken; import com.airbnb.lottie.parser.moshi.JsonReader; @@ -45,10 +45,14 @@ static PointF jsonToPoint(JsonReader reader, float scale) throws IOException { switch (reader.peek()) { - case NUMBER: return jsonNumbersToPoint(reader, scale); - case BEGIN_ARRAY: return jsonArrayToPoint(reader, scale); - case BEGIN_OBJECT: return jsonObjectToPoint(reader, scale); - default: throw new IllegalArgumentException("Unknown point starts with " + reader.peek()); + case NUMBER: + return jsonNumbersToPoint(reader, scale); + case BEGIN_ARRAY: + return jsonArrayToPoint(reader, scale); + case BEGIN_OBJECT: + return jsonObjectToPoint(reader, scale); + default: + throw new IllegalArgumentException("Unknown point starts with " + reader.peek()); } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/KeyframeParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/KeyframeParser.java index 3e54a6a..934ffe3 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/KeyframeParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/KeyframeParser.java
@@ -1,19 +1,18 @@ package com.airbnb.lottie.parser; import android.graphics.PointF; +import android.view.animation.Interpolator; +import android.view.animation.LinearInterpolator; + import androidx.annotation.Nullable; import androidx.collection.SparseArrayCompat; import androidx.core.view.animation.PathInterpolatorCompat; -import android.util.JsonToken; -import android.view.animation.Interpolator; -import android.view.animation.LinearInterpolator; - import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.parser.moshi.JsonReader; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.utils.MiscUtils; import com.airbnb.lottie.utils.Utils; +import com.airbnb.lottie.value.Keyframe; import java.io.IOException; import java.lang.ref.WeakReference; @@ -72,7 +71,7 @@ * @param multiDimensional When true, the keyframe interpolators can be independent for the X and Y axis. */ static <T> Keyframe<T> parse(JsonReader reader, LottieComposition composition, - float scale, ValueParser<T> valueParser, boolean animated, boolean multiDimensional) throws IOException { + float scale, ValueParser<T> valueParser, boolean animated, boolean multiDimensional) throws IOException { if (animated && multiDimensional) { return parseMultiDimensionalKeyframe(composition, reader, scale, valueParser);
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java index bc392e2..47c359d 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/LayerParser.java
@@ -4,8 +4,6 @@ import android.graphics.Rect; import com.airbnb.lottie.LottieComposition; -import com.airbnb.lottie.parser.moshi.JsonReader; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.model.animatable.AnimatableFloatValue; import com.airbnb.lottie.model.animatable.AnimatableTextFrame; import com.airbnb.lottie.model.animatable.AnimatableTextProperties; @@ -13,7 +11,9 @@ import com.airbnb.lottie.model.content.ContentModel; import com.airbnb.lottie.model.content.Mask; import com.airbnb.lottie.model.layer.Layer; +import com.airbnb.lottie.parser.moshi.JsonReader; import com.airbnb.lottie.utils.Utils; +import com.airbnb.lottie.value.Keyframe; import java.io.IOException; import java.util.ArrayList; @@ -22,7 +22,8 @@ public class LayerParser { - private LayerParser() {} + private LayerParser() { + } private static final JsonReader.Options NAMES = JsonReader.Options.of( "nm", // 0
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/LottieCompositionMoshiParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/LottieCompositionMoshiParser.java index 3ff3e24..1c2a48a 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/LottieCompositionMoshiParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/LottieCompositionMoshiParser.java
@@ -2,7 +2,9 @@ import android.graphics.Rect; -import com.airbnb.lottie.L; +import androidx.collection.LongSparseArray; +import androidx.collection.SparseArrayCompat; + import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.LottieImageAsset; import com.airbnb.lottie.model.Font; @@ -19,9 +21,6 @@ import java.util.List; import java.util.Map; -import androidx.collection.LongSparseArray; -import androidx.collection.SparseArrayCompat; - public class LottieCompositionMoshiParser { private static final JsonReader.Options NAMES = JsonReader.Options.of( @@ -114,7 +113,7 @@ } private static void parseLayers(JsonReader reader, LottieComposition composition, - List<Layer> layers, LongSparseArray<Layer> layerMap) throws IOException { + List<Layer> layers, LongSparseArray<Layer> layerMap) throws IOException { int imageCount = 0; reader.beginArray(); while (reader.hasNext()) { @@ -241,7 +240,7 @@ ); private static void parseMarkers( - JsonReader reader, LottieComposition composition, List<Marker> markers) throws IOException{ + JsonReader reader, LottieComposition composition, List<Marker> markers) throws IOException { reader.beginArray(); while (reader.hasNext()) { String comment = null;
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/LottieCompositionParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/LottieCompositionParser.java index 03e8eac..ecc64bc 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/LottieCompositionParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/LottieCompositionParser.java
@@ -2,6 +2,9 @@ import android.graphics.Rect; +import androidx.collection.LongSparseArray; +import androidx.collection.SparseArrayCompat; + import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.LottieImageAsset; import com.airbnb.lottie.model.Font; @@ -18,9 +21,6 @@ import java.util.List; import java.util.Map; -import androidx.collection.LongSparseArray; -import androidx.collection.SparseArrayCompat; - public class LottieCompositionParser { static JsonReader.Options NAMES = JsonReader.Options.of( @@ -99,7 +99,7 @@ } private static void parseLayers(JsonReader reader, LottieComposition composition, - List<Layer> layers, LongSparseArray<Layer> layerMap) throws IOException { + List<Layer> layers, LongSparseArray<Layer> layerMap) throws IOException { int imageCount = 0; reader.beginArray(); while (reader.hasNext()) {
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/MaskParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/MaskParser.java index d335fea..eae1514 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/MaskParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/MaskParser.java
@@ -11,7 +11,8 @@ class MaskParser { - private MaskParser() {} + private MaskParser() { + } static Mask parse( JsonReader reader, LottieComposition composition) throws IOException {
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/MergePathsParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/MergePathsParser.java index 7f52fd2..067d21d 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/MergePathsParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/MergePathsParser.java
@@ -12,7 +12,8 @@ "hd" ); - private MergePathsParser() {} + private MergePathsParser() { + } static MergePaths parse(JsonReader reader) throws IOException { String name = null; @@ -25,7 +26,7 @@ name = reader.nextString(); break; case 1: - mode = MergePaths.MergePathsMode.forId(reader.nextInt()); + mode = MergePaths.MergePathsMode.forId(reader.nextInt()); break; case 2: hidden = reader.nextBoolean();
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/PathKeyframeParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/PathKeyframeParser.java index 1209157..b5ff817 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/PathKeyframeParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/PathKeyframeParser.java
@@ -1,19 +1,19 @@ package com.airbnb.lottie.parser; import android.graphics.PointF; -import android.util.JsonToken; import com.airbnb.lottie.LottieComposition; -import com.airbnb.lottie.parser.moshi.JsonReader; -import com.airbnb.lottie.value.Keyframe; import com.airbnb.lottie.animation.keyframe.PathKeyframe; +import com.airbnb.lottie.parser.moshi.JsonReader; import com.airbnb.lottie.utils.Utils; +import com.airbnb.lottie.value.Keyframe; import java.io.IOException; class PathKeyframeParser { - private PathKeyframeParser() {} + private PathKeyframeParser() { + } static PathKeyframe parse( JsonReader reader, LottieComposition composition) throws IOException {
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/PathParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/PathParser.java index 0141725..9713bf8 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/PathParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/PathParser.java
@@ -9,7 +9,8 @@ public class PathParser implements ValueParser<PointF> { public static final PathParser INSTANCE = new PathParser(); - private PathParser() {} + private PathParser() { + } @Override public PointF parse(JsonReader reader, float scale) throws IOException { return JsonUtils.jsonToPoint(reader, scale);
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/PolystarShapeParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/PolystarShapeParser.java index 57678aa..1865be6 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/PolystarShapeParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/PolystarShapeParser.java
@@ -12,19 +12,20 @@ class PolystarShapeParser { private static final JsonReader.Options NAMES = JsonReader.Options.of( - "nm", - "sy", - "pt", - "p", - "r", - "or", - "os", - "ir", - "is", - "hd" + "nm", + "sy", + "pt", + "p", + "r", + "or", + "os", + "ir", + "is", + "hd" ); - private PolystarShapeParser() {} + private PolystarShapeParser() { + } static PolystarShape parse( JsonReader reader, LottieComposition composition) throws IOException {
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/ScaleXYParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/ScaleXYParser.java index e27e5a2..ce327c5 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/ScaleXYParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/ScaleXYParser.java
@@ -1,7 +1,5 @@ package com.airbnb.lottie.parser; -import android.util.JsonToken; - import com.airbnb.lottie.parser.moshi.JsonReader; import com.airbnb.lottie.value.ScaleXY;
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/ShapeDataParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/ShapeDataParser.java index 87f2e9c..04dd07d 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/ShapeDataParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/ShapeDataParser.java
@@ -15,10 +15,10 @@ public class ShapeDataParser implements ValueParser<ShapeData> { public static final ShapeDataParser INSTANCE = new ShapeDataParser(); private static final JsonReader.Options NAMES = JsonReader.Options.of( - "c", - "v", - "i", - "o" + "c", + "v", + "i", + "o" ); private ShapeDataParser() {
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/ShapeFillParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/ShapeFillParser.java index 631883b..e354121 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/ShapeFillParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/ShapeFillParser.java
@@ -1,6 +1,7 @@ package com.airbnb.lottie.parser; import android.graphics.Path; + import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.model.animatable.AnimatableColorValue; import com.airbnb.lottie.model.animatable.AnimatableIntegerValue;
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/ShapeGroupParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/ShapeGroupParser.java index 17eb682..b95655d 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/ShapeGroupParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/ShapeGroupParser.java
@@ -12,12 +12,15 @@ class ShapeGroupParser { - private ShapeGroupParser() {} + private ShapeGroupParser() { + } + private static JsonReader.Options NAMES = JsonReader.Options.of( "nm", "hd", "it" ); + static ShapeGroup parse( JsonReader reader, LottieComposition composition) throws IOException { String name = null;
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/ShapeTrimPathParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/ShapeTrimPathParser.java index f8e70dd..f8cc323 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/ShapeTrimPathParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/ShapeTrimPathParser.java
@@ -1,6 +1,8 @@ package com.airbnb.lottie.parser; +import static com.airbnb.lottie.parser.moshi.JsonReader.Options; + import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.model.animatable.AnimatableFloatValue; import com.airbnb.lottie.model.content.ShapeTrimPath; @@ -8,11 +10,11 @@ import java.io.IOException; -import static com.airbnb.lottie.parser.moshi.JsonReader.*; - class ShapeTrimPathParser { - private ShapeTrimPathParser() {} + private ShapeTrimPathParser() { + } + private static Options NAMES = Options.of( "s", "e", @@ -21,6 +23,7 @@ "m", "hd" ); + static ShapeTrimPath parse( JsonReader reader, LottieComposition composition) throws IOException { String name = null;
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonEncodingException.java b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonEncodingException.java index accdfaa..936049f 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonEncodingException.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonEncodingException.java
@@ -15,12 +15,14 @@ */ package com.airbnb.lottie.parser.moshi; -import java.io.IOException; - import androidx.annotation.Nullable; +import java.io.IOException; -/** Thrown when the data being parsed is not encoded as valid JSON. */ + +/** + * Thrown when the data being parsed is not encoded as valid JSON. + */ final class JsonEncodingException extends IOException { JsonEncodingException(@Nullable String message) { super(message);
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonReader.java b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonReader.java index ffa7bf5..dc7083f 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonReader.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonReader.java
@@ -17,12 +17,8 @@ import java.io.Closeable; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; -import java.util.Map; -import androidx.annotation.Nullable; import okio.Buffer; import okio.BufferedSink; import okio.BufferedSource; @@ -188,6 +184,7 @@ * error. http://code.google.com/p/google-gson/issues/detail?id=341 */ private static final String[] REPLACEMENT_CHARS; + static { REPLACEMENT_CHARS = new String[128]; for (int i = 0; i <= 0x1f; i++) { @@ -210,14 +207,20 @@ String[] pathNames; int[] pathIndices; - /** True to accept non-spec compliant JSON. */ + /** + * True to accept non-spec compliant JSON. + */ boolean lenient; - /** True to throw a {@link JsonDataException} on any attempt to call {@link #skipValue()}. */ + /** + * True to throw a {@link JsonDataException} on any attempt to call {@link #skipValue()}. + */ boolean failOnUnknown; - /** Returns a new instance that reads UTF-8 encoded JSON from {@code source}. */ - public static JsonReader of(BufferedSource source) { + /** + * Returns a new instance that reads UTF-8 encoded JSON from {@code source}. + */ + public static JsonReader of(BufferedSource source) { return new JsonUtf8Reader(source); } @@ -249,9 +252,6 @@ } - - - /** * Consumes the next token from the JSON stream and asserts that it is the beginning of a new * array. @@ -279,25 +279,25 @@ /** * Returns true if the current array or object has another element. */ - public abstract boolean hasNext() throws IOException; + public abstract boolean hasNext() throws IOException; /** * Returns the type of the next token without consuming it. */ - public abstract Token peek() throws IOException; + public abstract Token peek() throws IOException; /** * Returns the next token, a {@linkplain Token#NAME property name}, and consumes it. * * @throws JsonDataException if the next token in the stream is not a property name. */ - public abstract String nextName() throws IOException; + public abstract String nextName() throws IOException; /** * If the next token is a {@linkplain Token#NAME property name} that's in {@code options}, this * consumes it and returns its index. Otherwise this returns -1 and no name is consumed. */ - public abstract int selectName(Options options) throws IOException; + public abstract int selectName(Options options) throws IOException; /** * Skips the next token, consuming it. This method is intended for use when the JSON token stream @@ -329,7 +329,7 @@ * Double#parseDouble(String)}. * * @throws JsonDataException if the next token is not a literal value, or if the next literal - * value cannot be parsed as a double, or is non-finite. + * value cannot be parsed as a double, or is non-finite. */ public abstract double nextDouble() throws IOException; @@ -339,7 +339,7 @@ * value cannot be exactly represented by a Java {@code int}, this method throws. * * @throws JsonDataException if the next token is not a literal value, if the next literal value - * cannot be parsed as a number, or exactly represented as an int. + * cannot be parsed as a number, or exactly represented as an int. */ public abstract int nextInt() throws IOException; @@ -358,7 +358,7 @@ * Returns a <a href="http://goessner.net/articles/JsonPath/">JsonPath</a> to * the current location in the JSON value. */ - public final String getPath() { + public final String getPath() { return JsonScope.getPath(stackSize, scopes, pathNames, pathIndices); } @@ -375,7 +375,7 @@ this.doubleQuoteSuffix = doubleQuoteSuffix; } - public static Options of(String... strings) { + public static Options of(String... strings) { try { ByteString[] result = new ByteString[strings.length]; Buffer buffer = new Buffer();
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonScope.java b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonScope.java index 0234af2..eac9ba4 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonScope.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonScope.java
@@ -15,33 +15,51 @@ */ package com.airbnb.lottie.parser.moshi; -/** Lexical scoping elements within a JSON reader or writer. */ +/** + * Lexical scoping elements within a JSON reader or writer. + */ final class JsonScope { private JsonScope() { } - /** An array with no elements requires no separators or newlines before it is closed. */ + /** + * An array with no elements requires no separators or newlines before it is closed. + */ static final int EMPTY_ARRAY = 1; - /** A array with at least one value requires a comma and newline before the next element. */ + /** + * A array with at least one value requires a comma and newline before the next element. + */ static final int NONEMPTY_ARRAY = 2; - /** An object with no name/value pairs requires no separators or newlines before it is closed. */ + /** + * An object with no name/value pairs requires no separators or newlines before it is closed. + */ static final int EMPTY_OBJECT = 3; - /** An object whose most recent element is a key. The next element must be a value. */ + /** + * An object whose most recent element is a key. The next element must be a value. + */ static final int DANGLING_NAME = 4; - /** An object with at least one name/value pair requires a separator before the next element. */ + /** + * An object with at least one name/value pair requires a separator before the next element. + */ static final int NONEMPTY_OBJECT = 5; - /** No object or array has been started. */ + /** + * No object or array has been started. + */ static final int EMPTY_DOCUMENT = 6; - /** A document with at an array or object. */ + /** + * A document with at an array or object. + */ static final int NONEMPTY_DOCUMENT = 7; - /** A document that's been closed and cannot be accessed. */ + /** + * A document that's been closed and cannot be accessed. + */ static final int CLOSED = 8; /**
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonUtf8Reader.java b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonUtf8Reader.java index ab19c8f..e3fc1f8 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonUtf8Reader.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/JsonUtf8Reader.java
@@ -15,10 +15,11 @@ */ package com.airbnb.lottie.parser.moshi; +import androidx.annotation.Nullable; + import java.io.EOFException; import java.io.IOException; -import androidx.annotation.Nullable; import okio.Buffer; import okio.BufferedSource; import okio.ByteString; @@ -44,13 +45,17 @@ private static final int PEEKED_SINGLE_QUOTED = 8; private static final int PEEKED_DOUBLE_QUOTED = 9; private static final int PEEKED_UNQUOTED = 10; - /** When this is returned, the string value is stored in peekedString. */ + /** + * When this is returned, the string value is stored in peekedString. + */ private static final int PEEKED_BUFFERED = 11; private static final int PEEKED_SINGLE_QUOTED_NAME = 12; private static final int PEEKED_DOUBLE_QUOTED_NAME = 13; private static final int PEEKED_UNQUOTED_NAME = 14; private static final int PEEKED_BUFFERED_NAME = 15; - /** When this is returned, the integer value is stored in peekedLong. */ + /** + * When this is returned, the integer value is stored in peekedLong. + */ private static final int PEEKED_LONG = 16; private static final int PEEKED_NUMBER = 17; private static final int PEEKED_EOF = 18; @@ -65,7 +70,9 @@ private static final int NUMBER_CHAR_EXP_SIGN = 6; private static final int NUMBER_CHAR_EXP_DIGIT = 7; - /** The input JSON. */ + /** + * The input JSON. + */ private final BufferedSource source; private final Buffer buffer; @@ -716,11 +723,15 @@ StringBuilder builder = null; while (true) { long index = source.indexOfElement(runTerminator); - if (index == -1L) throw syntaxError("Unterminated string"); + if (index == -1L) { + throw syntaxError("Unterminated string"); + } // If we've got an escape character, we're going to need a string builder. if (buffer.getByte(index) == '\\') { - if (builder == null) builder = new StringBuilder(); + if (builder == null) { + builder = new StringBuilder(); + } builder.append(buffer.readUtf8(index)); buffer.readByte(); // '\' builder.append(readEscapeCharacter()); @@ -740,7 +751,9 @@ } } - /** Returns an unquoted value as a string. */ + /** + * Returns an unquoted value as a string. + */ private String nextUnquotedValue() throws IOException { long i = source.indexOfElement(UNQUOTED_STRING_TERMINALS); return i != -1 ? buffer.readUtf8(i) : buffer.readUtf8(); @@ -749,7 +762,9 @@ private void skipQuotedValue(ByteString runTerminator) throws IOException { while (true) { long index = source.indexOfElement(runTerminator); - if (index == -1L) throw syntaxError("Unterminated string"); + if (index == -1L) { + throw syntaxError("Unterminated string"); + } if (buffer.getByte(index) == '\\') { buffer.skip(index + 1); @@ -1037,7 +1052,9 @@ return (char) escaped; default: - if (!lenient) throw syntaxError("Invalid escape sequence: \\" + (char) escaped); + if (!lenient) { + throw syntaxError("Invalid escape sequence: \\" + (char) escaped); + } return (char) escaped; } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/LinkedHashTreeMap.java b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/LinkedHashTreeMap.java index 4537da9..959aaa7 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/LinkedHashTreeMap.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/LinkedHashTreeMap.java
@@ -37,7 +37,7 @@ * LinkedHashMap classes. */ final class LinkedHashTreeMap<K, V> extends AbstractMap<K, V> implements Serializable { - @SuppressWarnings({ "unchecked", "rawtypes" }) // to avoid Comparable<Comparable<Comparable<...>>> + @SuppressWarnings({"unchecked", "rawtypes"}) // to avoid Comparable<Comparable<Comparable<...>>> private static final Comparator<Comparable> NATURAL_ORDER = new Comparator<Comparable>() { public int compare(Comparable a, Comparable b) { return a.compareTo(b); @@ -64,12 +64,11 @@ * be null if {@code comparator} permits. * * @param comparator the comparator to order elements with, or {@code null} to - * use the natural ordering. + * use the natural ordering. */ @SuppressWarnings({ "unchecked", "rawtypes" // Unsafe! if comparator is null, this assumes K is comparable. - }) - LinkedHashTreeMap(Comparator<? super K> comparator) { + }) LinkedHashTreeMap(Comparator<? super K> comparator) { this.comparator = comparator != null ? comparator : (Comparator) NATURAL_ORDER; @@ -126,7 +125,7 @@ * Returns the node at or adjacent to the given key, creating it if requested. * * @throws ClassCastException if {@code key} and the tree's keys aren't - * mutually comparable. + * mutually comparable. */ Node<K, V> find(K key, boolean create) { Comparator<? super K> comparator = this.comparator; @@ -333,7 +332,7 @@ * newly-unbalanced node and the tree's root. * * @param insert true if the node was unbalanced by an insert; false if it - * was by a removal. + * was by a removal. */ private void rebalance(Node<K, V> unbalanced, boolean insert) { for (Node<K, V> node = unbalanced; node != null; node = node.parent) { @@ -475,14 +474,18 @@ V value; int height; - /** Create the header entry. */ + /** + * Create the header entry. + */ Node() { key = null; hash = -1; next = prev = this; } - /** Create a regular entry. */ + /** + * Create a regular entry. + */ Node(Node<K, V> parent, K key, int hash, Node<K, V> next, Node<K, V> prev) { this.parent = parent; this.key = key; @@ -567,7 +570,7 @@ // TODO: don't do anything if we're already at MAX_CAPACITY int oldCapacity = oldTable.length; @SuppressWarnings("unchecked") // Arrays and generics don't get along. - Node<K, V>[] newTable = new Node[oldCapacity * 2]; + Node<K, V>[] newTable = new Node[oldCapacity * 2]; AvlIterator<K, V> iterator = new AvlIterator<>(); AvlBuilder<K, V> leftBuilder = new AvlBuilder<>(); AvlBuilder<K, V> rightBuilder = new AvlBuilder<>(); @@ -620,7 +623,9 @@ * iteration of a tree. */ static class AvlIterator<K, V> { - /** This stack is a singly linked list, linked by the 'parent' field. */ + /** + * This stack is a singly linked list, linked by the 'parent' field. + */ private Node<K, V> stackTop; void reset(Node<K, V> root) { @@ -668,7 +673,9 @@ * {@code O(S)}. */ static final class AvlBuilder<K, V> { - /** This stack is a singly linked list, linked by the 'parent' field. */ + /** + * This stack is a singly linked list, linked by the 'parent' field. + */ private Node<K, V> stack; private int leavesToSkip; private int leavesSkipped;
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/package-info.java b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/package-info.java index 3c6cd55..e76b77d 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/moshi/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/moshi/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.parser.moshi; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/package-info.java b/lottie/src/main/java/com/airbnb/lottie/parser/package-info.java index fa7edd8..f27cd7d 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.parser; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/utils/BaseLottieAnimator.java b/lottie/src/main/java/com/airbnb/lottie/utils/BaseLottieAnimator.java index c6e0685..e55246a 100644 --- a/lottie/src/main/java/com/airbnb/lottie/utils/BaseLottieAnimator.java +++ b/lottie/src/main/java/com/airbnb/lottie/utils/BaseLottieAnimator.java
@@ -19,6 +19,7 @@ @Override public void setStartDelay(long startDelay) { throw new UnsupportedOperationException("LottieAnimator does not support setStartDelay."); } + @Override public ValueAnimator setDuration(long duration) { throw new UnsupportedOperationException("LottieAnimator does not support setDuration."); }
diff --git a/lottie/src/main/java/com/airbnb/lottie/utils/LottieValueAnimator.java b/lottie/src/main/java/com/airbnb/lottie/utils/LottieValueAnimator.java index 9673259..c3a652b 100644 --- a/lottie/src/main/java/com/airbnb/lottie/utils/LottieValueAnimator.java +++ b/lottie/src/main/java/com/airbnb/lottie/utils/LottieValueAnimator.java
@@ -1,11 +1,12 @@ package com.airbnb.lottie.utils; import android.animation.ValueAnimator; +import android.view.Choreographer; + import androidx.annotation.FloatRange; import androidx.annotation.MainThread; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import android.view.Choreographer; import com.airbnb.lottie.L; import com.airbnb.lottie.LottieComposition; @@ -138,8 +139,8 @@ if (keepMinAndMaxFrames) { setMinAndMaxFrames( - (int) Math.max(this.minFrame, composition.getStartFrame()), - (int) Math.min(this.maxFrame, composition.getEndFrame()) + (int) Math.max(this.minFrame, composition.getStartFrame()), + (int) Math.min(this.maxFrame, composition.getEndFrame()) ); } else { setMinAndMaxFrames((int) composition.getStartFrame(), (int) composition.getEndFrame());
diff --git a/lottie/src/main/java/com/airbnb/lottie/utils/MiscUtils.java b/lottie/src/main/java/com/airbnb/lottie/utils/MiscUtils.java index c55432b..ec285bd 100644 --- a/lottie/src/main/java/com/airbnb/lottie/utils/MiscUtils.java +++ b/lottie/src/main/java/com/airbnb/lottie/utils/MiscUtils.java
@@ -2,6 +2,7 @@ import android.graphics.Path; import android.graphics.PointF; + import androidx.annotation.FloatRange; import com.airbnb.lottie.animation.content.KeyPathElementContent; @@ -97,7 +98,7 @@ * Helper method for any {@link KeyPathElementContent} that will check if the content * fully matches the keypath then will add itself as the final key, resolve it, and add * it to the accumulator list. - * + * <p> * Any {@link KeyPathElementContent} should call through to this as its implementation of * {@link KeyPathElementContent#resolveKeyPath(KeyPath, int, List, KeyPath)}. */
diff --git a/lottie/src/main/java/com/airbnb/lottie/utils/Utils.java b/lottie/src/main/java/com/airbnb/lottie/utils/Utils.java index baac4e5..a0f7e9e 100644 --- a/lottie/src/main/java/com/airbnb/lottie/utils/Utils.java +++ b/lottie/src/main/java/com/airbnb/lottie/utils/Utils.java
@@ -14,6 +14,8 @@ import android.os.Build; import android.provider.Settings; +import androidx.annotation.Nullable; + import com.airbnb.lottie.L; import com.airbnb.lottie.animation.LPaint; import com.airbnb.lottie.animation.content.TrimPathContent; @@ -29,8 +31,6 @@ import javax.net.ssl.SSLException; -import androidx.annotation.Nullable; - public final class Utils { public static final int SECOND_IN_NANOS = 1000000000; @@ -261,11 +261,11 @@ public static float getAnimationScale(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return Settings.Global.getFloat(context.getContentResolver(), - Settings.Global.ANIMATOR_DURATION_SCALE, 1.0f); + Settings.Global.ANIMATOR_DURATION_SCALE, 1.0f); } else { //noinspection deprecation return Settings.System.getFloat(context.getContentResolver(), - Settings.System.ANIMATOR_DURATION_SCALE, 1.0f); + Settings.System.ANIMATOR_DURATION_SCALE, 1.0f); } }
diff --git a/lottie/src/main/java/com/airbnb/lottie/utils/package-info.java b/lottie/src/main/java/com/airbnb/lottie/utils/package-info.java index 7bf2a4c..f0a42a2 100644 --- a/lottie/src/main/java/com/airbnb/lottie/utils/package-info.java +++ b/lottie/src/main/java/com/airbnb/lottie/utils/package-info.java
@@ -1,6 +1,6 @@ @RestrictTo(LIBRARY) package com.airbnb.lottie.utils; -import androidx.annotation.RestrictTo; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; -import static androidx.annotation.RestrictTo.Scope.LIBRARY; \ No newline at end of file +import androidx.annotation.RestrictTo; \ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/value/Keyframe.java b/lottie/src/main/java/com/airbnb/lottie/value/Keyframe.java index 36d45d9..78f74db 100644 --- a/lottie/src/main/java/com/airbnb/lottie/value/Keyframe.java +++ b/lottie/src/main/java/com/airbnb/lottie/value/Keyframe.java
@@ -1,9 +1,10 @@ package com.airbnb.lottie.value; import android.graphics.PointF; +import android.view.animation.Interpolator; + import androidx.annotation.FloatRange; import androidx.annotation.Nullable; -import android.view.animation.Interpolator; import com.airbnb.lottie.LottieComposition; @@ -94,7 +95,7 @@ return 0f; } if (startProgress == Float.MIN_VALUE) { - startProgress = (startFrame - composition.getStartFrame()) / composition.getDurationFrames(); + startProgress = (startFrame - composition.getStartFrame()) / composition.getDurationFrames(); } return startProgress; }
diff --git a/lottie/src/main/java/com/airbnb/lottie/value/LottieRelativePointValueCallback.java b/lottie/src/main/java/com/airbnb/lottie/value/LottieRelativePointValueCallback.java index f0a7446..4aacef4 100644 --- a/lottie/src/main/java/com/airbnb/lottie/value/LottieRelativePointValueCallback.java +++ b/lottie/src/main/java/com/airbnb/lottie/value/LottieRelativePointValueCallback.java
@@ -1,6 +1,7 @@ package com.airbnb.lottie.value; import android.graphics.PointF; + import androidx.annotation.NonNull; import com.airbnb.lottie.utils.MiscUtils;
diff --git a/lottie/src/main/java/com/airbnb/lottie/value/LottieValueCallback.java b/lottie/src/main/java/com/airbnb/lottie/value/LottieValueCallback.java index 6e3354b..201c3bc 100644 --- a/lottie/src/main/java/com/airbnb/lottie/value/LottieValueCallback.java +++ b/lottie/src/main/java/com/airbnb/lottie/value/LottieValueCallback.java
@@ -29,7 +29,7 @@ /** * Override this if you haven't set a static value in the constructor or with setValue. - * + * <p> * Return null to resort to the default value. */ @Nullable