diff --git a/lottie-compose/src/test/java/com/airbnb/lottie/compose/LottieClipSpecTest.kt b/lottie-compose/src/test/java/com/airbnb/lottie/compose/LottieClipSpecTest.kt index 346c95d73f..e9a2bdbb4f 100644 --- a/lottie-compose/src/test/java/com/airbnb/lottie/compose/LottieClipSpecTest.kt +++ b/lottie-compose/src/test/java/com/airbnb/lottie/compose/LottieClipSpecTest.kt @@ -139,6 +139,8 @@ class LottieClipSpecTest { SparseArrayCompat(), emptyMap(), markers, + 0, + 0, ) return composition } diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieComposition.java b/lottie/src/main/java/com/airbnb/lottie/LottieComposition.java index a03e392101..1fc5d9c1f2 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieComposition.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieComposition.java @@ -72,12 +72,15 @@ public class LottieComposition { */ private int maskAndMatteCount = 0; + private int width; + private int height; + @RestrictTo(RestrictTo.Scope.LIBRARY) public void init(Rect bounds, float startFrame, float endFrame, float frameRate, List layers, LongSparseArray layerMap, Map> precomps, Map images, float imagesDpScale, SparseArrayCompat characters, Map fonts, - List markers) { + List markers, int width, int height) { this.bounds = bounds; this.startFrame = startFrame; this.endFrame = endFrame; @@ -90,6 +93,8 @@ public void init(Rect bounds, float startFrame, float endFrame, float frameRate, this.characters = characters; this.fonts = fonts; this.markers = markers; + this.width = width; + this.height = height; } @RestrictTo(RestrictTo.Scope.LIBRARY) @@ -233,6 +238,13 @@ public float getDurationFrames() { return endFrame - startFrame; } + public int getHeight() { + return height; + } + + public int getWidth() { + return width; + } @NonNull @Override 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 ee972df675..8c6f07c56e 100644 --- a/lottie/src/main/java/com/airbnb/lottie/parser/LottieCompositionMoshiParser.java +++ b/lottie/src/main/java/com/airbnb/lottie/parser/LottieCompositionMoshiParser.java @@ -107,7 +107,7 @@ public static LottieComposition parse(JsonReader reader) throws IOException { Rect bounds = new Rect(0, 0, scaledWidth, scaledHeight); composition.init(bounds, startFrame, endFrame, frameRate, layers, layerMap, precomps, - images, Utils.dpScale(), characters, fonts, markers); + images, Utils.dpScale(), characters, fonts, markers, width, height); return composition; } diff --git a/lottie/src/test/java/com/airbnb/lottie/LottieDrawableTest.java b/lottie/src/test/java/com/airbnb/lottie/LottieDrawableTest.java index 3e158ec722..9c50952062 100644 --- a/lottie/src/test/java/com/airbnb/lottie/LottieDrawableTest.java +++ b/lottie/src/test/java/com/airbnb/lottie/LottieDrawableTest.java @@ -4,10 +4,6 @@ import android.graphics.Rect; import androidx.collection.LongSparseArray; import androidx.collection.SparseArrayCompat; -import com.airbnb.lottie.model.Font; -import com.airbnb.lottie.model.FontCharacter; -import com.airbnb.lottie.model.Marker; -import com.airbnb.lottie.model.layer.Layer; import org.junit.Before; import org.junit.Test; @@ -16,7 +12,6 @@ import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import static junit.framework.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; @@ -39,7 +34,7 @@ private LottieComposition createComposition(int startFrame, int endFrame) { composition.init(new Rect(), startFrame, endFrame, 1000, new ArrayList<>(), new LongSparseArray<>(0), new HashMap<>(0), new HashMap<>(0), 1f, new SparseArrayCompat<>(0), - new HashMap<>(0), new ArrayList<>()); + new HashMap<>(0), new ArrayList<>(), 0, 0); return composition; } diff --git a/lottie/src/test/java/com/airbnb/lottie/LottieValueAnimatorUnitTest.java b/lottie/src/test/java/com/airbnb/lottie/LottieValueAnimatorUnitTest.java index 102087b636..a26e4a9c06 100644 --- a/lottie/src/test/java/com/airbnb/lottie/LottieValueAnimatorUnitTest.java +++ b/lottie/src/test/java/com/airbnb/lottie/LottieValueAnimatorUnitTest.java @@ -5,10 +5,6 @@ import android.graphics.Rect; import androidx.collection.LongSparseArray; import androidx.collection.SparseArrayCompat; -import com.airbnb.lottie.model.Font; -import com.airbnb.lottie.model.FontCharacter; -import com.airbnb.lottie.model.Marker; -import com.airbnb.lottie.model.layer.Layer; import com.airbnb.lottie.utils.LottieValueAnimator; import org.junit.Before; import org.junit.Test; @@ -17,7 +13,6 @@ import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import static junit.framework.Assert.assertEquals; @@ -63,7 +58,7 @@ private LottieComposition createComposition(int startFrame, int endFrame) { composition.init(new Rect(), startFrame, endFrame, 1000, new ArrayList<>(), new LongSparseArray<>(0), new HashMap<>(0), new HashMap<>(0), 1f, new SparseArrayCompat<>(0), - new HashMap<>(0), new ArrayList<>()); + new HashMap<>(0), new ArrayList<>(), 0, 0); return composition; }