diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index fcb919d0b..7dda0a652 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -488,6 +488,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/java/res/xml/keyboard_layout_set_arabic.xml b/java/res/xml/keyboard_layout_set_arabic.xml
index 10e95bd30..1bf8c6295 100644
--- a/java/res/xml/keyboard_layout_set_arabic.xml
+++ b/java/res/xml/keyboard_layout_set_arabic.xml
@@ -20,6 +20,8 @@
+
mKeyboardLayoutSetElementIdToParamsMap =
new SparseArray<>();
@@ -275,6 +278,10 @@ public final class KeyboardLayoutSet {
mParams.mDisableTouchPositionCorrectionDataForTest = true;
}
+ public void setScriptId(final int scriptId) {
+ mParams.mScriptId = scriptId;
+ }
+
public KeyboardLayoutSet build() {
if (mParams.mSubtype == null)
throw new RuntimeException("KeyboardLayoutSet subtype is not specified");
@@ -320,6 +327,8 @@ public final class KeyboardLayoutSet {
final String tag = parser.getName();
if (TAG_ELEMENT.equals(tag)) {
parseKeyboardLayoutSetElement(parser);
+ } else if (TAG_FEATURE.equals(tag)) {
+ parseKeyboardLayoutSetFeature(parser);
} else {
throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_KEYBOARD_SET);
}
@@ -361,6 +370,21 @@ public final class KeyboardLayoutSet {
}
}
+ private void parseKeyboardLayoutSetFeature(final XmlPullParser parser)
+ throws XmlPullParserException, IOException {
+ final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser),
+ R.styleable.KeyboardLayoutSet_Feature);
+ try {
+ final int scriptId = a.getInt(
+ R.styleable.KeyboardLayoutSet_Feature_supportedScript,
+ ScriptUtils.SCRIPT_LATIN);
+ XmlParseUtils.checkEndTag(TAG_FEATURE, parser);
+ setScriptId(scriptId);
+ } finally {
+ a.recycle();
+ }
+ }
+
private static int getKeyboardMode(final EditorInfo editorInfo) {
final int inputType = editorInfo.inputType;
final int variation = inputType & InputType.TYPE_MASK_VARIATION;
diff --git a/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java b/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java
index 4dfb38d80..00355c307 100644
--- a/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java
@@ -23,9 +23,12 @@ import java.util.TreeMap;
* A class to help with handling different writing scripts.
*/
public class ScriptUtils {
+ // TODO: should we use ISO 15924 identifiers instead?
public static final int SCRIPT_LATIN = 0;
public static final int SCRIPT_CYRILLIC = 1;
public static final int SCRIPT_GREEK = 2;
+ public static final int SCRIPT_ARABIC = 3;
+ public static final int SCRIPT_HEBREW = 4;
public static final TreeMap mLanguageToScript;
static {
// List of the supported languages and their associated script. We won't check