diff options
author | 2014-07-01 05:45:35 +0000 | |
---|---|---|
committer | 2014-06-26 23:14:58 +0000 | |
commit | 3afbac8cb77bbe0ca8c4d54ad70489194349262e (patch) | |
tree | 5c87a14888ca8e4cd830fe739f3ae9172feb004e /java/src | |
parent | 20c89b1cf5e30026844922d312163ffcd1c20b26 (diff) | |
parent | 5f6c303f0ba70c0bcfd73d06b63f0175669dafc1 (diff) | |
download | latinime-3afbac8cb77bbe0ca8c4d54ad70489194349262e.tar.gz latinime-3afbac8cb77bbe0ca8c4d54ad70489194349262e.tar.xz latinime-3afbac8cb77bbe0ca8c4d54ad70489194349262e.zip |
Merge "[HW2] Have a script for hardware keyboard"
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/utils/ScriptUtils.java | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index dd71e9d4f..f35126750 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -39,6 +39,7 @@ import com.android.inputmethod.latin.SubtypeSwitcher; import com.android.inputmethod.latin.WordComposer; import com.android.inputmethod.latin.settings.SettingsValues; import com.android.inputmethod.latin.utils.ResourceUtils; +import com.android.inputmethod.latin.utils.ScriptUtils; public final class KeyboardSwitcher implements KeyboardState.SwitchActions { private static final String TAG = KeyboardSwitcher.class.getSimpleName(); @@ -372,6 +373,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { } public int getCurrentKeyboardScriptId() { + if (null == mKeyboardLayoutSet) { + return ScriptUtils.SCRIPT_UNKNOWN; + } return mKeyboardLayoutSet.getScriptId(); } } diff --git a/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java b/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java index 00355c307..9ab7c7778 100644 --- a/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java @@ -23,6 +23,8 @@ import java.util.TreeMap; * A class to help with handling different writing scripts. */ public class ScriptUtils { + // Used for hardware keyboards + public static final int SCRIPT_UNKNOWN = -1; // TODO: should we use ISO 15924 identifiers instead? public static final int SCRIPT_LATIN = 0; public static final int SCRIPT_CYRILLIC = 1; @@ -89,6 +91,8 @@ public class ScriptUtils { return (codePoint >= 0x370 && codePoint <= 0x3FF) || (codePoint >= 0x1F00 && codePoint <= 0x1FFF) || codePoint == 0xF2; + case SCRIPT_UNKNOWN: + return true; default: // Should never come here throw new RuntimeException("Impossible value of script: " + script); |