From fa7f08b37327c825baf0a6455d6f7fdf8b37da57 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 27 Dec 2012 14:48:47 +0900 Subject: Set default audio and haptic feedback settings - Default keypress volume is set to 0.2f in resource. - Default keypress vibration duration is set to 10 msec in resource. Bug: 7055329 Change-Id: I83bd6288d171d9787d52e2b02e4e5305f1435681 --- java/src/com/android/inputmethod/latin/StringUtils.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'java/src/com/android/inputmethod/latin/StringUtils.java') diff --git a/java/src/com/android/inputmethod/latin/StringUtils.java b/java/src/com/android/inputmethod/latin/StringUtils.java index 043043cef..ddaa5ff5b 100644 --- a/java/src/com/android/inputmethod/latin/StringUtils.java +++ b/java/src/com/android/inputmethod/latin/StringUtils.java @@ -61,6 +61,23 @@ public final class StringUtils { return TextUtils.join(",", result); } + /** + * Find a string that start with specified prefix from an array. + * + * @param prefix a prefix string to find. + * @param array an string array to be searched. + * @return the rest part of the string that starts with the prefix. + * Returns null if it couldn't be found. + */ + public static String findPrefixedString(final String prefix, final String[] array) { + for (final String element : array) { + if (element.startsWith(prefix)) { + return element.substring(prefix.length()); + } + } + return null; + } + /** * Remove duplicates from an array of strings. * -- cgit v1.2.3-83-g751a