blob: eb3bed98b1b4ebae840ec760864b387b189e40e2 [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;
class ShapeGroupParser {
private ShapeGroupParser() {}
static ShapeGroup parse(
JsonReader reader, LottieComposition composition) throws IOException {
String name = null;
boolean hidden = false;
List<ContentModel> items = new ArrayList<>();
while (reader.hasNext()) {
switch (reader.nextName()) {
case "nm":
name = reader.nextString();
break;
case "hd":
hidden = reader.nextBoolean();
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, hidden);
}
}