Merge "[HW2] Have a script for hardware keyboard"
commit
3afbac8cb7
|
@ -39,6 +39,7 @@ import com.android.inputmethod.latin.SubtypeSwitcher;
|
||||||
import com.android.inputmethod.latin.WordComposer;
|
import com.android.inputmethod.latin.WordComposer;
|
||||||
import com.android.inputmethod.latin.settings.SettingsValues;
|
import com.android.inputmethod.latin.settings.SettingsValues;
|
||||||
import com.android.inputmethod.latin.utils.ResourceUtils;
|
import com.android.inputmethod.latin.utils.ResourceUtils;
|
||||||
|
import com.android.inputmethod.latin.utils.ScriptUtils;
|
||||||
|
|
||||||
public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
private static final String TAG = KeyboardSwitcher.class.getSimpleName();
|
private static final String TAG = KeyboardSwitcher.class.getSimpleName();
|
||||||
|
@ -372,6 +373,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentKeyboardScriptId() {
|
public int getCurrentKeyboardScriptId() {
|
||||||
|
if (null == mKeyboardLayoutSet) {
|
||||||
|
return ScriptUtils.SCRIPT_UNKNOWN;
|
||||||
|
}
|
||||||
return mKeyboardLayoutSet.getScriptId();
|
return mKeyboardLayoutSet.getScriptId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ import java.util.TreeMap;
|
||||||
* A class to help with handling different writing scripts.
|
* A class to help with handling different writing scripts.
|
||||||
*/
|
*/
|
||||||
public class ScriptUtils {
|
public class ScriptUtils {
|
||||||
|
// Used for hardware keyboards
|
||||||
|
public static final int SCRIPT_UNKNOWN = -1;
|
||||||
// TODO: should we use ISO 15924 identifiers instead?
|
// TODO: should we use ISO 15924 identifiers instead?
|
||||||
public static final int SCRIPT_LATIN = 0;
|
public static final int SCRIPT_LATIN = 0;
|
||||||
public static final int SCRIPT_CYRILLIC = 1;
|
public static final int SCRIPT_CYRILLIC = 1;
|
||||||
|
@ -89,6 +91,8 @@ public class ScriptUtils {
|
||||||
return (codePoint >= 0x370 && codePoint <= 0x3FF)
|
return (codePoint >= 0x370 && codePoint <= 0x3FF)
|
||||||
|| (codePoint >= 0x1F00 && codePoint <= 0x1FFF)
|
|| (codePoint >= 0x1F00 && codePoint <= 0x1FFF)
|
||||||
|| codePoint == 0xF2;
|
|| codePoint == 0xF2;
|
||||||
|
case SCRIPT_UNKNOWN:
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
// Should never come here
|
// Should never come here
|
||||||
throw new RuntimeException("Impossible value of script: " + script);
|
throw new RuntimeException("Impossible value of script: " + script);
|
||||||
|
|
Loading…
Reference in New Issue