use of com.thebluealliance.androidclient.listitems.gameday.GamedayTickerFilterCheckbox 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.gameday.GamedayTickerFilterCheckbox in project the-blue-alliance-android by the-blue-alliance.
the class FirebaseTickerFragment method getEnabledNotificationKeys.
private Set<String> getEnabledNotificationKeys() {
final Set<String> enabledNotificationKeys = new HashSet<>();
int filterItemCount = mFilterListView.getAdapter().getCount();
for (int i = 0; i < filterItemCount; i++) {
GamedayTickerFilterCheckbox checkbox = ((GamedayTickerFilterCheckbox) mFilterListView.getAdapter().getItem(i));
if (checkbox.isChecked()) {
enabledNotificationKeys.add(checkbox.getKey());
}
}
return enabledNotificationKeys;
}
Aggregations