material-prefs icon indicating copy to clipboard operation
material-prefs copied to clipboard

DateTimePicker not updating label when onSelected called

Open scottyab opened this issue 4 years ago • 0 comments

Hi, I noticed that the BaseDateTimePickerPreference isn't updating the label when you select a time, wasn't sure if this was a bug or feature? but the listSingleChoice updates the label on select.

Before

 protected fun onSelected(value: Calendar) {
        saveValue(value.timeInMillis)
        onValueSelected?.invoke(value)
    }

After

  protected fun onSelected(value: Calendar) {
        saveValue(value.timeInMillis)
        onValueSelected?.invoke(value)
        val text = valueConverter?.invoke(value) ?: defaultFormatter.format(value.time)
        view.setLabelText(text)
	}

It was a quick fix and likely a more elegant solution exists, but thought I'd share in case others found this issue.

scottyab avatar May 14 '21 08:05 scottyab