private void eventListItemClicked(int position) { ShowEvent clickedEvent = getEvents().get(position); setCurrentEvent(getModel().getEvent(clickedEvent.getId())); getCurrentEvent().addListener(ShowEvent.EventMeta.PARTICIPANTS_CHANGED, this); getCurrentEvent().addListener(ShowEvent.EventMeta.DIVISIONS_CHANGED, this); setupEventListAdapters(); showEventInfoButtons(); }
@Override public void onDestroy() { getModel().getCurrentUser().removeListener(User.EventMeta.EVENT_COUNT_CHANGED, this); ShowEvent[] events = getModel().getCurrentUser().getShowEvents(); for (ShowEvent e : events) { e.removeListener(this); if (e.getDivisions() != null) { for (Division d : e.getDivisions()) d.removeListener(this); } } super.onDestroy(); }
private void createShowEvent() { EditText eventNameEditText = (EditText) findViewById(R.id.admin_create_event_event_name_edit_text); DatePicker eventStartDateDatePicker = (DatePicker) findViewById(R.id.admin_create_event_event_start_date_date_picker); DatePicker eventEndDateDatePicker = (DatePicker) findViewById(R.id.admin_create_event_event_end_date_date_picker); String eventName = eventNameEditText.getText().toString(); String startDate = extractDatePickerDateString(eventStartDateDatePicker); String endDate = extractDatePickerDateString(eventEndDateDatePicker); ShowEvent createdEvent = new ShowEvent(); createdEvent.setAdminId(getModel().getCurrentUser().getId()); createdEvent.setName(eventName); createdEvent.setStartDate(startDate); createdEvent.setEndDate(endDate); Utility.showProgressDialog( this, getString(R.string.admin_creating_event_caption), getString(R.string.admin_creating_event_description)); AdminProxy.createShowEvent(this, createdEvent); }