Search in sources :

Example 6 with SimpleStringSplitter

use of android.text.TextUtils.SimpleStringSplitter in project android_frameworks_base by DirtyUnicorns.

the class InputMethodUtils method parseInputMethodsAndSubtypesString.

/**
     * Parses the setting stored input methods and subtypes string value.
     *
     * @param inputMethodsAndSubtypesString The input method subtypes value stored in settings.
     * @return Map from input method ID to set of input method subtypes IDs.
     */
@VisibleForTesting
public static ArrayMap<String, ArraySet<String>> parseInputMethodsAndSubtypesString(@Nullable final String inputMethodsAndSubtypesString) {
    final ArrayMap<String, ArraySet<String>> imeMap = new ArrayMap<>();
    if (TextUtils.isEmpty(inputMethodsAndSubtypesString)) {
        return imeMap;
    }
    final SimpleStringSplitter typeSplitter = new SimpleStringSplitter(INPUT_METHOD_SEPARATOR);
    final SimpleStringSplitter subtypeSplitter = new SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATOR);
    List<Pair<String, ArrayList<String>>> allImeSettings = InputMethodSettings.buildInputMethodsAndSubtypeList(inputMethodsAndSubtypesString, typeSplitter, subtypeSplitter);
    for (Pair<String, ArrayList<String>> ime : allImeSettings) {
        ArraySet<String> subtypes = new ArraySet<>();
        if (ime.second != null) {
            subtypes.addAll(ime.second);
        }
        imeMap.put(ime.first, subtypes);
    }
    return imeMap;
}
Also used : ArraySet(android.util.ArraySet) ArrayList(java.util.ArrayList) ArrayMap(android.util.ArrayMap) SimpleStringSplitter(android.text.TextUtils.SimpleStringSplitter) Pair(android.util.Pair) VisibleForTesting(com.android.internal.annotations.VisibleForTesting)

Example 7 with SimpleStringSplitter

use of android.text.TextUtils.SimpleStringSplitter in project android_frameworks_base by AOSPA.

the class InputMethodUtils method parseInputMethodsAndSubtypesString.

/**
     * Parses the setting stored input methods and subtypes string value.
     *
     * @param inputMethodsAndSubtypesString The input method subtypes value stored in settings.
     * @return Map from input method ID to set of input method subtypes IDs.
     */
@VisibleForTesting
public static ArrayMap<String, ArraySet<String>> parseInputMethodsAndSubtypesString(@Nullable final String inputMethodsAndSubtypesString) {
    final ArrayMap<String, ArraySet<String>> imeMap = new ArrayMap<>();
    if (TextUtils.isEmpty(inputMethodsAndSubtypesString)) {
        return imeMap;
    }
    final SimpleStringSplitter typeSplitter = new SimpleStringSplitter(INPUT_METHOD_SEPARATOR);
    final SimpleStringSplitter subtypeSplitter = new SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATOR);
    List<Pair<String, ArrayList<String>>> allImeSettings = InputMethodSettings.buildInputMethodsAndSubtypeList(inputMethodsAndSubtypesString, typeSplitter, subtypeSplitter);
    for (Pair<String, ArrayList<String>> ime : allImeSettings) {
        ArraySet<String> subtypes = new ArraySet<>();
        if (ime.second != null) {
            subtypes.addAll(ime.second);
        }
        imeMap.put(ime.first, subtypes);
    }
    return imeMap;
}
Also used : ArraySet(android.util.ArraySet) ArrayList(java.util.ArrayList) ArrayMap(android.util.ArrayMap) SimpleStringSplitter(android.text.TextUtils.SimpleStringSplitter) Pair(android.util.Pair) VisibleForTesting(com.android.internal.annotations.VisibleForTesting)

Aggregations

SimpleStringSplitter (android.text.TextUtils.SimpleStringSplitter)7 ArrayMap (android.util.ArrayMap)5 ArraySet (android.util.ArraySet)5 Pair (android.util.Pair)5 VisibleForTesting (com.android.internal.annotations.VisibleForTesting)5 ArrayList (java.util.ArrayList)5