[SD11] Add script checks for Myanmar, Sinhala, Thai and Telugu

Bug: 15840116
Change-Id: I1264fdeea0d4739ca0f360f4934d06e5a824d4e5
main
Jean Chalard 2014-07-30 12:31:29 +09:00
parent 0304c77750
commit 7c5cd5ec89
6 changed files with 33 additions and 0 deletions

View File

@ -490,6 +490,10 @@
<enum name="georgian" value="6" />
<enum name="khmer" value="7" />
<enum name="lao" value="8" />
<enum name="myanmar" value="9" />
<enum name="sinhala" value="10" />
<enum name="thai" value="11" />
<enum name="telugu" value="12" />
</attr>
</declare-styleable>

View File

@ -20,6 +20,8 @@
<KeyboardLayoutSet
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
<Feature
latin:supportedScript="myanmar" />
<Element
latin:elementName="alphabet"
latin:elementKeyboard="@xml/kbd_myanmar"

View File

@ -20,6 +20,8 @@
<KeyboardLayoutSet
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
<Feature
latin:supportedScript="sinhala" />
<Element
latin:elementName="alphabet"
latin:elementKeyboard="@xml/kbd_sinhala"

View File

@ -20,6 +20,8 @@
<KeyboardLayoutSet
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
<Feature
latin:supportedScript="telugu" />
<Element
latin:elementName="alphabet"
latin:elementKeyboard="@xml/kbd_telugu"

View File

@ -20,6 +20,8 @@
<KeyboardLayoutSet
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
<Feature
latin:supportedScript="thai" />
<Element
latin:elementName="alphabet"
latin:elementKeyboard="@xml/kbd_thai"

View File

@ -35,6 +35,10 @@ public class ScriptUtils {
public static final int SCRIPT_GEORGIAN = 6;
public static final int SCRIPT_KHMER = 7;
public static final int SCRIPT_LAO = 8;
public static final int SCRIPT_MYANMAR = 9;
public static final int SCRIPT_SINHALA = 10;
public static final int SCRIPT_THAI = 11;
public static final int SCRIPT_TELUGU = 12;
public static final TreeMap<String, Integer> mSpellCheckerLanguageToScript;
static {
// List of the supported languages and their associated script. We won't check
@ -132,6 +136,23 @@ public class ScriptUtils {
case SCRIPT_LAO:
// The Lao block is U+0E80..U+0EFF
return (codePoint >= 0xE80 && codePoint <= 0xEFF);
case SCRIPT_MYANMAR:
// Myanmar has three unicode blocks :
// Myanmar U+1000..U+109F
// Myanmar extended-A U+AA60..U+AA7F
// Myanmar extended-B U+A9E0..U+A9FF
return (codePoint >= 0x1000 && codePoint <= 0x109F
|| codePoint >= 0xAA60 && codePoint <= 0xAA7F
|| codePoint >= 0xA9E0 && codePoint <= 0xA9FF);
case SCRIPT_SINHALA:
// Sinhala unicode block is U+0D80..U+0DFF
return (codePoint >= 0xD80 && codePoint <= 0xDFF);
case SCRIPT_THAI:
// Thai unicode block is U+0E00..U+0E7F
return (codePoint >= 0xE00 && codePoint <= 0xE7F);
case SCRIPT_TELUGU:
// Telugu unicode block is U+0C00..U+0C7F
return (codePoint >= 0xC00 && codePoint <= 0xC7F);
case SCRIPT_UNKNOWN:
return true;
default: