Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Using the picker view
The dialog is what most people choose to select a recurrence, but you might want to include the picker view directly in your interface, or use it in a dialog with other widgets. For this purpose, you can use the
RecurrencePickerView by itself.
<com.maltaisn.recurpicker.RecurrencePickerView android:layout_width="match_parent" android:layout_height="wrap_content" />
The view has a few more settings than the dialog, you can set them with these methods:
setOnRecurrenceSelectedListener(@Nullable OnRecurrenceSelectedListener listener): Instead of the callback the dialog uses, the view uses a listener. The reason of this is that the dialog's caller activity might change during the dialog's lifetime, become the dialog instante in kept on configuration changes. Using a listener would be a memory leak.
listener: Listener to call when recurrence is selected and when cancel button is clicked. Set null to remove it.
setOnCreatorShownListener(@Nullable OnCreatorShownListener listener)
listener: Listener to call when picker view changes from option list to recurrence creator. This method may have limited use, but it is used by the dialog to briefly hide the dialog while its views and rearranged.
getRecurrence(): Get the currently selected recurrence.
Using the view in a dialog
Don't forget that if you are using the view in a dialog, you need to call:
setIsInDialog(true)to notify the view that it is in a dialog.
showDateDialogIfNeeded(): you need to call this method in your dialog's
onShowlistener to notify the view that it can now restore the date dialog if it was opened before restoring. This prevents the date dialog from being displayed behind your dialog because it was shown first.
For more information, look at the default
RecurrencePickerDialog source code.
If you need to remove the header in the recurrence creator, look at the example in the styling section.