Skip to content
Snippets Groups Projects
Commit 5f6c303f authored by Jean Chalard's avatar Jean Chalard
Browse files

[HW2] Have a script for hardware keyboard

Change-Id: I3ee85867c529156374ecc17db3243a50912e760b
parent 87d907bd
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
}
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment