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 Telugu keyboard. 28 */ 29 public final class Telugu extends LayoutBase { 30 private static final String LAYOUT_NAME = "telugu"; 31 32 public Telugu(final Locale locale) { 33 super(new TeluguCustomizer(locale), Symbols.class, SymbolsShifted.class); 34 } 35 36 @Override 37 public String getName() { return LAYOUT_NAME; } 38 39 private static class TeluguCustomizer extends LayoutCustomizer { 40 TeluguCustomizer(final Locale locale) { super(locale); } 41 42 @Override 43 public ExpectedKey getAlphabetKey() { return TELUGU_ALPHABET_KEY; } 44 45 @Override 46 public ExpectedKey getCurrencyKey() { return CURRENCY_RUPEE; } 47 48 @Override 49 public ExpectedKey[] getOtherCurrencyKeys() { 50 return SymbolsShifted.CURRENCIES_OTHER_GENERIC; 51 } 52 53 @Override 54 public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) { 55 return EMPTY_KEYS; 56 } 57 58 @Override 59 public ExpectedKey[] getRightShiftKeys(final boolean isPhone) { 60 return isPhone ? EMPTY_KEYS : EXCLAMATION_AND_QUESTION_MARKS; 61 } 62 63 @Override 64 public ExpectedKey[] getSpaceKeys(final boolean isPhone) { 65 return joinKeys(LANGUAGE_SWITCH_KEY, SPACE_KEY, key(ZWNJ_KEY, ZWJ_KEY)); 66 } 67 68 // U+0C05: "" TELUGU LETTER A 69 // U+0C06: "" TELUGU LETTER AA 70 // U+0C07: "" TELUGU LETTER I 71 private static final ExpectedKey TELUGU_ALPHABET_KEY = key( 72 "\u0C05\u0C06\u0C07", Constants.CODE_SWITCH_ALPHA_SYMBOL); 73 74 // U+20B9: "" INDIAN RUPEE SIGN 75 private static final ExpectedKey CURRENCY_RUPEE = key("\u20B9", 76 Symbols.CURRENCY_GENERIC_MORE_KEYS); 77 } 78 79 @Override 80 ExpectedKey[][] getCommonAlphabetLayout(boolean isPhone) { return ALPHABET_COMMON; } 81 82 @Override 83 ExpectedKey[][] getCommonAlphabetShiftLayout(boolean isPhone, final int elementId) { 84 return null; 85 } 86 87 private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder() 88 .setKeysOfRow(1, 89 // U+0C4C: "" TELUGU VOWEL SIGN AU 90 // U+0C14: "" TELUGU LETTER AU 91 key("\u0C4C", joinMoreKeys("\u0C14", "1")), 92 // U+0C48: "" TELUGU VOWEL SIGN AI 93 // U+0C10: "" TELUGU LETTER AI 94 key("\u0C48", joinMoreKeys("\u0C10", "2")), 95 // U+0C3E: "" TELUGU VOWEL SIGN AA 96 // U+0C06: "" TELUGU LETTER AA 97 key("\u0C3E", joinMoreKeys("\u0C06", "3")), 98 // U+0C40: "" TELUGU VOWEL SIGN II 99 // U+0C08: "" TELUGU LETTER II 100 key("\u0C40", joinMoreKeys("\u0C08", "4")), 101 // U+0C42: "" TELUGU VOWEL SIGN UU 102 // U+0C0A: "" TELUGU LETTER UU 103 key("\u0C42", joinMoreKeys("\u0C0A", "5")), 104 // U+0C2C: "" TELUGU LETTER BA 105 // U+0C2D: "" TELUGU LETTER BHA 106 key("\u0C2C", joinMoreKeys("\u0C2D", "6")), 107 // U+0C39: "" TELUGU LETTER HA 108 // U+0C03: "" TELUGU SIGN VISARGA 109 key("\u0C39", joinMoreKeys("\u0C03", "7")), 110 // U+0C17: "" TELUGU LETTER GA 111 // U+0C18: "" TELUGU LETTER GHA 112 key("\u0C17", joinMoreKeys("\u0C18", "8")), 113 // U+0C26: "" TELUGU LETTER DA 114 // U+0C27: "" TELUGU LETTER DHA 115 key("\u0C26", joinMoreKeys("\u0C27", "9")), 116 // U+0C1C: "" TELUGU LETTER JA 117 // U+0C1D: "" TELUGU LETTER JHA 118 key("\u0C1C", joinMoreKeys("\u0C1D", "0")), 119 // U+0C21: "" TELUGU LETTER DDA 120 // U+0C22: "" TELUGU LETTER DDHA 121 key("\u0C21", moreKey("\u0C22"))) 122 .setKeysOfRow(2, 123 // U+0C4B: "" TELUGU VOWEL SIGN OO 124 // U+0C13: "" TELUGU LETTER OO 125 key("\u0C4B", moreKey("\u0C13")), 126 // U+0C47: "" TELUGU VOWEL SIGN EE 127 // U+0C0F: "" TELUGU LETTER EE 128 key("\u0C47", moreKey("\u0C0F")), 129 // U+0C4D: "" TELUGU SIGN VIRAMA 130 // U+0C05: "" TELUGU LETTER A 131 key("\u0C4D", moreKey("\u0C05")), 132 // U+0C3F: "" TELUGU VOWEL SIGN I 133 // U+0C07: "" TELUGU LETTER I 134 key("\u0C3F", moreKey("\u0C07")), 135 // U+0C41: "" TELUGU VOWEL SIGN U 136 // U+0C09: "" TELUGU LETTER U 137 key("\u0C41", moreKey("\u0C09")), 138 // U+0C2A: "" TELUGU LETTER PA 139 // U+0C2B: "" TELUGU LETTER PHA 140 key("\u0C2A", moreKey("\u0C2B")), 141 // U+0C30: "" TELUGU LETTER RA 142 // U+0C31: "" TELUGU LETTER RRA 143 // U+0C4D/U+0C30: "" TELUGU SIGN VIRAMA/TELUGU LETTER RA 144 key("\u0C30", joinMoreKeys("\u0C31", "\u0C4D\u0C30")), 145 // U+0C15: "" TELUGU LETTER KA 146 // U+0C16: "" TELUGU LETTER KHA 147 key("\u0C15", moreKey("\u0C16")), 148 // U+0C24: "" TELUGU LETTER TA 149 // U+0C25: "" TELUGU LETTER THA 150 key("\u0C24", moreKey("\u0C25")), 151 // U+0C1A: "" TELUGU LETTER CA 152 // U+0C1B: "" TELUGU LETTER CHA 153 key("\u0C1A", moreKey("\u0C1B")), 154 // U+0C1F: "" TELUGU LETTER TTA 155 // U+0C20: "" TELUGU LETTER TTHA 156 key("\u0C1F", moreKey("\u0C20"))) 157 .setKeysOfRow(3, 158 // U+0C4A: "" TELUGU VOWEL SIGN O 159 // U+0C12: "" TELUGU LETTER O 160 key("\u0C4A", moreKey("\u0C12")), 161 // U+0C46: "" TELUGU VOWEL SIGN E 162 // U+0C0E: "" TELUGU LETTER E 163 key("\u0C46", moreKey("\u0C0E")), 164 // U+0C2E: "" TELUGU LETTER MA 165 // U+0C02: "" TELUGU SIGN ANUSVARA 166 // U+0C01: "" TELUGU SIGN CANDRABINDU 167 key("\u0C2E", joinMoreKeys("\u0C02", "\u0C01")), 168 // U+0C28: "" TELUGU LETTER NA 169 // U+0C23: "" TELUGU LETTER NNA 170 // U+0C19: "" TELUGU LETTER NGA 171 // U+0C1E: "" TELUGU LETTER NYA 172 key("\u0C28", joinMoreKeys("\u0C23", "\u0C19", "\u0C1E")), 173 // U+0C35: "" TELUGU LETTER VA 174 "\u0C35", 175 // U+0C32: "" TELUGU LETTER LA 176 // U+0C33: "" TELUGU LETTER LLA 177 key("\u0C32", moreKey("\u0C33")), 178 // U+0C38: "" TELUGU LETTER SA 179 // U+0C36: "" TELUGU LETTER SHA 180 key("\u0C38", moreKey("\u0C36")), 181 // U+0C0B: "" TELUGU LETTER VOCALIC R 182 // U+0C43: "" TELUGU VOWEL SIGN VOCALIC R 183 key("\u0C0B", moreKey("\u0C43")), 184 // U+0C37: "" TELUGU LETTER SSA 185 // U+0C15/U+0C4D/U+0C37: 186 // "" TELUGU LETTER KA/TELUGU SIGN VIRAMA/TELUGU LETTER SSA 187 key("\u0C37", moreKey("\u0C15\u0C4D\u0C37")), 188 // U+0C2F: "" TELUGU LETTER YA 189 // U+0C1C/U+0C4D/U+0C1E: 190 // "" TELUGU LETTER JA/TELUGU SIGN VIRAMA/TELUGU LETTER NYA 191 key("\u0C2F", moreKey("\u0C1C\u0C4D\u0C1E"))) 192 .build(); 193 } 194