Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make numpad work better in number picker dialog #1082

Merged
merged 2 commits into from
Sep 11, 2021

Conversation

hiqua
Copy link
Collaborator

@hiqua hiqua commented Aug 22, 2021

#922

  • Make both NumberPickers focusable.
  • Make the second NumberPicker have 0.01 increments instead of 0.05.
  • Ensure that typing "." in the numpad switches the focus from the first NumberPicker to the second and selects the current number, so that typing "3.14" works as expected.

Currently, entering the decimal part via the numpad has no effect.

I'm trying to listen to key events to switch from one NumberPicker to the other, but I don't see any event for the non-digit (soft) keys. This might be relevant: https://developer.android.com/training/keyboard-input/commands (we cannot rely on such key events).

@hiqua hiqua force-pushed the improve_number_picker branch 3 times, most recently from 06f70ff to c8faddb Compare September 4, 2021 14:17
@hiqua hiqua marked this pull request as ready for review September 4, 2021 15:15
@hiqua
Copy link
Collaborator Author

hiqua commented Sep 4, 2021

I wanted to use a TextWatcher to check that a separator is entered, but the filters remove it before it reaches the watcher, hence the current solution. Curious what you'll think about it / whether you think there's a better way.

I don't think I've seen https://code.google.com/p/android/issues/detail?id=35482 at least not with this PR, when does it occur? In the meantime I've deleted the corresponding workaround, as it allowed dots in the fractional part. If we need to put it back, I need to find out how to prevent that.

Still not perfect / to follow up:

  • for the fractional part, if only one digit is entered, it should be multiplied by 0.1 instead of 0.01
  • if possible, we should probably force the keyboard to always be open, instead of closing it if the user starts scrolling

@hiqua hiqua requested a review from iSoron September 4, 2021 15:19
@iSoron
Copy link
Owner

iSoron commented Sep 11, 2021

Thanks for the PR, @hiqua. I've tested it and it seems to be working quite well.

I don't think I've seen https://code.google.com/p/android/issues/detail?id=35482 at least not with this PR, when does it occur? In the meantime I've deleted the corresponding workaround, as it allowed dots in the fractional part. If we need to put it back, I need to find out how to prevent that.

I have also tried to reproduce the bug in your version of the code, but I couldn't. I think it's fine to remove the workaround.

@iSoron iSoron merged commit 0e988e7 into iSoron:dev Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants