am 22e2fa37: Merge "Add allowRedundantMoreKeys attribute"

* commit '22e2fa372c888e64a48eca8f98f0606c891f17ff':
  Add allowRedundantMoreKeys attribute
main
Tadashi G. Takaoka 2014-09-25 09:26:43 +00:00 committed by Android Git Automerger
commit 899d54f9e8
23 changed files with 769 additions and 269 deletions

View File

@ -518,6 +518,8 @@
<attr name="enableProximityCharsCorrection" format="boolean" />
<!-- Indicates if the keyboard layout supports being split or not. false by default -->
<attr name="supportsSplitLayout" format="boolean" />
<!-- Allow redundant more keys when they are in the base layout. true by default. -->
<attr name="allowRedundantMoreKeys" format="boolean" />
</declare-styleable>
<declare-styleable name="KeyboardLayoutSet_Feature">

View File

@ -23,7 +23,8 @@
<Element
latin:elementName="alphabet"
latin:elementKeyboard="@xml/kbd_nordic"
latin:enableProximityCharsCorrection="true" />
latin:enableProximityCharsCorrection="true"
latin:allowRedundantMoreKeys="true" />
<Element
latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" />

View File

@ -23,7 +23,8 @@
<Element
latin:elementName="alphabet"
latin:elementKeyboard="@xml/kbd_swiss"
latin:enableProximityCharsCorrection="true" />
latin:enableProximityCharsCorrection="true"
latin:allowRedundantMoreKeys="true" />
<Element
latin:elementName="symbols"
latin:elementKeyboard="@xml/kbd_symbols" />

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.compat;
import java.lang.reflect.Method;
public final class CharacterCompat {
// Note that Character.isAlphabetic(int), has been introduced in API level 19
// (Build.VERSION_CODE.KITKAT).
private static final Method METHOD_isAlphabetic = CompatUtils.getMethod(
Character.class, "isAlphabetic", int.class);
private CharacterCompat() {
// This utility class is not publicly instantiable.
}
public static boolean isAlphabetic(final int code) {
if (METHOD_isAlphabetic != null) {
return (Boolean)CompatUtils.invoke(null, false, METHOD_isAlphabetic, code);
}
switch (Character.getType(code)) {
case Character.UPPERCASE_LETTER:
case Character.LOWERCASE_LETTER:
case Character.TITLECASE_LETTER:
case Character.MODIFIER_LETTER:
case Character.OTHER_LETTER:
case Character.LETTER_NUMBER:
return true;
default:
return false;
}
}
}

View File

@ -395,6 +395,10 @@ public class Key implements Comparable<Key> {
* @param key the original key.
*/
protected Key(final Key key) {
this(key, key.mMoreKeys);
}
private Key(final Key key, final MoreKeySpec[] moreKeys) {
// Final attributes.
mCode = key.mCode;
mLabel = key.mLabel;
@ -408,7 +412,7 @@ public class Key implements Comparable<Key> {
mX = key.mX;
mY = key.mY;
mHitBox.set(key.mHitBox);
mMoreKeys = key.mMoreKeys;
mMoreKeys = moreKeys;
mMoreKeysColumnAndFlags = key.mMoreKeysColumnAndFlags;
mBackgroundType = key.mBackgroundType;
mActionFlags = key.mActionFlags;
@ -420,6 +424,14 @@ public class Key implements Comparable<Key> {
mEnabled = key.mEnabled;
}
public static Key removeRedundantMoreKeys(final Key key,
final MoreKeySpec.LettersOnBaseLayout lettersOnBaseLayout) {
final MoreKeySpec[] moreKeys = key.getMoreKeys();
final MoreKeySpec[] filteredMoreKeys = MoreKeySpec.removeRedundantMoreKeys(
moreKeys, lettersOnBaseLayout);
return (filteredMoreKeys == moreKeys) ? key : new Key(key, filteredMoreKeys);
}
private static boolean needsToUpperCase(final int labelFlags, final int keyboardElementId) {
if ((labelFlags & LABEL_FLAGS_PRESERVE_CASE) != 0) return false;
switch (keyboardElementId) {

View File

@ -97,6 +97,7 @@ public final class KeyboardLayoutSet {
int mKeyboardXmlId;
boolean mProximityCharsCorrectionEnabled;
boolean mSupportsSplitLayout;
boolean mAllowRedundantMoreKeys;
public ElementParams() {}
}
@ -202,6 +203,7 @@ public final class KeyboardLayoutSet {
if (id.isAlphabetKeyboard()) {
builder.setAutoGenerate(sKeysCache);
}
builder.setAllowRedundantMoreKes(elementParams.mAllowRedundantMoreKeys);
final int keyboardXmlId = elementParams.mKeyboardXmlId;
builder.load(keyboardXmlId, id);
if (mParams.mDisableTouchPositionCorrectionDataForTest) {
@ -395,6 +397,8 @@ public final class KeyboardLayoutSet {
false);
elementParams.mSupportsSplitLayout = a.getBoolean(
R.styleable.KeyboardLayoutSet_Element_supportsSplitLayout, false);
elementParams.mAllowRedundantMoreKeys = a.getBoolean(
R.styleable.KeyboardLayoutSet_Element_allowRedundantMoreKeys, true);
mParams.mKeyboardLayoutSetElementIdToParamsMap.put(elementName, elementParams);
} finally {
a.recycle();

View File

@ -162,6 +162,10 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
mParams.mKeysCache = keysCache;
}
public void setAllowRedundantMoreKes(final boolean enabled) {
mParams.mAllowRedundantMoreKeys = enabled;
}
public KeyboardBuilder<KP> load(final int xmlId, final KeyboardId id) {
mParams.mId = id;
final XmlResourceParser parser = mResources.getXml(xmlId);
@ -851,6 +855,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
}
private void endKeyboard() {
mParams.removeRedundantMoreKeys();
// {@link #parseGridRows(XmlPullParser,boolean)} may populate keyboard rows higher than
// previously expected.
final int actualHeight = mCurrentY - mParams.mVerticalGap + mParams.mBottomPadding;

View File

@ -68,6 +68,7 @@ public class KeyboardParams {
public final KeyStylesSet mKeyStyles = new KeyStylesSet(mTextsSet);
public KeysCache mKeysCache;
public boolean mAllowRedundantMoreKeys;
public int mMostCommonKeyHeight = 0;
public int mMostCommonKeyWidth = 0;
@ -115,6 +116,23 @@ public class KeyboardParams {
}
}
public void removeRedundantMoreKeys() {
if (mAllowRedundantMoreKeys) {
return;
}
final MoreKeySpec.LettersOnBaseLayout lettersOnBaseLayout =
new MoreKeySpec.LettersOnBaseLayout();
for (final Key key : mSortedKeys) {
lettersOnBaseLayout.addLetter(key);
}
final ArrayList<Key> allKeys = new ArrayList<>(mSortedKeys);
mSortedKeys.clear();
for (final Key key : allKeys) {
final Key filteredKey = Key.removeRedundantMoreKeys(key, lettersOnBaseLayout);
mSortedKeys.add(mKeysCache.replace(key, filteredKey));
}
}
private int mMaxHeightCount = 0;
private int mMaxWidthCount = 0;
private final SparseIntArray mHeightHistogram = new SparseIntArray();

View File

@ -36,4 +36,12 @@ public final class KeysCache {
mMap.put(key, key);
return key;
}
public Key replace(final Key oldKey, final Key newKey) {
if (oldKey.equals(newKey)) {
return oldKey;
}
mMap.remove(oldKey);
return get(newKey);
}
}

View File

@ -17,7 +17,9 @@
package com.android.inputmethod.keyboard.internal;
import android.text.TextUtils;
import android.util.SparseIntArray;
import com.android.inputmethod.compat.CharacterCompat;
import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.define.DebugFlags;
@ -26,6 +28,7 @@ import com.android.inputmethod.latin.utils.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Locale;
/**
@ -110,6 +113,46 @@ public final class MoreKeySpec {
}
}
public static class LettersOnBaseLayout {
private final SparseIntArray mCodes = new SparseIntArray();
private final HashSet<String> mTexts = new HashSet<>();
public void addLetter(final Key key) {
final int code = key.getCode();
if (CharacterCompat.isAlphabetic(code)) {
mCodes.put(code, 0);
} else if (code == Constants.CODE_OUTPUT_TEXT) {
mTexts.add(key.getOutputText());
}
}
public boolean contains(final MoreKeySpec moreKey) {
final int code = moreKey.mCode;
if (CharacterCompat.isAlphabetic(code) && mCodes.indexOfKey(code) >= 0) {
return true;
} else if (code == Constants.CODE_OUTPUT_TEXT && mTexts.contains(moreKey.mOutputText)) {
return true;
}
return false;
}
}
public static MoreKeySpec[] removeRedundantMoreKeys(final MoreKeySpec[] moreKeys,
final LettersOnBaseLayout lettersOnBaseLayout) {
if (moreKeys == null) {
return null;
}
final ArrayList<MoreKeySpec> filteredMoreKeys = new ArrayList<>();
for (final MoreKeySpec moreKey : moreKeys) {
if (!lettersOnBaseLayout.contains(moreKey)) {
filteredMoreKeys.add(moreKey);
}
}
final int size = filteredMoreKeys.size();
return (moreKeys.length == size) ? moreKeys
: filteredMoreKeys.toArray(new MoreKeySpec[size]);
}
private static final boolean DEBUG = DebugFlags.DEBUG_ENABLED;
// Constants for parsing.
private static final char COMMA = Constants.CODE_COMMA;

View File

@ -18,9 +18,8 @@ package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey.ExpectedAdditionalMoreKey;
import com.android.inputmethod.latin.settings.CustomInputStyleSettingsFragment;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;

View File

@ -0,0 +1,101 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.keyboard.layout.tests;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
class DanishCustomizer extends EuroCustomizer {
public DanishCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
@Override
public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_R9L; }
@Override
public ExpectedKey[] getDoubleAngleQuoteKeys() { return Symbols.DOUBLE_ANGLE_QUOTES_RL; }
@Override
public ExpectedKey[] getSingleAngleQuoteKeys() { return Symbols.SINGLE_ANGLE_QUOTES_RL; }
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
builder
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
.replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5")
// U+00E6: "æ" LATIN SMALL LETTER AE
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
.replaceKeyOfLabel(Nordic.ROW2_10, "\u00E6")
.setMoreKeysOf("\u00E6", "\u00E4")
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
.replaceKeyOfLabel(Nordic.ROW2_11, "\u00F8")
.setMoreKeysOf("\u00F8", "\u00F6");
}
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
setNordicKeys(builder);
return builder
// U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
// U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
.setMoreKeysOf("e", "\u00E9", "\u00EB")
// U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE
// U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS
.setMoreKeysOf("y", "\u00FD", "\u00FF")
// U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
// U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
// U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
.setMoreKeysOf("u", "\u00FA", "\u00FC", "\u00FB", "\u00F9", "\u016B")
// U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
// U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
.setMoreKeysOf("i", "\u00ED", "\u00EF")
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
// U+0153: "œ" LATIN SMALL LIGATURE OE
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
.setMoreKeysOf("o", "\u00F3", "\u00F4", "\u00F2", "\u00F5", "\u0153", "\u014D")
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
// U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
// U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
.setMoreKeysOf("a", "\u00E1", "\u00E4", "\u00E0", "\u00E2", "\u00E3", "\u0101")
// U+00DF: "ß" LATIN SMALL LETTER SHARP S
// U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
// U+0161: "š" LATIN SMALL LETTER S WITH CARON
.setMoreKeysOf("s", "\u00DF", "\u015B", "\u0161")
// U+00F0: "ð" LATIN SMALL LETTER ETH
.setMoreKeysOf("d", "\u00F0")
// U+0142: "ł" LATIN SMALL LETTER L WITH STROKE
.setMoreKeysOf("l", "\u0142")
// U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
// U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
.setMoreKeysOf("n", "\u00F1", "\u0144");
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.keyboard.layout.tests;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
class FinnishCustomizer extends EuroCustomizer {
public FinnishCustomizer(final Locale locale) { super(locale); }
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
builder
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
.replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5")
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
.replaceKeyOfLabel(Nordic.ROW2_10, "\u00F6")
.setMoreKeysOf("\u00F6","\u00F8")
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
// U+00E6: "æ" LATIN SMALL LETTER AE
.replaceKeyOfLabel(Nordic.ROW2_11, "\u00E4")
.setMoreKeysOf("\u00E4", "\u00E6");
}
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
setNordicKeys(builder);
return builder
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
.setMoreKeysOf("u", "\u00FC")
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
// U+0153: "œ" LATIN SMALL LIGATURE OE
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
.setMoreKeysOf("o",
"\u00F8", "\u00F4", "\u00F2", "\u00F3", "\u00F5", "\u0153", "\u014D")
// U+00E6: "æ" LATIN SMALL LETTER AE
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
// U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
// U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
.setMoreKeysOf("a", "\u00E6", "\u00E0", "\u00E1", "\u00E2", "\u00E3", "\u0101")
// U+0161: "š" LATIN SMALL LETTER S WITH CARON
// U+00DF: "ß" LATIN SMALL LETTER SHARP S
// U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
.setMoreKeysOf("s", "\u0161", "\u00DF", "\u015B")
// U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
// U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
// U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
.setMoreKeysOf("z", "\u017E", "\u017A", "\u017C");
}
}

View File

@ -0,0 +1,86 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.keyboard.layout.tests;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
class NorwegianCustomizer extends LayoutCustomizer {
public NorwegianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_L9R; }
@Override
public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_L9R; }
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
builder
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
.replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5")
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
.replaceKeyOfLabel(Nordic.ROW2_10, "\u00F8")
.setMoreKeysOf("\u00F8", "\u00F6")
// U+00E6: "æ" LATIN SMALL LETTER AE
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
.replaceKeyOfLabel(Nordic.ROW2_11, "\u00E6")
.setMoreKeysOf("\u00E6", "\u00E4");
}
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
setNordicKeys(builder);
return builder
// U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
// U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
// U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
// U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
// U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
// U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
// U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
.setMoreKeysOf("e",
"\u00E9", "\u00E8", "\u00EA", "\u00EB", "\u0119", "\u0117", "\u0113")
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
// U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
// U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
// U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
.setMoreKeysOf("u", "\u00FC", "\u00FB", "\u00F9", "\u00FA", "\u016B")
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
// U+0153: "œ" LATIN SMALL LIGATURE OE
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
.setMoreKeysOf("o",
"\u00F4", "\u00F2", "\u00F3", "\u00F6", "\u00F5", "\u0153", "\u014D")
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
// U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
// U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
.setMoreKeysOf("a", "\u00E0", "\u00E4", "\u00E1", "\u00E2", "\u00E3", "\u0101");
}
}

View File

@ -0,0 +1,131 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.keyboard.layout.tests;
import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
class SwedishCustomizer extends LayoutCustomizer {
private final LayoutCustomizer mEuroCustomizer;
public SwedishCustomizer(final Locale locale) {
super(locale);
mEuroCustomizer = new EuroCustomizer(locale);
}
@Override
public ExpectedKey getCurrencyKey() {
return mEuroCustomizer.getCurrencyKey();
}
@Override
public ExpectedKey[] getOtherCurrencyKeys() {
return mEuroCustomizer.getOtherCurrencyKeys();
}
@Override
public ExpectedKey[] getDoubleAngleQuoteKeys() { return Symbols.DOUBLE_ANGLE_QUOTES_RL; }
@Override
public ExpectedKey[] getSingleAngleQuoteKeys() { return Symbols.SINGLE_ANGLE_QUOTES_RL; }
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
builder
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
.replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5")
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
// U+0153: "œ" LATIN SMALL LIGATURE OE
.replaceKeyOfLabel(Nordic.ROW2_10, "\u00F6")
.setMoreKeysOf("\u00F6", "\u00F8", "\u0153")
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
// U+00E6: "æ" LATIN SMALL LETTER AE
.replaceKeyOfLabel(Nordic.ROW2_11, "\u00E4")
.setMoreKeysOf("\u00E4", "\u00E6");
}
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
setNordicKeys(builder);
return builder
// U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
// U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
// U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
// U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
// U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
.setMoreKeysOf("e", "\u00E9", "\u00E8", "\u00EA", "\u00EB", "\u0119")
// U+0159: "ř" LATIN SMALL LETTER R WITH CARON
.setMoreKeysOf("r", "\u0159")
// U+0165: "ť" LATIN SMALL LETTER T WITH CARON
// U+00FE: "þ" LATIN SMALL LETTER THORN
.setMoreKeysOf("t", "\u0165", "\u00FE")
// U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE
// U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS
.setMoreKeysOf("y", "\u00FD", "\u00FF")
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
// U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
// U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
// U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
.setMoreKeysOf("u", "\u00FC", "\u00FA", "\u00F9", "\u00FB", "\u016B")
// U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
// U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
// U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
// U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
.setMoreKeysOf("i", "\u00ED", "\u00EC", "\u00EE", "\u00EF")
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
.setMoreKeysOf("o", "\u00F3", "\u00F2", "\u00F4", "\u00F5", "\u014D")
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
// U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK
// U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
.setMoreKeysOf("a", "\u00E1", "\u00E0", "\u00E2", "\u0105", "\u00E3")
// U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
// U+0161: "š" LATIN SMALL LETTER S WITH CARON
// U+015F: "ş" LATIN SMALL LETTER S WITH CEDILLA
// U+00DF: "ß" LATIN SMALL LETTER SHARP S
.setMoreKeysOf("s", "\u015B", "\u0161", "\u015F", "\u00DF")
// U+00F0: "ð" LATIN SMALL LETTER ETH
// U+010F: "ď" LATIN SMALL LETTER D WITH CARON
.setMoreKeysOf("d", "\u00F0", "\u010F")
// U+0142: "ł" LATIN SMALL LETTER L WITH STROKE
.setMoreKeysOf("l", "\u0142")
// U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
// U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
// U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
.setMoreKeysOf("z", "\u017A", "\u017E", "\u017C")
// U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
// U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
// U+010D: "č" LATIN SMALL LETTER C WITH CARON
.setMoreKeysOf("c", "\u00E7", "\u0107", "\u010D")
// U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
// U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
// U+0148: "ň" LATIN SMALL LETTER N WITH CARON
.setMoreKeysOf("n", "\u0144", "\u00F1", "\u0148");
}
}

View File

@ -19,11 +19,7 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@ -37,73 +33,4 @@ public final class TestsDanish extends LayoutTestsBase {
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class DanishCustomizer extends EuroCustomizer {
public DanishCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_R9L; }
@Override
public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_R9L; }
@Override
public ExpectedKey[] getDoubleAngleQuoteKeys() { return Symbols.DOUBLE_ANGLE_QUOTES_RL; }
@Override
public ExpectedKey[] getSingleAngleQuoteKeys() { return Symbols.SINGLE_ANGLE_QUOTES_RL; }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
return builder
// U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
// U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
.setMoreKeysOf("e", "\u00E9", "\u00EB")
// U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE
// U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS
.setMoreKeysOf("y", "\u00FD", "\u00FF")
// U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
// U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
// U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
.setMoreKeysOf("u", "\u00FA", "\u00FC", "\u00FB", "\u00F9", "\u016B")
// U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
// U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
.setMoreKeysOf("i", "\u00ED", "\u00EF")
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
// U+0153: "œ" LATIN SMALL LIGATURE OE
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
.setMoreKeysOf("o", "\u00F3", "\u00F4", "\u00F2", "\u00F5", "\u0153", "\u014D")
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
.replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5")
// U+00E6: "æ" LATIN SMALL LETTER AE
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
.replaceKeyOfLabel(Nordic.ROW2_10, key("\u00E6", moreKey("\u00E4")))
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
.replaceKeyOfLabel(Nordic.ROW2_11, key("\u00F8", moreKey("\u00F6")))
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
// U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
// U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
.setMoreKeysOf("a", "\u00E1", "\u00E4", "\u00E0", "\u00E2", "\u00E3", "\u0101")
// U+00DF: "ß" LATIN SMALL LETTER SHARP S
// U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
// U+0161: "š" LATIN SMALL LETTER S WITH CARON
.setMoreKeysOf("s", "\u00DF", "\u015B", "\u0161")
// U+00F0: "ð" LATIN SMALL LETTER ETH
.setMoreKeysOf("d", "\u00F0")
// U+0142: "ł" LATIN SMALL LETTER L WITH STROKE
.setMoreKeysOf("l", "\u0142")
// U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
// U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
.setMoreKeysOf("n", "\u00F1", "\u0144");
}
}
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwertz;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
/**
* da: Danish/qwertz
*/
@SmallTest
public final class TestsDanishQwertz extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("da");
private static final LayoutBase LAYOUT = new Qwertz(new DanishQwertyCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class DanishQwertyCustomizer extends DanishCustomizer {
public DanishQwertyCustomizer(final Locale locale) {
super(locale);
}
@Override
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
// QWERTZ layout doesn't have Nordic keys.
}
}
}

View File

@ -19,9 +19,7 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@ -35,47 +33,4 @@ public final class TestsFinnish extends LayoutTestsBase {
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class FinnishCustomizer extends EuroCustomizer {
public FinnishCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
return builder
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
.setMoreKeysOf("u", "\u00FC")
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
// U+0153: "œ" LATIN SMALL LIGATURE OE
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
.setMoreKeysOf("o",
"\u00F8", "\u00F4", "\u00F2", "\u00F3", "\u00F5", "\u0153", "\u014D")
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
.replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5")
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
.replaceKeyOfLabel(Nordic.ROW2_10, key("\u00F6", moreKey("\u00F8")))
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
// U+00E6: "æ" LATIN SMALL LETTER AE
.replaceKeyOfLabel(Nordic.ROW2_11, key("\u00E4", moreKey("\u00E6")))
// U+00E6: "æ" LATIN SMALL LETTER AE
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
// U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
// U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
.setMoreKeysOf("a", "\u00E6", "\u00E0", "\u00E1", "\u00E2", "\u00E3", "\u0101")
// U+0161: "š" LATIN SMALL LETTER S WITH CARON
// U+00DF: "ß" LATIN SMALL LETTER SHARP S
// U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
.setMoreKeysOf("s", "\u0161", "\u00DF", "\u015B")
// U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
// U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
// U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
.setMoreKeysOf("z", "\u017E", "\u017A", "\u017C");
}
}
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.Qwerty;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
/**
* fi: Finnish/qwerty
*/
@SmallTest
public final class TestsFinnishQwerty extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("fi");
private static final LayoutBase LAYOUT = new Qwerty(new FinnishQwertyCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class FinnishQwertyCustomizer extends FinnishCustomizer {
public FinnishQwertyCustomizer(final Locale locale) {
super(locale);
}
@Override
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
// QWERTY layout doesn't have Nordic keys.
}
}
}

View File

@ -19,11 +19,7 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@ -37,58 +33,4 @@ public final class TestsNorwegian extends LayoutTestsBase {
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class NorwegianCustomizer extends LayoutCustomizer {
public NorwegianCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleQuoteMoreKeys() { return Symbols.DOUBLE_QUOTES_L9R; }
@Override
public ExpectedKey[] getSingleQuoteMoreKeys() { return Symbols.SINGLE_QUOTES_L9R; }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
return builder
// U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
// U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
// U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
// U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
// U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
// U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
// U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
.setMoreKeysOf("e",
"\u00E9", "\u00E8", "\u00EA", "\u00EB", "\u0119", "\u0117", "\u0113")
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
// U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
// U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
// U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
.setMoreKeysOf("u", "\u00FC", "\u00FB", "\u00F9", "\u00FA", "\u016B")
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
// U+0153: "œ" LATIN SMALL LIGATURE OE
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
.setMoreKeysOf("o",
"\u00F4", "\u00F2", "\u00F3", "\u00F6", "\u00F5", "\u0153", "\u014D")
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
.replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5")
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
.replaceKeyOfLabel(Nordic.ROW2_10, key("\u00F8", moreKey("\u00F6")))
// U+00E6: "æ" LATIN SMALL LETTER AE
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
.replaceKeyOfLabel(Nordic.ROW2_11, key("\u00E6", moreKey("\u00E4")))
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
// U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
// U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
.setMoreKeysOf("a", "\u00E0", "\u00E4", "\u00E1", "\u00E2", "\u00E3", "\u0101");
}
}
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.Colemak;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
/**
* nb: Norwegian Bokmål/colemak
*/
@SmallTest
public final class TestsNorwegianColemak extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("nb");
private static final LayoutBase LAYOUT = new Colemak(new NorwegianColemakCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class NorwegianColemakCustomizer extends NorwegianCustomizer {
public NorwegianColemakCustomizer(final Locale locale) {
super(locale);
}
@Override
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
// Colemak layout doesn't have Nordic keys.
}
}
}

View File

@ -19,11 +19,7 @@ package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.LayoutBase.EuroCustomizer;
import com.android.inputmethod.keyboard.layout.Nordic;
import com.android.inputmethod.keyboard.layout.Symbols;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
@ -37,88 +33,4 @@ public final class TestsSwedish extends LayoutTestsBase {
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class SwedishCustomizer extends EuroCustomizer {
public SwedishCustomizer(final Locale locale) { super(locale); }
@Override
public ExpectedKey[] getDoubleAngleQuoteKeys() { return Symbols.DOUBLE_ANGLE_QUOTES_RL; }
@Override
public ExpectedKey[] getSingleAngleQuoteKeys() { return Symbols.SINGLE_ANGLE_QUOTES_RL; }
@Override
public ExpectedKeyboardBuilder setAccentedLetters(final ExpectedKeyboardBuilder builder) {
return builder
// U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
// U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
// U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
// U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
// U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
.setMoreKeysOf("e", "\u00E9", "\u00E8", "\u00EA", "\u00EB", "\u0119")
// U+0159: "ř" LATIN SMALL LETTER R WITH CARON
.setMoreKeysOf("r", "\u0159")
// U+0165: "ť" LATIN SMALL LETTER T WITH CARON
// U+00FE: "þ" LATIN SMALL LETTER THORN
.setMoreKeysOf("t", "\u0165", "\u00FE")
// U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE
// U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS
.setMoreKeysOf("y", "\u00FD", "\u00FF")
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
// U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
// U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
// U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
.setMoreKeysOf("u", "\u00FC", "\u00FA", "\u00F9", "\u00FB", "\u016B")
// U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
// U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
// U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
// U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
.setMoreKeysOf("i", "\u00ED", "\u00EC", "\u00EE", "\u00EF")
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
// U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
// U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
.setMoreKeysOf("o", "\u00F3", "\u00F2", "\u00F4", "\u00F5", "\u014D")
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
.replaceKeyOfLabel(Nordic.ROW1_11, "\u00E5")
// U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
// U+0153: "œ" LATIN SMALL LIGATURE OE
.replaceKeyOfLabel(Nordic.ROW2_10,
key("\u00F6", joinMoreKeys("\u00F8", "\u0153")))
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
// U+00E6: "æ" LATIN SMALL LETTER AE
.replaceKeyOfLabel(Nordic.ROW2_11, key("\u00E4", moreKey("\u00E6")))
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
// U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
// U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK
// U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
.setMoreKeysOf("a", "\u00E1", "\u00E0", "\u00E2", "\u0105", "\u00E3")
// U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
// U+0161: "š" LATIN SMALL LETTER S WITH CARON
// U+015F: "ş" LATIN SMALL LETTER S WITH CEDILLA
// U+00DF: "ß" LATIN SMALL LETTER SHARP S
.setMoreKeysOf("s", "\u015B", "\u0161", "\u015F", "\u00DF")
// U+00F0: "ð" LATIN SMALL LETTER ETH
// U+010F: "ď" LATIN SMALL LETTER D WITH CARON
.setMoreKeysOf("d", "\u00F0", "\u010F")
// U+0142: "ł" LATIN SMALL LETTER L WITH STROKE
.setMoreKeysOf("l", "\u0142")
// U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
// U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
// U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
.setMoreKeysOf("z", "\u017A", "\u017E", "\u017C")
// U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
// U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
// U+010D: "č" LATIN SMALL LETTER C WITH CARON
.setMoreKeysOf("c", "\u00E7", "\u0107", "\u010D")
// U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
// U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
// U+0148: "ň" LATIN SMALL LETTER N WITH CARON
.setMoreKeysOf("n", "\u0144", "\u00F1", "\u0148");
}
}
}

View File

@ -0,0 +1,89 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.inputmethod.keyboard.layout.tests;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.inputmethod.keyboard.layout.LayoutBase;
import com.android.inputmethod.keyboard.layout.LayoutBase.LayoutCustomizer;
import com.android.inputmethod.keyboard.layout.PcQwerty;
import com.android.inputmethod.keyboard.layout.PcQwerty.PcQwertyCustomizer;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKeyboardBuilder;
import java.util.Locale;
/**
* sv: Swedish/pcqwerty
*/
@SmallTest
public final class TestsSwedishPcQwerty extends LayoutTestsBase {
private static final Locale LOCALE = new Locale("sv");
private static final LayoutBase LAYOUT = new PcQwerty(new SwedishPcQwertyCustomizer(LOCALE));
@Override
LayoutBase getLayout() { return LAYOUT; }
private static class SwedishPcQwertyCustomizer extends SwedishCustomizer {
private final LayoutCustomizer mPcQwertyCustomizer;
public SwedishPcQwertyCustomizer(final Locale locale) {
super(locale);
mPcQwertyCustomizer = new PcQwertyCustomizer(locale);
}
@Override
public ExpectedKey getCurrencyKey() {
return mPcQwertyCustomizer.getCurrencyKey();
}
@Override
public ExpectedKey[] getOtherCurrencyKeys() {
return mPcQwertyCustomizer.getOtherCurrencyKeys();
}
@Override
public int getNumberOfRows() {
return mPcQwertyCustomizer.getNumberOfRows();
}
@Override
public ExpectedKey[] getLeftShiftKeys(final boolean isPhone) {
return mPcQwertyCustomizer.getLeftShiftKeys(isPhone);
}
@Override
public ExpectedKey[] getRightShiftKeys(final boolean isPhone) {
return mPcQwertyCustomizer.getRightShiftKeys(isPhone);
}
@Override
public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
return mPcQwertyCustomizer.getKeysLeftToSpacebar(isPhone);
}
@Override
public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
return mPcQwertyCustomizer.getKeysRightToSpacebar(isPhone);
}
@Override
protected void setNordicKeys(final ExpectedKeyboardBuilder builder) {
// PC QWERTY layout doesn't have Nordic keys.
}
}
}