use of com.thebluealliance.androidclient.listitems.ListItem in project the-blue-alliance-android by the-blue-alliance.
the class FirebaseTickerFragment method createFilterListAdapter.
private ListViewAdapter createFilterListAdapter(Set<String> enabledNotifications) {
List<ListItem> listItems = new ArrayList<>();
// Start with all notifications enabled
listItems.add(new GamedayTickerFilterCheckbox(R.layout.list_item_checkbox_upcoming_match, "Upcoming Matches", NotificationTypes.UPCOMING_MATCH, true));
listItems.add(new GamedayTickerFilterCheckbox(R.layout.list_item_checkbox_match_results, "Match Results", NotificationTypes.MATCH_SCORE, true));
listItems.add(new GamedayTickerFilterCheckbox(R.layout.list_item_checkbox_schedule_updated, "Schedule Updated", NotificationTypes.SCHEDULE_UPDATED, true));
listItems.add(new GamedayTickerFilterCheckbox(R.layout.list_item_checkbox_competition_level_starting, "Competition Level Starting", NotificationTypes.LEVEL_STARTING, true));
listItems.add(new GamedayTickerFilterCheckbox(R.layout.list_item_checkbox_alliance_selections, "Alliance Selections", NotificationTypes.ALLIANCE_SELECTION, true));
listItems.add(new GamedayTickerFilterCheckbox(R.layout.list_item_checkbox_awards_posted, "Awards Posted", NotificationTypes.AWARDS, true));
// Initialize the preferences to their appropriate value
if (enabledNotifications != null) {
for (ListItem item : listItems) {
GamedayTickerFilterCheckbox checkbox = (GamedayTickerFilterCheckbox) item;
if (!enabledNotifications.contains(checkbox.getKey())) {
checkbox.setChecked(false);
}
}
}
return new ListViewAdapter(getActivity(), listItems);
}
use of com.thebluealliance.androidclient.listitems.ListItem in project the-blue-alliance-android by the-blue-alliance.
the class NavigationDrawerFragment method navigationItemClicked.
/**
* Called when an item in the navigation drawer is clicked
*
* @param position The position of the clicked item
*/
private void navigationItemClicked(int position) {
ListItem item = mNavigationAdapter.getItem(position);
// Ignore clicks on items like dividers and spacers
if (!(item instanceof NavDrawerItem)) {
return;
}
if (mDrawerListView != null) {
mDrawerListView.setItemChecked(position, true);
}
mListener.onNavDrawerItemClicked((NavDrawerItem) item);
if (mDrawerLayout != null) {
mDrawerLayout.closeDrawer(mFragmentContainerView);
}
}
use of com.thebluealliance.androidclient.listitems.ListItem 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);
}
}
use of com.thebluealliance.androidclient.listitems.ListItem in project the-blue-alliance-android by the-blue-alliance.
the class AwardRendererTest method testRenderIndividualCarded.
@Test
public void testRenderIndividualCarded() {
Award award = ModelMaker.getModel(Award.class, AWARD_INDIVIDUAL);
ListItem rendered = mRenderer.renderFromModel(award, new AwardRenderer.RenderArgs(new HashMap<>(), null));
assertNotNull(rendered);
assertTrue(rendered instanceof CardedAwardListElement);
}
use of com.thebluealliance.androidclient.listitems.ListItem in project the-blue-alliance-android by the-blue-alliance.
the class MyTbaModelRendererTest method testRenderEventTeam.
@Test
public void testRenderEventTeam() {
Team team = ModelMaker.getModel(Team.class, TEAM_KEY);
Event event = ModelMaker.getModel(Event.class, EVENT_KEY);
when(mDatafeed.fetchTeam(TEAM_KEY)).thenReturn(Observable.just(team));
when(mDatafeed.fetchEvent(EVENT_KEY)).thenReturn(Observable.just(event));
ListItem item = mRenderer.renderFromKey(EVENT_TEAM_KEY, ModelType.EVENTTEAM, null);
assertNotNull(item);
assertTrue(item instanceof ModelListElement);
assertEquals(((ModelListElement) item).getText(), "UberBots @ 2015 Hartford");
assertEquals(((ModelListElement) item).getKey(), EVENT_TEAM_KEY);
assertEquals(((ModelListElement) item).getType(), ModelType.EVENTTEAM);
}
Aggregations