use of com.mxt.anitrend.model.entity.anilist.edge.MediaEdge in project anitrend-app by AniTrend.
the class GroupingUtil method groupMediaByRelationType.
public static List<EntityGroup> groupMediaByRelationType(List<MediaEdge> edges) {
List<EntityGroup> entityMap = new ArrayList<>();
for (MediaEdge edge : edges) {
EntityHeader entityHeader = new EntityHeader(edge.getRelationType());
if (!entityMap.contains(entityHeader))
entityMap.add(entityHeader);
else {
entityHeader.setSize(entityHeader.getSize() + 1);
entityMap.add(edge.getNode());
}
}
return entityMap;
}
use of com.mxt.anitrend.model.entity.anilist.edge.MediaEdge in project anitrend-app by AniTrend.
the class GroupingUtil method groupActorMediaEdge.
/**
* Groups edge container items their media/node and the character role
* N.B. In this use case the main model is not used to check for existence
* of a given role because the voiceActors and characterRoles are grouped by media
* <br/>
*
* @see CharacterActorsFragment restricted and should only be used by this
* @see EdgeContainer
* <br/>
*
* @param edges The potential external model response which needs to be grouped
*/
public static List<EntityGroup> groupActorMediaEdge(List<MediaEdge> edges) {
List<EntityGroup> entityMap = new ArrayList<>();
for (MediaEdge edge : edges) {
if (edge.getNode() != null) {
if (!TextUtils.isEmpty(edge.getCharacterRole()))
edge.getNode().setSubGroupTitle(edge.getCharacterRole());
edge.getNode().setContentType(KeyUtil.RECYCLER_TYPE_HEADER);
entityMap.add(edge.getNode());
}
if (!CompatUtil.isEmpty(edge.getVoiceActors()))
entityMap.addAll(edge.getVoiceActors());
}
return entityMap;
}
Aggregations