aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/values-be/strings.xml153
-rw-r--r--java/res/values-et/strings.xml153
-rw-r--r--java/res/values-sv/strings.xml2
-rw-r--r--java/res/values-sw/strings.xml2
-rw-r--r--java/res/values-zu/strings.xml4
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java3
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java2
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java1
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java12
-rw-r--r--java/src/com/android/inputmethod/keyboard/PointerTracker.java5
-rw-r--r--java/src/com/android/inputmethod/keyboard/ProximityInfo.java8
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java2
-rw-r--r--java/src/com/android/inputmethod/latin/AutoCorrection.java2
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionary.java12
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java289
-rw-r--r--java/src/com/android/inputmethod/latin/Settings.java4
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java5
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestionsView.java16
-rw-r--r--java/src/com/android/inputmethod/latin/TextEntryState.java53
-rw-r--r--java/src/com/android/inputmethod/latin/UserBigramDictionary.java8
-rw-r--r--java/src/com/android/inputmethod/latin/UserUnigramDictionary.java4
-rw-r--r--java/src/com/android/inputmethod/latin/Utils.java4
-rw-r--r--java/src/com/android/inputmethod/latin/WordComposer.java2
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java2
24 files changed, 235 insertions, 513 deletions
diff --git a/java/res/values-be/strings.xml b/java/res/values-be/strings.xml
deleted file mode 100644
index 1ed944caf..000000000
--- a/java/res/values-be/strings.xml
+++ /dev/null
@@ -1,153 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
-**
-** Copyright 2008, 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:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="english_ime_name" msgid="7252517407088836577">"Клавіятура Android"</string>
- <string name="english_ime_settings" msgid="6661589557206947774">"Налады клавіятуры Android"</string>
- <string name="english_ime_input_options" msgid="3909945612939668554">"Параметры ўводу"</string>
- <string name="spell_checker_service_name" msgid="2003013122022285508">"Папраўкі Android"</string>
- <string name="android_spell_checker_settings" msgid="5822324635435443689">"Налады праверкі арфаграфіі"</string>
- <string name="use_proximity_option_title" msgid="7469233942295924620">"Выкарыстоўвайць дадзеныя аб блізкасці"</string>
- <string name="use_proximity_option_summary" msgid="2857708859847261945">"Для праверкі арфаграфіі выкарыстоўваць алгарытм блізкасці, падобны на клавіятуру"</string>
- <string name="vibrate_on_keypress" msgid="5258079494276955460">"Вібрацыя пры націску клавіш"</string>
- <string name="sound_on_keypress" msgid="6093592297198243644">"Гук пры націску"</string>
- <string name="popup_on_keypress" msgid="123894815723512944">"Па націску на клавішы ўсплывае акно"</string>
- <string name="general_category" msgid="1859088467017573195">"Агульныя"</string>
- <string name="correction_category" msgid="2236750915056607613">"Выпраўленне тэксту"</string>
- <string name="misc_category" msgid="6894192814868233453">"Іншыя параметры"</string>
- <string name="advanced_settings" msgid="362895144495591463">"Адмысловыя налады"</string>
- <string name="advanced_settings_summary" msgid="5193513161106637254">"Парам. для дасведч. карыст."</string>
- <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Затрым. скр. падк. клав."</string>
- <string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"Няма затрымкі"</string>
- <string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"Па змаўчанні"</string>
- <string name="use_contacts_dict" msgid="4435317977804180815">"Прапан. імёны кантактаў"</string>
- <string name="use_contacts_dict_summary" msgid="6599983334507879959">"Выкарыстоўваць імёны са спісу кантактаў для прапаноў і выпраўл."</string>
- <string name="enable_span_insert" msgid="7204653105667167620">"Уключыць карэкцiроўкі"</string>
- <string name="enable_span_insert_summary" msgid="2947317657871394467">"Задаць прапановы для карэкцiроўкі"</string>
- <string name="auto_cap" msgid="1719746674854628252">"Аўтаматычна рабіць вялікія літары"</string>
- <string name="configure_dictionaries_title" msgid="4238652338556902049">"Дадатковыя слоўнікі"</string>
- <string name="main_dictionary" msgid="4798763781818361168">"Асноўны слоўнік"</string>
- <string name="prefs_show_suggestions" msgid="8026799663445531637">"Паказаць прапановы на выпраўленне"</string>
- <string name="prefs_show_suggestions_summary" msgid="1583132279498502825">"Паказваць прапанаваныя словы падчас набору тэксту"</string>
- <string name="prefs_suggestion_visibility_show_name" msgid="3219916594067551303">"Заўсёды паказваць"</string>
- <string name="prefs_suggestion_visibility_show_only_portrait_name" msgid="3551821800439659812">"Паказаць у партрэтным рэжыме"</string>
- <string name="prefs_suggestion_visibility_hide_name" msgid="6309143926422234673">"Заўседы хаваць"</string>
- <string name="prefs_settings_key" msgid="4623341240804046498">"Паказаць умоўныя азначэнні налад"</string>
- <string name="auto_correction" msgid="4979925752001319458">"Аўтамат. выпраўленне"</string>
- <string name="auto_correction_summary" msgid="5625751551134658006">"Прабелы і пунктуацыйныя знакі дазваляюць аўтаматычна выпраўляць памылкова ўведзеныя словы"</string>
- <string name="auto_correction_threshold_mode_off" msgid="8470882665417944026">"Адключаны"</string>
- <string name="auto_correction_threshold_mode_modest" msgid="8788366690620799097">"Сціплы"</string>
- <string name="auto_correction_threshold_mode_aggeressive" msgid="3524029103734923819">"Агрэсіўны"</string>
- <string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Вельмі агрэсіўны"</string>
- <string name="bigram_suggestion" msgid="2636414079905220518">"Біграмныя падказкi"</string>
- <string name="bigram_suggestion_summary" msgid="4383845146070101531">"Выкарыстаць папярэдняе слова, каб палепшыць прапанову"</string>
- <string name="bigram_prediction" msgid="8914273444762259739">"Бiграмныя падказкi"</string>
- <string name="bigram_prediction_summary" msgid="1747261921174300098">"Выкарыстанне папярэдняга слова для падказак"</string>
- <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Захаваныя"</string>
- <string name="label_go_key" msgid="1635148082137219148">"Пачаць"</string>
- <string name="label_next_key" msgid="362972844525672568">"Далей"</string>
- <string name="label_done_key" msgid="2441578748772529288">"Гатова"</string>
- <string name="label_send_key" msgid="2815056534433717444">"Адправіць"</string>
- <string name="label_to_alpha_key" msgid="4793983863798817523">"ABC"</string>
- <string name="label_to_symbol_key" msgid="8516904117128967293">"?123"</string>
- <string name="label_to_symbol_with_microphone_key" msgid="9035925553010061906">"123"</string>
- <string name="label_pause_key" msgid="181098308428035340">"Паўза"</string>
- <string name="label_wait_key" msgid="6402152600878093134">"Чакае"</string>
- <string name="spoken_use_headphones" msgid="896961781287283493">"Каб праслухаць паролi, падключыце гарнiтуру."</string>
- <string name="spoken_current_text_is" msgid="2485723011272583845">"Бягучы тэкст %s"</string>
- <string name="spoken_no_text_entered" msgid="7479685225597344496">"Тэкст не ўведзены"</string>
- <string name="spoken_description_unknown" msgid="3197434010402179157">"Клавішны код %d"</string>
- <string name="spoken_description_shift" msgid="244197883292549308">"Зрух"</string>
- <string name="spoken_description_shift_shifted" msgid="954941524766465022">"Зрух уключаны"</string>
- <string name="spoken_description_caps_lock" msgid="5660626444912131764">"Caps Lock уключаны"</string>
- <string name="spoken_description_delete" msgid="8740376944276199801">"Выдаліць"</string>
- <string name="spoken_description_to_symbol" msgid="5486340107500448969">"Сімвалы"</string>
- <string name="spoken_description_to_alpha" msgid="23129338819771807">"Літары"</string>
- <string name="spoken_description_to_numeric" msgid="591752092685161732">"Лічбы"</string>
- <string name="spoken_description_settings" msgid="4627462689603838099">"Налады"</string>
- <string name="spoken_description_tab" msgid="2667716002663482248">"Укладка"</string>
- <string name="spoken_description_space" msgid="2582521050049860859">"Прабел"</string>
- <string name="spoken_description_mic" msgid="615536748882611950">"Галасавы ўвод"</string>
- <string name="spoken_description_smiley" msgid="2256309826200113918">"Смайлік"</string>
- <string name="spoken_description_return" msgid="8178083177238315647">"Увод"</string>
- <string name="spoken_description_comma" msgid="4970844442999724586">"Коска"</string>
- <string name="spoken_description_period" msgid="5286614628077903945">"Кропка"</string>
- <string name="spoken_description_left_parenthesis" msgid="8524822120595052415">"Адчыняючая дужка"</string>
- <string name="spoken_description_right_parenthesis" msgid="1085757995851933164">"Дужка, якая зачыняе"</string>
- <string name="spoken_description_colon" msgid="4312420908484277077">"Двукроп\'е"</string>
- <string name="spoken_description_semicolon" msgid="37737920987155179">"Кропка з коскай"</string>
- <string name="spoken_description_exclamation_mark" msgid="2625684427460737157">"Клічнік"</string>
- <string name="spoken_description_question_mark" msgid="7074097784255379666">"Пытальнік"</string>
- <string name="spoken_description_double_quote" msgid="5485320575389905967">"Двукоссі"</string>
- <string name="spoken_description_single_quote" msgid="4451320362665463938">"Паўдвукоссі"</string>
- <string name="spoken_description_dot" msgid="40711082435231673">"Кропка"</string>
- <string name="spoken_description_square_root" msgid="190595160284757811">"Квадратны корань"</string>
- <string name="spoken_description_pi" msgid="4554418247799952239">"Пі"</string>
- <string name="spoken_description_delta" msgid="3607948313655721579">"Дэльта"</string>
- <string name="spoken_description_trademark" msgid="475877774077871369">"Гандлёвая марка"</string>
- <string name="spoken_description_care_of" msgid="7492800237237796530">"Працэнт"</string>
- <string name="spoken_description_star" msgid="1009742725387231977">"Пазначыць"</string>
- <string name="spoken_description_pound" msgid="5530577649206922631">"Фунт"</string>
- <string name="spoken_description_ellipsis" msgid="1687670869947652062">"Шматкроп\'е"</string>
- <string name="spoken_description_low_double_quote" msgid="3551394572784840975">"Нізкія падвойныя двукоссі"</string>
- <string name="voice_warning_title" msgid="4419354150908395008">"Галасавы ўвод"</string>
- <string name="voice_warning_locale_not_supported" msgid="637923019716442333">"Галасавы ўвод пакуль не падтрымліваецца для вашай мовы, але працуе на англійскай мове."</string>
- <string name="voice_warning_may_not_understand" msgid="5596289095878251072">"Галасавы набор выкарыстоўвае распазнанне гаворкі Google. Ужываецца "<a href="http://m.google.com/privacy">"палiтыка прыватнасцi для мабiльных прылад"</a>"."</string>
- <string name="voice_warning_how_to_turn_off" msgid="3190378129944934856">"Каб адключыць галасавы ўвод, перайдзіце ў налады метаду ўводу."</string>
- <string name="voice_hint_dialog_message" msgid="1420686286820661548">"Каб выкарыстоўваць галасавы ўвод, націсніце кнопку мікрафона."</string>
- <string name="voice_listening" msgid="467518160751321844">"Гаварыце"</string>
- <string name="voice_working" msgid="6666937792815731889">"Апрацоўка"</string>
- <string name="voice_initializing" msgid="661962047129906646"></string>
- <string name="voice_error" msgid="5140896300312186162">"Памылка. Паспрабуйце яшчэ."</string>
- <string name="voice_network_error" msgid="6649556447401862563">"Не атрымалася ўсталяваць падключэнне"</string>
- <string name="voice_too_much_speech" msgid="5746973620134227376">"Памылка, зашмат гаворкі."</string>
- <string name="voice_audio_error" msgid="5072707727016414454">"Праблема з гукам"</string>
- <string name="voice_server_error" msgid="7807129913977261644">"Памылка сервера"</string>
- <string name="voice_speech_timeout" msgid="8461817525075498795">"Не чуваць гаворку"</string>
- <string name="voice_no_match" msgid="4285117547030179174">"Няма супадзенняў"</string>
- <string name="voice_not_installed" msgid="5552450909753842415">"Галасавы пошук не ўсталяваны"</string>
- <string name="voice_swipe_hint" msgid="6943546180310682021"><b>"Падказка:"</b>" Правядзіце пальцам праз клавіятуру, каб казаць"</string>
- <string name="voice_punctuation_hint" msgid="1611389463237317754"><b>"Падказка:"</b>" У наступны раз паспрабуйце прагаворваць такiя знакі пунктуацыі, як \"кропка\", \"коска\" або \"пытальнік\"."</string>
- <string name="cancel" msgid="6830980399865683324">"Адмяніць"</string>
- <string name="ok" msgid="7898366843681727667">"ОК"</string>
- <string name="voice_input" msgid="3583258583521397548">"Ключ галасавога ўводу"</string>
- <string name="voice_input_modes_main_keyboard" msgid="3360660341121083174">"На асн. клавіятуры"</string>
- <string name="voice_input_modes_symbols_keyboard" msgid="7203213240786084067">"На сімв. клавіятуры"</string>
- <string name="voice_input_modes_off" msgid="3745699748218082014">"Адключана"</string>
- <string name="voice_input_modes_summary_main_keyboard" msgid="6586544292900314339">"Мік. на асн. клав."</string>
- <string name="voice_input_modes_summary_symbols_keyboard" msgid="5233725927281932391">"Мік. на сімв. клав."</string>
- <string name="voice_input_modes_summary_off" msgid="63875609591897607">"Галасавы набор адкл."</string>
- <string name="selectInputMethod" msgid="315076553378705821">"Выберыце метад уводу"</string>
- <string name="configure_input_method" msgid="373356270290742459">"Налада метадаў уводу"</string>
- <string name="language_selection_title" msgid="1651299598555326750">"Мовы ўводу"</string>
- <string name="select_language" msgid="3693815588777926848">"Мовы ўводу"</string>
- <string name="hint_add_to_dictionary" msgid="9006292060636342317">"... Дакраніцеся яшчэ раз, каб захаваць"</string>
- <string name="has_dictionary" msgid="6071847973466625007">"Слоўнік даступны"</string>
- <string name="prefs_enable_log" msgid="6620424505072963557">"Уключыць зваротную сувязь з карыстальнікамі"</string>
- <string name="prefs_description_log" msgid="5827825607258246003">"Дапамажыце палепшыць гэты рэдактар ​​метаду ўводу, аўтаматычна адпраўляючы статыстыку выкарыстання і справаздачы аб збоях Google."</string>
- <string name="keyboard_layout" msgid="8451164783510487501">"Тэма клавіятуры"</string>
- <string name="subtype_de_qwerty" msgid="3358900499589259491">"Нямецкая QWERTY"</string>
- <string name="subtype_en_GB" msgid="88170601942311355">"Англійская (ЗК)"</string>
- <string name="subtype_en_US" msgid="6160452336634534239">"Англійская (ЗША)"</string>
- <string name="prefs_usability_study_mode" msgid="1261130555134595254">"Рэжым даследвання выкарыстальнасці"</string>
- <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Налады працягласцi вiбрацыi пры нацiску"</string>
- <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Налады гучнасцi пры нацiску"</string>
-</resources>
diff --git a/java/res/values-et/strings.xml b/java/res/values-et/strings.xml
deleted file mode 100644
index 2c69c99d3..000000000
--- a/java/res/values-et/strings.xml
+++ /dev/null
@@ -1,153 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
-**
-** Copyright 2008, 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:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="english_ime_name" msgid="7252517407088836577">"Androidi klaviatuur"</string>
- <string name="english_ime_settings" msgid="6661589557206947774">"Androidi klaviatuuriseaded"</string>
- <string name="english_ime_input_options" msgid="3909945612939668554">"Sisestusvalikud"</string>
- <string name="spell_checker_service_name" msgid="2003013122022285508">"Androidi parandus"</string>
- <string name="android_spell_checker_settings" msgid="5822324635435443689">"Õigekirjakontrolli seaded"</string>
- <string name="use_proximity_option_title" msgid="7469233942295924620">"Kasuta lähedusandmeid"</string>
- <string name="use_proximity_option_summary" msgid="2857708859847261945">"Kasuta õigekirjakontrollis klaviatuurisarnast lähedusalgoritmi"</string>
- <string name="vibrate_on_keypress" msgid="5258079494276955460">"Vibreeri klahvivajutusel"</string>
- <string name="sound_on_keypress" msgid="6093592297198243644">"Heli klahvivajutusel"</string>
- <string name="popup_on_keypress" msgid="123894815723512944">"Klahvivajutusel kuva hüpik"</string>
- <string name="general_category" msgid="1859088467017573195">"Üldine"</string>
- <string name="correction_category" msgid="2236750915056607613">"Teksti parandamine"</string>
- <string name="misc_category" msgid="6894192814868233453">"Muud valikud"</string>
- <string name="advanced_settings" msgid="362895144495591463">"Täpsemad seaded"</string>
- <string name="advanced_settings_summary" msgid="5193513161106637254">"Valikud ekspertkasutajatele"</string>
- <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Hüpiku loobumisviivitus"</string>
- <string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"Viivituseta"</string>
- <string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"Vaikeseade"</string>
- <string name="use_contacts_dict" msgid="4435317977804180815">"Soovita kontaktkirjeid"</string>
- <string name="use_contacts_dict_summary" msgid="6599983334507879959">"Kasuta soovitusteks ja parandusteks nimesid kontaktiloendist"</string>
- <string name="enable_span_insert" msgid="7204653105667167620">"Uute paranduste lubamine"</string>
- <string name="enable_span_insert_summary" msgid="2947317657871394467">"Soovituste seadmine uute paranduste jaoks"</string>
- <string name="auto_cap" msgid="1719746674854628252">"Automaatne suurtähtede kasutamine"</string>
- <string name="configure_dictionaries_title" msgid="4238652338556902049">"Pistiksõnaraamatud"</string>
- <string name="main_dictionary" msgid="4798763781818361168">"Peamine sõnaraamat"</string>
- <string name="prefs_show_suggestions" msgid="8026799663445531637">"Kuva parandussoovitusi"</string>
- <string name="prefs_show_suggestions_summary" msgid="1583132279498502825">"Kuva sisestamise ajal sõnasoovitusi"</string>
- <string name="prefs_suggestion_visibility_show_name" msgid="3219916594067551303">"Kuva alati"</string>
- <string name="prefs_suggestion_visibility_show_only_portrait_name" msgid="3551821800439659812">"Kuva portreerežiimis"</string>
- <string name="prefs_suggestion_visibility_hide_name" msgid="6309143926422234673">"Peida alati"</string>
- <string name="prefs_settings_key" msgid="4623341240804046498">"Kuva seadete võti"</string>
- <string name="auto_correction" msgid="4979925752001319458">"Automaatparandus"</string>
- <string name="auto_correction_summary" msgid="5625751551134658006">"Tühik ja kirjavahemärgid parand. autom. kirjavigadega sõnad"</string>
- <string name="auto_correction_threshold_mode_off" msgid="8470882665417944026">"Väljas"</string>
- <string name="auto_correction_threshold_mode_modest" msgid="8788366690620799097">"Mõõdukas"</string>
- <string name="auto_correction_threshold_mode_aggeressive" msgid="3524029103734923819">"Agressiivne"</string>
- <string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Väga agressiivne"</string>
- <string name="bigram_suggestion" msgid="2636414079905220518">"Bigrammi soovitused"</string>
- <string name="bigram_suggestion_summary" msgid="4383845146070101531">"Kasutage eelmist sõna soovituse parandamiseks"</string>
- <string name="bigram_prediction" msgid="8914273444762259739">"Bigrammi ennustus"</string>
- <string name="bigram_prediction_summary" msgid="1747261921174300098">"Kasuta ennustuseks ka eelmist sõna"</string>
- <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : salvestatud"</string>
- <string name="label_go_key" msgid="1635148082137219148">"Mine"</string>
- <string name="label_next_key" msgid="362972844525672568">"Edasi"</string>
- <string name="label_done_key" msgid="2441578748772529288">"Valmis"</string>
- <string name="label_send_key" msgid="2815056534433717444">"Saada"</string>
- <string name="label_to_alpha_key" msgid="4793983863798817523">"ABC"</string>
- <string name="label_to_symbol_key" msgid="8516904117128967293">"?123"</string>
- <string name="label_to_symbol_with_microphone_key" msgid="9035925553010061906">"123"</string>
- <string name="label_pause_key" msgid="181098308428035340">"Peata"</string>
- <string name="label_wait_key" msgid="6402152600878093134">"Oota"</string>
- <string name="spoken_use_headphones" msgid="896961781287283493">"Ühendage peakomplekt, et kuulata paroole."</string>
- <string name="spoken_current_text_is" msgid="2485723011272583845">"Praegune tekst on %s"</string>
- <string name="spoken_no_text_entered" msgid="7479685225597344496">"Teksti ei ole sisestatud"</string>
- <string name="spoken_description_unknown" msgid="3197434010402179157">"Klahvi kood: %d"</string>
- <string name="spoken_description_shift" msgid="244197883292549308">"Tõstuklahv"</string>
- <string name="spoken_description_shift_shifted" msgid="954941524766465022">"Tõstuklahv on lubatud"</string>
- <string name="spoken_description_caps_lock" msgid="5660626444912131764">"Suurtähelukk on lubatud"</string>
- <string name="spoken_description_delete" msgid="8740376944276199801">"Kustuta"</string>
- <string name="spoken_description_to_symbol" msgid="5486340107500448969">"Sümbolid"</string>
- <string name="spoken_description_to_alpha" msgid="23129338819771807">"Tähed"</string>
- <string name="spoken_description_to_numeric" msgid="591752092685161732">"Numbrid"</string>
- <string name="spoken_description_settings" msgid="4627462689603838099">"Seaded"</string>
- <string name="spoken_description_tab" msgid="2667716002663482248">"Tabulaator"</string>
- <string name="spoken_description_space" msgid="2582521050049860859">"Tühik"</string>
- <string name="spoken_description_mic" msgid="615536748882611950">"Kõnesisend"</string>
- <string name="spoken_description_smiley" msgid="2256309826200113918">"Naerunägu"</string>
- <string name="spoken_description_return" msgid="8178083177238315647">"Tagasi"</string>
- <string name="spoken_description_comma" msgid="4970844442999724586">"Koma"</string>
- <string name="spoken_description_period" msgid="5286614628077903945">"Punkt"</string>
- <string name="spoken_description_left_parenthesis" msgid="8524822120595052415">"Vasaksulg"</string>
- <string name="spoken_description_right_parenthesis" msgid="1085757995851933164">"Paremsulg"</string>
- <string name="spoken_description_colon" msgid="4312420908484277077">"Koolon"</string>
- <string name="spoken_description_semicolon" msgid="37737920987155179">"Semikoolon"</string>
- <string name="spoken_description_exclamation_mark" msgid="2625684427460737157">"Hüüumärk"</string>
- <string name="spoken_description_question_mark" msgid="7074097784255379666">"Küsimärk"</string>
- <string name="spoken_description_double_quote" msgid="5485320575389905967">"Jutumärgid"</string>
- <string name="spoken_description_single_quote" msgid="4451320362665463938">"Üksikjutumärgid"</string>
- <string name="spoken_description_dot" msgid="40711082435231673">"Punkt"</string>
- <string name="spoken_description_square_root" msgid="190595160284757811">"Ruutjuur"</string>
- <string name="spoken_description_pi" msgid="4554418247799952239">"Pii"</string>
- <string name="spoken_description_delta" msgid="3607948313655721579">"Delta"</string>
- <string name="spoken_description_trademark" msgid="475877774077871369">"Kaubamärk"</string>
- <string name="spoken_description_care_of" msgid="7492800237237796530">"Vahendaja"</string>
- <string name="spoken_description_star" msgid="1009742725387231977">"Tärn"</string>
- <string name="spoken_description_pound" msgid="5530577649206922631">"Nael"</string>
- <string name="spoken_description_ellipsis" msgid="1687670869947652062">"Kolmikpunkt"</string>
- <string name="spoken_description_low_double_quote" msgid="3551394572784840975">"Alumised jutumärgid"</string>
- <string name="voice_warning_title" msgid="4419354150908395008">"Kõnesisend"</string>
- <string name="voice_warning_locale_not_supported" msgid="637923019716442333">"Kõnesisendit ei toetata praegu teie keeles, kuid see töötab inglise keeles."</string>
- <string name="voice_warning_may_not_understand" msgid="5596289095878251072">"Kõnesisend kasutab Google\'i kõnetuvastust. Kehtivad "<a href="http://m.google.com/privacy">"Mobile\'i privaatsuseeskirjad"</a>"."</string>
- <string name="voice_warning_how_to_turn_off" msgid="3190378129944934856">"Kõnesisendi väljalülitamiseks minge sisestusmeetodi seadete juurde."</string>
- <string name="voice_hint_dialog_message" msgid="1420686286820661548">"Kõnesisendi kasutamiseks vajutage mikrofoni nuppu."</string>
- <string name="voice_listening" msgid="467518160751321844">"Alustage rääkimist"</string>
- <string name="voice_working" msgid="6666937792815731889">"Töötab"</string>
- <string name="voice_initializing" msgid="661962047129906646"></string>
- <string name="voice_error" msgid="5140896300312186162">"Viga. Proovige uuesti."</string>
- <string name="voice_network_error" msgid="6649556447401862563">"Ühendamine nurjus."</string>
- <string name="voice_too_much_speech" msgid="5746973620134227376">"Viga. Liiga palju kõnet."</string>
- <string name="voice_audio_error" msgid="5072707727016414454">"Heli probleem"</string>
- <string name="voice_server_error" msgid="7807129913977261644">"Serveri viga"</string>
- <string name="voice_speech_timeout" msgid="8461817525075498795">"Kõne pole kuuldav"</string>
- <string name="voice_no_match" msgid="4285117547030179174">"Ühtki vastet ei leitud"</string>
- <string name="voice_not_installed" msgid="5552450909753842415">"Hääleotsing pole installitud"</string>
- <string name="voice_swipe_hint" msgid="6943546180310682021"><b>"Vihje:"</b>" rääkimiseks libistage sõrme üle ekraani"</string>
- <string name="voice_punctuation_hint" msgid="1611389463237317754"><b>"Vihje:"</b>" proovige järgmine kord kirjavahemärkide ütlemist, nt „punkt”, „koma” või „küsimärk”."</string>
- <string name="cancel" msgid="6830980399865683324">"Tühista"</string>
- <string name="ok" msgid="7898366843681727667">"OK"</string>
- <string name="voice_input" msgid="3583258583521397548">"Häälesisendi klahv"</string>
- <string name="voice_input_modes_main_keyboard" msgid="3360660341121083174">"Peamisel klaviatuuril"</string>
- <string name="voice_input_modes_symbols_keyboard" msgid="7203213240786084067">"Sümbol. klaviatuuril"</string>
- <string name="voice_input_modes_off" msgid="3745699748218082014">"Väljas"</string>
- <string name="voice_input_modes_summary_main_keyboard" msgid="6586544292900314339">"Mikr. peam. klaviat."</string>
- <string name="voice_input_modes_summary_symbols_keyboard" msgid="5233725927281932391">"Mikr. sümb. klaviat."</string>
- <string name="voice_input_modes_summary_off" msgid="63875609591897607">"Kõnesisend on keelatud"</string>
- <string name="selectInputMethod" msgid="315076553378705821">"Sisestusmeet. valim."</string>
- <string name="configure_input_method" msgid="373356270290742459">"Sisestusmeetodite seadistamine"</string>
- <string name="language_selection_title" msgid="1651299598555326750">"Sisestuskeeled"</string>
- <string name="select_language" msgid="3693815588777926848">"Sisestuskeeled"</string>
- <string name="hint_add_to_dictionary" msgid="9006292060636342317">"←Salvestamiseks puudutage uuesti"</string>
- <string name="has_dictionary" msgid="6071847973466625007">"Sõnastik saadaval"</string>
- <string name="prefs_enable_log" msgid="6620424505072963557">"Luba kasutaja tagasiside"</string>
- <string name="prefs_description_log" msgid="5827825607258246003">"Saatke Google\'ile automaatselt kasutusstatistikat ja krahhiaruandeid ning aidake seda sisestusmeetodi redigeerijat parandada."</string>
- <string name="keyboard_layout" msgid="8451164783510487501">"Klaviatuuri teema"</string>
- <string name="subtype_de_qwerty" msgid="3358900499589259491">"Saksa QWERTY"</string>
- <string name="subtype_en_GB" msgid="88170601942311355">"Inglise (UK)"</string>
- <string name="subtype_en_US" msgid="6160452336634534239">"Inglise (USA)"</string>
- <string name="prefs_usability_study_mode" msgid="1261130555134595254">"Kasutatavuse uurimisrežiim"</string>
- <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Klahvivajutuse vibratsiooni kestuse seaded"</string>
- <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Klahvivajutuse helitugevuse seaded"</string>
-</resources>
diff --git a/java/res/values-sv/strings.xml b/java/res/values-sv/strings.xml
index 46760bbe2..0bed7ac43 100644
--- a/java/res/values-sv/strings.xml
+++ b/java/res/values-sv/strings.xml
@@ -80,7 +80,7 @@
<string name="spoken_description_caps_lock" msgid="5660626444912131764">"Caps Lock är aktiverat"</string>
<string name="spoken_description_delete" msgid="8740376944276199801">"Delete"</string>
<string name="spoken_description_to_symbol" msgid="5486340107500448969">"Symboler"</string>
- <string name="spoken_description_to_alpha" msgid="23129338819771807">"Bokstäver"</string>
+ <string name="spoken_description_to_alpha" msgid="23129338819771807">"Brev"</string>
<string name="spoken_description_to_numeric" msgid="591752092685161732">"Siffror"</string>
<string name="spoken_description_settings" msgid="4627462689603838099">"Inställningar"</string>
<string name="spoken_description_tab" msgid="2667716002663482248">"Tabb"</string>
diff --git a/java/res/values-sw/strings.xml b/java/res/values-sw/strings.xml
index 822907b05..ef0d9768a 100644
--- a/java/res/values-sw/strings.xml
+++ b/java/res/values-sw/strings.xml
@@ -149,5 +149,5 @@
<string name="subtype_en_US" msgid="6160452336634534239">"Kiingereza cha (Marekani)"</string>
<string name="prefs_usability_study_mode" msgid="1261130555134595254">"Modi ya uchunguzi wa utumizi"</string>
<string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Bonyeza mipangilio ya kipindi cha mtetemo"</string>
- <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Bonyeza mipangilio ya nguvu za sauti"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Bonyeza mipangilio ya kurekebisha sauti"</string>
</resources>
diff --git a/java/res/values-zu/strings.xml b/java/res/values-zu/strings.xml
index 072d17cba..2b4a6ace5 100644
--- a/java/res/values-zu/strings.xml
+++ b/java/res/values-zu/strings.xml
@@ -148,6 +148,6 @@
<string name="subtype_en_GB" msgid="88170601942311355">"i-English(UK)"</string>
<string name="subtype_en_US" msgid="6160452336634534239">"i-English (US)"</string>
<string name="prefs_usability_study_mode" msgid="1261130555134595254">"Imodi yesitadi yokusebenziseka"</string>
- <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Izilungiselelo ze-keypress vibration duraton"</string>
- <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Izilungiselelo zevolumu yomsindo wekeypress"</string>
+ <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"I-Keypress vibration ngesikhathi kuhlelwa"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"I-Keypress sound yokuhlela ivolumu"</string>
</resources>
diff --git a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
index 51dc4cd37..0e5f8c80a 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
@@ -153,8 +153,7 @@ public class InputMethodManagerCompatWrapper {
return Utils.getInputMethodInfo(this, mLatinImePackageName);
}
- @SuppressWarnings("unused")
- private InputMethodSubtypeCompatWrapper getLastResortSubtype(String mode) {
+ private static InputMethodSubtypeCompatWrapper getLastResortSubtype(String mode) {
if (VOICE_MODE.equals(mode) && !FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES)
return null;
Locale inputLocale = SubtypeSwitcher.getInstance().getInputLocale();
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index f1ae0b313..f2014b771 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -223,7 +223,7 @@ public class Key {
if (style == null)
throw new ParseException("Unknown key style: " + styleName, parser);
} else {
- style = keyStyles.getEmptyKeyStyle();
+ style = KeyStyles.getEmptyKeyStyle();
}
final float keyXPos = row.getKeyX(keyAttr);
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index a57b9d172..8d40e7aa5 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -75,7 +75,6 @@ public class Keyboard {
public static final int CODE_DELETE = -5;
public static final int CODE_SETTINGS = -6;
public static final int CODE_SHORTCUT = -7;
- public static final int CODE_HAPTIC_AND_AUDIO_FEEDBACK_ONLY = -98;
// Code value representing the code is not specified.
public static final int CODE_UNSPECIFIED = -99;
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index aab52e139..9d97cbf6c 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -21,7 +21,6 @@ import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.os.Message;
-import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
import android.view.GestureDetector;
@@ -349,9 +348,11 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
// When shift key is double tapped, the first tap is correctly processed as usual tap. And
// the second tap is treated as this double tap event, so that we need not mark tracker
// calling setAlreadyProcessed() nor remove the tracker from mPointerQueue.
- final int primaryCode = ignore ? Keyboard.CODE_HAPTIC_AND_AUDIO_FEEDBACK_ONLY
- : Keyboard.CODE_CAPSLOCK;
- mKeyboardActionListener.onCodeInput(primaryCode, null, 0, 0);
+ if (ignore) {
+ mKeyboardActionListener.onCustomRequest(LatinIME.CODE_HAPTIC_AND_AUDIO_FEEDBACK);
+ } else {
+ mKeyboardActionListener.onCodeInput(Keyboard.CODE_CAPSLOCK, null, 0, 0);
+ }
}
// This default implementation returns a more keys panel.
@@ -452,8 +453,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
this, this, pointX, pointY, mMoreKeysWindow, getKeyboardActionListener());
final int translatedX = moreKeysPanel.translateX(tracker.getLastX());
final int translatedY = moreKeysPanel.translateY(tracker.getLastY());
- tracker.onShowMoreKeysPanel(
- translatedX, translatedY, SystemClock.uptimeMillis(), moreKeysPanel);
+ tracker.onShowMoreKeysPanel(translatedX, translatedY, moreKeysPanel);
dimEntireKeyboard(true);
return true;
}
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index 38c419dc6..d5986aa32 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -18,6 +18,7 @@ package com.android.inputmethod.keyboard;
import android.content.Context;
import android.content.res.Resources;
+import android.os.SystemClock;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.TextView;
@@ -615,9 +616,9 @@ public class PointerTracker {
}
}
- public void onShowMoreKeysPanel(int x, int y, long eventTime, KeyEventHandler handler) {
+ public void onShowMoreKeysPanel(int x, int y, KeyEventHandler handler) {
onLongPressed();
- onDownEvent(x, y, eventTime, handler);
+ onDownEvent(x, y, SystemClock.uptimeMillis(), handler);
mIsShowingMoreKeysPanel = true;
}
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
index 2a25d0ca7..6c5c3e7be 100644
--- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
+++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
@@ -75,16 +75,16 @@ public class ProximityInfo {
return spellCheckerProximityInfo;
}
- private int mNativeProximityInfo;
+ private long mNativeProximityInfo;
static {
Utils.loadNativeLibrary();
}
- private native int setProximityInfoNative(int maxProximityCharsSize, int displayWidth,
+ private native long setProximityInfoNative(int maxProximityCharsSize, int displayWidth,
int displayHeight, int gridWidth, int gridHeight, int[] proximityCharsArray,
int keyCount, int[] keyXCoordinates, int[] keyYCoordinates,
int[] keyWidths, int[] keyHeights, int[] keyCharCodes,
float[] sweetSpotCenterX, float[] sweetSpotCenterY, float[] sweetSpotRadii);
- private native void releaseProximityInfoNative(int nativeProximityInfo);
+ private native void releaseProximityInfoNative(long nativeProximityInfo);
private final void setProximityInfo(int[][] gridNeighborKeyIndexes, int keyboardWidth,
int keyboardHeight, List<Key> keys,
@@ -157,7 +157,7 @@ public class ProximityInfo {
}
}
- public int getNativeProximityInfo() {
+ public long getNativeProximityInfo() {
return mNativeProximityInfo;
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java b/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
index b385b7a04..39fb521ea 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
@@ -235,7 +235,7 @@ public class KeyStyles {
return mStyles.get(styleName);
}
- public KeyStyle getEmptyKeyStyle() {
+ public static KeyStyle getEmptyKeyStyle() {
return EMPTY_KEY_STYLE;
}
}
diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java
index 485ec511f..cd066a3d1 100644
--- a/java/src/com/android/inputmethod/latin/AutoCorrection.java
+++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java
@@ -98,7 +98,7 @@ public class AutoCorrection {
return whiteListedWord != null;
}
- private boolean hasAutoCorrectionForTypedWord(Map<String, Dictionary> dictionaries,
+ private static boolean hasAutoCorrectionForTypedWord(Map<String, Dictionary> dictionaries,
WordComposer wordComposer, ArrayList<CharSequence> suggestions, CharSequence typedWord,
int correctionMode) {
if (TextUtils.isEmpty(typedWord)) return false;
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index b9fd57434..f0e56d346 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -46,7 +46,7 @@ public class BinaryDictionary extends Dictionary {
private static final int TYPED_LETTER_MULTIPLIER = 2;
private int mDicTypeId;
- private int mNativeDict;
+ private long mNativeDict;
private final int[] mInputCodes = new int[MAX_WORD_LENGTH * MAX_PROXIMITY_CHARS_SIZE];
private final char[] mOutputChars = new char[MAX_WORD_LENGTH * MAX_WORDS];
private final char[] mOutputChars_bigrams = new char[MAX_WORD_LENGTH * MAX_BIGRAMS];
@@ -107,15 +107,15 @@ public class BinaryDictionary extends Dictionary {
Utils.loadNativeLibrary();
}
- private native int openNative(String sourceDir, long dictOffset, long dictSize,
+ private native long openNative(String sourceDir, long dictOffset, long dictSize,
int typedLetterMultiplier, int fullWordMultiplier, int maxWordLength,
int maxWords, int maxAlternatives);
- private native void closeNative(int dict);
- private native boolean isValidWordNative(int nativeData, char[] word, int wordLength);
- private native int getSuggestionsNative(int dict, int proximityInfo, int[] xCoordinates,
+ private native void closeNative(long dict);
+ private native boolean isValidWordNative(long dict, char[] word, int wordLength);
+ private native int getSuggestionsNative(long dict, long proximityInfo, int[] xCoordinates,
int[] yCoordinates, int[] inputCodes, int codesSize, int flags, char[] outputChars,
int[] scores);
- private native int getBigramsNative(int dict, char[] prevWord, int prevWordLength,
+ private native int getBigramsNative(long dict, char[] prevWord, int prevWordLength,
int[] inputCodes, int inputCodesLength, char[] outputChars, int[] scores,
int maxWordLength, int maxBigrams, int maxAlternatives);
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 6d4569b76..fd833157d 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -157,6 +157,22 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
SUGGESTION_VISIBILILTY_HIDE_VALUE
};
+ // Magic space: a space that should disappear on space/apostrophe insertion, move after the
+ // punctuation on punctuation insertion, and become a real space on alpha char insertion.
+ // Weak space: a space that be swapped only by suggestion strip punctuation.
+ // Double space: the state where the user pressed space twice quickly, which LatinIME
+ // resolved as period-space. Undoing this converts the period to a space.
+ // Swap punctuation: the state where a (weak or magic) space and a punctuation from the
+ // suggestion strip have just been swapped. Undoing this swaps them back.
+ private static final int SPACE_STATE_NONE = 0;
+ private static final int SPACE_STATE_DOUBLE = 1;
+ private static final int SPACE_STATE_SWAP_PUNCTUATION = 2;
+ private static final int SPACE_STATE_MAGIC = 3;
+ private static final int SPACE_STATE_WEAK = 4;
+
+ // Current space state of the input method. This can be any of the above constants.
+ private int mSpaceState;
+
private Settings.Values mSettingsValues;
private View mExtractArea;
@@ -190,12 +206,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private WordComposer mWordComposer = new WordComposer();
private CharSequence mBestWord;
private boolean mHasUncommittedTypedChars;
- // Magic space: a space that should disappear on space/apostrophe insertion, move after the
- // punctuation on punctuation insertion, and become a real space on alpha char insertion.
- private boolean mJustAddedMagicSpace; // This indicates whether the last char is a magic space.
- // This indicates whether the last keypress resulted in processing of double space replacement
- // with period-space.
- private boolean mJustReplacedDoubleSpace;
private int mCorrectionMode;
private int mCommittedLength;
@@ -729,8 +739,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mComposingStringBuilder.setLength(0);
mHasUncommittedTypedChars = false;
mDeleteCount = 0;
- mJustAddedMagicSpace = false;
- mJustReplacedDoubleSpace = false;
+ mSpaceState = SPACE_STATE_NONE;
loadSettings();
updateCorrectionMode();
@@ -891,6 +900,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|| newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart;
final boolean candidatesCleared = candidatesStart == -1 && candidatesEnd == -1;
if (!mExpectingUpdateSelection) {
+ if (SPACE_STATE_WEAK == mSpaceState) {
+ // Test for no WEAK_SPACE action because there is a race condition that may end up
+ // in coming here on a normal key press. We set this to NONE because after
+ // a cursor move, we don't want the suggestion strip to swap the space with the
+ // newly inserted punctuation.
+ mSpaceState = SPACE_STATE_NONE;
+ }
if (((mComposingStringBuilder.length() > 0 && mHasUncommittedTypedChars)
|| mVoiceProxy.isVoiceInputHighlighted())
&& (selectionChanged || candidatesCleared)) {
@@ -908,8 +924,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
TextEntryState.reset();
updateSuggestions();
}
- mJustAddedMagicSpace = false; // The user moved the cursor.
- mJustReplacedDoubleSpace = false;
}
mExpectingUpdateSelection = false;
mHandler.postUpdateShiftKeyState();
@@ -1134,25 +1148,22 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return false;
}
- private void swapSwapperAndSpace() {
- final InputConnection ic = getCurrentInputConnection();
- if (ic == null) return;
+ // "ic" may be null
+ private void swapSwapperAndSpaceWhileInBatchEdit(final InputConnection ic) {
+ if (null == ic) return;
CharSequence lastTwo = ic.getTextBeforeCursor(2, 0);
// It is guaranteed lastTwo.charAt(1) is a swapper - else this method is not called.
if (lastTwo != null && lastTwo.length() == 2
&& lastTwo.charAt(0) == Keyboard.CODE_SPACE) {
- ic.beginBatchEdit();
ic.deleteSurroundingText(2, 0);
ic.commitText(lastTwo.charAt(1) + " ", 1);
- ic.endBatchEdit();
mKeyboardSwitcher.updateShiftState();
}
}
- private void maybeDoubleSpace() {
- if (mCorrectionMode == Suggest.CORRECTION_NONE) return;
- final InputConnection ic = getCurrentInputConnection();
- if (ic == null) return;
+ private boolean maybeDoubleSpaceWhileInBatchEdit(final InputConnection ic) {
+ if (mCorrectionMode == Suggest.CORRECTION_NONE) return false;
+ if (ic == null) return false;
final CharSequence lastThree = ic.getTextBeforeCursor(3, 0);
if (lastThree != null && lastThree.length() == 3
&& Utils.canBeFollowedByPeriod(lastThree.charAt(0))
@@ -1160,22 +1171,19 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
&& lastThree.charAt(2) == Keyboard.CODE_SPACE
&& mHandler.isAcceptingDoubleSpaces()) {
mHandler.cancelDoubleSpacesTimer();
- ic.beginBatchEdit();
ic.deleteSurroundingText(2, 0);
ic.commitText(". ", 1);
- ic.endBatchEdit();
mKeyboardSwitcher.updateShiftState();
- mJustReplacedDoubleSpace = true;
- } else {
- mHandler.startDoubleSpacesTimer();
+ return true;
}
+ return false;
}
- // "ic" must not null
- private void maybeRemovePreviousPeriod(final InputConnection ic, CharSequence text) {
+ // "ic" must not be null
+ private static void maybeRemovePreviousPeriod(final InputConnection ic, CharSequence text) {
// When the text's first character is '.', remove the previous period
// if there is one.
- CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
+ final CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
if (lastOne != null && lastOne.length() == 1
&& lastOne.charAt(0) == Keyboard.CODE_PERIOD
&& text.charAt(0) == Keyboard.CODE_PERIOD) {
@@ -1183,11 +1191,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
}
- private void removeTrailingSpace() {
- final InputConnection ic = getCurrentInputConnection();
+ // "ic" may be null
+ private static void removeTrailingSpaceWhileInBatchEdit(final InputConnection ic) {
if (ic == null) return;
-
- CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
+ final CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
if (lastOne != null && lastOne.length() == 1
&& lastOne.charAt(0) == Keyboard.CODE_SPACE) {
ic.deleteSurroundingText(1, 0);
@@ -1203,12 +1210,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return true;
}
- private boolean isAlphabet(int code) {
- if (Character.isLetter(code)) {
- return true;
- } else {
- return false;
- }
+ private static boolean isAlphabet(int code) {
+ return Character.isLetter(code);
}
private void onSettingsKeyPressed() {
@@ -1224,6 +1227,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// Virtual codes representing custom requests. These are used in onCustomRequest() below.
public static final int CODE_SHOW_INPUT_METHOD_PICKER = 1;
+ public static final int CODE_HAPTIC_AND_AUDIO_FEEDBACK = 2;
@Override
public boolean onCustomRequest(int requestCode) {
@@ -1235,6 +1239,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return true;
}
return false;
+ case CODE_HAPTIC_AND_AUDIO_FEEDBACK:
+ hapticAndAudioFeedback(Keyboard.CODE_UNSPECIFIED);
+ return true;
}
return false;
}
@@ -1243,6 +1250,28 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return mOptionsDialog != null && mOptionsDialog.isShowing();
}
+ private void insertPunctuationFromSuggestionStrip(final InputConnection ic, final int code) {
+ final CharSequence beforeText = ic != null ? ic.getTextBeforeCursor(1, 0) : null;
+ final int toLeft = TextUtils.isEmpty(beforeText) ? 0 : beforeText.charAt(0);
+ final boolean shouldRegisterSwapPunctuation;
+ // If we have a space left of the cursor and it's a weak or a magic space, then we should
+ // swap it, and override the space state with SPACESTATE_SWAP_PUNCTUATION.
+ // To swap it, we fool handleSeparator to think the previous space state was a
+ // magic space.
+ if (Keyboard.CODE_SPACE == toLeft && mSpaceState == SPACE_STATE_WEAK) {
+ mSpaceState = SPACE_STATE_MAGIC;
+ shouldRegisterSwapPunctuation = true;
+ } else {
+ shouldRegisterSwapPunctuation = false;
+ }
+ onCodeInput(code, new int[] { code },
+ KeyboardActionListener.NOT_A_TOUCH_COORDINATE,
+ KeyboardActionListener.NOT_A_TOUCH_COORDINATE);
+ if (shouldRegisterSwapPunctuation) {
+ mSpaceState = SPACE_STATE_SWAP_PUNCTUATION;
+ }
+ }
+
// Implementation of {@link KeyboardActionListener}.
@Override
public void onCodeInput(int primaryCode, int[] keyCodes, int x, int y) {
@@ -1253,11 +1282,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mLastKeyTime = when;
KeyboardSwitcher switcher = mKeyboardSwitcher;
final boolean distinctMultiTouch = switcher.hasDistinctMultitouch();
- final boolean lastStateOfJustReplacedDoubleSpace = mJustReplacedDoubleSpace;
- mJustReplacedDoubleSpace = false;
+ // The space state depends only on the last character pressed and its own previous
+ // state. Here, we revert the space state to neutral if the key is actually modifying
+ // the input contents (any non-shift key), which is what we should do for
+ // all inputs that do not result in a special state. Each character handling is then
+ // free to override the state as they see fit.
+ final int spaceState = mSpaceState;
switch (primaryCode) {
case Keyboard.CODE_DELETE:
- handleBackspace(lastStateOfJustReplacedDoubleSpace);
+ mSpaceState = SPACE_STATE_NONE;
+ handleBackspace(spaceState);
mDeleteCount++;
mExpectingUpdateSelection = true;
LatinImeLogger.logOnDelete();
@@ -1282,11 +1316,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
break;
case Keyboard.CODE_CAPSLOCK:
switcher.toggleCapsLock();
- //$FALL-THROUGH$
- case Keyboard.CODE_HAPTIC_AND_AUDIO_FEEDBACK_ONLY:
- // Dummy code for haptic and audio feedbacks.
- vibrate();
- playKeyClick(primaryCode);
+ hapticAndAudioFeedback(primaryCode);
break;
case Keyboard.CODE_SHORTCUT:
mSubtypeSwitcher.switchToShortcutIME();
@@ -1303,10 +1333,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// To sum it up: do not update mExpectingUpdateSelection here.
break;
default:
+ mSpaceState = SPACE_STATE_NONE;
if (mSettingsValues.isWordSeparator(primaryCode)) {
- handleSeparator(primaryCode, x, y);
+ handleSeparator(primaryCode, x, y, spaceState);
} else {
- handleCharacter(primaryCode, keyCodes, x, y);
+ handleCharacter(primaryCode, keyCodes, x, y, spaceState);
}
mExpectingUpdateSelection = true;
break;
@@ -1328,7 +1359,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
ic.endBatchEdit();
mKeyboardSwitcher.updateShiftState();
mKeyboardSwitcher.onKey(Keyboard.CODE_DUMMY);
- mJustAddedMagicSpace = false;
+ mSpaceState = SPACE_STATE_NONE;
mEnteredText = text;
}
@@ -1338,7 +1369,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mKeyboardSwitcher.onCancelInput();
}
- private void handleBackspace(boolean justReplacedDoubleSpace) {
+ private void handleBackspace(final int spaceState) {
if (mVoiceProxy.logAndRevertVoiceInput()) return;
final InputConnection ic = getCurrentInputConnection();
@@ -1376,15 +1407,24 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
mHandler.postUpdateShiftKeyState();
+ // TODO: Merge space state with TextEntryState
TextEntryState.backspace();
if (TextEntryState.isUndoCommit()) {
revertLastWord(ic);
ic.endBatchEdit();
return;
}
- if (justReplacedDoubleSpace) {
+ if (SPACE_STATE_DOUBLE == spaceState) {
if (revertDoubleSpace(ic)) {
ic.endBatchEdit();
+ // No need to reset mSpaceState, it has already be done (that's why we
+ // receive it as a parameter)
+ return;
+ }
+ } else if (SPACE_STATE_SWAP_PUNCTUATION == spaceState) {
+ if (revertSwapPunctuation(ic)) {
+ ic.endBatchEdit();
+ // Likewise
return;
}
}
@@ -1434,11 +1474,15 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
}
- private void handleCharacter(int primaryCode, int[] keyCodes, int x, int y) {
+ private void handleCharacter(final int primaryCode, final int[] keyCodes, final int x,
+ final int y, final int spaceState) {
mVoiceProxy.handleCharacter();
- if (mJustAddedMagicSpace && mSettingsValues.isMagicSpaceStripper(primaryCode)) {
- removeTrailingSpace();
+ final InputConnection ic = getCurrentInputConnection();
+ if (ic != null) ic.beginBatchEdit();
+ if (SPACE_STATE_MAGIC == spaceState
+ && mSettingsValues.isMagicSpaceStripper(primaryCode)) {
+ removeTrailingSpaceWhileInBatchEdit(ic);
}
int code = primaryCode;
@@ -1456,6 +1500,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (switcher.isShiftedOrShiftLocked()) {
if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT
|| keyCodes[0] > Character.MAX_CODE_POINT) {
+ if (null != ic) ic.endBatchEdit();
return;
}
code = keyCodes[0];
@@ -1469,6 +1514,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} else {
// Some keys, such as [eszett], have upper case as multi-characters.
onTextInput(upperCaseString);
+ if (null != ic) ic.endBatchEdit();
return;
}
}
@@ -1476,7 +1522,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mHasUncommittedTypedChars) {
mComposingStringBuilder.append((char) code);
mWordComposer.add(code, keyCodes, x, y);
- final InputConnection ic = getCurrentInputConnection();
if (ic != null) {
// If it's the first letter, make note of auto-caps state
if (mWordComposer.size() == 1) {
@@ -1494,18 +1539,19 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} else {
sendKeyChar((char)code);
}
- if (mJustAddedMagicSpace && mSettingsValues.isMagicSpaceSwapper(primaryCode)) {
- swapSwapperAndSpace();
- } else {
- mJustAddedMagicSpace = false;
+ if (SPACE_STATE_MAGIC == spaceState
+ && mSettingsValues.isMagicSpaceSwapper(primaryCode)) {
+ if (null != ic) swapSwapperAndSpaceWhileInBatchEdit(ic);
}
switcher.updateShiftState();
if (LatinIME.PERF_DEBUG) measureCps();
TextEntryState.typedCharacter((char) code, mSettingsValues.isWordSeparator(code), x, y);
+ if (null != ic) ic.endBatchEdit();
}
- private void handleSeparator(int primaryCode, int x, int y) {
+ private void handleSeparator(final int primaryCode, final int x, final int y,
+ final int spaceState) {
mVoiceProxy.handleSeparator();
mComposingStateManager.onFinishComposingText();
@@ -1535,21 +1581,49 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
}
- if (mJustAddedMagicSpace) {
+ final boolean swapMagicSpace;
+ if (Keyboard.CODE_ENTER == primaryCode && (SPACE_STATE_MAGIC == spaceState
+ || SPACE_STATE_SWAP_PUNCTUATION == spaceState)) {
+ removeTrailingSpaceWhileInBatchEdit(ic);
+ swapMagicSpace = false;
+ } else if (SPACE_STATE_MAGIC == spaceState) {
if (mSettingsValues.isMagicSpaceSwapper(primaryCode)) {
- sendKeyChar((char)primaryCode);
- swapSwapperAndSpace();
+ swapMagicSpace = true;
} else {
- if (mSettingsValues.isMagicSpaceStripper(primaryCode)) removeTrailingSpace();
- sendKeyChar((char)primaryCode);
- mJustAddedMagicSpace = false;
+ swapMagicSpace = false;
+ if (mSettingsValues.isMagicSpaceStripper(primaryCode)) {
+ removeTrailingSpaceWhileInBatchEdit(ic);
+ }
}
} else {
- sendKeyChar((char)primaryCode);
+ swapMagicSpace = false;
}
- if (isSuggestionsRequested() && primaryCode == Keyboard.CODE_SPACE) {
- maybeDoubleSpace();
+ sendKeyChar((char)primaryCode);
+
+ if (Keyboard.CODE_SPACE == primaryCode) {
+ if (isSuggestionsRequested()) {
+ if (maybeDoubleSpaceWhileInBatchEdit(ic)) {
+ mSpaceState = SPACE_STATE_DOUBLE;
+ } else if (!isShowingPunctuationList()) {
+ mSpaceState = SPACE_STATE_WEAK;
+ }
+ }
+
+ mHandler.startDoubleSpacesTimer();
+ if (!isCursorTouchingWord()) {
+ mHandler.cancelUpdateSuggestions();
+ mHandler.postUpdateBigramPredictions();
+ }
+ } else {
+ if (swapMagicSpace) {
+ swapSwapperAndSpaceWhileInBatchEdit(ic);
+ mSpaceState = SPACE_STATE_MAGIC;
+ }
+
+ // Set punctuation right away. onUpdateSelection will fire but tests whether it is
+ // already displayed or not, so it's okay.
+ setPunctuationSuggestions();
}
TextEntryState.typedCharacter((char) primaryCode, true, x, y);
@@ -1562,16 +1636,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
ic, mLastSelectionEnd - typedWord.length(), typedWord, mBestWord);
}
}
- if (Keyboard.CODE_SPACE == primaryCode) {
- if (!isCursorTouchingWord()) {
- mHandler.cancelUpdateSuggestions();
- mHandler.postUpdateBigramPredictions();
- }
- } else {
- // Set punctuation right away. onUpdateSelection will fire but tests whether it is
- // already displayed or not, so it's okay.
- setPunctuationSuggestions();
- }
mKeyboardSwitcher.updateShiftState();
if (ic != null) {
ic.endBatchEdit();
@@ -1606,7 +1670,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
public boolean isSuggestionsStripVisible() {
if (mSuggestionsView == null)
return false;
- if (mSuggestionsView.isShowingAddToDictionaryHint() || TextEntryState.isRecorrecting())
+ if (mSuggestionsView.isShowingAddToDictionaryHint())
return true;
if (!isShowingSuggestionsStrip())
return false;
@@ -1711,7 +1775,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
// Don't auto-correct words with multiple capital letter
autoCorrectionAvailable &= !wordComposer.isMostlyCaps();
- autoCorrectionAvailable &= !TextEntryState.isRecorrecting();
// Basically, we update the suggestion strip only when suggestion count > 1. However,
// there is an exception: We update the suggestion strip whenever typed word's length
@@ -1784,7 +1847,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion,
mSettingsValues.mWordSeparators);
- final boolean recorrecting = TextEntryState.isRecorrecting();
final InputConnection ic = getCurrentInputConnection();
if (ic != null) {
ic.beginBatchEdit();
@@ -1814,8 +1876,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
LatinImeLogger.logOnManualSuggestion(
"", suggestion.toString(), index, suggestions.mWords);
// Find out whether the previous character is a space. If it is, as a special case
- // for punctuation entered through the suggestion strip, it should be considered
- // a magic space even if it was a normal space. This is meant to help in case the user
+ // for punctuation entered through the suggestion strip, it should be swapped
+ // if it was a magic or a weak space. This is meant to help in case the user
// pressed space on purpose of displaying the suggestion strip punctuation.
final int rawPrimaryCode = suggestion.charAt(0);
// Maybe apply the "bidi mirrored" conversions for parentheses
@@ -1823,15 +1885,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
final boolean isRtl = keyboard != null && keyboard.mIsRtlKeyboard;
final int primaryCode = Key.getRtlParenthesisCode(rawPrimaryCode, isRtl);
- final CharSequence beforeText = ic != null ? ic.getTextBeforeCursor(1, 0) : "";
- final int toLeft = (ic == null || TextUtils.isEmpty(beforeText))
- ? 0 : beforeText.charAt(0);
- final boolean oldMagicSpace = mJustAddedMagicSpace;
- if (Keyboard.CODE_SPACE == toLeft) mJustAddedMagicSpace = true;
- onCodeInput(primaryCode, new int[] { primaryCode },
- KeyboardActionListener.NOT_A_TOUCH_COORDINATE,
- KeyboardActionListener.NOT_A_TOUCH_COORDINATE);
- mJustAddedMagicSpace = oldMagicSpace;
+ insertPunctuationFromSuggestionStrip(ic, primaryCode);
+ // TODO: the following endBatchEdit seems useless, check
if (ic != null) {
ic.endBatchEdit();
}
@@ -1855,7 +1910,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
suggestion.toString(), index, suggestions.mWords);
TextEntryState.acceptedSuggestion(mComposingStringBuilder.toString(), suggestion);
// Follow it with a space
- if (mInsertSpaceOnPickSuggestionManually && !recorrecting) {
+ if (mInsertSpaceOnPickSuggestionManually) {
sendMagicSpace();
}
@@ -1875,13 +1930,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|| !AutoCorrection.isValidWord(
mSuggest.getUnigramDictionaries(), suggestion, true));
- if (!recorrecting) {
- // Fool the state watcher so that a subsequent backspace will not do a revert, unless
- // we just did a correction, in which case we need to stay in
- // TextEntryState.State.PICKED_SUGGESTION state.
- TextEntryState.typedCharacter((char) Keyboard.CODE_SPACE, true,
- WordComposer.NOT_A_COORDINATE, WordComposer.NOT_A_COORDINATE);
- }
+ // Fool the state watcher so that a subsequent backspace will not do a revert, unless
+ // we just did a correction, in which case we need to stay in
+ // TextEntryState.State.PICKED_SUGGESTION state.
+ TextEntryState.typedCharacter((char) Keyboard.CODE_SPACE, true,
+ WordComposer.NOT_A_COORDINATE, WordComposer.NOT_A_COORDINATE);
if (!showingAddToDictionaryHint) {
// If we're not showing the "Touch again to save", then show corrections again.
// In case the cursor position doesn't change, make sure we show the suggestions again.
@@ -1892,7 +1945,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
if (showingAddToDictionaryHint) {
if (mIsUserDictionaryAvaliable) {
- mSuggestionsView.showAddToDictionaryHint(suggestion);
+ mSuggestionsView.showAddToDictionaryHint(
+ suggestion, mSettingsValues.mHintToSaveText);
} else {
mHandler.postUpdateSuggestions();
}
@@ -2023,13 +2077,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return false;
}
- // "ic" must not null
- private boolean sameAsTextBeforeCursor(final InputConnection ic, CharSequence text) {
+ // "ic" must not be null
+ private static boolean sameAsTextBeforeCursor(final InputConnection ic, CharSequence text) {
CharSequence beforeText = ic.getTextBeforeCursor(text.length(), 0);
return TextUtils.equals(text, beforeText);
}
- // "ic" must not null
+ // "ic" must not be null
private void revertLastWord(final InputConnection ic) {
if (mHasUncommittedTypedChars || mComposingStringBuilder.length() <= 0) {
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
@@ -2063,7 +2117,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mHandler.postUpdateSuggestions();
}
- // "ic" must not null
+ // "ic" must not be null
private boolean revertDoubleSpace(final InputConnection ic) {
mHandler.cancelDoubleSpacesTimer();
// Here we test whether we indeed have a period and a space before us. This should not
@@ -2078,13 +2132,28 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return true;
}
+ private static boolean revertSwapPunctuation(final InputConnection ic) {
+ // Here we test whether we indeed have a space and something else before us. This should not
+ // be needed, but it's there just in case something went wrong.
+ final CharSequence textBeforeCursor = ic.getTextBeforeCursor(2, 0);
+ // NOTE: This does not work with surrogate pairs. Hopefully when the keyboard is able to
+ // enter surrogate pairs this code will have been removed.
+ if (Keyboard.CODE_SPACE != textBeforeCursor.charAt(1))
+ return false;
+ ic.beginBatchEdit();
+ ic.deleteSurroundingText(2, 0);
+ ic.commitText(" " + textBeforeCursor.subSequence(0, 1), 1);
+ ic.endBatchEdit();
+ return true;
+ }
+
public boolean isWordSeparator(int code) {
return mSettingsValues.isWordSeparator(code);
}
private void sendMagicSpace() {
sendKeyChar((char)Keyboard.CODE_SPACE);
- mJustAddedMagicSpace = true;
+ mSpaceState = SPACE_STATE_MAGIC;
mKeyboardSwitcher.updateShiftState();
}
@@ -2106,12 +2175,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
loadSettings();
}
+ private void hapticAndAudioFeedback(int primaryCode) {
+ vibrate();
+ playKeyClick(primaryCode);
+ }
+
@Override
public void onPress(int primaryCode, boolean withSliding) {
final KeyboardSwitcher switcher = mKeyboardSwitcher;
if (switcher.isVibrateAndSoundFeedbackRequired()) {
- vibrate();
- playKeyClick(primaryCode);
+ hapticAndAudioFeedback(primaryCode);
}
final boolean distinctMultiTouch = switcher.hasDistinctMultitouch();
if (distinctMultiTouch && primaryCode == Keyboard.CODE_SHIFT) {
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index eeb0299b1..9d5d89071 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -115,6 +115,7 @@ public class Settings extends InputMethodSettingsActivity
public final String mSuggestPuncs;
public final SuggestedWords mSuggestPuncList;
private final String mSymbolsExcludedFromWordSeparators;
+ public final CharSequence mHintToSaveText;
// From preferences:
public final boolean mSoundOn; // Sound setting private to Latin IME (see mSilentModeOn)
@@ -176,6 +177,7 @@ public class Settings extends InputMethodSettingsActivity
mSuggestPuncs = res.getString(R.string.suggested_punctuations);
// TODO: it would be nice not to recreate this each time we change the configuration
mSuggestPuncList = createSuggestPuncList(mSuggestPuncs);
+ mHintToSaveText = context.getText(R.string.hint_add_to_dictionary);
// Get the settings preferences
final boolean hasVibrator = VibratorCompatWrapper.getInstance(context).hasVibrator();
@@ -792,4 +794,4 @@ public class Settings extends InputMethodSettingsActivity
builder.setView(v);
builder.create().show();
}
-} \ No newline at end of file
+}
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index caa5aac51..97e91745c 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -144,7 +144,7 @@ public class Suggest implements Dictionary.WordCallback {
initWhitelistAndAutocorrectAndPool(context, locale);
}
- private void addOrReplaceDictionary(Map<String, Dictionary> dictionaries, String key,
+ private static void addOrReplaceDictionary(Map<String, Dictionary> dictionaries, String key,
Dictionary dict) {
final Dictionary oldDict = (dict == null)
? dictionaries.remove(key)
@@ -518,7 +518,8 @@ public class Suggest implements Dictionary.WordCallback {
return -1;
}
- private void collectGarbage(ArrayList<CharSequence> suggestions, int prefMaxSuggestions) {
+ private static void collectGarbage(ArrayList<CharSequence> suggestions,
+ int prefMaxSuggestions) {
int poolSize = StringBuilderPool.getSize();
int garbageSize = suggestions.size();
while (poolSize < prefMaxSuggestions && garbageSize > 0) {
diff --git a/java/src/com/android/inputmethod/latin/SuggestionsView.java b/java/src/com/android/inputmethod/latin/SuggestionsView.java
index c25ecb382..8c49ba0cf 100644
--- a/java/src/com/android/inputmethod/latin/SuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/SuggestionsView.java
@@ -30,7 +30,6 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Message;
-import android.os.SystemClock;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
@@ -172,7 +171,6 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
public final TextView mWordToSaveView;
private final TextView mHintToSaveView;
- private final CharSequence mHintToSaveText;
public SuggestionsViewParams(Context context, AttributeSet attrs, int defStyle,
List<TextView> words, List<View> dividers, List<TextView> infos) {
@@ -228,7 +226,6 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
final LayoutInflater inflater = LayoutInflater.from(context);
mWordToSaveView = (TextView)inflater.inflate(R.layout.suggestion_word, null);
mHintToSaveView = (TextView)inflater.inflate(R.layout.suggestion_word, null);
- mHintToSaveText = context.getText(R.string.hint_add_to_dictionary);
}
private static Drawable getMoreSuggestionsHint(Resources res, float textSize, int color) {
@@ -445,7 +442,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
}
public void layoutAddToDictionaryHint(CharSequence word, ViewGroup stripView,
- int stripWidth) {
+ int stripWidth, CharSequence hintText) {
final int width = stripWidth - mDividerWidth - mPadding * 2;
final TextView wordView = mWordToSaveView;
@@ -464,8 +461,8 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
final TextView hintView = mHintToSaveView;
hintView.setTextColor(mColorAutoCorrect);
final int hintWidth = width - wordWidth;
- final float hintScaleX = getTextScaleX(mHintToSaveText, hintWidth, hintView.getPaint());
- hintView.setText(mHintToSaveText);
+ final float hintScaleX = getTextScaleX(hintText, hintWidth, hintView.getPaint());
+ hintView.setText(hintText);
hintView.setTextScaleX(hintScaleX);
stripView.addView(hintView);
setLayoutWeight(
@@ -647,9 +644,9 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
&& mSuggestionsStrip.getChildAt(0) == mParams.mWordToSaveView;
}
- public void showAddToDictionaryHint(CharSequence word) {
+ public void showAddToDictionaryHint(CharSequence word, CharSequence hintText) {
clear();
- mParams.layoutAddToDictionaryHint(word, mSuggestionsStrip, getWidth());
+ mParams.layoutAddToDictionaryHint(word, mSuggestionsStrip, getWidth(), hintText);
}
public boolean dismissAddToDictionaryHint() {
@@ -832,8 +829,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
// Decided to be in the sliding input mode only when the touch point has been moved
// upward.
mMoreSuggestionsMode = MORE_SUGGESTIONS_IN_SLIDING_MODE;
- tracker.onShowMoreKeysPanel(
- translatedX, translatedY, SystemClock.uptimeMillis(), moreKeysPanel);
+ tracker.onShowMoreKeysPanel(translatedX, translatedY, moreKeysPanel);
} else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP) {
// Decided to be in the modal input mode
mMoreSuggestionsMode = MORE_SUGGESTIONS_IN_MODAL_MODE;
diff --git a/java/src/com/android/inputmethod/latin/TextEntryState.java b/java/src/com/android/inputmethod/latin/TextEntryState.java
index 79b3bdebb..82242f87e 100644
--- a/java/src/com/android/inputmethod/latin/TextEntryState.java
+++ b/java/src/com/android/inputmethod/latin/TextEntryState.java
@@ -30,13 +30,10 @@ public class TextEntryState {
private static final int IN_WORD = 2;
private static final int ACCEPTED_DEFAULT = 3;
private static final int PICKED_SUGGESTION = 4;
- private static final int PUNCTUATION_AFTER_WORD = 5;
- private static final int PUNCTUATION_AFTER_ACCEPTED = 6;
- private static final int SPACE_AFTER_ACCEPTED = 7;
- private static final int SPACE_AFTER_PICKED = 8;
- private static final int UNDO_COMMIT = 9;
- private static final int RECORRECTING = 10;
- private static final int PICKED_RECORRECTION = 11;
+ private static final int PUNCTUATION_AFTER_ACCEPTED = 5;
+ private static final int SPACE_AFTER_ACCEPTED = 6;
+ private static final int SPACE_AFTER_PICKED = 7;
+ private static final int UNDO_COMMIT = 8;
private static int sState = UNKNOWN;
private static int sPreviousState = UNKNOWN;
@@ -79,27 +76,11 @@ public class TextEntryState {
}
public static void acceptedSuggestion(CharSequence typedWord, CharSequence actualWord) {
- if (sState == RECORRECTING || sState == PICKED_RECORRECTION) {
- setState(PICKED_RECORRECTION);
- } else {
- setState(PICKED_SUGGESTION);
- }
+ setState(PICKED_SUGGESTION);
if (DEBUG)
displayState("acceptedSuggestion", "typedWord", typedWord, "actualWord", actualWord);
}
- public static void selectedForRecorrection() {
- setState(RECORRECTING);
- if (DEBUG) displayState("selectedForRecorrection");
- }
-
- public static void onAbortRecorrection() {
- if (sState == RECORRECTING || sState == PICKED_RECORRECTION) {
- setState(START);
- }
- if (DEBUG) displayState("onAbortRecorrection");
- }
-
public static void typedCharacter(char c, boolean isSeparator, int x, int y) {
final boolean isSpace = (c == Keyboard.CODE_SPACE);
switch (sState) {
@@ -123,7 +104,6 @@ public class TextEntryState {
}
break;
case PICKED_SUGGESTION:
- case PICKED_RECORRECTION:
if (isSpace) {
setState(SPACE_AFTER_PICKED);
} else if (isSeparator) {
@@ -136,7 +116,6 @@ public class TextEntryState {
case START:
case UNKNOWN:
case SPACE_AFTER_ACCEPTED:
- case PUNCTUATION_AFTER_WORD:
if (!isSpace && !isSeparator) {
setState(IN_WORD);
} else {
@@ -150,9 +129,6 @@ public class TextEntryState {
setState(IN_WORD);
}
break;
- case RECORRECTING:
- setState(START);
- break;
}
RingCharBuffer.getInstance().push(c, x, y);
if (isSeparator) {
@@ -178,26 +154,10 @@ public class TextEntryState {
if (DEBUG) displayState("reset");
}
- public static boolean isAcceptedDefault() {
- return sState == ACCEPTED_DEFAULT;
- }
-
- public static boolean isSpaceAfterPicked() {
- return sState == SPACE_AFTER_PICKED;
- }
-
public static boolean isUndoCommit() {
return sState == UNDO_COMMIT;
}
- public static boolean isPunctuationAfterAccepted() {
- return sState == PUNCTUATION_AFTER_ACCEPTED;
- }
-
- public static boolean isRecorrecting() {
- return sState == RECORRECTING || sState == PICKED_RECORRECTION;
- }
-
public static String getState() {
return stateName(sState);
}
@@ -208,13 +168,10 @@ public class TextEntryState {
case IN_WORD: return "IN_WORD";
case ACCEPTED_DEFAULT: return "ACCEPTED_DEFAULT";
case PICKED_SUGGESTION: return "PICKED_SUGGESTION";
- case PUNCTUATION_AFTER_WORD: return "PUNCTUATION_AFTER_WORD";
case PUNCTUATION_AFTER_ACCEPTED: return "PUNCTUATION_AFTER_ACCEPTED";
case SPACE_AFTER_ACCEPTED: return "SPACE_AFTER_ACCEPTED";
case SPACE_AFTER_PICKED: return "SPACE_AFTER_PICKED";
case UNDO_COMMIT: return "UNDO_COMMIT";
- case RECORRECTING: return "RECORRECTING";
- case PICKED_RECORRECTION: return "PICKED_RECORRECTION";
default: return "UNKNOWN";
}
}
diff --git a/java/src/com/android/inputmethod/latin/UserBigramDictionary.java b/java/src/com/android/inputmethod/latin/UserBigramDictionary.java
index 9e656675e..3a1af9311 100644
--- a/java/src/com/android/inputmethod/latin/UserBigramDictionary.java
+++ b/java/src/com/android/inputmethod/latin/UserBigramDictionary.java
@@ -238,7 +238,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
/**
* Query the database
*/
- private Cursor query(String selection, String[] selectionArgs) {
+ private static Cursor query(String selection, String[] selectionArgs) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
// main INNER JOIN frequency ON (main._id=freq.pair_id)
@@ -310,7 +310,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
}
/** Prune any old data if the database is getting too big. */
- private void checkPruneData(SQLiteDatabase db) {
+ private static void checkPruneData(SQLiteDatabase db) {
db.execSQL("PRAGMA foreign_keys = ON;");
Cursor c = db.query(FREQ_TABLE_NAME, new String[] { FREQ_COLUMN_PAIR_ID },
null, null, null, null, null);
@@ -380,7 +380,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
return null;
}
- private ContentValues getContentValues(String word1, String word2, String locale) {
+ private static ContentValues getContentValues(String word1, String word2, String locale) {
ContentValues values = new ContentValues(3);
values.put(MAIN_COLUMN_WORD1, word1);
values.put(MAIN_COLUMN_WORD2, word2);
@@ -388,7 +388,7 @@ public class UserBigramDictionary extends ExpandableDictionary {
return values;
}
- private ContentValues getFrequencyContentValues(int pairId, int frequency) {
+ private static ContentValues getFrequencyContentValues(int pairId, int frequency) {
ContentValues values = new ContentValues(2);
values.put(FREQ_COLUMN_PAIR_ID, pairId);
values.put(FREQ_COLUMN_FREQUENCY, frequency);
diff --git a/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java b/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java
index e41230b3c..de7cb5716 100644
--- a/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java
+++ b/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java
@@ -206,7 +206,7 @@ public class UserUnigramDictionary extends ExpandableDictionary {
}
}
- private Cursor query(String selection, String[] selectionArgs) {
+ private static Cursor query(String selection, String[] selectionArgs) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(USER_UNIGRAM_DICT_TABLE_NAME);
qb.setProjectionMap(sDictProjectionMap);
@@ -251,7 +251,7 @@ public class UserUnigramDictionary extends ExpandableDictionary {
return null;
}
- private ContentValues getContentValues(String word, int frequency, String locale) {
+ private static ContentValues getContentValues(String word, int frequency, String locale) {
ContentValues values = new ContentValues(4);
values.put(COLUMN_WORD, word);
values.put(COLUMN_FREQUENCY, frequency);
diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java
index b29ff1975..3d0aa09f1 100644
--- a/java/src/com/android/inputmethod/latin/Utils.java
+++ b/java/src/com/android/inputmethod/latin/Utils.java
@@ -242,7 +242,7 @@ public class Utils {
UsabilityStudyLogUtils.getInstance().init(context);
return sRingCharBuffer;
}
- private int normalize(int in) {
+ private static int normalize(int in) {
int ret = in % BUFSIZE;
return ret < 0 ? ret + BUFSIZE : ret;
}
@@ -465,7 +465,7 @@ public class Utils {
}
}
- public void writeBackSpace() {
+ public static void writeBackSpace() {
UsabilityStudyLogUtils.getInstance().write("<backspace>\t0\t0");
}
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index adc5637f6..7f3a54244 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -135,7 +135,7 @@ public class WordComposer {
* @param primaryCode the preferred character
* @param codes array of codes based on distance from touch point
*/
- private void correctPrimaryJuxtapos(int primaryCode, int[] codes) {
+ private static void correctPrimaryJuxtapos(int primaryCode, int[] codes) {
if (codes.length < 2) return;
if (codes[0] > 0 && codes[1] > 0 && codes[0] != primaryCode && codes[1] == primaryCode) {
codes[1] = codes[0];
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 095c2c51c..5d296f892 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -368,7 +368,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
* @param text the string to evaluate.
* @return true if we should filter this text out, false otherwise
*/
- private boolean shouldFilterOut(final String text) {
+ private static boolean shouldFilterOut(final String text) {
if (TextUtils.isEmpty(text) || text.length() <= 1) return true;
// TODO: check if an equivalent processing can't be done more quickly with a