CalendarMonthPageSource

class CalendarMonthPageSource(    firstDayOfWeek: DayOfWeek,     startYearMonth: YearMonth = Clock.System.todayAt(TimeZone.currentSystemDefault()).yearMonth,     focusMode: CalendarMonthPageSource.FocusMode = FocusMode.MONTH,     val maxPageRange: IntRange = IntRange(-6000, 6000)) : CalendarPageSource

An implementation of CalendarPageSource that loads full months. Total rows are dynamic, and will change from month to month. The default range for the calendar is 500 years before and after the given startYearMonth, and can be overridden by setting maxPageRange.

Constructors

Link copied to clipboard
fun CalendarMonthPageSource(    firstDayOfWeek: DayOfWeek,     startYearMonth: YearMonth = Clock.System.todayAt(TimeZone.currentSystemDefault()).yearMonth,     focusMode: CalendarMonthPageSource.FocusMode = FocusMode.MONTH,     maxPageRange: IntRange = IntRange(-6000, 6000))

Types

Link copied to clipboard
enum FocusMode : Enum<CalendarMonthPageSource.FocusMode>

Functions

Link copied to clipboard
open override fun getPageFor(date: LocalDate): Int

Get the page number for the given date. This function should be as lightweight as possible, as no results here are cached.

Link copied to clipboard
open override fun loadPageData(page: Int): CalendarPage

Takes a page number and a DisplayDate producer, and returns a set of rows to display in the calendar UI. This should not implement any caching itself, caching is handled by consumers.

Link copied to clipboard
open fun mapInternalPositionToPage(position: Int): Int

Maps the given internal position of a zero-based pager to the page number. Note this is not necessary if we have a pager that supports negative numbers in the first place.

Link copied to clipboard
open fun mapPageToInternalPosition(page: Int): Int

Maps the given page number to an internal zero-based position. Note this is not necessary if we have a pager that supports negative numbers in the first place.

Properties

Link copied to clipboard
open override val hasOverlappingDates: Boolean = true

Whether this page source has dates that may overlap from one page to the next. Ephemeris may use this to determine whether additional updates are necessary when changing a date.

Link copied to clipboard
open override val maxPageRange: IntRange

Defines the maximum number of pages to be displayed. Pages are zero-based, therefore negative values represent pages before the start page, and positive values represent pages after the start page. Note the total number of pages should not exceed Int.MAX_VALUE.

Sources

Link copied to clipboard