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 SwedishCustomizer extends LayoutCustomizer { 27 private final LayoutCustomizer mEuroCustomizer; 28 29 public SwedishCustomizer(final Locale locale) { 30 super(locale); 31 mEuroCustomizer = new EuroCustomizer(locale); 32 } 33 34 @Override 35 public ExpectedKey getCurrencyKey() { 36 return mEuroCustomizer.getCurrencyKey(); 37 } 38 39 @Override 40 public ExpectedKey[] getOtherCurrencyKeys() { 41 return mEuroCustomizer.getOtherCurrencyKeys(); 42 } 43 44 @Override 45 public ExpectedKey[] getDoubleAngleQuoteKeys() { return Symbols.DOUBLE_ANGLE_QUOTES_RL; } 46 47 @Override 48 public ExpectedKey[] getSingleAngleQuoteKeys() { return Symbols.SINGLE_ANGLE_QUOTES_RL; } 49 50 protected void setNordicKeys(final ExpectedKeyboardBuilder builder) { 51 builder 52 // U+00E5: "" LATIN SMALL LETTER A WITH RING ABOVE 53 .replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5") 54 // U+00F6: "" LATIN SMALL LETTER O WITH DIAERESIS 55 // U+00F8: "" LATIN SMALL LETTER O WITH STROKE 56 // U+0153: "" LATIN SMALL LIGATURE OE 57 .replaceKeyOfLabel(Nordic.ROW2_10, "\u00F6") 58 .setMoreKeysOf("\u00F6", "\u00F8", "\u0153") 59 // U+00E4: "" LATIN SMALL LETTER A WITH DIAERESIS 60 // U+00E6: "" LATIN SMALL LETTER AE 61 .replaceKeyOfLabel(Nordic.ROW2_11, "\u00E4") 62 .setMoreKeysOf("\u00E4", "\u00E6"); 63 } 64 65 protected void setMoreKeysOfA(final ExpectedKeyboardBuilder builder) { 66 builder 67 // U+00E6: "" LATIN SMALL LETTER AE 68 // U+00E1: "" LATIN SMALL LETTER A WITH ACUTE 69 // U+00E0: "" LATIN SMALL LETTER A WITH GRAVE 70 // U+00E2: "" LATIN SMALL LETTER A WITH CIRCUMFLEX 71 // U+0105: "" LATIN SMALL LETTER A WITH OGONEK 72 // U+00E3: "" LATIN SMALL LETTER A WITH TILDE 73 .setMoreKeysOf("a", "\u00E6", "\u00E1", "\u00E0", "\u00E2", "\u0105", "\u00E3"); 74 } 75 76 protected void setMoreKeysOfO(final ExpectedKeyboardBuilder builder) { 77 builder 78 // U+00F8: "" LATIN SMALL LETTER O WITH STROKE 79 // U+0153: "" LATIN SMALL LIGATURE OE 80 // U+00F3: "" LATIN SMALL LETTER O WITH ACUTE 81 // U+00F2: "" LATIN SMALL LETTER O WITH GRAVE 82 // U+00F4: "" LATIN SMALL LETTER O WITH CIRCUMFLEX 83 // U+00F5: "" LATIN SMALL LETTER O WITH TILDE 84 // U+014D: "" LATIN SMALL LETTER O WITH MACRON 85 .setMoreKeysOf("o", "\u00F8", "\u0153", "\u00F3", "\u00F2", "\u00F4", "\u00F5", 86 "\u014D"); 87 } 88 89 @Override 90 public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) { 91 setNordicKeys(builder); 92 setMoreKeysOfA(builder); 93 setMoreKeysOfO(builder); 94 return builder 95 // U+00E9: "" LATIN SMALL LETTER E WITH ACUTE 96 // U+00E8: "" LATIN SMALL LETTER E WITH GRAVE 97 // U+00EA: "" LATIN SMALL LETTER E WITH CIRCUMFLEX 98 // U+00EB: "" LATIN SMALL LETTER E WITH DIAERESIS 99 // U+0119: "" LATIN SMALL LETTER E WITH OGONEK 100 .setMoreKeysOf("e", "\u00E9", "\u00E8", "\u00EA", "\u00EB", "\u0119") 101 // U+0159: "" LATIN SMALL LETTER R WITH CARON 102 .setMoreKeysOf("r", "\u0159") 103 // U+0165: "" LATIN SMALL LETTER T WITH CARON 104 // U+00FE: "" LATIN SMALL LETTER THORN 105 .setMoreKeysOf("t", "\u0165", "\u00FE") 106 // U+00FD: "" LATIN SMALL LETTER Y WITH ACUTE 107 // U+00FF: "" LATIN SMALL LETTER Y WITH DIAERESIS 108 .setMoreKeysOf("y", "\u00FD", "\u00FF") 109 // U+00FC: "" LATIN SMALL LETTER U WITH DIAERESIS 110 // U+00FA: "" LATIN SMALL LETTER U WITH ACUTE 111 // U+00F9: "" LATIN SMALL LETTER U WITH GRAVE 112 // U+00FB: "" LATIN SMALL LETTER U WITH CIRCUMFLEX 113 // U+016B: "" LATIN SMALL LETTER U WITH MACRON 114 .setMoreKeysOf("u", "\u00FC", "\u00FA", "\u00F9", "\u00FB", "\u016B") 115 // U+00ED: "" LATIN SMALL LETTER I WITH ACUTE 116 // U+00EC: "" LATIN SMALL LETTER I WITH GRAVE 117 // U+00EE: "" LATIN SMALL LETTER I WITH CIRCUMFLEX 118 // U+00EF: "" LATIN SMALL LETTER I WITH DIAERESIS 119 .setMoreKeysOf("i", "\u00ED", "\u00EC", "\u00EE", "\u00EF") 120 // U+015B: "" LATIN SMALL LETTER S WITH ACUTE 121 // U+0161: "" LATIN SMALL LETTER S WITH CARON 122 // U+015F: "" LATIN SMALL LETTER S WITH CEDILLA 123 // U+00DF: "" LATIN SMALL LETTER SHARP S 124 .setMoreKeysOf("s", "\u015B", "\u0161", "\u015F", "\u00DF") 125 // U+00F0: "" LATIN SMALL LETTER ETH 126 // U+010F: "" LATIN SMALL LETTER D WITH CARON 127 .setMoreKeysOf("d", "\u00F0", "\u010F") 128 // U+0142: "" LATIN SMALL LETTER L WITH STROKE 129 .setMoreKeysOf("l", "\u0142") 130 // U+017A: "" LATIN SMALL LETTER Z WITH ACUTE 131 // U+017E: "" LATIN SMALL LETTER Z WITH CARON 132 // U+017C: "" LATIN SMALL LETTER Z WITH DOT ABOVE 133 .setMoreKeysOf("z", "\u017A", "\u017E", "\u017C") 134 // U+00E7: "" LATIN SMALL LETTER C WITH CEDILLA 135 // U+0107: "" LATIN SMALL LETTER C WITH ACUTE 136 // U+010D: "" LATIN SMALL LETTER C WITH CARON 137 .setMoreKeysOf("c", "\u00E7", "\u0107", "\u010D") 138 // U+0144: "" LATIN SMALL LETTER N WITH ACUTE 139 // U+00F1: "" LATIN SMALL LETTER N WITH TILDE 140 // U+0148: "" LATIN SMALL LETTER N WITH CARON 141 .setMoreKeysOf("n", "\u0144", "\u00F1", "\u0148"); 142 } 143 } 144