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.customizer; 18 19 import com.android.inputmethod.keyboard.layout.Nordic; 20 import com.android.inputmethod.keyboard.layout.Symbols; 21 import com.android.inputmethod.keyboard.layout.expected.ExpectedKey; 22 import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder; 23 24 import java.util.Locale; 25 26 public class NorwegianCustomizer extends LayoutCustomizer { 27 public NorwegianCustomizer(final Locale locale) { super(locale); } 28 29 @Override 30 public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_L9R; } 31 32 @Override 33 public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_L9R; } 34 35 protected void setNordicKeys(final ExpectedKeyboardBuilder builder) { 36 builder 37 // U+00E5: "" LATIN SMALL LETTER A WITH RING ABOVE 38 .replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5") 39 // U+00F8: "" LATIN SMALL LETTER O WITH STROKE 40 // U+00F6: "" LATIN SMALL LETTER O WITH DIAERESIS 41 .replaceKeyOfLabel(Nordic.ROW2_10, "\u00F8") 42 .setMoreKeysOf("\u00F8", "\u00F6") 43 // U+00E6: "" LATIN SMALL LETTER AE 44 // U+00E4: "" LATIN SMALL LETTER A WITH DIAERESIS 45 .replaceKeyOfLabel(Nordic.ROW2_11, "\u00E6") 46 .setMoreKeysOf("\u00E6", "\u00E4"); 47 } 48 49 protected void setMoreKeysOfA(final ExpectedKeyboardBuilder builder) { 50 builder 51 // U+00E4: "" LATIN SMALL LETTER A WITH DIAERESIS 52 // U+00E0: "" LATIN SMALL LETTER A WITH GRAVE 53 // U+00E1: "" LATIN SMALL LETTER A WITH ACUTE 54 // U+00E2: "" LATIN SMALL LETTER A WITH CIRCUMFLEX 55 // U+00E3: "" LATIN SMALL LETTER A WITH TILDE 56 // U+0101: "" LATIN SMALL LETTER A WITH MACRON 57 .setMoreKeysOf("a", "\u00E4", "\u00E0", "\u00E1", "\u00E2", "\u00E3", "\u0101"); 58 } 59 60 protected void setMoreKeysOfO(final ExpectedKeyboardBuilder builder) { 61 builder 62 // U+00F6: "" LATIN SMALL LETTER O WITH DIAERESIS 63 // U+00F4: "" LATIN SMALL LETTER O WITH CIRCUMFLEX 64 // U+00F2: "" LATIN SMALL LETTER O WITH GRAVE 65 // U+00F3: "" LATIN SMALL LETTER O WITH ACUTE 66 // U+00F5: "" LATIN SMALL LETTER O WITH TILDE 67 // U+0153: "" LATIN SMALL LIGATURE OE 68 // U+014D: "" LATIN SMALL LETTER O WITH MACRON 69 .setMoreKeysOf("o", "\u00F6", "\u00F4", "\u00F2", "\u00F3", "\u00F5", "\u0153", 70 "\u014D"); 71 } 72 73 @Override 74 public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) { 75 setNordicKeys(builder); 76 setMoreKeysOfA(builder); 77 setMoreKeysOfO(builder); 78 return builder 79 // U+00E9: "" LATIN SMALL LETTER E WITH ACUTE 80 // U+00E8: "" LATIN SMALL LETTER E WITH GRAVE 81 // U+00EA: "" LATIN SMALL LETTER E WITH CIRCUMFLEX 82 // U+00EB: "" LATIN SMALL LETTER E WITH DIAERESIS 83 // U+0119: "" LATIN SMALL LETTER E WITH OGONEK 84 // U+0117: "" LATIN SMALL LETTER E WITH DOT ABOVE 85 // U+0113: "" LATIN SMALL LETTER E WITH MACRON 86 .setMoreKeysOf("e", 87 "\u00E9", "\u00E8", "\u00EA", "\u00EB", "\u0119", "\u0117", "\u0113") 88 // U+00FC: "" LATIN SMALL LETTER U WITH DIAERESIS 89 // U+00FB: "" LATIN SMALL LETTER U WITH CIRCUMFLEX 90 // U+00F9: "" LATIN SMALL LETTER U WITH GRAVE 91 // U+00FA: "" LATIN SMALL LETTER U WITH ACUTE 92 // U+016B: "" LATIN SMALL LETTER U WITH MACRON 93 .setMoreKeysOf("u", "\u00FC", "\u00FB", "\u00F9", "\u00FA", "\u016B"); 94 } 95 } 96