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 Bengali keyboard.
25  */
26 public final class Bengali extends LayoutBase {
27     private static final String LAYOUT_NAME = "bengali";
28 
Bengali(final LayoutCustomizer customizer)29     public Bengali(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+0994: "ঔ" BENGALI LETTER AU
47                     // U+09CC: "ৌ" BENGALI VOWEL SIGN AU
48                     // U+09E7: "১" BENGALI DIGIT ONE
49                     key("\u0994", joinMoreKeys("\u09CC", "\u09E7", "1")),
50                     // U+0990: "ঐ" BENGALI LETTER AI
51                     // U+09C8: "ৈ" BENGALI VOWEL SIGN AI
52                     // U+09E8: "২" BENGALI DIGIT TWO
53                     key("\u0990", joinMoreKeys("\u09C8", "\u09E8", "2")),
54                     // U+0986: "আ" BENGALI LETTER AA
55                     // U+09BE: "া" BENGALI VOWEL SIGN AA
56                     // U+09E9: "৩" BENGALI DIGIT THREE
57                     key("\u0986", joinMoreKeys("\u09BE", "\u09E9", "3")),
58                     // U+0988: "ঈ" BENGALI LETTER II
59                     // U+09C0: "ী" BENGALI VOWEL SIGN II
60                     // U+09EA: "৪" BENGALI DIGIT FOUR
61                     key("\u0988", joinMoreKeys("\u09C0", "\u09EA", "4")),
62                     // U+098A: "ঊ" BENGALI LETTER UU
63                     // U+09C2: "ূ" BENGALI VOWEL SIGN UU
64                     // U+09EB: "৫" BENGALI DIGIT FIVE
65                     key("\u098A", joinMoreKeys("\u09C2", "\u09EB", "5")),
66                     // U+09AC: "ব" BENGALI LETTER BA
67                     // U+09AD: "ভ" BENGALI LETTER BHA
68                     // U+09EC: "৬" BENGALI DIGIT SIX
69                     key("\u09AC", joinMoreKeys("\u09AD", "\u09EC", "6")),
70                     // U+09B9: "হ" BENGALI LETTER HA
71                     // U+09ED: "৭" BENGALI DIGIT SEVEN
72                     key("\u09B9", joinMoreKeys("\u09ED", "7")),
73                     // U+0997: "গ" BENGALI LETTER GA
74                     // U+0998: "ঘ" BENGALI LETTER GHA
75                     // U+09EE: "৮" BENGALI DIGIT EIGHT
76                     key("\u0997", joinMoreKeys("\u0998", "\u09EE", "8")),
77                     // U+09A6: "দ" BENGALI LETTER DA
78                     // U+09A7: "ধ" BENGALI LETTER DHA
79                     // U+09EF: "৯" BENGALI DIGIT NINE
80                     key("\u09A6", joinMoreKeys("\u09A7", "\u09EF", "9")),
81                     // U+099C: "জ" BENGALI LETTER JA
82                     // U+099D: "ঝ" BENGALI LETTER JHA
83                     // U+099C/U+09CD/U+099E:
84                     //     "জ্ঞ" BENGALI LETTER JA/BENGALI SIGN VIRAMA/BENGALI LETTER NYA
85                     // U+09E6: "০" BENGALI DIGIT ZERO
86                     key("\u099C", joinMoreKeys("\u099D", "\u099C\u09CD\u099E", "\u09E6", "0")),
87                     // U+09A1: "ড" BENGALI LETTER DDA
88                     // U+09A1/U+09BC: "ড়" BENGALI LETTER DDA/BENGALI SIGN NUKTA
89                     key("\u09A1", moreKey("\u09A1\u09BC")))
90             .setKeysOfRow(2,
91                     // U+0993: "ও" BENGALI LETTER O
92                     // U+09CB: "ো" BENGALI VOWEL SIGN O
93                     key("\u0993", moreKey("\u09CB")),
94                     // U+098F: "এ" BENGALI LETTER E
95                     // U+09C7: "ে" BENGALI VOWEL SIGN E
96                     key("\u098F", moreKey("\u09C7")),
97                     // U+0985: "অ" BENGALI LETTER A
98                     // U+09CD: "্" BENGALI SIGN VIRAMA
99                     key("\u0985", moreKey("\u09CD")),
100                     // U+0987: "ই" BENGALI LETTER I
101                     // U+09BF: "ি" BENGALI VOWEL SIGN I
102                     key("\u0987", moreKey("\u09BF")),
103                     // U+0989: "উ" BENGALI LETTER U
104                     // U+09C1: "ু" BENGALI VOWEL SIGN U
105                     key("\u0989", moreKey("\u09C1")),
106                     // U+09AA: "প" BENGALI LETTER PA
107                     // U+09AB: "ফ" BENGALI LETTER PHA
108                     key("\u09AA", moreKey("\u09AB")),
109                     // U+09B0: "র" BENGALI LETTER RA
110                     // U+09C3: "ৃ" BENGALI VOWEL SIGN VOCALIC R
111                     // U+098B: "ঋ" BENGALI LETTER VOCALIC R
112                     // U+09A4/U+09CD/U+09B0:
113                     //     "ত্র" BENGALI LETTER TA/BENGALI SIGN VIRAMA/BENGALI LETTER RA
114                     key("\u09B0", joinMoreKeys("\u09C3", "\u098B", "\u09A4\u09CD\u09B0")),
115                     // U+0995: "ক" BENGALI LETTER KA
116                     // U+0996: "খ" BENGALI LETTER KHA
117                     key("\u0995", moreKey("\u0996")),
118                     // U+09A4: "ত" BENGALI LETTER TA
119                     // U+09CE: "ৎ" BENGALI LETTER KHANDA TA
120                     // U+09A5: "থ" BENGALI LETTER THA
121                     // U+09A4/U+09CD/U+09A4:
122                     //     "ত্ত" BENGALI LETTER TA/BENGALI SIGN VIRAMA/BENGALI LETTER TA
123                     key("\u09A4", joinMoreKeys("\u09CE", "\u09A5", "\u09A4\u09CD\u09A4")),
124                     // U+099A: "চ" BENGALI LETTER CA
125                     // U+099B: "ছ" BENGALI LETTER CHA
126                     key("\u099A", moreKey("\u099B")),
127                     // U+099F: "ট" BENGALI LETTER TTA
128                     // U+09A0: "ঠ" BENGALI LETTER TTHA
129                     key("\u099F", moreKey("\u09A0")))
130             .setKeysOfRow(3,
131                     // U+0981: "ঁ" BENGALI SIGN CANDRABINDU
132                     // U+0983: "ঃ" BENGALI SIGN VISARGA
133                     // U+0982: "ং" BENGALI SIGN ANUSVARA
134                     key("\u0981", joinMoreKeys("\u0983", "\u0982")),
135                     // U+09A2: "ঢ" BENGALI LETTER DDHA
136                     // U+09A2/U+09BC: "ঢ়" BENGALI LETTER DDHA/BENGALI SIGN NUKTA
137                     key("\u09A2", moreKey("\u09A2\u09BC")),
138                     // U+09AE: "ম" BENGALI LETTER MA
139                     "\u09AE",
140                     // U+09A8: "ন" BENGALI LETTER NA
141                     // U+09A3: "ণ" BENGALI LETTER NNA
142                     key("\u09A8", moreKey("\u09A3")),
143                     // U+099E: "ঞ" BENGALI LETTER NYA
144                     // U+0999: "ঙ" BENGALI LETTER NGA
145                     // U+099E/U+09CD/U+099C:
146                     //     "ঞ্জ" BENGALI LETTER NYA/BENGALI SIGN VIRAMA/BENGALI LETTER JA
147                     key("\u099E", joinMoreKeys("\u0999", "\u099E\u09CD\u099C")),
148                     // U+09B2: "ল" BENGALI LETTER LA
149                     "\u09B2",
150                     // U+09B7: "ষ" BENGALI LETTER SSA
151                     // U+0995/U+09CD/U+09B7:
152                     //     "ক্ষ" BENGALI LETTER KA/BENGALI SIGN VIRAMA/BENGALI LETTER SSA
153                     key("\u09B7", moreKey("\u0995\u09CD\u09B7")),
154                     // U+09B8: "স" BENGALI LETTER SA
155                     // U+09B6: "শ" BENGALI LETTER SHA
156                     key("\u09B8", moreKey("\u09B6")),
157                     // U+09DF: "য়" BENGALI LETTER YYA
158                     // U+09AF: "য" BENGALI LETTER YA
159                     key("\u09DF", moreKey("\u09AF")),
160                     // U+0964: "।" DEVANAGARI DANDA
161                     // U+0965: "॥" DEVANAGARI DOUBLE DANDA
162                     key("\u0964", moreKey("\u0965")))
163             .build();
164 }
165