zhanghai / zhanghai/ComposePreference

Feature request: disable OK button in dialog if textToValue returns null in TextFieldPreference

Open
#17 4 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.