diff options
Diffstat (limited to 'tests/src')
21 files changed, 1665 insertions, 18 deletions
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java b/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java index 65b050be7..444730a2e 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java @@ -95,10 +95,10 @@ public final class Arabic extends LayoutBase { return ARABIC_DIACRITICS; } - // U+0623: "ا" ARABIC LETTER ALEF + // U+0623: "أ" ARABIC LETTER ALEF WITH HAMZA ABOVE // U+200C: ZERO WIDTH NON-JOINER // U+0628: "ب" ARABIC LETTER BEH - // U+062C: "پ" ARABIC LETTER PEH + // U+062C: "ج" ARABIC LETTER JEEM private static final ExpectedKey ARABIC_ALPHABET_KEY = key( "\u0623\u200C\u0628\u200C\u062C", Constants.CODE_SWITCH_ALPHA_SYMBOL); // U+0663: "٣" ARABIC-INDIC DIGIT THREE @@ -107,10 +107,6 @@ public final class Arabic extends LayoutBase { // U+061F: "؟" ARABIC QUESTION MARK private static final ExpectedKey ARABIC_SYMBOLS_KEY = key( "\u0663\u0662\u0661\u061F", Constants.CODE_SWITCH_ALPHA_SYMBOL); - // U+0663: "٣" ARABIC-INDIC DIGIT THREE - // U+0662: "٢" ARABIC-INDIC DIGIT TWO - // U+0661: "١" ARABIC-INDIC DIGIT ONE - // U+061F: "؟" ARABIC QUESTION MARK private static final ExpectedKey ARABIC_BACK_TO_SYMBOLS_KEY = key( "\u0663\u0662\u0661\u061F", Constants.CODE_SHIFT); @@ -218,7 +214,7 @@ public final class Arabic extends LayoutBase { // U+FEF9: "ﻹ" ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW ISOLATED FORM // U+0625: "إ" ARABIC LETTER ALEF WITH HAMZA BELOW // U+FEF5: "ﻵ" ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM - // U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE --> + // U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE key("\u0644", moreKey("\uFEFB", "\u0644\u0627"), moreKey("\uFEF7", "\u0644\u0623"), moreKey("\uFEF9", "\u0644\u0625"), moreKey("\uFEF5", "\u0644\u0622")), diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java b/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java new file mode 100644 index 000000000..afec46392 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java @@ -0,0 +1,367 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout; + +import com.android.inputmethod.keyboard.layout.Symbols.RtlSymbols; +import com.android.inputmethod.keyboard.layout.SymbolsShifted.RtlSymbolsShifted; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; +import com.android.inputmethod.latin.Constants; + +import java.util.Locale; + +public final class Farsi extends LayoutBase { + private static final String LAYOUT_NAME = "farsi"; + + public Farsi(final LayoutCustomizer customizer) { + super(customizer, FarsiSymbols.class, FarsiSymbolsShifted.class); + } + + @Override + public String getName() { return LAYOUT_NAME; } + + public static class FarsiCustomizer extends LayoutCustomizer { + public FarsiCustomizer(final Locale locale) { + super(locale); + } + + @Override + public ExpectedKey getAlphabetKey() { return FARSI_ALPHABET_KEY; } + + @Override + public ExpectedKey getSymbolsKey() { return FARSI_SYMBOLS_KEY; } + + @Override + public ExpectedKey getBackToSymbolsKey() { return FARSI_BACK_TO_SYMBOLS_KEY; } + + @Override + public ExpectedKey getCurrencyKey() { return CURRENCY_RIAL; } + + @Override + public ExpectedKey[] getOtherCurrencyKeys() { + return SymbolsShifted.CURRENCIES_OTHER_GENERIC; + } + + @Override + public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) { + return EMPTY_KEYS; + } + + @Override + public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { + return EMPTY_KEYS; + } + + @Override + public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) { + if (isPhone) { + // U+060C: "،" ARABIC COMMA + return joinKeys(key("\u060C", joinMoreKeys(",", SETTINGS_KEY))); + } + return super.getKeysLeftToSpacebar(isPhone); + } + + @Override + public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) { + if (isPhone) { + return super.getKeysRightToSpacebar(isPhone); + } + // U+060C: "،" ARABIC COMMA + // U+061F: "؟" ARABIC QUESTION MARK + // U+061B: "؛" ARABIC SEMICOLON + return joinKeys( + key("\u060C", joinMoreKeys(":", "!", "\u061F", "\u061B", "-", "/", + RtlSymbols.DOUBLE_ANGLE_QUOTES_LR_RTL)), + key(".", getPunctuationMoreKeys(isPhone))); + } + + @Override + public ExpectedKey[] getSpaceKeys(final boolean isPhone) { + return joinKeys(SPACE_KEY, key(ZWNJ_KEY, ZWJ_KEY)); + } + + @Override + public ExpectedKey[] getPunctuationMoreKeys(final boolean isPhone) { + return FARSI_DIACRITICS; + } + + // U+0627: "ا" ARABIC LETTER ALEF + // U+200C: ZERO WIDTH NON-JOINER + // U+0628: "ب" ARABIC LETTER BEH + // U+067E: "پ" ARABIC LETTER PEH + private static final ExpectedKey FARSI_ALPHABET_KEY = key( + "\u0627\u200C\u0628\u200C\u067E", Constants.CODE_SWITCH_ALPHA_SYMBOL); + // U+06F3: "۳" EXTENDED ARABIC-INDIC DIGIT THREE + // U+06F2: "۲" EXTENDED ARABIC-INDIC DIGIT TWO + // U+06F1: "۱" EXTENDED ARABIC-INDIC DIGIT ONE + // U+061F: "؟" ARABIC QUESTION MARK + private static final ExpectedKey FARSI_SYMBOLS_KEY = key( + "\u06F3\u06F2\u06F1\u061F", Constants.CODE_SWITCH_ALPHA_SYMBOL); + private static final ExpectedKey FARSI_BACK_TO_SYMBOLS_KEY = key( + "\u06F3\u06F2\u06F1\u061F", Constants.CODE_SHIFT); + // U+FDFC: "﷼" RIAL SIGN + private static final ExpectedKey CURRENCY_RIAL = key("\uFDFC", + Symbols.CURRENCY_GENERIC_MORE_KEYS); + private static final ExpectedKey[] FARSI_DIACRITICS = { + // U+0655: "ٕ" ARABIC HAMZA BELOW + // U+0652: "ْ" ARABIC SUKUN + // U+0651: "ّ" ARABIC SHADDA + // U+064C: "ٌ" ARABIC DAMMATAN + // U+064D: "ٍ" ARABIC KASRATAN + // U+064B: "ً" ARABIC FATHATAN + // U+0654: "ٔ" ARABIC HAMZA ABOVE + // U+0656: "ٖ" ARABIC SUBSCRIPT ALEF + // U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF + // U+0653: "ٓ" ARABIC MADDAH ABOVE + // U+064F: "ُ" ARABIC DAMMA + // U+0650: "ِ" ARABIC KASRA + // U+064E: "َ" ARABIC FATHA + // U+0640: "ـ" ARABIC TATWEEL + moreKey(" \u0655", "\u0655"), moreKey(" \u0652", "\u0652"), + moreKey(" \u0651", "\u0651"), moreKey(" \u064C", "\u064C"), + moreKey(" \u064D", "\u064D"), moreKey(" \u064B", "\u064B"), + moreKey(" \u0654", "\u0654"), moreKey(" \u0656", "\u0656"), + moreKey(" \u0670", "\u0670"), moreKey(" \u0653", "\u0653"), + moreKey(" \u064F", "\u064F"), moreKey(" \u0650", "\u0650"), + moreKey(" \u064E", "\u064E"), moreKey("\u0640\u0640\u0640", "\u0640") + }; + } + + @Override + ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { + if (isPhone) { + return ALPHABET_COMMON; + } + final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(ALPHABET_COMMON); + // U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE + builder.insertKeysAtRow(3, 10, key("\u0622")); + return builder.build(); + } + + @Override + ExpectedKey[][] getCommonAlphabetShiftLayout(final boolean isPhone, final int elementId) { + return null; + } + + private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() + .setKeysOfRow(1, + // U+0636: "ض" ARABIC LETTER DAD + // U+06F1: "۱" EXTENDED ARABIC-INDIC DIGIT ONE + key("\u0636", joinMoreKeys("\u06F1", "1")), + // U+0635: "ص" ARABIC LETTER SAD + // U+06F2: "۲" EXTENDED ARABIC-INDIC DIGIT TWO + key("\u0635", joinMoreKeys("\u06F2", "2")), + // U+062B: "ث" ARABIC LETTER THEH + // U+06F3: "۳" EXTENDED ARABIC-INDIC DIGIT THREE + key("\u062B", joinMoreKeys("\u06F3", "3")), + // U+0642: "ق" ARABIC LETTER QAF + // U+06F4: "۴" EXTENDED ARABIC-INDIC DIGIT FOUR + key("\u0642", joinMoreKeys("\u06F4", "4")), + // U+0641: "ف" ARABIC LETTER FEH + // U+06F5: "۵" EXTENDED ARABIC-INDIC DIGIT FIVE + key("\u0641", joinMoreKeys("\u06F5", "5")), + // U+063A: "غ" ARABIC LETTER GHAIN + // U+06F6: "۶" EXTENDED ARABIC-INDIC DIGIT SIX + key("\u063A", joinMoreKeys("\u06F6", "6")), + // U+0639: "ع" ARABIC LETTER AIN + // U+06F7: "۷" EXTENDED ARABIC-INDIC DIGIT SEVEN + key("\u0639", joinMoreKeys("\u06F7", "7")), + // U+0647: "ه" ARABIC LETTER HEH + // U+FEEB: "ﻫ" ARABIC LETTER HEH INITIAL FORM + // U+0647/U+200D: ARABIC LETTER HEH + ZERO WIDTH JOINER + // U+0647/U+0654: ARABIC LETTER HEH + ARABIC HAMZA ABOVE + // U+0629: "ة" ARABIC LETTER TEH MARBUTA + // U+06F8: "۸" EXTENDED ARABIC-INDIC DIGIT EIGHT + key("\u0647", joinMoreKeys(moreKey("\uFEEB", "\u0647\u200D"), "\u0647\u0654", + "\u0629", "\u06F8", "8")), + // U+062E: "خ" ARABIC LETTER KHAH + // U+06F9: "۹" EXTENDED ARABIC-INDIC DIGIT NINE + key("\u062E", joinMoreKeys("\u06F9", "9")), + // U+062D: "ح" ARABIC LETTER HAH + // U+06F0: "۰" EXTENDED ARABIC-INDIC DIGIT ZERO + key("\u062D", joinMoreKeys("\u06F0", "0")), + // U+062C: "ج" ARABIC LETTER JEEM + key("\u062C")) + .setKeysOfRow(2, + // U+0634: "ش" ARABIC LETTER SHEEN + key("\u0634"), + // U+0633: "س" ARABIC LETTER SEEN + key("\u0633"), + // U+06CC: "ی" ARABIC LETTER FARSI YEH + // U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE + // U+064A: "ي" ARABIC LETTER YEH + // U+FBE8: "ﯨ" ARABIC LETTER UIGHUR KAZAKH KIRGHIZ ALEF MAKSURA INITIAL FORM + // U+0649: "ى" ARABIC LETTER ALEF MAKSURA + key("\u06CC", joinMoreKeys("\u0626", "\u064A", moreKey("\uFBE8", "\u0649"))), + // U+0628: "ب" ARABIC LETTER BEH + key("\u0628"), + // U+0644: "ل" ARABIC LETTER LAM + key("\u0644"), + // U+0627: "ا" ARABIC LETTER ALEF + // U+0671: "ٱ" ARABIC LETTER ALEF WASLA + // U+0621: "ء" ARABIC LETTER HAMZA + // U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE + // U+0623: "أ" ARABIC LETTER ALEF WITH HAMZA ABOVE + // U+0625: "إ" ARABIC LETTER ALEF WITH HAMZA BELOW + key("\u0627", joinMoreKeys("\u0671", "\u0621", "\u0622", "\u0623", "\u0625")), + // U+062A: "ت" ARABIC LETTER TEH + // U+0629: "ة": ARABIC LETTER TEH MARBUTA + key("\u062A", moreKey("\u0629")), + // U+0646: "ن" ARABIC LETTER NOON + key("\u0646"), + // U+0645: "م" ARABIC LETTER MEEM + key("\u0645"), + // U+06A9: "ک" ARABIC LETTER KEHEH + // U+0643: "ك" ARABIC LETTER KAF + key("\u06A9", moreKey("\u0643")), + // U+06AF: "گ" ARABIC LETTER GAF + key("\u06AF")) + .setKeysOfRow(3, joinKeys( + // U+0638: "ظ" ARABIC LETTER ZAH + // U+0637: "ط" ARABIC LETTER TAH + // U+0698: "ژ" ARABIC LETTER JEH + // U+0632: "ز" ARABIC LETTER ZAIN + // U+0631: "ر" ARABIC LETTER REH + // U+0630: "ذ" ARABIC LETTER THAL + // U+062F: "د" ARABIC LETTER DAL + // U+067E: "پ" ARABIC LETTER PEH + "\u0638", "\u0637", "\u0698", "\u0632", "\u0631", "\u0630", "\u062F", "\u067E", + // U+0648: "و" ARABIC LETTER WAW + // U+0624: "ؤ" ARABIC LETTER WAW WITH HAMZA ABOVE + key("\u0648", moreKey("\u0624")), + // U+0686: "چ" ARABIC LETTER TCHEH + "\u0686")) + .build(); + + private static class FarsiSymbols extends RtlSymbols { + public FarsiSymbols(final LayoutCustomizer customizer) { + super(customizer); + } + + @Override + public ExpectedKey[][] getLayout(final boolean isPhone) { + return new ExpectedKeyboardBuilder(super.getLayout(isPhone)) + // U+06F1: "۱" EXTENDED ARABIC-INDIC DIGIT ONE + // U+00B9: "¹" SUPERSCRIPT ONE + // U+00BD: "½" VULGAR FRACTION ONE HALF + // U+2153: "⅓" VULGAR FRACTION ONE THIRD + // U+00BC: "¼" VULGAR FRACTION ONE QUARTER + // U+215B: "⅛" VULGAR FRACTION ONE EIGHTH + .replaceKeyOfLabel("1", key("\u06F1", + joinMoreKeys("1", "\u00B9", "\u00BD", "\u2153", "\u00BC", "\u215B"))) + // U+06F2: "۲" EXTENDED ARABIC-INDIC DIGIT TWO + // U+00B2: "²" SUPERSCRIPT TWO + // U+2154: "⅔" VULGAR FRACTION TWO THIRDS + .replaceKeyOfLabel("2", key("\u06F2", joinMoreKeys("2", "\u00B2", "\u2154"))) + // U+06F3: "۳" EXTENDED ARABIC-INDIC DIGIT THREE + // U+00B3: "³" SUPERSCRIPT THREE + // U+00BE: "¾" VULGAR FRACTION THREE QUARTERS + // U+215C: "⅜" VULGAR FRACTION THREE EIGHTHS + .replaceKeyOfLabel("3", key("\u06F3", + joinMoreKeys("3", "\u00B3", "\u00BE", "\u215C"))) + // U+06F4: "۴" EXTENDED ARABIC-INDIC DIGIT FOUR + // U+2074: "⁴" SUPERSCRIPT FOUR + .replaceKeyOfLabel("4", key("\u06F4", joinMoreKeys("4", "\u2074"))) + // U+06F5: "۵" EXTENDED ARABIC-INDIC DIGIT FIVE + // U+215D: "⅝" VULGAR FRACTION FIVE EIGHTHS + .replaceKeyOfLabel("5", key("\u06F5", joinMoreKeys("5", "\u215D"))) + // U+06F6: "۶" EXTENDED ARABIC-INDIC DIGIT SIX + .replaceKeyOfLabel("6", key("\u06F6", moreKey("6"))) + // U+06F7: "۷" EXTENDED ARABIC-INDIC DIGIT SEVEN + // U+215E: "⅞" VULGAR FRACTION SEVEN EIGHTHS + .replaceKeyOfLabel("7", key("\u06F7", joinMoreKeys("7", "\u215E"))) + // U+06F8: "۸" EXTENDED ARABIC-INDIC DIGIT EIGHT + .replaceKeyOfLabel("8", key("\u06F8", moreKey("8"))) + // U+06F9: "۹" EXTENDED ARABIC-INDIC DIGIT NINE + .replaceKeyOfLabel("9", key("\u06F9", moreKey("9"))) + // U+066C: "٬" ARABIC THOUSANDS SEPARATOR + .replaceKeyOfLabel("@", key("\u066C", moreKey("@"))) + // U+066B: "٫" ARABIC DECIMAL SEPARATOR + .replaceKeyOfLabel("#", key("\u066B", moreKey("#"))) + // U+06F0: "۰" EXTENDED ARABIC-INDIC DIGIT ZERO + // U+066B: "٫" ARABIC DECIMAL SEPARATOR + // U+066C: "٬" ARABIC THOUSANDS SEPARATOR + // U+207F: "ⁿ" SUPERSCRIPT LATIN SMALL LETTER N + // U+2205: "∅" EMPTY SET + .replaceKeyOfLabel("0", key("\u06F0", + joinMoreKeys("0", "\u066B", "\u066C", "\u207F", "\u2205"))) + // U+066A: "٪" ARABIC PERCENT SIGN + // U+2030: "‰" PER MILLE SIGN + .replaceKeyOfLabel("%", key("\u066A", joinMoreKeys("%", "\u2030"))) + // U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + // U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK + // U+2264: "≤" LESS-THAN OR EQUAL TO + .replaceKeyOfLabel("\"", key("\u00AB", "\u00BB", joinMoreKeys( + DOUBLE_QUOTES_9LR, DOUBLE_ANGLE_QUOTES_LR_RTL))) + // U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + // U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + // U+2265: "≥" GREATER-THAN EQUAL TO + .replaceKeyOfLabel("'", key("\u00BB", "\u00AB", joinMoreKeys( + SINGLE_QUOTES_9LR, SINGLE_ANGLE_QUOTES_LR_RTL))) + // U+061B: "؛" ARABIC SEMICOLON + .replaceKeyOfLabel(";", key("\u061B", moreKey(";"))) + // U+061F: "؟" ARABIC QUESTION MARK + // U+00BF: "¿" INVERTED QUESTION MARK + .replaceKeyOfLabel("?", key("\u061F", joinMoreKeys("?", "\u00BF"))) + // U+060C: "،" ARABIC COMMA + .replaceKeyOfLabel(",", key("\u060C", moreKey(","))) + // U+FD3E: "﴾" ORNATE LEFT PARENTHESIS + // U+FD3F: "﴿" ORNATE RIGHT PARENTHESIS + .replaceKeyOfLabel("(", key("(", ")", + moreKey("\uFD3E", "\uFD3F"), moreKey("<", ">"), moreKey("{", "}"), + moreKey("[", "]"))) + // U+FD3F: "﴿" ORNATE RIGHT PARENTHESIS + // U+FD3E: "﴾" ORNATE LEFT PARENTHESIS + .replaceKeyOfLabel(")", key(")", "(", + moreKey("\uFD3F", "\uFD3E"), moreKey(">", "<"), moreKey("}", "{"), + moreKey("]", "["))) + // U+2605: "★" BLACK STAR + // U+066D: "٭" ARABIC FIVE POINTED STAR + .setMoreKeysOf("*", "\u2605", "\u066D") + .build(); + } + } + + private static class FarsiSymbolsShifted extends RtlSymbolsShifted { + public FarsiSymbolsShifted(final LayoutCustomizer customizer) { + super(customizer); + } + + @Override + public ExpectedKey[][] getLayout(final boolean isPhone) { + return new ExpectedKeyboardBuilder(super.getLayout(isPhone)) + // U+2022: "•" BULLET + // U+266A: "♪" EIGHTH NOTE + .setMoreKeysOf("\u2022", "\u266A") + // U+060C: "،" ARABIC COMMA + .replaceKeyOfLabel(",", key("\u060C", moreKey(","))) + // U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + // U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK + // U+2264: "≤" LESS-THAN OR EQUAL TO + .replaceKeyOfLabel("<", key("\u00AB", "\u00BB", + moreKey("\u2039", "\u203A"), moreKey("\u2264", "\u2265"), + moreKey("<", ">"))) + // U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + // U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + // U+2265: "≥" GREATER-THAN EQUAL TO + .replaceKeyOfLabel(">", key("\u00BB", "\u00AB", + moreKey("\u203A", "\u2039"), moreKey("\u2265", "\u2264"), + moreKey(">", "<"))) + .build(); + } + } +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Georgian.java b/tests/src/com/android/inputmethod/keyboard/layout/Georgian.java new file mode 100644 index 000000000..ad87c3b49 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/Georgian.java @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout; + +import com.android.inputmethod.keyboard.KeyboardId; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; +import com.android.inputmethod.latin.Constants; + +import java.util.Locale; + +/** + * The Georgian alphabet keyboard. + */ +public final class Georgian extends LayoutBase { + private static final String LAYOUT_NAME = "georgian"; + + public Georgian(final LayoutCustomizer customizer) { + super(customizer, Symbols.class, SymbolsShifted.class); + } + + @Override + public String getName() { return LAYOUT_NAME; } + + public static class GeorgianCustomizer extends LayoutCustomizer { + public GeorgianCustomizer(final Locale locale) { super(locale); } + + @Override + public ExpectedKey getAlphabetKey() { return GEORGIAN_ALPHABET_KEY; } + + @Override + public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; } + + @Override + public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_R9L; } + + // U+10D0: "ა" GEORGIAN LETTER AN + // U+10D1: "ბ" GEORGIAN LETTER BAN + // U+10D2: "გ" GEORGIAN LETTER GAN + private static final ExpectedKey GEORGIAN_ALPHABET_KEY = key( + "\u10D0\u10D1\u10D2", Constants.CODE_SWITCH_ALPHA_SYMBOL); + } + + @Override + ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { + return ALPHABET_COMMON; + } + + @Override + public ExpectedKey[][] getCommonAlphabetShiftLayout(final boolean isPhone, + final int elementId) { + if (elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) { + return getCommonAlphabetLayout(isPhone); + } + return ALPHABET_SHIFTED_COMMON; + } + + private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() + .setKeysOfRow(1, + // U+10E5: "ქ" GEORGIAN LETTER GHAN + key("\u10E5", moreKey("1")), + // U+10EC: "წ" GEORGIAN LETTER CIL + key("\u10EC", moreKey("2")), + // U+10D4: "ე" GEORGIAN LETTER EN + // U+10F1: "ჱ" GEORGIAN LETTER HE + key("\u10D4", joinMoreKeys("3", "\u10F1")), + // U+10E0: "რ" GEORGIAN LETTER RAE + key("\u10E0", moreKey("4")), + // U+10E2: "ტ" GEORGIAN LETTER TAR + key("\u10E2", moreKey("5")), + // U+10E7: "ყ" GEORGIAN LETTER QAR + // U+10F8: "ჸ" GEORGIAN LETTER ELIFI + key("\u10E7", joinMoreKeys("6", "\u10F8")), + // U+10E3: "უ" GEORGIAN LETTER UN + key("\u10E3", moreKey("7")), + // U+10D8: "ი" GEORGIAN LETTER IN + // U+10F2: "ჲ" GEORGIAN LETTER HIE + key("\u10D8", joinMoreKeys("8", "\u10F2")), + // U+10DD: "ო" GEORGIAN LETTER ON + key("\u10DD", moreKey("9")), + // U+10DE: "პ" GEORGIAN LETTER PAR + key("\u10DE", moreKey("0"))) + .setKeysOfRow(2, + // U+10D0: "ა" GEORGIAN LETTER AN + // U+10FA: "ჺ" GEORGIAN LETTER AIN + key("\u10D0", moreKey("\u10FA")), + // U+10E1: "ს" GEORGIAN LETTER SAN + key("\u10E1"), + // U+10D3: "დ" GEORGIAN LETTER DON + key("\u10D3"), + // U+10E4: "ფ" GEORGIAN LETTER PHAR + // U+10F6: "ჶ" GEORGIAN LETTER FI + key("\u10E4", moreKey("\u10F6")), + // U+10D2: "გ" GEORGIAN LETTER GAN + // U+10F9: "ჹ" GEORGIAN LETTER TURNED GAN + key("\u10D2", moreKey("\u10F9")), + // U+10F0: "ჰ" GEORGIAN LETTER HAE + // U+10F5: "ჵ" GEORGIAN LETTER HOE + key("\u10F0", moreKey("\u10F5")), + // U+10EF: "ჯ" GEORGIAN LETTER JHAN + // U+10F7: "ჷ" GEORGIAN LETTER YN + key("\u10EF", moreKey("\u10F7")), + // U+10D9: "კ" GEORGIAN LETTER KAN + key("\u10D9"), + // U+10DA: "ლ" GEORGIAN LETTER LAS + key("\u10DA")) + .setKeysOfRow(3, + // U+10D6: "ზ" GEORGIAN LETTER ZEN + key("\u10D6"), + // U+10EE: "ხ" GEORGIAN LETTER XAN + // U+10F4: "ჴ" GEORGIAN LETTER HAR + key("\u10EE", moreKey("\u10F4")), + // U+10EA: "ც" GEORGIAN LETTER CAN + key("\u10EA"), + // U+10D5: "ვ" GEORGIAN LETTER VIN + // U+10F3: "ჳ" GEORGIAN LETTER WE + key("\u10D5", moreKey("\u10F3")), + // U+10D1: "ბ" GEORGIAN LETTER BAN + key("\u10D1"), + // U+10DC: "ნ" GEORGIAN LETTER NAR + // U+10FC: "ჼ" MODIFIER LETTER GEORGIAN NAR + key("\u10DC", moreKey("\u10FC")), + // U+10DB: "მ" GEORGIAN LETTER MAN + key("\u10DB")) + .build(); + + private static final ExpectedKey[][] ALPHABET_SHIFTED_COMMON = new ExpectedKeyboardBuilder() + .setKeysOfRow(1, + key("Q", moreKey("1")), + // U+10ED: "ჭ" GEORGIAN LETTER CHAR + key("\u10ED", moreKey("2")), + key("E", moreKey("3")), + // U+10E6: "ღ" GEORGIAN LETTER GHAN + key("\u10E6", moreKey("4")), + // U+10D7: "თ" GEORGIAN LETTER TAN + key("\u10D7", moreKey("5")), + key("Y", moreKey("6")), + key("U", moreKey("7")), + key("I", moreKey("8")), + key("O", moreKey("9")), + key("P", moreKey("0"))) + .setKeysOfRow(2, + key("A"), + // U+10E8: "შ" GEORGIAN LETTER SHIN + key("\u10E8"), + key("D"), + key("F"), + key("G"), + key("H"), + // U+10DF: "ჟ" GEORGIAN LETTER ZHAR + key("\u10DF"), + key("K"), + key("L")) + .setKeysOfRow(3, + // U+10EB: "ძ" GEORGIAN LETTER JIL + key("\u10EB"), + key("X"), + // U+10E9: "ჩ" GEORGIAN LETTER CHIN + key("\u10E9"), + key("V"), + key("B"), + key("N"), + key("M")) + .build(); +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Hebrew.java b/tests/src/com/android/inputmethod/keyboard/layout/Hebrew.java new file mode 100644 index 000000000..a5befab00 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/Hebrew.java @@ -0,0 +1,195 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout; + +import com.android.inputmethod.keyboard.layout.Symbols.RtlSymbols; +import com.android.inputmethod.keyboard.layout.SymbolsShifted.RtlSymbolsShifted; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; +import com.android.inputmethod.latin.Constants; + +import java.util.Locale; + +public final class Hebrew extends LayoutBase { + private static final String LAYOUT_NAME = "hebrew"; + + public Hebrew(final LayoutCustomizer customizer) { + super(customizer, HebrewSymbols.class, RtlSymbolsShifted.class); + } + + @Override + public String getName() { return LAYOUT_NAME; } + + public static class HebrewCustomizer extends LayoutCustomizer { + public HebrewCustomizer(final Locale locale) { + super(locale); + } + + @Override + public ExpectedKey getAlphabetKey() { return HEBREW_ALPHABET_KEY; } + + @Override + public ExpectedKey getCurrencyKey() { return CURRENCY_NEW_SHEQEL; } + + @Override + public ExpectedKey[] getOtherCurrencyKeys() { + return SymbolsShifted.CURRENCIES_OTHER_GENERIC; + } + + @Override + public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_LR9; } + + @Override + public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_LR9; } + + @Override + public ExpectedKey[] getDoubleAngleQuoteKeys() { + return RtlSymbols.DOUBLE_ANGLE_QUOTES_LR_RTL; + } + + @Override + public ExpectedKey[] getSingleAngleQuoteKeys() { + return RtlSymbols.SINGLE_ANGLE_QUOTES_LR_RTL; + } + + @Override + public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) { + return EMPTY_KEYS; + } + + @Override + public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { + return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS; + } + + @Override + public ExpectedKey[] getPunctuationMoreKeys(final boolean isPhone) { + return isPhone ? RTL_PHONE_PUNCTUATION_MORE_KEYS + : RTL_TABLET_PUNCTUATION_MORE_KEYS; + } + + // U+05D0: "א" HEBREW LETTER ALEF + // U+05D1: "ב" HEBREW LETTER BET + // U+05D2: "ג" HEBREW LETTER GIMEL + private static final ExpectedKey HEBREW_ALPHABET_KEY = key( + "\u05D0\u05D1\u05D2", Constants.CODE_SWITCH_ALPHA_SYMBOL); + // U+20AA: "₪" NEW SHEQEL SIGN + private static final ExpectedKey CURRENCY_NEW_SHEQEL = key("\u20AA", + Symbols.CURRENCY_GENERIC_MORE_KEYS); + private static final ExpectedKey[] RTL_PHONE_PUNCTUATION_MORE_KEYS = joinKeys( + ";", "/", key("(", ")"), key(")", "("), "#", "!", ",", "?", + "&", "%", "+", "\"", "-", ":", "'", "@"); + // Punctuation more keys for tablet form factor. + private static final ExpectedKey[] RTL_TABLET_PUNCTUATION_MORE_KEYS = joinKeys( + ";", "/", key("(", ")"), key(")", "("), "#", "'", ",", + "&", "%", "+", "\"", "-", ":", "@"); + } + + @Override + ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; } + + @Override + ExpectedKey[][] getCommonAlphabetShiftLayout(final boolean isPhone, final int elementId) { + return null; + } + + private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() + .setKeysOfRow(1, + key("'", joinMoreKeys("1", "\"")), + key("-", joinMoreKeys("2", "_")), + // U+05E7: "ק" HEBREW LETTER QOF + key("\u05E7", moreKey("3")), + // U+05E8: "ר" HEBREW LETTER RESH + key("\u05E8", moreKey("4")), + // U+05D0: "א" HEBREW LETTER ALEF + key("\u05D0", moreKey("5")), + // U+05D8: "ט" HEBREW LETTER TET + key("\u05D8", moreKey("6")), + // U+05D5: "ו" HEBREW LETTER VAV + key("\u05D5", moreKey("7")), + // U+05DF: "ן" HEBREW LETTER FINAL NUN + key("\u05DF", moreKey("8")), + // U+05DD: "ם" HEBREW LETTER FINAL MEM + key("\u05DD", moreKey("9")), + // U+05E4: "פ" HEBREW LETTER PE + key("\u05E4", moreKey("0"))) + .setKeysOfRow(2, + // U+05E9: "ש" HEBREW LETTER SHIN + key("\u05E9"), + // U+05D3: "ד" HEBREW LETTER DALET + key("\u05D3"), + // U+05D2: "ג" HEBREW LETTER GIMEL + // U+05D2 U+05F3: "ג׳" HEBREW LETTER GIMEL + HEBREW PUNCTUATION GERESH + key("\u05D2", moreKey("\u05D2\u05F3")), + // U+05DB: "כ" HEBREW LETTER KAF + key("\u05DB"), + // U+05E2: "ע" HEBREW LETTER AYIN + key("\u05E2"), + // U+05D9: "י" HEBREW LETTER YOD + // U+05F2 U+05B7: "ײַ" HEBREW LIGATURE YIDDISH DOUBLE YOD + HEBREW POINT PATAH + key("\u05D9", moreKey("\u05F2\u05B7")), + // U+05D7: "ח" HEBREW LETTER HET + // U+05D7 U+05F3: "ח׳" HEBREW LETTER HET + HEBREW PUNCTUATION GERESH + key("\u05D7", moreKey("\u05D7\u05F3")), + // U+05DC: "ל" HEBREW LETTER LAMED + key("\u05DC"), + // U+05DA: "ך" HEBREW LETTER FINAL KAF + key("\u05DA"), + // U+05E3: "ף" HEBREW LETTER FINAL PE + key("\u05E3")) + .setKeysOfRow(3, + // U+05D6: "ז" HEBREW LETTER ZAYIN + // U+05D6 U+05F3: "ז׳" HEBREW LETTER ZAYIN + HEBREW PUNCTUATION GERESH + key("\u05D6", moreKey("\u05D6\u05F3")), + // U+05E1: "ס" HEBREW LETTER SAMEKH + key("\u05E1"), + // U+05D1: "ב" HEBREW LETTER BET + key("\u05D1"), + // U+05D4: "ה" HEBREW LETTER HE + key("\u05D4"), + // U+05E0: "נ" HEBREW LETTER NUN + key("\u05E0"), + // U+05DE: "מ" HEBREW LETTER MEM + key("\u05DE"), + // U+05E6: "צ" HEBREW LETTER TSADI + // U+05E6 U+05F3: "צ׳" HEBREW LETTER TSADI + HEBREW PUNCTUATION GERESH + key("\u05E6", moreKey("\u05E6\u05F3")), + // U+05EA: "ת" HEBREW LETTER TAV + // U+05EA U+05F3: "ת׳" HEBREW LETTER TAV + HEBREW PUNCTUATION GERESH + key("\u05EA", moreKey("\u05EA\u05F3")), + // U+05E5: "ץ" HEBREW LETTER FINAL TSADI + // U+05E5 U+05F3: "ץ׳" HEBREW LETTER FINAL TSADI + HEBREW PUNCTUATION GERESH + key("\u05E5", moreKey("\u05E5\u05F3"))) + .build(); + + private static class HebrewSymbols extends RtlSymbols { + public HebrewSymbols(final LayoutCustomizer customizer) { + super(customizer); + } + + @Override + public ExpectedKey[][] getLayout(final boolean isPhone) { + return new ExpectedKeyboardBuilder(super.getLayout(isPhone)) + // U+00B1: "±" PLUS-MINUS SIGN + // U+FB29: "﬩" HEBREW LETTER ALTERNATIVE PLUS SIGN + .setMoreKeysOf("+", "\u00B1", "\uFB29") + // U+2605: "★" BLACK STAR + .setMoreKeysOf("*", "\u2605") + .build(); + } + } +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java b/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java index 0ba768b85..c1d161615 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/Hindi.java @@ -77,8 +77,7 @@ public final class Hindi extends LayoutBase { // U+20B9: "₹" INDIAN RUPEE SIGN private static final ExpectedKey CURRENCY_HINDI = key("\u20B9", - Symbols.DOLLAR_SIGN, Symbols.CENT_SIGN, Symbols.EURO_SIGN, Symbols.POUND_SIGN, - Symbols.YEN_SIGN, Symbols.PESO_SIGN); + Symbols.CURRENCY_GENERIC_MORE_KEYS); } @Override diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java b/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java new file mode 100644 index 000000000..61ade8b70 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/Khmer.java @@ -0,0 +1,322 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout; + +import com.android.inputmethod.keyboard.KeyboardId; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; +import com.android.inputmethod.latin.Constants; + +import java.util.Locale; + +/** + * The Khmer alphabet keyboard. + */ +public final class Khmer extends LayoutBase { + private static final String LAYOUT_NAME = "khmer"; + + public Khmer(final LayoutCustomizer customizer) { + super(customizer, Symbols.class, SymbolsShifted.class); + } + + @Override + public String getName() { return LAYOUT_NAME; } + + public static class KhmerCustomizer extends LayoutCustomizer { + public KhmerCustomizer(final Locale locale) { super(locale); } + + @Override + public ExpectedKey getAlphabetKey() { return KHMER_ALPHABET_KEY; } + + @Override + public ExpectedKey getCurrencyKey() { return CURRENCY_DOLLAR_WITH_RIEL; } + + @Override + public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { return EMPTY_KEYS; } + + // U+1780: "ក" KHMER LETTER KA + // U+1781: "ខ" KHMER LETTER KHA + // U+1782: "គ" KHMER LETTER KO + private static final ExpectedKey KHMER_ALPHABET_KEY = key( + "\u1780\u1781\u1782", Constants.CODE_SWITCH_ALPHA_SYMBOL); + + // U+17DB: "៛" KHMER CURRENCY SYMBOL RIEL + private static final ExpectedKey CURRENCY_DOLLAR_WITH_RIEL = key(Symbols.DOLLAR_SIGN, + moreKey("\u17DB"), Symbols.CENT_SIGN, Symbols.POUND_SIGN, Symbols.EURO_SIGN, + Symbols.YEN_SIGN, Symbols.PESO_SIGN); + } + + @Override + ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { + if (isPhone) { + return ALPHABET_COMMON; + } + final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(ALPHABET_COMMON); + builder.addKeysOnTheRightOfRow(4, EXCLAMATION_AND_QUESTION_MARKS); + return builder.build(); + } + + @Override + public ExpectedKey[][] getCommonAlphabetShiftLayout(final boolean isPhone, + final int elementId) { + if (elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) { + return getCommonAlphabetLayout(isPhone); + } + return ALPHABET_SHIFTED_COMMON; + } + + // Helper method to create alphabet layout by adding special function keys. + @Override + ExpectedKeyboardBuilder convertCommonLayoutToKeyboard(final ExpectedKeyboardBuilder builder, + final boolean isPhone) { + final LayoutCustomizer customizer = getCustomizer(); + final ExpectedKey[] spacebar = joinKeys( + customizer.getKeysLeftToSpacebar(isPhone), + customizer.getSpaceKeys(isPhone), + customizer.getKeysRightToSpacebar(isPhone)); + builder.setKeysOfRow(5, spacebar); + if (isPhone) { + builder.addKeysOnTheRightOfRow(4, DELETE_KEY) + .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey()) + .addKeysOnTheRightOfRow(5, key(ENTER_KEY, EMOJI_KEY)); + } else { + builder.addKeysOnTheRightOfRow(1, DELETE_KEY) + .addKeysOnTheRightOfRow(3, ENTER_KEY) + .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey(), SETTINGS_KEY) + .addKeysOnTheRightOfRow(5, EMOJI_KEY); + } + builder.addKeysOnTheLeftOfRow(4, customizer.getLeftShiftKeys(isPhone)) + .addKeysOnTheRightOfRow(4, customizer.getRightShiftKeys(isPhone)); + return builder; + } + + private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() + .setKeysOfRow(1, + // U+17E1: "១" KHMER DIGIT ONE + // U+17F1: "៱" KHMER SYMBOL LEK ATTAK MUOY + key("\u17E1", joinMoreKeys("1", "\u17F1")), + // U+17E2: "២" KHMER DIGIT TWO + // U+17F2: "៲" KHMER SYMBOL LEK ATTAK PII + key("\u17E2", joinMoreKeys("2", "\u17F2")), + // U+17E3: "៣" KHMER DIGIT THREE + // U+17F3: "៳" KHMER SYMBOL LEK ATTAK BEI + key("\u17E3", joinMoreKeys("3", "\u17F3")), + // U+17E4: "៤" KHMER DIGIT FOUR + // U+17F4: "៴" KHMER SYMBOL LEK ATTAK BUON + key("\u17E4", joinMoreKeys("4", "\u17F4")), + // U+17E5: "៥" KHMER DIGIT FIVE + // U+17F5: "៵" KHMER SYMBOL LEK ATTAK PRAM + key("\u17E5", joinMoreKeys("5", "\u17F5")), + // U+17E6: "៦" KHMER DIGIT SIX + // U+17F6: "៶" KHMER SYMBOL LEK ATTAK PRAM-MUOY + key("\u17E6", joinMoreKeys("6", "\u17F6")), + // U+17E7: "៧" KHMER DIGIT SEVEN + // U+17F7: "៷" KHMER SYMBOL LEK ATTAK PRAM-PII + key("\u17E7", joinMoreKeys("7", "\u17F7")), + // U+17E8: "៨" KHMER DIGIT EIGHT + // U+17F8: "៸" KHMER SYMBOL LEK ATTAK PRAM-BEI + key("\u17E8", joinMoreKeys("8", "\u17F8")), + // U+17E9: "៩" KHMER DIGIT NINE + // U+17F9: "៹" KHMER SYMBOL LEK ATTAK PRAM-BUON + key("\u17E9", joinMoreKeys("9", "\u17F9")), + // U+17E0: "០" KHMER DIGIT ZERO + // U+17F0: "៰" KHMER SYMBOL LEK ATTAK SON + key("\u17E0", joinMoreKeys("0", "\u17F0")), + // U+17A5: "ឥ" KHMER INDEPENDENT VOWEL QI + // U+17A6: "ឦ" KHMER INDEPENDENT VOWEL QII + key("\u17A5", moreKey("\u17A6")), + // U+17B2: "ឲ" KHMER INDEPENDENT VOWEL QOO TYPE TWO + // U+17B1: "ឱ" KHMER INDEPENDENT VOWEL QOO TYPE ONE + key("\u17B2", moreKey("\u17B1"))) + .setKeysOfRow(2, + // U+1786: "ឆ" KHMER LETTER CHA + key("\u1786"), + // U+17B9: "ឹ" KHMER VOWEL SIGN Y + key("\u17B9"), + // U+17C1: "េ" KHMER VOWEL SIGN E + key("\u17C1"), + // U+179A: "រ" KHMER LETTER RO + key("\u179A"), + // U+178F: "ត" KHMER LETTER TA + key("\u178F"), + // U+1799: "យ" KHMER LETTER YO + key("\u1799"), + // U+17BB: "ុ" KHMER VOWEL SIGN U + key("\u17BB"), + // U+17B7: "ិ" KHMER VOWEL SIGN I + key("\u17B7"), + // U+17C4: "ោ" KHMER VOWEL SIGN OO + key("\u17C4"), + // U+1795: "ផ" KHMER LETTER PHA + key("\u1795"), + // U+17C0: "ៀ" KHMER VOWEL SIGN IE + key("\u17C0"), + // U+17AA: "ឪ" KHMER INDEPENDENT VOWEL QUUV + // U+17A7: "ឧ" KHMER INDEPENDENT VOWEL QU + // U+17B1: "ឱ" KHMER INDEPENDENT VOWEL QOO TYPE ONE + // U+17B3: "ឳ" KHMER INDEPENDENT VOWEL QAU + // U+17A9: "ឩ" KHMER INDEPENDENT VOWEL QUU + // U+17A8: "ឨ" KHMER INDEPENDENT VOWEL QUK + key("\u17AA", joinMoreKeys("\u17A7", "\u17B1", "\u17B3", "\u17A9", "\u17A8"))) + .setKeysOfRow(3, + // U+17B6: "ា" KHMER VOWEL SIGN AA + key("\u17B6"), + // U+179F: "ស" KHMER LETTER SA + key("\u179F"), + // U+178A: "ដ" KHMER LETTER DA + key("\u178A"), + // U+1790: "ថ" KHMER LETTER THA + key("\u1790"), + // U+1784: "ង" KHMER LETTER NGO + key("\u1784"), + // U+17A0: "ហ" KHMER LETTER HA + key("\u17A0"), + // U+17D2: "្" KHMER SIGN COENG + key("\u17D2"), + // U+1780: "ក" KHMER LETTER KA + key("\u1780"), + // U+179B: "ល" KHMER LETTER LO + key("\u179B"), + // U+17BE: "ើ" KHMER VOWEL SIGN OE + key("\u17BE"), + // U+17CB: "់" KHMER SIGN BANTOC + key("\u17CB"), + // U+17AE: "ឮ" KHMER INDEPENDENT VOWEL LYY + // U+17AD: "ឭ" KHMER INDEPENDENT VOWEL LY + // U+17B0: "ឰ" KHMER INDEPENDENT VOWEL QAI + key("\u17AE", joinMoreKeys("\u17AD", "\u17B0"))) + .setLabelsOfRow(4, + // U+178B: "ឋ" KHMER LETTER TTHA + // U+1781: "ខ" KHMER LETTER KHA + // U+1785: "ច" KHMER LETTER CA + // U+179C: "វ" KHMER LETTER VO + // U+1794: "ប" KHMER LETTER BA + // U+1793: "ន" KHMER LETTER NO + // U+1798: "ម" KHMER LETTER MO + // U+17BB/U+17C6: "ុំ" KHMER VOWEL SIGN U/KHMER SIGN NIKAHIT + // U+17D4: "។" KHMER SIGN KHAN + // U+17CA: "៊" KHMER SIGN TRIISAP + "\u178B", "\u1781", "\u1785", "\u179C", "\u1794", "\u1793", "\u1798", + "\u17BB\u17C6", "\u17D4", "\u17CA") + .build(); + + private static final ExpectedKey[][] ALPHABET_SHIFTED_COMMON = new ExpectedKeyboardBuilder() + .setKeysOfRow(1, + key("!", ZWJ_KEY), + // U+17D7: "ៗ" KHMER SIGN LEK TOO + key("\u17D7", ZWNJ_KEY), + // U+17D1: "៑" KHMER SIGN VIRIAM + key("\"", moreKey("\u17D1")), + // U+17DB: "៛" KHMER CURRENCY SYMBOL RIEL + key("\u17DB", joinMoreKeys(Symbols.DOLLAR_SIGN, Symbols.EURO_SIGN)), + // U+17D6: "៖" KHMER SIGN CAMNUC PII KUUH + key("%", moreKey("\u17D6")), + // U+17CD: "៍" KHMER SIGN TOANDAKHIAT + // U+17D9: "៙" KHMER SIGN PHNAEK MUAN + key("\u17CD", moreKey("\u17D9")), + // U+17D0: "័" KHMER SIGN SAMYOK SANNYA + // U+17DA: "៚" KHMER SIGN KOOMUUT + key("\u17D0", moreKey("\u17DA")), + // U+17CF: "៏" KHMER SIGN AHSDA + key("\u17CF", moreKey("*")), + // U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + key("(", joinMoreKeys("{", "\u00AB")), + // U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + key(")", joinMoreKeys("}", "\u00BB")), + // U+17CC: "៌" KHMER SIGN ROBAT + // U+00D7: "×" MULTIPLICATION SIGN + key("\u17CC", moreKey("\u00D7")), + // U+17CE: "៎" KHMER SIGN KAKABAT + key("\u17CE")) + .setKeysOfRow(2, + // U+1788: "ឈ" KHMER LETTER CHO + // U+17DC: "ៜ" KHMER SIGN AVAKRAHASANYA + key("\u1788", moreKey("\u17DC")), + // U+17BA: "ឺ" KHMER VOWEL SIGN YY + // U+17DD: "៝" KHMER SIGN ATTHACAN + key("\u17BA", moreKey("\u17DD")), + // U+17C2: "ែ" KHMER VOWEL SIGN AE + key("\u17C2"), + // U+17AC: "ឬ" KHMER INDEPENDENT VOWEL RYY + // U+17AB: "ឫ" KHMER INDEPENDENT VOWEL RY + key("\u17AC", moreKey("\u17AB")), + // U+1791: "ទ" KHMER LETTER TO + key("\u1791"), + // U+17BD: "ួ" KHMER VOWEL SIGN UA + key("\u17BD"), + // U+17BC: "ូ" KHMER VOWEL SIGN UU + key("\u17BC"), + // U+17B8: "ី" KHMER VOWEL SIGN II + key("\u17B8"), + // U+17C5: "ៅ" KHMER VOWEL SIGN AU + key("\u17C5"), + // U+1797: "ភ" KHMER LETTER PHO + key("\u1797"), + // U+17BF: "ឿ" KHMER VOWEL SIGN YA + key("\u17BF"), + // U+17B0: "ឰ" KHMER INDEPENDENT VOWEL QAI + key("\u17B0")) + .setKeysOfRow(3, + // U+17B6/U+17C6: "ាំ" KHMER VOWEL SIGN AA/KHMER SIGN NIKAHIT + key("\u17B6\u17C6"), + // U+17C3: "ៃ" KHMER VOWEL SIGN AI + key("\u17C3"), + // U+178C: "ឌ" KHMER LETTER DO + key("\u178C"), + // U+1792: "ធ" KHMER LETTER THO + key("\u1792"), + // U+17A2: "អ" KHMER LETTER QAE + key("\u17A2"), + // U+17C7: "ះ" KHMER SIGN REAHMUK + // U+17C8: "ៈ" KHMER SIGN YUUKALEAPINTU + key("\u17C7", moreKey("\u17C8")), + // U+1789: "ញ" KHMER LETTER NYO + key("\u1789"), + // U+1782: "គ" KHMER LETTER KO + // U+179D: "ឝ" KHMER LETTER SHA + key("\u1782", moreKey("\u179D")), + // U+17A1: "ឡ" KHMER LETTER LA + key("\u17A1"), + // U+17C4/U+17C7: "ោះ" KHMER VOWEL SIGN OO/KHMER SIGN REAHMUK + key("\u17C4\u17C7"), + // U+17C9: "៉" KHMER SIGN MUUSIKATOAN + key("\u17C9"), + // U+17AF: "ឯ" KHMER INDEPENDENT VOWEL QE + key("\u17AF")) + .setKeysOfRow(4, + // U+178D: "ឍ" KHMER LETTER TTHO + key("\u178D"), + // U+1783: "ឃ" KHMER LETTER KHO + key("\u1783"), + // U+1787: "ជ" KHMER LETTER CO + key("\u1787"), + // U+17C1/U+17C7: "េះ" KHMER VOWEL SIGN E/KHMER SIGN REAHMUK + key("\u17C1\u17C7"), + // U+1796: "ព" KHMER LETTER PO + // U+179E: "ឞ" KHMER LETTER SSO + key("\u1796", moreKey("\u179E")), + // U+178E: "ណ" KHMER LETTER NNO + key("\u178E"), + // U+17C6: "ំ" KHMER SIGN NIKAHIT + key("\u17C6"), + // U+17BB/U+17C7: "ុះ" KHMER VOWEL SIGN U/KHMER SIGN REAHMUK + key("\u17BB\u17C7"), + // U+17D5: "៕" KHMER SIGN BARIYOOSAN + key("\u17D5"), + key("?")) + .build(); +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Lao.java b/tests/src/com/android/inputmethod/keyboard/layout/Lao.java new file mode 100644 index 000000000..488905504 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/Lao.java @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout; + +import com.android.inputmethod.keyboard.KeyboardId; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; +import com.android.inputmethod.latin.Constants; + +import java.util.Locale; + +/** + * The Khmer alphabet keyboard. + */ +public final class Lao extends LayoutBase { + private static final String LAYOUT_NAME = "lao"; + + public Lao(final LayoutCustomizer customizer) { + super(customizer, Symbols.class, SymbolsShifted.class); + } + + @Override + public String getName() { return LAYOUT_NAME; } + + public static class LaoCustomizer extends LayoutCustomizer { + public LaoCustomizer(final Locale locale) { super(locale); } + + @Override + public ExpectedKey getAlphabetKey() { return LAO_ALPHABET_KEY; } + + @Override + public ExpectedKey getCurrencyKey() { return CURRENCY_KIP; } + + @Override + public ExpectedKey[] getOtherCurrencyKeys() { + return SymbolsShifted.CURRENCIES_OTHER_GENERIC; + } + + @Override + public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { return EMPTY_KEYS; } + + // U+0E81: "ກ" LAO LETTER KO + // U+0E82: "ຂ" LAO LETTER KHO SUNG + // U+0E84: "ຄ" LAO LETTER KHO TAM + private static final ExpectedKey LAO_ALPHABET_KEY = key( + "\u0E81\u0E82\u0E84", Constants.CODE_SWITCH_ALPHA_SYMBOL); + + // U+20AD: "₭" KIP SIGN + private static final ExpectedKey CURRENCY_KIP = key("\u20AD", + Symbols.CURRENCY_GENERIC_MORE_KEYS); + } + + @Override + ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { + if (isPhone) { + return ALPHABET_COMMON; + } + final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(ALPHABET_COMMON); + builder.addKeysOnTheRightOfRow(4, EXCLAMATION_AND_QUESTION_MARKS); + return builder.build(); + } + + @Override + public ExpectedKey[][] getCommonAlphabetShiftLayout(final boolean isPhone, + final int elementId) { + if (elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) { + return getCommonAlphabetLayout(isPhone); + } + return ALPHABET_SHIFTED_COMMON; + } + + // Helper method to create alphabet layout by adding special function keys. + @Override + ExpectedKeyboardBuilder convertCommonLayoutToKeyboard(final ExpectedKeyboardBuilder builder, + final boolean isPhone) { + final LayoutCustomizer customizer = getCustomizer(); + final ExpectedKey[] spacebar = joinKeys( + customizer.getKeysLeftToSpacebar(isPhone), + customizer.getSpaceKeys(isPhone), + customizer.getKeysRightToSpacebar(isPhone)); + builder.setKeysOfRow(5, spacebar); + if (isPhone) { + builder.addKeysOnTheRightOfRow(4, DELETE_KEY) + .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey()) + .addKeysOnTheRightOfRow(5, key(ENTER_KEY, EMOJI_KEY)); + } else { + builder.addKeysOnTheRightOfRow(1, DELETE_KEY) + .addKeysOnTheRightOfRow(3, ENTER_KEY) + .addKeysOnTheLeftOfRow(5, customizer.getSymbolsKey(), SETTINGS_KEY) + .addKeysOnTheRightOfRow(5, EMOJI_KEY); + } + builder.addKeysOnTheLeftOfRow(4, customizer.getLeftShiftKeys(isPhone)) + .addKeysOnTheRightOfRow(4, customizer.getRightShiftKeys(isPhone)); + return builder; + } + + private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() + .setKeysOfRow(1, + // U+0EA2: "ຢ" LAO LETTER YO + // U+0ED1: "໑" LAO DIGIT ONE + key("\u0EA2", joinMoreKeys("1", "\u0ED1")), + // U+0E9F: "ຟ" LAO LETTER FO SUNG + // U+0ED2: "໒" LAO DIGIT TWO + key("\u0E9F", joinMoreKeys("2", "\u0ED2")), + // U+0EC2: "ໂ" LAO VOWEL SIGN O + // U+0ED3: "໓" LAO DIGIT THREE + key("\u0EC2", joinMoreKeys("3", "\u0ED3")), + // U+0E96: "ຖ" LAO LETTER THO SUNG + // U+0ED4: "໔" LAO DIGIT FOUR + key("\u0E96", joinMoreKeys("4", "\u0ED4")), + // U+0EB8: "ຸ" LAO VOWEL SIGN U + key("\u0EB8"), + // U+0EB9: "ູ" LAO VOWEL SIGN UU + key("\u0EB9"), + // U+0E84: "ຄ" LAO LETTER KHO TAM + // U+0ED5: "໕" LAO DIGIT FIVE + key("\u0E84", joinMoreKeys("5", "\u0ED5")), + // U+0E95: "ຕ" LAO LETTER TO + // U+0ED6: "໖" LAO DIGIT SIX + key("\u0E95", joinMoreKeys("6", "\u0ED6")), + // U+0E88: "ຈ" LAO LETTER CO + // U+0ED7: "໗" LAO DIGIT SEVEN + key("\u0E88", joinMoreKeys("7", "\u0ED7")), + // U+0E82: "ຂ" LAO LETTER KHO SUNG + // U+0ED8: "໘" LAO DIGIT EIGHT + key("\u0E82", joinMoreKeys("8", "\u0ED8")), + // U+0E8A: "ຊ" LAO LETTER SO TAM + // U+0ED9: "໙" LAO DIGIT NINE + key("\u0E8A", joinMoreKeys("9", "\u0ED9")), + // U+0ECD: "ໍ" LAO NIGGAHITA + key("\u0ECD")) + .setKeysOfRow(2, + // U+0EBB: "ົ" LAO VOWEL SIGN MAI KON + key("\u0EBB"), + // U+0EC4: "ໄ" LAO VOWEL SIGN AI + // U+0ED0: "໐" LAO DIGIT ZERO + key("\u0EC4", joinMoreKeys("0", "\u0ED0")), + // U+0EB3: "ຳ" LAO VOWEL SIGN AM + key("\u0EB3"), + // U+0E9E: "ພ" LAO LETTER PHO TAM + key("\u0E9E"), + // U+0EB0: "ະ" LAO VOWEL SIGN A + key("\u0EB0"), + // U+0EB4: "ິ" LAO VOWEL SIGN I + key("\u0EB4"), + // U+0EB5: "ີ" LAO VOWEL SIGN II + key("\u0EB5"), + // U+0EAE: "ຮ" LAO LETTER HO TAM + key("\u0EAE"), + // U+0E99: "ນ" LAO LETTER NO + key("\u0E99"), + // U+0E8D: "ຍ" LAO LETTER NYO + key("\u0E8D"), + // U+0E9A: "ບ" LAO LETTER BO + key("\u0E9A"), + // U+0EA5: "ລ" LAO LETTER LO LOOT + key("\u0EA5")) + .setLabelsOfRow(3, + // U+0EB1: "ັ" LAO VOWEL SIGN MAI KAN + // U+0EAB: "ຫ" LAO LETTER HO SUNG + // U+0E81: "ກ" LAO LETTER KO + // U+0E94: "ດ" LAO LETTER DO + // U+0EC0: "ເ" LAO VOWEL SIGN E + // U+0EC9: "້" LAO TONE MAI THO + // U+0EC8: "່" LAO TONE MAI EK + // U+0EB2: "າ" LAO VOWEL SIGN AA + // U+0EAA: "ສ" LAO LETTER SO SUNG + // U+0EA7: "ວ" LAO LETTER WO + // U+0E87: "ງ" LAO LETTER NGO + // U+201C: "“" LEFT DOUBLE QUOTATION MARK + "\u0EB1", "\u0EAB", "\u0E81", "\u0E94", "\u0EC0", "\u0EC9", "\u0EC8", "\u0EB2", + "\u0EAA", "\u0EA7", "\u0E87", "\u201C") + .setLabelsOfRow(4, + // U+0E9C: "ຜ" LAO LETTER PHO SUNG + // U+0E9B: "ປ" LAO LETTER PO + // U+0EC1: "ແ" LAO VOWEL SIGN EI + // U+0EAD: "ອ" LAO LETTER O + // U+0EB6: "ຶ" LAO VOWEL SIGN Y + // U+0EB7: "ື" LAO VOWEL SIGN YY + // U+0E97: "ທ" LAO LETTER THO TAM + // U+0EA1: "ມ" LAO LETTER MO + // U+0EC3: "ໃ" LAO VOWEL SIGN AY + // U+0E9D: "ຝ" LAO LETTER FO TAM + "\u0E9C", "\u0E9B", "\u0EC1", "\u0EAD", "\u0EB6", "\u0EB7", "\u0E97", "\u0EA1", + "\u0EC3", "\u0E9D") + .build(); + + private static final ExpectedKey[][] ALPHABET_SHIFTED_COMMON = new ExpectedKeyboardBuilder() + .setLabelsOfRow(1, + // U+0ED1: "໑" LAO DIGIT ONE + // U+0ED2: "໒" LAO DIGIT TWO + // U+0ED3: "໓" LAO DIGIT THREE + // U+0ED4: "໔" LAO DIGIT FOUR + // U+0ECC: "໌" LAO CANCELLATION MARK + // U+0EBC: "ຼ" LAO SEMIVOWEL SIGN LO + // U+0ED5: "໕" LAO DIGIT FIVE + // U+0ED6: "໖" LAO DIGIT SIX + // U+0ED7: "໗" LAO DIGIT SEVEN + // U+0ED8: "໘" LAO DIGIT EIGHT + // U+0ED9: "໙" LAO DIGIT NINE + // U+0ECD/U+0EC8: "ໍ່" LAO NIGGAHITA/LAO TONE MAI EK + "\u0ED1", "\u0ED2", "\u0ED3", "\u0ED4", "\u0ECC", "\u0EBC", "\u0ED5", "\u0ED6", + "\u0ED7", "\u0ED8", "\u0ED9", "\u0ECD\u0EC8") + .setLabelsOfRow(2, + // U+0EBB/U+0EC9: "" LAO VOWEL SIGN MAI KON/LAO TONE MAI THO + // U+0ED0: "໐" LAO DIGIT ZERO + // U+0EB3/U+0EC9: "ຳ້" LAO VOWEL SIGN AM/LAO TONE MAI THO + // U+0EB4/U+0EC9: "ິ້" LAO VOWEL SIGN I/LAO TONE MAI THO + // U+0EB5/U+0EC9: "ີ້" LAO VOWEL SIGN II/LAO TONE MAI THO + // U+0EA3: "ຣ" LAO LETTER LO LING + // U+0EDC: "ໜ" LAO HO NO + // U+0EBD: "ຽ" LAO SEMIVOWEL SIGN NYO + // U+0EAB/U+0EBC: "" LAO LETTER HO SUNG/LAO SEMIVOWEL SIGN LO + // U+201D: "”" RIGHT DOUBLE QUOTATION MARK + "\u0EBB\u0EC9", "\u0ED0", "\u0EB3\u0EC9", "_", "+", "\u0EB4\u0EC9", + "\u0EB5\u0EC9", "\u0EA3", "\u0EDC", "\u0EBD", "\u0EAB\u0EBC", "\u201D") + .setLabelsOfRow(3, + // U+0EB1/U+0EC9: "ັ້" LAO VOWEL SIGN MAI KAN/LAO TONE MAI THO + // U+0ECA: "໊" LAO TONE MAI TI + // U+0ECB: "໋" LAO TONE MAI CATAWA + // U+201C: "“" LEFT DOUBLE QUOTATION MARK + "\u0EB1\u0EC9", ";", ".", ",", ":", "\u0ECA", "\u0ECB", "!", "?", "%", "=", + "\u201C") + .setLabelsOfRow(4, + // U+20AD: "₭" KIP SIGN + // U+0EAF: "ຯ" LAO ELLIPSIS + // U+0EB6/U+0EC9: "ຶ້" LAO VOWEL SIGN Y/LAO TONE MAI THO + // U+0EB7/U+0EC9: "ື້" LAO VOWEL SIGN YY/LAO TONE MAI THO + // U+0EC6: "ໆ" LAO KO LA + // U+0EDD: "ໝ" LAO HO MO + "\u20AD", "(", "\u0EAF", "@", "\u0EB6\u0EC9", "\u0EB7\u0EC9", "\u0EC6", + "\u0EDD", "$", ")") + .build(); +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java index 2c1ac2e4f..982777bd6 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java @@ -265,7 +265,8 @@ public abstract class LayoutBase extends AbstractLayoutBase { key("!", moreKey("\u00A1")), key("?", moreKey("\u00BF"))); // U+200C: ZERO WIDTH NON-JOINER // U+200D: ZERO WIDTH JOINER - static final ExpectedKey ZWNJ_ZWJ_KEY = key(ICON_ZWNJ, "\u200C", moreKey(ICON_ZWJ, "\u200D")); + static final ExpectedKey ZWNJ_KEY = key(ICON_ZWNJ, "\u200C"); + static final ExpectedKey ZWJ_KEY = key(ICON_ZWJ, "\u200D"); // Punctuation more keys for phone form factor. public static final ExpectedKey[] PHONE_PUNCTUATION_MORE_KEYS = joinKeys( diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Mongolian.java b/tests/src/com/android/inputmethod/keyboard/layout/Mongolian.java new file mode 100644 index 000000000..3c9f4a06d --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/Mongolian.java @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout; + +import com.android.inputmethod.keyboard.layout.EastSlavic.EastSlavicCustomizer; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; +import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; + +import java.util.Locale; + +public final class Mongolian extends LayoutBase { + private static final String LAYOUT_NAME = "mongolian"; + + public Mongolian(final LayoutCustomizer customizer) { + super(customizer, Symbols.class, SymbolsShifted.class); + } + + @Override + public String getName() { return LAYOUT_NAME; } + + public static class MongolianMNCustomizer extends EastSlavicCustomizer { + public MongolianMNCustomizer(final Locale locale) { + super(locale); + } + + @Override + public ExpectedKey getCurrencyKey() { return CURRENCY_TUGRIK; } + + @Override + public ExpectedKey[] getOtherCurrencyKeys() { + return SymbolsShifted.CURRENCIES_OTHER_GENERIC; + } + + // U+20AE: "₮" TUGRIK SIGN + private static final ExpectedKey CURRENCY_TUGRIK = key("\u20AE", + Symbols.CURRENCY_GENERIC_MORE_KEYS); + } + + @Override + ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; } + + private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() + .setKeysOfRow(1, + // U+0444: "ф" CYRILLIC SMALL LETTER EF + key("\u0444", moreKey("1")), + // U+0446: "ц" CYRILLIC SMALL LETTER TSE + key("\u0446", moreKey("2")), + // U+0443: "у" CYRILLIC SMALL LETTER U + key("\u0443", moreKey("3")), + // U+0436: "ж" CYRILLIC SMALL LETTER ZHE + key("\u0436", moreKey("4")), + // U+044D: "э" CYRILLIC SMALL LETTER E + key("\u044D", moreKey("5")), + // U+043D: "н" CYRILLIC SMALL LETTER EN + key("\u043D", moreKey("6")), + // U+0433: "г" CYRILLIC SMALL LETTER GHE + key("\u0433", moreKey("7")), + // U+0448: "ш" CYRILLIC SMALL LETTER SHA + // U+0449: "щ" CYRILLIC SMALL LETTER SHCHA + key("\u0448", joinMoreKeys("8", "\u0449")), + // U+04AF: "ү" CYRILLIC SMALL LETTER STRAIGHT U + key("\u04AF", moreKey("9")), + // U+0437: "з" CYRILLIC SMALL LETTER ZE + key("\u0437", moreKey("0")), + // U+043A: "к" CYRILLIC SMALL LETTER KA + key("\u043A")) + // U+0439: "й" CYRILLIC SMALL LETTER SHORT I + // U+044B: "ы" CYRILLIC SMALL LETTER YERU + // U+0431: "б" CYRILLIC SMALL LETTER BE + // U+04E9: "ө" CYRILLIC SMALL LETTER BARRED O + // U+0430: "а" CYRILLIC SMALL LETTER A + // U+0445: "х" CYRILLIC SMALL LETTER HA + // U+0440: "р" CYRILLIC SMALL LETTER ER + // U+043E: "о" CYRILLIC SMALL LETTER O + // U+043B: "л" CYRILLIC SMALL LETTER EL + // U+0434: "д" CYRILLIC SMALL LETTER DE + // U+043F: "п" CYRILLIC SMALL LETTER PE + .setLabelsOfRow(2, + "\u0439", "\u044B", "\u0431", "\u04E9", "\u0430", "\u0445", "\u0440", "\u043E", + "\u043B", "\u0434", "\u043F") + .setKeysOfRow(3, + // U+044F: "я" CYRILLIC SMALL LETTER YA + key("\u044F"), + // U+0447: "ч" CYRILLIC SMALL LETTER CHE + key("\u0447"), + // U+0451: "ё" CYRILLIC SMALL LETTER IO + // U+0435: "е" CYRILLIC SMALL LETTER IE + key("\u0451", moreKey("\u0435")), + // U+0441: "с" CYRILLIC SMALL LETTER ES + key("\u0441"), + // U+043C: "м" CYRILLIC SMALL LETTER EM + key("\u043C"), + // U+0438: "и" CYRILLIC SMALL LETTER I + key("\u0438"), + // U+0442: "т" CYRILLIC SMALL LETTER TE + key("\u0442"), + // U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN + // U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN + key("\u044C", moreKey("\u044A")), + // U+0432: "в" CYRILLIC SMALL LETTER VE + // U+044E: "ю" CYRILLIC SMALL LETTER YU + key("\u0432", moreKey("\u044E"))) + .build(); +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java b/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java index 29258945e..c0bc29f2a 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/NepaliRomanized.java @@ -45,7 +45,7 @@ public final class NepaliRomanized extends LayoutBase { @Override public ExpectedKey[] getSpaceKeys(final boolean isPhone) { - return joinKeys(SPACE_KEY, ZWNJ_ZWJ_KEY); + return joinKeys(SPACE_KEY, key(ZWNJ_KEY, ZWJ_KEY)); } // U+0930/U+0941/U+002E "रु." NEPALESE RUPEE SIGN diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java b/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java index 127d81aad..9ce418770 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java @@ -74,6 +74,9 @@ public class Symbols extends AbstractLayoutBase { CENT_SIGN, POUND_SIGN, EURO_SIGN, YEN_SIGN, PESO_SIGN); public static final ExpectedKey CURRENCY_EURO = key("\u20AC", CENT_SIGN, POUND_SIGN, DOLLAR_SIGN, YEN_SIGN, PESO_SIGN); + public static final ExpectedKey[] CURRENCY_GENERIC_MORE_KEYS = joinMoreKeys( + Symbols.DOLLAR_SIGN, Symbols.CENT_SIGN, Symbols.EURO_SIGN, Symbols.POUND_SIGN, + Symbols.YEN_SIGN, Symbols.PESO_SIGN); // Variations of the "double quote" key's "more keys" on the 3rd row. public static final String DOUBLE_QUOTE = "DOUBLE_QUOTE"; diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Thai.java b/tests/src/com/android/inputmethod/keyboard/layout/Thai.java index 747e0aa31..64081a138 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/Thai.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/Thai.java @@ -61,8 +61,7 @@ public final class Thai extends LayoutBase { // U+0E3F: "฿" THAI CURRENCY SYMBOL BAHT private static final ExpectedKey CURRENCY_BAHT = key("\u0E3F", - Symbols.DOLLAR_SIGN, Symbols.CENT_SIGN, Symbols.EURO_SIGN, Symbols.POUND_SIGN, - Symbols.YEN_SIGN, Symbols.PESO_SIGN); + Symbols.CURRENCY_GENERIC_MORE_KEYS); } @Override diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArabic.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArabic.java index 7c97df5af..fd7670827 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArabic.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsArabic.java @@ -25,7 +25,7 @@ import com.android.inputmethod.keyboard.layout.LayoutBase; import java.util.Locale; /** - * ar: TestsArabic/arabic + * ar: Arabic/arabic */ @SmallTest public class TestsArabic extends LayoutTestsBase { diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGeorgianGE.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGeorgianGE.java new file mode 100644 index 000000000..f25942fb5 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsGeorgianGE.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout.tests; + +import android.test.suitebuilder.annotation.SmallTest; + +import com.android.inputmethod.keyboard.layout.Georgian; +import com.android.inputmethod.keyboard.layout.Georgian.GeorgianCustomizer; +import com.android.inputmethod.keyboard.layout.LayoutBase; + +import java.util.Locale; + +/** + * ka_GE: Georgian (Georgia)/georgian + */ +@SmallTest +public final class TestsGeorgianGE extends LayoutTestsBase { + private static final Locale LOCALE = new Locale("ka", "GE"); + private static final LayoutBase LAYOUT = new Georgian(new GeorgianCustomizer(LOCALE)); + + @Override + LayoutBase getLayout() { return LAYOUT; } +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHebrew.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHebrew.java new file mode 100644 index 000000000..c0243a870 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsHebrew.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout.tests; + +import android.test.suitebuilder.annotation.SmallTest; + +import com.android.inputmethod.keyboard.layout.Hebrew; +import com.android.inputmethod.keyboard.layout.Hebrew.HebrewCustomizer; +import com.android.inputmethod.keyboard.layout.LayoutBase; + +import java.util.Locale; + +/** + * iw: Hebrew/hebrew + */ +@SmallTest +public class TestsHebrew extends LayoutTestsBase { + private static final Locale LOCALE = new Locale("iw"); + private static final LayoutBase LAYOUT = new Hebrew(new HebrewCustomizer(LOCALE)); + + @Override + LayoutBase getLayout() { return LAYOUT; } +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKhmerKH.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKhmerKH.java new file mode 100644 index 000000000..df2f40d86 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsKhmerKH.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout.tests; + +import android.test.suitebuilder.annotation.SmallTest; + +import com.android.inputmethod.keyboard.layout.Khmer; +import com.android.inputmethod.keyboard.layout.Khmer.KhmerCustomizer; +import com.android.inputmethod.keyboard.layout.LayoutBase; + +import java.util.Locale; + +/** + * km_KH: Khmer (Cambodia)/khmer + */ +@SmallTest +public final class TestsKhmerKH extends LayoutTestsBase { + private static final Locale LOCALE = new Locale("km", "KH"); + private static final LayoutBase LAYOUT = new Khmer(new KhmerCustomizer(LOCALE)); + + @Override + LayoutBase getLayout() { return LAYOUT; } +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLaoLA.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLaoLA.java new file mode 100644 index 000000000..34ad1fb7f --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsLaoLA.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout.tests; + +import android.test.suitebuilder.annotation.SmallTest; + +import com.android.inputmethod.keyboard.layout.Lao; +import com.android.inputmethod.keyboard.layout.Lao.LaoCustomizer; +import com.android.inputmethod.keyboard.layout.LayoutBase; + +import java.util.Locale; + +/** + * lo_LA: Lao (Laos)/lao + */ +@SmallTest +public final class TestsLaoLA extends LayoutTestsBase { + private static final Locale LOCALE = new Locale("lo", "LA"); + private static final LayoutBase LAYOUT = new Lao(new LaoCustomizer(LOCALE)); + + @Override + LayoutBase getLayout() { return LAYOUT; } +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMongolianMN.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMongolianMN.java new file mode 100644 index 000000000..e28e962f9 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsMongolianMN.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout.tests; + +import android.test.suitebuilder.annotation.SmallTest; + +import com.android.inputmethod.keyboard.layout.LayoutBase; +import com.android.inputmethod.keyboard.layout.Mongolian; +import com.android.inputmethod.keyboard.layout.Mongolian.MongolianMNCustomizer; + +import java.util.Locale; + +/** + * mn_MN: Mongolian (Mongolia)/mongolian + */ +@SmallTest +public final class TestsMongolianMN extends LayoutTestsBase { + private static final Locale LOCALE = new Locale("mn", "MN"); + private static final LayoutBase LAYOUT = new Mongolian(new MongolianMNCustomizer(LOCALE)); + + @Override + LayoutBase getLayout() { return LAYOUT; } +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPersian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPersian.java new file mode 100644 index 000000000..b7d75c9f0 --- /dev/null +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsPersian.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.layout.tests; + +import android.test.suitebuilder.annotation.SmallTest; + +import com.android.inputmethod.keyboard.layout.Farsi; +import com.android.inputmethod.keyboard.layout.Farsi.FarsiCustomizer; +import com.android.inputmethod.keyboard.layout.LayoutBase; + +import java.util.Locale; + +/** + * fa: Persian/farsi + */ +@SmallTest +public class TestsPersian extends LayoutTestsBase { + private static final Locale LOCALE = new Locale("fa"); + private static final LayoutBase LAYOUT = new Farsi(new FarsiCustomizer(LOCALE)); + + @Override + LayoutBase getLayout() { return LAYOUT; } +} diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUkrainian.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUkrainian.java index 20749d675..27893fe9b 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUkrainian.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsUkrainian.java @@ -58,8 +58,7 @@ public final class TestsUkrainian extends LayoutTestsBase { // U+20B4: "₴" HRYVNIA SIGN private static final ExpectedKey CURRENCY_HRYVNIA = key("\u20B4", - Symbols.DOLLAR_SIGN, Symbols.CENT_SIGN, Symbols.EURO_SIGN, Symbols.POUND_SIGN, - Symbols.YEN_SIGN, Symbols.PESO_SIGN); + Symbols.CURRENCY_GENERIC_MORE_KEYS); @Override public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) { diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsVietnamese.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsVietnamese.java index 94b0c1f3b..96ae38a9c 100644 --- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsVietnamese.java +++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsVietnamese.java @@ -54,8 +54,7 @@ public final class TestsVietnamese extends LayoutTestsBase { // U+20AB: "₫" DONG SIGN private static final ExpectedKey CURRENCY_DONG = key("\u20AB", - Symbols.DOLLAR_SIGN, Symbols.CENT_SIGN, Symbols.EURO_SIGN, Symbols.POUND_SIGN, - Symbols.YEN_SIGN, Symbols.PESO_SIGN); + Symbols.CURRENCY_GENERIC_MORE_KEYS); @Override public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) { |