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 
23 /**
24  * The Tamil keyboard.
25  */
26 public final class Tamil extends LayoutBase {
27     private static final String LAYOUT_NAME = "tamil";
28 
Tamil(final LayoutCustomizer customizer)29     public Tamil(final LayoutCustomizer customizer) {
30         super(customizer, Symbols.class, SymbolsShifted.class);
31     }
32 
33     @Override
getName()34     public String getName() { return LAYOUT_NAME; }
35 
36     @Override
getCommonAlphabetLayout(boolean isPhone)37     ExpectedKey[][] getCommonAlphabetLayout(boolean isPhone) { return ALPHABET_COMMON; }
38 
39     @Override
getCommonAlphabetShiftLayout(boolean isPhone, final int elementId)40     ExpectedKey[][] getCommonAlphabetShiftLayout(boolean isPhone, final int elementId) {
41         return null;
42     }
43 
44     private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
45             .setKeysOfRow(1,
46                     // U+0B94: "ஔ" TAMIL LETTER AU
47                     // U+0BCC: "ௌ" TAMIL VOWEL SIGN AU
48                     key("\u0B94", joinMoreKeys("\u0BCC", "1")),
49                     // U+0B90: "ஐ" TAMIL LETTER AI
50                     // U+0BC8: "ை" TAMIL VOWEL SIGN AI
51                     key("\u0B90", joinMoreKeys("\u0BC8", "2")),
52                     // U+0B86: "ஆ" TAMIL LETTER AA
53                     // U+0BBE: "ா" TAMIL VOWEL SIGN AA
54                     key("\u0B86", joinMoreKeys("\u0BBE", "3")),
55                     // U+0B88: "ஈ" TAMIL LETTER II
56                     // U+0BC0: "ீ" TAMIL VOWEL SIGN II
57                     key("\u0B88", joinMoreKeys("\u0BC0", "4")),
58                     // U+0B8A: "ஊ" TAMIL LETTER UU
59                     // U+0BC2: "ூ" TAMIL VOWEL SIGN UU
60                     key("\u0B8A", joinMoreKeys("\u0BC2","5")),
61                     // U+0BAE: "ம" TAMIL LETTER MA
62                     key("\u0BAE", moreKey("6")),
63                     // U+0BA9: "ன" TAMIL LETTER NNNA
64                     key("\u0BA9", moreKey("7")),
65                     // U+0BA8: "ந" TAMIL LETTER NA
66                     key("\u0BA8", moreKey("8")),
67                     // U+0B99: "ங" TAMIL LETTER NGA
68                     key("\u0B99", moreKey("9")),
69                     // U+0BA3: "ண" TAMIL LETTER NNA
70                     key("\u0BA3", moreKey("0")),
71                     // U+0B9E: "ஞ" TAMIL LETTER NYA
72                     "\u0B9E")
73             .setKeysOfRow(2,
74                     // U+0B93: "ஓ" TAMIL LETTER OO
75                     // U+0BCB: "ோ" TAMIL VOWEL SIGN OO
76                     // U+0BD0: "ௐ" TAMIL OM
77                     key("\u0B93", joinMoreKeys("\u0BCB", "\u0BD0")),
78                     // U+0B8F: "ஏ" TAMIL LETTER EE
79                     // U+0BC7: "ே" TAMIL VOWEL SIGN EE
80                     key("\u0B8F", moreKey("\u0BC7")),
81                     // U+0B85: "அ" TAMIL LETTER A
82                     // U+0B83: "ஃ" TAMIL SIGN VISARGA
83                     key("\u0B85", moreKey("\u0B83")),
84                     // U+0B87: "இ" TAMIL LETTER I
85                     // U+0BBF: "ி" TAMIL VOWEL SIGN I
86                     key("\u0B87", moreKey("\u0BBF")),
87                     // U+0B89: "உ" TAMIL LETTER U
88                     // U+0BC1: "ு" TAMIL VOWEL SIGN U
89                     key("\u0B89", moreKey("\u0BC1")),
90                     // U+0BB1: "ற" TAMIL LETTER RRA
91                     // U+0BAA: "ப" TAMIL LETTER PA
92                     "\u0BB1", "\u0BAA",
93                     // U+0B95: "க" TAMIL LETTER KA
94                     // U+0BB9: "ஹ" TAMIL LETTER HA
95                     // U+0B95/U+0BCD/U+0BB7:
96                     //     "க்ஷ" TAMIL LETTER KA/TAMIL SIGN VIRAMA/TAMIL LETTER SSA
97                     key("\u0B95", joinMoreKeys("\u0BB9", "\u0B95\u0BCD\u0BB7")),
98                     // U+0BA4: "த" TAMIL LETTER TA
99                     "\u0BA4",
100                     // U+0B9A: "ச" TAMIL LETTER CA
101                     // U+0BB8: "ஸ" TAMIL LETTER SA
102                     // U+0BB6/U+0BCD/U+0BB0/U+0BC0:
103                     //     "ஶ்ரீ" TAMIL LETTER SHA/TAMIL SIGN VIRAMA/TAMIL LETTER RA
104                     //          /TAMIL VOWEL SIGN II
105                     key("\u0B9A", joinMoreKeys("\u0BB8", "\u0BB6\u0BCD\u0BB0\u0BC0")),
106                     // U+0B9F: "ட" TAMIL LETTER TTA
107                     "\u0B9F")
108             .setKeysOfRow(3,
109                     // U+0B92: "ஒ" TAMIL LETTER O
110                     // U+0BCA: "ொ" TAMIL VOWEL SIGN O
111                     key("\u0B92", moreKey("\u0BCA")),
112                     // U+0B8E: "எ" TAMIL LETTER E
113                     // U+0BC6: "ெ" TAMIL VOWEL SIGN E
114                     key("\u0B8E", moreKey("\u0BC6")),
115                     // U+0BCD: "்" TAMIL SIGN VIRAMA
116                     // U+0BB0: "ர" TAMIL LETTER RA
117                     // U+0BB5: "வ" TAMIL LETTER VA
118                     // U+0BB4: "ழ TAMIL LETTER LLLA
119                     // U+0BB2: "ல" TAMIL LETTER LA
120                     // U+0BB3: "ள" TAMIL LETTER LLA
121                     // U+0BAF: "ய" TAMIL LETTER YA
122                     "\u0BCD", "\u0BB0", "\u0BB5", "\u0BB4", "\u0BB2", "\u0BB3", "\u0BAF",
123                     // U+0BB7: "ஷ" TAMIL LETTER SSA
124                     // U+0B9C: "ஜ" TAMIL LETTER JA
125                     key("\u0BB7", moreKey("\u0B9C")))
126             .build();
127 }
128