Merge "Special-case English for DateTime and Time key listeners" into oc-dev

am: 91d289903c

Change-Id: Ibeaea13b146e30b5f7d67c49295081632a6a7736
This commit is contained in:
Roozbeh Pournader
2017-04-07 19:32:45 +00:00
committed by android-build-merger
2 changed files with 18 additions and 4 deletions

View File

@@ -68,7 +68,7 @@ public class DateTimeKeyListener extends NumberKeyListener
final LinkedHashSet<Character> chars = new LinkedHashSet<>();
// First add the digits. Then, add all the character in AM and PM markers. Finally, add all
// the non-pattern characters seen in the patterns for "yMdhms" and "yMdHms".
boolean success = NumberKeyListener.addDigits(chars, locale)
final boolean success = NumberKeyListener.addDigits(chars, locale)
&& NumberKeyListener.addAmPmChars(chars, locale)
&& NumberKeyListener.addFormatCharsFromSkeleton(
chars, locale, SKELETON_12HOUR, SYMBOLS_TO_IGNORE)
@@ -76,7 +76,14 @@ public class DateTimeKeyListener extends NumberKeyListener
chars, locale, SKELETON_24HOUR, SYMBOLS_TO_IGNORE);
if (success) {
mCharacters = NumberKeyListener.collectionToArray(chars);
mNeedsAdvancedInput = !ArrayUtils.containsAll(CHARACTERS, mCharacters);
if (locale != null && "en".equals(locale.getLanguage())) {
// For backward compatibility reasons, assume we don't need advanced input for
// English locales, although English locales literally also need a comma and perhaps
// uppercase letters for AM and PM.
mNeedsAdvancedInput = false;
} else {
mNeedsAdvancedInput = !ArrayUtils.containsAll(CHARACTERS, mCharacters);
}
} else {
mCharacters = CHARACTERS;
mNeedsAdvancedInput = false;

View File

@@ -68,7 +68,7 @@ public class TimeKeyListener extends NumberKeyListener
final LinkedHashSet<Character> chars = new LinkedHashSet<>();
// First add the digits. Then, add all the character in AM and PM markers. Finally, add all
// the non-pattern characters seen in the patterns for "hms" and "Hms".
boolean success = NumberKeyListener.addDigits(chars, locale)
final boolean success = NumberKeyListener.addDigits(chars, locale)
&& NumberKeyListener.addAmPmChars(chars, locale)
&& NumberKeyListener.addFormatCharsFromSkeleton(
chars, locale, SKELETON_12HOUR, SYMBOLS_TO_IGNORE)
@@ -76,7 +76,14 @@ public class TimeKeyListener extends NumberKeyListener
chars, locale, SKELETON_24HOUR, SYMBOLS_TO_IGNORE);
if (success) {
mCharacters = NumberKeyListener.collectionToArray(chars);
mNeedsAdvancedInput = !ArrayUtils.containsAll(CHARACTERS, mCharacters);
if (locale != null && "en".equals(locale.getLanguage())) {
// For backward compatibility reasons, assume we don't need advanced input for
// English locales, although English locales may need uppercase letters for
// AM and PM.
mNeedsAdvancedInput = false;
} else {
mNeedsAdvancedInput = !ArrayUtils.containsAll(CHARACTERS, mCharacters);
}
} else {
mCharacters = CHARACTERS;
mNeedsAdvancedInput = false;