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 239d9bcae3..b794b9dab7 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 @@ -3,6 +3,7 @@ import android.graphics.Color; import android.support.annotation.IntRange; import android.util.JsonReader; +import android.util.JsonToken; import android.util.Log; import com.airbnb.lottie.L; @@ -73,11 +74,16 @@ private ValueFactory(int colorPoints) { List array = new ArrayList<>(); // The array was started by Keyframe because it thought that this may be an array of keyframes // but peek returned a number so it considered it a static array of numbers. - // reader.beginArray(); + boolean isArray = reader.peek() == JsonToken.BEGIN_ARRAY; + if (isArray) { + reader.beginArray(); + } while (reader.hasNext()) { array.add((float) reader.nextDouble()); } - // reader.endArray(); + if(isArray) { + reader.endArray(); + } if (colorPoints == -1) { colorPoints = array.size() / 4; } 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 8e71eb6106..9645a97d54 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 @@ -146,6 +146,7 @@ static GradientStroke newInstance( break; case "t": gradientType = reader.nextInt() == 1 ? GradientType.Linear : GradientType.Radial; + break; case "s": startPoint = AnimatablePointValue.Factory.newInstance(reader, composition); break;