diff --git a/java/res/xml-sw600dp/key_space.xml b/java/res/xml-sw600dp/key_space.xml index 4e1e15b55e9e9db20af1038aeda153a1ce2de6e7..4670142ccfa5c029408f95e124bc9de12942ab20 100644 --- a/java/res/xml-sw600dp/key_space.xml +++ b/java/res/xml-sw600dp/key_space.xml @@ -21,6 +21,9 @@ <merge xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > + <Spacer + latin:keyWidth="0dp" + latin:keyXPos="30.750%p" /> <switch> <case latin:languageCode="fa" diff --git a/java/res/xml-sw600dp/row_symbols4.xml b/java/res/xml-sw600dp/row_symbols4.xml index baa090c248bc611f209cba0b30edcab95cb87254..9b6daab365637c30c3d6851b52bf926ce61190b8 100644 --- a/java/res/xml-sw600dp/row_symbols4.xml +++ b/java/res/xml-sw600dp/row_symbols4.xml @@ -19,7 +19,7 @@ --> <merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Row latin:keyWidth="8.9%p" @@ -31,10 +31,8 @@ latin:keyStyle="tabKeyStyle" /> <Key latin:keyLabel="\@" /> - <Key - latin:keyStyle="spaceKeyStyle" - latin:keyXPos="30.750%p" - latin:keyWidth="39.750%p" /> + <include + latin:keyboardLayout="@xml/key_space" /> <Key latin:keyLabel=""" latin:moreKeys="!text/more_keys_for_tablet_double_quote" /> diff --git a/java/res/xml-sw600dp/row_symbols_shift4.xml b/java/res/xml-sw600dp/row_symbols_shift4.xml index 4381bce6d76c22bea812b5ae36da257d2d27b916..7823561ebdbd2c4bce9faffe3f3ab41d8e16c30a 100644 --- a/java/res/xml-sw600dp/row_symbols_shift4.xml +++ b/java/res/xml-sw600dp/row_symbols_shift4.xml @@ -19,7 +19,7 @@ --> <merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Row latin:keyWidth="8.9%p" @@ -29,10 +29,8 @@ latin:keyWidth="13.0%p" /> <Key latin:keyStyle="tabKeyStyle" /> - <Key - latin:keyStyle="spaceKeyStyle" - latin:keyXPos="30.750%p" - latin:keyWidth="39.750%p" /> + <include + latin:keyboardLayout="@xml/key_space" /> <Spacer latin:keyXPos="-10.00%p" latin:keyWidth="0%p" /> diff --git a/java/res/xml-sw768dp/key_space.xml b/java/res/xml-sw768dp/key_space.xml index 115bcb6bfffb1e0f6f217e87f610c13f0cfe2d70..f4d0480060f08c25757c7ec324306c28c3e554e6 100644 --- a/java/res/xml-sw768dp/key_space.xml +++ b/java/res/xml-sw768dp/key_space.xml @@ -21,13 +21,15 @@ <merge xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > + <Spacer + latin:keyWidth="0dp" + latin:keyXPos="31.250%p" /> <switch> <case latin:languageCode="fa" > <Key latin:keyStyle="spaceKeyStyle" - latin:keyXPos="31.250%p" latin:keyWidth="29.453%p" /> <!-- U+200C: "" ZERO WIDTH NON-JOINER U+200D: "" ZERO WIDTH JOINER --> @@ -37,7 +39,6 @@ <default> <Key latin:keyStyle="spaceKeyStyle" - latin:keyXPos="31.250%p" latin:keyWidth="37.500%p" /> </default> </switch> diff --git a/java/res/xml-sw768dp/row_symbols4.xml b/java/res/xml-sw768dp/row_symbols4.xml index ecb1259d1e15b33e203ffc4c8505b927768f6b0b..29845aae03eccadf8442ebee53f2809dac985ac1 100644 --- a/java/res/xml-sw768dp/row_symbols4.xml +++ b/java/res/xml-sw768dp/row_symbols4.xml @@ -19,7 +19,7 @@ --> <merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Row latin:keyWidth="8.047%p" @@ -31,10 +31,8 @@ latin:keyXPos="15.157%p" /> <Key latin:keyLabel="\@" /> - <Key - latin:keyStyle="spaceKeyStyle" - latin:keyXPos="31.250%p" - latin:keyWidth="37.500%p" /> + <include + latin:keyboardLayout="@xml/key_space" /> <Key latin:keyLabel=""" latin:moreKeys="!text/more_keys_for_tablet_double_quote" /> diff --git a/java/res/xml-sw768dp/row_symbols_shift4.xml b/java/res/xml-sw768dp/row_symbols_shift4.xml index 8e0071f63966ab341b475b2d91d1961af961ca76..6828fdb78d45c602b2f2deb9949c26fa2100d66e 100644 --- a/java/res/xml-sw768dp/row_symbols_shift4.xml +++ b/java/res/xml-sw768dp/row_symbols_shift4.xml @@ -19,17 +19,15 @@ --> <merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Row latin:keyWidth="8.047%p" > <include latin:keyboardLayout="@xml/key_settings" /> - <Key - latin:keyStyle="spaceKeyStyle" - latin:keyXPos="31.250%p" - latin:keyWidth="37.500%p" /> + <include + latin:keyboardLayout="@xml/key_space" /> <switch> <case latin:shortcutKeyEnabled="true" diff --git a/java/res/xml/key_space.xml b/java/res/xml/key_space.xml index 02ee42fd2783eaf174dfa482889be8479ca3e85b..c47407dc7c4138ce55eb6d8bd1d2faaa7bba96e0 100644 --- a/java/res/xml/key_space.xml +++ b/java/res/xml/key_space.xml @@ -21,6 +21,9 @@ <merge xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > + <Spacer + latin:keyWidth="0dp" + latin:keyXPos="25%p" /> <switch> <case latin:languageCode="fa" diff --git a/java/res/xml/row_symbols4.xml b/java/res/xml/row_symbols4.xml index 3ff884607c2312f138239cbfaa06a1341756b060..a92d55a76b0b47f0f7f78e510520906cbb6e580c 100644 --- a/java/res/xml/row_symbols4.xml +++ b/java/res/xml/row_symbols4.xml @@ -43,9 +43,8 @@ latin:keyStyle="f1MoreKeysStyle" /> </default> </switch> - <Key - latin:keyStyle="spaceKeyStyle" - latin:keyWidth="50%p" /> + <include + latin:keyboardLayout="@xml/key_space" /> <Key latin:keyStyle="punctuationKeyStyle" /> <Key diff --git a/java/res/xml/row_symbols_shift4.xml b/java/res/xml/row_symbols_shift4.xml index 28b6ab8dc60397d4ff24428ff09014a65f120b14..6608b77959cc902c5f4d0dfc5772b5b7cb3bacd2 100644 --- a/java/res/xml/row_symbols_shift4.xml +++ b/java/res/xml/row_symbols_shift4.xml @@ -35,9 +35,8 @@ <Key latin:keyLabel="„" latin:backgroundType="functional" /> - <Key - latin:keyStyle="spaceKeyStyle" - latin:keyWidth="50%p" /> + <include + latin:keyboardLayout="@xml/key_space" /> <!-- U+2026: "…" HORIZONTAL ELLIPSIS --> <Key latin:keyLabel="…" diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index dcbdc27313afc4be6cf1f73c04fd7ecfa34dc15b..28855f5611ab26ab0de051e2c34835180639992f 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -313,8 +313,11 @@ public class Keyboard { public void onAddKey(Key newKey) { final Key key = (mKeysCache != null) ? mKeysCache.get(newKey) : newKey; - mKeys.add(key); - updateHistogram(key); + final boolean zeroWidthSpacer = key.isSpacer() && key.mWidth == 0; + if (!zeroWidthSpacer) { + mKeys.add(key); + updateHistogram(key); + } if (key.mCode == Keyboard.CODE_SHIFT) { mShiftKeys.add(key); }