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
17package com.android.inputmethod.keyboard.layout.customizer;
18
19import com.android.inputmethod.keyboard.layout.Nordic;
20import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
21
22import java.util.Locale;
23
24public class FinnishCustomizer extends EuroCustomizer {
25    public FinnishCustomizer(final Locale locale) { super(locale); }
26
27    protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
28        builder
29                // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
30                .replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5")
31                // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
32                // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
33                .replaceKeyOfLabel(Nordic.ROW2_10, "\u00F6")
34                .setMoreKeysOf("\u00F6","\u00F8")
35                // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
36                // U+00E6: "æ" LATIN SMALL LETTER AE
37                .replaceKeyOfLabel(Nordic.ROW2_11, "\u00E4")
38                .setMoreKeysOf("\u00E4", "\u00E6");
39    }
40
41    protected void setMoreKeysOfA(final ExpectedKeyboardBuilder builder) {
42        builder
43                // U+00E6: "æ" LATIN SMALL LETTER AE
44                // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
45                // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
46                // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
47                // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
48                // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
49                .setMoreKeysOf("a", "\u00E6", "\u00E0", "\u00E1", "\u00E2", "\u00E3", "\u0101");
50    }
51
52    protected void setMoreKeysOfO(final ExpectedKeyboardBuilder builder) {
53        builder
54                // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
55                // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
56                // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
57                // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
58                // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
59                // U+0153: "œ" LATIN SMALL LIGATURE OE
60                // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
61                .setMoreKeysOf("o", "\u00F8", "\u00F4", "\u00F2", "\u00F3", "\u00F5", "\u0153",
62                        "\u014D");
63    }
64
65    @Override
66    public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
67        setNordicKeys(builder);
68        setMoreKeysOfA(builder);
69        setMoreKeysOfO(builder);
70        return builder
71                // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
72                .setMoreKeysOf("u", "\u00FC")
73                // U+0161: "š" LATIN SMALL LETTER S WITH CARON
74                // U+00DF: "ß" LATIN SMALL LETTER SHARP S
75                // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
76                .setMoreKeysOf("s", "\u0161", "\u00DF", "\u015B")
77                // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
78                // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
79                // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
80                .setMoreKeysOf("z", "\u017E", "\u017A", "\u017C");
81    }
82}
83