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.EastSlavicCustomizer;
20 import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
21 import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
22 
23 import java.util.Locale;
24 
25 public final class BulgarianBds extends LayoutBase {
26     private static final String LAYOUT_NAME = "bulgarian_bds";
27 
BulgarianBds(final Locale locale)28     public BulgarianBds(final Locale locale) {
29         super(new BulgarianBdsCustomizer(locale), Symbols.class, SymbolsShifted.class);
30     }
31 
32     @Override
getName()33     public String getName() { return LAYOUT_NAME; }
34 
35     private static class BulgarianBdsCustomizer extends EastSlavicCustomizer {
BulgarianBdsCustomizer(final Locale locale)36         BulgarianBdsCustomizer(final Locale locale) { super(locale); }
37 
38         @Override
getDoubleQuoteMoreKeys()39         public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
40     }
41 
42     @Override
getCommonAlphabetLayout(final boolean isPhone)43     ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; }
44 
45     private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
46             .setKeysOfRow(1,
47                     // U+0443: "у" CYRILLIC SMALL LETTER U
48                     key("\u0443", moreKey("1")),
49                     // U+0435: "е" CYRILLIC SMALL LETTER IE
50                     key("\u0435", moreKey("2")),
51                     // U+0438: "и" CYRILLIC SMALL LETTER I
52                     // U+045D: "ѝ" CYRILLIC SMALL LETTER I WITH GRAVE
53                     key("\u0438", joinMoreKeys("3", "\u045D")),
54                     // U+0448: "ш" CYRILLIC SMALL LETTER SHA
55                     key("\u0448", moreKey("4")),
56                     // U+0449: "щ" CYRILLIC SMALL LETTER SHCHA
57                     key("\u0449", moreKey("5")),
58                     // U+043A: "к" CYRILLIC SMALL LETTER KA
59                     key("\u043A", moreKey("6")),
60                     // U+0441: "с" CYRILLIC SMALL LETTER ES
61                     key("\u0441", moreKey("7")),
62                     // U+0434: "д" CYRILLIC SMALL LETTER DE
63                     key("\u0434", moreKey("8")),
64                     // U+0437: "з" CYRILLIC SMALL LETTER ZE
65                     key("\u0437", moreKey("9")),
66                     // U+0446: "ц" CYRILLIC SMALL LETTER TSE
67                     key("\u0446", moreKey("0")),
68                     // U+0431: "б" CYRILLIC SMALL LETTER BE
69                     "\u0431")
70             .setKeysOfRow(2,
71                     // U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN
72                     // U+044F: "я" CYRILLIC SMALL LETTER YA
73                     // U+0430: "а" CYRILLIC SMALL LETTER A
74                     // U+043E: "о" CYRILLIC SMALL LETTER O
75                     // U+0436: "ж" CYRILLIC SMALL LETTER ZHE
76                     // U+0433: "г" CYRILLIC SMALL LETTER GHE
77                     // U+0442: "т" CYRILLIC SMALL LETTER TE
78                     // U+043D: "н" CYRILLIC SMALL LETTER EN
79                     // U+0432: "в" CYRILLIC SMALL LETTER VE
80                     // U+043C: "м" CYRILLIC SMALL LETTER EM
81                     // U+0447: "ч" CYRILLIC SMALL LETTER CHE
82                     "\u044C", "\u044F", "\u0430", "\u043E", "\u0436", "\u0433", "\u0442", "\u043D",
83                     "\u0432", "\u043C", "\u0447")
84             .setKeysOfRow(3,
85                     // U+044E: "ю" CYRILLIC SMALL LETTER YU
86                     // U+0439: "й" CYRILLIC SMALL LETTER SHORT I
87                     // U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN
88                     // U+044D: "э" CYRILLIC SMALL LETTER E
89                     // U+0444: "ф" CYRILLIC SMALL LETTER EF
90                     // U+0445: "х" CYRILLIC SMALL LETTER HA
91                     // U+043F: "п" CYRILLIC SMALL LETTER PE
92                     // U+0440: "р" CYRILLIC SMALL LETTER ER
93                     // U+043B: "л" CYRILLIC SMALL LETTER EL
94                     "\u044E", "\u0439", "\u044A", "\u044D", "\u0444", "\u0445", "\u043F", "\u0440",
95                     "\u043B")
96             .build();
97 }
98