diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TeiDataRepositoryImpl.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TeiDataRepositoryImpl.kt index 535a5b7319..ef6aeef136 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TeiDataRepositoryImpl.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TeiDataRepositoryImpl.kt @@ -162,10 +162,10 @@ class TeiDataRepositoryImpl( val canAddEventToEnrollment = enrollmentUid?.let { programStage.access()?.data()?.write() == true && - d2.eventModule().eventService().blockingCanAddEventToEnrollment( - it, - programStage.uid(), - ) + d2.eventModule().eventService().blockingCanAddEventToEnrollment( + it, + programStage.uid(), + ) } ?: false eventViewModels.add( @@ -186,7 +186,7 @@ class TeiDataRepositoryImpl( ), ) checkEventStatus(eventList).take( - if (selectedStage.showAllEvents) eventList.size else maxEventToShow + if (selectedStage.showAllEvents) eventList.size else maxEventToShow, ).forEachIndexed { index, event -> val showTopShadow = index == 0 val showBottomShadow = index == eventList.size - 1 @@ -238,7 +238,7 @@ class TeiDataRepositoryImpl( displayDate = null, nameCategoryOptionCombo = null, showAllEvents = selectedStage.showAllEvents, - maxEventsToShow = maxEventToShow + maxEventsToShow = maxEventToShow, ), ) } @@ -249,7 +249,7 @@ class TeiDataRepositoryImpl( private fun getTimelineEvents( eventRepository: EventCollectionRepository, - showAllEvents: Boolean + showAllEvents: Boolean, ): Single> { val eventViewModels = mutableListOf() val maxEventToShow = 5 @@ -260,7 +260,7 @@ class TeiDataRepositoryImpl( .get() .map { eventList -> checkEventStatus(eventList).take( - if (showAllEvents) eventList.size else maxEventToShow + if (showAllEvents) eventList.size else maxEventToShow, ).forEachIndexed { _, event -> val programStage = d2.programModule().programStages() .uid(event.programStage()) diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/EventAdapter.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/EventAdapter.kt index bb4732ca13..ee383c7630 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/EventAdapter.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/EventAdapter.kt @@ -35,7 +35,6 @@ class EventAdapter( oldItem.event!!.uid() } else { oldItem.stage!!.uid() - } val newItemId = if (newItem.type == EVENT) { newItem.event!!.uid() @@ -100,7 +99,7 @@ class EventAdapter( TOGGLE_BUTTON -> { ToggleStageEventsButtonHolder( ComposeView(parent.context), - stageSelector + stageSelector, ) } } diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/StageViewHolder.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/StageViewHolder.kt index 90078dbfd3..772182914f 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/StageViewHolder.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/StageViewHolder.kt @@ -82,8 +82,8 @@ internal class StageViewHolder( StageSection( stageUid = stage.uid(), showOptions = true, - showAllEvents = false - ) + showAllEvents = false, + ), ) } diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/ToggleStageEventsButtonHolder.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/ToggleStageEventsButtonHolder.kt index cc4b8eb844..1c03ad9e25 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/ToggleStageEventsButtonHolder.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/teievents/ToggleStageEventsButtonHolder.kt @@ -16,7 +16,7 @@ class ToggleStageEventsButtonHolder( private val stageSelector: FlowableProcessor, ) : RecyclerView.ViewHolder(composeView) { fun bind( - eventViewModel: EventViewModel + eventViewModel: EventViewModel, ) { composeView.setContent { MdcTheme { @@ -27,16 +27,20 @@ class ToggleStageEventsButtonHolder( StageSection( stageUid = eventViewModel.stage?.uid() ?: "", showOptions = false, - showAllEvents = !eventViewModel.showAllEvents - ) + showAllEvents = !eventViewModel.showAllEvents, + ), ) }, - text = if (eventViewModel.showAllEvents) + text = if (eventViewModel.showAllEvents) { composeView.context.getString(R.string.show_less_events) - else - composeView.context.getString(R.string.show_more_events, (eventViewModel.eventCount - eventViewModel.maxEventsToShow).toString()) + } else { + composeView.context.getString( + R.string.show_more_events, + (eventViewModel.eventCount - eventViewModel.maxEventsToShow).toString(), + ) + }, ) } } } -} \ No newline at end of file +} diff --git a/commons/src/main/java/org/dhis2/commons/data/EventViewModel.kt b/commons/src/main/java/org/dhis2/commons/data/EventViewModel.kt index 3cbe8728c8..13668acbb2 100644 --- a/commons/src/main/java/org/dhis2/commons/data/EventViewModel.kt +++ b/commons/src/main/java/org/dhis2/commons/data/EventViewModel.kt @@ -38,7 +38,7 @@ data class EventViewModel( fun isAfterToday(today: Date): Boolean { return type == EventViewModelType.EVENT && event?.eventDate() != null && - event.eventDate()?.after(today) == true + event.eventDate()?.after(today) == true } fun applyHideStage(hidden: Boolean): EventViewModel? {