-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [Fix] KalendarEvents marker * [Fix] Current KalendarDay Market in Endloss * [Fix] Calendar changes after Jan/Dec
- Loading branch information
Showing
10 changed files
with
131 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
kalendar-endlos/src/main/java/com/himanshoe/kalendar/endlos/KalendarEndloss.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.himanshoe.kalendar.endlos | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import androidx.paging.compose.LazyPagingItems | ||
import androidx.paging.compose.items | ||
import com.himanshoe.kalendar.endlos.color.KalendarThemeColor | ||
import com.himanshoe.kalendar.endlos.component.day.config.KalendarDayColors | ||
import com.himanshoe.kalendar.endlos.model.KalendarDay | ||
import com.himanshoe.kalendar.endlos.model.KalendarEvent | ||
import kotlinx.datetime.Clock | ||
import kotlinx.datetime.LocalDate | ||
import kotlinx.datetime.TimeZone | ||
import kotlinx.datetime.todayIn | ||
|
||
@Composable | ||
internal fun KalendarEndloss( | ||
modifier: Modifier, | ||
kalendarItems: LazyPagingItems<LocalDate>, | ||
kalendarEvents: List<KalendarEvent>, | ||
onCurrentDayClick: (KalendarDay, List<KalendarEvent>) -> Unit, | ||
kalendarDayColors: KalendarDayColors, | ||
kalendarThemeColors: List<KalendarThemeColor> | ||
) { | ||
val today = Clock.System.todayIn(TimeZone.currentSystemDefault()) | ||
val clickedDay = remember { mutableStateOf(today) } | ||
|
||
LazyColumn(modifier = modifier.fillMaxWidth()) { | ||
items(kalendarItems) { date: LocalDate? -> | ||
if (date != null) { | ||
val kalendarThemeColor = if (kalendarThemeColors.count() == 1) { | ||
kalendarThemeColors.first() | ||
} else kalendarThemeColors[date.monthNumber.minus(1)] | ||
|
||
KalendarMonth( | ||
date = date, | ||
modifier = modifier | ||
.padding(horizontal = 12.dp, vertical = 6.dp) | ||
.background(kalendarThemeColor.backgroundColor), | ||
kalendarEvents = kalendarEvents.filter { it.date.monthNumber == date.monthNumber }, | ||
onCurrentDayClick = { day, events -> | ||
clickedDay.value = day.localDate | ||
onCurrentDayClick(day, events) | ||
}, | ||
kalendarDayColors = kalendarDayColors, | ||
selectedDay = clickedDay.value, | ||
kalendarThemeColors = kalendarThemeColor | ||
) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.