1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.inputmethod.keyboard.layout; 18 19 import com.android.inputmethod.keyboard.KeyboardId; 20 import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; 21 import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; 22 import com.android.inputmethod.latin.Constants; 23 24 import java.util.Locale; 25 26 /** 27 * The Khmer alphabet keyboard. 28 */ 29 public final class Lao extends LayoutBase { 30 private static final String LAYOUT_NAME = "lao"; 31 Lao(final LayoutCustomizer customizer)32 public Lao(final LayoutCustomizer customizer) { 33 super(customizer, Symbols.class, SymbolsShifted.class); 34 } 35 36 @Override getName()37 public String getName() { return LAYOUT_NAME; } 38 39 public static class LaoCustomizer extends LayoutCustomizer { LaoCustomizer(final Locale locale)40 public LaoCustomizer(final Locale locale) { super(locale); } 41 42 @Override getNumberOfRows()43 public int getNumberOfRows() { return 5; } 44 45 @Override getAlphabetKey()46 public ExpectedKey getAlphabetKey() { return LAO_ALPHABET_KEY; } 47 48 @Override getCurrencyKey()49 public ExpectedKey getCurrencyKey() { return CURRENCY_KIP; } 50 51 @Override getOtherCurrencyKeys()52 public ExpectedKey[] getOtherCurrencyKeys() { 53 return SymbolsShifted.CURRENCIES_OTHER_GENERIC; 54 } 55 56 @Override getRightShiftKeys(final boolean isPhone)57 public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { return EMPTY_KEYS; } 58 59 // U+0E81: "ກ" LAO LETTER KO 60 // U+0E82: "ຂ" LAO LETTER KHO SUNG 61 // U+0E84: "ຄ" LAO LETTER KHO TAM 62 private static final ExpectedKey LAO_ALPHABET_KEY = key( 63 "\u0E81\u0E82\u0E84", Constants.CODE_SWITCH_ALPHA_SYMBOL); 64 65 // U+20AD: "₭" KIP SIGN 66 private static final ExpectedKey CURRENCY_KIP = key("\u20AD", 67 Symbols.CURRENCY_GENERIC_MORE_KEYS); 68 } 69 70 @Override getCommonAlphabetLayout(final boolean isPhone)71 ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { 72 if (isPhone) { 73 return ALPHABET_COMMON; 74 } 75 final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(ALPHABET_COMMON); 76 builder.addKeysOnTheRightOfRow(4, (Object[])EXCLAMATION_AND_QUESTION_MARKS); 77 return builder.build(); 78 } 79 80 @Override getCommonAlphabetShiftLayout(final boolean isPhone, final int elementId)81 public ExpectedKey[][] getCommonAlphabetShiftLayout(final boolean isPhone, 82 final int elementId) { 83 if (elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) { 84 return getCommonAlphabetLayout(isPhone); 85 } 86 return ALPHABET_SHIFTED_COMMON; 87 } 88 89 private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() 90 .setKeysOfRow(1, 91 // U+0EA2: "ຢ" LAO LETTER YO 92 // U+0ED1: "໑" LAO DIGIT ONE 93 key("\u0EA2", joinMoreKeys("1", "\u0ED1")), 94 // U+0E9F: "ຟ" LAO LETTER FO SUNG 95 // U+0ED2: "໒" LAO DIGIT TWO 96 key("\u0E9F", joinMoreKeys("2", "\u0ED2")), 97 // U+0EC2: "ໂ" LAO VOWEL SIGN O 98 // U+0ED3: "໓" LAO DIGIT THREE 99 key("\u0EC2", joinMoreKeys("3", "\u0ED3")), 100 // U+0E96: "ຖ" LAO LETTER THO SUNG 101 // U+0ED4: "໔" LAO DIGIT FOUR 102 key("\u0E96", joinMoreKeys("4", "\u0ED4")), 103 // U+0EB8: "ຸ" LAO VOWEL SIGN U 104 // U+0EB9: "ູ" LAO VOWEL SIGN UU 105 "\u0EB8", "\u0EB9", 106 // U+0E84: "ຄ" LAO LETTER KHO TAM 107 // U+0ED5: "໕" LAO DIGIT FIVE 108 key("\u0E84", joinMoreKeys("5", "\u0ED5")), 109 // U+0E95: "ຕ" LAO LETTER TO 110 // U+0ED6: "໖" LAO DIGIT SIX 111 key("\u0E95", joinMoreKeys("6", "\u0ED6")), 112 // U+0E88: "ຈ" LAO LETTER CO 113 // U+0ED7: "໗" LAO DIGIT SEVEN 114 key("\u0E88", joinMoreKeys("7", "\u0ED7")), 115 // U+0E82: "ຂ" LAO LETTER KHO SUNG 116 // U+0ED8: "໘" LAO DIGIT EIGHT 117 key("\u0E82", joinMoreKeys("8", "\u0ED8")), 118 // U+0E8A: "ຊ" LAO LETTER SO TAM 119 // U+0ED9: "໙" LAO DIGIT NINE 120 key("\u0E8A", joinMoreKeys("9", "\u0ED9")), 121 // U+0ECD: "ໍ" LAO NIGGAHITA 122 "\u0ECD") 123 .setKeysOfRow(2, 124 // U+0EBB: "ົ" LAO VOWEL SIGN MAI KON 125 "\u0EBB", 126 // U+0EC4: "ໄ" LAO VOWEL SIGN AI 127 // U+0ED0: "໐" LAO DIGIT ZERO 128 key("\u0EC4", joinMoreKeys("0", "\u0ED0")), 129 // U+0EB3: "ຳ" LAO VOWEL SIGN AM 130 // U+0E9E: "ພ" LAO LETTER PHO TAM 131 // U+0EB0: "ະ" LAO VOWEL SIGN A 132 // U+0EB4: "ິ" LAO VOWEL SIGN I 133 // U+0EB5: "ີ" LAO VOWEL SIGN II 134 // U+0EAE: "ຮ" LAO LETTER HO TAM 135 // U+0E99: "ນ" LAO LETTER NO 136 // U+0E8D: "ຍ" LAO LETTER NYO 137 // U+0E9A: "ບ" LAO LETTER BO 138 // U+0EA5: "ລ" LAO LETTER LO LOOT 139 "\u0EB3", "\u0E9E", "\u0EB0", "\u0EB4", "\u0EB5", "\u0EAE", "\u0E99", "\u0E8D", 140 "\u0E9A", "\u0EA5") 141 .setKeysOfRow(3, 142 // U+0EB1: "ັ" LAO VOWEL SIGN MAI KAN 143 // U+0EAB: "ຫ" LAO LETTER HO SUNG 144 // U+0E81: "ກ" LAO LETTER KO 145 // U+0E94: "ດ" LAO LETTER DO 146 // U+0EC0: "ເ" LAO VOWEL SIGN E 147 // U+0EC9: "້" LAO TONE MAI THO 148 // U+0EC8: "່" LAO TONE MAI EK 149 // U+0EB2: "າ" LAO VOWEL SIGN AA 150 // U+0EAA: "ສ" LAO LETTER SO SUNG 151 // U+0EA7: "ວ" LAO LETTER WO 152 // U+0E87: "ງ" LAO LETTER NGO 153 // U+201C: "“" LEFT DOUBLE QUOTATION MARK 154 "\u0EB1", "\u0EAB", "\u0E81", "\u0E94", "\u0EC0", "\u0EC9", "\u0EC8", "\u0EB2", 155 "\u0EAA", "\u0EA7", "\u0E87", "\u201C") 156 .setKeysOfRow(4, 157 // U+0E9C: "ຜ" LAO LETTER PHO SUNG 158 // U+0E9B: "ປ" LAO LETTER PO 159 // U+0EC1: "ແ" LAO VOWEL SIGN EI 160 // U+0EAD: "ອ" LAO LETTER O 161 // U+0EB6: "ຶ" LAO VOWEL SIGN Y 162 // U+0EB7: "ື" LAO VOWEL SIGN YY 163 // U+0E97: "ທ" LAO LETTER THO TAM 164 // U+0EA1: "ມ" LAO LETTER MO 165 // U+0EC3: "ໃ" LAO VOWEL SIGN AY 166 // U+0E9D: "ຝ" LAO LETTER FO TAM 167 "\u0E9C", "\u0E9B", "\u0EC1", "\u0EAD", "\u0EB6", "\u0EB7", "\u0E97", "\u0EA1", 168 "\u0EC3", "\u0E9D") 169 .build(); 170 171 private static final ExpectedKey[][] ALPHABET_SHIFTED_COMMON = new ExpectedKeyboardBuilder() 172 .setKeysOfRow(1, 173 // U+0ED1: "໑" LAO DIGIT ONE 174 // U+0ED2: "໒" LAO DIGIT TWO 175 // U+0ED3: "໓" LAO DIGIT THREE 176 // U+0ED4: "໔" LAO DIGIT FOUR 177 // U+0ECC: "໌" LAO CANCELLATION MARK 178 // U+0EBC: "ຼ" LAO SEMIVOWEL SIGN LO 179 // U+0ED5: "໕" LAO DIGIT FIVE 180 // U+0ED6: "໖" LAO DIGIT SIX 181 // U+0ED7: "໗" LAO DIGIT SEVEN 182 // U+0ED8: "໘" LAO DIGIT EIGHT 183 // U+0ED9: "໙" LAO DIGIT NINE 184 // U+0ECD/U+0EC8: "ໍ່" LAO NIGGAHITA/LAO TONE MAI EK 185 "\u0ED1", "\u0ED2", "\u0ED3", "\u0ED4", "\u0ECC", "\u0EBC", "\u0ED5", "\u0ED6", 186 "\u0ED7", "\u0ED8", "\u0ED9", "\u0ECD\u0EC8") 187 .setKeysOfRow(2, 188 // U+0EBB/U+0EC9: "" LAO VOWEL SIGN MAI KON/LAO TONE MAI THO 189 // U+0ED0: "໐" LAO DIGIT ZERO 190 // U+0EB3/U+0EC9: "ຳ້" LAO VOWEL SIGN AM/LAO TONE MAI THO 191 // U+0EB4/U+0EC9: "ິ້" LAO VOWEL SIGN I/LAO TONE MAI THO 192 // U+0EB5/U+0EC9: "ີ້" LAO VOWEL SIGN II/LAO TONE MAI THO 193 // U+0EA3: "ຣ" LAO LETTER LO LING 194 // U+0EDC: "ໜ" LAO HO NO 195 // U+0EBD: "ຽ" LAO SEMIVOWEL SIGN NYO 196 // U+0EAB/U+0EBC: "" LAO LETTER HO SUNG/LAO SEMIVOWEL SIGN LO 197 // U+201D: "”" RIGHT DOUBLE QUOTATION MARK 198 "\u0EBB\u0EC9", "\u0ED0", "\u0EB3\u0EC9", "_", "+", "\u0EB4\u0EC9", 199 "\u0EB5\u0EC9", "\u0EA3", "\u0EDC", "\u0EBD", "\u0EAB\u0EBC", "\u201D") 200 .setKeysOfRow(3, 201 // U+0EB1/U+0EC9: "ັ້" LAO VOWEL SIGN MAI KAN/LAO TONE MAI THO 202 // U+0ECA: "໊" LAO TONE MAI TI 203 // U+0ECB: "໋" LAO TONE MAI CATAWA 204 // U+201C: "“" LEFT DOUBLE QUOTATION MARK 205 "\u0EB1\u0EC9", ";", ".", ",", ":", "\u0ECA", "\u0ECB", "!", "?", "%", "=", 206 "\u201C") 207 .setKeysOfRow(4, 208 // U+20AD: "₭" KIP SIGN 209 // U+0EAF: "ຯ" LAO ELLIPSIS 210 // U+0EB6/U+0EC9: "ຶ້" LAO VOWEL SIGN Y/LAO TONE MAI THO 211 // U+0EB7/U+0EC9: "ື້" LAO VOWEL SIGN YY/LAO TONE MAI THO 212 // U+0EC6: "ໆ" LAO KO LA 213 // U+0EDD: "ໝ" LAO HO MO 214 "\u20AD", "(", "\u0EAF", "@", "\u0EB6\u0EC9", "\u0EB7\u0EC9", "\u0EC6", 215 "\u0EDD", "$", ")") 216 .build(); 217 } 218