diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/res/values-be/donottranslate-more-keys.xml | 23 | ||||
-rw-r--r-- | java/res/values-ru/donottranslate-more-keys.xml | 4 | ||||
-rw-r--r-- | java/res/values/donottranslate-more-keys.xml | 13 | ||||
-rw-r--r-- | java/res/xml-be/keyboard_set.xml | 42 | ||||
-rw-r--r-- | java/res/xml-ru/keyboard_set.xml | 2 | ||||
-rw-r--r-- | java/res/xml-sw600dp/kbd_rows_slavic.xml (renamed from java/res/xml-sw600dp/kbd_rows_russian.xml) | 18 | ||||
-rw-r--r-- | java/res/xml-sw768dp/kbd_rows_slavic.xml (renamed from java/res/xml-sw768dp/kbd_rows_russian.xml) | 18 | ||||
-rw-r--r-- | java/res/xml/kbd_rows_slavic.xml (renamed from java/res/xml/kbd_rows_russian.xml) | 20 | ||||
-rw-r--r-- | java/res/xml/kbd_slavic.xml (renamed from java/res/xml/kbd_russian.xml) | 2 | ||||
-rw-r--r-- | java/res/xml/method.xml | 9 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 43 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/WordComposer.java | 4 |
12 files changed, 138 insertions, 60 deletions
diff --git a/java/res/values-be/donottranslate-more-keys.xml b/java/res/values-be/donottranslate-more-keys.xml new file mode 100644 index 000000000..28264c4ac --- /dev/null +++ b/java/res/values-be/donottranslate-more-keys.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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. +*/ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="keylabel_for_slavic_shcha">ў</string> + <string name="keylabel_for_slavic_i">i</string> +</resources> diff --git a/java/res/values-ru/donottranslate-more-keys.xml b/java/res/values-ru/donottranslate-more-keys.xml index f7e006e84..7ae9ffbda 100644 --- a/java/res/values-ru/donottranslate-more-keys.xml +++ b/java/res/values-ru/donottranslate-more-keys.xml @@ -18,7 +18,5 @@ */ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="more_keys_for_cyrillic_e">5,ё</string> - <string name="more_keys_for_cyrillic_soft_sign">ъ</string> - <string name="more_keys_for_cyrillic_ha">ъ</string> + <string name="more_keys_for_slavic_ye">5,ё</string> </resources> diff --git a/java/res/values/donottranslate-more-keys.xml b/java/res/values/donottranslate-more-keys.xml index 6c7753999..ac175dfe7 100644 --- a/java/res/values/donottranslate-more-keys.xml +++ b/java/res/values/donottranslate-more-keys.xml @@ -42,9 +42,16 @@ <string name="keylabel_for_scandinavia_row2_11"></string> <string name="more_keys_for_scandinavia_row2_10"></string> <string name="more_keys_for_scandinavia_row2_11"></string> - <string name="more_keys_for_cyrillic_e"></string> - <string name="more_keys_for_cyrillic_soft_sign"></string> - <string name="more_keys_for_cyrillic_ha"></string> + <string name="keylabel_for_slavic_shcha">щ</string> + <string name="keylabel_for_slavic_yery">ы</string> + <string name="keylabel_for_slavic_i">и</string> + <string name="more_keys_for_slavic_u">3</string> + <string name="more_keys_for_slavic_ye">5</string> + <string name="more_keys_for_slavic_en">6</string> + <string name="more_keys_for_slavic_ha">ъ</string> + <string name="more_keys_for_slavic_yery"></string> + <string name="more_keys_for_slavic_o"></string> + <string name="more_keys_for_slavic_soft_sign">ъ</string> <string name="more_keys_for_currency_dollar">¢,£,€,¥,₱</string> <string name="more_keys_for_currency_euro">¢,£,$,¥,₱</string> <string name="more_keys_for_currency_pound">¢,$,€,¥,₱</string> diff --git a/java/res/xml-be/keyboard_set.xml b/java/res/xml-be/keyboard_set.xml new file mode 100644 index 000000000..e5c6ba35a --- /dev/null +++ b/java/res/xml-be/keyboard_set.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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. +*/ +--> + +<KeyboardSet + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + latin:keyboardLocale="be"> + <Element + latin:elementName="alphabet" + latin:elementKeyboard="@xml/kbd_slavic" /> + <Element + latin:elementName="symbols" + latin:elementKeyboard="@xml/kbd_symbols" /> + <Element + latin:elementName="symbolsShift" + latin:elementKeyboard="@xml/kbd_symbols_shift" /> + <Element + latin:elementName="phone" + latin:elementKeyboard="@xml/kbd_phone" /> + <Element + latin:elementName="phoneShift" + latin:elementKeyboard="@xml/kbd_phone_shift" /> + <Element + latin:elementName="number" + latin:elementKeyboard="@xml/kbd_number" /> +</KeyboardSet> diff --git a/java/res/xml-ru/keyboard_set.xml b/java/res/xml-ru/keyboard_set.xml index eabee5dc3..0a158d9cc 100644 --- a/java/res/xml-ru/keyboard_set.xml +++ b/java/res/xml-ru/keyboard_set.xml @@ -23,7 +23,7 @@ latin:keyboardLocale="ru"> <Element latin:elementName="alphabet" - latin:elementKeyboard="@xml/kbd_russian" /> + latin:elementKeyboard="@xml/kbd_slavic" /> <Element latin:elementName="symbols" latin:elementKeyboard="@xml/kbd_symbols" /> diff --git a/java/res/xml-sw600dp/kbd_rows_russian.xml b/java/res/xml-sw600dp/kbd_rows_slavic.xml index 3395065ed..0a162058d 100644 --- a/java/res/xml-sw600dp/kbd_rows_russian.xml +++ b/java/res/xml-sw600dp/kbd_rows_slavic.xml @@ -31,20 +31,22 @@ <Key latin:keyLabel="ц" /> <Key - latin:keyLabel="у" /> + latin:keyLabel="у" + latin:moreKeys="@string/more_keys_for_slavic_u" /> <Key latin:keyLabel="к" /> <Key latin:keyLabel="е" - latin:moreKeys="@string/more_keys_for_cyrillic_e" /> + latin:moreKeys="@string/more_keys_for_slavic_ye" /> <Key - latin:keyLabel="н" /> + latin:keyLabel="н" + latin:moreKeys="@string/more_keys_for_slavic_en" /> <Key latin:keyLabel="г" /> <Key latin:keyLabel="ш" /> <Key - latin:keyLabel="щ" /> + latin:keyLabel="@string/keylabel_for_slavic_shcha" /> <Key latin:keyLabel="з" /> <Key @@ -63,7 +65,8 @@ latin:keyLabel="ф" latin:keyXPos="2.25%p" /> <Key - latin:keyLabel="ы" /> + latin:keyLabel="@string/keylabel_for_slavic_yery" + latin:moreKeys="@string/more_keys_for_slavic_yery" /> <Key latin:keyLabel="в" /> <Key @@ -73,7 +76,8 @@ <Key latin:keyLabel="р" /> <Key - latin:keyLabel="о" /> + latin:keyLabel="о" + latin:moreKeys="@string/more_keys_for_slavic_o" /> <Key latin:keyLabel="л" /> <Key @@ -101,7 +105,7 @@ <Key latin:keyLabel="м" /> <Key - latin:keyLabel="и" /> + latin:keyLabel="@string/keylabel_for_slavic_i" /> <Key latin:keyLabel="т" /> <Key diff --git a/java/res/xml-sw768dp/kbd_rows_russian.xml b/java/res/xml-sw768dp/kbd_rows_slavic.xml index eb0baf95d..4c9128d86 100644 --- a/java/res/xml-sw768dp/kbd_rows_russian.xml +++ b/java/res/xml-sw768dp/kbd_rows_slavic.xml @@ -34,20 +34,22 @@ <Key latin:keyLabel="ц" /> <Key - latin:keyLabel="у" /> + latin:keyLabel="у" + latin:moreKeys="@string/more_keys_for_slavic_u" /> <Key latin:keyLabel="к" /> <Key latin:keyLabel="е" - latin:moreKeys="@string/more_keys_for_cyrillic_e" /> + latin:moreKeys="@string/more_keys_for_slavic_ye" /> <Key - latin:keyLabel="н" /> + latin:keyLabel="н" + latin:moreKeys="@string/more_keys_for_slavic_en" /> <Key latin:keyLabel="г" /> <Key latin:keyLabel="ш" /> <Key - latin:keyLabel="щ" /> + latin:keyLabel="@string/keylabel_for_slavic_shcha" /> <Key latin:keyLabel="з" /> <Key @@ -68,7 +70,8 @@ <Key latin:keyLabel="ф" /> <Key - latin:keyLabel="ы" /> + latin:keyLabel="@string/keylabel_for_slavic_yery" + latin:moreKeys="@string/more_keys_for_slavic_yery" /> <Key latin:keyLabel="в" /> <Key @@ -78,7 +81,8 @@ <Key latin:keyLabel="р" /> <Key - latin:keyLabel="о" /> + latin:keyLabel="о" + latin:moreKeys="@string/more_keys_for_slavic_o" /> <Key latin:keyLabel="л" /> <Key @@ -107,7 +111,7 @@ <Key latin:keyLabel="м" /> <Key - latin:keyLabel="и" /> + latin:keyLabel="@string/keylabel_for_slavic_i" /> <Key latin:keyLabel="т" /> <Key diff --git a/java/res/xml/kbd_rows_russian.xml b/java/res/xml/kbd_rows_slavic.xml index f1794e750..6536eaeb3 100644 --- a/java/res/xml/kbd_rows_russian.xml +++ b/java/res/xml/kbd_rows_slavic.xml @@ -37,7 +37,7 @@ <Key latin:keyLabel="у" latin:keyHintLabel="3" - latin:moreKeys="3" /> + latin:moreKeys="@string/more_keys_for_slavic_u" /> <Key latin:keyLabel="к" latin:keyHintLabel="4" @@ -45,11 +45,11 @@ <Key latin:keyLabel="е" latin:keyHintLabel="5" - latin:moreKeys="@string/more_keys_for_cyrillic_e" /> + latin:moreKeys="@string/more_keys_for_slavic_ye" /> <Key latin:keyLabel="н" latin:keyHintLabel="6" - latin:moreKeys="6" /> + latin:moreKeys="@string/more_keys_for_slavic_en" /> <Key latin:keyLabel="г" latin:keyHintLabel="7" @@ -59,7 +59,7 @@ latin:keyHintLabel="8" latin:moreKeys="8" /> <Key - latin:keyLabel="щ" + latin:keyLabel="@string/keylabel_for_slavic_shcha" latin:keyHintLabel="9" latin:moreKeys="9" /> <Key @@ -68,7 +68,7 @@ latin:moreKeys="0" /> <Key latin:keyLabel="х" - latin:moreKeys="@string/more_keys_for_cyrillic_ha" + latin:moreKeys="@string/more_keys_for_slavic_ha" latin:keyWidth="fillRight" /> </Row> <Row @@ -78,7 +78,8 @@ latin:keyLabel="ф" latin:keyWidth="8.75%p" /> <Key - latin:keyLabel="ы" /> + latin:keyLabel="@string/keylabel_for_slavic_yery" + latin:moreKeys="@string/more_keys_for_slavic_yery" /> <Key latin:keyLabel="в" /> <Key @@ -88,7 +89,8 @@ <Key latin:keyLabel="р" /> <Key - latin:keyLabel="о" /> + latin:keyLabel="о" + latin:moreKeys="@string/more_keys_for_slavic_o" /> <Key latin:keyLabel="л" /> <Key @@ -114,12 +116,12 @@ <Key latin:keyLabel="м" /> <Key - latin:keyLabel="и" /> + latin:keyLabel="@string/keylabel_for_slavic_i" /> <Key latin:keyLabel="т" /> <Key latin:keyLabel="ь" - latin:moreKeys="@string/more_keys_for_cyrillic_soft_sign" /> + latin:moreKeys="@string/more_keys_for_slavic_soft_sign" /> <Key latin:keyLabel="б" /> <Key diff --git a/java/res/xml/kbd_russian.xml b/java/res/xml/kbd_slavic.xml index 071bfd588..6207d2939 100644 --- a/java/res/xml/kbd_russian.xml +++ b/java/res/xml/kbd_slavic.xml @@ -22,5 +22,5 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <include - latin:keyboardLayout="@xml/kbd_rows_russian" /> + latin:keyboardLayout="@xml/kbd_rows_slavic" /> </Keyboard> diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 2b2c00c17..e9e3912f9 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -20,7 +20,8 @@ <!-- The attributes in this XML file provide configuration information --> <!-- for the Input Method Manager. --> -<!-- Keyboard: en_US, en_GB, ar, cs, da, de, de(QWERTY), es, es_US, et, fi, fr, fr_CA, fr_CH, hr, hu, it, iw, lt, lv, nb, nl, pl, pt, ru, sr, sv, tr --> +<!-- Keyboard: en_US, en_GB, ar, be, cs, da, de, de(QWERTY), es, es_US, et, fi, fr, fr_CA, fr_CH, + hr, hu, it, iw, lt, lv, nb, nl, pl, pt, ru, sr, sv, tr --> <!-- TODO: use <lang>_keyboard icon instead of a common keyboard icon. --> <!-- If IME doesn't have an applicable subtype, the first subtype will be used as a default subtype.--> @@ -47,6 +48,12 @@ /> <subtype android:icon="@drawable/ic_subtype_keyboard" android:label="@string/subtype_generic" + android:imeSubtypeLocale="be" + android:imeSubtypeMode="keyboard" + android:imeSubtypeExtraValue="SupportTouchPositionCorrection" + /> + <subtype android:icon="@drawable/ic_subtype_keyboard" + android:label="@string/subtype_generic" android:imeSubtypeLocale="cs" android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection" diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 944042a9a..f24dc3fe3 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -198,7 +198,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private boolean mIsUserDictionaryAvailable; private WordComposer mWordComposer = new WordComposer(); - private boolean mHasUncommittedTypedChars; private int mCorrectionMode; private String mWordSavedForAutoCorrectCancellation; @@ -759,7 +758,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar inputView.closing(); mEnteredText = null; mWordComposer.reset(); - mHasUncommittedTypedChars = false; mDeleteCount = 0; mSpaceState = SPACE_STATE_NONE; @@ -863,11 +861,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // newly inserted punctuation. mSpaceState = SPACE_STATE_NONE; } - if (((mWordComposer.size() > 0 && mHasUncommittedTypedChars) + if (((mWordComposer.isComposingWord()) || mVoiceProxy.isVoiceInputHighlighted()) && (selectionChanged || candidatesCleared)) { mWordComposer.reset(); - mHasUncommittedTypedChars = false; updateSuggestions(); final InputConnection ic = getCurrentInputConnection(); if (ic != null) { @@ -875,7 +872,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } mComposingStateManager.onFinishComposingText(); mVoiceProxy.setVoiceInputHighlighted(false); - } else if (!mHasUncommittedTypedChars) { + } else if (!mWordComposer.isComposingWord()) { updateSuggestions(); } } @@ -1076,8 +1073,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } public void commitTyped(final InputConnection ic) { - if (!mHasUncommittedTypedChars) return; - mHasUncommittedTypedChars = false; + if (!mWordComposer.isComposingWord()) return; final CharSequence typedWord = mWordComposer.getTypedWord(); mWordComposer.onCommitWord(); if (typedWord.length() > 0) { @@ -1352,18 +1348,18 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return; } - if (mHasUncommittedTypedChars) { + if (mWordComposer.isComposingWord()) { final int length = mWordComposer.size(); if (length > 0) { mWordComposer.deleteLast(); ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1); - if (mWordComposer.size() == 0) { - mHasUncommittedTypedChars = false; - // Remaining size equals zero means we just erased the last character of the - // word, so we can show bigrams. + // If we have deleted the last remaining character of a word, then we are not + // isComposingWord() any more. + if (!mWordComposer.isComposingWord()) { + // Not composing word any more, so we can show bigrams. mHandler.postUpdateBigramPredictions(); } else { - // length > 1, so we still have letters to deduce a suggestion from. + // Still composing a word, so we still have letters to deduce a suggestion from. mHandler.postUpdateSuggestions(); } } else { @@ -1452,7 +1448,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (null != ic) removeTrailingSpaceWhileInBatchEdit(ic); } - boolean isComposingWord = mHasUncommittedTypedChars; + boolean isComposingWord = mWordComposer.isComposingWord(); int code = primaryCode; if ((isAlphabet(code) || mSettingsValues.isSymbolExcludedFromWordSeparators(code)) && isSuggestionsRequested() && !isCursorTouchingWord()) { @@ -1489,7 +1485,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } if (isComposingWord) { - mHasUncommittedTypedChars = true; mWordComposer.add(code, keyCodes, x, y); if (ic != null) { // If it's the first letter, make note of auto-caps state @@ -1535,7 +1530,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // Reset the saved word in all cases. If this separator causes an autocorrection, // it will overwrite this null with the actual word we need to save. mWordSavedForAutoCorrectCancellation = null; - if (mHasUncommittedTypedChars) { + if (mWordComposer.isComposingWord()) { // In certain languages where single quote is a separator, it's better // not to auto correct, but accept the typed word. For instance, // in Italian dov' should not be expanded to dove' because the elision @@ -1710,7 +1705,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mHandler.cancelUpdateSuggestions(); mHandler.cancelUpdateBigramPredictions(); - if (!mHasUncommittedTypedChars) { + if (!mWordComposer.isComposingWord()) { setPunctuationSuggestions(); return; } @@ -1885,11 +1880,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } return; } - if (!mHasUncommittedTypedChars) { - // If we are not composing a word, then it was a suggestion inferred from - // context - no user input. We should reset the word composer. - mWordComposer.reset(); - } mExpectingUpdateSelection = true; commitBestWord(suggestion); // Add the word to the auto dictionary if it's not a known word @@ -1899,8 +1889,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } else { addToOnlyBigramDictionary(suggestion, 1); } - // TODO: the following is fishy, because if !mHasUncommittedTypedChars we are - // going to log an empty string + // TODO: the following is fishy, because it seems there may be cases where we are not + // composing a word at all. Maybe throw an exception if !mWordComposer.isComposingWord() ? LatinImeLogger.logOnManualSuggestion(mWordComposer.getTypedWord().toString(), suggestion.toString(), index, suggestions.mWords); // Follow it with a space @@ -1965,7 +1955,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar ic.commitText(bestWord, 1); } } - mHasUncommittedTypedChars = false; mWordComposer.onCommitWord(); } @@ -2109,7 +2098,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private void restartSuggestionsOnWordBeforeCursor(final InputConnection ic, final CharSequence word) { mWordComposer.setComposingWord(word, mKeyboardSwitcher.getLatinKeyboard()); - mHasUncommittedTypedChars = true; mComposingStateManager.onStartComposingText(); ic.deleteSurroundingText(word.length(), 0); ic.setComposingText(word, 1); @@ -2168,7 +2156,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // Note: in the interest of code simplicity, we may want to just call // restartSuggestionsOnWordBeforeCursorIfAtEndOfWord instead, but retrieving // the old WordComposer allows to reuse the actual typed coordinates. - mHasUncommittedTypedChars = true; mWordComposer.resumeSuggestionOnKeptWord(); ic.setComposingText(mWordComposer.getTypedWord(), 1); mHandler.cancelUpdateBigramPredictions(); @@ -2456,7 +2443,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar p.println(" Keyboard mode = " + keyboardMode); p.println(" mIsSuggestionsRequested=" + mInputAttributes.mIsSettingsSuggestionStripOn); p.println(" mCorrectionMode=" + mCorrectionMode); - p.println(" mHasUncommittedTypedChars=" + mHasUncommittedTypedChars); + p.println(" isComposingWord=" + mWordComposer.isComposingWord()); p.println(" mAutoCorrectEnabled=" + mSettingsValues.mAutoCorrectEnabled); p.println(" mSoundOn=" + mSettingsValues.mSoundOn); p.println(" mVibrateOn=" + mSettingsValues.mVibrateOn); diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index c0204c2a6..b88e73fc7 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -120,6 +120,10 @@ public class WordComposer { return mCurrentWord.mTypedWord.length(); } + public final boolean isComposingWord() { + return size() > 0; + } + /** * Returns the codes at a particular position in the word. * @param index the position in the word |