am bab437fb: Another small cleanup for test code
* commit 'bab437fb3b1a58925e285c2e03ca2e125484bad9': Another small cleanup for test codemain
commit
a242d7593b
|
@ -25,7 +25,7 @@ import com.android.inputmethod.keyboard.layout.expected.LayoutBase;
|
||||||
*/
|
*/
|
||||||
public final class Qwerty extends LayoutBase {
|
public final class Qwerty extends LayoutBase {
|
||||||
public static ExpectedKey[][] getLayout(final boolean isPhone) {
|
public static ExpectedKey[][] getLayout(final boolean isPhone) {
|
||||||
return toCommonAlphabet(ALPHABET_COMMON, isPhone);
|
return getDefaultAlphabetLayout(ALPHABET_COMMON, isPhone);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder(10, 9, 7, 3)
|
private static final ExpectedKey[][] ALPHABET_COMMON = new ExpectedKeyboardBuilder(10, 9, 7, 3)
|
||||||
|
|
|
@ -121,9 +121,10 @@ public class LayoutBase {
|
||||||
"&", "%", "+", "\"", "-", ":", "@"
|
"&", "%", "+", "\"", "-", ":", "@"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Helper method to create alphabet layout for phone by adding special function keys except
|
||||||
|
// shift key.
|
||||||
private static ExpectedKeyboardBuilder toPhoneAlphabet(final ExpectedKeyboardBuilder builder) {
|
private static ExpectedKeyboardBuilder toPhoneAlphabet(final ExpectedKeyboardBuilder builder) {
|
||||||
return builder
|
return builder
|
||||||
.addKeysOnTheLeftOfRow(3, key(SHIFT_KEY, CAPSLOCK_MORE_KEY))
|
|
||||||
.addKeysOnTheRightOfRow(3, DELETE_KEY)
|
.addKeysOnTheRightOfRow(3, DELETE_KEY)
|
||||||
.setLabelsOfRow(4, ",", " ", ".")
|
.setLabelsOfRow(4, ",", " ", ".")
|
||||||
.setMoreKeysOf(",", SETTINGS_KEY)
|
.setMoreKeysOf(",", SETTINGS_KEY)
|
||||||
|
@ -134,8 +135,7 @@ public class LayoutBase {
|
||||||
|
|
||||||
// Helper method to create alphabet layout for tablet by adding special function keys except
|
// Helper method to create alphabet layout for tablet by adding special function keys except
|
||||||
// shift key.
|
// shift key.
|
||||||
public static ExpectedKeyboardBuilder toTabletAlphabetWithoutShiftKeys(
|
private static ExpectedKeyboardBuilder toTabletAlphabet(final ExpectedKeyboardBuilder builder) {
|
||||||
final ExpectedKeyboardBuilder builder) {
|
|
||||||
return builder
|
return builder
|
||||||
// U+00BF: "¿" INVERTED QUESTION MARK
|
// U+00BF: "¿" INVERTED QUESTION MARK
|
||||||
// U+00A1: "¡" INVERTED EXCLAMATION MARK
|
// U+00A1: "¡" INVERTED EXCLAMATION MARK
|
||||||
|
@ -150,13 +150,25 @@ public class LayoutBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to create alphabet layout by adding special function keys.
|
// Helper method to create alphabet layout by adding special function keys.
|
||||||
public static ExpectedKey[][] toCommonAlphabet(final ExpectedKey[][] common,
|
public static ExpectedKey[][] getAlphabetLayoutWithoutShiftKeys(final ExpectedKey[][] common,
|
||||||
final boolean isPhone) {
|
final boolean isPhone) {
|
||||||
final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(common);
|
final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(common);
|
||||||
if (isPhone) {
|
if (isPhone) {
|
||||||
toPhoneAlphabet(builder);
|
toPhoneAlphabet(builder);
|
||||||
} else {
|
} else {
|
||||||
toTabletAlphabetWithoutShiftKeys(builder);
|
toTabletAlphabet(builder).build();
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper method to create alphabet layout by adding special function keys.
|
||||||
|
public static ExpectedKey[][] getDefaultAlphabetLayout(final ExpectedKey[][] common,
|
||||||
|
final boolean isPhone) {
|
||||||
|
final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(
|
||||||
|
getAlphabetLayoutWithoutShiftKeys(common, isPhone));
|
||||||
|
if (isPhone) {
|
||||||
|
builder.addKeysOnTheLeftOfRow(3, key(SHIFT_KEY, CAPSLOCK_MORE_KEY));
|
||||||
|
} else {
|
||||||
builder.addKeysOnTheLeftOfRow(3, key(SHIFT_KEY, CAPSLOCK_MORE_KEY))
|
builder.addKeysOnTheLeftOfRow(3, key(SHIFT_KEY, CAPSLOCK_MORE_KEY))
|
||||||
.addKeysOnTheRightOfRow(3, key(SHIFT_KEY, CAPSLOCK_MORE_KEY));
|
.addKeysOnTheRightOfRow(3, key(SHIFT_KEY, CAPSLOCK_MORE_KEY));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue