blob: 26b7a940470d18791a1a9c0674dabf4ed5a30b2a [file] [log] [blame]
package com.airbnb.lottie.parser;
import com.airbnb.lottie.LottieComposition;
import com.airbnb.lottie.model.animatable.AnimatableShapeValue;
import com.airbnb.lottie.model.content.ShapePath;
import com.airbnb.lottie.parser.moshi.JsonReader;
import java.io.IOException;
class ShapePathParser {
static JsonReader.Options NAMES = JsonReader.Options.of(
"nm",
"ind",
"ks",
"hd"
);
private ShapePathParser() {
}
static ShapePath parse(
JsonReader reader, LottieComposition composition) throws IOException {
String name = null;
int ind = 0;
AnimatableShapeValue shape = null;
boolean hidden = false;
while (reader.hasNext()) {
switch (reader.selectName(NAMES)) {
case 0:
name = reader.nextString();
break;
case 1:
ind = reader.nextInt();
break;
case 2:
shape = AnimatableValueParser.parseShapeData(reader, composition);
break;
case 3:
hidden = reader.nextBoolean();
break;
default:
reader.skipValue();
}
}
return new ShapePath(name, ind, shape, hidden);
}
}