use of com.thebluealliance.androidclient.viewmodels.EventViewModel in project the-blue-alliance-android by the-blue-alliance.
the class TeamEventsFragment method initializeAdapterCreator.
@Override
public void initializeAdapterCreator(SmartAdapter.MultiAdaptersCreator creator) {
creator.map(EventViewModel.class, EventItemView.class);
creator.map(ListSectionHeaderViewModel.class, ListSectionHeaderItemView.class);
creator.listener((actionId, item, position, view) -> {
if (actionId == Interactions.EVENT_CLICKED && item instanceof EventViewModel) {
EventViewModel event = (EventViewModel) item;
startActivity(TeamAtEventActivity.newInstance(getContext(), event.getKey(), mTeamKey));
}
});
}
use of com.thebluealliance.androidclient.viewmodels.EventViewModel in project the-blue-alliance-android by the-blue-alliance.
the class EventListFragment method initializeAdapterCreator.
@Override
public void initializeAdapterCreator(SmartAdapter.MultiAdaptersCreator creator) {
creator.map(EventViewModel.class, EventItemView.class);
creator.map(ListSectionHeaderViewModel.class, ListSectionHeaderItemView.class);
creator.listener((actionId, item, position, view) -> {
if (actionId == Interactions.EVENT_CLICKED && item instanceof EventViewModel) {
EventViewModel event = (EventViewModel) item;
startActivity(ViewEventActivity.newInstance(getContext(), event.getKey()));
}
});
}
use of com.thebluealliance.androidclient.viewmodels.EventViewModel in project the-blue-alliance-android by the-blue-alliance.
the class DistrictEventsFragment method initializeAdapterCreator.
@Override
public void initializeAdapterCreator(SmartAdapter.MultiAdaptersCreator creator) {
creator.map(EventViewModel.class, EventItemView.class);
creator.map(ListSectionHeaderViewModel.class, ListSectionHeaderItemView.class);
creator.listener((actionId, item, position, view) -> {
if (actionId == Interactions.EVENT_CLICKED && item instanceof EventViewModel) {
EventViewModel event = (EventViewModel) item;
startActivity(ViewEventActivity.newInstance(getContext(), event.getKey()));
}
});
}
use of com.thebluealliance.androidclient.viewmodels.EventViewModel in project the-blue-alliance-android by the-blue-alliance.
the class DistrictEventsBinder method updateData.
@Override
public void updateData(@Nullable List<Object> data) {
super.updateData(data);
// Because we don't want to rely on the key -> constant mappings
if (isDataBound() && mList != null) {
for (int i = 0; i < mList.size(); i++) {
Object item = mList.get(i);
if (item instanceof EventViewModel) {
EventViewModel viewModel = ((EventViewModel) item);
String district = viewModel.getDistrictString();
int year = viewModel.getYear();
if (district != null && !district.isEmpty()) {
String title = mResources.getString(R.string.district_title_format, year, district);
mEventBus.post(new ActionBarTitleEvent(title));
return;
}
}
}
}
}
use of com.thebluealliance.androidclient.viewmodels.EventViewModel in project the-blue-alliance-android by the-blue-alliance.
the class Event method renderToViewModel.
@Nullable
@Override
public EventViewModel renderToViewModel(Context context, @Nullable @RenderType Integer renderType) {
if (renderType == null) {
return null;
}
EventViewModel model;
model = new EventViewModel(getKey(), getYear(), getShortName(), getDateString(), getLocation(), getEventDistrictString());
switch(renderType) {
case RENDER_MYTBA_BUTTON:
model.setShowMyTbaSettings(true);
}
return model;
}
Aggregations