Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91d28990 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 2f2e3f8a 9fe1c121
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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);
            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;
+9 −2
Original line number Diff line number Diff line
@@ -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);
            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;