Java Code Examples for com.android.internal.util.ArrayUtils#containsAll()

The following examples show how to use com.android.internal.util.ArrayUtils#containsAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimeKeyListener.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public TimeKeyListener(@Nullable Locale locale) {
    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".
    final boolean success = NumberKeyListener.addDigits(chars, locale)
                      && NumberKeyListener.addAmPmChars(chars, locale)
                      && NumberKeyListener.addFormatCharsFromSkeleton(
                          chars, locale, SKELETON_12HOUR, SYMBOLS_TO_IGNORE)
                      && NumberKeyListener.addFormatCharsFromSkeleton(
                          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;
    }
}
 
Example 2
Source File: DateTimeKeyListener.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public DateTimeKeyListener(@Nullable Locale locale) {
    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".
    final boolean success = NumberKeyListener.addDigits(chars, locale)
                      && NumberKeyListener.addAmPmChars(chars, locale)
                      && NumberKeyListener.addFormatCharsFromSkeleton(
                          chars, locale, SKELETON_12HOUR, SYMBOLS_TO_IGNORE)
                      && NumberKeyListener.addFormatCharsFromSkeleton(
                          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;
    }
}
 
Example 3
Source File: DateKeyListener.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public DateKeyListener(@Nullable Locale locale) {
    final LinkedHashSet<Character> chars = new LinkedHashSet<>();
    // First add the digits, then add all the non-pattern characters seen in the pattern for
    // "yMd", which is supposed to only have numerical fields.
    final boolean success = NumberKeyListener.addDigits(chars, locale)
                            && NumberKeyListener.addFormatCharsFromSkeletons(
                                    chars, locale, SKELETONS, SYMBOLS_TO_IGNORE);
    if (success) {
        mCharacters = NumberKeyListener.collectionToArray(chars);
        mNeedsAdvancedInput = !ArrayUtils.containsAll(CHARACTERS, mCharacters);
    } else {
        mCharacters = CHARACTERS;
        mNeedsAdvancedInput = false;
    }
}
 
Example 4
Source File: DigitsKeyListener.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private void calculateNeedForAdvancedInput() {
    final int kind = (mSign ? SIGN : 0) | (mDecimal ? DECIMAL : 0);
    mNeedsAdvancedInput = !ArrayUtils.containsAll(COMPATIBILITY_CHARACTERS[kind], mAccepted);
}
 
Example 5
Source File: Signature.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Test if given {@link Signature} sets are exactly equal.
 *
 * @hide
 */
public static boolean areExactMatch(Signature[] a, Signature[] b) {
    return (a.length == b.length) && ArrayUtils.containsAll(a, b)
            && ArrayUtils.containsAll(b, a);
}