Recurrence

An object describing a recurrence rule. All recurrence objects are immutable.

Types

Link copied to clipboard
class Builder

Builder for recurrence.

Link copied to clipboard
object Companion
Link copied to clipboard
annotation class DaysOfWeek

Int def for the byDay bit field property.

Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard
val byDay: Int

Least-significant bit is 1 if the value is used, 0 otherwise.

Link copied to clipboard

If period is MONTHLY, the day of the month on which the events happen. The number must be between -31 and 31. If the value is 0 (the default), the events will happen on the same day of the month as the start date's. The value can also be 0 if byDay determines the day of the month instead. Negative numbers start counting from the end of the month.

Link copied to clipboard

If period is MONTHLY, get the day of the week on which the events happen. Returns 0 if undefined or events happen on a particular day of the month instead. Returns a Calendar.SUNDAY-SATURDAY constant otherwise.

Link copied to clipboard

The number of events before the end of the recurrence if end type is EndType.BY_COUNT. If not, end count is always 0. Since the start date is exclusive, the number of events never includes the start date event.

Link copied to clipboard

The end date if end type is EndType.BY_DATE. If not, end date is always DATE_NONE. The end date is inclusive so the last event might be on the end date. The date is given in UTC milliseconds since epoch time. The time of the day has no importance. To account for time zones, use RecurrenceFinder.timeZone and RRuleFormatter.timeZone.

Link copied to clipboard

The rule for the recurrence end, see EndType.

Link copied to clipboard

The recurrence frequency i.e after how many periods to repeat the event. For example, if period is daily and frequency is 2, events will happen every 2 days. Frequency of Period.NONE recurrences is always 1.

Link copied to clipboard

The time period over which the recurrence happens.

Link copied to clipboard

If period is MONTHLY, get the week of the month on which the events happen. Returns 0 if undefined or events happen on a particular day of the month instead.

Functions

Link copied to clipboard
open override fun describeContents(): Int
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Note: since two recurrences with dates at different times of the day will produce the same events, they are considered equal, even though the dates may not have the same value. Same applies for hashCode.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

If period is WEEKLY, checks if events happen on certain days of the week. Returns true only if recurrence happens on all of these days. To get the number of days set use Integer.bitCount(recurrence.byDay) - 1 (or recurrence.byDay.countOneBits() - 1 in Kotlin). Note that if the weekly recurrence has no days set, meaning it happens on the same day as the start date's, this method will always return false since this day is unknown. If period is MONTHLY, checks if events happen on a certain day of the week specified by a single flag set in days.

Link copied to clipboard
open override fun toString(): String

Return a human readable string representation of the recurrence. This is only for debug purposes and will not even work on release builds. RecurrenceFormatter should be used instead.

Link copied to clipboard
open override fun writeToParcel(parcel: Parcel, flags: Int)