Merge "Read shortcuts as strings in the dictionary."
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 6ada090..950b5e9 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -1229,7 +1229,7 @@
private void endRow(Row row) {
if (mCurrentRow == null)
- throw new InflateException("orphant end row tag");
+ throw new InflateException("orphan end row tag");
if (mRightEdgeKey != null) {
mRightEdgeKey.markAsRightEdge(mParams);
mRightEdgeKey = null;
diff --git a/java/src/com/android/inputmethod/latin/StringUtils.java b/java/src/com/android/inputmethod/latin/StringUtils.java
index 42fce53..649cd65 100644
--- a/java/src/com/android/inputmethod/latin/StringUtils.java
+++ b/java/src/com/android/inputmethod/latin/StringUtils.java
@@ -46,7 +46,7 @@
return text.codePointCount(0, text.length());
}
- public static boolean containsInCsv(String key, String csv) {
+ private static boolean containsInCsv(String key, String csv) {
if (csv == null)
return false;
for (String option : csv.split(",")) {
@@ -129,7 +129,7 @@
/**
* Remove duplicates from an array of strings.
*
- * This method will always keep the first occurence of all strings at their position
+ * This method will always keep the first occurrence of all strings at their position
* in the array, removing the subsequent ones.
*/
public static void removeDupes(final ArrayList<CharSequence> suggestions) {
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index dfb01a2..6612c24 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -18,11 +18,9 @@
import android.content.Context;
import android.content.Intent;
-import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
@@ -291,45 +289,6 @@
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
- public Drawable getShortcutIcon() {
- return getSubtypeIcon(mShortcutInputMethodInfo, mShortcutSubtype);
- }
-
- private Drawable getSubtypeIcon(InputMethodInfo imi, InputMethodSubtype subtype) {
- final PackageManager pm = mService.getPackageManager();
- if (imi != null) {
- final String imiPackageName = imi.getPackageName();
- if (DBG) {
- Log.d(TAG, "Update icons of IME: " + imiPackageName + ","
- + KeyboardLayoutSet.getKeyboardLayoutSetLocaleString(subtype) + ","
- + subtype.getMode());
- }
- if (subtype != null) {
- return pm.getDrawable(imiPackageName, subtype.getIconResId(),
- imi.getServiceInfo().applicationInfo);
- } else if (imi.getSubtypeCount() > 0 && imi.getSubtypeAt(0) != null) {
- return pm.getDrawable(imiPackageName,
- imi.getSubtypeAt(0).getIconResId(),
- imi.getServiceInfo().applicationInfo);
- } else {
- try {
- return pm.getApplicationInfo(imiPackageName, 0).loadIcon(pm);
- } catch (PackageManager.NameNotFoundException e) {
- Log.w(TAG, "IME can't be found: " + imiPackageName);
- }
- }
- }
- return null;
- }
-
- private static boolean contains(String[] hay, String needle) {
- for (String element : hay) {
- if (element.equals(needle))
- return true;
- }
- return false;
- }
-
public boolean isShortcutImeEnabled() {
if (mShortcutInputMethodInfo == null) {
return false;
@@ -352,7 +311,7 @@
return false;
if (mShortcutSubtype == null)
return true;
- if (contains(mShortcutSubtype.getExtraValue().split(","),
+ if (mShortcutSubtype.containsExtraValueKey(
SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY)) {
return mIsNetworkConnected;
}