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

Add localized listener for Android numeric input #719

Merged
merged 2 commits into from Feb 17, 2017

Conversation

Projects
None yet
4 participants
@hartez
Member

hartez commented Jan 25, 2017

Description of Change

Proposing this as an alternative fix to PR 396

The DigitsKeyListener in Android has . hard-coded as the decimal separator. This change introduces a LocalizedDigitsKeyListener which checks the current decimal separator for the device language. If the separator is ., it defers to the built-in DigitsKeyListener; if not, it uses an instance of LocalizedDigitsKeyListener with the correct decimal separator.

This preserves the default Android behavior (not allowing the user to enter an invalid number format) while allowing for "alternate" decimal separators (e.g. ,).

This change also provides an easily overridable method for providing an alternate NumericKeyListener for users who need to disallow negative/decimal numbers or provide alternate acceptable characters.

A test page is included, but it's manual - there's currently no UI test facility for changing the language settings of the device mid-test.

Bugs Fixed

API Changes

  • None

Behavioral Changes

  • This change makes the numeric keyboard on Android allow negative numbers by default; the previous default did not allow negative numbers. I believe this new default follows the law of least surprise, but feel free to argue for the previous default behavior in the comments.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense

hartez added some commits Jan 25, 2017

@rmarinho rmarinho merged commit 408b662 into master Feb 17, 2017

6 checks passed

Android-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run Android 6.0.1 : Tests passed: 352, i…
Details
OSX-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: OSX Debug : Running
Details
Windows-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: Windows Debug : Tests passed: 3723, ignored: 10
Details
iOS10-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS10 : Tests passed: 34…
Details
iOS8-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified IOS8 : Tests passed: 348…
Details
iOS9-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS9 : Tests passed: 350…
Details

@hartez hartez deleted the fix-bugzilla42000 branch May 16, 2017

@samhouts samhouts added D-15.4 and removed cla-not-required labels Oct 10, 2017

@samhouts samhouts added this to the 2.3.0 milestone Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment