aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/values-bg/strings.xml6
-rw-r--r--java/res/values-da/strings.xml10
-rw-r--r--java/res/values-de/strings.xml2
-rw-r--r--java/res/values-es-rUS/strings.xml2
-rw-r--r--java/res/values-fr/strings.xml4
-rw-r--r--java/res/values-hr/strings.xml6
-rw-r--r--java/res/values-in/strings.xml6
-rw-r--r--java/res/values-it/strings.xml2
-rw-r--r--java/res/values-ja/strings.xml6
-rw-r--r--java/res/values-ko/strings.xml10
-rw-r--r--java/res/values-lt/strings.xml4
-rw-r--r--java/res/values-ms/strings.xml4
-rw-r--r--java/res/values-pl/strings.xml12
-rw-r--r--java/res/values-ru/strings.xml2
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java252
-rw-r--r--java/src/com/android/inputmethod/latin/TextEntryState.java53
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java24
17 files changed, 213 insertions, 192 deletions
diff --git a/java/res/values-bg/strings.xml b/java/res/values-bg/strings.xml
index 2b266472f..30fe132d8 100644
--- a/java/res/values-bg/strings.xml
+++ b/java/res/values-bg/strings.xml
@@ -148,8 +148,6 @@
<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>
- <!-- no translation found for prefs_keypress_vibration_duration_settings (1829950405285211668) -->
- <skip />
- <!-- no translation found for prefs_keypress_sound_volume_settings (5875933757082305040) -->
- <skip />
+ <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Настройки за продължителност на вибрирането при натискане на клавиш"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Настройки за силата на звука при натискане на клавиш"</string>
</resources>
diff --git a/java/res/values-da/strings.xml b/java/res/values-da/strings.xml
index 5d8f80635..b91acaa90 100644
--- a/java/res/values-da/strings.xml
+++ b/java/res/values-da/strings.xml
@@ -21,7 +21,7 @@
<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-tastatur"</string>
- <string name="english_ime_settings" msgid="6661589557206947774">"Indstillinger for Android-tastatur"</string>
+ <string name="english_ime_settings" msgid="6661589557206947774">"Android-tastatur-indstillinger"</string>
<string name="english_ime_input_options" msgid="3909945612939668554">"Indstillinger for input"</string>
<string name="spell_checker_service_name" msgid="2003013122022285508">"Android-rettelse"</string>
<string name="android_spell_checker_settings" msgid="5822324635435443689">"Indstillinger for stavekontrol"</string>
@@ -29,16 +29,16 @@
<string name="use_proximity_option_summary" msgid="2857708859847261945">"Brug en tastaturlignende nærhedsalgoritme til stavekontrol"</string>
<string name="vibrate_on_keypress" msgid="5258079494276955460">"Vibration ved tastetryk"</string>
<string name="sound_on_keypress" msgid="6093592297198243644">"Lyd ved tastetryk"</string>
- <string name="popup_on_keypress" msgid="123894815723512944">"Popup ved tastetryk"</string>
+ <string name="popup_on_keypress" msgid="123894815723512944">"Pop op ved tastetryk"</string>
<string name="general_category" msgid="1859088467017573195">"Generelt"</string>
<string name="correction_category" msgid="2236750915056607613">"Tekstkorrigering"</string>
<string name="misc_category" msgid="6894192814868233453">"Andre valgmuligheder"</string>
<string name="advanced_settings" msgid="362895144495591463">"Avancerede indstillinger"</string>
<string name="advanced_settings_summary" msgid="5193513161106637254">"Muligheder for ekspertbrugere"</string>
- <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Forsink. afvis. af taste-popup"</string>
+ <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Forsink. afvis. af taste-pop op"</string>
<string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"Ingen forsink."</string>
<string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"Standard"</string>
- <string name="use_contacts_dict" msgid="4435317977804180815">"Foreslå navne på kontaktpersoner"</string>
+ <string name="use_contacts_dict" msgid="4435317977804180815">"Foreslå navne på kontakter"</string>
<string name="use_contacts_dict_summary" msgid="6599983334507879959">"Brug navne fra Kontaktpersoner til forslag og rettelser"</string>
<string name="enable_span_insert" msgid="7204653105667167620">"Aktiver fornyet rettelse"</string>
<string name="enable_span_insert_summary" msgid="2947317657871394467">"Angiv forslag til fornyet rettelse"</string>
@@ -54,7 +54,7 @@
<string name="auto_correction" msgid="4979925752001319458">"Automatisk retning"</string>
<string name="auto_correction_summary" msgid="5625751551134658006">"Mellemrumstast og tegnsætning retter automatisk forkerte ord"</string>
<string name="auto_correction_threshold_mode_off" msgid="8470882665417944026">"Fra"</string>
- <string name="auto_correction_threshold_mode_modest" msgid="8788366690620799097">"Beskeden"</string>
+ <string name="auto_correction_threshold_mode_modest" msgid="8788366690620799097">"Moderat"</string>
<string name="auto_correction_threshold_mode_aggeressive" msgid="3524029103734923819">"Aggressiv"</string>
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Meget aggressiv"</string>
<string name="bigram_suggestion" msgid="2636414079905220518">"Bigram-forslag"</string>
diff --git a/java/res/values-de/strings.xml b/java/res/values-de/strings.xml
index 907a40f92..d329f3271 100644
--- a/java/res/values-de/strings.xml
+++ b/java/res/values-de/strings.xml
@@ -149,5 +149,5 @@
<string name="subtype_en_US" msgid="6160452336634534239">"Englisch (USA)"</string>
<string name="prefs_usability_study_mode" msgid="1261130555134595254">"Modus der Studie zur Benutzerfreundlichkeit"</string>
<string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Einstellungen für Vibrationsdauer bei Tastendruck"</string>
- <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Einstellungen für Sound-Lautstärke bei Tastendruck"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Einstellungen für Tonlautstärke bei Tastendruck"</string>
</resources>
diff --git a/java/res/values-es-rUS/strings.xml b/java/res/values-es-rUS/strings.xml
index a45a2a4c5..95e309ff7 100644
--- a/java/res/values-es-rUS/strings.xml
+++ b/java/res/values-es-rUS/strings.xml
@@ -149,5 +149,5 @@
<string name="subtype_en_US" msgid="6160452336634534239">"Inglés (EE.UU.)"</string>
<string name="prefs_usability_study_mode" msgid="1261130555134595254">"Modo de estudio de usabilidad"</string>
<string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Configuración de la duración de vibraciones al presionar las teclas"</string>
- <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Configuración de la duración de volumen al presionar las teclas"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Configuración del volumen de sonio al presionar las teclas"</string>
</resources>
diff --git a/java/res/values-fr/strings.xml b/java/res/values-fr/strings.xml
index ae14e2fdc..ef9303e88 100644
--- a/java/res/values-fr/strings.xml
+++ b/java/res/values-fr/strings.xml
@@ -148,6 +148,6 @@
<string name="subtype_en_GB" msgid="88170601942311355">"Anglais (Royaume-Uni)"</string>
<string name="subtype_en_US" msgid="6160452336634534239">"Anglais (États-Unis)"</string>
<string name="prefs_usability_study_mode" msgid="1261130555134595254">"Mode d\'étude de l\'utilisabilité"</string>
- <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Paramètres de durée du vibreur à chaque touche"</string>
- <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Paramètres de volume du son à chaque touche"</string>
+ <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Paramètres de durée du vibreur à chaque pression de touche"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Paramètres de volume sonore à chaque pression de touche"</string>
</resources>
diff --git a/java/res/values-hr/strings.xml b/java/res/values-hr/strings.xml
index 49e71d16b..30c20b3cc 100644
--- a/java/res/values-hr/strings.xml
+++ b/java/res/values-hr/strings.xml
@@ -148,8 +148,6 @@
<string name="subtype_en_GB" msgid="88170601942311355">"Engleski (UK)"</string>
<string name="subtype_en_US" msgid="6160452336634534239">"Engleski (SAD)"</string>
<string name="prefs_usability_study_mode" msgid="1261130555134595254">"Način studije upotrebljivosti"</string>
- <!-- no translation found for prefs_keypress_vibration_duration_settings (1829950405285211668) -->
- <skip />
- <!-- no translation found for prefs_keypress_sound_volume_settings (5875933757082305040) -->
- <skip />
+ <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Postavke trajanja vibracije kod pritiska tipke"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Postavke glasnoće zvuka kod pritiska tipke"</string>
</resources>
diff --git a/java/res/values-in/strings.xml b/java/res/values-in/strings.xml
index 663ea1ee1..a023b6477 100644
--- a/java/res/values-in/strings.xml
+++ b/java/res/values-in/strings.xml
@@ -148,8 +148,6 @@
<string name="subtype_en_GB" msgid="88170601942311355">"Inggris (Inggris)"</string>
<string name="subtype_en_US" msgid="6160452336634534239">"Inggris (AS)"</string>
<string name="prefs_usability_study_mode" msgid="1261130555134595254">"Modus studi daya guna"</string>
- <!-- no translation found for prefs_keypress_vibration_duration_settings (1829950405285211668) -->
- <skip />
- <!-- no translation found for prefs_keypress_sound_volume_settings (5875933757082305040) -->
- <skip />
+ <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Setelan durasi getaran saat tombol ditekan"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Setelan volume suara saat tombol ditekan"</string>
</resources>
diff --git a/java/res/values-it/strings.xml b/java/res/values-it/strings.xml
index ef9ba04b1..58c0e2c3b 100644
--- a/java/res/values-it/strings.xml
+++ b/java/res/values-it/strings.xml
@@ -114,7 +114,7 @@
<string name="voice_warning_how_to_turn_off" msgid="3190378129944934856">"Per disattivare l\'input vocale, vai alle impostazioni del metodo di input."</string>
<string name="voice_hint_dialog_message" msgid="1420686286820661548">"Per utilizzare l\'input vocale, premi il pulsante del microfono."</string>
<string name="voice_listening" msgid="467518160751321844">"Parla ora"</string>
- <string name="voice_working" msgid="6666937792815731889">"Elaborazione in corso"</string>
+ <string name="voice_working" msgid="6666937792815731889">"Elaborazione..."</string>
<string name="voice_initializing" msgid="661962047129906646"></string>
<string name="voice_error" msgid="5140896300312186162">"Errore. Riprova più tardi."</string>
<string name="voice_network_error" msgid="6649556447401862563">"Impossibile connettersi."</string>
diff --git a/java/res/values-ja/strings.xml b/java/res/values-ja/strings.xml
index 14972854a..57b389580 100644
--- a/java/res/values-ja/strings.xml
+++ b/java/res/values-ja/strings.xml
@@ -148,8 +148,6 @@
<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>
- <!-- no translation found for prefs_keypress_vibration_duration_settings (1829950405285211668) -->
- <skip />
- <!-- no translation found for prefs_keypress_sound_volume_settings (5875933757082305040) -->
- <skip />
+ <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"キー操作バイブの振動時間の設定"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"キー操作音の音量設定"</string>
</resources>
diff --git a/java/res/values-ko/strings.xml b/java/res/values-ko/strings.xml
index 05a4335ae..bc2b6289c 100644
--- a/java/res/values-ko/strings.xml
+++ b/java/res/values-ko/strings.xml
@@ -38,7 +38,7 @@
<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" msgid="4435317977804180815">"주소록 이름 활용"</string>
<string name="use_contacts_dict_summary" msgid="6599983334507879959">"추천 및 수정에 주소록의 이름 사용"</string>
<string name="enable_span_insert" msgid="7204653105667167620">"재수정 가능 설정"</string>
<string name="enable_span_insert_summary" msgid="2947317657871394467">"재수정 추천어 사전 활성화"</string>
@@ -48,15 +48,15 @@
<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_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="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">"Bigram 추천"</string>
<string name="bigram_suggestion_summary" msgid="4383845146070101531">"이전 단어를 사용하여 추천 기능 개선"</string>
<string name="bigram_prediction" msgid="8914273444762259739">"Bigram 예측"</string>
diff --git a/java/res/values-lt/strings.xml b/java/res/values-lt/strings.xml
index 333355382..6263f6706 100644
--- a/java/res/values-lt/strings.xml
+++ b/java/res/values-lt/strings.xml
@@ -148,6 +148,6 @@
<string name="subtype_en_GB" msgid="88170601942311355">"Anglų k. (JK)"</string>
<string name="subtype_en_US" msgid="6160452336634534239">"Anglų k. (JAV)"</string>
<string name="prefs_usability_study_mode" msgid="1261130555134595254">"Tinkamumo tyrimo režimas"</string>
- <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Vibracijos nuspaudus mygtuką trukmės nustatymai"</string>
- <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Garso nuspaudus mygtuką garsumo nustatymai"</string>
+ <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Vibracijos paspaudus mygtuką trukmės nustatymai"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Garso paspaudus mygtuką garsumo nustatymai"</string>
</resources>
diff --git a/java/res/values-ms/strings.xml b/java/res/values-ms/strings.xml
index 498a9a4d8..8a9954175 100644
--- a/java/res/values-ms/strings.xml
+++ b/java/res/values-ms/strings.xml
@@ -148,6 +148,6 @@
<string name="subtype_en_GB" msgid="88170601942311355">"Bahasa Inggeris (UK)"</string>
<string name="subtype_en_US" msgid="6160452336634534239">"Bahasa Inggeris (AS)"</string>
<string name="prefs_usability_study_mode" msgid="1261130555134595254">"Mod kajian kebolehgunaan"</string>
- <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Tekan kunci tetapan tempoh getaran"</string>
- <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Tekan kunci tetapan kelantangan bunyi"</string>
+ <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Tetapan tempoh getaran tekanan kekunci"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Tetapan kelantangan bunyi tekanan kekunci"</string>
</resources>
diff --git a/java/res/values-pl/strings.xml b/java/res/values-pl/strings.xml
index 458d3c3d4..a9a6a76b6 100644
--- a/java/res/values-pl/strings.xml
+++ b/java/res/values-pl/strings.xml
@@ -35,10 +35,10 @@
<string name="misc_category" msgid="6894192814868233453">"Inne opcje"</string>
<string name="advanced_settings" msgid="362895144495591463">"Ustawienia zaawansowane"</string>
<string name="advanced_settings_summary" msgid="5193513161106637254">"Opcje dla zaawansowanych użytkowników"</string>
- <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Opóźnienie wyłączenia wyskakującego okienka"</string>
+ <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Opóźnienie znikania klawiszy"</string>
<string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"Bez opóźnienia"</string>
<string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"Wartość domyślna"</string>
- <string name="use_contacts_dict" msgid="4435317977804180815">"Proponuj nazwiska z kontaktów"</string>
+ <string name="use_contacts_dict" msgid="4435317977804180815">"Proponuj osoby z kontaktów"</string>
<string name="use_contacts_dict_summary" msgid="6599983334507879959">"W propozycjach i poprawkach użyj nazwisk z kontaktów"</string>
<string name="enable_span_insert" msgid="7204653105667167620">"Włącz poprawki"</string>
<string name="enable_span_insert_summary" msgid="2947317657871394467">"Ustaw sugestie poprawek"</string>
@@ -56,7 +56,7 @@
<string name="auto_correction_threshold_mode_off" msgid="8470882665417944026">"Wyłącz"</string>
<string name="auto_correction_threshold_mode_modest" msgid="8788366690620799097">"Umiarkowana"</string>
<string name="auto_correction_threshold_mode_aggeressive" msgid="3524029103734923819">"Agresywna"</string>
- <string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Bardzo agresywnie"</string>
+ <string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Bardzo agresywna"</string>
<string name="bigram_suggestion" msgid="2636414079905220518">"Podpowiadanie dwuznaków"</string>
<string name="bigram_suggestion_summary" msgid="4383845146070101531">"Używaj poprzedniego wyrazu, aby polepszyć sugestię"</string>
<string name="bigram_prediction" msgid="8914273444762259739">"Przewidywanie dwuznaków"</string>
@@ -128,7 +128,7 @@
<string name="voice_punctuation_hint" msgid="1611389463237317754"><b>"Wskazówka:"</b>" następnym razem spróbuj wypowiadać nazwy znaków interpunkcyjnych: „kropka”, „przecinek” lub „pytajnik”."</string>
<string name="cancel" msgid="6830980399865683324">"Anuluj"</string>
<string name="ok" msgid="7898366843681727667">"OK"</string>
- <string name="voice_input" msgid="3583258583521397548">"Klawisz wprowadzania głosowego"</string>
+ <string name="voice_input" msgid="3583258583521397548">"Klawisz rozpoznawania mowy"</string>
<string name="voice_input_modes_main_keyboard" msgid="3360660341121083174">"Na klawiaturze głównej"</string>
<string name="voice_input_modes_symbols_keyboard" msgid="7203213240786084067">"Na klawiaturze z symbolami"</string>
<string name="voice_input_modes_off" msgid="3745699748218082014">"Wyłącz"</string>
@@ -148,6 +148,6 @@
<string name="subtype_en_GB" msgid="88170601942311355">"Angielska (Wielka Brytania)"</string>
<string name="subtype_en_US" msgid="6160452336634534239">"Angielska (Stany Zjednoczone)"</string>
<string name="prefs_usability_study_mode" msgid="1261130555134595254">"Tryb badania przydatności"</string>
- <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Ustawienia czasu trwania wibracji przy naciśnięciu"</string>
- <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Ustawienia głośności dźwięku przy naciśnięciu"</string>
+ <string name="prefs_keypress_vibration_duration_settings" msgid="1829950405285211668">"Czas trwania wibracji przy naciśnięciu"</string>
+ <string name="prefs_keypress_sound_volume_settings" msgid="5875933757082305040">"Głośność dźwięku przy naciśnięciu"</string>
</resources>
diff --git a/java/res/values-ru/strings.xml b/java/res/values-ru/strings.xml
index 9af496bb1..863c8a28c 100644
--- a/java/res/values-ru/strings.xml
+++ b/java/res/values-ru/strings.xml
@@ -139,7 +139,7 @@
<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="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>
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 567537df2..41409ca11 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;
@@ -727,8 +737,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();
@@ -889,6 +898,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)) {
@@ -906,8 +922,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
TextEntryState.reset();
updateSuggestions();
}
- mJustAddedMagicSpace = false; // The user moved the cursor.
- mJustReplacedDoubleSpace = false;
}
mExpectingUpdateSelection = false;
mHandler.postUpdateShiftKeyState();
@@ -1132,25 +1146,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))
@@ -1158,22 +1169,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
+ // "ic" must not be null
private 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) {
@@ -1181,11 +1189,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
}
- private void removeTrailingSpace() {
- final InputConnection ic = getCurrentInputConnection();
+ // "ic" may be null
+ private 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);
@@ -1241,6 +1248,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) {
@@ -1251,11 +1280,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();
@@ -1301,10 +1335,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;
@@ -1326,7 +1361,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;
}
@@ -1336,7 +1371,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();
@@ -1374,15 +1409,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;
}
}
@@ -1432,11 +1476,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;
@@ -1454,6 +1502,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];
@@ -1467,6 +1516,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;
}
}
@@ -1474,7 +1524,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) {
@@ -1492,18 +1541,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();
@@ -1533,21 +1583,45 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
}
- if (mJustAddedMagicSpace) {
+ final boolean swapMagicSpace;
+ 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);
@@ -1560,16 +1634,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();
@@ -1604,7 +1668,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;
@@ -1709,7 +1773,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
@@ -1782,7 +1845,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();
@@ -1812,8 +1874,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
@@ -1821,15 +1883,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();
}
@@ -1853,7 +1908,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();
}
@@ -1873,13 +1928,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.
@@ -2021,13 +2074,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return false;
}
- // "ic" must not null
+ // "ic" must not be null
private 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);
@@ -2061,7 +2114,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
@@ -2076,13 +2129,28 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return true;
}
+ private 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();
}
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/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 8f478f385..095c2c51c 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -61,11 +61,6 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
private static final int CAPITALIZE_ALL = 2; // All caps
private final static String[] EMPTY_STRING_ARRAY = new String[0];
- private final static SuggestionsInfo NOT_IN_DICT_EMPTY_SUGGESTIONS =
- new SuggestionsInfo(0, EMPTY_STRING_ARRAY);
- private final static SuggestionsInfo IN_DICT_EMPTY_SUGGESTIONS =
- new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY,
- EMPTY_STRING_ARRAY);
private final static Flag[] USE_FULL_EDIT_DISTANCE_FLAG_ARRAY;
static {
// See BinaryDictionary.java for an explanation of these flags
@@ -103,6 +98,15 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
return new AndroidSpellCheckerSession(this);
}
+ private static SuggestionsInfo getNotInDictEmptySuggestions() {
+ return new SuggestionsInfo(0, EMPTY_STRING_ARRAY);
+ }
+
+ private static SuggestionsInfo getInDictEmptySuggestions() {
+ return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY,
+ EMPTY_STRING_ARRAY);
+ }
+
private static class SuggestionsGatherer implements WordCallback {
public static class Result {
public final String[] mSuggestions;
@@ -408,9 +412,9 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
DictAndProximity dictInfo = null;
try {
dictInfo = mDictionaryPool.takeOrGetNull();
- if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS;
- return dictInfo.mDictionary.isValidWord(text) ? IN_DICT_EMPTY_SUGGESTIONS
- : NOT_IN_DICT_EMPTY_SUGGESTIONS;
+ if (null == dictInfo) return getNotInDictEmptySuggestions();
+ return dictInfo.mDictionary.isValidWord(text) ? getInDictEmptySuggestions()
+ : getNotInDictEmptySuggestions();
} finally {
if (null != dictInfo) {
if (!mDictionaryPool.offer(dictInfo)) {
@@ -445,7 +449,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
DictAndProximity dictInfo = null;
try {
dictInfo = mDictionaryPool.takeOrGetNull();
- if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS;
+ if (null == dictInfo) return getNotInDictEmptySuggestions();
dictInfo.mDictionary.getWords(composer, suggestionsGatherer,
dictInfo.mProximityInfo);
isInDict = dictInfo.mDictionary.isValidWord(text);
@@ -490,7 +494,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
throw e;
} else {
Log.e(TAG, "Exception while spellcheking: " + e);
- return NOT_IN_DICT_EMPTY_SUGGESTIONS;
+ return getNotInDictEmptySuggestions();
}
}
}