Skip to content

Public API

Till Hellmund edited this page Nov 19, 2020 · 2 revisions

Core module

Properties

firstVisibleDate: Calendar

Returns the first visible date in WeekView.

firstVisibleHour: Double

Returns the first hour that is visible on the screen.

lastVisibleDate: Calendar

Returns the last visible date in WeekView.

typeface: Typeface

ℹ️ This attribute can also be set in XML.

Returns the typeface used for events, time labels and date labels.

adapter: Adapter<T>?

Returns the previously set WeekView.Adapter<T>, or null if none was set.

numberOfVisibleDays: Int

ℹ️ This attribute can also be set in XML.

Returns the number of days currently displayed in WeekView.

showFirstDayOfWeekFirst: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether the first day of the week should be displayed at the start position when WeekView is rendered for the first time.

showHeaderBottomLine: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether a horizontal line should be displayed at the bottom of the header row.

headerBottomLineColor: Int

ℹ️ This attribute can also be set in XML.

Returns the color of the horizontal line at the bottom of the header row.

headerBottomLineWidth: Int

ℹ️ This attribute can also be set in XML.

Returns the stroke width of the horizontal line at the bottom of the header row.

showHeaderBottomShadow: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether a shadow should be displayed at the bottom of the header row.

headerBottomShadowColor: Int

ℹ️ This attribute can also be set in XML.

Returns the color of the shadow at the bottom of the header row.

headerBottomShadowRadius: Int

ℹ️ This attribute can also be set in XML.

Returns the radius of the shadow at the bottom of the header row.

showWeekNumber: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether the current week number is displayed in the header.

weekNumberTextColor: Int

ℹ️ This attribute can also be set in XML.

Returns the text color of the week number.

weekNumberTextSize: Int

ℹ️ This attribute can also be set in XML.

Returns the text size of the week number.

weekNumberBackgroundColor: Int

ℹ️ This attribute can also be set in XML.

Returns the color of the week number's background.

weekNumberBackgroundCornerRadius: Int

ℹ️ This attribute can also be set in XML.

Returns the corner radius of the week number's background.

timeColumnPadding: Int

ℹ️ This attribute can also be set in XML.

Returns the padding in the time column to the left and right side of the time label.

timeColumnTextColor: Int

ℹ️ This attribute can also be set in XML.

Returns the text color of the labels in the time column.

timeColumnBackgroundColor: Int

ℹ️ This attribute can also be set in XML.

Returns the background color of the time column.

timeColumnTextSize: Int

ℹ️ This attribute can also be set in XML.

Returns the text size of the labels in the time column.

showTimeColumnHourSeparators: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether a horizontal line is displayed for each hour in the time column.

timeColumnHoursInterval: Int

ℹ️ This attribute can also be set in XML.

Returns the interval in which time labels are displayed in the time column.

showTimeColumnSeparator: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether a vertical line is displayed between the time column and the calendar grid.

timeColumnSeparatorColor: Int

ℹ️ This attribute can also be set in XML.

Returns the color of the time column separator.

timeColumnSeparatorWidth: Int

ℹ️ This attribute can also be set in XML.

Returns the stroke width of the time column separator.

headerPadding: Int

ℹ️ This attribute can also be set in XML.

Returns the vertical header row padding.

headerBackgroundColor: Int

ℹ️ This attribute can also be set in XML.

Returns the header row background color.

headerTextColor: Int

ℹ️ This attribute can also be set in XML.

Returns the text color used for all date labels except today.

todayHeaderTextColor: Int

ℹ️ This attribute can also be set in XML.

Returns the text color used for today's date label.

headerTextSize: Int

ℹ️ This attribute can also be set in XML.

Returns the text size of all date labels.

eventCornerRadius: Int

ℹ️ This attribute can also be set in XML.

Returns the corner radius of an event chip.

eventTextSize: Int

ℹ️ This attribute can also be set in XML.

Returns the text size of a single event chip.

isAdaptiveEventTextSize: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether the text size of the event chip is adapting to the chip’s height.

allDayEventTextSize: Int

ℹ️ This attribute can also be set in XML.

Returns the text size of an all-day event chip.

defaultEventTextColor: Int

ℹ️ This attribute can also be set in XML.

Returns the default text color of an event chip.

eventPaddingHorizontal: Int

ℹ️ This attribute can also be set in XML.

Returns the horizontal padding within an event chip.

eventPaddingVertical: Int

ℹ️ This attribute can also be set in XML.

Returns the vertical padding within an event chip.

defaultEventColor: Int

ℹ️ This attribute can also be set in XML.

Returns the default background color of an event chip.

columnGap: Int

ℹ️ This attribute can also be set in XML.

Returns the column gap at the end of each day.

overlappingEventGap: Int

ℹ️ This attribute can also be set in XML.

Returns the horizontal gap between overlapping event chips.

eventMarginVertical: Int

ℹ️ This attribute can also be set in XML.

Returns the vertical margin between the event chips of consecutive events.

singleDayHorizontalPadding: Int

ℹ️ This attribute can also be set in XML.

Returns the horizontal padding used in single-day view.

dayBackgroundColor: Int

ℹ️ This attribute can also be set in XML.

Returns the background color of a day.

todayBackgroundColor: Int

ℹ️ This attribute can also be set in XML.

Returns the background color of the current date.

pastBackgroundColor: Int

ℹ️ This attribute can also be set in XML.

Returns the background color for past dates. If not explicitly set, WeekView will use dayBackgroundColor.

pastWeekendBackgroundColor: Int

ℹ️ This attribute can also be set in XML.

Returns the background color for past weekend dates. If not explicitly set, WeekView will use pastBackgroundColor.

futureBackgroundColor: Int

ℹ️ This attribute can also be set in XML.

Returns the background color for future dates. If not explicitly set, WeekView will use dayBackgroundColor.

futureWeekendBackgroundColor: Int

ℹ️ This attribute can also be set in XML.

Returns the background color for future weekend dates. If not explicitly set, WeekView will use futureBackgroundColor.

hourHeight: Int

ℹ️ This attribute can also be set in XML.

Returns the current height of an hour.

minHourHeight: Int

ℹ️ This attribute can also be set in XML.

Returns the minimum height of an hour. This limits how far a user can zoom out.

maxHourHeight: Int

ℹ️ This attribute can also be set in XML.

Returns the maximum height of an hour. This limits how far a user can zoom in.

showCompleteDay: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether the complete day should be shown. If true, hourHeight automatically adjusts to make sure all hours between minHour and maxHour are displayed.

showNowLine: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether a horizontal line should be displayed at the current time.

nowLineColor: Int

ℹ️ This attribute can also be set in XML.

Returns the color of the horizontal now line.

nowLineStrokeWidth: Int

ℹ️ This attribute can also be set in XML.

Returns the stroke width of the horizontal now line.

showNowLineDot: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether a dot at the start of the now line is displayed. The dot is only displayed if showNowLine is set to true.

nowLineDotColor: Int

ℹ️ This attribute can also be set in XML.

Returns the color of the dot at the start of the now line.

nowLineDotRadius: Int

ℹ️ This attribute can also be set in XML.

Returns the radius of the dot at the start of the now line.

showHourSeparators: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether horizontal lines are displayed as separators between hours.

hourSeparatorColor: Int

ℹ️ This attribute can also be set in XML.

Returns the stroke color of the hour separators.

hourSeparatorStrokeWidth: Int

ℹ️ This attribute can also be set in XML.

Returns the stroke width of the hour separators.

showDaySeparators: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether vertical lines are displayed as separators between dates.

daySeparatorColor: Int

ℹ️ This attribute can also be set in XML.

Returns the color of the separators between dates.

daySeparatorStrokeWidth: Int

ℹ️ This attribute can also be set in XML.

Returns the stroke width of the separators between dates.

minDate: Calendar?

ℹ️ This attribute can also be set in XML.

Returns the minimum date that WeekView will display, or null if none is set. Dates before this date will not be shown.

maxDate: Calendar?

ℹ️ This attribute can also be set in XML.

Returns the maximum date that WeekView will display, or null if none is set. Dates after this date will not be shown.

minHour: Int

ℹ️ This attribute can also be set in XML.

Returns the minimum hour that WeekView will display. Hours before this time will not be shown.

maxHour: Int

ℹ️ This attribute can also be set in XML.

Returns the maximum hour that WeekView will display. Hours after this time will not be shown.

isHorizontalScrollingEnabled: Boolean

ℹ️ This attribute can also be set in XML.

Returns whether WeekView can scroll horizontally. If false, WeekView can still scroll vertically.

Methods

goToToday()

Scrolls to the current date.

goToCurrentTime()

Scrolls to the current time.

goToDate(date: Calendar)

Scrolls to the specified date.

goToHour(hour: Int)

Scrolls to the specified hour.

setDateFormatter(formatter: DateFormatter)

Sets the provided DateFormatter as the current date formatter. DateFormatter is of type (Calendar) -> String.

setTimeFormatter(formatter: TimeFormatter)

Sets the provided TimeFormatter as the current time formatter. TimeFormatter is of type (Int) -> String.

Adapters

WeekView.SimpleAdapter<T>

  • onCreateEntity(item: T): Return a WeekViewEntity that will be rendered in the WeekView that is associated with this adapter.
  • onEventClick(data: T): Returns the data of the WeekViewEvent that the user clicked on.
  • onEventClick(data: T, bounds: RectF): Returns the data of the WeekViewEvent that the user clicked on as well as the bounds of the EventChip in which it is displayed.
  • onEventLongClick(data: T): Returns the data of the WeekViewEvent that the user long-clicked on.
  • onEventLongClick(data: T, bounds: RectF): Returns the data of the WeekViewEvent that the user long-clicked on as well as the bounds of the [EventChip] in which it is displayed.
  • onEmptyViewClick(time: Calendar): Returns the date and time of the location that the user clicked on.
  • onEmptyViewLongClick(time: Calendar): Returns the date and time of the location that the user long-clicked on.
  • submit(events: List<WeekViewDisplayable<T>>): Submits a new list of WeekViewDisplayable elements to the adapter. Previously submitted events are replaced completely.
  • onRangeChanged(firstVisibleDate: Calendar, lastVisibleDate: Calendar): Called whenever the range of dates visible in WeekView changes.

WeekView.PagingAdapter<T>

  • onCreateEntity(item: T): Return a WeekViewEntity that will be rendered in the WeekView that is associated with this adapter.
  • onEventClick(data: T): Returns the data of the WeekViewEvent that the user clicked on.
  • onEventClick(data: T, bounds: RectF): Returns the data of the WeekViewEvent that the user clicked on as well as the bounds of the EventChip in which it is displayed.
  • onEventLongClick(data: T): Returns the data of the WeekViewEvent that the user long-clicked on.
  • onEventLongClick(data: T, bounds: RectF): Returns the data of the WeekViewEvent that the user long-clicked on as well as the bounds of the [EventChip] in which it is displayed.
  • onEmptyViewClick(time: Calendar): Returns the date and time of the location that the user clicked on.
  • onEmptyViewLongClick(time: Calendar): Returns the date and time of the location that the user long-clicked on.
  • submit(events: List<WeekViewDisplayable<T>>): Submits a new list of WeekViewDisplayable elements to the adapter. Previously submitted events of the same month are replaced completely.
  • onLoadMore(startDate: Calendar, endDate: Calendar): Called whenever WeekView needs to fetch WeekViewDisplayable elements of a given month in order to allow for a smooth scrolling experience.
  • onRangeChanged(firstVisibleDate: Calendar, lastVisibleDate: Calendar): Called whenever the range of dates visible in WeekView changes.
  • refresh(): Refreshes the WeekViewDisplayable elements presented by this adapter. All cached elements will be removed and a call to onLoadMore will be triggered.

JodaTime, JSR310 and ThreeTenABP modules

Properties

minDateAsLocalDate: LocalDate?

Returns the minimum date that WeekView will display as a LocalDate, or null if none is set. Dates before this date will not be shown.

maxDateAsLocalDate: LocalDate?

Returns the maximum date that WeekView will display as a LocalDate, or null if none is set. Dates after this date will not be shown.

firstVisibleDateAsLocalDate: LocalDate

Returns the first visible date as a LocalDate

lastVisibleDateAsLocalDate: LocalDate

Returns the last visible date as a LocalDate.

Methods

goToDate(date: LocalDate)

Shows a specific date. If it is before minDate or after maxDate, these will be shown instead.

setDateFormatter(formatter: (LocalDate) -> String)

Sets the provided closure as the current date formatter.

Adapters

JodaTime

Use WeekViewSimpleAdapterJodaTime<T> and WeekViewPagingAdapterJodaTime<T> for JodaTime-specific method overrides.

JSR310

Use WeekViewSimpleAdapterJsr310<T> and WeekViewPagingAdapterJsr310<T> for JSR310-specific method overrides.

ThreeTenABP

Use WeekViewSimpleAdapterThreeTenAbp<T> and WeekViewPagingAdapterThreeTenAbp<T>for ThreeTenABP-specific method overrides.

Clone this wiki locally