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.layout.customizer.LayoutCustomizer; 20 import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; 21 import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; 22 import com.android.inputmethod.latin.common.Constants; 23 24 import java.util.Locale; 25 26 /** 27 * The Malayalam keyboard. 28 */ 29 public final class Malayalam extends LayoutBase { 30 private static final String LAYOUT_NAME = "malayalam"; 31 Malayalam(final Locale locale)32 public Malayalam(final Locale locale) { 33 super(new MalayalamCustomizer(locale), Symbols.class, SymbolsShifted.class); 34 } 35 36 @Override getName()37 public String getName() { return LAYOUT_NAME; } 38 39 private static class MalayalamCustomizer extends LayoutCustomizer { MalayalamCustomizer(final Locale locale)40 MalayalamCustomizer(final Locale locale) { super(locale); } 41 42 @Override getAlphabetKey()43 public ExpectedKey getAlphabetKey() { return MALAYALAM_ALPHABET_KEY; } 44 45 @Override getCurrencyKey()46 public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; } 47 48 @Override getOtherCurrencyKeys()49 public ExpectedKey[] getOtherCurrencyKeys() { 50 return SymbolsShifted.CURRENCIES_OTHER_GENERIC; 51 } 52 53 @Override getLeftShiftKeys(final boolean isPhone)54 public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) { 55 return EMPTY_KEYS; 56 } 57 58 @Override getRightShiftKeys(final boolean isPhone)59 public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { 60 return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS; 61 } 62 63 // U+0D05: "അ" MALAYALAM LETTER A 64 private static final ExpectedKey MALAYALAM_ALPHABET_KEY = key( 65 "\u0D05", Constants.CODE_SWITCH_ALPHA_SYMBOL); 66 67 // U+20B9: "₹" INDIAN RUPEE SIGN 68 private static final ExpectedKey CURRENCY_RUPEE = key("\u20B9", 69 Symbols.CURRENCY_GENERIC_MORE_KEYS); 70 } 71 72 @Override getCommonAlphabetLayout(boolean isPhone)73 ExpectedKey[][] getCommonAlphabetLayout(boolean isPhone) { return ALPHABET_COMMON; } 74 75 @Override getCommonAlphabetShiftLayout(boolean isPhone, final int elementId)76 ExpectedKey[][] getCommonAlphabetShiftLayout(boolean isPhone, final int elementId) { 77 return null; 78 } 79 80 private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() 81 .setKeysOfRow(1, 82 // U+0D4D: "്" MALAYALAM SIGN VIRAMA 83 // U+0D05: "അ" MALAYALAM LETTER A 84 key("\u0D4D", joinMoreKeys("\u0D05", "1")), 85 // U+0D3E: "ാ" MALAYALAM VOWEL SIGN AA 86 // U+0D06: "ആ" MALAYALAM LETTER AA 87 key("\u0D3E", joinMoreKeys("\u0D06", "2")), 88 // U+0D3F: "ി" MALAYALAM VOWEL SIGN I 89 // U+0D07: "ഇ" MALAYALAM LETTER I 90 key("\u0D3F", joinMoreKeys("\u0D07", "3")), 91 // U+0D40: "ീ" MALAYALAM VOWEL SIGN II 92 // U+0D08: "ഈ" MALAYALAM LETTER II 93 key("\u0D40", joinMoreKeys("\u0D08", "4")), 94 // U+0D41: "ു" MALAYALAM VOWEL SIGN U 95 // U+0D09: "ഉ" MALAYALAM LETTER U 96 key("\u0D41", joinMoreKeys("\u0D09", "5")), 97 // U+0D42: "ൂ" MALAYALAM VOWEL SIGN UU 98 // U+0D0A: "ഊ" MALAYALAM LETTER UU 99 key("\u0D42", joinMoreKeys("\u0D0A", "6")), 100 // U+0D43: "ൃ" MALAYALAM VOWEL SIGN VOCALIC R 101 // U+0D0B: "ഋ" MALAYALAM LETTER VOCALIC R 102 key("\u0D43", joinMoreKeys("\u0D0B", "7")), 103 // U+0D46: "െ" MALAYALAM VOWEL SIGN E 104 // U+0D0E: "എ" MALAYALAM LETTER E 105 // U+0D10: "ഐ" MALAYALAM LETTER AI 106 // U+0D48: "ൈ" MALAYALAM VOWEL SIGN AI 107 key("\u0D46", joinMoreKeys("\u0D0E", "\u0D10", "\u0D48", "8")), 108 // U+0D47: "േ" MALAYALAM VOWEL SIGN EE 109 // U+0D0F: "ഏ" MALAYALAM LETTER EE 110 key("\u0D47", joinMoreKeys("\u0D0F", "9")), 111 // U+0D4A: "ൊ" MALAYALAM VOWEL SIGN O 112 // U+0D12: "ഒ" MALAYALAM LETTER O 113 key("\u0D4A", joinMoreKeys("\u0D12", "0")), 114 // U+0D4B: "ോ" MALAYALAM VOWEL SIGN OO 115 // U+0D13: "ഓ" MALAYALAM LETTER OO 116 // U+0D14: "ഔ" MALAYALAM LETTER AU 117 // U+0D57: "ൗ" MALAYALAM AU LENGTH MARK 118 key("\u0D4B", joinMoreKeys("\u0D13", "\u0D14", "\u0D57"))) 119 .setKeysOfRow(2, 120 // U+0D15: "ക" MALAYALAM LETTER KA 121 // U+0D16: "ഖ" MALAYALAM LETTER KHA 122 key("\u0D15", moreKey("\u0D16")), 123 // U+0D17: "ഗ" MALAYALAM LETTER GA 124 // U+0D18: "ഘ" MALAYALAM LETTER GHA 125 key("\u0D17", moreKey("\u0D18")), 126 // U+0D19: "ങ" MALAYALAM LETTER NGA 127 // U+0D1E: "ഞ" MALAYALAM LETTER NYA 128 key("\u0D19", moreKey("\u0D1E")), 129 // U+0D1A: "ച" MALAYALAM LETTER CA 130 // U+0D1B: "ഛ" MALAYALAM LETTER CHA 131 key("\u0D1A", moreKey("\u0D1B")), 132 // U+0D1C: "ജ" MALAYALAM LETTER JA 133 // U+0D1D: "ഝ" MALAYALAM LETTER JHA 134 key("\u0D1C", moreKey("\u0D1D")), 135 // U+0D1F: "ട" MALAYALAM LETTER TTA 136 // U+0D20: "ഠ" MALAYALAM LETTER TTHA 137 key("\u0D1F", moreKey("\u0D20")), 138 // U+0D21: "ഡ" MALAYALAM LETTER DDA 139 // U+0D22: "ഢ" MALAYALAM LETTER DDHA 140 key("\u0D21", moreKey("\u0D22")), 141 // U+0D23: "ണ" MALAYALAM LETTER NNA 142 // U+0D7A: "ൺ" MALAYALAM LETTER CHILLU NN 143 key("\u0D23", moreKey("\u0D7A")), 144 // U+0D24: "ത" MALAYALAM LETTER TA 145 // U+0D25: "ഥ" MALAYALAM LETTER THA 146 key("\u0D24", moreKey("\u0D25")), 147 // U+0D26: "ദ" MALAYALAM LETTER DA 148 // U+0D27: "ധ" MALAYALAM LETTER DHA 149 key("\u0D26", moreKey("\u0D27")), 150 // U+0D28: "ഗന" MALAYALAM LETTER NA 151 // U+0D7B: "ൻ" MALAYALAM LETTER CHILLU N 152 key("\u0D28", moreKey("\u0D7B"))) 153 .setKeysOfRow(3, 154 // U+0D2A: "പ" MALAYALAM LETTER PA 155 // U+0D2B: "ഫ" MALAYALAM LETTER PHA 156 key("\u0D2A", moreKey("\u0D2B")), 157 // U+0D2C: "ബ" MALAYALAM LETTER BA 158 // U+0D2D: "ഭ" MALAYALAM LETTER BHA 159 key("\u0D2C", moreKey("\u0D2D")), 160 // U+0D2E: "മ" MALAYALAM LETTER MA 161 // U+0D02: "ം" MALAYALAM SIGN ANUSVARA 162 key("\u0D2E", moreKey("\u0D02")), 163 // U+0D2F: "യ" MALAYALAM LETTER YA 164 // U+0D4D/U+0D2F: "്യ" MALAYALAM SIGN VIRAMA/MALAYALAM LETTER YA 165 key("\u0D2F", moreKey("\u0D4D\u0D2F")), 166 // U+0D30: "ര" MALAYALAM LETTER RA 167 // U+0D4D/U+0D30: "്ര" MALAYALAM SIGN VIRAMA/MALAYALAM LETTER RA 168 // U+0D7C: "ർ" MALAYALAM LETTER CHILLU RR 169 // U+0D31: "റ" MALAYALAM LETTER RRA 170 key("\u0D30", joinMoreKeys("\u0D4D\u0D30", "\u0D7C", "\u0D31")), 171 // U+0D32: "ല" MALAYALAM LETTER LA 172 // U+0D7D: "ൽ" MALAYALAM LETTER CHILLU L 173 key("\u0D32", moreKey("\u0D7D")), 174 // U+0D35: "വ" MALAYALAM LETTER VA 175 // U+0D4D/U+0D35: "്വ" MALAYALAM SIGN VIRAMA/MALAYALAM LETTER VA 176 key("\u0D35", moreKey("\u0D4D\u0D35")), 177 // U+0D36: "ശ" MALAYALAM LETTER SHA 178 // U+0D37: "ഷ" MALAYALAM LETTER SSA 179 // U+0D38: "സ" MALAYALAM LETTER SA 180 key("\u0D36", joinMoreKeys("\u0D37", "\u0D38")), 181 // U+0D39: "ഹ" MALAYALAM LETTER HA 182 // U+0D03: "ഃ" MALAYALAM SIGN VISARGA 183 key("\u0D39", moreKey("\u0D03")), 184 // U+0D33: "ള" MALAYALAM LETTER LLA 185 // U+0D7E: "ൾ" MALAYALAM LETTER CHILLU LL 186 // U+0D34: "ഴ" MALAYALAM LETTER LLLA 187 key("\u0D33", joinMoreKeys("\u0D7E", "\u0D34"))) 188 .build(); 189 } 190