use of com.thebluealliance.androidclient.viewmodels.TeamViewModel in project the-blue-alliance-android by the-blue-alliance.
the class TeamListRecyclerSubscriber method parseData.
@Override
public void parseData() {
mDataToBind.clear();
Collections.sort(mAPIData, mComparator);
for (int i = 0; i < mAPIData.size(); i++) {
Team team = mAPIData.get(i);
if (team == null) {
continue;
}
TeamViewModel item = team.renderToViewModel(mContext, mRenderMode);
if (item == null) {
continue;
}
mDataToBind.add(item);
}
}
use of com.thebluealliance.androidclient.viewmodels.TeamViewModel in project the-blue-alliance-android by the-blue-alliance.
the class TeamListFragment method initializeAdapterCreator.
@Override
public void initializeAdapterCreator(SmartAdapter.MultiAdaptersCreator creator) {
creator.map(TeamViewModel.class, TeamItemView.class);
creator.listener((actionId, item, position, view) -> {
if (actionId == Interactions.TEAM_ITEM_CLICKED && item instanceof TeamViewModel) {
TeamViewModel team = (TeamViewModel) item;
startActivity(ViewTeamActivity.newInstance(getActivity(), team.getTeamKey()));
}
});
}
use of com.thebluealliance.androidclient.viewmodels.TeamViewModel in project the-blue-alliance-android by the-blue-alliance.
the class EventTeamsFragment method initializeAdapterCreator.
@Override
public void initializeAdapterCreator(SmartAdapter.MultiAdaptersCreator creator) {
creator.map(TeamViewModel.class, TeamItemView.class);
creator.listener((actionId, item, position, view) -> {
if (actionId == Interactions.TEAM_ITEM_CLICKED && item instanceof TeamViewModel) {
TeamViewModel team = (TeamViewModel) item;
Intent intent = TeamAtEventActivity.newInstance(getActivity(), mEventKey, team.getTeamKey());
startActivity(intent);
// Track the call
AnalyticsHelper.sendClickUpdate(getActivity(), "team@event_click", "EventTeamsFragment", EventTeamHelper.generateKey(mEventKey, team.getTeamKey()));
}
});
}
use of com.thebluealliance.androidclient.viewmodels.TeamViewModel in project the-blue-alliance-android by the-blue-alliance.
the class Team method renderToViewModel.
@Nullable
@Override
public TeamViewModel renderToViewModel(Context context, @Nullable @RenderType Integer renderType) {
int safeRenderType = renderType == null ? RENDER_BASIC : renderType;
TeamViewModel model = new TeamViewModel(getKey(), getTeamNumber(), getNickname(), getLocation());
model.setShowLinkToTeamDetails(false);
model.setShowMyTbaDetails(false);
switch(safeRenderType) {
case RENDER_BASIC:
break;
case RENDER_DETAILS_BUTTON:
model.setShowLinkToTeamDetails(true);
break;
case RENDER_MYTBA_DETAILS:
model.setShowMyTbaDetails(true);
break;
}
return model;
}
Aggregations