use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class CreateCopyrightViewModel method createCopyright.
public void createCopyright() {
nullifyEmptyFields(copyright);
if (!verifyYear(copyright))
return;
long eventId = ContextManager.getSelectedEvent().getId();
Event event = new Event();
event.setId(eventId);
copyright.setEvent(event);
compositeDisposable.add(copyrightRepository.createCopyright(copyright).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(createdTicket -> {
success.setValue("Copyright Created");
dismiss.call();
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class EventDashboardFragment method onResume.
@Override
public void onResume() {
super.onResume();
Event event = ContextManager.getSelectedEvent();
String startsAt = DateUtils.formatDateWithDefault(DateUtils.FORMAT_DATE_TIME, event.getStartsAt());
String endsAt = DateUtils.formatDateWithDefault(DateUtils.FORMAT_DATE_TIME, event.getEndsAt());
((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(event.getName());
((AppCompatActivity) getActivity()).getSupportActionBar().setSubtitle(startsAt + " - " + endsAt);
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class EventsViewModel method filter.
public void filter() {
List<Event> live = new ArrayList<>();
List<Event> past = new ArrayList<>();
List<Event> draft = new ArrayList<>();
for (Event event : events.getValue()) {
try {
if (event.getState().equals("draft"))
draft.add(event);
else if ("past".equalsIgnoreCase(DateService.getEventStatus(event)))
past.add(event);
else
live.add(event);
} catch (ParseException e) {
Timber.e(e);
}
}
liveEvents.setValue(live);
pastEvents.setValue(past);
draftEvents.setValue(draft);
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class EventViewModel method showLoadedEvent.
private void showLoadedEvent(long storedEventId) {
eventId.setValue(storedEventId);
Event staticEvent = ContextManager.getSelectedEvent();
if (staticEvent != null) {
selectedEvent.setValue(staticEvent);
showEventDashboard();
return;
}
compositeDisposable.add(eventRepository.getEvent(storedEventId, false).subscribe(bus::pushSelectedEvent, throwable -> {
Logger.logError(throwable);
error.setValue(throwable.getMessage());
}));
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class CreateSponsorViewModel method createSponsor.
public void createSponsor() {
long eventId = ContextManager.getSelectedEvent().getId();
Event event = new Event();
event.setId(eventId);
sponsor.setEvent(event);
nullifyEmptyFields(sponsor);
compositeDisposable.add(sponsorRepository.createSponsor(sponsor).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(createdSponsor -> {
success.setValue("Sponsor Created");
dismiss.call();
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
Aggregations