From 8bb20bc682db0966f2d4b1c7c0e6bf89d1497da7 Mon Sep 17 00:00:00 2001 From: Tadashi Takaoka <takaoka@google.com> Date: Tue, 24 Jan 2012 15:20:05 -0800 Subject: [PATCH] Revert "Add autoGenerateFromAlphabet enum to KeyboardSet.Element.elementKeyboard" This reverts commit b5b92f9b78295366c12b25d1b464a371401c3677 Bug: 5908440 --- java/res/values/attrs.xml | 27 ++++--- java/res/xml-ar/keyboard_set.xml | 4 +- java/res/xml-be/keyboard_set.xml | 4 +- java/res/xml-bg/keyboard_set.xml | 4 +- java/res/xml-cs/keyboard_set.xml | 4 +- java/res/xml-da/keyboard_set.xml | 4 +- java/res/xml-de-rZZ/keyboard_set.xml | 4 +- java/res/xml-de/keyboard_set.xml | 4 +- java/res/xml-es/keyboard_set.xml | 4 +- java/res/xml-et/keyboard_set.xml | 4 +- java/res/xml-fi/keyboard_set.xml | 4 +- java/res/xml-fr-rCA/keyboard_set.xml | 4 +- java/res/xml-fr-rCH/keyboard_set.xml | 4 +- java/res/xml-fr/keyboard_set.xml | 4 +- java/res/xml-hr/keyboard_set.xml | 4 +- java/res/xml-hu/keyboard_set.xml | 4 +- java/res/xml-iw/keyboard_set.xml | 4 +- java/res/xml-ky/keyboard_set.xml | 4 +- java/res/xml-nb/keyboard_set.xml | 4 +- java/res/xml-pl/keyboard_set.xml | 4 +- java/res/xml-pt/keyboard_set.xml | 4 +- java/res/xml-ro/keyboard_set.xml | 4 +- java/res/xml-ru/keyboard_set.xml | 4 +- java/res/xml-sk/keyboard_set.xml | 4 +- java/res/xml-sl/keyboard_set.xml | 4 +- java/res/xml-sr/keyboard_set.xml | 4 +- java/res/xml-sv/keyboard_set.xml | 4 +- java/res/xml-tr/keyboard_set.xml | 4 +- java/res/xml-uk/keyboard_set.xml | 4 +- java/res/xml-vi/keyboard_set.xml | 4 +- java/res/xml/keyboard_set.xml | 4 +- .../inputmethod/keyboard/KeyboardId.java | 52 +++++++------ .../inputmethod/keyboard/KeyboardSet.java | 76 ++++++++----------- .../keyboard/internal/KeyboardState.java | 2 - 34 files changed, 134 insertions(+), 143 deletions(-) diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 0ae7fa2abe..57930c6756 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -345,21 +345,20 @@ <declare-styleable name="KeyboardSet_Element"> <!-- This should be aligned with KeyboardId.ELEMENT_* --> <attr name="elementName" format="enum"> - <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|enum"> - <!-- This should be aligned with KeyboardSet.ELEMENT_KEYBOARD_* --> - <enum name="autoGenerateFromAlphabet" value="1"/> + <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" /> </attr> + <attr name="elementKeyboard" format="reference" /> <!-- TODO: Add setShifted and setShiftLocked attribute. --> </declare-styleable> </resources> diff --git a/java/res/xml-ar/keyboard_set.xml b/java/res/xml-ar/keyboard_set.xml index a8aac169bb..68dc34fe3e 100644 --- a/java/res/xml-ar/keyboard_set.xml +++ b/java/res/xml-ar/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-be/keyboard_set.xml b/java/res/xml-be/keyboard_set.xml index c8ee9c1620..e5c6ba35a4 100644 --- a/java/res/xml-be/keyboard_set.xml +++ b/java/res/xml-be/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-bg/keyboard_set.xml b/java/res/xml-bg/keyboard_set.xml index 5a759648d3..a789de630e 100644 --- a/java/res/xml-bg/keyboard_set.xml +++ b/java/res/xml-bg/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-cs/keyboard_set.xml b/java/res/xml-cs/keyboard_set.xml index 6b476df822..94076d3e08 100644 --- a/java/res/xml-cs/keyboard_set.xml +++ b/java/res/xml-cs/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-da/keyboard_set.xml b/java/res/xml-da/keyboard_set.xml index cf930dd05f..84d126dc24 100644 --- a/java/res/xml-da/keyboard_set.xml +++ b/java/res/xml-da/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-de-rZZ/keyboard_set.xml b/java/res/xml-de-rZZ/keyboard_set.xml index 585dc3d6a4..2309729981 100644 --- a/java/res/xml-de-rZZ/keyboard_set.xml +++ b/java/res/xml-de-rZZ/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-de/keyboard_set.xml b/java/res/xml-de/keyboard_set.xml index 059174ccd1..c178836203 100644 --- a/java/res/xml-de/keyboard_set.xml +++ b/java/res/xml-de/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-es/keyboard_set.xml b/java/res/xml-es/keyboard_set.xml index ec40a5a9b2..77f3786375 100644 --- a/java/res/xml-es/keyboard_set.xml +++ b/java/res/xml-es/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-et/keyboard_set.xml b/java/res/xml-et/keyboard_set.xml index 80a9d8fab9..304328a704 100644 --- a/java/res/xml-et/keyboard_set.xml +++ b/java/res/xml-et/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-fi/keyboard_set.xml b/java/res/xml-fi/keyboard_set.xml index cf95b5ec90..0c3a96d360 100644 --- a/java/res/xml-fi/keyboard_set.xml +++ b/java/res/xml-fi/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-fr-rCA/keyboard_set.xml b/java/res/xml-fr-rCA/keyboard_set.xml index 856363ea7d..b3bb4cc12e 100644 --- a/java/res/xml-fr-rCA/keyboard_set.xml +++ b/java/res/xml-fr-rCA/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-fr-rCH/keyboard_set.xml b/java/res/xml-fr-rCH/keyboard_set.xml index 778754c6ff..d6dcf7541f 100644 --- a/java/res/xml-fr-rCH/keyboard_set.xml +++ b/java/res/xml-fr-rCH/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-fr/keyboard_set.xml b/java/res/xml-fr/keyboard_set.xml index ae911afa00..b94a3f2523 100644 --- a/java/res/xml-fr/keyboard_set.xml +++ b/java/res/xml-fr/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-hr/keyboard_set.xml b/java/res/xml-hr/keyboard_set.xml index 4bd81d0e89..1d8582c0a8 100644 --- a/java/res/xml-hr/keyboard_set.xml +++ b/java/res/xml-hr/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-hu/keyboard_set.xml b/java/res/xml-hu/keyboard_set.xml index 9ed1d949a0..0771119236 100644 --- a/java/res/xml-hu/keyboard_set.xml +++ b/java/res/xml-hu/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-iw/keyboard_set.xml b/java/res/xml-iw/keyboard_set.xml index c16a6d79dc..ce25aae72f 100644 --- a/java/res/xml-iw/keyboard_set.xml +++ b/java/res/xml-iw/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-ky/keyboard_set.xml b/java/res/xml-ky/keyboard_set.xml index 1bb8926dfb..7cdd0a169d 100644 --- a/java/res/xml-ky/keyboard_set.xml +++ b/java/res/xml-ky/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-nb/keyboard_set.xml b/java/res/xml-nb/keyboard_set.xml index 1a36de4356..eacda8f878 100644 --- a/java/res/xml-nb/keyboard_set.xml +++ b/java/res/xml-nb/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-pl/keyboard_set.xml b/java/res/xml-pl/keyboard_set.xml index 39ee777719..89bd72f1ab 100644 --- a/java/res/xml-pl/keyboard_set.xml +++ b/java/res/xml-pl/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-pt/keyboard_set.xml b/java/res/xml-pt/keyboard_set.xml index bd19761d38..de31e0be50 100644 --- a/java/res/xml-pt/keyboard_set.xml +++ b/java/res/xml-pt/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-ro/keyboard_set.xml b/java/res/xml-ro/keyboard_set.xml index 75ca682720..725cb52d28 100644 --- a/java/res/xml-ro/keyboard_set.xml +++ b/java/res/xml-ro/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-ru/keyboard_set.xml b/java/res/xml-ru/keyboard_set.xml index 8d4d277b22..0a158d9ccc 100644 --- a/java/res/xml-ru/keyboard_set.xml +++ b/java/res/xml-ru/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-sk/keyboard_set.xml b/java/res/xml-sk/keyboard_set.xml index b73c446ef5..9df01dda65 100644 --- a/java/res/xml-sk/keyboard_set.xml +++ b/java/res/xml-sk/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-sl/keyboard_set.xml b/java/res/xml-sl/keyboard_set.xml index b2378e2c2f..d2ec4c02dd 100644 --- a/java/res/xml-sl/keyboard_set.xml +++ b/java/res/xml-sl/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-sr/keyboard_set.xml b/java/res/xml-sr/keyboard_set.xml index 729136f3a4..e72a0f23f3 100644 --- a/java/res/xml-sr/keyboard_set.xml +++ b/java/res/xml-sr/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-sv/keyboard_set.xml b/java/res/xml-sv/keyboard_set.xml index 3d366a4439..df06aef68f 100644 --- a/java/res/xml-sv/keyboard_set.xml +++ b/java/res/xml-sv/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-tr/keyboard_set.xml b/java/res/xml-tr/keyboard_set.xml index 3c429585f7..854ab85667 100644 --- a/java/res/xml-tr/keyboard_set.xml +++ b/java/res/xml-tr/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-uk/keyboard_set.xml b/java/res/xml-uk/keyboard_set.xml index 300eea2267..e5ba43b236 100644 --- a/java/res/xml-uk/keyboard_set.xml +++ b/java/res/xml-uk/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml-vi/keyboard_set.xml b/java/res/xml-vi/keyboard_set.xml index 0b92c94c13..7f4b25d9d5 100644 --- a/java/res/xml-vi/keyboard_set.xml +++ b/java/res/xml-vi/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/res/xml/keyboard_set.xml b/java/res/xml/keyboard_set.xml index ebdd9902eb..96f352bb2b 100644 --- a/java/res/xml/keyboard_set.xml +++ b/java/res/xml/keyboard_set.xml @@ -28,13 +28,13 @@ latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> <Element - latin:elementName="symbolsShifted" + latin:elementName="symbolsShift" latin:elementKeyboard="@xml/kbd_symbols_shift" /> <Element latin:elementName="phone" latin:elementKeyboard="@xml/kbd_phone" /> <Element - latin:elementName="phoneShifted" + latin:elementName="phoneShift" latin:elementKeyboard="@xml/kbd_phone_shift" /> <Element latin:elementName="number" diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index edce4c6e8f..d95c3b3af0 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -39,14 +39,16 @@ public class KeyboardId { public static final int MODE_NUMBER = 5; public static final int ELEMENT_ALPHABET = 0; - 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; + /* 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_SYMBOLS = 5; - public static final int ELEMENT_SYMBOLS_SHIFTED = 6; + public static final int ELEMENT_SYMBOLS_SHIFT = 6; public static final int ELEMENT_PHONE = 7; - public static final int ELEMENT_PHONE_SHIFTED = 8; + public static final int ELEMENT_PHONE_SHIFT = 8; public static final int ELEMENT_NUMBER = 9; private static final int F2KEY_MODE_NONE = 0; @@ -58,7 +60,7 @@ public class KeyboardId { public final int mOrientation; public final int mWidth; public final int mMode; - public final int mElement; + public final int mElementState; private final int mInputType; private final int mImeOptions; private final boolean mSettingsKeyEnabled; @@ -68,14 +70,14 @@ public class KeyboardId { private final int mHashCode; - public KeyboardId(int element, Locale locale, int orientation, int width, int mode, + public KeyboardId(int elementState, 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.mElement = element; + this.mElementState = elementState; this.mInputType = inputType; this.mImeOptions = imeOptions; this.mSettingsKeyEnabled = settingsKeyEnabled; @@ -89,7 +91,7 @@ public class KeyboardId { private static int hashCode(KeyboardId id) { return Arrays.hashCode(new Object[] { id.mOrientation, - id.mElement, + id.mElementState, id.mMode, id.mWidth, id.navigateAction(), @@ -107,7 +109,7 @@ public class KeyboardId { if (other == this) return true; return other.mOrientation == this.mOrientation - && other.mElement == this.mElement + && other.mElementState == this.mElementState && other.mMode == this.mMode && other.mWidth == this.mWidth && other.navigateAction() == this.navigateAction() @@ -121,19 +123,19 @@ public class KeyboardId { } public boolean isAlphabetKeyboard() { - return mElement < ELEMENT_SYMBOLS; + return mElementState < ELEMENT_SYMBOLS; } public boolean isSymbolsKeyboard() { - return mElement == ELEMENT_SYMBOLS || mElement == ELEMENT_SYMBOLS_SHIFTED; + return mElementState == ELEMENT_SYMBOLS || mElementState == ELEMENT_SYMBOLS_SHIFT; } public boolean isPhoneKeyboard() { - return mElement == ELEMENT_PHONE || mElement == ELEMENT_PHONE_SHIFTED; + return mElementState == ELEMENT_PHONE || mElementState == ELEMENT_PHONE_SHIFT; } public boolean isPhoneShiftKeyboard() { - return mElement == ELEMENT_PHONE_SHIFTED; + return mElementState == ELEMENT_PHONE_SHIFT; } public boolean navigateAction() { @@ -188,7 +190,7 @@ public class KeyboardId { @Override public String toString() { return String.format("[%s %s %s%d %s %s %s%s%s%s%s%s%s]", - elementToString(mElement), + elementStateToString(mElementState), mLocale, (mOrientation == 1 ? "port" : "land"), mWidth, modeName(mMode), @@ -211,17 +213,19 @@ public class KeyboardId { && TextUtils.equals(a.privateImeOptions, b.privateImeOptions); } - public static String elementToString(int element) { - switch (element) { + public static String elementStateToString(int elementState) { + switch (elementState) { case ELEMENT_ALPHABET: return "alphabet"; - 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"; + /* 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_SYMBOLS: return "symbols"; - case ELEMENT_SYMBOLS_SHIFTED: return "symbolsShifted"; + case ELEMENT_SYMBOLS_SHIFT: return "symbolsShift"; case ELEMENT_PHONE: return "phone"; - case ELEMENT_PHONE_SHIFTED: return "phoneShifted"; + case ELEMENT_PHONE_SHIFT: return "phoneShift"; case ELEMENT_NUMBER: return "number"; default: return null; } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java index f4602b8fd4..2852520445 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java @@ -22,7 +22,6 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.util.Log; -import android.util.TypedValue; import android.util.Xml; import android.view.inputmethod.EditorInfo; @@ -55,12 +54,10 @@ public class KeyboardSet { private static final String TAG_KEYBOARD_SET = TAG; private static final String TAG_ELEMENT = "Element"; - private static final int ELEMENT_KEYBOARD_AUTO_GENERATE_FROM_ALPHABET = 1; - private final Context mContext; private final Params mParams; - static class Params { + private static class Params { int mMode; int mInputType; int mImeOptions; @@ -107,18 +104,16 @@ public class KeyboardSet { } private Keyboard getKeyboard(boolean isSymbols, boolean isShift) { - final int element = KeyboardSet.getElement(mParams.mMode, isSymbols, isShift); - // TODO: If xmlId is ELEMENT_KEYBOARD_AUTO_GENERATE_FROM_ALPHABET, auto generate the - // 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 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); return keyboard; } public KeyboardId getMainKeyboardId() { - final int element = KeyboardSet.getElement(mParams.mMode, false, false); - return KeyboardSet.getKeyboardId(element, false, mParams); + final int elementState = Builder.getElementState(mParams.mMode, false, false); + return Builder.getKeyboardId(elementState, false, mParams); } private Keyboard getKeyboard(Context context, int xmlId, KeyboardId id) { @@ -152,30 +147,6 @@ public class KeyboardSet { 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 { private final Context mContext; private final String mPackageName; @@ -247,6 +218,31 @@ public class KeyboardSet { 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); @@ -304,14 +300,8 @@ public class KeyboardSet { final int elementName = a.getInt( R.styleable.KeyboardSet_Element_elementName, 0); - final int index = R.styleable.KeyboardSet_Element_elementKeyboard; - 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); - } + final int elementKeyboard = a.getResourceId( + R.styleable.KeyboardSet_Element_elementKeyboard, 0); mParams.mElementKeyboards.put(elementName, elementKeyboard); } finally { a.recycle(); diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java index 38c31adcee..bc8b7e3f73 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java @@ -43,8 +43,6 @@ public class KeyboardState { public void setAlphabetManualShiftedKeyboard(); public void setAlphabetAutomaticShiftedKeyboard(); public void setAlphabetShiftLockedKeyboard(); - // TODO: Add this. - //public void setAlphabetShiftLockShiftedKeyboard(); public void setSymbolsKeyboard(); public void setSymbolsShiftedKeyboard(); -- GitLab