Search in sources :

Example 1 with RenderableModel

use of com.thebluealliance.androidclient.interfaces.RenderableModel in project the-blue-alliance-android by the-blue-alliance.

the class MatchListAdapter method getChildView.

@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
    if (groupPosition >= mGroups.size() || childPosition >= mGroups.get(groupPosition).children.size()) {
        // Can't render due to bounds errors
        return new LabelValueListItem("Match", "Unable to render").getView(mActivity, mInflater, convertView);
    }
    RenderableModel child = mGroups.get(groupPosition).children.get(childPosition);
    if (child instanceof Match) {
        ((Match) child).setSelectedTeam(mTeamKey);
    }
    ListItem renderedChild = child.render(mRendererSupplier);
    if (renderedChild != null) {
        return renderedChild.getView(mActivity, mInflater, convertView);
    } else {
        return new LabelValueListItem("Match", "Unable to render").getView(mActivity, mInflater, convertView);
    }
}
Also used : LabelValueListItem(com.thebluealliance.androidclient.listitems.LabelValueListItem) ListItem(com.thebluealliance.androidclient.listitems.ListItem) LabelValueListItem(com.thebluealliance.androidclient.listitems.LabelValueListItem) RenderableModel(com.thebluealliance.androidclient.interfaces.RenderableModel) Match(com.thebluealliance.androidclient.models.Match)

Aggregations

RenderableModel (com.thebluealliance.androidclient.interfaces.RenderableModel)1 LabelValueListItem (com.thebluealliance.androidclient.listitems.LabelValueListItem)1 ListItem (com.thebluealliance.androidclient.listitems.ListItem)1 Match (com.thebluealliance.androidclient.models.Match)1