Search in sources :

Example 1 with EventType

use of com.github.dedis.popstellar.model.objects.event.EventType in project popstellar by dedis.

the class RollCallEventCreationFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    setupConfirmButton();
    setupOpenButton();
    setupCancelButton();
    // Subscribe to "new LAO event creation" event
    mLaoDetailViewModel.getNewLaoEventCreationEvent().observe(getViewLifecycleOwner(), eventTypeEvent -> {
        EventType eventType = eventTypeEvent.getContentIfNotHandled();
        if (eventType == EventType.ROLL_CALL) {
            createRollCall(false);
        }
    });
    // Subscribe to "open new roll call" event
    mLaoDetailViewModel.getOpenNewRollCallEvent().observe(getViewLifecycleOwner(), booleanEvent -> {
        Boolean action = booleanEvent.getContentIfNotHandled();
        if (action != null) {
            createRollCall(true);
        }
    });
    mLaoDetailViewModel.getCreatedRollCallEvent().observe(getViewLifecycleOwner(), booleanEvent -> {
        Boolean action = booleanEvent.getContentIfNotHandled();
        if (action != null) {
            mLaoDetailViewModel.openLaoDetail();
        }
    });
}
Also used : EventType(com.github.dedis.popstellar.model.objects.event.EventType)

Aggregations

EventType (com.github.dedis.popstellar.model.objects.event.EventType)1