Builder

class Builder(context: Context, @StyleRes themeResId: Int, onDateSetListener: MonthYearPickerDialog.OnDateSetListener?, selectedYear: Int, @IntRange(from = 0, to = 11) selectedMonth: Int)

Builder for MonthYearPickerDialog.

Parameters

context

parent context.

themeResId

resource ID of the theme against which to inflate this dialog.

onDateSetListener

the listener to be invoked when user sets the date. Default value is null.

selectedYear

initially selected year. Default value is current year.

selectedMonth

initially selected month in range from Calendar.JANUARY to Calendar.DECEMBER. Default value is current month.

Constructors

Builder
Link copied to clipboard
fun Builder(context: Context, @StyleRes themeResId: Int, onDateSetListener: MonthYearPickerDialog.OnDateSetListener? = null, selectedYear: Int = Calendar.getInstance()[Calendar.YEAR], @IntRange(from = 0, to = 11) selectedMonth: Int = Calendar.getInstance()[Calendar.MONTH])

Functions

build
Link copied to clipboard
fun build(): MonthYearPickerDialog

Creates MonthYearPickerDialog after checking the entered parameters.

setAnnualMode
Link copied to clipboard
fun setAnnualMode(enableAnnualMode: Boolean): MonthYearPickerDialog.Builder

Enables or disables annual mode.

setMaxMonth
Link copied to clipboard
fun setMaxMonth(@IntRange(from = 0, to = 11) month: Int): MonthYearPickerDialog.Builder

Sets maximum enabled month.

setMaxYear
Link copied to clipboard
fun setMaxYear(year: Int): MonthYearPickerDialog.Builder

Sets maximum available year.

setMinMonth
Link copied to clipboard
fun setMinMonth(@IntRange(from = 0, to = 11) month: Int): MonthYearPickerDialog.Builder

Sets minimum enabled month.

setMinYear
Link copied to clipboard
fun setMinYear(year: Int): MonthYearPickerDialog.Builder

Sets minimum available year.

setMode
Link copied to clipboard

Sets UI mode of dialog.

setMonthFormat
Link copied to clipboard
fun setMonthFormat(format: SimpleDateFormat): MonthYearPickerDialog.Builder

Sets format for usage when picking months.

fun setMonthFormat(pattern: String, locale: Locale = Locale.getDefault()): MonthYearPickerDialog.Builder

Constructs a SimpleDateFormat from given pattern and default date format symbols for given locale and sets it for usage when picking months.

setNegativeButton
Link copied to clipboard
fun setNegativeButton(text: CharSequence): MonthYearPickerDialog.Builder
fun setNegativeButton(@StringRes textId: Int): MonthYearPickerDialog.Builder

Sets text to display in the negative button.

setOnMonthSelectedListener
Link copied to clipboard

Sets callback that will be invoked when user has selected month.

setOnYearSelectedListener
Link copied to clipboard

Sets callback that will be invoked when user has selected year.

setPositiveButton
Link copied to clipboard
fun setPositiveButton(text: CharSequence): MonthYearPickerDialog.Builder
fun setPositiveButton(@StringRes textId: Int): MonthYearPickerDialog.Builder

Sets text to display in the positive button.