Skip to content

Commit

Permalink
Gradient stroke works
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Peal committed Jan 2, 2018
1 parent e85557a commit 7b09cc0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -73,11 +74,16 @@ private ValueFactory(int colorPoints) {
List<Float> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7b09cc0

Please sign in to comment.