Add autoGenerateFromAlphabet enum to KeyboardSet.Element.elementKeyboard

This is the first step to support separate Keyboard for elementName.

Change-Id: Icef66564b6938910fa06ecab664dce4be84c9505
main
Tadashi G. Takaoka 2012-01-24 18:03:50 +09:00
parent 25971b5a14
commit b5b92f9b78
34 changed files with 143 additions and 134 deletions

View File

@ -345,20 +345,21 @@
<declare-styleable name="KeyboardSet_Element"> <declare-styleable name="KeyboardSet_Element">
<!-- This should be aligned with KeyboardId.ELEMENT_* --> <!-- This should be aligned with KeyboardId.ELEMENT_* -->
<attr name="elementName" format="enum"> <attr name="elementName" format="enum">
<enum name="alphabet" value="0" /> <enum name="alphabet" value="0" />
<!-- TODO: Implement alphabet variant shift keyboards <enum name="alphabetManualShifted" value="1" />
<enum name="alphabetManualTemporaryShift" value="1" /> <enum name="alphabetAutomaticShifted" value="2" />
<enum name="alphabetAutomaticTemporaryShift" value="2" /> <enum name="alphabetShiftLocked" value="3" />
<enum name="alphabetShiftLock" value="3" /> <enum name="alphabetShiftLockShifted" value="4" />
<enum name="alphabetShiftLockShift" value="4" /> <enum name="symbols" value="5" />
--> <enum name="symbolsShifted" value="6" />
<enum name="symbols" value="5" /> <enum name="phone" value="7" />
<enum name="symbolsShift" value="6" /> <enum name="phoneShifted" value="8" />
<enum name="phone" value="7" /> <enum name="number" value="9" />
<enum name="phoneShift" value="8" /> </attr>
<enum name="number" value="9" /> <attr name="elementKeyboard" format="reference|enum">
<!-- This should be aligned with KeyboardSet.ELEMENT_KEYBOARD_* -->
<enum name="autoGenerateFromAlphabet" value="1"/>
</attr> </attr>
<attr name="elementKeyboard" format="reference" />
<!-- TODO: Add setShifted and setShiftLocked attribute. --> <!-- TODO: Add setShifted and setShiftLocked attribute. -->
</declare-styleable> </declare-styleable>
</resources> </resources>

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -28,13 +28,13 @@
latin:elementName="symbols" latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" /> latin:elementKeyboard="@xml/kbd_symbols" />
<Element <Element
latin:elementName="symbolsShift" latin:elementName="symbolsShifted"
latin:elementKeyboard="@xml/kbd_symbols_shift" /> latin:elementKeyboard="@xml/kbd_symbols_shift" />
<Element <Element
latin:elementName="phone" latin:elementName="phone"
latin:elementKeyboard="@xml/kbd_phone" /> latin:elementKeyboard="@xml/kbd_phone" />
<Element <Element
latin:elementName="phoneShift" latin:elementName="phoneShifted"
latin:elementKeyboard="@xml/kbd_phone_shift" /> latin:elementKeyboard="@xml/kbd_phone_shift" />
<Element <Element
latin:elementName="number" latin:elementName="number"

View File

@ -39,16 +39,14 @@ public class KeyboardId {
public static final int MODE_NUMBER = 5; public static final int MODE_NUMBER = 5;
public static final int ELEMENT_ALPHABET = 0; public static final int ELEMENT_ALPHABET = 0;
/* TODO: Implement alphabet variant shift keyboard. public static final int ELEMENT_ALPHABET_MANUAL_SHIFTED = 1;
public static final int ELEMENT_ALPHABET_MANUAL_TEMPORARY_SHIFT = 1; public static final int ELEMENT_ALPHABET_AUTOMATIC_SHIFTED = 2;
public static final int ELEMENT_ALPHABET_AUTOMATIC_TEMPORARY_SHIFT = 2; public static final int ELEMENT_ALPHABET_SHIFT_LOCKED = 3;
public static final int ELEMENT_ALPHABET_SHIFT_LOCK = 3; public static final int ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED = 4;
public static final int ELEMENT_ALPHABET_SHIFT_LOCK_SHIFT = 4;
*/
public static final int ELEMENT_SYMBOLS = 5; public static final int ELEMENT_SYMBOLS = 5;
public static final int ELEMENT_SYMBOLS_SHIFT = 6; public static final int ELEMENT_SYMBOLS_SHIFTED = 6;
public static final int ELEMENT_PHONE = 7; public static final int ELEMENT_PHONE = 7;
public static final int ELEMENT_PHONE_SHIFT = 8; public static final int ELEMENT_PHONE_SHIFTED = 8;
public static final int ELEMENT_NUMBER = 9; public static final int ELEMENT_NUMBER = 9;
private static final int F2KEY_MODE_NONE = 0; private static final int F2KEY_MODE_NONE = 0;
@ -60,7 +58,7 @@ public class KeyboardId {
public final int mOrientation; public final int mOrientation;
public final int mWidth; public final int mWidth;
public final int mMode; public final int mMode;
public final int mElementState; public final int mElement;
private final int mInputType; private final int mInputType;
private final int mImeOptions; private final int mImeOptions;
private final boolean mSettingsKeyEnabled; private final boolean mSettingsKeyEnabled;
@ -70,14 +68,14 @@ public class KeyboardId {
private final int mHashCode; private final int mHashCode;
public KeyboardId(int elementState, Locale locale, int orientation, int width, int mode, public KeyboardId(int element, Locale locale, int orientation, int width, int mode,
int inputType, int imeOptions, boolean settingsKeyEnabled, boolean clobberSettingsKey, int inputType, int imeOptions, boolean settingsKeyEnabled, boolean clobberSettingsKey,
boolean shortcutKeyEnabled, boolean hasShortcutKey) { boolean shortcutKeyEnabled, boolean hasShortcutKey) {
this.mLocale = locale; this.mLocale = locale;
this.mOrientation = orientation; this.mOrientation = orientation;
this.mWidth = width; this.mWidth = width;
this.mMode = mode; this.mMode = mode;
this.mElementState = elementState; this.mElement = element;
this.mInputType = inputType; this.mInputType = inputType;
this.mImeOptions = imeOptions; this.mImeOptions = imeOptions;
this.mSettingsKeyEnabled = settingsKeyEnabled; this.mSettingsKeyEnabled = settingsKeyEnabled;
@ -91,7 +89,7 @@ public class KeyboardId {
private static int hashCode(KeyboardId id) { private static int hashCode(KeyboardId id) {
return Arrays.hashCode(new Object[] { return Arrays.hashCode(new Object[] {
id.mOrientation, id.mOrientation,
id.mElementState, id.mElement,
id.mMode, id.mMode,
id.mWidth, id.mWidth,
id.navigateAction(), id.navigateAction(),
@ -109,7 +107,7 @@ public class KeyboardId {
if (other == this) if (other == this)
return true; return true;
return other.mOrientation == this.mOrientation return other.mOrientation == this.mOrientation
&& other.mElementState == this.mElementState && other.mElement == this.mElement
&& other.mMode == this.mMode && other.mMode == this.mMode
&& other.mWidth == this.mWidth && other.mWidth == this.mWidth
&& other.navigateAction() == this.navigateAction() && other.navigateAction() == this.navigateAction()
@ -123,19 +121,19 @@ public class KeyboardId {
} }
public boolean isAlphabetKeyboard() { public boolean isAlphabetKeyboard() {
return mElementState < ELEMENT_SYMBOLS; return mElement < ELEMENT_SYMBOLS;
} }
public boolean isSymbolsKeyboard() { public boolean isSymbolsKeyboard() {
return mElementState == ELEMENT_SYMBOLS || mElementState == ELEMENT_SYMBOLS_SHIFT; return mElement == ELEMENT_SYMBOLS || mElement == ELEMENT_SYMBOLS_SHIFTED;
} }
public boolean isPhoneKeyboard() { public boolean isPhoneKeyboard() {
return mElementState == ELEMENT_PHONE || mElementState == ELEMENT_PHONE_SHIFT; return mElement == ELEMENT_PHONE || mElement == ELEMENT_PHONE_SHIFTED;
} }
public boolean isPhoneShiftKeyboard() { public boolean isPhoneShiftKeyboard() {
return mElementState == ELEMENT_PHONE_SHIFT; return mElement == ELEMENT_PHONE_SHIFTED;
} }
public boolean navigateAction() { public boolean navigateAction() {
@ -190,7 +188,7 @@ public class KeyboardId {
@Override @Override
public String toString() { public String toString() {
return String.format("[%s %s %s%d %s %s %s%s%s%s%s%s%s]", return String.format("[%s %s %s%d %s %s %s%s%s%s%s%s%s]",
elementStateToString(mElementState), elementToString(mElement),
mLocale, mLocale,
(mOrientation == 1 ? "port" : "land"), mWidth, (mOrientation == 1 ? "port" : "land"), mWidth,
modeName(mMode), modeName(mMode),
@ -213,19 +211,17 @@ public class KeyboardId {
&& TextUtils.equals(a.privateImeOptions, b.privateImeOptions); && TextUtils.equals(a.privateImeOptions, b.privateImeOptions);
} }
public static String elementStateToString(int elementState) { public static String elementToString(int element) {
switch (elementState) { switch (element) {
case ELEMENT_ALPHABET: return "alphabet"; case ELEMENT_ALPHABET: return "alphabet";
/* TODO: Implement alphabet variant shift keyboard. case ELEMENT_ALPHABET_MANUAL_SHIFTED: return "alphabetManualShifted";
case ELEMENT_ALPHABET_MANUAL_TEMPORARY_SHIFT: return "alphabetManualTemporaryShift"; case ELEMENT_ALPHABET_AUTOMATIC_SHIFTED: return "alphabetAutomaticShifted";
case ELEMENT_ALPHABET_AUTOMATIC_TEMPORARY_SHIFT: return "alphabetAutomaticTemporaryShift"; case ELEMENT_ALPHABET_SHIFT_LOCKED: return "alphabetShiftLocked";
case ELEMENT_ALPHABET_SHIFT_LOCK: return "alphabetShiftLock"; case ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED: return "alphabetShiftLockShifted";
case ELEMENT_ALPHABET_SHIFT_LOCK_SHIFT: return "alphabetShiftLockShift";
*/
case ELEMENT_SYMBOLS: return "symbols"; case ELEMENT_SYMBOLS: return "symbols";
case ELEMENT_SYMBOLS_SHIFT: return "symbolsShift"; case ELEMENT_SYMBOLS_SHIFTED: return "symbolsShifted";
case ELEMENT_PHONE: return "phone"; case ELEMENT_PHONE: return "phone";
case ELEMENT_PHONE_SHIFT: return "phoneShift"; case ELEMENT_PHONE_SHIFTED: return "phoneShifted";
case ELEMENT_NUMBER: return "number"; case ELEMENT_NUMBER: return "number";
default: return null; default: return null;
} }

View File

@ -22,6 +22,7 @@ import android.content.res.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.content.res.XmlResourceParser; import android.content.res.XmlResourceParser;
import android.util.Log; import android.util.Log;
import android.util.TypedValue;
import android.util.Xml; import android.util.Xml;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
@ -54,10 +55,12 @@ public class KeyboardSet {
private static final String TAG_KEYBOARD_SET = TAG; private static final String TAG_KEYBOARD_SET = TAG;
private static final String TAG_ELEMENT = "Element"; private static final String TAG_ELEMENT = "Element";
private static final int ELEMENT_KEYBOARD_AUTO_GENERATE_FROM_ALPHABET = 1;
private final Context mContext; private final Context mContext;
private final Params mParams; private final Params mParams;
private static class Params { static class Params {
int mMode; int mMode;
int mInputType; int mInputType;
int mImeOptions; int mImeOptions;
@ -104,16 +107,18 @@ public class KeyboardSet {
} }
private Keyboard getKeyboard(boolean isSymbols, boolean isShift) { private Keyboard getKeyboard(boolean isSymbols, boolean isShift) {
final int elementState = Builder.getElementState(mParams.mMode, isSymbols, isShift); final int element = KeyboardSet.getElement(mParams.mMode, isSymbols, isShift);
final int xmlId = mParams.mElementKeyboards.get(elementState); // TODO: If xmlId is ELEMENT_KEYBOARD_AUTO_GENERATE_FROM_ALPHABET, auto generate the
final KeyboardId id = Builder.getKeyboardId(elementState, isSymbols, mParams); // keyboard based on base main alphabet keyboard considering element.
final int xmlId = mParams.mElementKeyboards.get(element);
final KeyboardId id = KeyboardSet.getKeyboardId(element, isSymbols, mParams);
final Keyboard keyboard = getKeyboard(mContext, xmlId, id); final Keyboard keyboard = getKeyboard(mContext, xmlId, id);
return keyboard; return keyboard;
} }
public KeyboardId getMainKeyboardId() { public KeyboardId getMainKeyboardId() {
final int elementState = Builder.getElementState(mParams.mMode, false, false); final int element = KeyboardSet.getElement(mParams.mMode, false, false);
return Builder.getKeyboardId(elementState, false, mParams); return KeyboardSet.getKeyboardId(element, false, mParams);
} }
private Keyboard getKeyboard(Context context, int xmlId, KeyboardId id) { private Keyboard getKeyboard(Context context, int xmlId, KeyboardId id) {
@ -147,6 +152,30 @@ public class KeyboardSet {
return keyboard; return keyboard;
} }
private static int getElement(int mode, boolean isSymbols, boolean isShift) {
switch (mode) {
case KeyboardId.MODE_PHONE:
return (isSymbols && isShift)
? KeyboardId.ELEMENT_PHONE_SHIFTED : KeyboardId.ELEMENT_PHONE;
case KeyboardId.MODE_NUMBER:
return KeyboardId.ELEMENT_NUMBER;
default:
if (isSymbols) {
return isShift
? KeyboardId.ELEMENT_SYMBOLS_SHIFTED : KeyboardId.ELEMENT_SYMBOLS;
}
return KeyboardId.ELEMENT_ALPHABET;
}
}
private static KeyboardId getKeyboardId(int element, boolean isSymbols, Params params) {
final boolean hasShortcutKey = params.mVoiceKeyEnabled
&& (isSymbols != params.mVoiceKeyOnMain);
return new KeyboardId(element, params.mLocale, params.mOrientation, params.mWidth,
params.mMode, params.mInputType, params.mImeOptions, params.mSettingsKeyEnabled,
params.mNoSettingsKey, params.mVoiceKeyEnabled, hasShortcutKey);
}
public static class Builder { public static class Builder {
private final Context mContext; private final Context mContext;
private final String mPackageName; private final String mPackageName;
@ -218,31 +247,6 @@ public class KeyboardSet {
return new KeyboardSet(mContext, mParams); return new KeyboardSet(mContext, mParams);
} }
// TODO: Move this method to KeyboardSet
static KeyboardId getKeyboardId(int elementState, boolean isSymbols, Params params) {
final boolean hasShortcutKey = params.mVoiceKeyEnabled
&& (isSymbols != params.mVoiceKeyOnMain);
return new KeyboardId(elementState, params.mLocale, params.mOrientation, params.mWidth,
params.mMode, params.mInputType, params.mImeOptions, params.mSettingsKeyEnabled,
params.mNoSettingsKey, params.mVoiceKeyEnabled, hasShortcutKey);
}
// TODO: Move this method to KeyboardSet
static int getElementState(int mode, boolean isSymbols, boolean isShift) {
switch (mode) {
case KeyboardId.MODE_PHONE:
return (isSymbols && isShift)
? KeyboardId.ELEMENT_PHONE_SHIFT : KeyboardId.ELEMENT_PHONE;
case KeyboardId.MODE_NUMBER:
return KeyboardId.ELEMENT_NUMBER;
default:
if (isSymbols) {
return isShift ? KeyboardId.ELEMENT_SYMBOLS_SHIFT : KeyboardId.ELEMENT_SYMBOLS;
}
return KeyboardId.ELEMENT_ALPHABET;
}
}
private void parseKeyboardSet(Resources res, int resId) throws XmlPullParserException, private void parseKeyboardSet(Resources res, int resId) throws XmlPullParserException,
IOException { IOException {
final XmlResourceParser parser = res.getXml(resId); final XmlResourceParser parser = res.getXml(resId);
@ -300,8 +304,14 @@ public class KeyboardSet {
final int elementName = a.getInt( final int elementName = a.getInt(
R.styleable.KeyboardSet_Element_elementName, 0); R.styleable.KeyboardSet_Element_elementName, 0);
final int elementKeyboard = a.getResourceId( final int index = R.styleable.KeyboardSet_Element_elementKeyboard;
R.styleable.KeyboardSet_Element_elementKeyboard, 0); final TypedValue v = a.peekValue(index);
final int elementKeyboard;
if (v.type == TypedValue.TYPE_REFERENCE) {
elementKeyboard = a.getResourceId(index, 0);
} else {
elementKeyboard = a.getInt(index, 0);
}
mParams.mElementKeyboards.put(elementName, elementKeyboard); mParams.mElementKeyboards.put(elementName, elementKeyboard);
} finally { } finally {
a.recycle(); a.recycle();

View File

@ -43,6 +43,8 @@ public class KeyboardState {
public void setAlphabetManualShiftedKeyboard(); public void setAlphabetManualShiftedKeyboard();
public void setAlphabetAutomaticShiftedKeyboard(); public void setAlphabetAutomaticShiftedKeyboard();
public void setAlphabetShiftLockedKeyboard(); public void setAlphabetShiftLockedKeyboard();
// TODO: Add this.
//public void setAlphabetShiftLockShiftedKeyboard();
public void setSymbolsKeyboard(); public void setSymbolsKeyboard();
public void setSymbolsShiftedKeyboard(); public void setSymbolsShiftedKeyboard();