Search in sources :

Example 1 with Bus

use of com.eventyay.organizer.data.Bus 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());
    }));
}
Also used : MutableLiveData(androidx.lifecycle.MutableLiveData) LiveData(androidx.lifecycle.LiveData) SingleEventLiveData(com.eventyay.organizer.common.livedata.SingleEventLiveData) Event(com.eventyay.organizer.data.event.Event) ViewModel(androidx.lifecycle.ViewModel) ContextManager(com.eventyay.organizer.common.ContextManager) CurrencyUtils(com.eventyay.organizer.utils.CurrencyUtils) Logger(com.eventyay.organizer.common.rx.Logger) Inject(javax.inject.Inject) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Bus(com.eventyay.organizer.data.Bus) EventRepository(com.eventyay.organizer.data.event.EventRepository) EVENT_KEY(com.eventyay.organizer.core.main.MainActivity.EVENT_KEY) Preferences(com.eventyay.organizer.data.Preferences) Event(com.eventyay.organizer.data.event.Event)

Aggregations

LiveData (androidx.lifecycle.LiveData)1 MutableLiveData (androidx.lifecycle.MutableLiveData)1 ViewModel (androidx.lifecycle.ViewModel)1 ContextManager (com.eventyay.organizer.common.ContextManager)1 SingleEventLiveData (com.eventyay.organizer.common.livedata.SingleEventLiveData)1 Logger (com.eventyay.organizer.common.rx.Logger)1 EVENT_KEY (com.eventyay.organizer.core.main.MainActivity.EVENT_KEY)1 Bus (com.eventyay.organizer.data.Bus)1 Preferences (com.eventyay.organizer.data.Preferences)1 Event (com.eventyay.organizer.data.event.Event)1 EventRepository (com.eventyay.organizer.data.event.EventRepository)1 CurrencyUtils (com.eventyay.organizer.utils.CurrencyUtils)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1 Inject (javax.inject.Inject)1