blob: 59528df2e4e03ea3a850473c7c84850e3dedc757 [file] [log] [blame]
package com.airbnb.lottie.parser;
import android.util.JsonReader;
import com.airbnb.lottie.LottieComposition;
import com.airbnb.lottie.model.content.ContentModel;
import com.airbnb.lottie.model.content.ShapeGroup;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class ShapeGroupParser {
private ShapeGroupParser() {}
public static ShapeGroup parse(
JsonReader reader, LottieComposition composition) throws IOException {
String name = null;
List<ContentModel> items = new ArrayList<>();
while (reader.hasNext()) {
switch (reader.nextName()) {
case "nm":
name = reader.nextString();
break;
case "it":
reader.beginArray();
while (reader.hasNext()) {
ContentModel newItem = ContentModelParser.parse(reader, composition);
if (newItem != null) {
items.add(newItem);
}
}
reader.endArray();
break;
default:
reader.skipValue();
}
}
return new ShapeGroup(name, items);
}
}