Closed KovshefulCoder closed 1 month ago
You can already figure this out from the CalendarDay
provided in the binder.
val daysOfWeek = daysOfWeek(firstDayOfWeek = firstDayOfWeekFromLocale())
if (day.position == DayPosition.InDate && day.date.dayOfWeek == daysOfWeek.first()) {
// This is the first in date in the row
}
if (day.position == DayPosition.OutDate && day.date.dayOfWeek == daysOfWeek.last()) {
// This is the last out date in the row
}
I guess this is resolved? Closing!
Yes, this is resolved, thanks. Now using this:
private fun CalendarDay.isLastOutDay(firstDayOfWeek: DayOfWeek = firstDayOfWeekFromLocale()): Boolean {
return position == DayPosition.OutDate && date.dayOfWeek == daysOfWeek(firstDayOfWeek).last()
}
Feature
Add more info in DayPosition to be able to use it in UI
I can propose smth like this: 1) Add something like index or offset in DayPosition to know position of this date in list of dates of the same DayPosition type. 2) Based on this offset calculate if this DayPosition is last of such DayPositions
Use case
Be able to customize UI based on position of day, especially for in and out days. In my case for the last outDay(in phto there is only one outDay, 1day of next month) I want to show arrow indicating how to scroll this calendar After a little thought, I also came up with a fading for outDays and vice versa for inDays, based on the position and number of such days
Tech (MVP)
New DayPosition
How it is calculated in MonthData