zhanghai / zhanghai/ComposePreference
Feature request: disable OK button in dialog if textToValue returns null in TextFieldPreference
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 324
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
Hello. Thanks for the great library!
Currently, if the textToValue lambda retuns null pressing the OK button has no effect. This is a kinda roundabout way of validating the input, but it yields a poor UX.
Would you consider disabling the OK button in this case?
This would require calculating textToValue at each value update, so maybe a different isValid lambda could be provided for this use-case.
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the TextFieldPreference implementation and tracing how textToValue is evaluated when the dialog value changes. Determine how the OK button is enabled, then make its disabled state reflect a null result from textToValue. Done means invalid input cannot be confirmed while valid input still can.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100