@@ -47,78 +47,84 @@ public interface RecurrencePickerSettings {
47
47
boolean DEFAULT_SHOW_CANCEL_BTN = false ;
48
48
int DEFAULT_ENABLED_PERIODS = 0b1111;
49
49
int DEFAULT_ENABLED_END_TYPES = 0b111;
50
- Recurrence [] DEFAULT_OPTION_LIST_DEFAULTS = null ;
50
+
51
+ Recurrence [] DEFAULT_OPTION_LIST_DEFAULTS = new Recurrence []{
52
+ new Recurrence (0 , Recurrence .DAILY ),
53
+ new Recurrence (0 , Recurrence .WEEKLY ),
54
+ new Recurrence (0 , Recurrence .MONTHLY ),
55
+ new Recurrence (0 , Recurrence .YEARLY ),
56
+ };
51
57
CharSequence [] DEFAULT_OPTION_LIST_TITLES = null ;
52
58
53
59
/**
54
- * Set the date format to use
55
- * By default, the system default date format is used
56
- * You should call this method before {@link #setRecurrence(Recurrence, long)}
57
- * @param endDateFormat Date format to use for the end date
58
- * This date should usually be shorter
59
- * @param optionListDateFormat Date format to use for the custom item in the option list
60
- * This date should usually be more verbose
60
+ * Set the date format to use.
61
+ * By default, the system default date format is used.
62
+ * You should call this method before {@link #setRecurrence(Recurrence, long)}.
63
+ * @param endDateFormat Date format to use for the end date.
64
+ * This date should usually be shorter.
65
+ * @param optionListDateFormat Date format to use for the custom item in the option list.
66
+ * This date should usually be more verbose.
61
67
*/
62
68
RecurrencePickerSettings setDateFormat (@ NonNull DateFormat endDateFormat , @ NonNull DateFormat optionListDateFormat );
63
69
64
70
/**
65
- * Call this method to initialize the recurrence picker with a recurrence and a date
66
- * @param recurrence Recurrence to display, use null for the default "does not repeat"
67
- * @param startDate Starting date of recurrence to be returned, use 0 for today
71
+ * Call this method to initialize the recurrence picker with a recurrence and a date.
72
+ * @param recurrence Recurrence to display, use null for the default "does not repeat".
73
+ * @param startDate Starting date of recurrence to be returned, use {@code 0} for today.
68
74
*/
69
75
RecurrencePickerSettings setRecurrence (@ Nullable Recurrence recurrence , long startDate );
70
76
71
77
/**
72
- * Set the maximum event count for a recurrence
73
- * By default, the maximum number of events is 999
74
- * Must be set before showing the creator or the dialog
75
- * @param max Maximum count, set to -1 to allow any number of events
76
- * Even if set to -1 , maximum is {@link RecurrencePickerView#MAX_FIELD_VALUE}
78
+ * Set the maximum event count for a recurrence.
79
+ * By default, the maximum number of events is 999.
80
+ * Must be set before showing the creator or the dialog.
81
+ * @param max Maximum count, set to {@code -1} to allow any number of events
82
+ * Even if set to {@code -1} , maximum is {@link RecurrencePickerView#MAX_FIELD_VALUE}.
77
83
*/
78
84
RecurrencePickerSettings setMaxEventCount (int max );
79
85
80
86
/**
81
- * Set the maximum frequency for a period
82
- * By default, maximum frequency is 99
83
- * Must be set before showing the creator or the dialog
84
- * ex : if 10 , maximum will be: every 10 days, every 10 weeks, every 10 months...
85
- * @param max Maximum frequency, set to -1 to allow any value
86
- * Even if set to -1 , maximum is {@link RecurrencePickerView#MAX_FIELD_VALUE}
87
+ * Set the maximum frequency for a period.
88
+ * By default, maximum frequency is 99.
89
+ * Must be set before showing the creator or the dialog.
90
+ * Eg : if {@code 10} , maximum will be: every 10 days, every 10 weeks, every 10 months...
91
+ * @param max Maximum frequency, set to {@code -1} to allow any value.
92
+ * Even if set to {@code -1} , maximum is {@link RecurrencePickerView#MAX_FIELD_VALUE}.
87
93
*/
88
94
RecurrencePickerSettings setMaxFrequency (int max );
89
95
90
96
/**
91
- * Set the maximum end date for a recurrence
92
- * By default, there is no maximum end date
93
- * Must be set before showing the creator or the dialog
94
- * @param time Time in millis for a date, set to -1 for no maximum
97
+ * Set the maximum end date for a recurrence.
98
+ * By default, there is no maximum end date.
99
+ * Must be set before showing the creator or the dialog.
100
+ * @param time Time in millis for a date, set to {@code -1} for no maximum.
95
101
*/
96
102
RecurrencePickerSettings setMaxEndDate (long time );
97
103
98
104
/**
99
- * Change how the end date is set relative to the start date by default
100
- * By default, default end date is 3 periods after start date
101
- * Must be set before showing the creator or the dialog
102
- * @param usePeriod If true, will use the currently selected period as the unit of the interval
103
- * ex : if repeating weekly and interval is 3, default end date will be 3 weeks after start date
104
- * If false, will use days as the unit of the interval
105
- * @param interval How many periods/days after start date to set default end date
105
+ * Change how the end date is set relative to the start date by default.
106
+ * By default, default end date is 3 periods after start date.
107
+ * Must be set before showing the creator or the dialog.
108
+ * @param usePeriod If true, will use the currently selected period as the unit of the interval.
109
+ * Eg : if repeating weekly and interval is 3, default end date will be 3 weeks after start date.
110
+ * If false, will use days as the unit of the interval.
111
+ * @param interval How many periods/days after start date to set default end date.
106
112
*/
107
113
RecurrencePickerSettings setDefaultEndDate (boolean usePeriod , int interval );
108
114
109
115
/**
110
- * Set the number of events to show by default
111
- * By default, recurrence ends after 5 events
112
- * Must be set before showing the creator or the dialog
113
- * @param count Number of events to show by default
116
+ * Set the number of events to show by default.
117
+ * By default, recurrence ends after 5 events.
118
+ * Must be set before showing the creator or the dialog.
119
+ * @param count Number of events to show by default.
114
120
*/
115
121
RecurrencePickerSettings setDefaultEndCount (int count );
116
122
117
123
/**
118
- * Select which modes are enabled: default options list and recurrence creator
119
- * By default, both modes are enabled, and at least one of them should be
120
- * @param optionListEnabled whether to enable the default options list
121
- * @param creatorEnabled whether to enabled the recurrence creator
124
+ * Select which modes are enabled: default options list and recurrence creator.
125
+ * By default, both modes are enabled, and at least one of them should be.
126
+ * @param optionListEnabled whether to enable the default options list.
127
+ * @param creatorEnabled whether to enabled the recurrence creator.
122
128
*/
123
129
RecurrencePickerSettings setEnabledModes (boolean optionListEnabled , boolean creatorEnabled );
124
130
@@ -134,47 +140,45 @@ public interface RecurrencePickerSettings {
134
140
* Set whether the header should be displayed in the first screen, the list of default recurrence options,
135
141
* or not. If you wish to also hide the header in the creator mode, you can change its background color.
136
142
* By default, header is shown.
137
- * @param show Whether to show it or not
143
+ * @param show Whether to show it or not.
138
144
*/
139
145
RecurrencePickerSettings setShowHeaderInOptionList (boolean show );
140
146
141
147
/**
142
148
* Set whether to show a cancel button or not. Cancel button is placed at the left side of the done button.
143
149
* By default, cancel button is hidden.
144
- * @param show Whether to show it or not
150
+ * @param show Whether to show it or not.
145
151
*/
146
152
RecurrencePickerSettings setShowCancelButton (boolean show );
147
153
148
154
/**
149
- * Set which periods are available to be used. Note that NONE period cannot be disabled
155
+ * Set which periods are available to be used. Note that {@code NONE} period cannot be disabled.
150
156
* You must set at least one period.
151
157
* Must be set before showing the creator or the dialog
152
- * @param periods bit field of 1 << [Recurrence. DAILY to Recurrence.YEARLY]. Ex:
153
- * periods = (1 << Recurrence.DAILY) | (1 << Recurrence.WEEKLY)
158
+ * @param periods bit field of recurrence period constants. ({@code DAILY} to {@code YEARLY})
159
+ * Eg: {@code periods = (1 << Recurrence.DAILY) | (1 << Recurrence.YEARLY)}
154
160
* Don't forget the parentheses!
155
- * A quicker way would be to use binary literal ex: periods = 0b1111 (all periods)
156
161
*/
157
162
RecurrencePickerSettings setEnabledPeriods (int periods );
158
163
159
164
/**
160
- * Set which end types are available to be used. Note that END_BY_DATE_OR_COUNT is not implemented
165
+ * Set which end types are available to be used.
161
166
* You must set at least one type. If that's the case, end type spinner will be disabled.
162
167
* If the only end type set is forever, end type spinner completely disappears.
163
- * Must be set before showing the creator or the dialog
164
- * @param types bit field of 1 << [Recurrence.END_NEVER, END_BY_DATE and END_BY_COUNT]. Ex:
165
- * periods = (1 << Recurrence.END_BY_DATE) | (1 << Recurrence.END_BY_COUNT)
168
+ * Must be set before showing the creator or the dialog.
169
+ * @param types bit field of recurrence end types.
170
+ * Eg: {@code types = (1 << Recurrence.END_BY_DATE) | (1 << Recurrence.END_BY_COUNT)}
166
171
* Don't forget the parentheses!
167
- * A quicker way would be to use binary literal ex: types = 0b111 (all types)
168
172
*/
169
173
RecurrencePickerSettings setEnabledEndTypes (int types );
170
174
171
175
/**
172
- * Change defaults in option list. Note that "Does not repeat" will always be shown.
173
- * By default, a daily, weekly, monthly and yearly recurrences with frequency of 1 are used
174
- * MUST be set before setting the recurrence if using the view by itself
175
- * @param defaults Array of recurrence to use as defaults, leave null to use default defaults (exactly)
176
- * or leave null to only change the titles
177
- * You can set any start date for these recurrences because it gets changed
176
+ * Change defaults in option list. Note that "Does not repeat" will always be shown first .
177
+ * By default, a daily, weekly, monthly and yearly recurrences with frequency of 1 are used.
178
+ * Must be set before setting the recurrence if using the view by itself.
179
+ * @param defaults Array of recurrence to use as defaults, leave null to use default defaults,
180
+ * or to only change the titles.
181
+ * You can set any start date for these recurrences because it gets changed.
178
182
* @param titles Array of titles to use for each recurrence, leave null to use
179
183
* {@link RecurrenceFormat#format(Recurrence)} instead. You can also leave
180
184
* specific items in array null to only format those.
0 commit comments