Search in sources :

Example 1 with TeamRankingItemView

use of com.thebluealliance.androidclient.itemviews.TeamRankingItemView in project the-blue-alliance-android by the-blue-alliance.

the class EventRankingsFragment method initializeAdapterCreator.

@Override
public void initializeAdapterCreator(SmartAdapter.MultiAdaptersCreator creator) {
    creator.map(TeamRankingViewModel.class, TeamRankingItemView.class);
    creator.listener((actionId, item, position, view) -> {
        if (actionId == Interactions.TEAM_RANKING_CLICKED && item instanceof TeamRankingViewModel) {
            TeamRankingViewModel ranking = (TeamRankingViewModel) item;
            startActivity(TeamAtEventActivity.newInstance(getContext(), mEventKey, ranking.getTeamKey()));
            /* Track the call */
            AnalyticsHelper.sendClickUpdate(getActivity(), "team@event_click", "EventRankingsFragment", mEventKey);
        } else if (actionId == Interactions.EXPAND_TEAM_RANKING && view instanceof TeamRankingItemView) {
            TeamRankingItemView itemView = (TeamRankingItemView) view;
            itemView.toggleRankingsExpanded();
        }
    });
}
Also used : TeamRankingViewModel(com.thebluealliance.androidclient.viewmodels.TeamRankingViewModel) TeamRankingItemView(com.thebluealliance.androidclient.itemviews.TeamRankingItemView)

Aggregations

TeamRankingItemView (com.thebluealliance.androidclient.itemviews.TeamRankingItemView)1 TeamRankingViewModel (com.thebluealliance.androidclient.viewmodels.TeamRankingViewModel)1