diff --git a/res/values/strings.xml b/res/values/strings.xml index 90cd6d42919865d7e62ac14b00ac40d50d13b38c..85de32207b683696a990f58e758d88ceae846500 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -252,6 +252,12 @@ <!-- Preferences item for enabling speech input --> <string name="enable_voice">Voice input</string> + <!-- Preferences item for speech icon on primary keyboard --> + <string name="voice_on_primary">Mic on primary</string> + + <!-- Preferences item summary for speech icon on primary keyboard --> + <string name="voice_on_primary_summary">Show the microphone on the primary keyboard</string> + <!-- Press the "enter" key after the user speaks. Option on settings.--> <string name="auto_submit">Auto submit after voice</string> diff --git a/res/xml-de/kbd_qwerty.xml b/res/xml-de/kbd_qwerty.xml index 9e2f5841dd48679aede00f129532c1720a128fdf..4e57c6067e888660fd3f75c1f0d6791ecfce8275 100755 --- a/res/xml-de/kbd_qwerty.xml +++ b/res/xml-de/kbd_qwerty.xml @@ -100,7 +100,7 @@ android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="_" android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_globe" + <Key android:codes="@integer/key_f1" android:keyWidth="10%p"/> <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" android:iconPreview="@drawable/sym_keyboard_feedback_space" @@ -112,24 +112,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_normal_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" - android:iconPreview="@drawable/sym_keyboard_feedback_mic" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="40%p" android:isRepeatable="true"/> - <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_url" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -150,26 +132,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_url_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:keyLabel="/" android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:keyLabel="@string/popular_domain_0" - android:keyOutputText="@string/popular_domain_0" - android:popupKeyboard="@xml/popup_domains" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_email" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -189,25 +151,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_email_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:keyLabel="\@"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:keyLabel="@string/popular_domain_0" - android:keyOutputText="@string/popular_domain_0" - android:popupKeyboard="@xml/popup_domains" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_im" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -225,24 +168,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_im_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" - android:iconPreview="@drawable/sym_keyboard_feedback_mic" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="40%p" android:isRepeatable="true"/> - <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:keyLabel=":-)" android:keyOutputText=":-) " - android:popupKeyboard="@xml/popup_smileys" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_webentry" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -261,24 +186,4 @@ android:iconPreview="@drawable/sym_keyboard_feedback_return" android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - - <Row android:keyboardMode="@+id/mode_webentry_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" - android:iconPreview="@drawable/sym_keyboard_feedback_mic" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:codes="9" android:keyIcon="@drawable/sym_keyboard_tab" - android:iconPreview="@drawable/sym_keyboard_feedback_tab" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> </Keyboard> diff --git a/res/xml-fr/kbd_qwerty.xml b/res/xml-fr/kbd_qwerty.xml index 7abe18eb23e9f160210756104065c25ef13eed20..1b20c043899603d2a38a4b351ac103e5c509ead1 100644 --- a/res/xml-fr/kbd_qwerty.xml +++ b/res/xml-fr/kbd_qwerty.xml @@ -114,24 +114,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_normal_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" - android:iconPreview="@drawable/sym_keyboard_feedback_mic" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="40%p" android:isRepeatable="true"/> - <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_url" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -152,26 +134,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_url_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:keyLabel="/" android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:keyLabel="@string/popular_domain_0" - android:keyOutputText="@string/popular_domain_0" - android:popupKeyboard="@xml/popup_domains" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_email" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -191,25 +153,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_email_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:keyLabel="\@"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:keyLabel="@string/popular_domain_0" - android:keyOutputText="@string/popular_domain_0" - android:popupKeyboard="@xml/popup_domains" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_im" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -227,24 +170,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_im_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" - android:iconPreview="@drawable/sym_keyboard_feedback_mic" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="40%p" android:isRepeatable="true"/> - <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:keyLabel=":-)" android:keyOutputText=":-) " - android:popupKeyboard="@xml/popup_smileys" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_webentry" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -264,25 +189,5 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_webentry_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" - android:iconPreview="@drawable/sym_keyboard_feedback_mic" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:codes="9" android:keyIcon="@drawable/sym_keyboard_tab" - android:iconPreview="@drawable/sym_keyboard_feedback_tab" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - </Keyboard> diff --git a/res/xml-ru/kbd_qwerty.xml b/res/xml-ru/kbd_qwerty.xml index 8a3a59229d9d4d87c2fc106f7cc95c7352af547d..45d355b0f062e274dd40ccd181ad59263bb8f2c7 100755 --- a/res/xml-ru/kbd_qwerty.xml +++ b/res/xml-ru/kbd_qwerty.xml @@ -96,24 +96,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_normal_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" - android:iconPreview="@drawable/sym_keyboard_feedback_mic" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="40%p" android:isRepeatable="true"/> - <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_url" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -134,26 +116,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_url_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:keyLabel="/" android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:keyLabel="@string/popular_domain_0" - android:keyOutputText="@string/popular_domain_0" - android:popupKeyboard="@xml/popup_domains" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_email" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -173,25 +135,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_email_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:keyLabel="\@" android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:keyLabel="@string/popular_domain_0" - android:keyOutputText="@string/popular_domain_0" - android:popupKeyboard="@xml/popup_domains" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_im" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -209,24 +152,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_im_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" - android:iconPreview="@drawable/sym_keyboard_feedback_mic" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="40%p" android:isRepeatable="true"/> - <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:keyLabel=":-)" android:keyOutputText=":-) " - android:popupKeyboard="@xml/popup_smileys" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_webentry" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -245,26 +170,5 @@ android:iconPreview="@drawable/sym_keyboard_feedback_return" android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - - <Row android:keyboardMode="@+id/mode_webentry_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" - android:iconPreview="@drawable/sym_keyboard_feedback_mic" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:codes="9" android:keyIcon="@drawable/sym_keyboard_tab" - android:iconPreview="@drawable/sym_keyboard_feedback_tab" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - </Keyboard> diff --git a/res/xml/kbd_qwerty.xml b/res/xml/kbd_qwerty.xml index e0fe5cdc325992f648efddf37fccd45efd948ea9..4aa476136b1afac19b786fa6c3e104d7010f6210 100755 --- a/res/xml/kbd_qwerty.xml +++ b/res/xml/kbd_qwerty.xml @@ -111,7 +111,8 @@ android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="_" android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_globe" + <Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_mic" + android:iconPreview="@drawable/sym_keyboard_feedback_mic" android:keyWidth="10%p"/> <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" android:iconPreview="@drawable/sym_keyboard_feedback_space" @@ -123,24 +124,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_normal_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" - android:iconPreview="@drawable/sym_keyboard_feedback_mic" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="40%p" android:isRepeatable="true"/> - <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_url" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -161,26 +144,6 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_url_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:keyLabel="/" android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:keyLabel="@string/popular_domain_0" - android:keyOutputText="@string/popular_domain_0" - android:popupKeyboard="@xml/popup_domains" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_email" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" @@ -200,48 +163,12 @@ android:keyWidth="20%p" android:keyEdgeFlags="right"/> </Row> - <Row android:keyboardMode="@+id/mode_email_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:keyLabel="\@"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:keyLabel="@string/popular_domain_0" - android:keyOutputText="@string/popular_domain_0" - android:popupKeyboard="@xml/popup_domains" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - <Row android:keyboardMode="@+id/mode_im" android:rowEdgeFlags="bottom"> <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="_" android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_globe" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="40%p" android:isRepeatable="true"/> - <Key android:codes="46" android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation" - android:keyWidth="10%p"/> - <Key android:keyLabel=":-)" android:keyOutputText=":-) " - android:popupKeyboard="@xml/popup_smileys" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - - <Row android:keyboardMode="@+id/mode_im_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" + <Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_mic" android:iconPreview="@drawable/sym_keyboard_feedback_mic" android:keyWidth="10%p"/> <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" @@ -259,26 +186,7 @@ android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="_" android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_globe" - android:keyWidth="10%p"/> - <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" - android:iconPreview="@drawable/sym_keyboard_feedback_space" - android:keyWidth="20%p" android:isRepeatable="true"/> - <Key android:codes="9" android:keyIcon="@drawable/sym_keyboard_tab" - android:iconPreview="@drawable/sym_keyboard_feedback_tab" - android:keyWidth="20%p"/> - <Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"/> - <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return" - android:iconPreview="@drawable/sym_keyboard_feedback_return" - android:keyWidth="20%p" android:keyEdgeFlags="right"/> - </Row> - - <Row android:keyboardMode="@+id/mode_webentry_voice" android:rowEdgeFlags="bottom"> - <Key android:codes="-2" android:keyLabel="@string/label_symbol_key" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="_" - android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:codes="-102" android:keyIcon="@drawable/sym_keyboard_mic" + <Key android:codes="@integer/key_f1" android:keyIcon="@drawable/sym_keyboard_mic" android:iconPreview="@drawable/sym_keyboard_feedback_mic" android:keyWidth="10%p"/> <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" diff --git a/res/xml/kbd_symbols.xml b/res/xml/kbd_symbols.xml index 5a30c7b8f5290b57b5680f0c46fdecc550821272..067932b3f0dc5c2f64cca4bf0376f592e62de73c 100755 --- a/res/xml/kbd_symbols.xml +++ b/res/xml/kbd_symbols.xml @@ -126,10 +126,7 @@ android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="_" android:keyWidth="20%p" android:keyEdgeFlags="left"/> - <Key android:keyLabel="," android:keyWidth="10%p" - android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="‚„" - /> + <Key android:codes="@integer/key_f1" android:keyWidth="10%p"/> <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space" android:keyWidth="40%p" android:iconPreview="@drawable/sym_keyboard_feedback_space" diff --git a/res/xml/prefs.xml b/res/xml/prefs.xml index 74a2bcb20892cdb1c714a444576032152016cc06..4792c43cfbc594432a73a6795a3b407d40cc655a 100644 --- a/res/xml/prefs.xml +++ b/res/xml/prefs.xml @@ -43,6 +43,16 @@ android:persistent="false" android:defaultValue="@bool/voice_input_default" /> + + <CheckBoxPreference + android:key="voice_on_main" + android:title="@string/voice_on_primary" + android:summary="@string/voice_on_primary_summary" + android:persistent="true" + android:dependency="enable_voice_input" + android:defaultValue="@bool/voice_input_default" + /> + <PreferenceScreen android:title="@string/language_selection_title"> <intent diff --git a/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/src/com/android/inputmethod/latin/KeyboardSwitcher.java index 45d0a1e126ed6e647ffa182db7430e69d01f88ee..ea473f22345bd5eb8ce5360d507ceff54b538510 100644 --- a/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -67,16 +67,12 @@ public class KeyboardSwitcher { private KeyboardId mCurrentId; private Map<KeyboardId, LatinKeyboard> mKeyboards; - /** - * Maps keyboard mode to the equivalent mode with voice. - */ - private Map<Integer, Integer> mModeToVoice; - private int mMode; /** One of the MODE_XXX values */ private int mImeOptions; private int mTextMode = MODE_TEXT_QWERTY; private boolean mIsSymbols; private boolean mHasVoice; + private boolean mVoiceOnPrimary; private boolean mPreferSymbols; private int mSymbolsModeState = SYMBOLS_MODE_STATE_NONE; @@ -87,14 +83,8 @@ public class KeyboardSwitcher { KeyboardSwitcher(Context context, InputMethodService ims) { mContext = context; mKeyboards = new HashMap<KeyboardId, LatinKeyboard>(); - mSymbolsId = new KeyboardId(R.xml.kbd_symbols); - mSymbolsShiftedId = new KeyboardId(R.xml.kbd_symbols_shift); - mModeToVoice = new HashMap<Integer, Integer>(); - mModeToVoice.put(R.id.mode_normal, R.id.mode_normal_voice); - mModeToVoice.put(R.id.mode_url, R.id.mode_url_voice); - mModeToVoice.put(R.id.mode_email, R.id.mode_email_voice); - mModeToVoice.put(R.id.mode_im, R.id.mode_im_voice); - mModeToVoice.put(R.id.mode_webentry, R.id.mode_webentry_voice); + mSymbolsId = new KeyboardId(R.xml.kbd_symbols, false); + mSymbolsShiftedId = new KeyboardId(R.xml.kbd_symbols_shift, false); mInputMethodService = ims; } @@ -122,8 +112,9 @@ public class KeyboardSwitcher { if (displayWidth == mLastDisplayWidth) return; mLastDisplayWidth = displayWidth; if (!forceCreate) mKeyboards.clear(); - mSymbolsId = new KeyboardId(R.xml.kbd_symbols); - mSymbolsShiftedId = new KeyboardId(R.xml.kbd_symbols_shift); + mSymbolsId = new KeyboardId(R.xml.kbd_symbols, mHasVoice && !mVoiceOnPrimary); + mSymbolsShiftedId = new KeyboardId(R.xml.kbd_symbols_shift, + mHasVoice && !mVoiceOnPrimary); } /** @@ -134,15 +125,17 @@ public class KeyboardSwitcher { public int mXml; public int mKeyboardMode; /** A KEYBOARDMODE_XXX value */ public boolean mEnableShiftLock; + public boolean mHasVoice; - public KeyboardId(int xml, int mode, boolean enableShiftLock) { + public KeyboardId(int xml, int mode, boolean enableShiftLock, boolean hasVoice) { this.mXml = xml; this.mKeyboardMode = mode; this.mEnableShiftLock = enableShiftLock; + this.mHasVoice = hasVoice; } - public KeyboardId(int xml) { - this(xml, 0, false); + public KeyboardId(int xml, boolean hasVoice) { + this(xml, 0, false, hasVoice); } public boolean equals(Object other) { @@ -152,16 +145,29 @@ public class KeyboardSwitcher { public boolean equals(KeyboardId other) { return other.mXml == this.mXml && other.mKeyboardMode == this.mKeyboardMode - && other.mEnableShiftLock == this.mEnableShiftLock; + && other.mEnableShiftLock == this.mEnableShiftLock + && other.mHasVoice == this.mHasVoice; } public int hashCode() { - return (mXml + 1) * (mKeyboardMode + 1) * (mEnableShiftLock ? 2 : 1); + return (mXml + 1) * (mKeyboardMode + 1) * (mEnableShiftLock ? 2 : 1) + * (mHasVoice ? 4 : 8); } } - void setVoiceMode(boolean enableVoice) { - setKeyboardMode(mMode, mImeOptions, enableVoice, mIsSymbols); + void setVoiceMode(boolean enableVoice, boolean voiceOnPrimary) { + if (enableVoice != mHasVoice || voiceOnPrimary != mVoiceOnPrimary) { + System.err.println("Clearing keyboards"); + mKeyboards.clear(); + } + mHasVoice = enableVoice; + mVoiceOnPrimary = voiceOnPrimary; + setKeyboardMode(mMode, mImeOptions, mHasVoice, + mIsSymbols); + } + + boolean hasVoiceButton(boolean isSymbols) { + return mHasVoice && (isSymbols != mVoiceOnPrimary); } void setKeyboardMode(int mode, int imeOptions, boolean enableVoice) { @@ -181,9 +187,6 @@ public class KeyboardSwitcher { mInputView.setPreviewEnabled(true); KeyboardId id = getKeyboardId(mode, imeOptions, isSymbols); - if (enableVoice && mModeToVoice.containsKey(id.mKeyboardMode)) { - id.mKeyboardMode = mModeToVoice.get(id.mKeyboardMode); - } LatinKeyboard keyboard = getKeyboard(id); if (mode == MODE_PHONE) { @@ -211,17 +214,12 @@ public class KeyboardSwitcher { conf.locale = mInputLocale; orig.updateConfiguration(conf, null); LatinKeyboard keyboard = new LatinKeyboard( - mContext, id.mXml, id.mKeyboardMode); + mContext, id.mXml, id.mKeyboardMode, id.mHasVoice); if (id.mKeyboardMode == KEYBOARDMODE_NORMAL || id.mKeyboardMode == KEYBOARDMODE_URL || id.mKeyboardMode == KEYBOARDMODE_IM || id.mKeyboardMode == KEYBOARDMODE_EMAIL || id.mKeyboardMode == KEYBOARDMODE_WEB - || id.mKeyboardMode == R.id.mode_normal_voice - || id.mKeyboardMode == R.id.mode_url_voice - || id.mKeyboardMode == R.id.mode_im_voice - || id.mKeyboardMode == R.id.mode_email_voice - || id.mKeyboardMode == R.id.mode_webentry_voice ) { keyboard.setExtension(R.xml.kbd_extension); } @@ -238,31 +236,32 @@ public class KeyboardSwitcher { } private KeyboardId getKeyboardId(int mode, int imeOptions, boolean isSymbols) { + boolean hasVoice = hasVoiceButton(isSymbols); if (isSymbols) { return (mode == MODE_PHONE) - ? new KeyboardId(R.xml.kbd_phone_symbols) : new KeyboardId(R.xml.kbd_symbols); + ? new KeyboardId(R.xml.kbd_phone_symbols, hasVoice) + : new KeyboardId(R.xml.kbd_symbols, hasVoice); } - switch (mode) { case MODE_TEXT: if (mTextMode == MODE_TEXT_QWERTY) { - return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_NORMAL, true); + return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_NORMAL, true, hasVoice); } else if (mTextMode == MODE_TEXT_ALPHA) { - return new KeyboardId(R.xml.kbd_alpha, KEYBOARDMODE_NORMAL, true); + return new KeyboardId(R.xml.kbd_alpha, KEYBOARDMODE_NORMAL, true, hasVoice); } break; case MODE_SYMBOLS: - return new KeyboardId(R.xml.kbd_symbols); + return new KeyboardId(R.xml.kbd_symbols, hasVoice); case MODE_PHONE: - return new KeyboardId(R.xml.kbd_phone); + return new KeyboardId(R.xml.kbd_phone, hasVoice); case MODE_URL: - return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_URL, true); + return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_URL, true, hasVoice); case MODE_EMAIL: - return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_EMAIL, true); + return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_EMAIL, true, hasVoice); case MODE_IM: - return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_IM, true); + return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_IM, true, hasVoice); case MODE_WEB: - return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_WEB, true); + return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_WEB, true, hasVoice); } return null; } @@ -295,7 +294,7 @@ public class KeyboardSwitcher { boolean isAlphabetMode() { int currentMode = mCurrentId.mKeyboardMode; for (Integer mode : ALPHABET_MODES) { - if (currentMode == mode || currentMode == mModeToVoice.get(mode)) { + if (currentMode == mode) { return true; } } diff --git a/src/com/android/inputmethod/latin/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java index 7eecfb9b94035e691b1b0b416d0d3d823b830954..5faac5fae4087bb716fd6a45b6d021fd482a9cbc 100644 --- a/src/com/android/inputmethod/latin/LatinIME.java +++ b/src/com/android/inputmethod/latin/LatinIME.java @@ -92,7 +92,8 @@ public class LatinIME extends InputMethodService private static final String PREF_AUTO_COMPLETE = "auto_complete"; private static final String PREF_ENABLE_VOICE = "enable_voice_input"; private static final String PREF_VOICE_SERVER_URL = "voice_server_url"; - + private static final String PREF_VOICE_MAIN = "voice_on_main"; + // Whether or not the user has used voice input before (and thus, whether to show the // first-run warning dialog or not). private static final String PREF_HAS_USED_VOICE_INPUT = "has_used_voice_input"; @@ -211,6 +212,7 @@ public class LatinIME extends InputMethodService private boolean mIsShowingHint; private int mCorrectionMode; private boolean mEnableVoice = true; + private boolean mVoiceOnPrimary; private int mOrientation; // Indicates whether the suggestion strip is to be on in landscape @@ -445,6 +447,7 @@ public class LatinIME extends InputMethodService } mEnableVoiceButton = shouldShowVoiceButton(makeFieldContext(), attribute); + final boolean enableVoiceButton = mEnableVoiceButton && mEnableVoice; mAfterVoiceInput = false; mImmediatelyAfterVoiceInput = false; @@ -463,15 +466,15 @@ public class LatinIME extends InputMethodService case EditorInfo.TYPE_CLASS_NUMBER: case EditorInfo.TYPE_CLASS_DATETIME: mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_SYMBOLS, - attribute.imeOptions, mEnableVoiceButton); + attribute.imeOptions, enableVoiceButton); break; case EditorInfo.TYPE_CLASS_PHONE: mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_PHONE, - attribute.imeOptions, mEnableVoiceButton); + attribute.imeOptions, enableVoiceButton); break; case EditorInfo.TYPE_CLASS_TEXT: mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_TEXT, - attribute.imeOptions, mEnableVoiceButton); + attribute.imeOptions, enableVoiceButton); //startPrediction(); mPredictionOn = true; // Make sure that passwords are not displayed in candidate view @@ -491,19 +494,19 @@ public class LatinIME extends InputMethodService if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) { mPredictionOn = false; mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_EMAIL, - attribute.imeOptions, mEnableVoiceButton); + attribute.imeOptions, enableVoiceButton); } else if (variation == EditorInfo.TYPE_TEXT_VARIATION_URI) { mPredictionOn = false; mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_URL, - attribute.imeOptions, mEnableVoiceButton); + attribute.imeOptions, enableVoiceButton); } else if (variation == EditorInfo.TYPE_TEXT_VARIATION_SHORT_MESSAGE) { mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_IM, - attribute.imeOptions, mEnableVoiceButton); + attribute.imeOptions, enableVoiceButton); } else if (variation == EditorInfo.TYPE_TEXT_VARIATION_FILTER) { mPredictionOn = false; } else if (variation == EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT) { mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_WEB, - attribute.imeOptions, mEnableVoiceButton); + attribute.imeOptions, enableVoiceButton); // If it's a browser edit field and auto correct is not ON explicitly, then // disable auto correction, but keep suggestions on. if ((attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) == 0) { @@ -529,7 +532,7 @@ public class LatinIME extends InputMethodService break; default: mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_TEXT, - attribute.imeOptions, mEnableVoiceButton); + attribute.imeOptions, enableVoiceButton); updateShiftKeyState(attribute); } mInputView.closing(); @@ -790,6 +793,7 @@ public class LatinIME extends InputMethodService } mKeyboardSwitcher.setInputLocale(new Locale(mInputLanguage), getSelectedInputLanguages() != null); + mKeyboardSwitcher.setVoiceMode(mEnableVoice, mVoiceOnPrimary); mKeyboardSwitcher.makeKeyboards(true); } @@ -1504,7 +1508,8 @@ public class LatinIME extends InputMethodService int currentKeyboardMode = mKeyboardSwitcher.getKeyboardMode(); reloadKeyboards(); mKeyboardSwitcher.makeKeyboards(true); - mKeyboardSwitcher.setKeyboardMode(currentKeyboardMode, 0, mEnableVoiceButton); + mKeyboardSwitcher.setKeyboardMode(currentKeyboardMode, 0, + mEnableVoiceButton && mEnableVoice); initSuggest(mInputLanguage); persistInputLanguage(mInputLanguage); updateShiftKeyState(getCurrentInputEditorInfo()); @@ -1555,7 +1560,6 @@ public class LatinIME extends InputMethodService private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo attribute) { return ENABLE_VOICE_BUTTON - && mEnableVoice && fieldCanDoVoice(fieldContext) && !(attribute != null && attribute.privateImeOptions != null && attribute.privateImeOptions.equals(IME_OPTION_NO_MICROPHONE)); @@ -1719,10 +1723,13 @@ public class LatinIME extends InputMethodService if (VOICE_INSTALLED) { boolean enableVoice = sp.getBoolean(PREF_ENABLE_VOICE, true); - if (enableVoice != mEnableVoice && mKeyboardSwitcher != null) { - mKeyboardSwitcher.setVoiceMode(enableVoice); + boolean voiceOnPrimary = sp.getBoolean(PREF_VOICE_MAIN, true); + if (mKeyboardSwitcher != null && + (enableVoice != mEnableVoice || voiceOnPrimary != mVoiceOnPrimary)) { + mKeyboardSwitcher.setVoiceMode(enableVoice, voiceOnPrimary); } mEnableVoice = enableVoice; + mVoiceOnPrimary = voiceOnPrimary; } mAutoCorrectEnabled = sp.getBoolean(PREF_AUTO_COMPLETE, mResources.getBoolean(R.bool.enable_autocorrect)) & mShowSuggestions; diff --git a/src/com/android/inputmethod/latin/LatinKeyboard.java b/src/com/android/inputmethod/latin/LatinKeyboard.java index df38358d6b31568a9d19f48d36ec9e1181a58a11..f876af70963c109c42cd9a862497a8d61fed775f 100644 --- a/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -38,6 +38,10 @@ public class LatinKeyboard extends Keyboard { private Drawable mOldShiftIcon; private Drawable mOldShiftPreviewIcon; private Drawable mSpaceIcon; + private Drawable mMicIcon; + private Drawable mMicPreviewIcon; + private Drawable m123MicIcon; + private Drawable m123MicPreviewIcon; private Key mShiftKey; private Key mEnterKey; private Key mF1Key; @@ -45,6 +49,7 @@ public class LatinKeyboard extends Keyboard { /* package */ Locale mLocale; private Resources mRes; private int mMode; + private boolean mHasVoice; private int mExtensionResId; @@ -57,22 +62,26 @@ public class LatinKeyboard extends Keyboard { static int sSpacebarVerticalCorrection; public LatinKeyboard(Context context, int xmlLayoutResId) { - this(context, xmlLayoutResId, 0); + this(context, xmlLayoutResId, 0, false); } - public LatinKeyboard(Context context, int xmlLayoutResId, int mode) { + public LatinKeyboard(Context context, int xmlLayoutResId, int mode, boolean hasVoice) { super(context, xmlLayoutResId, mode); final Resources res = context.getResources(); mMode = mode; mRes = res; + mHasVoice = hasVoice; mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked); mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked); mShiftLockPreviewIcon.setBounds(0, 0, mShiftLockPreviewIcon.getIntrinsicWidth(), mShiftLockPreviewIcon.getIntrinsicHeight()); mSpaceIcon = res.getDrawable(R.drawable.sym_keyboard_space); + mMicIcon = res.getDrawable(R.drawable.sym_keyboard_mic); + mMicPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_mic); sSpacebarVerticalCorrection = res.getDimensionPixelOffset( R.dimen.spacebar_vertical_correction); + setF1Key(); } public LatinKeyboard(Context context, int layoutTemplateResId, @@ -227,28 +236,19 @@ public class LatinKeyboard extends Keyboard { } private void setF1Key() { - // TODO -// else { -// mSpaceKey.icon = mRes.getDrawable(R.drawable.sym_keyboard_space); -// switch (mMode) { -// case KeyboardSwitcher.KEYBOARDMODE_NORMAL: -// case KeyboardSwitcher.KEYBOARDMODE_IM: -// mF1Key.label = ","; -// mF1Key.codes = new int[] { ',' }; -// mF1Key.icon = null; -// mF1Key.iconPreview = null; -// break; -// case KeyboardSwitcher.KEYBOARDMODE_EMAIL: -// case KeyboardSwitcher.KEYBOARDMODE_URL: -// mF1Key.label = mRes.getString(R.string.popular_domain_0); -// mF1Key.codes = new int[] { '.' }; -// mF1Key.text = mF1Key.label; -// mF1Key.icon = null; -// mF1Key.iconPreview = null; -// mF1Key.popupResId = R.xml.popup_domains; -// break; -// } -// } + if (mF1Key == null) return; + System.err.println("Setting F1 key"); + if (!mHasVoice) { + mF1Key.label = ","; + mF1Key.codes = new int[] { ',' }; + mF1Key.icon = null; + mF1Key.iconPreview = null; + } else { + mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; + mF1Key.label = null; + mF1Key.icon = mMicIcon; + mF1Key.iconPreview = mMicPreviewIcon; + } } private void updateSpaceBarForLocale() {