This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add localized listener for Android numeric input #719
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
samhouts
reviewed
Feb 1, 2017
@@ -56,6 +58,14 @@ protected override void OnCellPropertyChanged(object sender, PropertyChangedEven | |||
UpdateHeight(); | |||
} | |||
|
|||
protected NumberKeyListener GetDigitsKeyListener(InputTypes inputTypes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
virtual
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks.
@@ -86,6 +87,14 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE | |||
base.OnElementPropertyChanged(sender, e); | |||
} | |||
|
|||
protected NumberKeyListener GetDigitsKeyListener(InputTypes inputTypes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
virtual
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks.
902d0a9
to
be83984
Compare
samhouts
approved these changes
Feb 1, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Behavioral Changes
PR Checklist