Add autoGenerateFromAlphabet enum to KeyboardSet.Element.elementKeyboard
This is the first step to support separate Keyboard for elementName. This change is the second attempt of Icef66564. Change-Id: I78ea6cb9ea3d965ff89e0ff5d896a6b11ba5c670main
parent
af4efd5a3e
commit
117c124c13
|
@ -345,20 +345,19 @@
|
|||
<declare-styleable name="KeyboardSet_Element">
|
||||
<!-- This should be aligned with KeyboardId.ELEMENT_* -->
|
||||
<attr name="elementName" format="enum">
|
||||
<enum name="alphabet" value="0" />
|
||||
<!-- TODO: Implement alphabet variant shift keyboards
|
||||
<enum name="alphabetManualTemporaryShift" value="1" />
|
||||
<enum name="alphabetAutomaticTemporaryShift" value="2" />
|
||||
<enum name="alphabetShiftLock" value="3" />
|
||||
<enum name="alphabetShiftLockShift" value="4" />
|
||||
-->
|
||||
<enum name="symbols" value="5" />
|
||||
<enum name="symbolsShift" value="6" />
|
||||
<enum name="phone" value="7" />
|
||||
<enum name="phoneShift" value="8" />
|
||||
<enum name="number" value="9" />
|
||||
<enum name="alphabet" value="0" />
|
||||
<enum name="alphabetManualShifted" value="1" />
|
||||
<enum name="alphabetAutomaticShifted" value="2" />
|
||||
<enum name="alphabetShiftLocked" value="3" />
|
||||
<enum name="alphabetShiftLockShifted" value="4" />
|
||||
<enum name="symbols" value="5" />
|
||||
<enum name="symbolsShifted" value="6" />
|
||||
<enum name="phone" value="7" />
|
||||
<enum name="phoneShifted" value="8" />
|
||||
<enum name="number" value="9" />
|
||||
</attr>
|
||||
<attr name="elementKeyboard" format="reference" />
|
||||
<attr name="elementKeyboard" format="reference"/>
|
||||
<attr name="elementAutoGenerate" format="boolean" />
|
||||
<!-- TODO: Add setShifted and setShiftLocked attribute. -->
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -24,17 +24,33 @@
|
|||
<Element
|
||||
latin:elementName="alphabet"
|
||||
latin:elementKeyboard="@xml/kbd_qwerty" />
|
||||
<Element
|
||||
latin:elementName="alphabetManualShifted"
|
||||
latin:elementKeyboard="@xml/kbd_qwerty"
|
||||
latin:elementAutoGenerate="true" />
|
||||
<Element
|
||||
latin:elementName="alphabetAutomaticShifted"
|
||||
latin:elementKeyboard="@xml/kbd_qwerty"
|
||||
latin:elementAutoGenerate="true" />
|
||||
<Element
|
||||
latin:elementName="alphabetShiftLocked"
|
||||
latin:elementKeyboard="@xml/kbd_qwerty"
|
||||
latin:elementAutoGenerate="true" />
|
||||
<Element
|
||||
latin:elementName="alphabetShiftLockShifted"
|
||||
latin:elementKeyboard="@xml/kbd_qwerty"
|
||||
latin:elementAutoGenerate="true" />
|
||||
<Element
|
||||
latin:elementName="symbols"
|
||||
latin:elementKeyboard="@xml/kbd_symbols" />
|
||||
<Element
|
||||
latin:elementName="symbolsShift"
|
||||
latin:elementName="symbolsShifted"
|
||||
latin:elementKeyboard="@xml/kbd_symbols_shift" />
|
||||
<Element
|
||||
latin:elementName="phone"
|
||||
latin:elementKeyboard="@xml/kbd_phone" />
|
||||
<Element
|
||||
latin:elementName="phoneShift"
|
||||
latin:elementName="phoneShifted"
|
||||
latin:elementKeyboard="@xml/kbd_phone_shift" />
|
||||
<Element
|
||||
latin:elementName="number"
|
||||
|
|
|
@ -39,16 +39,14 @@ public class KeyboardId {
|
|||
public static final int MODE_NUMBER = 5;
|
||||
|
||||
public static final int ELEMENT_ALPHABET = 0;
|
||||
/* TODO: Implement alphabet variant shift keyboard.
|
||||
public static final int ELEMENT_ALPHABET_MANUAL_TEMPORARY_SHIFT = 1;
|
||||
public static final int ELEMENT_ALPHABET_AUTOMATIC_TEMPORARY_SHIFT = 2;
|
||||
public static final int ELEMENT_ALPHABET_SHIFT_LOCK = 3;
|
||||
public static final int ELEMENT_ALPHABET_SHIFT_LOCK_SHIFT = 4;
|
||||
*/
|
||||
public static final int ELEMENT_ALPHABET_MANUAL_SHIFTED = 1;
|
||||
public static final int ELEMENT_ALPHABET_AUTOMATIC_SHIFTED = 2;
|
||||
public static final int ELEMENT_ALPHABET_SHIFT_LOCKED = 3;
|
||||
public static final int ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED = 4;
|
||||
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_SHIFT = 8;
|
||||
public static final int ELEMENT_PHONE_SHIFTED = 8;
|
||||
public static final int ELEMENT_NUMBER = 9;
|
||||
|
||||
private static final int F2KEY_MODE_NONE = 0;
|
||||
|
@ -60,7 +58,7 @@ public class KeyboardId {
|
|||
public final int mOrientation;
|
||||
public final int mWidth;
|
||||
public final int mMode;
|
||||
public final int mElementState;
|
||||
public final int mElementId;
|
||||
private final int mInputType;
|
||||
private final int mImeOptions;
|
||||
private final boolean mSettingsKeyEnabled;
|
||||
|
@ -70,14 +68,14 @@ public class KeyboardId {
|
|||
|
||||
private final int mHashCode;
|
||||
|
||||
public KeyboardId(int elementState, Locale locale, int orientation, int width, int mode,
|
||||
public KeyboardId(int elementId, Locale locale, int orientation, int width, int mode,
|
||||
int inputType, int imeOptions, boolean settingsKeyEnabled, boolean clobberSettingsKey,
|
||||
boolean shortcutKeyEnabled, boolean hasShortcutKey) {
|
||||
this.mLocale = locale;
|
||||
this.mOrientation = orientation;
|
||||
this.mWidth = width;
|
||||
this.mMode = mode;
|
||||
this.mElementState = elementState;
|
||||
this.mElementId = elementId;
|
||||
this.mInputType = inputType;
|
||||
this.mImeOptions = imeOptions;
|
||||
this.mSettingsKeyEnabled = settingsKeyEnabled;
|
||||
|
@ -91,7 +89,7 @@ public class KeyboardId {
|
|||
private static int hashCode(KeyboardId id) {
|
||||
return Arrays.hashCode(new Object[] {
|
||||
id.mOrientation,
|
||||
id.mElementState,
|
||||
id.mElementId,
|
||||
id.mMode,
|
||||
id.mWidth,
|
||||
id.navigateAction(),
|
||||
|
@ -109,7 +107,7 @@ public class KeyboardId {
|
|||
if (other == this)
|
||||
return true;
|
||||
return other.mOrientation == this.mOrientation
|
||||
&& other.mElementState == this.mElementState
|
||||
&& other.mElementId == this.mElementId
|
||||
&& other.mMode == this.mMode
|
||||
&& other.mWidth == this.mWidth
|
||||
&& other.navigateAction() == this.navigateAction()
|
||||
|
@ -123,19 +121,19 @@ public class KeyboardId {
|
|||
}
|
||||
|
||||
public boolean isAlphabetKeyboard() {
|
||||
return mElementState < ELEMENT_SYMBOLS;
|
||||
return mElementId < ELEMENT_SYMBOLS;
|
||||
}
|
||||
|
||||
public boolean isSymbolsKeyboard() {
|
||||
return mElementState == ELEMENT_SYMBOLS || mElementState == ELEMENT_SYMBOLS_SHIFT;
|
||||
return mElementId == ELEMENT_SYMBOLS || mElementId == ELEMENT_SYMBOLS_SHIFTED;
|
||||
}
|
||||
|
||||
public boolean isPhoneKeyboard() {
|
||||
return mElementState == ELEMENT_PHONE || mElementState == ELEMENT_PHONE_SHIFT;
|
||||
return mElementId == ELEMENT_PHONE || mElementId == ELEMENT_PHONE_SHIFTED;
|
||||
}
|
||||
|
||||
public boolean isPhoneShiftKeyboard() {
|
||||
return mElementState == ELEMENT_PHONE_SHIFT;
|
||||
return mElementId == ELEMENT_PHONE_SHIFTED;
|
||||
}
|
||||
|
||||
public boolean navigateAction() {
|
||||
|
@ -190,7 +188,7 @@ public class KeyboardId {
|
|||
@Override
|
||||
public String toString() {
|
||||
return String.format("[%s %s %s%d %s %s %s%s%s%s%s%s%s]",
|
||||
elementStateToString(mElementState),
|
||||
elementIdToName(mElementId),
|
||||
mLocale,
|
||||
(mOrientation == 1 ? "port" : "land"), mWidth,
|
||||
modeName(mMode),
|
||||
|
@ -213,19 +211,17 @@ public class KeyboardId {
|
|||
&& TextUtils.equals(a.privateImeOptions, b.privateImeOptions);
|
||||
}
|
||||
|
||||
public static String elementStateToString(int elementState) {
|
||||
switch (elementState) {
|
||||
public static String elementIdToName(int elementId) {
|
||||
switch (elementId) {
|
||||
case ELEMENT_ALPHABET: return "alphabet";
|
||||
/* TODO: Implement alphabet variant shift keyboard.
|
||||
case ELEMENT_ALPHABET_MANUAL_TEMPORARY_SHIFT: return "alphabetManualTemporaryShift";
|
||||
case ELEMENT_ALPHABET_AUTOMATIC_TEMPORARY_SHIFT: return "alphabetAutomaticTemporaryShift";
|
||||
case ELEMENT_ALPHABET_SHIFT_LOCK: return "alphabetShiftLock";
|
||||
case ELEMENT_ALPHABET_SHIFT_LOCK_SHIFT: return "alphabetShiftLockShift";
|
||||
*/
|
||||
case ELEMENT_ALPHABET_MANUAL_SHIFTED: return "alphabetManualShifted";
|
||||
case ELEMENT_ALPHABET_AUTOMATIC_SHIFTED: return "alphabetAutomaticShifted";
|
||||
case ELEMENT_ALPHABET_SHIFT_LOCKED: return "alphabetShiftLocked";
|
||||
case ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED: return "alphabetShiftLockShifted";
|
||||
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_SHIFT: return "phoneShift";
|
||||
case ELEMENT_PHONE_SHIFTED: return "phoneShifted";
|
||||
case ELEMENT_NUMBER: return "number";
|
||||
default: return null;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import java.io.IOException;
|
|||
import java.lang.ref.SoftReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class represents a set of keyboards. Each of them represents a different keyboard
|
||||
|
@ -57,7 +58,18 @@ public class KeyboardSet {
|
|||
private final Context mContext;
|
||||
private final Params mParams;
|
||||
|
||||
private static class Params {
|
||||
static class KeyboardElement {
|
||||
final int mElementId;
|
||||
final int mLayoutId;
|
||||
final boolean mAutoGenerate;
|
||||
KeyboardElement(int elementId, int layoutId, boolean autoGenerate) {
|
||||
mElementId = elementId;
|
||||
mLayoutId = layoutId;
|
||||
mAutoGenerate = autoGenerate;
|
||||
}
|
||||
}
|
||||
|
||||
static class Params {
|
||||
int mMode;
|
||||
int mInputType;
|
||||
int mImeOptions;
|
||||
|
@ -69,7 +81,8 @@ public class KeyboardSet {
|
|||
Locale mLocale;
|
||||
int mOrientation;
|
||||
int mWidth;
|
||||
final HashMap<Integer, Integer> mElementKeyboards = new HashMap<Integer, Integer>();
|
||||
final Map<Integer, KeyboardElement> mElementKeyboards =
|
||||
new HashMap<Integer, KeyboardElement>();
|
||||
Params() {}
|
||||
}
|
||||
|
||||
|
@ -104,16 +117,18 @@ public class KeyboardSet {
|
|||
}
|
||||
|
||||
private Keyboard getKeyboard(boolean isSymbols, boolean isShift) {
|
||||
final int elementState = Builder.getElementState(mParams.mMode, isSymbols, isShift);
|
||||
final int xmlId = mParams.mElementKeyboards.get(elementState);
|
||||
final KeyboardId id = Builder.getKeyboardId(elementState, isSymbols, mParams);
|
||||
final Keyboard keyboard = getKeyboard(mContext, xmlId, id);
|
||||
final int elementId = KeyboardSet.getElementId(mParams.mMode, isSymbols, isShift);
|
||||
final KeyboardElement keyboardElement = mParams.mElementKeyboards.get(elementId);
|
||||
// TODO: If keyboardElement.mAutoGenerate is true, the keyboard will be auto generated
|
||||
// based on keyboardElement.mKayoutId Keyboard XML definition.
|
||||
final KeyboardId id = KeyboardSet.getKeyboardId(elementId, isSymbols, mParams);
|
||||
final Keyboard keyboard = getKeyboard(mContext, keyboardElement.mLayoutId, id);
|
||||
return keyboard;
|
||||
}
|
||||
|
||||
public KeyboardId getMainKeyboardId() {
|
||||
final int elementState = Builder.getElementState(mParams.mMode, false, false);
|
||||
return Builder.getKeyboardId(elementState, false, mParams);
|
||||
final int elementId = KeyboardSet.getElementId(mParams.mMode, false, false);
|
||||
return KeyboardSet.getKeyboardId(elementId, false, mParams);
|
||||
}
|
||||
|
||||
private Keyboard getKeyboard(Context context, int xmlId, KeyboardId id) {
|
||||
|
@ -147,6 +162,30 @@ public class KeyboardSet {
|
|||
return keyboard;
|
||||
}
|
||||
|
||||
private static int getElementId(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 elementId, boolean isSymbols, Params params) {
|
||||
final boolean hasShortcutKey = params.mVoiceKeyEnabled
|
||||
&& (isSymbols != params.mVoiceKeyOnMain);
|
||||
return new KeyboardId(elementId, params.mLocale, params.mOrientation, params.mWidth,
|
||||
params.mMode, params.mInputType, params.mImeOptions, params.mSettingsKeyEnabled,
|
||||
params.mNoSettingsKey, params.mVoiceKeyEnabled, hasShortcutKey);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final Context mContext;
|
||||
private final String mPackageName;
|
||||
|
@ -211,38 +250,15 @@ public class KeyboardSet {
|
|||
try {
|
||||
parseKeyboardSet(mResources, R.xml.keyboard_set);
|
||||
} catch (Exception e) {
|
||||
//
|
||||
throw new RuntimeException(e.getMessage() + " in "
|
||||
+ mResources.getResourceName(R.xml.keyboard_set)
|
||||
+ " of locale " + mParams.mLocale);
|
||||
} finally {
|
||||
LocaleUtils.setSystemLocale(mResources, savedLocale);
|
||||
}
|
||||
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,
|
||||
IOException {
|
||||
final XmlResourceParser parser = res.getXml(resId);
|
||||
|
@ -302,7 +318,10 @@ public class KeyboardSet {
|
|||
R.styleable.KeyboardSet_Element_elementName, 0);
|
||||
final int elementKeyboard = a.getResourceId(
|
||||
R.styleable.KeyboardSet_Element_elementKeyboard, 0);
|
||||
mParams.mElementKeyboards.put(elementName, elementKeyboard);
|
||||
final boolean elementAutoGenerate = a.getBoolean(
|
||||
R.styleable.KeyboardSet_Element_elementAutoGenerate, false);
|
||||
mParams.mElementKeyboards.put(elementName, new KeyboardElement(
|
||||
elementName, elementKeyboard, elementAutoGenerate));
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ public class KeyboardState {
|
|||
public void setAlphabetManualShiftedKeyboard();
|
||||
public void setAlphabetAutomaticShiftedKeyboard();
|
||||
public void setAlphabetShiftLockedKeyboard();
|
||||
// TODO: Add this.
|
||||
//public void setAlphabetShiftLockShiftedKeyboard();
|
||||
public void setSymbolsKeyboard();
|
||||
public void setSymbolsShiftedKeyboard();
|
||||
|
||||
|
|
Loading…
Reference in New Issue