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.customizer.LayoutCustomizer; 21 import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; 22 import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; 23 import com.android.inputmethod.latin.common.Constants; 24 25 import java.util.Locale; 26 27 /** 28 * The Khmer alphabet keyboard. 29 */ 30 public final class Lao extends LayoutBase { 31 private static final String LAYOUT_NAME = "lao"; 32 33 public Lao(final Locale locale) { 34 super(new LaoCustomizer(locale), Symbols.class, SymbolsShifted.class); 35 } 36 37 @Override 38 public String getName() { return LAYOUT_NAME; } 39 40 private static class LaoCustomizer extends LayoutCustomizer { 41 LaoCustomizer(final Locale locale) { super(locale); } 42 43 @Override 44 public int getNumberOfRows() { return 5; } 45 46 @Override 47 public ExpectedKey getAlphabetKey() { return LAO_ALPHABET_KEY; } 48 49 @Override 50 public ExpectedKey getCurrencyKey() { return CURRENCY_KIP; } 51 52 @Override 53 public ExpectedKey[] getOtherCurrencyKeys() { 54 return SymbolsShifted.CURRENCIES_OTHER_GENERIC; 55 } 56 57 @Override 58 public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { return EMPTY_KEYS; } 59 60 // U+0E81: "" LAO LETTER KO 61 // U+0E82: "" LAO LETTER KHO SUNG 62 // U+0E84: "" LAO LETTER KHO TAM 63 private static final ExpectedKey LAO_ALPHABET_KEY = key( 64 "\u0E81\u0E82\u0E84", Constants.CODE_SWITCH_ALPHA_SYMBOL); 65 66 // U+20AD: "" KIP SIGN 67 private static final ExpectedKey CURRENCY_KIP = key("\u20AD", 68 Symbols.CURRENCY_GENERIC_MORE_KEYS); 69 } 70 71 @Override 72 ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { 73 if (isPhone) { 74 return ALPHABET_COMMON; 75 } 76 final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(ALPHABET_COMMON); 77 builder.addKeysOnTheRightOfRow(4, (Object[])EXCLAMATION_AND_QUESTION_MARKS); 78 return builder.build(); 79 } 80 81 @Override 82 public ExpectedKey[][] getCommonAlphabetShiftLayout(final boolean isPhone, 83 final int elementId) { 84 if (elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) { 85 return getCommonAlphabetLayout(isPhone); 86 } 87 return ALPHABET_SHIFTED_COMMON; 88 } 89 90 private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() 91 .setKeysOfRow(1, 92 // U+0EA2: "" LAO LETTER YO 93 // U+0ED1: "" LAO DIGIT ONE 94 key("\u0EA2", joinMoreKeys("1", "\u0ED1")), 95 // U+0E9F: "" LAO LETTER FO SUNG 96 // U+0ED2: "" LAO DIGIT TWO 97 key("\u0E9F", joinMoreKeys("2", "\u0ED2")), 98 // U+0EC2: "" LAO VOWEL SIGN O 99 // U+0ED3: "" LAO DIGIT THREE 100 key("\u0EC2", joinMoreKeys("3", "\u0ED3")), 101 // U+0E96: "" LAO LETTER THO SUNG 102 // U+0ED4: "" LAO DIGIT FOUR 103 key("\u0E96", joinMoreKeys("4", "\u0ED4")), 104 // U+0EB8: "" LAO VOWEL SIGN U 105 // U+0EB9: "" LAO VOWEL SIGN UU 106 "\u0EB8", "\u0EB9", 107 // U+0E84: "" LAO LETTER KHO TAM 108 // U+0ED5: "" LAO DIGIT FIVE 109 key("\u0E84", joinMoreKeys("5", "\u0ED5")), 110 // U+0E95: "" LAO LETTER TO 111 // U+0ED6: "" LAO DIGIT SIX 112 key("\u0E95", joinMoreKeys("6", "\u0ED6")), 113 // U+0E88: "" LAO LETTER CO 114 // U+0ED7: "" LAO DIGIT SEVEN 115 key("\u0E88", joinMoreKeys("7", "\u0ED7")), 116 // U+0E82: "" LAO LETTER KHO SUNG 117 // U+0ED8: "" LAO DIGIT EIGHT 118 key("\u0E82", joinMoreKeys("8", "\u0ED8")), 119 // U+0E8A: "" LAO LETTER SO TAM 120 // U+0ED9: "" LAO DIGIT NINE 121 key("\u0E8A", joinMoreKeys("9", "\u0ED9")), 122 // U+0ECD: "" LAO NIGGAHITA 123 "\u0ECD") 124 .setKeysOfRow(2, 125 // U+0EBB: "" LAO VOWEL SIGN MAI KON 126 "\u0EBB", 127 // U+0EC4: "" LAO VOWEL SIGN AI 128 // U+0ED0: "" LAO DIGIT ZERO 129 key("\u0EC4", joinMoreKeys("0", "\u0ED0")), 130 // U+0EB3: "" LAO VOWEL SIGN AM 131 // U+0E9E: "" LAO LETTER PHO TAM 132 // U+0EB0: "" LAO VOWEL SIGN A 133 // U+0EB4: "" LAO VOWEL SIGN I 134 // U+0EB5: "" LAO VOWEL SIGN II 135 // U+0EAE: "" LAO LETTER HO TAM 136 // U+0E99: "" LAO LETTER NO 137 // U+0E8D: "" LAO LETTER NYO 138 // U+0E9A: "" LAO LETTER BO 139 // U+0EA5: "" LAO LETTER LO LOOT 140 "\u0EB3", "\u0E9E", "\u0EB0", "\u0EB4", "\u0EB5", "\u0EAE", "\u0E99", "\u0E8D", 141 "\u0E9A", "\u0EA5") 142 .setKeysOfRow(3, 143 // U+0EB1: "" LAO VOWEL SIGN MAI KAN 144 // U+0EAB: "" LAO LETTER HO SUNG 145 // U+0E81: "" LAO LETTER KO 146 // U+0E94: "" LAO LETTER DO 147 // U+0EC0: "" LAO VOWEL SIGN E 148 // U+0EC9: "" LAO TONE MAI THO 149 // U+0EC8: "" LAO TONE MAI EK 150 // U+0EB2: "" LAO VOWEL SIGN AA 151 // U+0EAA: "" LAO LETTER SO SUNG 152 // U+0EA7: "" LAO LETTER WO 153 // U+0E87: "" LAO LETTER NGO 154 // U+201C: "" LEFT DOUBLE QUOTATION MARK 155 "\u0EB1", "\u0EAB", "\u0E81", "\u0E94", "\u0EC0", "\u0EC9", "\u0EC8", "\u0EB2", 156 "\u0EAA", "\u0EA7", "\u0E87", "\u201C") 157 .setKeysOfRow(4, 158 // U+0E9C: "" LAO LETTER PHO SUNG 159 // U+0E9B: "" LAO LETTER PO 160 // U+0EC1: "" LAO VOWEL SIGN EI 161 // U+0EAD: "" LAO LETTER O 162 // U+0EB6: "" LAO VOWEL SIGN Y 163 // U+0EB7: "" LAO VOWEL SIGN YY 164 // U+0E97: "" LAO LETTER THO TAM 165 // U+0EA1: "" LAO LETTER MO 166 // U+0EC3: "" LAO VOWEL SIGN AY 167 // U+0E9D: "" LAO LETTER FO TAM 168 "\u0E9C", "\u0E9B", "\u0EC1", "\u0EAD", "\u0EB6", "\u0EB7", "\u0E97", "\u0EA1", 169 "\u0EC3", "\u0E9D") 170 .build(); 171 172 private static final ExpectedKey[][] ALPHABET_SHIFTED_COMMON = new ExpectedKeyboardBuilder() 173 .setKeysOfRow(1, 174 // U+0ED1: "" LAO DIGIT ONE 175 // U+0ED2: "" LAO DIGIT TWO 176 // U+0ED3: "" LAO DIGIT THREE 177 // U+0ED4: "" LAO DIGIT FOUR 178 // U+0ECC: "" LAO CANCELLATION MARK 179 // U+0EBC: "" LAO SEMIVOWEL SIGN LO 180 // U+0ED5: "" LAO DIGIT FIVE 181 // U+0ED6: "" LAO DIGIT SIX 182 // U+0ED7: "" LAO DIGIT SEVEN 183 // U+0ED8: "" LAO DIGIT EIGHT 184 // U+0ED9: "" LAO DIGIT NINE 185 // U+0ECD/U+0EC8: "" LAO NIGGAHITA/LAO TONE MAI EK 186 "\u0ED1", "\u0ED2", "\u0ED3", "\u0ED4", "\u0ECC", "\u0EBC", "\u0ED5", "\u0ED6", 187 "\u0ED7", "\u0ED8", "\u0ED9", "\u0ECD\u0EC8") 188 .setKeysOfRow(2, 189 // U+0EBB/U+0EC9: "" LAO VOWEL SIGN MAI KON/LAO TONE MAI THO 190 // U+0ED0: "" LAO DIGIT ZERO 191 // U+0EB3/U+0EC9: "" LAO VOWEL SIGN AM/LAO TONE MAI THO 192 // U+0EB4/U+0EC9: "" LAO VOWEL SIGN I/LAO TONE MAI THO 193 // U+0EB5/U+0EC9: "" LAO VOWEL SIGN II/LAO TONE MAI THO 194 // U+0EA3: "" LAO LETTER LO LING 195 // U+0EDC: "" LAO HO NO 196 // U+0EBD: "" LAO SEMIVOWEL SIGN NYO 197 // U+0EAB/U+0EBC: "" LAO LETTER HO SUNG/LAO SEMIVOWEL SIGN LO 198 // U+201D: "" RIGHT DOUBLE QUOTATION MARK 199 "\u0EBB\u0EC9", "\u0ED0", "\u0EB3\u0EC9", "_", "+", "\u0EB4\u0EC9", 200 "\u0EB5\u0EC9", "\u0EA3", "\u0EDC", "\u0EBD", "\u0EAB\u0EBC", "\u201D") 201 .setKeysOfRow(3, 202 // U+0EB1/U+0EC9: "" LAO VOWEL SIGN MAI KAN/LAO TONE MAI THO 203 // U+0ECA: "" LAO TONE MAI TI 204 // U+0ECB: "" LAO TONE MAI CATAWA 205 // U+201C: "" LEFT DOUBLE QUOTATION MARK 206 "\u0EB1\u0EC9", ";", ".", ",", ":", "\u0ECA", "\u0ECB", "!", "?", "%", "=", 207 "\u201C") 208 .setKeysOfRow(4, 209 // U+20AD: "" KIP SIGN 210 // U+0EAF: "" LAO ELLIPSIS 211 // U+0EB6/U+0EC9: "" LAO VOWEL SIGN Y/LAO TONE MAI THO 212 // U+0EB7/U+0EC9: "" LAO VOWEL SIGN YY/LAO TONE MAI THO 213 // U+0EC6: "" LAO KO LA 214 // U+0EDD: "" LAO HO MO 215 "\u20AD", "(", "\u0EAF", "@", "\u0EB6\u0EC9", "\u0EB7\u0EC9", "\u0EC6", 216 "\u0EDD", "$", ")") 217 .build(); 218 } 219