diff --git a/java/res/xml-sw600dp/key_comma.xml b/java/res/xml-sw600dp/key_comma.xml
index 67199e237..e616a8d70 100644
--- a/java/res/xml-sw600dp/key_comma.xml
+++ b/java/res/xml-sw600dp/key_comma.xml
@@ -2,7 +2,7 @@
-
-
+ latin:keySpec="/"
+ latin:keyStyle="settingsMoreKeysStyle" />
+
+
+
+
+
+
-
+ latin:keySpec="!text/keyspec_tablet_comma"
+ latin:moreKeys="!text/morekeys_tablet_comma,%"
+ latin:keyHintLabel="!text/keyhintlabel_tablet_comma"
+ latin:keyLabelFlags="hasPopupHint"
+ latin:keyStyle="settingsMoreKeysStyle" />
diff --git a/java/res/xml-sw600dp/key_f1.xml b/java/res/xml-sw600dp/key_f1.xml
deleted file mode 100644
index ba78a6430..000000000
--- a/java/res/xml-sw600dp/key_f1.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/java/res/xml-sw600dp/key_period.xml b/java/res/xml-sw600dp/key_period.xml
index d2909d82d..df1daf792 100644
--- a/java/res/xml-sw600dp/key_period.xml
+++ b/java/res/xml-sw600dp/key_period.xml
@@ -35,6 +35,13 @@
latin:moreKeys="!autoColumnOrder!8,\\,,.,',#,),(,/,;,@,:,-,",+,\\%,&"
latin:backgroundType="functional" />
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/java/res/xml-sw600dp/key_space_5kw.xml b/java/res/xml-sw600dp/key_space_7kw.xml
similarity index 93%
rename from java/res/xml-sw600dp/key_space_5kw.xml
rename to java/res/xml-sw600dp/key_space_7kw.xml
index 8302184c7..3311f812a 100644
--- a/java/res/xml-sw600dp/key_space_5kw.xml
+++ b/java/res/xml-sw600dp/key_space_7kw.xml
@@ -34,7 +34,7 @@
latin:keyStyle="languageSwitchKeyStyle" />
+ latin:keyWidth="45.0%p" />
@@ -44,7 +44,7 @@
>
+ latin:keyWidth="54.0%p" />
@@ -55,13 +55,13 @@
latin:keyStyle="languageSwitchKeyStyle" />
+ latin:keyWidth="54.0%p" />
+ latin:keyWidth="63.0%p" />
diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml
index 1b52b1efd..c750a9319 100644
--- a/java/res/xml-sw600dp/key_styles_common.xml
+++ b/java/res/xml-sw600dp/key_styles_common.xml
@@ -36,6 +36,9 @@
+
diff --git a/java/res/xml-sw600dp/row_dvorak4.xml b/java/res/xml-sw600dp/row_dvorak4.xml
deleted file mode 100644
index ab2b5603d..000000000
--- a/java/res/xml-sw600dp/row_dvorak4.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/java/res/xml-sw600dp/row_pcqwerty5.xml b/java/res/xml-sw600dp/row_pcqwerty5.xml
index ac07f11c2..4dcae1455 100644
--- a/java/res/xml-sw600dp/row_pcqwerty5.xml
+++ b/java/res/xml-sw600dp/row_pcqwerty5.xml
@@ -50,6 +50,6 @@
latin:keyXPos="-9.0%p"
latin:keyWidth="9.0%p"
latin:backgroundType="functional"
- latin:keyboardLayout="@xml/key_f2" />
+ latin:keyboardLayout="@xml/key_emoji" />
diff --git a/java/res/xml-sw600dp/row_qwerty4.xml b/java/res/xml-sw600dp/row_qwerty4.xml
index 0eb86f2d4..ed7150de4 100644
--- a/java/res/xml-sw600dp/row_qwerty4.xml
+++ b/java/res/xml-sw600dp/row_qwerty4.xml
@@ -30,18 +30,14 @@
latin:keyWidth="10.0%p" />
-
-
+ latin:keyboardLayout="@xml/key_emoji" />
diff --git a/java/res/xml-sw600dp/rows_dvorak.xml b/java/res/xml-sw600dp/rows_dvorak.xml
index 88592676d..c8f5e3aa2 100644
--- a/java/res/xml-sw600dp/rows_dvorak.xml
+++ b/java/res/xml-sw600dp/rows_dvorak.xml
@@ -53,6 +53,8 @@
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="fillRight" />
+
+ latin:keyboardLayout="@xml/row_qwerty4" />
diff --git a/java/res/xml-sw600dp/rows_symbols.xml b/java/res/xml-sw600dp/rows_symbols.xml
index a915c3351..05e7c685e 100644
--- a/java/res/xml-sw600dp/rows_symbols.xml
+++ b/java/res/xml-sw600dp/rows_symbols.xml
@@ -70,6 +70,6 @@
+ latin:keyboardLayout="@xml/key_emoji" />
diff --git a/java/res/xml-sw600dp/rows_symbols_shift.xml b/java/res/xml-sw600dp/rows_symbols_shift.xml
index 7ead4d5b1..70ac42eb9 100644
--- a/java/res/xml-sw600dp/rows_symbols_shift.xml
+++ b/java/res/xml-sw600dp/rows_symbols_shift.xml
@@ -72,6 +72,6 @@
+ latin:keyboardLayout="@xml/key_emoji" />
diff --git a/java/res/xml/key_f1.xml b/java/res/xml/key_comma.xml
similarity index 82%
rename from java/res/xml/key_f1.xml
rename to java/res/xml/key_comma.xml
index 7bd7385a1..cf919a85d 100644
--- a/java/res/xml/key_f1.xml
+++ b/java/res/xml/key_comma.xml
@@ -22,6 +22,15 @@
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
>
+
+
+
diff --git a/java/res/xml/key_f2.xml b/java/res/xml/key_emoji.xml
similarity index 100%
rename from java/res/xml/key_f2.xml
rename to java/res/xml/key_emoji.xml
diff --git a/java/res/xml/key_period.xml b/java/res/xml/key_period.xml
index e1d4bbdf7..fc27c0235 100644
--- a/java/res/xml/key_period.xml
+++ b/java/res/xml/key_period.xml
@@ -48,6 +48,14 @@
latin:moreKeys="!text/morekeys_punctuation"
latin:backgroundType="functional" />
+
+
+
+
diff --git a/java/res/xml/key_styles_settings.xml b/java/res/xml/key_styles_settings.xml
index 956b40235..a504bed78 100644
--- a/java/res/xml/key_styles_settings.xml
+++ b/java/res/xml/key_styles_settings.xml
@@ -29,15 +29,17 @@
>
+ latin:backgroundType="functional"
+ latin:parentStyle="baseSettingsMoreKeysStyle" />
+ latin:additionalMoreKeys="!text/keyspec_settings"
+ latin:backgroundType="functional"
+ latin:parentStyle="baseSettingsMoreKeysStyle" />
diff --git a/java/res/xml/row_dvorak4.xml b/java/res/xml/row_dvorak4.xml
deleted file mode 100644
index e7a3ee736..000000000
--- a/java/res/xml/row_dvorak4.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/java/res/xml/row_qwerty4.xml b/java/res/xml/row_qwerty4.xml
index 509092d96..5bc104f69 100644
--- a/java/res/xml/row_qwerty4.xml
+++ b/java/res/xml/row_qwerty4.xml
@@ -28,7 +28,7 @@
latin:keyStyle="toSymbolKeyStyle"
latin:keyWidth="15%p" />
+ latin:keyboardLayout="@xml/key_comma" />
diff --git a/java/res/xml/rows_dvorak.xml b/java/res/xml/rows_dvorak.xml
index 13d70210d..f656613ec 100644
--- a/java/res/xml/rows_dvorak.xml
+++ b/java/res/xml/rows_dvorak.xml
@@ -49,6 +49,8 @@
latin:keyWidth="fillRight"
latin:visualInsetsLeft="1%p" />
+
+ latin:keyboardLayout="@xml/row_qwerty4" />
diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java
index 22460ef7d..0a76a9d91 100644
--- a/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/KeyboardLayoutSetTestsBase.java
@@ -113,13 +113,13 @@ public abstract class KeyboardLayoutSetTestsBase extends AndroidTestCase {
"Unknown subtype: locale=" + locale + " keyboardLayout=" + keyboardLayout);
}
- protected final KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
+ protected KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
final EditorInfo editorInfo) {
return createKeyboardLayoutSet(subtype, editorInfo, false /* voiceInputKeyEnabled */,
false /* languageSwitchKeyEnabled */);
}
- protected final KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
+ protected KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
final EditorInfo editorInfo, final boolean voiceInputKeyEnabled,
final boolean languageSwitchKeyEnabled) {
final Context context = mThemeContext;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java b/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java
index fa818654e..3f85e4baa 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Arabic.java
@@ -78,8 +78,7 @@ public final class Arabic extends LayoutBase {
// U+061F: "؟" ARABIC QUESTION MARK
// U+061B: "؛" ARABIC SEMICOLON
return joinKeys(key("\u060C", joinMoreKeys(
- ":", "!", "\u061F", "\u061B", "-", "\"", "'", SETTINGS_KEY)),
- "_");
+ ":", "!", "\u061F", "\u061B", "-", "\"", "'", SETTINGS_KEY)));
}
@Override
@@ -90,7 +89,7 @@ public final class Arabic extends LayoutBase {
// U+060C: "،" ARABIC COMMA
// U+061F: "؟" ARABIC QUESTION MARK
// U+061B: "؛" ARABIC SEMICOLON
- return joinKeys("/", key(".", getPunctuationMoreKeys(isPhone)));
+ return joinKeys(key(".", getPunctuationMoreKeys(isPhone)));
}
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java b/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java
index dba91b4da..2cecedceb 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/ArmenianPhonetic.java
@@ -62,14 +62,14 @@ public final class ArmenianPhonetic extends LayoutBase {
public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
// U+055D: "՝" ARMENIAN COMMA
return isPhone ? joinKeys(key("\u055D", SETTINGS_KEY))
- : joinKeys(key("\u055D", SETTINGS_KEY), "_");
+ : joinKeys(key("\u055D", SETTINGS_KEY));
}
@Override
public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
// U+0589: "։" ARMENIAN FULL STOP
final ExpectedKey fullStopKey = key("\u0589", getPunctuationMoreKeys(isPhone));
- return isPhone ? joinKeys(fullStopKey) : joinKeys("/", fullStopKey);
+ return joinKeys(fullStopKey);
}
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Dvorak.java b/tests/src/com/android/inputmethod/keyboard/layout/Dvorak.java
index e75cfd0ff..ba94c8dee 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Dvorak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Dvorak.java
@@ -20,13 +20,14 @@ 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 java.util.Locale;
/**
- * The QWERTY alphabet keyboard.
+ * The Dvorak alphabet keyboard.
*/
-public final class Dvorak extends LayoutBase {
+public class Dvorak extends LayoutBase {
private static final String LAYOUT_NAME = "dvorak";
public Dvorak(final LayoutCustomizer customizer) {
@@ -51,17 +52,19 @@ public final class Dvorak extends LayoutBase {
@Override
public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
- return isPhone ? joinKeys(key("q", SETTINGS_KEY)) :
- joinKeys(SETTINGS_KEY, key("_", moreKey("-")));
+ // U+00A1: "¡" INVERTED EXCLAMATION MARK
+ return isPhone ? joinKeys(key("q", SETTINGS_KEY))
+ : joinKeys(key("!", joinMoreKeys("\u00A1", SETTINGS_KEY)));
}
@Override
public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
final ExpectedAdditionalMoreKey[] punctuationMoreKeys =
convertToAdditionalMoreKeys(getPunctuationMoreKeys(isPhone));
+ // U+00BF: "¿" INVERTED QUESTION MARK
return isPhone
? joinKeys(key("z", punctuationMoreKeys))
- : joinKeys("/", key("?", moreKey("!")));
+ : joinKeys(key("?", joinMoreKeys(punctuationMoreKeys, "\u00BF")));
}
private static ExpectedAdditionalMoreKey[] convertToAdditionalMoreKeys(
@@ -76,7 +79,33 @@ public final class Dvorak extends LayoutBase {
}
@Override
- ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) { return ALPHABET_COMMON; }
+ public ExpectedKey[][] getCommonAlphabetLayout(final boolean isPhone) {
+ return ALPHABET_COMMON;
+ }
+
+ protected ExpectedKey getRow1_1Key(final boolean isPhone, final int elementId) {
+ if (elementId == KeyboardId.ELEMENT_ALPHABET
+ || elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) {
+ return key("'", joinMoreKeys(additionalMoreKey("1"), "!", "\""));
+ }
+ return key("\"", additionalMoreKey("1"));
+ }
+
+ protected ExpectedKey getRow1_2Key(final boolean isPhone, final int elementId) {
+ if (elementId == KeyboardId.ELEMENT_ALPHABET
+ || elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) {
+ return key(",", joinMoreKeys(additionalMoreKey("2"), "?", "<"));
+ }
+ return key("<", additionalMoreKey("2"));
+ }
+
+ protected ExpectedKey getRow1_3Key(final boolean isPhone, final int elementId) {
+ if (elementId == KeyboardId.ELEMENT_ALPHABET
+ || elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) {
+ return key(".", joinMoreKeys(additionalMoreKey("3"), ">"));
+ }
+ return key(">", additionalMoreKey("3"));
+ }
@Override
public ExpectedKey[][] getLayout(final boolean isPhone, final int elementId) {
@@ -86,18 +115,9 @@ public final class Dvorak extends LayoutBase {
}
final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(
getCommonAlphabetLayout(isPhone));
- if (elementId == KeyboardId.ELEMENT_ALPHABET
- || elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED) {
- builder.addKeysOnTheLeftOfRow(1,
- key("'", joinMoreKeys(additionalMoreKey("1"), "!", "\"")),
- key(",", joinMoreKeys(additionalMoreKey("2"), "?", "<")),
- key(".", joinMoreKeys(additionalMoreKey("3"), ">")));
- } else {
- builder.addKeysOnTheLeftOfRow(1,
- key("\"", additionalMoreKey("1")),
- key("<", additionalMoreKey("2")),
- key(">", additionalMoreKey("3")));
- }
+ builder.replaceKeyOfLabel(ROW1_1, getRow1_1Key(isPhone, elementId))
+ .replaceKeyOfLabel(ROW1_2, getRow1_2Key(isPhone, elementId))
+ .replaceKeyOfLabel(ROW1_3, getRow1_3Key(isPhone, elementId));
convertCommonLayoutToKeyboard(builder, isPhone);
getCustomizer().setAccentedLetters(builder);
if (elementId != KeyboardId.ELEMENT_ALPHABET) {
@@ -107,8 +127,13 @@ public final class Dvorak extends LayoutBase {
return builder.build();
}
+ public static final String ROW1_1 = "ROW1_1";
+ public static final String ROW1_2 = "ROW1_2";
+ public static final String ROW1_3 = "ROW1_3";
+
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder()
.setKeysOfRow(1,
+ ROW1_1, ROW1_2, ROW1_3,
key("p", additionalMoreKey("4")),
key("y", additionalMoreKey("5")),
key("f", additionalMoreKey("6")),
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java b/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java
index a513740e7..7390457d0 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Farsi.java
@@ -77,8 +77,7 @@ public final class Farsi extends LayoutBase {
// U+061B: "؛" ARABIC SEMICOLON
return joinKeys(key("\u060C", joinMoreKeys(
":", "!", "\u061F", "\u061B", "-", RtlSymbols.DOUBLE_ANGLE_QUOTES_LR_RTL,
- SETTINGS_KEY)),
- "_");
+ SETTINGS_KEY)));
}
@Override
@@ -86,7 +85,7 @@ public final class Farsi extends LayoutBase {
if (isPhone) {
return super.getKeysRightToSpacebar(isPhone);
}
- return joinKeys("/", key(".", getPunctuationMoreKeys(isPhone)));
+ return joinKeys(key(".", getPunctuationMoreKeys(isPhone)));
}
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java b/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java
index 2b625c32b..c2a15f3f3 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/HindiCompact.java
@@ -50,7 +50,7 @@ public final class HindiCompact extends LayoutBase {
public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
// U+0964: "।" DEVANAGARI DANDA
final ExpectedKey periodKey = key("\u0964", getPunctuationMoreKeys(isPhone));
- return isPhone ? joinKeys(periodKey) : joinKeys("/", periodKey);
+ return joinKeys(periodKey);
}
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
index 0548a010d..b05789b73 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/LayoutBase.java
@@ -148,6 +148,24 @@ public abstract class LayoutBase extends AbstractLayoutBase {
return isPhone ? EMPTY_KEYS : joinKeys(EXCLAMATION_AND_QUESTION_MARKS, SHIFT_KEY);
}
+ /**
+ * Get the enter key.
+ * @param isPhone true if requesting phone's key.
+ * @return the array of {@link ExpectedKey} that should be placed as an enter key.
+ */
+ public ExpectedKey getEnterKey(final boolean isPhone) {
+ return isPhone ? key(ENTER_KEY, EMOJI_ACTION_KEY) : ENTER_KEY;
+ }
+
+ /**
+ * Get the emoji key.
+ * @param isPhone true if requesting phone's key.
+ * @return the array of {@link ExpectedKey} that should be placed as an emoji key.
+ */
+ public ExpectedKey getEmojiKey(final boolean isPhone) {
+ return EMOJI_NORMAL_KEY;
+ }
+
/**
* Get the space keys.
* @param isPhone true if requesting phone's keys.
@@ -165,8 +183,7 @@ public abstract class LayoutBase extends AbstractLayoutBase {
*/
public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
// U+002C: "," COMMA
- return isPhone ? joinKeys(key("\u002C", SETTINGS_KEY))
- : joinKeys(key("\u002C", SETTINGS_KEY), "_");
+ return joinKeys(key("\u002C", SETTINGS_KEY));
}
/**
@@ -176,7 +193,7 @@ public abstract class LayoutBase extends AbstractLayoutBase {
*/
public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
final ExpectedKey periodKey = key(".", getPunctuationMoreKeys(isPhone));
- return isPhone ? joinKeys(periodKey) : joinKeys("/", periodKey);
+ return joinKeys(periodKey);
}
/**
@@ -241,7 +258,25 @@ public abstract class LayoutBase extends AbstractLayoutBase {
*/
public final LayoutCustomizer getCustomizer() { return mCustomizer; }
- // Icon id.
+ // Icon ids.
+ private static final int ICON_DELETE = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_DELETE_KEY);
+ private static final int ICON_SPACE = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_SPACE_KEY);
+ private static final int ICON_TAB = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_TAB_KEY);
+ private static final int ICON_SHORTCUT = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_SHORTCUT_KEY);
+ private static final int ICON_SETTINGS = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_SETTINGS_KEY);
+ private static final int ICON_LANGUAGE_SWITCH = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_LANGUAGE_SWITCH_KEY);
+ private static final int ICON_ENTER = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_ENTER_KEY);
+ private static final int ICON_EMOJI_ACTION = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_EMOJI_ACTION_KEY);
+ private static final int ICON_EMOJI_NORMAL = KeyboardIconsSet.getIconId(
+ KeyboardIconsSet.NAME_EMOJI_NORMAL_KEY);
private static final int ICON_SHIFT = KeyboardIconsSet.getIconId(
KeyboardIconsSet.NAME_SHIFT_KEY);
private static final int ICON_SHIFTED_SHIFT = KeyboardIconsSet.getIconId(
@@ -251,11 +286,21 @@ public abstract class LayoutBase extends AbstractLayoutBase {
private static final int ICON_ZWJ = KeyboardIconsSet.getIconId(
KeyboardIconsSet.NAME_ZWJ_KEY);
- // Functional key.
+ // Functional keys.
+ public static final ExpectedKey DELETE_KEY = key(ICON_DELETE, Constants.CODE_DELETE);
+ public static final ExpectedKey TAB_KEY = key(ICON_TAB, Constants.CODE_TAB);
+ public static final ExpectedKey SHORTCUT_KEY = key(ICON_SHORTCUT, Constants.CODE_SHORTCUT);
+ public static final ExpectedKey SETTINGS_KEY = key(ICON_SETTINGS, Constants.CODE_SETTINGS);
+ public static final ExpectedKey LANGUAGE_SWITCH_KEY = key(
+ ICON_LANGUAGE_SWITCH, Constants.CODE_LANGUAGE_SWITCH);
+ public static final ExpectedKey ENTER_KEY = key(ICON_ENTER, Constants.CODE_ENTER);
+ public static final ExpectedKey EMOJI_ACTION_KEY = key(ICON_EMOJI_ACTION, Constants.CODE_EMOJI);
+ public static final ExpectedKey EMOJI_NORMAL_KEY = key(ICON_EMOJI_NORMAL, Constants.CODE_EMOJI);
+ public static final ExpectedKey SPACE_KEY = key(ICON_SPACE, Constants.CODE_SPACE);
static final ExpectedKey CAPSLOCK_MORE_KEY = key(" ", Constants.CODE_CAPSLOCK);
- static final ExpectedKey SHIFT_KEY = key(ICON_SHIFT,
+ public static final ExpectedKey SHIFT_KEY = key(ICON_SHIFT,
Constants.CODE_SHIFT, CAPSLOCK_MORE_KEY);
- static final ExpectedKey SHIFTED_SHIFT_KEY = key(ICON_SHIFTED_SHIFT,
+ public static final ExpectedKey SHIFTED_SHIFT_KEY = key(ICON_SHIFTED_SHIFT,
Constants.CODE_SHIFT, CAPSLOCK_MORE_KEY);
static final ExpectedKey ALPHABET_KEY = key("ABC", Constants.CODE_SWITCH_ALPHA_SYMBOL);
static final ExpectedKey SYMBOLS_KEY = key("?123", Constants.CODE_SWITCH_ALPHA_SYMBOL);
@@ -271,6 +316,9 @@ public abstract class LayoutBase extends AbstractLayoutBase {
// U+200D: ZERO WIDTH JOINER
static final ExpectedKey ZWNJ_KEY = key(ICON_ZWNJ, "\u200C");
static final ExpectedKey ZWJ_KEY = key(ICON_ZWJ, "\u200D");
+ // Domain key
+ public static final ExpectedKey DOMAIN_KEY =
+ key(".com", joinMoreKeys(".net", ".org", ".gov", ".edu")).preserveCase();
// Punctuation more keys for phone form factor.
public static final ExpectedKey[] PHONE_PUNCTUATION_MORE_KEYS = joinKeys(
@@ -300,12 +348,12 @@ public abstract class LayoutBase extends AbstractLayoutBase {
if (isPhone) {
builder.addKeysOnTheRightOfRow(numberOfRows - 1, DELETE_KEY)
.addKeysOnTheLeftOfRow(numberOfRows, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(numberOfRows, key(ENTER_KEY, EMOJI_ACTION_KEY));
+ .addKeysOnTheRightOfRow(numberOfRows, customizer.getEnterKey(isPhone));
} else {
builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
- .addKeysOnTheRightOfRow(numberOfRows - 2, ENTER_KEY)
+ .addKeysOnTheRightOfRow(numberOfRows - 2, customizer.getEnterKey(isPhone))
.addKeysOnTheLeftOfRow(numberOfRows, customizer.getSymbolsKey())
- .addKeysOnTheRightOfRow(numberOfRows, EMOJI_NORMAL_KEY);
+ .addKeysOnTheRightOfRow(numberOfRows, customizer.getEmojiKey(isPhone));
}
builder.addKeysOnTheLeftOfRow(
numberOfRows - 1, (Object[])customizer.getLeftShiftKeys(isPhone));
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java b/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java
index 15c74ed8c..3c70d3266 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Myanmar.java
@@ -55,14 +55,14 @@ public final class Myanmar extends LayoutBase {
// U+002C: "," COMMA
// U+104A: "၊" MYANMAR SIGN LITTLE SECTION
return isPhone ? joinKeys(key("\u002C", SETTINGS_KEY))
- : joinKeys(key("\u104A", moreKey(","), SETTINGS_KEY), "_");
+ : joinKeys(key("\u104A", moreKey(","), SETTINGS_KEY));
}
@Override
public ExpectedKey[] getKeysRightToSpacebar(final boolean isPhone) {
// U+104B: "။" MYANMAR SIGN SECTION
final ExpectedKey periodKey = key("\u104B", getPunctuationMoreKeys(isPhone));
- return isPhone ? joinKeys(periodKey) : joinKeys("/", periodKey);
+ return joinKeys(periodKey);
}
@Override
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java b/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java
index 2cee2d909..803089721 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/Symbols.java
@@ -41,18 +41,18 @@ public class Symbols extends AbstractLayoutBase {
customizer.getSingleQuoteMoreKeys(), customizer.getSingleAngleQuoteKeys())));
if (isPhone) {
builder.addKeysOnTheLeftOfRow(3, customizer.getSymbolsShiftKey(isPhone))
- .addKeysOnTheRightOfRow(3, DELETE_KEY)
+ .addKeysOnTheRightOfRow(3, LayoutBase.DELETE_KEY)
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
- .addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_ACTION_KEY));
+ .addKeysOnTheRightOfRow(4, customizer.getEnterKey(isPhone));
} else {
// Tablet symbols keyboard has extra two keys at the left edge of the 3rd row.
builder.addKeysOnTheLeftOfRow(3, (Object[])joinKeys("\\", "="));
- builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
- .addKeysOnTheRightOfRow(2, ENTER_KEY)
+ builder.addKeysOnTheRightOfRow(1, LayoutBase.DELETE_KEY)
+ .addKeysOnTheRightOfRow(2, customizer.getEnterKey(isPhone))
.addKeysOnTheLeftOfRow(3, customizer.getSymbolsShiftKey(isPhone))
.addKeysOnTheRightOfRow(3, customizer.getSymbolsShiftKey(isPhone))
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
- .addKeysOnTheRightOfRow(4, EMOJI_NORMAL_KEY);
+ .addKeysOnTheRightOfRow(4, customizer.getEmojiKey(isPhone));
}
return builder.build();
}
@@ -167,7 +167,7 @@ public class Symbols extends AbstractLayoutBase {
// U+00BF: "¿" INVERTED QUESTION MARK
key("?", moreKey("\u00BF")))
.setKeysOfRow(4,
- key(","), key("_"), SPACE_KEY, key("/"),
+ key(","), key("_"), LayoutBase.SPACE_KEY, key("/"),
// U+2026: "…" HORIZONTAL ELLIPSIS
key(".", moreKey("\u2026")))
.build();
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java b/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java
index 7ed103ba0..19cb6075a 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/SymbolsShifted.java
@@ -37,20 +37,20 @@ public class SymbolsShifted extends AbstractLayoutBase {
builder.replaceKeyOfLabel(OTHER_CURRENCIES, (Object[])customizer.getOtherCurrencyKeys());
if (isPhone) {
builder.addKeysOnTheLeftOfRow(3, customizer.getBackToSymbolsKey())
- .addKeysOnTheRightOfRow(3, DELETE_KEY)
+ .addKeysOnTheRightOfRow(3, LayoutBase.DELETE_KEY)
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
- .addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_ACTION_KEY));
+ .addKeysOnTheRightOfRow(4, customizer.getEnterKey(isPhone));
} else {
// Tablet symbols shifted keyboard has extra two keys at the right edge of the 3rd row.
// U+00BF: "¿" INVERTED QUESTION MARK
// U+00A1: "¡" INVERTED EXCLAMATION MARK
builder.addKeysOnTheRightOfRow(3, (Object[])joinKeys("\u00A1", "\u00BF"));
- builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
- .addKeysOnTheRightOfRow(2, ENTER_KEY)
+ builder.addKeysOnTheRightOfRow(1, LayoutBase.DELETE_KEY)
+ .addKeysOnTheRightOfRow(2, customizer.getEnterKey(isPhone))
.addKeysOnTheLeftOfRow(3, customizer.getBackToSymbolsKey())
.addKeysOnTheRightOfRow(3, customizer.getBackToSymbolsKey())
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
- .addKeysOnTheRightOfRow(4, EMOJI_NORMAL_KEY);
+ .addKeysOnTheRightOfRow(4, customizer.getEmojiKey(isPhone));
}
return builder.build();
}
@@ -122,7 +122,7 @@ public class SymbolsShifted extends AbstractLayoutBase {
// U+2264: "≤" LESS-THAN OR EQUAL TO
// U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
key("<", joinMoreKeys("\u2039", "\u2264", "\u00AB")),
- SPACE_KEY,
+ LayoutBase.SPACE_KEY,
// U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
// U+2265: "≥" GREATER-THAN EQUAL TO
// U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java b/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java
index 0f7bef2a3..3556cb4bf 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/expected/AbstractLayoutBase.java
@@ -16,9 +16,7 @@
package com.android.inputmethod.keyboard.layout.expected;
-import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.layout.expected.ExpectedKey.ExpectedAdditionalMoreKey;
-import com.android.inputmethod.latin.Constants;
/**
* Base class to create an expected keyboard for unit test.
@@ -104,36 +102,4 @@ public abstract class AbstractLayoutBase {
public static ExpectedKey[] joinKeys(final Object ... keys) {
return ExpectedKeyboardBuilder.joinKeys(keys);
}
-
- // Icon ids.
- private static final int ICON_DELETE = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_DELETE_KEY);
- private static final int ICON_SPACE = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_SPACE_KEY);
- private static final int ICON_TAB = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_TAB_KEY);
- private static final int ICON_SHORTCUT = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_SHORTCUT_KEY);
- private static final int ICON_SETTINGS = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_SETTINGS_KEY);
- private static final int ICON_LANGUAGE_SWITCH = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_LANGUAGE_SWITCH_KEY);
- private static final int ICON_ENTER = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_ENTER_KEY);
- private static final int ICON_EMOJI_ACTION = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_EMOJI_ACTION_KEY);
- private static final int ICON_EMOJI_NORMAL = KeyboardIconsSet.getIconId(
- KeyboardIconsSet.NAME_EMOJI_NORMAL_KEY);
-
- // Functional keys.
- public static final ExpectedKey DELETE_KEY = key(ICON_DELETE, Constants.CODE_DELETE);
- public static final ExpectedKey TAB_KEY = key(ICON_TAB, Constants.CODE_TAB);
- public static final ExpectedKey SHORTCUT_KEY = key(ICON_SHORTCUT, Constants.CODE_SHORTCUT);
- public static final ExpectedKey SETTINGS_KEY = key(ICON_SETTINGS, Constants.CODE_SETTINGS);
- public static final ExpectedKey LANGUAGE_SWITCH_KEY = key(
- ICON_LANGUAGE_SWITCH, Constants.CODE_LANGUAGE_SWITCH);
- public static final ExpectedKey ENTER_KEY = key(ICON_ENTER, Constants.CODE_ENTER);
- public static final ExpectedKey EMOJI_ACTION_KEY = key(ICON_EMOJI_ACTION, Constants.CODE_EMOJI);
- public static final ExpectedKey EMOJI_NORMAL_KEY = key(ICON_EMOJI_NORMAL, Constants.CODE_EMOJI);
- public static final ExpectedKey SPACE_KEY = key(ICON_SPACE, Constants.CODE_SPACE);
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKey.java b/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKey.java
index 0e1c71cd1..2674a6a69 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKey.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKey.java
@@ -148,6 +148,18 @@ public class ExpectedKey {
return newInstance(mVisual.toUpperCase(locale), mOutput.toUpperCase(locale));
}
+ public ExpectedKey preserveCase() {
+ final ExpectedKey[] moreKeys = getMoreKeys();
+ final ExpectedKey[] casePreservedMoreKeys = new ExpectedKey[moreKeys.length];
+ for (int index = 0; index < moreKeys.length; index++) {
+ final ExpectedKey moreKey = moreKeys[index];
+ casePreservedMoreKeys[index] = newInstance(
+ moreKey.getVisual().preserveCase(), moreKey.getOutput().preserveCase());
+ }
+ return newInstance(
+ getVisual().preserveCase(), getOutput().preserveCase(), casePreservedMoreKeys);
+ }
+
public boolean equalsTo(final Key key) {
// This key has no "more keys".
return mVisual.equalsTo(key) && mOutput.equalsTo(key) && key.getMoreKeys() == null;
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKeyOutput.java b/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKeyOutput.java
index 1be51e60b..737d1695b 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKeyOutput.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKeyOutput.java
@@ -42,6 +42,7 @@ abstract class ExpectedKeyOutput {
}
abstract ExpectedKeyOutput toUpperCase(final Locale locale);
+ abstract ExpectedKeyOutput preserveCase();
abstract boolean equalsTo(final String text);
abstract boolean equalsTo(final Key key);
abstract boolean equalsTo(final MoreKeySpec moreKeySpec);
@@ -68,6 +69,11 @@ abstract class ExpectedKeyOutput {
return this;
}
+ @Override
+ ExpectedKeyOutput preserveCase() {
+ return new CasePreservedCode(mCode);
+ }
+
@Override
boolean equalsTo(final String text) {
return StringUtils.codePointCount(text) == 1 && text.codePointAt(0) == mCode;
@@ -93,6 +99,16 @@ abstract class ExpectedKeyOutput {
return Constants.isLetterCode(mCode) ? StringUtils.newSingleCodePointString(mCode)
: Constants.printableCode(mCode);
}
+
+ private static class CasePreservedCode extends Code {
+ CasePreservedCode(final int code) { super(code); }
+
+ @Override
+ ExpectedKeyOutput toUpperCase(final Locale locale) { return this; }
+
+ @Override
+ ExpectedKeyOutput preserveCase() { return this; }
+ }
}
/**
@@ -108,6 +124,11 @@ abstract class ExpectedKeyOutput {
return newInstance(mText.toUpperCase(locale));
}
+ @Override
+ ExpectedKeyOutput preserveCase() {
+ return new CasePreservedText(mText);
+ }
+
@Override
boolean equalsTo(final String text) {
return text.equals(text);
@@ -134,5 +155,15 @@ abstract class ExpectedKeyOutput {
public String toString() {
return mText;
}
+
+ private static class CasePreservedText extends Text {
+ CasePreservedText(final String text) { super(text); }
+
+ @Override
+ ExpectedKeyOutput toUpperCase(final Locale locale) { return this; }
+
+ @Override
+ ExpectedKeyOutput preserveCase() { return this; }
+ }
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKeyVisual.java b/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKeyVisual.java
index 0a0da32b6..facdf7043 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKeyVisual.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/expected/ExpectedKeyVisual.java
@@ -37,6 +37,7 @@ abstract class ExpectedKeyVisual {
}
abstract ExpectedKeyVisual toUpperCase(final Locale locale);
+ abstract ExpectedKeyVisual preserveCase();
abstract boolean equalsTo(final String text);
abstract boolean equalsTo(final Key key);
abstract boolean equalsTo(final MoreKeySpec moreKeySpec);
@@ -58,6 +59,11 @@ abstract class ExpectedKeyVisual {
return this;
}
+ @Override
+ ExpectedKeyVisual preserveCase() {
+ return this;
+ }
+
@Override
boolean equalsTo(final String text) {
return false;
@@ -102,6 +108,11 @@ abstract class ExpectedKeyVisual {
return new Label(mLabel.toUpperCase(locale));
}
+ @Override
+ ExpectedKeyVisual preserveCase() {
+ return new CasePreservedLabel(mLabel);
+ }
+
@Override
boolean equalsTo(final String text) {
return mLabel.equals(text);
@@ -131,5 +142,15 @@ abstract class ExpectedKeyVisual {
public String toString() {
return mLabel;
}
+
+ private static class CasePreservedLabel extends Label {
+ CasePreservedLabel(final String label) { super(label); }
+
+ @Override
+ ExpectedKeyVisual toUpperCase(final Locale locale) { return this; }
+
+ @Override
+ ExpectedKeyVisual preserveCase() { return this; }
+ }
}
}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakEmail.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakEmail.java
new file mode 100644
index 000000000..37ca09238
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakEmail.java
@@ -0,0 +1,91 @@
+/*
+ * 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 android.text.InputType;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.KeyboardLayoutSet;
+import com.android.inputmethod.keyboard.layout.Dvorak;
+import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.tests.TestsEnglishDvorak.EnglishDvorakCustomizer;
+
+import java.util.Locale;
+
+/**
+ * en_US: English (United States)/dvorak, email input field.
+ */
+@SmallTest
+public class TestsDvorakEmail extends LayoutTestsBase {
+ private static final Locale LOCALE = new Locale("en", "US");
+ private static final LayoutBase LAYOUT = new DvorakEmail(new DvorakEmailCustomizer(LOCALE));
+
+ @Override
+ LayoutBase getLayout() { return LAYOUT; }
+
+ @Override
+ protected KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
+ final EditorInfo editorInfo, final boolean voiceInputKeyEnabled,
+ final boolean languageSwitchKeyEnabled) {
+ final EditorInfo emailField = new EditorInfo();
+ emailField.inputType =
+ InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
+ return super.createKeyboardLayoutSet(
+ subtype, emailField, voiceInputKeyEnabled, languageSwitchKeyEnabled);
+ }
+
+ private static class DvorakEmailCustomizer extends EnglishDvorakCustomizer {
+ DvorakEmailCustomizer(final Locale locale) {
+ super(locale);
+ }
+
+ @Override
+ public ExpectedKey getEnterKey(final boolean isPhone) {
+ return isPhone ? LayoutBase.ENTER_KEY : super.getEnterKey(isPhone);
+ }
+
+ @Override
+ public ExpectedKey getEmojiKey(final boolean isPhone) {
+ return LayoutBase.DOMAIN_KEY;
+ }
+
+ @Override
+ public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
+ return isPhone ? super.getKeysLeftToSpacebar(isPhone)
+ : joinKeys(key("@", LayoutBase.SETTINGS_KEY));
+ }
+ }
+
+ private static class DvorakEmail extends Dvorak {
+ public DvorakEmail(final LayoutCustomizer customizer) {
+ super(customizer);
+ }
+
+ @Override
+ protected ExpectedKey getRow1_1Key(final boolean isPhone, final int elementId) {
+ if (isPhone && (elementId == KeyboardId.ELEMENT_ALPHABET
+ || elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED)) {
+ return key("@", joinMoreKeys(additionalMoreKey("1")));
+ }
+ return super.getRow1_1Key(isPhone, elementId);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakUrl.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakUrl.java
new file mode 100644
index 000000000..3bcae0ce4
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsDvorakUrl.java
@@ -0,0 +1,91 @@
+/*
+ * 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 android.text.InputType;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.keyboard.KeyboardLayoutSet;
+import com.android.inputmethod.keyboard.layout.Dvorak;
+import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+import com.android.inputmethod.keyboard.layout.tests.TestsEnglishDvorak.EnglishDvorakCustomizer;
+
+import java.util.Locale;
+
+/**
+ * en_US: English (United States)/dvorak, URL input field.
+ */
+@SmallTest
+public class TestsDvorakUrl extends LayoutTestsBase {
+ private static final Locale LOCALE = new Locale("en", "US");
+ private static final LayoutBase LAYOUT = new DvorakEmail(new DvorakUrlCustomizer(LOCALE));
+
+ @Override
+ LayoutBase getLayout() { return LAYOUT; }
+
+ @Override
+ protected KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
+ final EditorInfo editorInfo, final boolean voiceInputKeyEnabled,
+ final boolean languageSwitchKeyEnabled) {
+ final EditorInfo emailField = new EditorInfo();
+ emailField.inputType =
+ InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI;
+ return super.createKeyboardLayoutSet(
+ subtype, emailField, voiceInputKeyEnabled, languageSwitchKeyEnabled);
+ }
+
+ private static class DvorakUrlCustomizer extends EnglishDvorakCustomizer {
+ DvorakUrlCustomizer(final Locale locale) {
+ super(locale);
+ }
+
+ @Override
+ public ExpectedKey getEnterKey(final boolean isPhone) {
+ return isPhone ? LayoutBase.ENTER_KEY : super.getEnterKey(isPhone);
+ }
+
+ @Override
+ public ExpectedKey getEmojiKey(final boolean isPhone) {
+ return LayoutBase.DOMAIN_KEY;
+ }
+
+ @Override
+ public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
+ return isPhone ? super.getKeysLeftToSpacebar(isPhone)
+ : joinKeys(key("/", LayoutBase.SETTINGS_KEY));
+ }
+ }
+
+ private static class DvorakEmail extends Dvorak {
+ public DvorakEmail(final LayoutCustomizer customizer) {
+ super(customizer);
+ }
+
+ @Override
+ protected ExpectedKey getRow1_1Key(final boolean isPhone, final int elementId) {
+ if (isPhone && (elementId == KeyboardId.ELEMENT_ALPHABET
+ || elementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED)) {
+ return key("/", joinMoreKeys(additionalMoreKey("1")));
+ }
+ return super.getRow1_1Key(isPhone, elementId);
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishDvorak.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishDvorak.java
index a05269312..e647f8aea 100644
--- a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishDvorak.java
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsEnglishDvorak.java
@@ -36,7 +36,7 @@ public class TestsEnglishDvorak extends LayoutTestsBase {
@Override
LayoutBase getLayout() { return LAYOUT; }
- private static class EnglishDvorakCustomizer extends DvorakCustomizer {
+ public static class EnglishDvorakCustomizer extends DvorakCustomizer {
private final EnglishCustomizer mEnglishCustomizer;
EnglishDvorakCustomizer(final Locale locale) {
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyEmail.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyEmail.java
new file mode 100644
index 000000000..8563d6933
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyEmail.java
@@ -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 android.test.suitebuilder.annotation.SmallTest;
+import android.text.InputType;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.KeyboardLayoutSet;
+import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+
+import java.util.Locale;
+
+/**
+ * en_US: English (United States)/qwerty, email input field.
+ */
+@SmallTest
+public class TestsQwertyEmail extends LayoutTestsBase {
+ private static final Locale LOCALE = new Locale("en", "US");
+ private static final LayoutBase LAYOUT = new Qwerty(new EnglishEmailCustomizer(LOCALE));
+
+ @Override
+ LayoutBase getLayout() { return LAYOUT; }
+
+ @Override
+ protected KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
+ final EditorInfo editorInfo, final boolean voiceInputKeyEnabled,
+ final boolean languageSwitchKeyEnabled) {
+ final EditorInfo emailField = new EditorInfo();
+ emailField.inputType =
+ InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
+ return super.createKeyboardLayoutSet(
+ subtype, emailField, voiceInputKeyEnabled, languageSwitchKeyEnabled);
+ }
+
+ private static class EnglishEmailCustomizer extends EnglishCustomizer {
+ EnglishEmailCustomizer(final Locale locale) {
+ super(locale);
+ }
+
+ @Override
+ public ExpectedKey getEnterKey(final boolean isPhone) {
+ return isPhone ? LayoutBase.ENTER_KEY : super.getEnterKey(isPhone);
+ }
+
+ @Override
+ public ExpectedKey getEmojiKey(final boolean isPhone) {
+ return LayoutBase.DOMAIN_KEY;
+ }
+
+ @Override
+ public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
+ return joinKeys(key("@", LayoutBase.SETTINGS_KEY));
+ }
+ }
+}
diff --git a/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyUrl.java b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyUrl.java
new file mode 100644
index 000000000..1c1a2bbbd
--- /dev/null
+++ b/tests/src/com/android/inputmethod/keyboard/layout/tests/TestsQwertyUrl.java
@@ -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 android.test.suitebuilder.annotation.SmallTest;
+import android.text.InputType;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodSubtype;
+
+import com.android.inputmethod.keyboard.KeyboardLayoutSet;
+import com.android.inputmethod.keyboard.layout.LayoutBase;
+import com.android.inputmethod.keyboard.layout.Qwerty;
+import com.android.inputmethod.keyboard.layout.expected.ExpectedKey;
+
+import java.util.Locale;
+
+/**
+ * en_US: English (United States)/qwerty, URL input field.
+ */
+@SmallTest
+public class TestsQwertyUrl extends LayoutTestsBase {
+ private static final Locale LOCALE = new Locale("en", "US");
+ private static final LayoutBase LAYOUT = new Qwerty(new EnglishUrlCustomizer(LOCALE));
+
+ @Override
+ LayoutBase getLayout() { return LAYOUT; }
+
+ @Override
+ protected KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
+ final EditorInfo editorInfo, final boolean voiceInputKeyEnabled,
+ final boolean languageSwitchKeyEnabled) {
+ final EditorInfo emailField = new EditorInfo();
+ emailField.inputType =
+ InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI;
+ return super.createKeyboardLayoutSet(
+ subtype, emailField, voiceInputKeyEnabled, languageSwitchKeyEnabled);
+ }
+
+ private static class EnglishUrlCustomizer extends EnglishCustomizer {
+ EnglishUrlCustomizer(final Locale locale) {
+ super(locale);
+ }
+
+ @Override
+ public ExpectedKey getEnterKey(final boolean isPhone) {
+ return isPhone ? LayoutBase.ENTER_KEY : super.getEnterKey(isPhone);
+ }
+
+ @Override
+ public ExpectedKey getEmojiKey(final boolean isPhone) {
+ return LayoutBase.DOMAIN_KEY;
+ }
+
+ @Override
+ public ExpectedKey[] getKeysLeftToSpacebar(final boolean isPhone) {
+ return joinKeys(key("/", LayoutBase.SETTINGS_KEY));
+ }
+ }
+}