diff options
Diffstat (limited to 'java')
35 files changed, 372 insertions, 218 deletions
diff --git a/java/res/values-da/strings.xml b/java/res/values-da/strings.xml index c4649e296..47619dc05 100644 --- a/java/res/values-da/strings.xml +++ b/java/res/values-da/strings.xml @@ -45,7 +45,7 @@ <string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"Standard"</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" msgid="7204653105667167620">"Aktivér fornyet rettelse"</string> <string name="enable_span_insert_summary" msgid="2947317657871394467">"Angiv forslag til fornyet rettelse"</string> <string name="auto_cap" msgid="1719746674854628252">"Skriv aut. med stort"</string> <string name="configure_dictionaries_title" msgid="4238652338556902049">"Tillægsordbøger"</string> @@ -113,7 +113,7 @@ <string name="select_language" msgid="3693815588777926848">"Inputsprog"</string> <string name="hint_add_to_dictionary" msgid="573678656946085380">"Tryk igen for at gemme"</string> <string name="has_dictionary" msgid="6071847973466625007">"Ordbog er tilgængelig"</string> - <string name="prefs_enable_log" msgid="6620424505072963557">"Aktiver brugerfeedback"</string> + <string name="prefs_enable_log" msgid="6620424505072963557">"Aktivér brugerfeedback"</string> <string name="prefs_description_log" msgid="5827825607258246003">"Vær med til at forbedre denne inputmetode ved at sende anvendelsesstatistikker og rapporter om nedbrud til Google."</string> <string name="keyboard_layout" msgid="8451164783510487501">"Tastaturtema"</string> <string name="subtype_en_GB" msgid="88170601942311355">"Engelsk (Storbritannien)"</string> diff --git a/java/res/xml-sw600dp/key_space.xml b/java/res/xml-sw600dp/key_space.xml index 234c80391..86af89f50 100644 --- a/java/res/xml-sw600dp/key_space.xml +++ b/java/res/xml-sw600dp/key_space.xml @@ -30,7 +30,7 @@ latin:keyStyle="languageSwitchKeyStyle" /> <Key latin:keyStyle="spaceKeyStyle" - latin:keyWidth="25.50%p" /> + latin:keyWidth="27.0%p" /> <Key latin:keyStyle="zwnjKeyStyle" /> </case> @@ -40,7 +40,7 @@ > <Key latin:keyStyle="spaceKeyStyle" - latin:keyWidth="34.00%p" /> + latin:keyWidth="36.0%p" /> <Key latin:keyStyle="zwnjKeyStyle" /> </case> @@ -51,13 +51,13 @@ latin:keyStyle="languageSwitchKeyStyle" /> <Key latin:keyStyle="spaceKeyStyle" - latin:keyWidth="34.00%p" /> + latin:keyWidth="36.0%p" /> </case> <!-- languageSwitchKeyEnabled="false" --> <default> <Key latin:keyStyle="spaceKeyStyle" - latin:keyWidth="42.50%p" /> + latin:keyWidth="45.0%p" /> </default> </switch> </merge> diff --git a/java/res/xml-sw600dp/keys_f1f2.xml b/java/res/xml-sw600dp/keys_f1f2.xml index 14b7231c9..9d2968720 100644 --- a/java/res/xml-sw600dp/keys_f1f2.xml +++ b/java/res/xml-sw600dp/keys_f1f2.xml @@ -27,7 +27,7 @@ > <Key latin:keyStyle="comKeyStyle" - latin:keyWidth="17.8%p" /> + latin:keyWidth="17.0%p" /> </case> <default> <switch> diff --git a/java/res/xml-sw600dp/row_dvorak4.xml b/java/res/xml-sw600dp/row_dvorak4.xml index 63ab8a835..ffc3427c5 100644 --- a/java/res/xml-sw600dp/row_dvorak4.xml +++ b/java/res/xml-sw600dp/row_dvorak4.xml @@ -22,22 +22,22 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Row - latin:keyWidth="8.9%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="toSymbolKeyStyle" - latin:keyWidth="13.0%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/keys_f1f2" /> <include - latin:keyXPos="30.750%p" + latin:keyXPos="28.0%p" latin:keyboardLayout="@xml/key_space" /> <include latin:keyboardLayout="@xml/key_question_exclamation" /> <include latin:keyboardLayout="@xml/key_dash" /> <include - latin:keyXPos="-10.00%p" + latin:keyXPos="-9.0%p" latin:keyWidth="fillRight" latin:keyboardLayout="@xml/key_shortcut" /> </Row> diff --git a/java/res/xml-sw600dp/row_hebrew4.xml b/java/res/xml-sw600dp/row_hebrew4.xml index 90441fba8..114a5cc16 100644 --- a/java/res/xml-sw600dp/row_hebrew4.xml +++ b/java/res/xml-sw600dp/row_hebrew4.xml @@ -22,20 +22,20 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="toSymbolKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/keys_f1f2" /> <include - latin:keyXPos="28.75%p" + latin:keyXPos="28.0%p" latin:keyboardLayout="@xml/key_space" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <include - latin:keyXPos="-8.5%p" + latin:keyXPos="-9.0%p" latin:keyWidth="fillRight" latin:keyboardLayout="@xml/key_shortcut" /> </Row> diff --git a/java/res/xml-sw600dp/row_qwerty4.xml b/java/res/xml-sw600dp/row_qwerty4.xml index 5008696fd..a4ba8a4c3 100644 --- a/java/res/xml-sw600dp/row_qwerty4.xml +++ b/java/res/xml-sw600dp/row_qwerty4.xml @@ -22,22 +22,22 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="toSymbolKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/keys_f1f2" /> <include - latin:keyXPos="28.75%p" + latin:keyXPos="28.0%p" latin:keyboardLayout="@xml/key_space" /> <include latin:keyboardLayout="@xml/key_apostrophe" /> <include latin:keyboardLayout="@xml/key_dash" /> <include - latin:keyXPos="-8.5%p" + latin:keyXPos="-9.0%p" latin:keyWidth="fillRight" latin:keyboardLayout="@xml/key_shortcut" /> </Row> diff --git a/java/res/xml-sw600dp/row_symbols4.xml b/java/res/xml-sw600dp/row_symbols4.xml index a4fe5faaa..20d1a7dff 100644 --- a/java/res/xml-sw600dp/row_symbols4.xml +++ b/java/res/xml-sw600dp/row_symbols4.xml @@ -22,17 +22,17 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="toAlphaKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <Key - latin:keyStyle="smileyKeyStyle" /> + latin:keyLabel="/" /> <Key latin:keyLabel="\@" /> <include - latin:keyXPos="28.75%p" + latin:keyXPos="28.0%p" latin:keyboardLayout="@xml/key_space" /> <Key latin:keyLabel=""" @@ -40,7 +40,7 @@ <Key latin:keyLabel="_" /> <include - latin:keyXPos="-8.5%p" + latin:keyXPos="-9.0%p" latin:keyWidth="fillRight" latin:keyboardLayout="@xml/key_shortcut" /> </Row> diff --git a/java/res/xml-sw600dp/row_symbols_shift4.xml b/java/res/xml-sw600dp/row_symbols_shift4.xml index ffb6e7fe5..fd7b37032 100644 --- a/java/res/xml-sw600dp/row_symbols_shift4.xml +++ b/java/res/xml-sw600dp/row_symbols_shift4.xml @@ -22,18 +22,16 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="toAlphaKeyStyle" - latin:keyWidth="11.75%p" /> - <Key - latin:keyStyle="smileyKeyStyle" /> + latin:keyWidth="10.0%p" /> <include - latin:keyXPos="28.75%p" + latin:keyXPos="28.0%p" latin:keyboardLayout="@xml/key_space" /> <include - latin:keyXPos="-8.5%p" + latin:keyXPos="-9.0%p" latin:keyWidth="fillRight" latin:keyboardLayout="@xml/key_shortcut" /> </Row> diff --git a/java/res/xml-sw600dp/rows_10_10_7_symbols.xml b/java/res/xml-sw600dp/rows_10_10_7_symbols.xml index d016eb8d0..44c967c04 100644 --- a/java/res/xml-sw600dp/rows_10_10_7_symbols.xml +++ b/java/res/xml-sw600dp/rows_10_10_7_symbols.xml @@ -26,34 +26,33 @@ <include latin:keyboardLayout="@xml/key_styles_currency" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_symbols1" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_symbols2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="toMoreSymbolKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_symbols3" /> <Key latin:keyStyle="toMoreSymbolKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_10_10_7_symbols_shift.xml b/java/res/xml-sw600dp/rows_10_10_7_symbols_shift.xml index d4496b82f..3d3b59f22 100644 --- a/java/res/xml-sw600dp/rows_10_10_7_symbols_shift.xml +++ b/java/res/xml-sw600dp/rows_10_10_7_symbols_shift.xml @@ -26,34 +26,33 @@ <include latin:keyboardLayout="@xml/key_styles_currency" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_symbols_shift1" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_symbols_shift2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="backFromMoreSymbolKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_symbols_shift3" /> <Key latin:keyStyle="backFromMoreSymbolKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_arabic.xml b/java/res/xml-sw600dp/rows_arabic.xml index bc21854c0..ec7c2ad96 100644 --- a/java/res/xml-sw600dp/rows_arabic.xml +++ b/java/res/xml-sw600dp/rows_arabic.xml @@ -24,29 +24,29 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_arabic1" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_arabic2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_arabic3" - latin:keyXPos="7.727%p" /> + latin:keyXPos="4.091%p" /> </Row> <include latin:keyboardLayout="@xml/row_qwerty4" /> diff --git a/java/res/xml-sw600dp/rows_azerty.xml b/java/res/xml-sw600dp/rows_azerty.xml index 137c654a8..824ee38f3 100644 --- a/java/res/xml-sw600dp/rows_azerty.xml +++ b/java/res/xml-sw600dp/rows_azerty.xml @@ -24,37 +24,36 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_azerty1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_azerty2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_azerty3" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key latin:keyStyle="shiftKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_bulgarian.xml b/java/res/xml-sw600dp/rows_bulgarian.xml index 682c72a0d..72532369c 100644 --- a/java/res/xml-sw600dp/rows_bulgarian.xml +++ b/java/res/xml-sw600dp/rows_bulgarian.xml @@ -24,37 +24,36 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_bulgarian1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_bulgarian2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.65%p" + latin:keyWidth="8.182%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_bulgarian3" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key latin:keyStyle="shiftKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_bulgarian_bds.xml b/java/res/xml-sw600dp/rows_bulgarian_bds.xml index 863296432..db6220e8e 100644 --- a/java/res/xml-sw600dp/rows_bulgarian_bds.xml +++ b/java/res/xml-sw600dp/rows_bulgarian_bds.xml @@ -24,30 +24,30 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_bulgarian_bds1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_bulgarian_bds2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.65%p" + latin:keyWidth="8.182%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_bulgarian_bds3" /> <include diff --git a/java/res/xml-sw600dp/rows_colemak.xml b/java/res/xml-sw600dp/rows_colemak.xml index a94381893..f7e903bb5 100644 --- a/java/res/xml-sw600dp/rows_colemak.xml +++ b/java/res/xml-sw600dp/rows_colemak.xml @@ -24,7 +24,7 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_colemak1" @@ -33,30 +33,29 @@ latin:keyboardLayout="@xml/key_colemak_colon" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_colemak2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_colemak3" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key latin:keyStyle="shiftKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_dvorak.xml b/java/res/xml-sw600dp/rows_dvorak.xml index 83d1feece..2fa8eb205 100644 --- a/java/res/xml-sw600dp/rows_dvorak.xml +++ b/java/res/xml-sw600dp/rows_dvorak.xml @@ -24,7 +24,7 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/keys_dvorak_123" /> @@ -33,28 +33,27 @@ latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_dvorak2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_dvorak3" /> <Key latin:keyStyle="shiftKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_east_slavic.xml b/java/res/xml-sw600dp/rows_east_slavic.xml index 76a6cc364..309625516 100644 --- a/java/res/xml-sw600dp/rows_east_slavic.xml +++ b/java/res/xml-sw600dp/rows_east_slavic.xml @@ -24,30 +24,30 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_east_slavic1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_east_slavic2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_east_slavic3" /> <include diff --git a/java/res/xml-sw600dp/rows_farsi.xml b/java/res/xml-sw600dp/rows_farsi.xml index 9daba6d0a..1ce658648 100644 --- a/java/res/xml-sw600dp/rows_farsi.xml +++ b/java/res/xml-sw600dp/rows_farsi.xml @@ -24,31 +24,31 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_farsi1" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_farsi2" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_farsi3" - latin:keyXPos="7.727%p" /> + latin:keyXPos="4.091%p" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <include latin:keyboardLayout="@xml/row_qwerty4" /> diff --git a/java/res/xml-sw600dp/rows_georgian.xml b/java/res/xml-sw600dp/rows_georgian.xml index 89ef09f66..61d3eb05a 100644 --- a/java/res/xml-sw600dp/rows_georgian.xml +++ b/java/res/xml-sw600dp/rows_georgian.xml @@ -24,38 +24,37 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_georgian1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_georgian2" - latin:keyXPos="5.875%p" /> + latin:keyXPos="4.5%p" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_georgian3" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key latin:keyStyle="shiftKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_greek.xml b/java/res/xml-sw600dp/rows_greek.xml index 24cbd6289..6a10228fb 100644 --- a/java/res/xml-sw600dp/rows_greek.xml +++ b/java/res/xml-sw600dp/rows_greek.xml @@ -24,7 +24,7 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/key_greek_semicolon" /> @@ -33,31 +33,30 @@ latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_greek2" - latin:keyXPos="5.875%p" /> + latin:keyXPos="4.5%p" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_greek3" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key latin:keyStyle="shiftKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_hebrew.xml b/java/res/xml-sw600dp/rows_hebrew.xml index 0a7bdf165..f9e6f51ab 100644 --- a/java/res/xml-sw600dp/rows_hebrew.xml +++ b/java/res/xml-sw600dp/rows_hebrew.xml @@ -24,7 +24,7 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/key_apostrophe" /> @@ -34,23 +34,23 @@ latin:keyboardLayout="@xml/rowkeys_hebrew1" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_hebrew2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_hebrew3" - latin:keyXPos="11.75%p" /> + latin:keyXPos="10.0%p" /> </Row> <include latin:keyboardLayout="@xml/row_hebrew4" /> diff --git a/java/res/xml-sw600dp/rows_hindi.xml b/java/res/xml-sw600dp/rows_hindi.xml index 267e96fc9..967846519 100644 --- a/java/res/xml-sw600dp/rows_hindi.xml +++ b/java/res/xml-sw600dp/rows_hindi.xml @@ -24,30 +24,30 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_hindi1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_hindi2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_hindi3" /> <include diff --git a/java/res/xml-sw600dp/rows_nordic.xml b/java/res/xml-sw600dp/rows_nordic.xml index 93373b637..43144030f 100644 --- a/java/res/xml-sw600dp/rows_nordic.xml +++ b/java/res/xml-sw600dp/rows_nordic.xml @@ -24,39 +24,39 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_nordic1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_nordic2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <Spacer - latin:keyWidth="3.479%p" /> + latin:keyWidth="3.181%p" /> <include latin:keyboardLayout="@xml/rowkeys_qwerty3" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key latin:keyStyle="shiftKeyStyle" - latin:keyXPos="-11.75%p" + latin:keyXPos="-10.0%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_pcqwerty.xml b/java/res/xml-sw600dp/rows_pcqwerty.xml index 0c74114fd..fa6080a19 100644 --- a/java/res/xml-sw600dp/rows_pcqwerty.xml +++ b/java/res/xml-sw600dp/rows_pcqwerty.xml @@ -30,7 +30,7 @@ latin:keyboardLayout="@xml/rowkeys_pcqwerty1" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row latin:keyWidth="7.0%p" @@ -52,7 +52,7 @@ latin:keyboardLayout="@xml/rowkeys_pcqwerty3" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row latin:keyWidth="7.0%p" diff --git a/java/res/xml-sw600dp/rows_pcqwerty_symbols.xml b/java/res/xml-sw600dp/rows_pcqwerty_symbols.xml index dd8df4e09..5e1aa6382 100644 --- a/java/res/xml-sw600dp/rows_pcqwerty_symbols.xml +++ b/java/res/xml-sw600dp/rows_pcqwerty_symbols.xml @@ -32,7 +32,7 @@ latin:keyboardLayout="@xml/rowkeys_pcqwerty1" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row latin:keyWidth="7.0%p" @@ -53,7 +53,7 @@ latin:keyboardLayout="@xml/rowkeys_pcqwerty3" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row latin:keyWidth="7.0%p" diff --git a/java/res/xml-sw600dp/rows_qwerty.xml b/java/res/xml-sw600dp/rows_qwerty.xml index 29aea3fdc..bac02fd9a 100644 --- a/java/res/xml-sw600dp/rows_qwerty.xml +++ b/java/res/xml-sw600dp/rows_qwerty.xml @@ -24,38 +24,37 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_qwerty1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_qwerty2" - latin:keyXPos="5.875%p" /> + latin:keyXPos="4.5%p" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_qwerty3" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key latin:keyStyle="shiftKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_qwertz.xml b/java/res/xml-sw600dp/rows_qwertz.xml index abbc7db89..98ddd0843 100644 --- a/java/res/xml-sw600dp/rows_qwertz.xml +++ b/java/res/xml-sw600dp/rows_qwertz.xml @@ -24,38 +24,37 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_qwertz1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_qwerty2" - latin:keyXPos="5.875%p" /> + latin:keyXPos="4.5%p" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_qwertz3" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key latin:keyStyle="shiftKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_south_slavic.xml b/java/res/xml-sw600dp/rows_south_slavic.xml index 68d86a9a2..e53a2ee92 100644 --- a/java/res/xml-sw600dp/rows_south_slavic.xml +++ b/java/res/xml-sw600dp/rows_south_slavic.xml @@ -24,30 +24,30 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_south_slavic1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <include latin:keyboardLayout="@xml/rowkeys_south_slavic2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.727%p" + latin:keyWidth="8.182%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_south_slavic3" /> <include diff --git a/java/res/xml-sw600dp/rows_spanish.xml b/java/res/xml-sw600dp/rows_spanish.xml index 8c965b2ff..b48ee0155 100644 --- a/java/res/xml-sw600dp/rows_spanish.xml +++ b/java/res/xml-sw600dp/rows_spanish.xml @@ -24,37 +24,36 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_qwerty1" latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_spanish2" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_qwerty3" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key latin:keyStyle="shiftKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_symbols.xml b/java/res/xml-sw600dp/rows_symbols.xml index 57ec70de1..3d0593dab 100644 --- a/java/res/xml-sw600dp/rows_symbols.xml +++ b/java/res/xml-sw600dp/rows_symbols.xml @@ -26,35 +26,34 @@ <include latin:keyboardLayout="@xml/key_styles_currency" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_symbols1" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_symbols2" - latin:keyXPos="5.875%p" /> + latin:keyXPos="4.5%p" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="toMoreSymbolKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_symbols3" /> <Key latin:keyStyle="toMoreSymbolKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_symbols_shift.xml b/java/res/xml-sw600dp/rows_symbols_shift.xml index c46661ec7..0050c0c15 100644 --- a/java/res/xml-sw600dp/rows_symbols_shift.xml +++ b/java/res/xml-sw600dp/rows_symbols_shift.xml @@ -26,35 +26,34 @@ <include latin:keyboardLayout="@xml/key_styles_currency" /> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_symbols_shift1" /> <Key latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <include latin:keyboardLayout="@xml/rowkeys_symbols_shift2" - latin:keyXPos="5.875%p" /> + latin:keyXPos="4.5%p" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="8.5%p" + latin:keyWidth="9.0%p" > <Key latin:keyStyle="backFromMoreSymbolKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_symbols_shift3" /> <Key latin:keyStyle="backFromMoreSymbolKeyStyle" - latin:keyXPos="-11.75%p" latin:keyWidth="fillRight" /> </Row> <include diff --git a/java/res/xml-sw600dp/rows_thai.xml b/java/res/xml-sw600dp/rows_thai.xml index c387081a3..c1fe55b39 100644 --- a/java/res/xml-sw600dp/rows_thai.xml +++ b/java/res/xml-sw600dp/rows_thai.xml @@ -24,38 +24,38 @@ <include latin:keyboardLayout="@xml/key_styles_common" /> <Row - latin:keyWidth="7.354%p" + latin:keyWidth="7.5%p" > <include latin:keyboardLayout="@xml/rowkeys_thai1" - latin:keyXPos="4.396%p" /> + latin:keyXPos="3.75%p" /> <Key latin:keyStyle="deleteKeyStyle" latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.354%p" + latin:keyWidth="7.5%p" > <include latin:keyboardLayout="@xml/rowkeys_thai2" latin:keyXPos="0.719%p" /> </Row> <Row - latin:keyWidth="7.354%p" + latin:keyWidth="7.5%p" > <include latin:keyboardLayout="@xml/rowkeys_thai3" - latin:keyXPos="4.396%p" /> + latin:keyXPos="3.75%p" /> <Key latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillBoth" /> + latin:keyWidth="fillRight" /> </Row> <Row - latin:keyWidth="7.354%p" + latin:keyWidth="7.5%p" > <Key latin:keyStyle="shiftKeyStyle" - latin:keyWidth="11.75%p" /> + latin:keyWidth="10.0%p" /> <include latin:keyboardLayout="@xml/rowkeys_thai4" /> <include diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index a644ec0d9..cc20f4294 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin; import android.content.Context; +import android.text.TextUtils; import com.android.inputmethod.keyboard.ProximityInfo; @@ -84,6 +85,7 @@ public class BinaryDictionary extends Dictionary { int typedLetterMultiplier, int fullWordMultiplier, int maxWordLength, int maxWords); private native void closeNative(long dict); private native boolean isValidWordNative(long dict, int[] word, int wordLength); + private native boolean isValidBigramNative(long dict, int[] word1, int[] word2); private native int getSuggestionsNative(long dict, long proximityInfo, int[] xCoordinates, int[] yCoordinates, int[] inputCodes, int codesSize, int[] prevWordForBigrams, boolean useFullEditDistance, char[] outputChars, int[] scores); @@ -204,6 +206,15 @@ public class BinaryDictionary extends Dictionary { return isValidWordNative(mNativeDict, chars, chars.length); } + // TODO: Add a batch process version (isValidBigramMultiple?) to avoid excessive numbers of jni + // calls when checking for changes in an entire dictionary. + public boolean isValidBigram(CharSequence word1, CharSequence word2) { + if (TextUtils.isEmpty(word1) || TextUtils.isEmpty(word2)) return false; + int[] chars1 = StringUtils.toCodePointArray(word1.toString()); + int[] chars2 = StringUtils.toCodePointArray(word2.toString()); + return isValidBigramNative(mNativeDict, chars1, chars2); + } + @Override public synchronized void close() { closeInternal(); diff --git a/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java index 65f97e987..22787c218 100644 --- a/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java @@ -18,6 +18,7 @@ import android.content.ContentResolver; import android.content.Context; import android.database.ContentObserver; import android.database.Cursor; +import android.os.SystemClock; import android.provider.BaseColumns; import android.provider.ContactsContract.Contacts; import android.text.TextUtils; @@ -30,18 +31,27 @@ import java.util.Locale; public class ContactsBinaryDictionary extends ExpandableBinaryDictionary { private static final String[] PROJECTION = {BaseColumns._ID, Contacts.DISPLAY_NAME,}; + private static final String[] PROJECTION_ID_ONLY = {BaseColumns._ID}; private static final String TAG = ContactsBinaryDictionary.class.getSimpleName(); private static final String NAME = "contacts"; + private static boolean DEBUG = false; + /** * Frequency for contacts information into the dictionary */ private static final int FREQUENCY_FOR_CONTACTS = 40; private static final int FREQUENCY_FOR_CONTACTS_BIGRAM = 90; + /** The maximum number of contacts that this dictionary supports. */ + private static final int MAX_CONTACT_COUNT = 10000; + private static final int INDEX_NAME = 1; + /** The number of contacts in the most recent dictionary rebuild. */ + static private int sContactCountAtLastRebuild = 0; + private ContentObserver mObserver; /** @@ -98,6 +108,7 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary { if (cursor != null) { try { if (cursor.moveToFirst()) { + sContactCountAtLastRebuild = getContactCount(); addWords(cursor); } } finally { @@ -125,15 +136,28 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary { private void addWords(Cursor cursor) { clearFusionDictionary(); - while (!cursor.isAfterLast()) { + int count = 0; + while (!cursor.isAfterLast() && count < MAX_CONTACT_COUNT) { String name = cursor.getString(INDEX_NAME); - if (name != null && -1 == name.indexOf('@')) { + if (isValidName(name)) { addName(name); + ++count; } cursor.moveToNext(); } } + private int getContactCount() { + // TODO: consider switching to a rawQuery("select count(*)...") on the database if + // performance is a bottleneck. + final Cursor cursor = mContext.getContentResolver().query( + Contacts.CONTENT_URI, PROJECTION_ID_ONLY, null, null, null); + if (cursor != null) { + return cursor.getCount(); + } + return 0; + } + /** * Adds the words in a name (e.g., firstname/lastname) to the binary dictionary along with their * bigrams depending on locale. @@ -144,16 +168,9 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary { // TODO: Better tokenization for non-Latin writing systems for (int i = 0; i < len; i++) { if (Character.isLetter(name.codePointAt(i))) { - int j; - for (j = i + 1; j < len; j++) { - final int codePoint = name.codePointAt(j); - if (!(codePoint == Keyboard.CODE_DASH || codePoint == Keyboard.CODE_SINGLE_QUOTE - || Character.isLetter(codePoint))) { - break; - } - } - String word = name.substring(i, j); - i = j - 1; + int end = getWordEndPosition(name, len, i); + String word = name.substring(i, end); + i = end - 1; // Don't add single letter words, possibly confuses // capitalization of i. final int wordLen = word.codePointCount(0, word.length()); @@ -169,4 +186,100 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary { } } } + + /** + * Returns the index of the last letter in the word, starting from position startIndex. + */ + private static int getWordEndPosition(String string, int len, int startIndex) { + int end; + int cp = 0; + for (end = startIndex + 1; end < len; end += Character.charCount(cp)) { + cp = string.codePointAt(end); + if (!(cp == Keyboard.CODE_DASH || cp == Keyboard.CODE_SINGLE_QUOTE + || Character.isLetter(cp))) { + break; + } + } + return end; + } + + @Override + protected boolean hasContentChanged() { + final long startTime = SystemClock.uptimeMillis(); + final int contactCount = getContactCount(); + if (contactCount > MAX_CONTACT_COUNT) { + // If there are too many contacts then return false. In this rare case it is impossible + // to include all of them anyways and the cost of rebuilding the dictionary is too high. + // TODO: Sort and check only the MAX_CONTACT_COUNT most recent contacts? + return false; + } + if (contactCount != sContactCountAtLastRebuild) { + return true; + } + // Check all contacts since it's not possible to find out which names have changed. + // This is needed because it's possible to receive extraneous onChange events even when no + // name has changed. + Cursor cursor = mContext.getContentResolver().query( + Contacts.CONTENT_URI, PROJECTION, null, null, null); + if (cursor != null) { + try { + if (cursor.moveToFirst()) { + while (!cursor.isAfterLast()) { + String name = cursor.getString(INDEX_NAME); + if (isValidName(name) && !isNameInDictionary(name)) { + if (DEBUG) { + Log.d(TAG, "Contact name missing: " + name + " (runtime = " + + (SystemClock.uptimeMillis() - startTime) + " ms)"); + } + return true; + } + cursor.moveToNext(); + } + } + } finally { + cursor.close(); + } + } + if (DEBUG) { + Log.d(TAG, "No contacts changed. (runtime = " + (SystemClock.uptimeMillis() - startTime) + + " ms)"); + } + return false; + } + + private static boolean isValidName(String name) { + if (name != null && -1 == name.indexOf('@')) { + return true; + } + return false; + } + + /** + * Checks if the words in a name are in the current binary dictionary. + */ + private boolean isNameInDictionary(String name) { + int len = name.codePointCount(0, name.length()); + String prevWord = null; + for (int i = 0; i < len; i++) { + if (Character.isLetter(name.codePointAt(i))) { + int end = getWordEndPosition(name, len, i); + String word = name.substring(i, end); + i = end - 1; + final int wordLen = word.codePointCount(0, word.length()); + if (wordLen < MAX_WORD_LENGTH && wordLen > 1) { + if (!TextUtils.isEmpty(prevWord) && mUseFirstLastBigrams) { + if (!super.isValidBigramLocked(prevWord, word)) { + return false; + } + } else { + if (!super.isValidWordLocked(word)) { + return false; + } + } + prevWord = word; + } + } + } + return true; + } } diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index 3d89226c0..22d8f24f1 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -96,6 +96,13 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { protected abstract void loadDictionaryAsync(); /** + * Indicates that the source dictionary content has changed and a rebuild of the binary file is + * required. If it returns false, the next reload will only read the current binary dictionary + * from file. Note that the shared binary dictionary is locked when this is called. + */ + protected abstract boolean hasContentChanged(); + + /** * Gets the shared dictionary controller for the given filename. */ private static synchronized DictionaryController getSharedDictionaryController( @@ -148,8 +155,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { * the native side. */ public void clearFusionDictionary() { - mFusionDictionary = new FusionDictionary(new Node(), new FusionDictionary.DictionaryOptions( - new HashMap<String, String>(), false, false)); + mFusionDictionary = new FusionDictionary(new Node(), + new FusionDictionary.DictionaryOptions(new HashMap<String, String>(), false, + false)); } /** @@ -224,9 +232,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { protected boolean isValidWordInner(final CharSequence word) { if (mLocalDictionaryController.tryLock()) { try { - if (mBinaryDictionary != null) { - return mBinaryDictionary.isValidWord(word); - } + return isValidWordLocked(word); } finally { mLocalDictionaryController.unlock(); } @@ -234,6 +240,32 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { return false; } + protected boolean isValidWordLocked(final CharSequence word) { + if (mBinaryDictionary == null) return false; + return mBinaryDictionary.isValidWord(word); + } + + protected boolean isValidBigram(final CharSequence word1, final CharSequence word2) { + if (mBinaryDictionary == null) return false; + return mBinaryDictionary.isValidBigram(word1, word2); + } + + protected boolean isValidBigramInner(final CharSequence word1, final CharSequence word2) { + if (mLocalDictionaryController.tryLock()) { + try { + return isValidBigramLocked(word1, word2); + } finally { + mLocalDictionaryController.unlock(); + } + } + return false; + } + + protected boolean isValidBigramLocked(final CharSequence word1, final CharSequence word2) { + if (mBinaryDictionary == null) return false; + return mBinaryDictionary.isValidBigram(word1, word2); + } + /** * Load the current binary dictionary from internal storage in a background thread. If no binary * dictionary exists, this method will generate one. @@ -315,12 +347,16 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { } /** - * Sets whether or not the dictionary is out of date and requires a reload. + * Marks that the dictionary is out of date and requires a reload. + * + * @param requiresRebuild Indicates that the source dictionary content has changed and a rebuild + * of the binary file is required. If not true, the next reload process will only read + * the current binary dictionary from file. */ - protected void setRequiresReload(final boolean reload) { - final long time = reload ? SystemClock.uptimeMillis() : 0; - mSharedDictionaryController.mLastUpdateRequestTime = time; + protected void setRequiresReload(final boolean requiresRebuild) { + final long time = SystemClock.uptimeMillis(); mLocalDictionaryController.mLastUpdateRequestTime = time; + mSharedDictionaryController.mLastUpdateRequestTime = time; if (DEBUG) { Log.d(TAG, "Reload request: request=" + time + " update=" + mSharedDictionaryController.mLastUpdateTime); @@ -351,21 +387,30 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { if (mSharedDictionaryController.isOutOfDate() || !dictionaryFileExists()) { // If the shared dictionary file does not exist or is out of date, the first // instance that acquires the lock will generate a new one. - mSharedDictionaryController.mLastUpdateTime = time; - mLocalDictionaryController.mLastUpdateTime = time; - generateBinaryDictionary(); - loadBinaryDictionary(); - } else if (mLocalDictionaryController.isOutOfDate()) { - // Otherwise, if only the local dictionary for this instance is out of date, load - // the shared dictionary from file. - mLocalDictionaryController.mLastUpdateTime = time; + if (hasContentChanged()) { + // If the source content has changed, rebuild the binary dictionary. + mSharedDictionaryController.mLastUpdateTime = time; + generateBinaryDictionary(); + loadBinaryDictionary(); + } else { + // If not, the reload request was unnecessary so revert LastUpdateRequestTime + // to LastUpdateTime. + mSharedDictionaryController.mLastUpdateRequestTime = + mSharedDictionaryController.mLastUpdateTime; + } + } else if (mBinaryDictionary == null || mLocalDictionaryController.mLastUpdateTime + < mSharedDictionaryController.mLastUpdateTime) { + // Otherwise, if the local dictionary is older than the shared dictionary, load the + // shared dictionary. loadBinaryDictionary(); } + mLocalDictionaryController.mLastUpdateTime = time; } finally { mSharedDictionaryController.unlock(); } } + // TODO: cache the file's existence so that we avoid doing a disk access each time. private boolean dictionaryFileExists() { final File file = new File(mContext.getFilesDir(), mFilename); return file.exists(); |