I am migrating the calendar components to the new Materials library, MaterialDatePicker
, however I am having problems in doing something as simple as changing the name of the confirm button texts
Previously enough with this
datePickerDialog.setButton(DatePickerDialog.BUTTON_POSITIVE, getString(R.string.save), datePickerDialog)
But now I can't find any public method
val picker = Builder.datePicker()
picker.addOnPositiveButtonClickListener { selection: Long ->
saveListPosition()
accountDetailsPresenter.editDate(selection, transaction, product, "")
}
picker.show(childFragmentManager, picker.toString())
Currently (1.1.0-beta02
and 1.2.0-alpha02
) you can't do it programmatically.
However you can override the existing strings in your project, but this workaround can stop to run in the next releases.
For the confirm and the cancel buttons put in your projects these strings:
<string name="mtrl_picker_confirm" description="Button text to indicate that the widget will save the user's selection [CHAR_LIMIT=16]">.....</string>
<string name="mtrl_picker_cancel" description="Button text to indicate that the widget will ignore the user's selection [CHAR_LIMIT=16]" translatable="false">...</string>