am fd59cd80: am 26b07201: am 7c5cd5ec: [SD11] Add script checks for Myanmar, Sinhala, Thai and Telugu

* commit 'fd59cd804c6938611de13c72283d0b476410608e':
  [SD11] Add script checks for Myanmar, Sinhala, Thai and Telugu
main
Jean Chalard 2014-07-30 17:17:18 +00:00 committed by Android Git Automerger
commit e0698ef0a2
6 changed files with 33 additions and 0 deletions

View File

@ -490,6 +490,10 @@
<enum name="georgian" value="6" /> <enum name="georgian" value="6" />
<enum name="khmer" value="7" /> <enum name="khmer" value="7" />
<enum name="lao" value="8" /> <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> </attr>
</declare-styleable> </declare-styleable>

View File

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

View File

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

View File

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

View File

@ -20,6 +20,8 @@
<KeyboardLayoutSet <KeyboardLayoutSet
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"> xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
<Feature
latin:supportedScript="thai" />
<Element <Element
latin:elementName="alphabet" latin:elementName="alphabet"
latin:elementKeyboard="@xml/kbd_thai" 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_GEORGIAN = 6;
public static final int SCRIPT_KHMER = 7; public static final int SCRIPT_KHMER = 7;
public static final int SCRIPT_LAO = 8; 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; public static final TreeMap<String, Integer> mSpellCheckerLanguageToScript;
static { static {
// List of the supported languages and their associated script. We won't check // List of the supported languages and their associated script. We won't check
@ -132,6 +136,23 @@ public class ScriptUtils {
case SCRIPT_LAO: case SCRIPT_LAO:
// The Lao block is U+0E80..U+0EFF // The Lao block is U+0E80..U+0EFF
return (codePoint >= 0xE80 && codePoint <= 0xEFF); 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: case SCRIPT_UNKNOWN:
return true; return true;
default: default: