aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/values-pl/strings.xml2
-rw-r--r--java/res/values-rm/strings.xml23
-rw-r--r--java/res/values-ru/strings.xml2
-rw-r--r--java/res/values-xlarge/bools.xml23
-rw-r--r--java/res/values-xlarge/dimens.xml34
-rw-r--r--java/res/values/dimens.xml5
-rw-r--r--java/res/values/strings.xml2
-rw-r--r--java/res/values/styles.xml10
-rw-r--r--java/res/xml-xlarge/kbd_popup_template.xml27
-rw-r--r--java/res/xml-xlarge/kbd_qwerty.xml216
-rw-r--r--java/res/xml-xlarge/kbd_symbols.xml158
-rw-r--r--java/res/xml-xlarge/kbd_symbols_shift.xml158
-rw-r--r--java/res/xml/method.xml111
-rw-r--r--java/res/xml/prefs.xml9
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java16
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboard.java86
-rw-r--r--java/src/com/android/inputmethod/voice/VoiceInput.java16
-rw-r--r--java/src/com/android/inputmethod/voice/VoiceInputLogger.java15
18 files changed, 840 insertions, 73 deletions
diff --git a/java/res/values-pl/strings.xml b/java/res/values-pl/strings.xml
index d10b5c35e..2335858fd 100644
--- a/java/res/values-pl/strings.xml
+++ b/java/res/values-pl/strings.xml
@@ -103,7 +103,7 @@
<string name="voice_audio_error" msgid="5072707727016414454">"Problem z dźwiękiem"</string>
<string name="voice_server_error" msgid="7807129913977261644">"Błąd serwera"</string>
<string name="voice_speech_timeout" msgid="8461817525075498795">"Nie wykryto mowy"</string>
- <string name="voice_no_match" msgid="4285117547030179174">"Brak wyników"</string>
+ <string name="voice_no_match" msgid="4285117547030179174">"Nie znaleziono żadnych wyników"</string>
<string name="voice_not_installed" msgid="5552450909753842415">"Wyszukiwanie głosowe nie jest zainstalowane"</string>
<string name="voice_swipe_hint" msgid="6943546180310682021"><b>"Wskazówka:"</b>" przesuń palcem po klawiaturze, aby mówić."</string>
<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>
diff --git a/java/res/values-rm/strings.xml b/java/res/values-rm/strings.xml
index 91dbf72ff..da7b3a111 100644
--- a/java/res/values-rm/strings.xml
+++ b/java/res/values-rm/strings.xml
@@ -22,6 +22,8 @@
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="english_ime_name" msgid="7252517407088836577">"Tastatura Android"</string>
<string name="english_ime_settings" msgid="6661589557206947774">"Parameters da la tastatura Android"</string>
+ <!-- no translation found for english_ime_input_options (3909945612939668554) -->
+ <skip />
<string name="vibrate_on_keypress" msgid="5258079494276955460">"Vibrar cun smatgar in buttun"</string>
<string name="sound_on_keypress" msgid="6093592297198243644">"Tun cun smatgar in buttun"</string>
<!-- no translation found for popup_on_keypress (123894815723512944) -->
@@ -48,6 +50,17 @@
<string name="show_suggestions_summary" msgid="1989672863935759654">"Mussar pleds proponids durant l\'endataziun"</string>
<string name="auto_complete" msgid="1103196318775486023">"Cumplettaziun automatica"</string>
<string name="auto_complete_summary" msgid="6113149638718274624">"Inserir auto. il pled marcà cun la tasta da vid/interpuncziun"</string>
+ <!-- no translation found for prefs_settings_key (4623341240804046498) -->
+ <skip />
+ <!-- no translation found for settings_key_mode_auto_name (2993460277873684680) -->
+ <skip />
+ <!-- no translation found for settings_key_mode_always_show_name (3047567041784760575) -->
+ <skip />
+ <!-- no translation found for settings_key_mode_always_hide_name (7833948046716923994) -->
+ <skip />
+ <!-- no translation found for settings_key_modes:0 (8549888726962891527) -->
+ <!-- no translation found for settings_key_modes:1 (881280041213210923) -->
+ <!-- no translation found for settings_key_modes:2 (7317310620171067848) -->
<!-- no translation found for bigram_suggestion (1323347224043514969) -->
<skip />
<!-- no translation found for bigram_suggestion_summary (4383845146070101531) -->
@@ -120,6 +133,8 @@
<string name="popular_domain_2" msgid="3036812463748402878">".org"</string>
<string name="popular_domain_3" msgid="8718639560809452028">".gov"</string>
<string name="popular_domain_4" msgid="35359437471311470">".edu"</string>
+ <!-- no translation found for selectInputMethod (315076553378705821) -->
+ <skip />
<string name="language_selection_title" msgid="1651299598555326750">"Linguas da cumonds vocals"</string>
<string name="language_selection_summary" msgid="187110938289512256">"Stritgar cun il det sur la tasta da vid per midar la lingua"</string>
<string name="hint_add_to_dictionary" msgid="8058519710062071085">"← Tippar danovamain per memorisar"</string>
@@ -128,8 +143,14 @@
<skip />
<!-- no translation found for prefs_description_log (5827825607258246003) -->
<skip />
+ <!-- no translation found for prefs_enable_recorrection (4966265843750259377) -->
+ <skip />
+ <!-- no translation found for prefs_enable_recorrection_summary (8181745740388568396) -->
+ <skip />
<!-- no translation found for keyboard_layout (437433231038683666) -->
<skip />
- <!-- no translation found for prefs_debug_mode (3889340783846594980) -->
+ <!-- no translation found for subtype_mode_keyboard (2242090416595003881) -->
+ <skip />
+ <!-- no translation found for subtype_mode_voice (4394113125441627771) -->
<skip />
</resources>
diff --git a/java/res/values-ru/strings.xml b/java/res/values-ru/strings.xml
index 65f9d5f32..98b36ed4d 100644
--- a/java/res/values-ru/strings.xml
+++ b/java/res/values-ru/strings.xml
@@ -61,7 +61,7 @@
<!-- no translation found for settings_key_modes:0 (8549888726962891527) -->
<!-- no translation found for settings_key_modes:1 (881280041213210923) -->
<!-- no translation found for settings_key_modes:2 (7317310620171067848) -->
- <string name="bigram_suggestion" msgid="1323347224043514969">"Биграммные подсказки"</string>
+ <string name="bigram_suggestion" msgid="1323347224043514969">"Биграммные подсказки "</string>
<string name="bigram_suggestion_summary" msgid="4383845146070101531">"Используйте предыдущее слово, чтобы исправить подсказку"</string>
<string-array name="prediction_modes">
<item msgid="4870266572388153286">"Нет"</item>
diff --git a/java/res/values-xlarge/bools.xml b/java/res/values-xlarge/bools.xml
new file mode 100644
index 000000000..fe8fc5838
--- /dev/null
+++ b/java/res/values-xlarge/bools.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, 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>
+ <!-- Whether or not Popup on key press is enabled by default -->
+ <bool name="default_popup_preview">false</bool>
+</resources>
diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml
new file mode 100644
index 000000000..9e4736f78
--- /dev/null
+++ b/java/res/values-xlarge/dimens.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, 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>
+ <dimen name="key_height">72dip</dimen>
+ <dimen name="candidate_strip_height">46dip</dimen>
+ <dimen name="spacebar_vertical_correction">0dip</dimen>
+ <dimen name="key_text_size">28sp</dimen>
+ <dimen name="key_label_text_size">16sp</dimen>
+ <dimen name="key_preview_height">40dip</dimen>
+ <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
+ <!-- key_height x 1.7 -->
+ <dimen name="mini_keyboard_slide_allowance">122.4dip</dimen>
+ <!-- -key_height x 1.0 -->
+ <dimen name="mini_keyboard_vertical_correction">-72dip</dimen>
+ <dimen name="keyboard_vertical_correction">0dip</dimen>
+</resources>
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index f83fc36a6..de2e69973 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -28,10 +28,15 @@
will not go into extract (fullscreen) mode. -->
<dimen name="max_height_for_fullscreen">2.5in</dimen>
<dimen name="key_text_size">22sp</dimen>
+ <dimen name="key_label_text_size">14sp</dimen>
+ <dimen name="key_preview_offset">0dip</dimen>
+ <dimen name="key_preview_height">80dip</dimen>
<!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
<!-- key_height x 1.7 -->
<dimen name="mini_keyboard_slide_allowance">91.8dip</dimen>
<!-- -key_height x 1.0 -->
<dimen name="mini_keyboard_vertical_correction">-54dip</dimen>
+ <dimen name="key_hysteresis_distance">0.05in</dimen>
+ <dimen name="keyboard_vertical_correction">-10dip</dimen>
<dimen name="candidate_min_touchable_width">0.3in</dimen>
</resources>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 17921ff33..a4ebe4650 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -31,7 +31,7 @@
<!-- Option to play back sound on keypress in soft keyboard -->
<string name="sound_on_keypress">Sound on keypress</string>
- <!-- Option to pop up the character with a larger font above soft keyboard -->
+ <!-- Option to control whether or not to show a popup with a larger font on each key press. -->
<string name="popup_on_keypress">Popup on keypress</string>
<!-- Option to enable using nearby keys when correcting/predicting -->
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index 5e239482f..0372b07cf 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -22,12 +22,12 @@
<item name="keyTextSize">@dimen/key_text_size</item>
<item name="keyTextColor">#FFFFFFFF</item>
<item name="keyPreviewLayout">@layout/key_preview</item>
- <item name="keyPreviewOffset">0dip</item>
- <item name="keyPreviewHeight">80dip</item>
- <item name="labelTextSize">14sp</item>
+ <item name="keyPreviewOffset">@dimen/key_preview_offset</item>
+ <item name="keyPreviewHeight">@dimen/key_preview_height</item>
+ <item name="labelTextSize">@dimen/key_label_text_size</item>
<item name="popupLayout">@layout/keyboard_popup</item>
- <item name="keyHysteresisDistance">0.05in</item>
- <item name="verticalCorrection">-10dip</item>
+ <item name="keyHysteresisDistance">@dimen/key_hysteresis_distance</item>
+ <item name="verticalCorrection">@dimen/keyboard_vertical_correction</item>
<item name="shadowColor">#BB000000</item>
<item name="shadowRadius">2.75</item>
<item name="backgroundDimAmount">0.5</item>
diff --git a/java/res/xml-xlarge/kbd_popup_template.xml b/java/res/xml-xlarge/kbd_popup_template.xml
new file mode 100644
index 000000000..0e67a18d4
--- /dev/null
+++ b/java/res/xml-xlarge/kbd_popup_template.xml
@@ -0,0 +1,27 @@
+<?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.
+*/
+-->
+
+<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
+ android:keyWidth="7.5%p"
+ android:horizontalGap="0px"
+ android:verticalGap="0px"
+ android:keyHeight="@dimen/key_height"
+ >
+</Keyboard>
diff --git a/java/res/xml-xlarge/kbd_qwerty.xml b/java/res/xml-xlarge/kbd_qwerty.xml
new file mode 100644
index 000000000..80fb8884e
--- /dev/null
+++ b/java/res/xml-xlarge/kbd_qwerty.xml
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, 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.
+*/
+-->
+
+<Keyboard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:keyWidth="7.5%p"
+ android:horizontalGap="0px"
+ android:verticalGap="0px"
+ android:keyHeight="@dimen/key_height"
+>
+ <Row>
+ <!-- This row is intentionally not marked as a top row -->
+ <Key
+ android:codes="@integer/key_tab"
+ android:keyLabel="Tab"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="q"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_q" />
+ <Key
+ android:keyLabel="w"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_w" />
+ <Key
+ android:keyLabel="e"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_e" />
+ <Key
+ android:keyLabel="r"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_r" />
+ <Key
+ android:keyLabel="t"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_t" />
+ <Key
+ android:keyLabel="y"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_y" />
+ <Key
+ android:keyLabel="u"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_u" />
+ <Key
+ android:keyLabel="i"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_i" />
+ <Key
+ android:keyLabel="o"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_o" />
+ <Key
+ android:keyLabel="p"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_p" />
+ <Key
+ android:keyLabel="="
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="+" />
+ <Key
+ android:codes="@integer/key_delete"
+ android:keyIcon="@drawable/sym_keyboard_delete"
+ android:iconPreview="@drawable/sym_keyboard_feedback_delete"
+ android:keyWidth="10.5%p"
+ android:isModifier="true"
+ android:isRepeatable="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_symbol"
+ android:keyLabel="@string/label_symbol_key"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="a"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_a" />
+ <Key
+ android:keyLabel="s"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_s" />
+ <Key
+ android:keyLabel="d"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_d" />
+ <Key
+ android:keyLabel="f" />
+ <Key
+ android:keyLabel="g"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_g" />
+ <Key
+ android:keyLabel="h" />
+ <Key
+ android:keyLabel="j" />
+ <Key
+ android:keyLabel="k" />
+ <Key
+ android:keyLabel="l"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_l" />
+ <Key
+ android:keyLabel=";"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters=":" />
+ <Key
+ android:keyLabel="\'"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="&quot;" />
+ <Key
+ android:codes="@integer/key_return"
+ android:keyIcon="@drawable/sym_keyboard_return"
+ android:iconPreview="@drawable/sym_keyboard_feedback_return"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="z"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_z" />
+ <Key
+ android:keyLabel="x" />
+ <Key
+ android:keyLabel="c"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_c" />
+ <Key
+ android:keyLabel="v"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_v" />
+ <Key
+ android:keyLabel="b" />
+ <Key
+ android:keyLabel="n"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_n" />
+ <Key
+ android:keyLabel="m" />
+ <Key
+ android:keyLabel=","
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="*" />
+ <Key
+ android:keyLabel="."
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="!" />
+ <Key
+ android:keyLabel="/"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="\?" />
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <!-- This row is intentionally not marked as a bottom row -->
+ <Key
+ android:keyLabel="("
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="&lt;"
+ android:horizontalGap="16.25%p" />
+ <Key
+ android:keyLabel=")"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="&gt;" />
+ <Key
+ android:codes="@integer/key_space"
+ android:keyIcon="@drawable/sym_keyboard_space"
+ android:iconPreview="@drawable/sym_keyboard_feedback_space"
+ android:keyWidth="37.5%p"
+ android:isModifier="true" />
+ <Key
+ android:keyLabel="_"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="\@" />
+ <Key
+ android:keyLabel="-"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="#" />
+ </Row>
+</Keyboard>
diff --git a/java/res/xml-xlarge/kbd_symbols.xml b/java/res/xml-xlarge/kbd_symbols.xml
new file mode 100644
index 000000000..462672623
--- /dev/null
+++ b/java/res/xml-xlarge/kbd_symbols.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, 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.
+*/
+-->
+
+<Keyboard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:keyWidth="7.5%p"
+ android:horizontalGap="0px"
+ android:verticalGap="0px"
+ android:keyHeight="@dimen/key_height"
+>
+ <Row>
+ <!-- This row is intentionally not marked as a top row -->
+ <Key
+ android:codes="@integer/key_tab"
+ android:keyLabel="Tab"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="1" />
+ <Key
+ android:keyLabel="2" />
+ <Key
+ android:keyLabel="3" />
+ <Key
+ android:keyLabel="4" />
+ <Key
+ android:keyLabel="5" />
+ <Key
+ android:keyLabel="6" />
+ <Key
+ android:keyLabel="7" />
+ <Key
+ android:keyLabel="8" />
+ <Key
+ android:keyLabel="9" />
+ <Key
+ android:keyLabel="0" />
+ <Key
+ android:keyLabel="~" />
+ <Key
+ android:codes="@integer/key_delete"
+ android:keyIcon="@drawable/sym_keyboard_delete"
+ android:iconPreview="@drawable/sym_keyboard_feedback_delete"
+ android:keyWidth="10.5%p"
+ android:isModifier="true"
+ android:isRepeatable="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_symbol"
+ android:keyLabel="@string/label_alpha_key"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="\@" />
+ <Key
+ android:keyLabel="#" />
+ <Key
+ android:keyLabel="$" />
+ <Key
+ android:keyLabel="%" />
+ <Key
+ android:keyLabel="^" />
+ <Key
+ android:keyLabel="&amp;" />
+ <Key
+ android:keyLabel="*" />
+ <Key
+ android:keyLabel="-" />
+ <Key
+ android:keyLabel="+" />
+ <Key
+ android:keyLabel="(" />
+ <Key
+ android:keyLabel=")" />
+ <Key
+ android:codes="@integer/key_return"
+ android:keyIcon="@drawable/sym_keyboard_return"
+ android:iconPreview="@drawable/sym_keyboard_feedback_return"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="!" />
+ <Key
+ android:keyLabel="&quot;" />
+ <Key
+ android:keyLabel="\'" />
+ <Key
+ android:keyLabel=":" />
+ <Key
+ android:keyLabel=";" />
+ <Key
+ android:keyLabel="/" />
+ <Key
+ android:keyLabel="\\" />
+ <Key
+ android:keyLabel="," />
+ <Key
+ android:keyLabel="." />
+ <Key
+ android:keyLabel="\?" />
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <!-- This row is intentionally not marked as a bottom row -->
+ <Key
+ android:keyLabel="&lt;"
+ android:horizontalGap="16.25%p" />
+ <Key
+ android:keyLabel="&gt;" />
+ <Key
+ android:codes="@integer/key_space"
+ android:keyIcon="@drawable/sym_keyboard_space"
+ android:iconPreview="@drawable/sym_keyboard_feedback_space"
+ android:keyWidth="37.5%p"
+ android:isModifier="true" />
+ <Key
+ android:keyLabel="[" />
+ <Key
+ android:keyLabel="]" />
+ </Row>
+</Keyboard>
diff --git a/java/res/xml-xlarge/kbd_symbols_shift.xml b/java/res/xml-xlarge/kbd_symbols_shift.xml
new file mode 100644
index 000000000..f02174a91
--- /dev/null
+++ b/java/res/xml-xlarge/kbd_symbols_shift.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, 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.
+*/
+-->
+
+<Keyboard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:keyWidth="7.5%p"
+ android:horizontalGap="0px"
+ android:verticalGap="0px"
+ android:keyHeight="@dimen/key_height"
+>
+ <Row>
+ <!-- This row is intentionally not marked as a top row -->
+ <Key
+ android:codes="@integer/key_tab"
+ android:keyLabel="Tab"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="∞" />
+ <Key
+ android:keyLabel="±" />
+ <Key
+ android:keyLabel="|" />
+ <Key
+ android:keyLabel="•" />
+ <Key
+ android:keyLabel="√" />
+ <Key
+ android:keyLabel="π" />
+ <Key
+ android:keyLabel="÷" />
+ <Key
+ android:keyLabel="×" />
+ <Key
+ android:keyLabel="±" />
+ <Key
+ android:keyLabel="∆" />
+ <Key
+ android:keyLabel="≈" />
+ <Key
+ android:codes="@integer/key_delete"
+ android:keyIcon="@drawable/sym_keyboard_delete"
+ android:iconPreview="@drawable/sym_keyboard_feedback_delete"
+ android:keyWidth="10.5%p"
+ android:isModifier="true"
+ android:isRepeatable="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_symbol"
+ android:keyLabel="@string/label_alpha_key"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="£" />
+ <Key
+ android:keyLabel="¢" />
+ <Key
+ android:keyLabel="¥" />
+ <Key
+ android:keyLabel="€" />
+ <Key
+ android:keyLabel="¼" />
+ <Key
+ android:keyLabel="½" />
+ <Key
+ android:keyLabel="¾" />
+ <Key
+ android:keyLabel="_" />
+ <Key
+ android:keyLabel="=" />
+ <Key
+ android:keyLabel="{" />
+ <Key
+ android:keyLabel="}" />
+ <Key
+ android:codes="@integer/key_return"
+ android:keyIcon="@drawable/sym_keyboard_return"
+ android:iconPreview="@drawable/sym_keyboard_feedback_return"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="¡" />
+ <Key
+ android:keyLabel="°" />
+ <Key
+ android:keyLabel="©" />
+ <Key
+ android:keyLabel="®" />
+ <Key
+ android:keyLabel="¶" />
+ <Key
+ android:keyLabel="§" />
+ <Key
+ android:keyLabel="¤" />
+ <Key
+ android:keyLabel="¬" />
+ <Key
+ android:keyLabel="…" />
+ <Key
+ android:keyLabel="¿" />
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <!-- This row is intentionally not marked as a bottom row -->
+ <Key
+ android:keyLabel="≤"
+ android:horizontalGap="16.25%p" />
+ <Key
+ android:keyLabel="≥" />
+ <Key
+ android:codes="@integer/key_space"
+ android:keyIcon="@drawable/sym_keyboard_space"
+ android:iconPreview="@drawable/sym_keyboard_feedback_space"
+ android:keyWidth="37.5%p"
+ android:isModifier="true" />
+ <Key
+ android:keyLabel="²" />
+ <Key
+ android:keyLabel="³" />
+ </Row>
+</Keyboard>
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index e5654e96d..fab4bd72b 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -20,7 +20,114 @@
<!-- The attributes in this XML file provide configuration information -->
<!-- for the Input Method Manager. -->
+<!-- cs, da, de, en, es, fr, it, iw, nb, nl, ru, sr, sv -->
+<!-- TODO: use <lang>_keyboard icon instead of a common keyboard icon. -->
+<!-- TODO: use <lang>_mic icon instead of a common mic icon. -->
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.android.inputmethod.latin.LatinIMESettings"
- android:isDefault="@bool/im_is_default"
-/>
+ android:isDefault="@bool/im_is_default">
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="cs"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="da"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="de"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="en"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="es"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="fr"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="it"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="iw"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="nb"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="nl"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="ru"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="sr"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:imeSubtypeLocale="sv"
+ android:imeSubtypeMode="@string/subtype_mode_keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="cs"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="da"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="de"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="en"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="es"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="fr"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="it"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="iw"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="nb"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="nl"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="ru"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="sr"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+ <subtype android:icon="@drawable/ic_subtype_mic"
+ android:imeSubtypeLocale="sv"
+ android:imeSubtypeMode="@string/subtype_mode_voice"
+ />
+</input-method>
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index 7bcf19334..8a971092f 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -105,6 +105,15 @@
android:defaultValue="@bool/enable_autocorrect"
android:dependency="show_suggestions"
/>
+
+ <CheckBoxPreference
+ android:key="bigram_suggestion"
+ android:title="@string/bigram_suggestion"
+ android:summary="@string/bigram_suggestion_summary"
+ android:persistent="true"
+ android:defaultValue="true"
+ android:dependency="auto_complete"
+ />
</PreferenceCategory>
</PreferenceScreen>
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index fb9c47db2..692183dbf 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -96,7 +96,7 @@ public class LatinIME extends InputMethodService
private static final String PREF_QUICK_FIXES = "quick_fixes";
private static final String PREF_SHOW_SUGGESTIONS = "show_suggestions";
private static final String PREF_AUTO_COMPLETE = "auto_complete";
- //private static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion";
+ private static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion";
private static final String PREF_VOICE_MODE = "voice_mode";
// Whether or not the user has used voice input before (and thus, whether to show the
@@ -192,8 +192,7 @@ public class LatinIME extends InputMethodService
private boolean mJustAddedAutoSpace;
private boolean mAutoCorrectEnabled;
private boolean mReCorrectionEnabled;
- // Bigram Suggestion is disabled in this version.
- private final boolean mBigramSuggestionEnabled = false;
+ private boolean mBigramSuggestionEnabled;
private boolean mAutoCorrectOn;
// TODO move this state variable outside LatinIME
private boolean mCapsLock;
@@ -1849,13 +1848,13 @@ public class LatinIME extends InputMethodService
}
public void pickSuggestionManually(int index, CharSequence suggestion) {
- if (mAfterVoiceInput && mShowingVoiceSuggestions) mVoiceInput.logNBestChoose(index);
List<CharSequence> suggestions = mCandidateView.getSuggestions();
-
- if (mAfterVoiceInput && !mShowingVoiceSuggestions) {
+ if (mAfterVoiceInput && mShowingVoiceSuggestions) {
mVoiceInput.flushAllTextModificationCounters();
// send this intent AFTER logging any prior aggregated edits.
- mVoiceInput.logTextModifiedByChooseSuggestion(suggestion.length());
+ mVoiceInput.logTextModifiedByChooseSuggestion(suggestion.toString(), index,
+ mWordSeparators,
+ getCurrentInputConnection());
}
final boolean correcting = TextEntryState.isCorrecting();
@@ -2487,8 +2486,7 @@ public class LatinIME extends InputMethodService
}
mAutoCorrectEnabled = sp.getBoolean(PREF_AUTO_COMPLETE,
mResources.getBoolean(R.bool.enable_autocorrect)) & mShowSuggestions;
- //mBigramSuggestionEnabled = sp.getBoolean(
- // PREF_BIGRAM_SUGGESTIONS, true) & mShowSuggestions;
+ mBigramSuggestionEnabled = sp.getBoolean(PREF_BIGRAM_SUGGESTIONS, true) & mShowSuggestions;
updateCorrectionMode();
updateAutoTextEnabled(mResources.getConfiguration().locale);
mLanguageSwitcher.loadLocales(sp);
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
index 14a503bc3..76b90f8f3 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
@@ -36,6 +36,8 @@ import android.util.Log;
import android.view.ViewConfiguration;
import android.view.inputmethod.EditorInfo;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Locale;
@@ -48,7 +50,7 @@ public class LatinKeyboard extends Keyboard {
private Drawable mShiftLockIcon;
private Drawable mShiftLockPreviewIcon;
- private Drawable mOldShiftIcon;
+ private final HashMap<Key, Drawable> mOldShiftIcons = new HashMap<Key, Drawable>();
private Drawable mSpaceIcon;
private Drawable mSpaceAutoCompletionIndicator;
private Drawable mSpacePreviewIcon;
@@ -58,7 +60,7 @@ public class LatinKeyboard extends Keyboard {
private Drawable m123MicPreviewIcon;
private final Drawable mButtonArrowLeftIcon;
private final Drawable mButtonArrowRightIcon;
- private Key mShiftKey;
+ private ArrayList<Key> mShiftKeys;
private Key mEnterKey;
private Key mF1Key;
private Key mSpaceKey;
@@ -156,9 +158,22 @@ public class LatinKeyboard extends Keyboard {
mNumberHintIcons[9] = res.getDrawable(R.drawable.keyboard_hint_9);
}
+ // TODO: delete this method and do initialization in constructor.
+ private void initializeMemberVariablesAsNeeded() {
+ if (mNumberHintKeys == null)
+ mNumberHintKeys = new Key[NUMBER_HINT_COUNT];
+ if (mShiftKeys == null)
+ mShiftKeys = new ArrayList<Key>();
+ }
+
@Override
protected Key createKeyFromXml(Resources res, Row parent, int x, int y,
XmlResourceParser parser) {
+ // TODO: This initialization is needed because this protected method is being called from
+ // the base class constructor before this class constructor gets called. We need to fix
+ // this.
+ initializeMemberVariablesAsNeeded();
+
Key key = new LatinKey(res, parent, x, y, parser);
switch (key.codes[0]) {
case LatinIME.KEYCODE_ENTER:
@@ -170,6 +185,9 @@ public class LatinKeyboard extends Keyboard {
case LatinIME.KEYCODE_SPACE:
mSpaceKey = key;
break;
+ case KEYCODE_SHIFT:
+ mShiftKeys.add(key);
+ break;
case KEYCODE_MODE_CHANGE:
m123Key = key;
m123Label = key.label;
@@ -177,11 +195,6 @@ public class LatinKeyboard extends Keyboard {
}
// For number hints on the upper-right corner of key
- if (mNumberHintKeys == null) {
- // NOTE: This protected method is being called from the base class constructor before
- // mNumberHintKeys gets initialized.
- mNumberHintKeys = new Key[NUMBER_HINT_COUNT];
- }
int hintNumber = -1;
if (LatinKeyboardBaseView.isNumberAtLeftmostPopupChar(key)) {
hintNumber = key.popupCharacters.charAt(0) - '0';
@@ -195,7 +208,7 @@ public class LatinKeyboard extends Keyboard {
return key;
}
- void setImeOptions(Resources res, int mode, int options) {
+ public void setImeOptions(Resources res, int mode, int options) {
if (mEnterKey != null) {
// Reset some of the rarely used attributes.
mEnterKey.popupCharacters = null;
@@ -253,61 +266,56 @@ public class LatinKeyboard extends Keyboard {
}
}
}
-
- void enableShiftLock() {
- int index = getShiftKeyIndex();
- if (index >= 0) {
- mShiftKey = getKeys().get(index);
- if (mShiftKey instanceof LatinKey) {
- ((LatinKey)mShiftKey).enableShiftLock();
+
+ public void enableShiftLock() {
+ for (final Key key : mShiftKeys) {
+ if (key instanceof LatinKey) {
+ ((LatinKey)key).enableShiftLock();
}
- mOldShiftIcon = mShiftKey.icon;
+ mOldShiftIcons.put(key, key.icon);
}
}
- void setShiftLocked(boolean shiftLocked) {
- if (mShiftKey != null) {
- if (shiftLocked) {
- mShiftKey.on = true;
- mShiftKey.icon = mShiftLockIcon;
- mShiftState = SHIFT_LOCKED;
- } else {
- mShiftKey.on = false;
- mShiftKey.icon = mShiftLockIcon;
- mShiftState = SHIFT_ON;
- }
+ public void setShiftLocked(boolean shiftLocked) {
+ for (final Key key : mShiftKeys) {
+ key.on = shiftLocked;
+ key.icon = mShiftLockIcon;
}
+ mShiftState = shiftLocked ? SHIFT_LOCKED : SHIFT_ON;
}
- boolean isShiftLocked() {
+ public boolean isShiftLocked() {
return mShiftState == SHIFT_LOCKED;
}
@Override
public boolean setShifted(boolean shiftState) {
boolean shiftChanged = false;
- if (mShiftKey != null) {
+ if (mShiftKeys.size() > 0) {
+ for (final Key key : mShiftKeys) {
+ if (shiftState == false) {
+ key.on = false;
+ key.icon = mOldShiftIcons.get(key);
+ } else if (mShiftState == SHIFT_OFF) {
+ key.icon = mShiftLockIcon;
+ }
+ }
if (shiftState == false) {
shiftChanged = mShiftState != SHIFT_OFF;
mShiftState = SHIFT_OFF;
- mShiftKey.on = false;
- mShiftKey.icon = mOldShiftIcon;
- } else {
- if (mShiftState == SHIFT_OFF) {
- shiftChanged = mShiftState == SHIFT_OFF;
- mShiftState = SHIFT_ON;
- mShiftKey.icon = mShiftLockIcon;
- }
+ } else if (mShiftState == SHIFT_OFF) {
+ shiftChanged = mShiftState == SHIFT_OFF;
+ mShiftState = SHIFT_ON;
}
+ return shiftChanged;
} else {
return super.setShifted(shiftState);
}
- return shiftChanged;
}
@Override
public boolean isShifted() {
- if (mShiftKey != null) {
+ if (mShiftKeys.size() > 0) {
return mShiftState != SHIFT_OFF;
} else {
return super.isShifted();
diff --git a/java/src/com/android/inputmethod/voice/VoiceInput.java b/java/src/com/android/inputmethod/voice/VoiceInput.java
index f24c180d0..4c54dd3c5 100644
--- a/java/src/com/android/inputmethod/voice/VoiceInput.java
+++ b/java/src/com/android/inputmethod/voice/VoiceInput.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.voice;
+import com.android.inputmethod.latin.EditingUtil;
import com.android.inputmethod.latin.R;
import android.content.ContentResolver;
@@ -30,6 +31,7 @@ import android.speech.RecognitionListener;
import android.speech.SpeechRecognizer;
import android.speech.RecognizerIntent;
import android.util.Log;
+import android.view.inputmethod.InputConnection;
import android.view.View;
import android.view.View.OnClickListener;
@@ -423,8 +425,14 @@ public class VoiceInput implements OnClickListener {
mLogger.textModifiedByTypingDeletion(length);
}
- public void logTextModifiedByChooseSuggestion(int length) {
- mLogger.textModifiedByChooseSuggestion(length);
+ public void logTextModifiedByChooseSuggestion(String suggestion, int index,
+ String wordSeparators, InputConnection ic) {
+ EditingUtil.Range range = new EditingUtil.Range();
+ String wordToBeReplaced = EditingUtil.getWordAtCursor(ic, wordSeparators, range);
+ // If we enable phrase-based alternatives, only send up the first word
+ // in suggestion and wordToBeReplaced.
+ mLogger.textModifiedByChooseSuggestion(suggestion.length(), wordToBeReplaced.length(),
+ index, wordToBeReplaced, suggestion);
}
public void logKeyboardWarningDialogShown() {
@@ -455,10 +463,6 @@ public class VoiceInput implements OnClickListener {
mLogger.voiceInputDelivered(length);
}
- public void logNBestChoose(int index) {
- mLogger.nBestChoose(index);
- }
-
public void logInputEnded() {
mLogger.inputEnded();
}
diff --git a/java/src/com/android/inputmethod/voice/VoiceInputLogger.java b/java/src/com/android/inputmethod/voice/VoiceInputLogger.java
index 9d3a92037..4d50f5ee8 100644
--- a/java/src/com/android/inputmethod/voice/VoiceInputLogger.java
+++ b/java/src/com/android/inputmethod/voice/VoiceInputLogger.java
@@ -178,20 +178,19 @@ public class VoiceInputLogger {
mContext.sendBroadcast(i);
}
- public void textModifiedByChooseSuggestion(int length) {
+ public void textModifiedByChooseSuggestion(int suggestionLength, int replacedPhraseLength,
+ int index, String before, String after) {
Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.TEXT_MODIFIED);
- i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH, length);
+ i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH, suggestionLength);
+ i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_REPLACED_LENGTH, replacedPhraseLength);
i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_TYPE,
LoggingEvents.VoiceIme.TEXT_MODIFIED_TYPE_CHOOSE_SUGGESTION);
- mContext.sendBroadcast(i);
- }
-
- public void nBestChoose(int index) {
- Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.N_BEST_CHOOSE);
i.putExtra(LoggingEvents.VoiceIme.EXTRA_N_BEST_CHOOSE_INDEX, index);
+ i.putExtra(LoggingEvents.VoiceIme.EXTRA_BEFORE_N_BEST_CHOOSE, before);
+ i.putExtra(LoggingEvents.VoiceIme.EXTRA_AFTER_N_BEST_CHOOSE, after);
mContext.sendBroadcast(i);
}
-
+
public void inputEnded() {
mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.INPUT_ENDED));
}