diff --git a/LottieSample/libs/happo.aar b/LottieSample/libs/happo.aar index d07533211f..43a9f0a2e6 100644 Binary files a/LottieSample/libs/happo.aar and b/LottieSample/libs/happo.aar differ diff --git a/LottieSample/src/androidTest/java/com/airbnb/lottie/LottieSnapshotProvider.java b/LottieSample/src/androidTest/java/com/airbnb/lottie/LottieSnapshotProvider.java index ea3ae7776b..fdb2d6db86 100644 --- a/LottieSample/src/androidTest/java/com/airbnb/lottie/LottieSnapshotProvider.java +++ b/LottieSample/src/androidTest/java/com/airbnb/lottie/LottieSnapshotProvider.java @@ -96,6 +96,7 @@ public void run() { } private void runAnimation(final String name) { + Log.d("Happo", "runAnimation " + name); LottieComposition composition = LottieComposition.Factory.fromFileSync(context, name); if (composition.getBounds().width() > 4 * Resources.getSystem().getDisplayMetrics().widthPixels || composition.getBounds().height() > 4 * Resources.getSystem().getDisplayMetrics().heightPixels) { @@ -114,6 +115,7 @@ private void drawComposition(LottieComposition composition, String name) { } }); view.setComposition(composition); + Log.d("Happo", "Snapshotting " + name); for (float progress : PROGRESS) { view.setProgress(progress); recordSnapshot(view, 1080, "android", name, Integer.toString((int) (progress * 100))); diff --git a/LottieSample/src/androidTest/java/com/airbnb/lottie/LottieTest.java b/LottieSample/src/androidTest/java/com/airbnb/lottie/LottieTest.java index 8da9b4a318..c642ac6b71 100644 --- a/LottieSample/src/androidTest/java/com/airbnb/lottie/LottieTest.java +++ b/LottieSample/src/androidTest/java/com/airbnb/lottie/LottieTest.java @@ -7,6 +7,7 @@ import android.support.test.rule.GrantPermissionRule; import android.support.test.runner.AndroidJUnit4; import android.text.TextUtils; +import android.util.Log; import com.airbnb.happo.HappoRunner; import com.airbnb.lottie.samples.MainActivity; @@ -41,6 +42,7 @@ public class LottieTest { String branch = TextUtils.isEmpty(com.airbnb.lottie.samples.BuildConfig.TRAVIS_GIT_BRANCH) ? com.airbnb.lottie.samples.BuildConfig.GIT_BRANCH : com.airbnb.lottie.samples.BuildConfig.TRAVIS_GIT_BRANCH; + Log.d("Happo", "Happo S3 " + com.airbnb.lottie.samples.BuildConfig.S3AccessKey); HappoRunner.runTests( mainActivityRule.getActivity(), new LottieSnapshotProvider(mainActivityRule.getActivity()), diff --git a/LottieSample/src/main/assets/Arrow.json b/LottieSample/src/main/assets/Arrow.json deleted file mode 100644 index 10ace9d84f..0000000000 --- a/LottieSample/src/main/assets/Arrow.json +++ /dev/null @@ -1 +0,0 @@ -{"v":"4.11.1","fr":30,"ip":0,"op":180,"w":400,"h":300,"nm":"HamburgerArrow","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":3,"nm":"Rotator","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[200.5,149.375,0],"ix":2},"a":{"a":0,"k":[60,60,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"ip":0,"op":180,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"A2","parent":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[60,60.625,0],"ix":2},"a":{"a":0,"k":[0.5,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-34,0],[35,0]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.403921574354,0.160784319043,0.698039233685,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":10,"ix":5},"lc":1,"lj":1,"ml":4,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"bm":0}]} \ No newline at end of file diff --git a/LottieSample/src/main/assets/Gradient.json b/LottieSample/src/main/assets/Gradient.json deleted file mode 100644 index 4d51611c62..0000000000 --- a/LottieSample/src/main/assets/Gradient.json +++ /dev/null @@ -1 +0,0 @@ -{"v":"4.11.1","fr":29.9700012207031,"ip":0,"op":61.0000024845809,"w":300,"h":300,"nm":"Comp 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[150,150,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[173.406,173.406],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"gs","o":{"a":0,"k":100,"ix":9},"w":{"a":0,"k":18,"ix":10},"g":{"p":2,"k":{"a":0,"k":[0,1,1,1,1,0,0,0],"ix":8}},"s":{"a":0,"k":[0,0],"ix":4},"e":{"a":0,"k":[100,0],"ix":5},"t":1,"lc":1,"lj":1,"ml":4,"nm":"Gradient Stroke 1","mn":"ADBE Vector Graphic - G-Stroke","hd":false},{"ty":"gs","o":{"a":0,"k":100,"ix":9},"w":{"a":0,"k":42,"ix":10},"g":{"p":2,"k":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[0,1,1,1,1,0,0,0],"e":[0,1,1,1,1,0,0,0]},{"t":60.0000024438501}],"ix":8}},"s":{"a":0,"k":[0,0],"ix":4},"e":{"a":0,"k":[100,0],"ix":5},"t":1,"lc":1,"lj":1,"ml":4,"nm":"Gradient Stroke 2","mn":"ADBE Vector Graphic - G-Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[8.703,-3.297],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":61.0000024845809,"st":0,"bm":0}]} \ No newline at end of file diff --git a/LottieSample/src/main/assets/Shapes.json b/LottieSample/src/main/assets/Shapes.json deleted file mode 100644 index 4549a33134..0000000000 --- a/LottieSample/src/main/assets/Shapes.json +++ /dev/null @@ -1 +0,0 @@ -{"v":"4.11.1","fr":29.9700012207031,"ip":0,"op":61.0000024845809,"w":150,"h":250,"nm":"Shapes","ddd":0,"assets":[{"id":"comp_1","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[195,25,0],"e":[304,25,0],"to":[18.1666660308838,0,0],"ti":[-18.1666660308838,0,0]},{"t":60.0000024438501}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[32.832,32.832],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":20,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.928262987324,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-174.584,2.416],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":61.0000024845809,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"Circle 1","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[75,180,0],"ix":2},"a":{"a":0,"k":[75,25,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":150,"h":50,"ip":0,"op":61.0000024845809,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":0,"nm":"Circle 2","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[75,226,0],"ix":2},"a":{"a":0,"k":[75,25,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":150,"h":50,"ip":0,"op":61.0000024845809,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[75,82,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[25.836,25.836],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.928262987324,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"rp","c":{"a":0,"k":2,"ix":1},"o":{"a":0,"k":0,"ix":2},"m":1,"ix":3,"tr":{"ty":"tr","p":{"a":0,"k":[30,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":4},"so":{"a":0,"k":100,"ix":5},"eo":{"a":0,"k":100,"ix":6},"nm":"Transform"},"nm":"Repeater 1","mn":"ADBE Vector Filter - Repeater","hd":false},{"ty":"tr","p":{"a":0,"k":[-15.082,-0.082],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Repeater Shape","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[38.172,38.172],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":6,"ix":5},"lc":1,"lj":1,"ml":4,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.928262987324,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-46.414,-42.414],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle","np":3,"cix":2,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ty":"sr","sy":1,"d":1,"pt":{"a":0,"k":5,"ix":3},"p":{"a":0,"k":[0,0],"ix":4},"r":{"a":0,"k":0,"ix":5},"ir":{"a":0,"k":11,"ix":6},"is":{"a":0,"k":0,"ix":8},"or":{"a":0,"k":28.99,"ix":7},"os":{"a":0,"k":0,"ix":9},"ix":1,"nm":"Polystar Path 1","mn":"ADBE Vector Shape - Star","hd":false},{"ty":"fl","c":{"a":0,"k":[0.928262987324,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[35,43],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Star","np":2,"cix":2,"ix":3,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ty":"sr","sy":2,"d":1,"pt":{"a":0,"k":5,"ix":3},"p":{"a":0,"k":[0,0],"ix":4},"r":{"a":0,"k":0,"ix":5},"or":{"a":0,"k":25.324,"ix":7},"os":{"a":0,"k":0,"ix":9},"ix":1,"nm":"Polystar Path 1","mn":"ADBE Vector Shape - Star","hd":false},{"ty":"fl","c":{"a":0,"k":[0.928262987324,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-42,47],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Polygon","np":2,"cix":2,"ix":4,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[42.203,42.203],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.928262987324,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[40.602,-43.398],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse","np":2,"cix":2,"ix":5,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":61.0000024845809,"st":0,"bm":0}]} \ No newline at end of file diff --git a/LottieSample/src/main/assets/Square.json b/LottieSample/src/main/assets/Square.json deleted file mode 100644 index 42c310c120..0000000000 --- a/LottieSample/src/main/assets/Square.json +++ /dev/null @@ -1 +0,0 @@ -{"v":"4.11.1","fr":29.9700012207031,"ip":0,"op":61.0000024845809,"w":50,"h":50,"nm":"Comp 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[25,25,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"rc","d":1,"s":{"a":0,"k":[16.189,16.189],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.928262987324,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":61.0000024845809,"st":0,"bm":0}]} \ No newline at end of file diff --git a/LottieSample/src/main/res/layout/fragment_list.xml b/LottieSample/src/main/res/layout/fragment_list.xml index 3d34d5330a..0a181c4e15 100644 --- a/LottieSample/src/main/res/layout/fragment_list.xml +++ b/LottieSample/src/main/res/layout/fragment_list.xml @@ -16,7 +16,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" - app:lottie_fileName="Camera.json" + app:lottie_fileName="Logo/LogoSmall.json" app:lottie_loop="true" /> diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/Keyframe.java b/lottie/src/main/java/com/airbnb/lottie/animation/Keyframe.java index 0869623182..6b1eb11802 100644 --- a/lottie/src/main/java/com/airbnb/lottie/animation/Keyframe.java +++ b/lottie/src/main/java/com/airbnb/lottie/animation/Keyframe.java @@ -61,8 +61,8 @@ public static void setEndFrames(List> keyframes) { // Used by PathKeyframe but it has to be parsed by KeyFrame because we use a JsonReader to // deserialzie the data so we have to parse everything in order - protected PointF pathCp1 = null; - protected PointF pathCp2 = null; + public PointF pathCp1 = null; + public PointF pathCp2 = null; public Keyframe(@SuppressWarnings("NullableProblems") LottieComposition composition, @@ -228,7 +228,7 @@ private static Keyframe parseKeyframe(LottieComposition composition, Json endValue = startValue; // TODO: create a HoldInterpolator so progress changes don't invalidate. interpolator = LINEAR_INTERPOLATOR; - } else if (cp1 != null) { + } else if (cp1 != null && cp2 != null) { cp1.x = MiscUtils.clamp(cp1.x, -scale, scale); cp1.y = MiscUtils.clamp(cp1.y, -MAX_CP_VALUE, MAX_CP_VALUE); cp2.x = MiscUtils.clamp(cp2.x, -scale, scale); 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 01bf5f34af..0c72ff3965 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 @@ -5,7 +5,6 @@ import android.support.annotation.Nullable; import android.util.JsonReader; import android.util.JsonToken; -import android.view.animation.Interpolator; import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.animation.Keyframe; @@ -17,10 +16,9 @@ public class PathKeyframe extends Keyframe { @Nullable private Path path; - private PathKeyframe(LottieComposition composition, @Nullable PointF startValue, - @Nullable PointF endValue, @Nullable Interpolator interpolator, - float startFrame, @Nullable Float endFrame) { - super(composition, startValue, endValue, interpolator, startFrame, endFrame); + private PathKeyframe(LottieComposition composition, Keyframe keyframe) { + super(composition, keyframe.startValue, keyframe.endValue, keyframe.interpolator, + keyframe.startFrame, keyframe.endFrame); // This must use equals(float, float) because PointF didn't have an equals(PathF) method // until KitKat... @@ -28,7 +26,7 @@ private PathKeyframe(LottieComposition composition, @Nullable PointF startValue, startValue.equals(endValue.x, endValue.y); //noinspection ConstantConditions if (endValue != null && !equals) { - path = Utils.createPath(startValue, endValue, pathCp1, pathCp2); + path = Utils.createPath(startValue, endValue, keyframe.pathCp1, keyframe.pathCp2); } } @@ -42,9 +40,7 @@ public static PathKeyframe newInstance(JsonReader reader, LottieComposition comp Keyframe keyframe = Keyframe.Factory.newInstance( reader, composition, Utils.dpScale(), valueFactory, animated); - - return new PathKeyframe(composition, keyframe.startValue, - keyframe.endValue, keyframe.interpolator, keyframe.startFrame, keyframe.endFrame); + return new PathKeyframe(composition, keyframe); } } diff --git a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTextProperties.java b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTextProperties.java index 9d9aa42050..baca43ab39 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTextProperties.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableTextProperties.java @@ -36,10 +36,10 @@ public static AnimatableTextProperties newInstance( while (reader.hasNext()) { switch (reader.nextName()) { case "a": - anim = parseAnimatableTextProperties(reader, composition); - break; - default: - reader.skipValue(); + anim = parseAnimatableTextProperties(reader, composition); + break; + default: + reader.skipValue(); } } reader.endObject(); @@ -75,6 +75,7 @@ private static AnimatableTextProperties parseAnimatableTextProperties( reader.skipValue(); } } + reader.endObject(); return new AnimatableTextProperties(color, stroke, strokeWidth, tracking); } diff --git a/lottie/src/test/java/com/airbnb/lottie/KeyPathTest.java b/lottie/src/test/java/com/airbnb/lottie/KeyPathTest.java index a026a4fda7..d474fdca20 100644 --- a/lottie/src/test/java/com/airbnb/lottie/KeyPathTest.java +++ b/lottie/src/test/java/com/airbnb/lottie/KeyPathTest.java @@ -1,17 +1,16 @@ package com.airbnb.lottie; -import android.app.Application; +import android.util.JsonReader; import com.airbnb.lottie.model.KeyPath; -import org.json.JSONException; -import org.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.RuntimeEnvironment; +import java.io.IOException; +import java.io.StringReader; import java.util.List; import static junit.framework.Assert.assertEquals; @@ -32,13 +31,12 @@ public class KeyPathTest { @Before public void setupDrawable() { - Application context = RuntimeEnvironment.application; lottieDrawable = new LottieDrawable(); try { LottieComposition composition = LottieComposition.Factory - .fromJsonSync(new (Fixtures.SQUARES)); + .fromJsonSync(new JsonReader(new StringReader(Fixtures.SQUARES))); lottieDrawable.setComposition(composition); - } catch (JSONException e) { + } catch (IOException e) { throw new IllegalStateException(e); } }