use of android.text.TextUtils.SimpleStringSplitter in project platform_frameworks_base by android.
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;
}
use of android.text.TextUtils.SimpleStringSplitter in project XobotOS by xamarin.
the class AccessibilityInjector method ensureWebContentKeyBindings.
/**
* Ensures that the Web content key bindings are loaded.
*/
private void ensureWebContentKeyBindings() {
if (sBindings.size() > 0) {
return;
}
String webContentKeyBindingsString = Settings.Secure.getString(mWebView.getContext().getContentResolver(), Settings.Secure.ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS);
SimpleStringSplitter semiColonSplitter = new SimpleStringSplitter(';');
semiColonSplitter.setString(webContentKeyBindingsString);
while (semiColonSplitter.hasNext()) {
String bindingString = semiColonSplitter.next();
if (TextUtils.isEmpty(bindingString)) {
Log.e(LOG_TAG, "Disregarding malformed Web content key binding: " + webContentKeyBindingsString);
continue;
}
String[] keyValueArray = bindingString.split("=");
if (keyValueArray.length != 2) {
Log.e(LOG_TAG, "Disregarding malformed Web content key binding: " + bindingString);
continue;
}
try {
long keyCodeAndModifiers = Long.decode(keyValueArray[0].trim());
String[] actionStrings = keyValueArray[1].split(":");
int[] actions = new int[actionStrings.length];
for (int i = 0, count = actions.length; i < count; i++) {
actions[i] = Integer.decode(actionStrings[i].trim());
}
sBindings.add(new AccessibilityWebContentKeyBinding(keyCodeAndModifiers, actions));
} catch (NumberFormatException nfe) {
Log.e(LOG_TAG, "Disregarding malformed key binding: " + bindingString);
}
}
}
use of android.text.TextUtils.SimpleStringSplitter in project android_frameworks_base by ResurrectionRemix.
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;
}
use of android.text.TextUtils.SimpleStringSplitter in project android_frameworks_base by crdroidandroid.
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;
}
use of android.text.TextUtils.SimpleStringSplitter in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityInjectorFallback method ensureWebContentKeyBindings.
/**
* Ensures that the Web content key bindings are loaded.
*/
private void ensureWebContentKeyBindings() {
if (sBindings.size() > 0) {
return;
}
String webContentKeyBindingsString = Settings.Secure.getString(mWebView.getContext().getContentResolver(), Settings.Secure.ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS);
SimpleStringSplitter semiColonSplitter = new SimpleStringSplitter(';');
semiColonSplitter.setString(webContentKeyBindingsString);
while (semiColonSplitter.hasNext()) {
String bindingString = semiColonSplitter.next();
if (TextUtils.isEmpty(bindingString)) {
Log.e(LOG_TAG, "Disregarding malformed Web content key binding: " + webContentKeyBindingsString);
continue;
}
String[] keyValueArray = bindingString.split("=");
if (keyValueArray.length != 2) {
Log.e(LOG_TAG, "Disregarding malformed Web content key binding: " + bindingString);
continue;
}
try {
long keyCodeAndModifiers = Long.decode(keyValueArray[0].trim());
String[] actionStrings = keyValueArray[1].split(":");
int[] actions = new int[actionStrings.length];
for (int i = 0, count = actions.length; i < count; i++) {
actions[i] = Integer.decode(actionStrings[i].trim());
}
sBindings.add(new AccessibilityWebContentKeyBinding(keyCodeAndModifiers, actions));
} catch (NumberFormatException nfe) {
Log.e(LOG_TAG, "Disregarding malformed key binding: " + bindingString);
}
}
}
Aggregations