diff options
231 files changed, 2798 insertions, 1802 deletions
diff --git a/java/res/drawable-hdpi/ic_emoji_dark.png b/java/res/drawable-hdpi/ic_emoji_dark.png Binary files differnew file mode 100644 index 000000000..a9f18cde0 --- /dev/null +++ b/java/res/drawable-hdpi/ic_emoji_dark.png diff --git a/java/res/drawable-hdpi/ic_emoji_light.png b/java/res/drawable-hdpi/ic_emoji_light.png Binary files differnew file mode 100644 index 000000000..2e3638bf3 --- /dev/null +++ b/java/res/drawable-hdpi/ic_emoji_light.png diff --git a/java/res/drawable-mdpi/ic_emoji_dark.png b/java/res/drawable-mdpi/ic_emoji_dark.png Binary files differnew file mode 100644 index 000000000..d0047a437 --- /dev/null +++ b/java/res/drawable-mdpi/ic_emoji_dark.png diff --git a/java/res/drawable-mdpi/ic_emoji_light.png b/java/res/drawable-mdpi/ic_emoji_light.png Binary files differnew file mode 100644 index 000000000..a3195041a --- /dev/null +++ b/java/res/drawable-mdpi/ic_emoji_light.png diff --git a/java/res/drawable-xhdpi/ic_emoji_dark.png b/java/res/drawable-xhdpi/ic_emoji_dark.png Binary files differnew file mode 100644 index 000000000..22daec22e --- /dev/null +++ b/java/res/drawable-xhdpi/ic_emoji_dark.png diff --git a/java/res/drawable-xhdpi/ic_emoji_light.png b/java/res/drawable-xhdpi/ic_emoji_light.png Binary files differnew file mode 100644 index 000000000..21bc9090d --- /dev/null +++ b/java/res/drawable-xhdpi/ic_emoji_light.png diff --git a/java/res/layout/input_view.xml b/java/res/layout/input_view.xml index 136e18cd5..78217b01a 100644 --- a/java/res/layout/input_view.xml +++ b/java/res/layout/input_view.xml @@ -23,48 +23,23 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" + android:gravity="bottom|center_horizontal" > - <!-- The height of key_preview_backing view will automatically be determined by code. --> - <View - android:id="@+id/key_preview_backing" - android:layout_width="match_parent" - android:layout_height="0dp" /> - - <!-- On tablets, the suggestions strip is centered with horizontal paddings on both sides - because width of the landscape mode is too long for the suggestions strip. This - LinearLayout is required to hold the paddings. --> - <LinearLayout - android:id="@+id/suggestions_container" - android:orientation="horizontal" + <!-- To ensure that key preview popup is correctly placed when the current system locale is + one of RTL locales, layoutDirection="ltr" is needed in the SDK version 17+. --> + <com.android.inputmethod.latin.suggestions.SuggestionStripView + android:id="@+id/suggestion_strip_view" + android:layoutDirection="ltr" android:layout_width="match_parent" - android:layout_height="wrap_content" - > - <View - android:layout_width="@dimen/suggestions_strip_padding" - android:layout_height="@dimen/suggestions_strip_height" - style="?attr/suggestionsStripBackgroundStyle" /> - <!-- To ensure that key preview popup is correctly placed when the current system locale is - one of RTL locales, layoutDirection="ltr" is needed in the SDK version 17+. --> - <com.android.inputmethod.latin.suggestions.SuggestionStripView - android:id="@+id/suggestion_strip_view" - android:layoutDirection="ltr" - android:layout_weight="1.0" - android:layout_width="0dp" - android:layout_height="@dimen/suggestions_strip_height" - android:gravity="center_vertical" - style="?attr/suggestionStripViewStyle" /> - <View - android:layout_width="@dimen/suggestions_strip_padding" - android:layout_height="@dimen/suggestions_strip_height" - style="?attr/suggestionsStripBackgroundStyle" /> - </LinearLayout> - + android:layout_height="@dimen/suggestions_strip_height" + android:paddingRight="@dimen/suggestions_strip_padding" + android:paddingLeft="@dimen/suggestions_strip_padding" + style="?attr/suggestionStripViewStyle" /> <!-- To ensure that key preview popup is correctly placed when the current system locale is one of RTL locales, layoutDirection="ltr" is needed in the SDK version 17+. --> <com.android.inputmethod.keyboard.MainKeyboardView android:id="@+id/keyboard_view" android:layoutDirection="ltr" - android:layout_alignParentBottom="true" - android:layout_width="match_parent" + android:layout_width="wrap_content" android:layout_height="wrap_content" /> </com.android.inputmethod.latin.InputView> diff --git a/java/res/values-af/strings.xml b/java/res/values-af/strings.xml index d2a7486df..fc71368f0 100644 --- a/java/res/values-af/strings.xml +++ b/java/res/values-af/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Engels (VK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Engels (VS) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spaans (VS) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Geen taal nie"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Geen taal (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Geen taal nie (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Geen taal nie (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Geen taal nie (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Geen taal nie (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Geen taal nie (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Geen taal nie (alfabet)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabet (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabet (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabet (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabet (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabet (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabet (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Gepasmaakte invoerstyle"</string> <string name="add_style" msgid="6163126614514489951">"Voeg styl by"</string> <string name="add" msgid="8299699805688017798">"Voeg by"</string> diff --git a/java/res/values-am/strings.xml b/java/res/values-am/strings.xml index 3f235b37d..93f9a6000 100644 --- a/java/res/values-am/strings.xml +++ b/java/res/values-am/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"እንግሊዘኛ (ዩናይትድ ኪንግደም) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"እንግሊዘኛ (አሜሪካ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"ስፓኒሽኛ (ዩኤስ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"ምንም ቋንቋ"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"ቋንቋ አልባ (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"ቋንቋ አልባ (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"ቋንቋ አልባ (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"ቋንቋ አልባ (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"ቋንቋ አልባ (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"ቋንቋ አልባ (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"ምንም ቋንቋ (ፊደላት)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"ፊደላት (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"ፊደላት (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"ፊደላት (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"ፊደላት (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"ፊደላት (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"ፊደላት (ፒሲ)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"የተበጁ የግቤት ስታይሎች"</string> <string name="add_style" msgid="6163126614514489951">"ስታይል አክል"</string> <string name="add" msgid="8299699805688017798">"አክል"</string> diff --git a/java/res/values-ar/strings.xml b/java/res/values-ar/strings.xml index b52237353..efb294985 100644 --- a/java/res/values-ar/strings.xml +++ b/java/res/values-ar/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"الإنجليزية (المملكة المتحدة) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"الإنجليزية (الولايات المتحدة) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"الإسبانية (الأمريكية) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"بدون لغة"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"بدون لغة (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"بدون لغة (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"بدون لغة (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"بدون لغة (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"بدون لغة (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"بدون لغة (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"بدون لغة (أبجدية)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"الأبجدية (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"الأبجدية (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"الأبجدية (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"الأبجدية (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"الأبجدية (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"الأبجدية (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"أنماط الإدخال المخصصة"</string> <string name="add_style" msgid="6163126614514489951">"إضافة نمط"</string> <string name="add" msgid="8299699805688017798">"إضافة"</string> diff --git a/java/res/values-be/strings.xml b/java/res/values-be/strings.xml index 752c8b4b7..21adcca17 100644 --- a/java/res/values-be/strings.xml +++ b/java/res/values-be/strings.xml @@ -146,13 +146,20 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Англійская (Вялікабрытанія) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Англійская (ЗША) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"iспанская (ЗША) ( <xliff:g id="LAYOUT">%s</xliff:g> )"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Мова не выбрана"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Мова не выбрана (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Няма мовы (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Няма мовы (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Няма мовы (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Няма мовы (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Няма мовы (PC)"</string> + <!-- no translation found for subtype_no_language (7137390094240139495) --> + <skip /> + <!-- no translation found for subtype_no_language_qwerty (244337630616742604) --> + <skip /> + <!-- no translation found for subtype_no_language_qwertz (443066912507547976) --> + <skip /> + <!-- no translation found for subtype_no_language_azerty (8144348527575640087) --> + <skip /> + <!-- no translation found for subtype_no_language_dvorak (1564494667584718094) --> + <skip /> + <!-- no translation found for subtype_no_language_colemak (5837418400010302623) --> + <skip /> + <!-- no translation found for subtype_no_language_pcqwerty (5354918232046200018) --> + <skip /> <string name="custom_input_styles_title" msgid="8429952441821251512">"Карыстальніцкія стылі ўводу"</string> <string name="add_style" msgid="6163126614514489951">"Дадаць стыль"</string> <string name="add" msgid="8299699805688017798">"Дадаць"</string> diff --git a/java/res/values-bg/strings.xml b/java/res/values-bg/strings.xml index 67de96225..301f84e38 100644 --- a/java/res/values-bg/strings.xml +++ b/java/res/values-bg/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"английски (Великобр.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"английски (САЩ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"испански (САЩ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Без език"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"без език („QWERTY“)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Без език (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Без език (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Без език (Дворак)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Без език (Коулмак)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Без език (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Без език (латиница)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Латиница (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Латиница (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Латиница (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Латиница (Дворак)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Латиница (Коулмак)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Латиница (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Персон. стилове за въвежд."</string> <string name="add_style" msgid="6163126614514489951">"+ стил"</string> <string name="add" msgid="8299699805688017798">"Добавяне"</string> diff --git a/java/res/values-ca/strings.xml b/java/res/values-ca/strings.xml index f998cfe54..37e7d569c 100644 --- a/java/res/values-ca/strings.xml +++ b/java/res/values-ca/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Anglès (Regne Unit) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Anglès (Estats Units) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Espanyol (EUA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Cap idioma"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Cap idioma (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Cap idioma (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Cap idioma (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Cap idioma (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Cap idioma (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Cap idioma (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Cap idioma (alfabet)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabet (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabet (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabet (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabet (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabet (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabet (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Estils d\'entrada personalitzats"</string> <string name="add_style" msgid="6163126614514489951">"Afeg. estil"</string> <string name="add" msgid="8299699805688017798">"Afegeix"</string> diff --git a/java/res/values-cs/strings.xml b/java/res/values-cs/strings.xml index 9f822eca0..8aeaf73ff 100644 --- a/java/res/values-cs/strings.xml +++ b/java/res/values-cs/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"angličtina (VB) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"angličtina (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"španělština (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Žádný jazyk"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Žádný jazyk (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Žádný jazyk (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Žádný jazyk (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Žádný jazyk (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Žádný jazyk (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Žádný jazyk (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Žádný jazyk (latinka)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Latinka (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Latinka (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Latinka (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Latinka (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Latinka (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Latinka (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Vlastní styl zadávání"</string> <string name="add_style" msgid="6163126614514489951">"Přidat styl"</string> <string name="add" msgid="8299699805688017798">"Přidat"</string> diff --git a/java/res/values-da/strings.xml b/java/res/values-da/strings.xml index 69c63498e..afd92658f 100644 --- a/java/res/values-da/strings.xml +++ b/java/res/values-da/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Engelsk (Storbritannien) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Engelsk (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spansk (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Intet sprog"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Ingen sprog (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Intet sprog (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Intet sprog (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Intet sprog (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Intet sprog (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Intet sprog (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Intet sprog (Alfabet)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabet (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabet (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabet (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabet (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabet (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabet (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Tilpasset inputtypografi"</string> <string name="add_style" msgid="6163126614514489951">"Tilføj typografi"</string> <string name="add" msgid="8299699805688017798">"Tilføj"</string> diff --git a/java/res/values-de/strings.xml b/java/res/values-de/strings.xml index 9efdb37d8..12386d8e2 100644 --- a/java/res/values-de/strings.xml +++ b/java/res/values-de/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Englisch (GB) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Englisch (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spanisch (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Keine Sprache"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Keine Sprache (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Keine Sprache (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Keine Sprache (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Keine Sprache (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Keine Sprache (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Keine Sprache (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Keine Sprache (lat. Alphabet)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Lat. Alphabet (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Lat. Alphabet (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Lat. Alphabet (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Lat. Alphabet (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Lat. Alphabet (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Lat. Alphabet (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Benutzerdefinierte Eingabestile"</string> <string name="add_style" msgid="6163126614514489951">"Stil hinzufügen"</string> <string name="add" msgid="8299699805688017798">"Hinzufügen"</string> diff --git a/java/res/values-el/strings.xml b/java/res/values-el/strings.xml index 47f5bf2cb..b010e44e6 100644 --- a/java/res/values-el/strings.xml +++ b/java/res/values-el/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Αγγλικά (ΗΒ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Αγγλικά (ΗΠΑ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Ισπανικά (ΗΠΑ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Καμία γλώσσα"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Καμία γλώσσα (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Καμία γλώσσα (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Καμία γλώσσα (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Καμία γλώσσα (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Καμία γλώσσα (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Καμία γλώσσα (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Καμία γλώσσα (Αλφάβητο)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Αλφάβητο (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Αλφάβητο (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Αλφάβητο (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Αλφάβητο (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Αλφάβητο (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Αλφάβητο (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Προσαρμοσ. στυλ εισαγ."</string> <string name="add_style" msgid="6163126614514489951">"Προσθ. στυλ"</string> <string name="add" msgid="8299699805688017798">"Προσθήκη"</string> diff --git a/java/res/values-en-rGB/strings.xml b/java/res/values-en-rGB/strings.xml index 772a40ed8..c8dfe8f1e 100644 --- a/java/res/values-en-rGB/strings.xml +++ b/java/res/values-en-rGB/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"English (UK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"English (US) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spanish (US) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"No language"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"No language (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"No language (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"No language (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"No language (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"No language (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"No language (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"No language (Alphabet)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alphabet (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alphabet (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alphabet (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alphabet (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alphabet (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alphabet (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Custom input styles"</string> <string name="add_style" msgid="6163126614514489951">"Add style"</string> <string name="add" msgid="8299699805688017798">"Add"</string> diff --git a/java/res/values-es-rUS/strings.xml b/java/res/values-es-rUS/strings.xml index e2880f89a..52abe8259 100644 --- a/java/res/values-es-rUS/strings.xml +++ b/java/res/values-es-rUS/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Inglés (Reino Unido) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Inglés (EE.UU.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Español (EE.UU.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Ningún idioma"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Ningún idioma (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Sin idioma (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Sin idioma (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Sin idioma (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Sin idioma (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Sin idioma (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Ningún idioma (alfabeto)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabeto (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabeto (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabeto (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabeto (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabeto (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabeto (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Estilos de entrada personalizados"</string> <string name="add_style" msgid="6163126614514489951">"Agr. estilo"</string> <string name="add" msgid="8299699805688017798">"Agregar"</string> diff --git a/java/res/values-es/strings.xml b/java/res/values-es/strings.xml index e907bf779..c25058c25 100644 --- a/java/res/values-es/strings.xml +++ b/java/res/values-es/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Inglés (Reino Unido) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Inglés (EE.UU.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Español (EE.UU.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"ningún idioma"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"ningún idioma (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"ningún idioma (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"ningún idioma (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"ningún idioma (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"ningún idioma (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"ningún idioma (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Ningún idioma (alfabeto)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabeto (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabeto (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabeto (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabeto (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabeto (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabeto (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Estilos de entrada personalizados"</string> <string name="add_style" msgid="6163126614514489951">"Añadir estilo"</string> <string name="add" msgid="8299699805688017798">"Añadir"</string> diff --git a/java/res/values-et/strings.xml b/java/res/values-et/strings.xml index 7b36e1bba..9b9c93a7b 100644 --- a/java/res/values-et/strings.xml +++ b/java/res/values-et/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Inglise (UK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Inglise (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"hispaania (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Keel puudub"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Keel puudub (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Keel puudub (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Keel puudub (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Keel puudub (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Keel puudub (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Keel puudub (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Keel puudub (tähestik)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Tähestik (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Tähestik (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Tähestik (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Tähestik (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Tähestik (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Tähestik (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Kohandage sisendlaadid"</string> <string name="add_style" msgid="6163126614514489951">"Lisage laad"</string> <string name="add" msgid="8299699805688017798">"Lisa"</string> diff --git a/java/res/values-fa/strings.xml b/java/res/values-fa/strings.xml index 8bc7c26df..6d8365926 100644 --- a/java/res/values-fa/strings.xml +++ b/java/res/values-fa/strings.xml @@ -147,13 +147,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"انگلیسی (انگلستان) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"انگلیسی (ایالات متحده) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"اسپانیایی (آمریکا) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"زبانی موجود نیست"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"بدون زبان (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"هیچکدام از زبانها (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"هیچکدام از زبانها (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"هیچکدام از زبانها (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"هیچکدام از زبانها (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"هیچکدام از زبانها (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"بدون زبان (حروف الفبا)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"حروف الفبا (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"حروف الفبا (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"حروف الفبا (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"حروف الفبا (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"حروف الفبا (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"حروف الفبا (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"سبکهای ورودی سفارشی"</string> <string name="add_style" msgid="6163126614514489951">"افزودن سبک"</string> <string name="add" msgid="8299699805688017798">"افزودن"</string> diff --git a/java/res/values-fi/strings.xml b/java/res/values-fi/strings.xml index 921d6b2c0..e0e595e2f 100644 --- a/java/res/values-fi/strings.xml +++ b/java/res/values-fi/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"englanti (Iso-Britannia) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"englanti (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"espanja (Yhdysvallat) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Ei kieltä"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Ei kieltä (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Ei kieltä (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Ei kieltä (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Ei kieltä (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Ei kieltä (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Ei kieltä (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Ei kieltä (aakkoset)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Aakkoset (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Aakkoset (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Aakkoset (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Aakkoset (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Aakkoset (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Aakkoset (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Muokatut syöttötyylit"</string> <string name="add_style" msgid="6163126614514489951">"Lisää tyyli"</string> <string name="add" msgid="8299699805688017798">"Lisää"</string> diff --git a/java/res/values-fr/strings.xml b/java/res/values-fr/strings.xml index 9e91d9141..edabdb3ee 100644 --- a/java/res/values-fr/strings.xml +++ b/java/res/values-fr/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Anglais (Royaume-Uni) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Anglais (États-Unis) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Espagnol (États-Unis) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Aucune langue"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Aucune langue (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Aucune langue (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Aucune langue (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Aucune langue (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Aucune langue (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Aucune langue (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Aucune langue (latin)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alphabet latin (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alphabet latin (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alphabet latin (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alphabet latin (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alphabet latin (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alphabet latin (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Styles saisie personnalisés"</string> <string name="add_style" msgid="6163126614514489951">"Ajouter style"</string> <string name="add" msgid="8299699805688017798">"Ajouter"</string> diff --git a/java/res/values-hi/strings.xml b/java/res/values-hi/strings.xml index 324aaf292..19135ff52 100644 --- a/java/res/values-hi/strings.xml +++ b/java/res/values-hi/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"अंग्रेज़ी (यूके) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"अंग्रेज़ी (यूएस) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"स्पेनिश (यूएस) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"कोई भाषा नहीं"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"कोई भाषा नहीं (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"कोई भाषा नहीं (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"कोई भाषा नहीं (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"कोई भाषा नहीं (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"कोई भाषा नहीं (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"कोई भाषा नहीं (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"कोई भाषा नहीं (लैटिन वर्णाक्षर)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"वर्णाक्षर (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"वर्णाक्षर (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"वर्णाक्षर (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"वर्णाक्षर (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"वर्णाक्षर (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"वर्णाक्षर (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"कस्टम इनपुट शैलियां"</string> <string name="add_style" msgid="6163126614514489951">"शैली जोड़ें"</string> <string name="add" msgid="8299699805688017798">"जोड़ें"</string> diff --git a/java/res/values-hr/strings.xml b/java/res/values-hr/strings.xml index 8a7f9bbd1..084d5b6fb 100644 --- a/java/res/values-hr/strings.xml +++ b/java/res/values-hr/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"engleski (UK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"engleski (SAD) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"španjolski (SAD) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Nema jezika"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Nema jezika (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Nema jezika (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Nema jezika (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Nema jezika (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Nema jezika (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Nema jezika (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Nema jezika (abeceda)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Abeceda (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Abeceda (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Abeceda (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Abeceda (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Abeceda (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Abeceda (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Prilagođeni stilovi unosa"</string> <string name="add_style" msgid="6163126614514489951">"Dodaj stil"</string> <string name="add" msgid="8299699805688017798">"Dodaj"</string> diff --git a/java/res/values-hu/strings.xml b/java/res/values-hu/strings.xml index 9556daa91..a335aa957 100644 --- a/java/res/values-hu/strings.xml +++ b/java/res/values-hu/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"angol (brit) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"angol (amerikai) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"spanyol (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Nincs nyelv"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Nincs nyelv (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Nincs nyelv (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Nincs nyelv (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Nincs nyelv (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Nincs nyelv (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Nincs nyelv (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Nincs nyelv (ábécé)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Ábécé (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Ábécé (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Ábécé (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Ábécé (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Ábécé (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Ábécé (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Egyedi bevitelstílusok"</string> <string name="add_style" msgid="6163126614514489951">"Új stílus"</string> <string name="add" msgid="8299699805688017798">"Hozzáadás"</string> diff --git a/java/res/values-in/strings.xml b/java/res/values-in/strings.xml index 79fa54291..229cf8586 100644 --- a/java/res/values-in/strings.xml +++ b/java/res/values-in/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Inggris (Inggris) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Inggris (AS) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spanyol (AS) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Tidak ada bahasa"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Tanpa bahasa (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Tanpa bahasa (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Tanpa bahasa (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Tanpa bahasa (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Tanpa bahasa (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Tanpa bahasa (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Tidak ada bahasa (Abjad)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Abjad (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Abjad (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Abjad (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Abjad (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Abjad (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Abjad (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Gaya masukan khusus"</string> <string name="add_style" msgid="6163126614514489951">"Tambah gaya"</string> <string name="add" msgid="8299699805688017798">"Tambahkan"</string> diff --git a/java/res/values-it/strings.xml b/java/res/values-it/strings.xml index 8d8743f8b..310ffee63 100644 --- a/java/res/values-it/strings.xml +++ b/java/res/values-it/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Inglese (Regno Unito) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Inglese (Stati Uniti) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spagnolo (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Nessuna lingua"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Nessuna lingua (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Nessuna lingua (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Nessuna lingua (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Nessuna lingua (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Nessuna lingua (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Nessuna lingua (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Nessuna lingua (alfabeto)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabeto (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabeto (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabeto (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabeto (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabeto (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabeto (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Stili personalizzati"</string> <string name="add_style" msgid="6163126614514489951">"Aggiungi stile"</string> <string name="add" msgid="8299699805688017798">"Aggiungi"</string> diff --git a/java/res/values-iw/strings.xml b/java/res/values-iw/strings.xml index 9b11bc9a8..3c0cbad54 100644 --- a/java/res/values-iw/strings.xml +++ b/java/res/values-iw/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"אנגלית (בריטניה) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"אנגלית (ארה\"ב) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"ספרדית (ארצות הברית) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"ללא שפה"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"אין שפה (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"אין שפה (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"אין שפה (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"אין שפה (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"אין שפה (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"אין שפה (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"ללא שפה (אלף-בית)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"אלף-בית (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"אלף-בית (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"אלף-בית (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"אלף-בית (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"אלף-בית (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"אלף-בית (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"סגנונות קלט מותאמים אישית"</string> <string name="add_style" msgid="6163126614514489951">"הוסף סגנון"</string> <string name="add" msgid="8299699805688017798">"הוסף"</string> diff --git a/java/res/values-ja/strings.xml b/java/res/values-ja/strings.xml index a1fcd9aa9..594220613 100644 --- a/java/res/values-ja/strings.xml +++ b/java/res/values-ja/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"英語 (英国) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"英語 (米国) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"スペイン語 (米国) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"言語設定なし"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"言語設定なし (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"言語設定なし (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"言語設定なし (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"言語設定なし (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"言語設定なし (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"言語設定なし (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"言語なし(アルファベット)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"アルファベット(QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"アルファベット(QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"アルファベット(AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"アルファベット(Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"アルファベット(Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"アルファベット(PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"カスタム入力スタイル"</string> <string name="add_style" msgid="6163126614514489951">"スタイル追加"</string> <string name="add" msgid="8299699805688017798">"追加"</string> diff --git a/java/res/values-ka/strings.xml b/java/res/values-ka/strings.xml index 9dc0a8e72..211e92328 100644 --- a/java/res/values-ka/strings.xml +++ b/java/res/values-ka/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"ინგლისური (გაერთ. სამ.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"ინგლისური (აშშ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"ესპანური (აშშ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"ენის გარეშე"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"ენის გარეშე (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"ენის გარეშე (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"ენის გარეშე (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"ენის გარეშე (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"ენის გარეშე (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"ენის გარეშე (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"ენის გარეშე (ანბანი)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"ანბანი (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"ანბანი (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"ანბანი (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"ანბანი (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"ანბანი (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"ანბანი (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"შეყვანის სტილების კონფიგურაცია"</string> <string name="add_style" msgid="6163126614514489951">"სტილის დამატება"</string> <string name="add" msgid="8299699805688017798">"დამატება"</string> diff --git a/java/res/values-ko/strings.xml b/java/res/values-ko/strings.xml index 3567a8139..e729fc60d 100644 --- a/java/res/values-ko/strings.xml +++ b/java/res/values-ko/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"영어(영국) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"영어(미국) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"스페인어(미국)(<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"언어가 없음"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"언어가 없음(QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"언어 없음(QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"언어 없음(AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"언어 없음(드보락)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"언어 없음(콜맥)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"언어 없음(PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"언어 없음(알파벳)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"알파벳(QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"알파벳(QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"알파벳(AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"알파벳(드보락)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"알파벳(콜맥)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"알파벳(PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"맞춤 입력 스타일"</string> <string name="add_style" msgid="6163126614514489951">"스타일 추가"</string> <string name="add" msgid="8299699805688017798">"추가"</string> diff --git a/java/res/values-lt/strings.xml b/java/res/values-lt/strings.xml index c9403125d..44e01a977 100644 --- a/java/res/values-lt/strings.xml +++ b/java/res/values-lt/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Angliška (JK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Angliška (JAV) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Ispanų k. (JAV) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Kalbos nėra"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Nėra kalbos (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Nėra kalbos (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Nėra kalbos (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Nėra kalbos (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Nėra kalbos (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Nėra kalbos (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Kalbos nėra (abėcėlė)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Abėcėlė (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Abėcėlė (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Abėcėlė (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Abėcėlė (Dvorako)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Abėcėlė („Colemak“)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Abėcėlė (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Pasirinkti įvesties stilių"</string> <string name="add_style" msgid="6163126614514489951">"Prid. stilių"</string> <string name="add" msgid="8299699805688017798">"Pridėti"</string> diff --git a/java/res/values-lv/strings.xml b/java/res/values-lv/strings.xml index 81e485e6d..152ed856d 100644 --- a/java/res/values-lv/strings.xml +++ b/java/res/values-lv/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Angļu (Lielbritānija) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Angļu (ASV) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spāņu (ASV) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Nav valodas"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Nav valodas (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Nav valodas (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Nav valodas (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Nav valodas (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Nav valodas (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Nav valodas (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Nav valodas (alfabēts)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabēts (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabēts (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabēts (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabēts (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabēts (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabēts (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Pielāg. ievades stili"</string> <string name="add_style" msgid="6163126614514489951">"Piev. stilu"</string> <string name="add" msgid="8299699805688017798">"Pievienot"</string> diff --git a/java/res/values-mn/strings.xml b/java/res/values-mn/strings.xml index db6dec5d7..4a612040e 100644 --- a/java/res/values-mn/strings.xml +++ b/java/res/values-mn/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Англи (ИБ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Англи (АНУ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Испани (АНУ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Хэл байхгүй"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Хэл байхгүй (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Хэл байхгүй (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Хэл байхгүй (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Хэл байхгүй (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Хэл байхгүй (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Хэл байхгүй (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Хэл байхгүй (Цагаан толгой)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Цагаан толгой (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Цагаан толгой (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Цагаан толгой (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Цагаан толгой (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Цагаан толгой (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Цагаан толгой (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Өөрийн оруулах загвар"</string> <string name="add_style" msgid="6163126614514489951">"Загвар нэмэх"</string> <string name="add" msgid="8299699805688017798">"Нэмэх"</string> diff --git a/java/res/values-ms/strings.xml b/java/res/values-ms/strings.xml index 74ad15b88..df30627aa 100644 --- a/java/res/values-ms/strings.xml +++ b/java/res/values-ms/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Bahasa Inggeris (UK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Bahasa Inggeris (AS) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Bahasa Sepanyol (AS) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Tiada bahasa"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Tiada bahasa (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Tiada bahasa (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Tiada bahasa (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Tiada bahasa (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Tiada bahasa (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Tiada bahasa (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Tiada bahasa (Abjad)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Abjad (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Abjad (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Abjad (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Abjad (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Abjad (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Abjad (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Gaya input peribadi"</string> <string name="add_style" msgid="6163126614514489951">"Tambah gaya"</string> <string name="add" msgid="8299699805688017798">"Tambah"</string> diff --git a/java/res/values-nb/strings.xml b/java/res/values-nb/strings.xml index 345d75662..1f9dbed41 100644 --- a/java/res/values-nb/strings.xml +++ b/java/res/values-nb/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Engelsk (Storbritannia) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Engelsk (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spansk (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Ingen språk"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Ingen språk (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Ingen språk (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Ingen språk (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Ingen språk (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Ingen språk (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Ingen språk (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Ingen språk (alfabet)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabet (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabet (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabet (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabet (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabet (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabet (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Egendefinerte inndata"</string> <string name="add_style" msgid="6163126614514489951">"Legg til stil"</string> <string name="add" msgid="8299699805688017798">"Legg til"</string> diff --git a/java/res/values-nl/strings.xml b/java/res/values-nl/strings.xml index 36050b068..3eed154f7 100644 --- a/java/res/values-nl/strings.xml +++ b/java/res/values-nl/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Engels (VK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Engels (VS) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spaans (VS) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Geen taal"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Geen taal (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Geen taal (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Geen taal (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Geen taal (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Geen taal (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Geen taal (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Geen taal (alfabet)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabet (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabet (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabet (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabet (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabet (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabet (pc)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Aangep. invoerstijlen"</string> <string name="add_style" msgid="6163126614514489951">"Stijl toev."</string> <string name="add" msgid="8299699805688017798">"Toevoegen"</string> diff --git a/java/res/values-pl/strings.xml b/java/res/values-pl/strings.xml index ed8e5288d..b4f261213 100644 --- a/java/res/values-pl/strings.xml +++ b/java/res/values-pl/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"angielski (UK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"angielski (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"hiszpański (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Brak języka"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Brak języka (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Brak języka (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Brak języka (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Brak języka (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Brak języka (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Brak języka (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Bez języka (alfabet)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabet (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabet (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabet (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabet (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabet (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabet (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Style niestandardowe"</string> <string name="add_style" msgid="6163126614514489951">"Dodaj styl"</string> <string name="add" msgid="8299699805688017798">"Dodaj"</string> diff --git a/java/res/values-pt-rPT/strings.xml b/java/res/values-pt-rPT/strings.xml index 0508d894e..cacc3970e 100644 --- a/java/res/values-pt-rPT/strings.xml +++ b/java/res/values-pt-rPT/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Inglês (RU) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Inglês (EUA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Espanhol (EUA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Nenhum idioma"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Nenhum idioma (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Nenhum idioma (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Nenhum idioma (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Nenhum idioma (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Nenh. idioma (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Nenhum idioma (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Sem idioma (alfabeto)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabeto (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabeto (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabeto (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabeto (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabeto (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabeto (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Estilos entrada pers."</string> <string name="add_style" msgid="6163126614514489951">"Adic. estilo"</string> <string name="add" msgid="8299699805688017798">"Adicionar"</string> diff --git a/java/res/values-pt/strings.xml b/java/res/values-pt/strings.xml index 75250fb14..57ebe127e 100644 --- a/java/res/values-pt/strings.xml +++ b/java/res/values-pt/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Inglês (Reino Unido) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Inglês (EUA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"espanhol (EUA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Sem idioma"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"nenhum idioma (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Nenhum idioma (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Nenhum idioma (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Nenhum idioma (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Nenhum idioma (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Nenhum idioma (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Nenhum idioma (alfabeto)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabeto (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabeto (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabeto (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabeto (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabeto (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabeto (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Estilos personalizados"</string> <string name="add_style" msgid="6163126614514489951">"Adic. estilo"</string> <string name="add" msgid="8299699805688017798">"Adicionar"</string> diff --git a/java/res/values-rm/strings.xml b/java/res/values-rm/strings.xml index 8a673682d..1d14b8f4c 100644 --- a/java/res/values-rm/strings.xml +++ b/java/res/values-rm/strings.xml @@ -254,19 +254,19 @@ <skip /> <!-- no translation found for subtype_with_layout_es_US (6261791057007890189) --> <skip /> - <!-- no translation found for subtype_no_language (141420857808801746) --> + <!-- no translation found for subtype_no_language (7137390094240139495) --> <skip /> - <!-- no translation found for subtype_no_language_qwerty (2956121451616633133) --> + <!-- no translation found for subtype_no_language_qwerty (244337630616742604) --> <skip /> - <!-- no translation found for subtype_no_language_qwertz (1177848172397202890) --> + <!-- no translation found for subtype_no_language_qwertz (443066912507547976) --> <skip /> - <!-- no translation found for subtype_no_language_azerty (8721460968141187394) --> + <!-- no translation found for subtype_no_language_azerty (8144348527575640087) --> <skip /> - <!-- no translation found for subtype_no_language_dvorak (3122976737669823935) --> + <!-- no translation found for subtype_no_language_dvorak (1564494667584718094) --> <skip /> - <!-- no translation found for subtype_no_language_colemak (4205992994906097244) --> + <!-- no translation found for subtype_no_language_colemak (5837418400010302623) --> <skip /> - <!-- no translation found for subtype_no_language_pcqwerty (8840928374394180189) --> + <!-- no translation found for subtype_no_language_pcqwerty (5354918232046200018) --> <skip /> <!-- no translation found for custom_input_styles_title (8429952441821251512) --> <skip /> diff --git a/java/res/values-ro/strings.xml b/java/res/values-ro/strings.xml index 9d150daf7..8df11b1ac 100644 --- a/java/res/values-ro/strings.xml +++ b/java/res/values-ro/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Engleză (Regatul Unit) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Engleză (S.U.A.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spaniolă (S.U.A.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Nicio limbă"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Nicio limbă (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Nicio limbă (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Nicio limbă (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Nicio limbă (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Nicio limbă (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Nicio limbă (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Nicio limbă (alfabet)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabet (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabet (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabet (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabet (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabet (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabet (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Stiluri personalizate"</string> <string name="add_style" msgid="6163126614514489951">"Stil"</string> <string name="add" msgid="8299699805688017798">"Adăugaţi"</string> diff --git a/java/res/values-ru/strings.xml b/java/res/values-ru/strings.xml index 99e9afd16..b7539d13a 100644 --- a/java/res/values-ru/strings.xml +++ b/java/res/values-ru/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Английская (Великобр.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Английская (США) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Испанский (США): <xliff:g id="LAYOUT">%s</xliff:g>"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Язык не указан"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"QWERTY-клавиатура"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Язык не задан (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Язык не задан (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Язык не задан (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Яз. не задан (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Язык не задан (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Язык не определен (латиница)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Латиница (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Латиница (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Латиница (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Латиница (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Латиница (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Латиница (ПК)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Персонализированные стили"</string> <string name="add_style" msgid="6163126614514489951">"Добавить стиль"</string> <string name="add" msgid="8299699805688017798">"Добавить"</string> diff --git a/java/res/values-sk/strings.xml b/java/res/values-sk/strings.xml index 48d04b790..c4e5a06b5 100644 --- a/java/res/values-sk/strings.xml +++ b/java/res/values-sk/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"angličtina (UK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"angličtina (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"španielčina (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Žiadny jazyk"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Žiadny jazyk (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Žiadny jazyk (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Žiadny jazyk (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Žiadny jazyk (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Žiadny jazyk (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Žiadny jazyk (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Žiadny jazyk (latinka)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Latinka (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Latinka (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Latinka (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Latinka (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Latinka (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Latinka (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Vlastné štýly vstupu"</string> <string name="add_style" msgid="6163126614514489951">"Pridať štýl"</string> <string name="add" msgid="8299699805688017798">"Pridať"</string> diff --git a/java/res/values-sl/strings.xml b/java/res/values-sl/strings.xml index 496eae3e6..c6e7c24dd 100644 --- a/java/res/values-sl/strings.xml +++ b/java/res/values-sl/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Angleška (Zdr. kralj.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Angleška (ZDA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"španščina (ZDA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Ni jezika"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Ni jezika (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Ni jezika (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Ni jezika (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Ni jezika (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Ni jezika (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Ni jezika (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Brez jezika (latinice)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Latinica (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Latinica (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Latinica (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Latinica (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Latinica (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Latinica (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Slogi vnosa po meri"</string> <string name="add_style" msgid="6163126614514489951">"Dodaj slog"</string> <string name="add" msgid="8299699805688017798">"Dodaj"</string> diff --git a/java/res/values-sr/strings.xml b/java/res/values-sr/strings.xml index ee533d24d..cb3e32bbe 100644 --- a/java/res/values-sr/strings.xml +++ b/java/res/values-sr/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"енглески (УК) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"енглески (САД) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"шпански (САД) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Без језика"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Нема језика (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Без језика (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Без језика (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Без језика (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Без језика (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Без језика (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Нема језика (абецеда)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Абецеда (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Абецеда (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Абецеда (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Абецеда (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Абецеда (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Абецеда (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Прилаг. стилови уноса"</string> <string name="add_style" msgid="6163126614514489951">"Додав. стила"</string> <string name="add" msgid="8299699805688017798">"Додај"</string> diff --git a/java/res/values-sv/strings.xml b/java/res/values-sv/strings.xml index d45f160cf..5b34b2f02 100644 --- a/java/res/values-sv/strings.xml +++ b/java/res/values-sv/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Engelskt (brittiskt) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Engelskt (amerikanskt) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"spanska (USA (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Inget språk"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Inget språk (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Inget språk (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Inget språk (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Inget språk (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Inget språk (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Inget språk (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Inget språk (alfabet)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabet (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabet (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabet (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabet (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabet (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabet (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Anpassade indatastilar"</string> <string name="add_style" msgid="6163126614514489951">"Ny stil"</string> <string name="add" msgid="8299699805688017798">"Lägg till"</string> diff --git a/java/res/values-sw/strings.xml b/java/res/values-sw/strings.xml index 8aed331f5..94759b683 100644 --- a/java/res/values-sw/strings.xml +++ b/java/res/values-sw/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Kiingereza (Uingereza) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Kiingereza (Marekani) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Kihispania (Marekani) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Hakuna lugha"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Hakuna lugha (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Hakuna lugha (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Hakuna lugha (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Hakuna lugha (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Hakuna lugha (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Hakuna lugha (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Hakuna lugha (Alfabeti)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabeti (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabeti (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabeti (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabeti (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabeti (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabeti (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Mitindo maalum ya ingizo"</string> <string name="add_style" msgid="6163126614514489951">"Ongeza mtindo"</string> <string name="add" msgid="8299699805688017798">"Ongeza"</string> diff --git a/java/res/values-th/strings.xml b/java/res/values-th/strings.xml index e3b8342cb..58faeb00c 100644 --- a/java/res/values-th/strings.xml +++ b/java/res/values-th/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"อังกฤษ (สหราชอาณาจักร) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"อังกฤษ (สหรัฐอเมริกา) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"สเปน (สหรัฐอเมริกา) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"ไม่มีภาษา"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"ไม่มีภาษา (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"ไม่มีภาษา (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"ไม่มีภาษา (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"ไม่มีภาษา (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"ไม่มีภาษา (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"ไม่มีภาษา (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"ไม่มีภาษา (ตัวอักษรละติน)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"ตัวอักษร (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"ตัวอักษร (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"ตัวอักษร (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"ตัวอักษร (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"ตัวอักษร (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"ตัวอักษร (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"รูปแบบอินพุตกำหนดเอง"</string> <string name="add_style" msgid="6163126614514489951">"เพิ่มสไตล์"</string> <string name="add" msgid="8299699805688017798">"เพิ่ม"</string> diff --git a/java/res/values-tl/strings.xml b/java/res/values-tl/strings.xml index c69945932..1c27ffdd8 100644 --- a/java/res/values-tl/strings.xml +++ b/java/res/values-tl/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Ingles (UK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Ingles (US) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Spanish (US) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Walang wika"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Walang wika (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Walang wika (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Walang wika (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Walang wika (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Walang wika (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Walang wika (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Walang wika (Alpabeto)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alpabeto (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alpabeto (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alpabeto (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alpabeto (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alpabeto (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alpabeto (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Custom style ng input"</string> <string name="add_style" msgid="6163126614514489951">"Dagdag style"</string> <string name="add" msgid="8299699805688017798">"Idagdag"</string> diff --git a/java/res/values-tr/strings.xml b/java/res/values-tr/strings.xml index c2e8c82eb..6d4653373 100644 --- a/java/res/values-tr/strings.xml +++ b/java/res/values-tr/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"İngilizce (İngiltere) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"İngilizce (ABD) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"İspanyolca (ABD) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Dil yok"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Dil yok (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Dil yok (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Dil yok (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Dil yok (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Dil yok (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Dil yok (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Dil yok (Alfabe)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabe (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabe (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabe (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabe (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabe (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabe (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Özel giriş stilleri"</string> <string name="add_style" msgid="6163126614514489951">"Stil ekle"</string> <string name="add" msgid="8299699805688017798">"Ekle"</string> diff --git a/java/res/values-uk/strings.xml b/java/res/values-uk/strings.xml index 7246b913a..affce86c9 100644 --- a/java/res/values-uk/strings.xml +++ b/java/res/values-uk/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Англійська (Великобр.) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Англійська (США) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"іспанська (США) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Мову не вибрано"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"QWERTY-клавіатура"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Без мови (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Без мови (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Без мови (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Без мови (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Без мови (ПК)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Стандартна (латиниця)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Латиниця (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Латиниця (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Латиниця (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Латиниця (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Латиниця (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Латиниця (ПК)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Персональні стилі введення"</string> <string name="add_style" msgid="6163126614514489951">"Додати стиль"</string> <string name="add" msgid="8299699805688017798">"Додати"</string> diff --git a/java/res/values-vi/strings.xml b/java/res/values-vi/strings.xml index c3130b9c2..67b140ef3 100644 --- a/java/res/values-vi/strings.xml +++ b/java/res/values-vi/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Tiếng Anh (Anh) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Tiếng Anh (Mỹ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"Tiếng Tây Ban Nha (Mỹ) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Không có ngôn ngữ nào"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Không có ngôn ngữ (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"0 ngôn ngữ (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"0 ngôn ngữ (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"0 ngôn ngữ (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"0 ngôn ngữ (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"0 ngôn ngữ (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Không ngôn ngữ nào (Bảng chữ cái)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Bảng chữ cái (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Bảng chữ cái (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Bảng chữ cái (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Bảng chữ cái (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Bảng chữ cái (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Bảng chữ cái (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Kiểu nhập tùy chỉnh"</string> <string name="add_style" msgid="6163126614514489951">"Thêm kiểu"</string> <string name="add" msgid="8299699805688017798">"Thêm"</string> diff --git a/java/res/values-zh-rCN/strings.xml b/java/res/values-zh-rCN/strings.xml index 99c1bd357..461d326b1 100644 --- a/java/res/values-zh-rCN/strings.xml +++ b/java/res/values-zh-rCN/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"英语(英国)(<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"英语(美国)(<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"西班牙语(美国)(<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"无语言"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"无语言(QWERTY 键盘)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"无语言(QWERTZ 键盘)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"无语言(AZERTY 键盘)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"无语言(Dvorak 键盘)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"无语言(Colemak 键盘)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"无语言(PC 键盘)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"无语言(字母)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"字母 (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"字母 (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"字母 (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"字母 (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"字母 (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"字母 (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"自定义输入风格"</string> <string name="add_style" msgid="6163126614514489951">"添加样式"</string> <string name="add" msgid="8299699805688017798">"添加"</string> diff --git a/java/res/values-zh-rTW/strings.xml b/java/res/values-zh-rTW/strings.xml index b6fa6674a..8d7b155c7 100644 --- a/java/res/values-zh-rTW/strings.xml +++ b/java/res/values-zh-rTW/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"英文 (英國) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"英文 (美國) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"西班牙文 (美國) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"無語言"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"無語言 (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"無語言 (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"無語言 (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"無語言 (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"無語言 (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"無語言 (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"無語言 (字母)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"字母 (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"字母 (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"字母 (AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"字母 (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"字母 (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"字母 (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"自訂輸入樣式"</string> <string name="add_style" msgid="6163126614514489951">"新增樣式"</string> <string name="add" msgid="8299699805688017798">"新增"</string> diff --git a/java/res/values-zu/strings.xml b/java/res/values-zu/strings.xml index 4d3a1f5e2..38a5c27bf 100644 --- a/java/res/values-zu/strings.xml +++ b/java/res/values-zu/strings.xml @@ -143,13 +143,13 @@ <string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"I-English (UK) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_en_US" msgid="1362581347576714579">"I-English (US) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> <string name="subtype_with_layout_es_US" msgid="6261791057007890189">"I-Spanish (US) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string> - <string name="subtype_no_language" msgid="141420857808801746">"Akunalimi"</string> - <string name="subtype_no_language_qwerty" msgid="2956121451616633133">"Akunalimi (QWERTY)"</string> - <string name="subtype_no_language_qwertz" msgid="1177848172397202890">"Alukho ulimi (QWERTZ)"</string> - <string name="subtype_no_language_azerty" msgid="8721460968141187394">"Alukho ulimi (AZERTY)"</string> - <string name="subtype_no_language_dvorak" msgid="3122976737669823935">"Alukho ulimi (Dvorak)"</string> - <string name="subtype_no_language_colemak" msgid="4205992994906097244">"Alukho ulimi (Colemak)"</string> - <string name="subtype_no_language_pcqwerty" msgid="8840928374394180189">"Alukho ulimi (PC)"</string> + <string name="subtype_no_language" msgid="7137390094240139495">"Alikho ulimi (Alfabhethi)"</string> + <string name="subtype_no_language_qwerty" msgid="244337630616742604">"Alfabhethi (QWERTY)"</string> + <string name="subtype_no_language_qwertz" msgid="443066912507547976">"Alfabhethi (QWERTZ)"</string> + <string name="subtype_no_language_azerty" msgid="8144348527575640087">"Alfabhethi (I-AZERTY)"</string> + <string name="subtype_no_language_dvorak" msgid="1564494667584718094">"Alfabhethi (Dvorak)"</string> + <string name="subtype_no_language_colemak" msgid="5837418400010302623">"Alfabhethi (Colemak)"</string> + <string name="subtype_no_language_pcqwerty" msgid="5354918232046200018">"Alfabhethi (PC)"</string> <string name="custom_input_styles_title" msgid="8429952441821251512">"Izitayela zokufaka ngokwezifiso"</string> <string name="add_style" msgid="6163126614514489951">"Engeza isitayela"</string> <string name="add" msgid="8299699805688017798">"Engeza"</string> diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index c31831747..eef9116da 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -28,7 +28,6 @@ <attr name="moreKeysKeyboardViewStyle" format="reference" /> <attr name="moreKeysKeyboardPanelStyle" format="reference" /> <!-- Suggestions strip style --> - <attr name="suggestionsStripBackgroundStyle" format="reference" /> <attr name="suggestionStripViewStyle" format="reference" /> <attr name="moreSuggestionsViewStyle" format="reference" /> <attr name="suggestionBackgroundStyle" format="reference" /> @@ -217,6 +216,7 @@ <attr name="iconLanguageSwitchKey" format="reference" /> <attr name="iconZwnjKey" format="reference" /> <attr name="iconZwjKey" format="reference" /> + <attr name="iconEmojiKey" format="reference" /> </declare-styleable> <declare-styleable name="Keyboard_Key"> diff --git a/java/res/values/keyboard-icons-black.xml b/java/res/values/keyboard-icons-black.xml index e9c5733b5..c1b1b6573 100644 --- a/java/res/values/keyboard-icons-black.xml +++ b/java/res/values/keyboard-icons-black.xml @@ -39,5 +39,6 @@ <!-- TODO: Needs dedicated black theme ZWNJ and ZWJ icons --> <item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_holo</item> <item name="iconZwjKey">@drawable/sym_keyboard_zwj_holo</item> + <item name="iconEmojiKey">@drawable/ic_emoji_light</item> </style> </resources> diff --git a/java/res/values/keyboard-icons-ics.xml b/java/res/values/keyboard-icons-ics.xml index 8eba196de..5ada27ae8 100644 --- a/java/res/values/keyboard-icons-ics.xml +++ b/java/res/values/keyboard-icons-ics.xml @@ -36,5 +36,6 @@ <item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch</item> <item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_holo</item> <item name="iconZwjKey">@drawable/sym_keyboard_zwj_holo</item> + <item name="iconEmojiKey">@drawable/ic_emoji_light</item> </style> </resources> diff --git a/java/res/values/keyboard-icons-white.xml b/java/res/values/keyboard-icons-white.xml index e52099867..7c6de42fa 100644 --- a/java/res/values/keyboard-icons-white.xml +++ b/java/res/values/keyboard-icons-white.xml @@ -35,5 +35,6 @@ <!-- TODO: Needs dedicated black theme ZWNJ and ZWJ icons --> <item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_holo</item> <item name="iconZwjKey">@drawable/sym_keyboard_zwj_holo</item> + <item name="iconEmojiKey">@drawable/ic_emoji_dark</item> </style> </resources> diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index f572904f0..aae5b0b70 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -380,20 +380,83 @@ This should be identical to subtype_serbian_latin aside from the trailing (%s). <string name="subtype_with_layout_sr-Latn">Serbian (Latin) (<xliff:g id="layout">%s</xliff:g>)</string> --> - <!-- Description for language agnostic keyboard subtype [CHAR LIMIT=25] --> - <string name="subtype_no_language">No language</string> - <!-- Description for language agnostic QWERTY keyboard subtype [CHAR LIMIT=25] --> - <string name="subtype_no_language_qwerty">No language (QWERTY)</string> - <!-- Description for language agnostic QWERTZ keyboard subtype [CHAR LIMIT=25] --> - <string name="subtype_no_language_qwertz">No language (QWERTZ)</string> - <!-- Description for language agnostic AZERTY keyboard subtype [CHAR LIMIT=25] --> - <string name="subtype_no_language_azerty">No language (AZERTY)</string> - <!-- Description for language agnostic Dvorak keyboard subtype [CHAR LIMIT=25] --> - <string name="subtype_no_language_dvorak">No language (Dvorak)</string> - <!-- Description for language agnostic Colemak keyboard subtype [CHAR LIMIT=25] --> - <string name="subtype_no_language_colemak">No language (Colemak)</string> - <!-- Description for language agnostic PC QWERTY keyboard subtype [CHAR LIMIT=25] --> - <string name="subtype_no_language_pcqwerty">No language (PC)</string> + <!-- This string is displayed in a language list that allows to choose a language for +suggestions in a software keyboard. This setting won't give suggestions in any particular +language, hence "No language". +As for the "alphabet" mention, it refers specifically to the Latin alphabet, as opposed to +Cyrillic, Arabic, Hebrew or other scripts. This keyboard offers no suggestions, but it will +be a QWERTY, or AZERTY, or any other disposition that only offers Latin characters, so +you wouldn't be able to type, say, Arabic on it. Please translate it in a way that "alphabet" +would be understood to mean specifically the Latin alphabet, rather than any other +alphabet. [CHAR LIMIT=29] --> + <string name="subtype_no_language">No language (Alphabet)</string> + <!-- This string is displayed in the description for a keyboard type. It refers specifically to +the Latin alphabet, as opposed to Cyrillic, Arabic, Hebrew or other scripts. +When the device is configured to use a language using a script other than the Latin alphabet, the +user still needs a keyboard that can input Latin characters for passwords or login names for +example, and a way to switch to this Latin alphabet keyboard. This string is the description for +this keyboard, so users of other scripts should understand when they read this that it represents a +keyboard that is meant for them to be able to enter Latin characters as opposed to the script they +are used to. This keyboard does not provide a dictionary, and it is not tied to any specific +language among those that use the Latin alphabet. This keyboard is laid out in the QWERTY +disposition rather than other common dispositions for Latin languages. [CHAR LIMIT=25] --> + <string name="subtype_no_language_qwerty">Alphabet (QWERTY)</string> + <!-- This string is displayed in the description for a keyboard type. It refers specifically to +the Latin alphabet, as opposed to Cyrillic, Arabic, Hebrew or other scripts. +When the device is configured to use a language using a script other than the Latin alphabet, the +user still needs a keyboard that can input Latin characters for passwords or login names for +example, and a way to switch to this Latin alphabet keyboard. This string is the description for +this keyboard, so users of other scripts should understand when they read this that it represents a +keyboard that is meant for them to be able to enter Latin characters as opposed to the script they +are used to. This keyboard does not provide a dictionary, and it is not tied to any specific +language among those that use the Latin alphabet. This keyboard is laid out in the QWERTZ +disposition rather than other common dispositions for Latin languages. [CHAR LIMIT=25] --> + <string name="subtype_no_language_qwertz">Alphabet (QWERTZ)</string> + <!-- This string is displayed in the description for a keyboard type. It refers specifically to +the Latin alphabet, as opposed to Cyrillic, Arabic, Hebrew or other scripts. +When the device is configured to use a language using a script other than the Latin alphabet, the +user still needs a keyboard that can input Latin characters for passwords or login names for +example, and a way to switch to this Latin alphabet keyboard. This string is the description for +this keyboard, so users of other scripts should understand when they read this that it represents a +keyboard that is meant for them to be able to enter Latin characters as opposed to the script they +are used to. This keyboard does not provide a dictionary, and it is not tied to any specific +language among those that use the Latin alphabet. This keyboard is laid out in the AZERTY +disposition rather than other common dispositions for Latin languages. [CHAR LIMIT=25] --> + <string name="subtype_no_language_azerty">Alphabet (AZERTY)</string> + <!-- This string is displayed in the description for a keyboard type. It refers specifically to +the Latin alphabet, as opposed to Cyrillic, Arabic, Hebrew or other scripts. +When the device is configured to use a language using a script other than the Latin alphabet, the +user still needs a keyboard that can input Latin characters for passwords or login names for +example, and a way to switch to this Latin alphabet keyboard. This string is the description for +this keyboard, so users of other scripts should understand when they read this that it represents a +keyboard that is meant for them to be able to enter Latin characters as opposed to the script they +are used to. This keyboard does not provide a dictionary, and it is not tied to any specific +language among those that use the Latin alphabet. This keyboard is laid out in the Dvorak +disposition rather than other common dispositions for Latin languages. [CHAR LIMIT=25] --> + <string name="subtype_no_language_dvorak">Alphabet (Dvorak)</string> + <!-- This string is displayed in the description for a keyboard type. It refers specifically to +the Latin alphabet, as opposed to Cyrillic, Arabic, Hebrew or other scripts. +When the device is configured to use a language using a script other than the Latin alphabet, the +user still needs a keyboard that can input Latin characters for passwords or login names for +example, and a way to switch to this Latin alphabet keyboard. This string is the description for +this keyboard, so users of other scripts should understand when they read this that it represents a +keyboard that is meant for them to be able to enter Latin characters as opposed to the script they +are used to. This keyboard does not provide a dictionary, and it is not tied to any specific +language among those that use the Latin alphabet. This keyboard is laid out in the Colemak +disposition rather than other common dispositions for Latin languages. [CHAR LIMIT=25] --> + <string name="subtype_no_language_colemak">Alphabet (Colemak)</string> + <!-- This string is displayed in the description for a keyboard type. It refers specifically to +the Latin alphabet, as opposed to Cyrillic, Arabic, Hebrew or other scripts. +When the device is configured to use a language using a script other than the Latin alphabet, the +user still needs a keyboard that can input Latin characters for passwords or login names for +example, and a way to switch to this Latin alphabet keyboard. This string is the description for +this keyboard, so users of other scripts should understand when they read this that it represents a +keyboard that is meant for them to be able to enter Latin characters as opposed to the script they +are used to. This keyboard does not provide a dictionary, and it is not tied to any specific +language among those that use the Latin alphabet. This keyboard is laid out in the QWERTY PC +disposition that offers additional keys, but smaller keys compared to other common dispositions for +mobile devices. [CHAR LIMIT=25] --> + <string name="subtype_no_language_pcqwerty">Alphabet (PC)</string> <!-- Title of the preference settings for custom input styles (language and keyboard layout pairs) [CHAR LIMIT=35]--> <string name="custom_input_styles_title">Custom input styles</string> diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index 8b6c29e59..37c6a9553 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -145,13 +145,10 @@ <style name="MoreKeysKeyboardPanelStyle"> <item name="android:background">@drawable/keyboard_popup_panel_background</item> </style> - <style name="SuggestionsStripBackgroundStyle"> - <item name="android:background">@drawable/keyboard_suggest_strip</item> - </style> <style name="SuggestionStripViewStyle" - parent="SuggestionsStripBackgroundStyle" > + <item name="android:background">@drawable/keyboard_suggest_strip</item> <item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item> <item name="colorValidTypedWord">@color/highlight_color_default</item> <item name="colorTypedWord">@color/typed_word_color_default</item> @@ -380,13 +377,10 @@ <style name="MoreKeysKeyboardPanelStyle.IceCreamSandwich"> <item name="android:background">@drawable/keyboard_popup_panel_background_holo</item> </style> - <style name="SuggestionsStripBackgroundStyle.IceCreamSandwich"> - <item name="android:background">@drawable/keyboard_suggest_strip_holo</item> - </style> <style name="SuggestionStripViewStyle.IceCreamSandwich" - parent="SuggestionsStripBackgroundStyle.IceCreamSandwich" > + <item name="android:background">@drawable/keyboard_suggest_strip_holo</item> <item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item> <item name="colorValidTypedWord">@color/highlight_color_ics</item> <item name="colorTypedWord">@color/highlight_color_ics</item> diff --git a/java/res/values/themes-basic-highcontrast.xml b/java/res/values/themes-basic-highcontrast.xml index 48df0a1b6..e81d47386 100644 --- a/java/res/values/themes-basic-highcontrast.xml +++ b/java/res/values/themes-basic-highcontrast.xml @@ -22,7 +22,6 @@ <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView</item> <item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle</item> - <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> <item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle</item> <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> diff --git a/java/res/values/themes-basic.xml b/java/res/values/themes-basic.xml index 88a0c5d8d..c44f0f614 100644 --- a/java/res/values/themes-basic.xml +++ b/java/res/values/themes-basic.xml @@ -22,7 +22,6 @@ <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView</item> <item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle</item> - <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> <item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle</item> <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> diff --git a/java/res/values/themes-gingerbread.xml b/java/res/values/themes-gingerbread.xml index 51f680a7a..129afdf5b 100644 --- a/java/res/values/themes-gingerbread.xml +++ b/java/res/values/themes-gingerbread.xml @@ -22,7 +22,6 @@ <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.Gingerbread</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.Gingerbread</item> <item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle</item> - <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> <item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle</item> <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index d9c59a180..1264831f3 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -22,7 +22,6 @@ <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.IceCreamSandwich</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.IceCreamSandwich</item> <item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle.IceCreamSandwich</item> - <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.IceCreamSandwich</item> <item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle.IceCreamSandwich</item> <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle.IceCreamSandwich</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.IceCreamSandwich</item> diff --git a/java/res/values/themes-stone-bold.xml b/java/res/values/themes-stone-bold.xml index 6ace9d673..196f3ef9f 100644 --- a/java/res/values/themes-stone-bold.xml +++ b/java/res/values/themes-stone-bold.xml @@ -22,7 +22,6 @@ <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.Stone</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.Stone</item> <item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle</item> - <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> <item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle</item> <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> diff --git a/java/res/values/themes-stone.xml b/java/res/values/themes-stone.xml index 3c3826b1a..d0d35c28d 100644 --- a/java/res/values/themes-stone.xml +++ b/java/res/values/themes-stone.xml @@ -22,7 +22,6 @@ <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.Stone</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.Stone</item> <item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle</item> - <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> <item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle</item> <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml index a2d2fd827..f407ba346 100644 --- a/java/res/xml-sw600dp/key_styles_common.xml +++ b/java/res/xml-sw600dp/key_styles_common.xml @@ -120,6 +120,11 @@ latin:keyActionFlags="noKeyPreview|altCodeWhileTyping|enableLongPress" latin:altCode="!code/key_space" /> <key-style + latin:styleName="emojiKeyStyle" + latin:code="!code/key_emoji" + latin:keyIcon="!icon/emoji_key" + latin:keyActionFlags="noKeyPreview" /> + <key-style latin:styleName="settingsKeyStyle" latin:code="!code/key_settings" latin:keyIcon="!icon/settings_key" 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 44c967c04..0e4710c37 100644 --- a/java/res/xml-sw600dp/rows_10_10_7_symbols.xml +++ b/java/res/xml-sw600dp/rows_10_10_7_symbols.xml @@ -43,7 +43,7 @@ latin:keyStyle="enterKeyStyle" latin:keyWidth="fillRight" /> </Row> - <Row + <Row latin:keyWidth="9.0%p" > <Key diff --git a/java/res/xml-sw768dp/key_styles_common.xml b/java/res/xml-sw768dp/key_styles_common.xml index e69bc3020..7c0a82a71 100644 --- a/java/res/xml-sw768dp/key_styles_common.xml +++ b/java/res/xml-sw768dp/key_styles_common.xml @@ -110,6 +110,11 @@ latin:keyActionFlags="noKeyPreview|altCodeWhileTyping|enableLongPress" latin:altCode="!code/key_space" /> <key-style + latin:styleName="emojiKeyStyle" + latin:code="!code/key_emoji" + latin:keyIcon="!icon/emoji_key" + latin:keyActionFlags="noKeyPreview" /> + <key-style latin:styleName="settingsKeyStyle" latin:code="!code/key_settings" latin:keyIcon="!icon/settings_key" diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml index 6590d0a4c..355455e3b 100644 --- a/java/res/xml/key_styles_common.xml +++ b/java/res/xml/key_styles_common.xml @@ -126,6 +126,11 @@ latin:keyActionFlags="noKeyPreview|altCodeWhileTyping|enableLongPress" latin:altCode="!code/key_space" /> <key-style + latin:styleName="emojiKeyStyle" + latin:code="!code/key_emoji" + latin:keyIcon="!icon/emoji_key" + latin:keyActionFlags="noKeyPreview" /> + <key-style latin:styleName="tabKeyStyle" latin:code="!code/key_tab" latin:keyIcon="!icon/tab_key" diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 09f1145e9..61805286d 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -306,8 +306,15 @@ public class Key implements Comparable<Key> { } mActionFlags = actionFlags; + final int code = KeySpecParser.parseCode(style.getString(keyAttr, + R.styleable.Keyboard_Key_code), params.mCodesSet, CODE_UNSPECIFIED); if ((mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0) { mLabel = params.mId.mCustomActionLabel; + } else if (code >= Character.MIN_SUPPLEMENTARY_CODE_POINT) { + // This is a workaround to have a key that has a supplementary code point in its label. + // Because we can put a string in resource neither as a XML entity of a supplementary + // code point nor as a surrogate pair. + mLabel = new StringBuilder().appendCodePoint(code).toString(); } else { mLabel = KeySpecParser.toUpperCaseOfStringForLocale(style.getString(keyAttr, R.styleable.Keyboard_Key_keyLabel), needsToUpperCase, locale); @@ -320,8 +327,6 @@ public class Key implements Comparable<Key> { } String outputText = KeySpecParser.toUpperCaseOfStringForLocale(style.getString(keyAttr, R.styleable.Keyboard_Key_keyOutputText), needsToUpperCase, locale); - final int code = KeySpecParser.parseCode(style.getString(keyAttr, - R.styleable.Keyboard_Key_code), params.mCodesSet, CODE_UNSPECIFIED); // Choose the first letter of the label as primary code if not specified. if (code == CODE_UNSPECIFIED && TextUtils.isEmpty(outputText) && !TextUtils.isEmpty(mLabel)) { diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index 8864b7603..1dc3c6a4c 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -18,7 +18,6 @@ package com.android.inputmethod.keyboard; import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.KEYBOARD_LAYOUT_SET; -import android.content.res.Configuration; import android.text.InputType; import android.text.TextUtils; import android.view.inputmethod.EditorInfo; @@ -58,8 +57,6 @@ public final class KeyboardId { public final InputMethodSubtype mSubtype; public final Locale mLocale; - // TODO: Remove this member. It is used only for logging purpose. - public final int mOrientation; public final int mWidth; public final int mHeight; public final int mMode; @@ -77,7 +74,6 @@ public final class KeyboardId { public KeyboardId(final int elementId, final KeyboardLayoutSet.Params params) { mSubtype = params.mSubtype; mLocale = SubtypeLocaleUtils.getSubtypeLocale(mSubtype); - mOrientation = params.mOrientation; mWidth = params.mKeyboardWidth; mHeight = params.mKeyboardHeight; mMode = params.mMode; @@ -101,7 +97,6 @@ public final class KeyboardId { private static int computeHashCode(final KeyboardId id) { return Arrays.hashCode(new Object[] { - id.mOrientation, id.mElementId, id.mMode, id.mWidth, @@ -123,8 +118,7 @@ public final class KeyboardId { private boolean equals(final KeyboardId other) { if (other == this) return true; - return other.mOrientation == mOrientation - && other.mElementId == mElementId + return other.mElementId == mElementId && other.mMode == mMode && other.mWidth == mWidth && other.mHeight == mHeight @@ -185,13 +179,10 @@ public final class KeyboardId { @Override public String toString() { - final String orientation = (mOrientation == Configuration.ORIENTATION_PORTRAIT) - ? "port" : "land"; - return String.format(Locale.ROOT, "[%s %s:%s %s:%dx%d %s %s %s%s%s%s%s%s%s%s%s]", + return String.format(Locale.ROOT, "[%s %s:%s %dx%d %s %s %s%s%s%s%s%s%s%s%s]", elementIdToName(mElementId), - mLocale, - mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET), - orientation, mWidth, mHeight, + mLocale, mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET), + mWidth, mHeight, modeName(mMode), imeAction(), (navigateNext() ? "navigateNext" : ""), diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java index e15310721..bccf8fb15 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java @@ -23,20 +23,16 @@ import static com.android.inputmethod.latin.Constants.ImeOption.NO_SETTINGS_KEY; import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.ASCII_CAPABLE; import android.content.Context; -import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.text.InputType; -import android.text.TextUtils; -import android.util.DisplayMetrics; import android.util.Log; import android.util.SparseArray; import android.util.Xml; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodSubtype; -import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.compat.EditorInfoCompatUtils; import com.android.inputmethod.keyboard.internal.KeyboardBuilder; import com.android.inputmethod.keyboard.internal.KeyboardParams; @@ -45,10 +41,8 @@ import com.android.inputmethod.latin.InputAttributes; import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.SubtypeSwitcher; -import com.android.inputmethod.latin.utils.AdditionalSubtypeUtils; import com.android.inputmethod.latin.utils.CollectionUtils; import com.android.inputmethod.latin.utils.InputTypeUtils; -import com.android.inputmethod.latin.utils.ResourceUtils; import com.android.inputmethod.latin.utils.SubtypeLocaleUtils; import com.android.inputmethod.latin.utils.XmlParseUtils; @@ -74,8 +68,6 @@ public final class KeyboardLayoutSet { private static final String TAG_ELEMENT = "Element"; private static final String KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX = "keyboard_layout_set_"; - private static final int SPELLCHECKER_DUMMY_KEYBOARD_WIDTH = 480; - private static final int SPELLCHECKER_DUMMY_KEYBOARD_HEIGHT = 800; private final Context mContext; private final Params mParams; @@ -119,7 +111,6 @@ public final class KeyboardLayoutSet { boolean mLanguageSwitchKeyEnabled; InputMethodSubtype mSubtype; boolean mIsSpellChecker; - int mOrientation; int mKeyboardWidth; int mKeyboardHeight; // Sparse array of KeyboardLayoutSet element parameters indexed by element's id. @@ -222,7 +213,6 @@ public final class KeyboardLayoutSet { private final Context mContext; private final String mPackageName; private final Resources mResources; - private final EditorInfo mEditorInfo; private final Params mParams = new Params(); @@ -232,55 +222,25 @@ public final class KeyboardLayoutSet { mContext = context; mPackageName = context.getPackageName(); mResources = context.getResources(); - mEditorInfo = editorInfo; final Params params = mParams; params.mMode = getKeyboardMode(editorInfo); params.mEditorInfo = (editorInfo != null) ? editorInfo : EMPTY_EDITOR_INFO; params.mNoSettingsKey = InputAttributes.inPrivateImeOptions( - mPackageName, NO_SETTINGS_KEY, mEditorInfo); + mPackageName, NO_SETTINGS_KEY, params.mEditorInfo); } - public Builder setScreenGeometry(final int widthPixels, final int heightPixels) { - final Params params = mParams; - params.mOrientation = (heightPixels > widthPixels) - ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE; - setDefaultKeyboardSize(widthPixels, heightPixels); + public Builder setKeyboardGeometry(final int keyboardWidth, final int keyboardHeight) { + mParams.mKeyboardWidth = keyboardWidth; + mParams.mKeyboardHeight = keyboardHeight; return this; } - private void setDefaultKeyboardSize(final int widthPixels, final int heightPixels) { - final String keyboardHeightString = ResourceUtils.getDeviceOverrideValue( - mResources, R.array.keyboard_heights); - final float keyboardHeight; - if (TextUtils.isEmpty(keyboardHeightString)) { - keyboardHeight = mResources.getDimension(R.dimen.keyboardHeight); - } else { - keyboardHeight = Float.parseFloat(keyboardHeightString) - * mResources.getDisplayMetrics().density; - } - final float maxKeyboardHeight = mResources.getFraction( - R.fraction.maxKeyboardHeight, heightPixels, heightPixels); - float minKeyboardHeight = mResources.getFraction( - R.fraction.minKeyboardHeight, heightPixels, heightPixels); - if (minKeyboardHeight < 0.0f) { - // Specified fraction was negative, so it should be calculated against display - // width. - minKeyboardHeight = -mResources.getFraction( - R.fraction.minKeyboardHeight, widthPixels, widthPixels); - } - // Keyboard height will not exceed maxKeyboardHeight and will not be less than - // minKeyboardHeight. - mParams.mKeyboardHeight = (int)Math.max( - Math.min(keyboardHeight, maxKeyboardHeight), minKeyboardHeight); - mParams.mKeyboardWidth = widthPixels; - } - public Builder setSubtype(final InputMethodSubtype subtype) { final boolean asciiCapable = subtype.containsExtraValueKey(ASCII_CAPABLE); @SuppressWarnings("deprecation") final boolean deprecatedForceAscii = InputAttributes.inPrivateImeOptions( - mPackageName, FORCE_ASCII, mEditorInfo); + mPackageName, FORCE_ASCII, mParams.mEditorInfo); final boolean forceAscii = EditorInfoCompatUtils.hasFlagForceAscii( mParams.mEditorInfo.imeOptions) || deprecatedForceAscii; @@ -302,9 +262,9 @@ public final class KeyboardLayoutSet { final boolean languageSwitchKeyEnabled) { @SuppressWarnings("deprecation") final boolean deprecatedNoMicrophone = InputAttributes.inPrivateImeOptions( - null, NO_MICROPHONE_COMPAT, mEditorInfo); + null, NO_MICROPHONE_COMPAT, mParams.mEditorInfo); final boolean noMicrophone = InputAttributes.inPrivateImeOptions( - mPackageName, NO_MICROPHONE, mEditorInfo) + mPackageName, NO_MICROPHONE, mParams.mEditorInfo) || deprecatedNoMicrophone; mParams.mVoiceKeyEnabled = voiceKeyEnabled && !noMicrophone; mParams.mVoiceKeyOnMain = voiceKeyOnMain; @@ -317,8 +277,6 @@ public final class KeyboardLayoutSet { } public KeyboardLayoutSet build() { - if (mParams.mOrientation == Configuration.ORIENTATION_UNDEFINED) - throw new RuntimeException("Screen geometry is not specified"); if (mParams.mSubtype == null) throw new RuntimeException("KeyboardLayoutSet subtype is not specified"); final String packageName = mResources.getResourcePackageName( @@ -442,51 +400,4 @@ public final class KeyboardLayoutSet { } } } - - public static KeyboardLayoutSet createKeyboardSetForSpellChecker(final Context context, - final String locale, final String layout) { - final InputMethodSubtype subtype = - AdditionalSubtypeUtils.createAdditionalSubtype(locale, layout, null); - return createKeyboardSet(context, subtype, SPELLCHECKER_DUMMY_KEYBOARD_WIDTH, - SPELLCHECKER_DUMMY_KEYBOARD_HEIGHT, false /* testCasesHaveTouchCoordinates */, - true /* isSpellChecker */); - } - - @UsedForTesting - public static KeyboardLayoutSet createKeyboardSetForTest(final Context context, - final InputMethodSubtype subtype, final int orientation, - final boolean testCasesHaveTouchCoordinates) { - final DisplayMetrics dm = context.getResources().getDisplayMetrics(); - final int width; - final int height; - if (orientation == Configuration.ORIENTATION_LANDSCAPE) { - width = Math.max(dm.widthPixels, dm.heightPixels); - height = Math.min(dm.widthPixels, dm.heightPixels); - } else if (orientation == Configuration.ORIENTATION_PORTRAIT) { - width = Math.min(dm.widthPixels, dm.heightPixels); - height = Math.max(dm.widthPixels, dm.heightPixels); - } else { - throw new RuntimeException("Orientation should be ORIENTATION_LANDSCAPE or " - + "ORIENTATION_PORTRAIT: orientation=" + orientation); - } - return createKeyboardSet(context, subtype, width, height, testCasesHaveTouchCoordinates, - false /* isSpellChecker */); - } - - private static KeyboardLayoutSet createKeyboardSet(final Context context, - final InputMethodSubtype subtype, final int width, final int height, - final boolean testCasesHaveTouchCoordinates, final boolean isSpellChecker) { - final EditorInfo editorInfo = new EditorInfo(); - editorInfo.inputType = InputType.TYPE_CLASS_TEXT; - final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder( - context, editorInfo); - builder.setScreenGeometry(width, height); - builder.setSubtype(subtype); - builder.setIsSpellChecker(isSpellChecker); - if (!testCasesHaveTouchCoordinates) { - // For spell checker and tests - builder.disableTouchPositionCorrectionData(); - } - return builder.build(); - } } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index 8880af48c..1ea0f8b96 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -20,7 +20,6 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.preference.PreferenceManager; -import android.util.DisplayMetrics; import android.util.Log; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; @@ -39,6 +38,7 @@ import com.android.inputmethod.latin.SubtypeSwitcher; import com.android.inputmethod.latin.WordComposer; import com.android.inputmethod.latin.settings.Settings; import com.android.inputmethod.latin.settings.SettingsValues; +import com.android.inputmethod.latin.utils.ResourceUtils; public final class KeyboardSwitcher implements KeyboardState.SwitchActions { private static final String TAG = KeyboardSwitcher.class.getSimpleName(); @@ -137,8 +137,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder( mThemeContext, editorInfo); final Resources res = mThemeContext.getResources(); - final DisplayMetrics dm = res.getDisplayMetrics(); - builder.setScreenGeometry(dm.widthPixels, dm.heightPixels); + final int keyboardWidth = ResourceUtils.getDefaultKeyboardWidth(res); + final int keyboardHeight = ResourceUtils.getDefaultKeyboardHeight(res); + builder.setKeyboardGeometry(keyboardWidth, keyboardHeight); builder.setSubtype(mSubtypeSwitcher.getCurrentSubtype()); builder.setOptions( settingsValues.isVoiceKeyEnabled(editorInfo), diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 054c503d8..28eb58573 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -196,13 +196,14 @@ public class KeyboardView extends View { @Override protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { - if (mKeyboard != null) { - // The main keyboard expands to the display width. - final int height = mKeyboard.mOccupiedHeight + getPaddingTop() + getPaddingBottom(); - setMeasuredDimension(widthMeasureSpec, height); - } else { + if (mKeyboard == null) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); + return; } + // The main keyboard expands to the entire this {@link KeyboardView}. + final int width = mKeyboard.mOccupiedWidth + getPaddingLeft() + getPaddingRight(); + final int height = mKeyboard.mOccupiedHeight + getPaddingTop() + getPaddingBottom(); + setMeasuredDimension(width, height); } @Override diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 6782317d0..526c2f1ec 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -615,7 +615,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap; mSpacebarTextSize = keyHeight * mSpacebarTextRatio; if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { - ResearchLogger.mainKeyboardView_setKeyboard(keyboard); + final int orientation = getContext().getResources().getConfiguration().orientation; + ResearchLogger.mainKeyboardView_setKeyboard(keyboard, orientation); } // This always needs to be set since the accessibility state can @@ -837,10 +838,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack mSlidingKeyInputPreview.dismissSlidingKeyInputPreview(); } - public void setGesturePreviewMode(final boolean drawsGestureTrail, - final boolean drawsGestureFloatingPreviewText) { - mGestureFloatingPreviewText.setPreviewEnabled(drawsGestureFloatingPreviewText); - mGestureTrailsPreview.setPreviewEnabled(drawsGestureTrail); + private void setGesturePreviewMode(final boolean isGestureTrailEnabled, + final boolean isGestureFloatingPreviewTextEnabled) { + mGestureFloatingPreviewText.setPreviewEnabled(isGestureFloatingPreviewTextEnabled); + mGestureTrailsPreview.setPreviewEnabled(isGestureTrailEnabled); } public void showGestureFloatingPreviewText(final SuggestedWords suggestedWords) { @@ -868,8 +869,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack PointerTracker.setMainDictionaryAvailability(mainDictionaryAvailable); } - public void setGestureHandlingEnabledByUser(final boolean gestureHandlingEnabledByUser) { - PointerTracker.setGestureHandlingEnabledByUser(gestureHandlingEnabledByUser); + public void setGestureHandlingEnabledByUser(final boolean isGestureHandlingEnabledByUser, + final boolean isGestureTrailEnabled, + final boolean isGestureFloatingPreviewTextEnabled) { + PointerTracker.setGestureHandlingEnabledByUser(isGestureHandlingEnabledByUser); + setGesturePreviewMode(isGestureHandlingEnabledByUser && isGestureTrailEnabled, + isGestureHandlingEnabledByUser && isGestureFloatingPreviewTextEnabled); } @Override @@ -973,9 +978,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack // {@link KeyboardView#showKeyPreview(PointerTracker)}. final int pointY = key.mY + mKeyPreviewDrawParams.mPreviewVisibleOffset; moreKeysPanel.showMoreKeysPanel(this, this, pointX, pointY, mKeyboardActionListener); - final int translatedX = moreKeysPanel.translateX(CoordinateUtils.x(lastCoords)); - final int translatedY = moreKeysPanel.translateY(CoordinateUtils.y(lastCoords)); - tracker.onShowMoreKeysPanel(translatedX, translatedY, moreKeysPanel); + tracker.onShowMoreKeysPanel(moreKeysPanel); } public boolean isInSlidingKeyInput() { diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java index 94f6a3cf2..f00f5a99e 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java @@ -198,12 +198,6 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel final int x = (int)me.getX(index); final int y = (int)me.getY(index); final int pointerId = me.getPointerId(index); - processMotionEvent(action, x, y, pointerId, eventTime); - return true; - } - - public void processMotionEvent(final int action, final int x, final int y, - final int pointerId, final long eventTime) { switch (action) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_POINTER_DOWN: @@ -217,6 +211,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel onMoveEvent(x, y, pointerId, eventTime); break; } + return true; } @Override diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index ab5fee99d..b66ee2a65 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -1282,12 +1282,12 @@ public final class PointerTracker implements PointerTrackerQueue.Element { } } - public void onShowMoreKeysPanel(final int translatedX, final int translatedY, - final MoreKeysPanel panel) { + public void onShowMoreKeysPanel(final MoreKeysPanel panel) { setReleasedKeyGraphics(mCurrentKey); - final long eventTime = SystemClock.uptimeMillis(); + final int translatedX = panel.translateX(mLastX); + final int translatedY = panel.translateY(mLastY); + panel.onDownEvent(translatedX, translatedY, mPointerId, SystemClock.uptimeMillis()); mMoreKeysPanel = panel; - mMoreKeysPanel.onDownEvent(translatedX, translatedY, mPointerId, eventTime); } @Override diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java index 69ffb4c75..dc815e57d 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java @@ -53,6 +53,7 @@ public final class KeyboardCodesSet { "key_action_previous", "key_shift_enter", "key_language_switch", + "key_emoji", "key_unspecified", "key_left_parenthesis", "key_right_parenthesis", @@ -89,6 +90,7 @@ public final class KeyboardCodesSet { Constants.CODE_ACTION_PREVIOUS, Constants.CODE_SHIFT_ENTER, Constants.CODE_LANGUAGE_SWITCH, + Constants.CODE_EMOJI, Constants.CODE_UNSPECIFIED, CODE_LEFT_PARENTHESIS, CODE_RIGHT_PARENTHESIS, @@ -116,6 +118,7 @@ public final class KeyboardCodesSet { DEFAULT[12], DEFAULT[13], DEFAULT[14], + DEFAULT[15], CODE_RIGHT_PARENTHESIS, CODE_LEFT_PARENTHESIS, CODE_GREATER_THAN_SIGN, diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java index 4e3f7618b..336db186e 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java @@ -56,6 +56,7 @@ public final class KeyboardIconsSet { "language_switch_key", R.styleable.Keyboard_iconLanguageSwitchKey, "zwnj_key", R.styleable.Keyboard_iconZwnjKey, "zwj_key", R.styleable.Keyboard_iconZwjKey, + "emoji_key", R.styleable.Keyboard_iconEmojiKey, }; private static int NUM_ICONS = NAMES_AND_ATTR_IDS.length / 2; diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java index 7bb7442f3..bb49f4758 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java @@ -27,18 +27,18 @@ import java.util.HashMap; /** * !!!!! DO NOT EDIT THIS FILE !!!!! * - * This file is generated by tools/maketext. The base template file is - * tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl + * This file is generated by tools/make-keyboard-text. The base template file is + * tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl * * This file must be updated when any text resources in keyboard layout files have been changed. * These text resources are referred as "!text/<resource_name>" in keyboard XML definitions, * and should be defined in - * tools/maketext/res/values-<locale>/donottranslate-more-keys.xml + * tools/make-keyboard-text/res/values-<locale>/donottranslate-more-keys.xml * * To update this file, please run the following commands. * $ cd $ANDROID_BUILD_TOP - * $ mmm packages/inputmethods/LatinIME/tools/maketext - * $ maketext -java packages/inputmethods/LatinIME/java/src + * $ mmm packages/inputmethods/LatinIME/tools/make-keyboard-text + * $ make-keyboard-text -java packages/inputmethods/LatinIME/java/src * * The updated source file will be generated to the following path (this file). * packages/inputmethods/LatinIME/java/src/com/android/inputmethod/keyboard/internal/ @@ -519,7 +519,7 @@ public final class KeyboardTextsSet { // U+061F: "؟" ARABIC QUESTION MARK // U+060C: "،" ARABIC COMMA // U+061B: "؛" ARABIC SEMICOLON - /* 53 */ "!fixedColumnOrder!8,\",\',#,-,:,!,\u060C,\u061F,@,&,\\%,+,\u061B,/,(,)", + /* 53 */ "!fixedColumnOrder!8,\",\',#,-,:,!,\u060C,\u061F,@,&,\\%,+,\u061B,/,(|),)|(", // U+2605: "★" BLACK STAR // U+066D: "٭" ARABIC FIVE POINTED STAR /* 54 */ "\u2605,\u066D", @@ -1408,7 +1408,7 @@ public final class KeyboardTextsSet { // U+061F: "؟" ARABIC QUESTION MARK // U+060C: "،" ARABIC COMMA // U+061B: "؛" ARABIC SEMICOLON - /* 53 */ "!fixedColumnOrder!8,\",\',#,-,:,!,\u060C,\u061F,@,&,\\%,+,\u061B,/,(,)", + /* 53 */ "!fixedColumnOrder!8,\",\',#,-,:,!,\u060C,\u061F,@,&,\\%,+,\u061B,/,(|),)|(", // U+2605: "★" BLACK STAR // U+066D: "٭" ARABIC FIVE POINTED STAR /* 54 */ "\u2605,\u066D", @@ -1900,8 +1900,9 @@ public final class KeyboardTextsSet { /* 48 */ "!text/single_laqm_raqm_rtl", /* 49 */ "!text/double_laqm_raqm_rtl", /* 50~ */ - null, null, null, null, - /* ~53 */ + null, null, null, + /* ~52 */ + /* 53 */ "!fixedColumnOrder!8,\",\',#,-,:,!,\\,,?,@,&,\\%,+,;,/,(|),)|(", // U+2605: "★" BLACK STAR /* 54 */ "\u2605", /* 55 */ null, @@ -3151,7 +3152,7 @@ public final class KeyboardTextsSet { /* 7 */ "\u00E7", }; - /* Language zz: No language */ + /* Language zz: Alphabet */ private static final String[] LANGUAGE_zz = { // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE @@ -3324,7 +3325,7 @@ public final class KeyboardTextsSet { "uk", LANGUAGE_uk, /* Ukrainian */ "vi", LANGUAGE_vi, /* Vietnamese */ "zu", LANGUAGE_zu, /* Zulu */ - "zz", LANGUAGE_zz, /* No language */ + "zz", LANGUAGE_zz, /* Alphabet */ }; static { diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java index fa301b5a6..d0a4afd50 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java @@ -235,7 +235,7 @@ final public class BinaryDictionaryGetter { new BinaryDictInputOutput.ByteBufferWrapper(inStream.getChannel().map( FileChannel.MapMode.READ_ONLY, 0, f.length())); final int magic = buffer.readInt(); - if (magic != FormatSpec.VERSION_2_MAGIC_NUMBER) { + if (magic != FormatSpec.MAGIC_NUMBER) { return false; } final int formatVersion = buffer.readInt(); diff --git a/java/src/com/android/inputmethod/latin/Constants.java b/java/src/com/android/inputmethod/latin/Constants.java index f91a21c7a..8aec03f71 100644 --- a/java/src/com/android/inputmethod/latin/Constants.java +++ b/java/src/com/android/inputmethod/latin/Constants.java @@ -187,6 +187,7 @@ public final class Constants { public static final int CODE_ACTION_NEXT = -8; public static final int CODE_ACTION_PREVIOUS = -9; public static final int CODE_LANGUAGE_SWITCH = -10; + public static final int CODE_EMOJI = -11; public static final int CODE_SHIFT_ENTER = -12; // Code value representing the code is not specified. public static final int CODE_UNSPECIFIED = -13; @@ -207,6 +208,7 @@ public final class Constants { case CODE_ACTION_NEXT: return "actionNext"; case CODE_ACTION_PREVIOUS: return "actionPrevious"; case CODE_LANGUAGE_SWITCH: return "languageSwitch"; + case CODE_EMOJI: return "emoji"; case CODE_SHIFT_ENTER: return "shiftEnter"; case CODE_UNSPECIFIED: return "unspec"; case CODE_TAB: return "tab"; diff --git a/java/src/com/android/inputmethod/latin/DictionaryWriter.java b/java/src/com/android/inputmethod/latin/DictionaryWriter.java index 8be04c1c0..47151bf61 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryWriter.java +++ b/java/src/com/android/inputmethod/latin/DictionaryWriter.java @@ -37,10 +37,9 @@ import java.util.HashMap; * An in memory dictionary for memorizing entries and writing a binary dictionary. */ public class DictionaryWriter extends AbstractDictionaryWriter { - // TODO: Regenerate version 3 binary dictionary. - private static final int BINARY_DICT_VERSION = 2; + private static final int BINARY_DICT_VERSION = 3; private static final FormatSpec.FormatOptions FORMAT_OPTIONS = - new FormatSpec.FormatOptions(BINARY_DICT_VERSION); + new FormatSpec.FormatOptions(BINARY_DICT_VERSION, true /* supportsDynamicUpdate */); private FusionDictionary mFusionDictionary; diff --git a/java/src/com/android/inputmethod/latin/InputView.java b/java/src/com/android/inputmethod/latin/InputView.java index 5359c8185..81ccf83d8 100644 --- a/java/src/com/android/inputmethod/latin/InputView.java +++ b/java/src/com/android/inputmethod/latin/InputView.java @@ -24,7 +24,7 @@ import android.view.View; import android.widget.LinearLayout; public final class InputView extends LinearLayout { - private View mSuggestionStripContainer; + private View mSuggestionStripView; private View mKeyboardView; private int mKeyboardTopPadding; @@ -33,33 +33,29 @@ public final class InputView extends LinearLayout { private final Rect mEventForwardingRect = new Rect(); private final Rect mEventReceivingRect = new Rect(); - public InputView(Context context, AttributeSet attrs) { + public InputView(final Context context, final AttributeSet attrs) { super(context, attrs, 0); } - public void setKeyboardGeometry(int keyboardTopPadding) { + public void setKeyboardGeometry(final int keyboardTopPadding) { mKeyboardTopPadding = keyboardTopPadding; } @Override protected void onFinishInflate() { - mSuggestionStripContainer = findViewById(R.id.suggestions_container); + mSuggestionStripView = findViewById(R.id.suggestion_strip_view); mKeyboardView = findViewById(R.id.keyboard_view); } @Override - public boolean dispatchTouchEvent(MotionEvent me) { - if (mSuggestionStripContainer.getVisibility() == VISIBLE - && mKeyboardView.getVisibility() == VISIBLE - && forwardTouchEvent(me)) { - return true; + public boolean dispatchTouchEvent(final MotionEvent me) { + if (mSuggestionStripView.getVisibility() != VISIBLE + || mKeyboardView.getVisibility() != VISIBLE) { + return super.dispatchTouchEvent(me); } - return super.dispatchTouchEvent(me); - } - // The touch events that hit the top padding of keyboard should be forwarded to - // {@link SuggestionStripView}. - private boolean forwardTouchEvent(MotionEvent me) { + // The touch events that hit the top padding of keyboard should be forwarded to + // {@link SuggestionStripView}. final Rect rect = mInputViewRect; this.getGlobalVisibleRect(rect); final int x = (int)me.getX() + rect.left; @@ -68,7 +64,7 @@ public final class InputView extends LinearLayout { final Rect forwardingRect = mEventForwardingRect; mKeyboardView.getGlobalVisibleRect(forwardingRect); if (!mIsForwardingEvent && !forwardingRect.contains(x, y)) { - return false; + return super.dispatchTouchEvent(me); } final int forwardingLimitY = forwardingRect.top + mKeyboardTopPadding; @@ -93,11 +89,11 @@ public final class InputView extends LinearLayout { } if (!sendToTarget) { - return false; + return super.dispatchTouchEvent(me); } final Rect receivingRect = mEventReceivingRect; - mSuggestionStripContainer.getGlobalVisibleRect(receivingRect); + mSuggestionStripView.getGlobalVisibleRect(receivingRect); final int translatedX = x - receivingRect.left; final int translatedY; if (y < forwardingLimitY) { @@ -107,7 +103,7 @@ public final class InputView extends LinearLayout { translatedY = y - receivingRect.top; } me.setLocation(translatedX, translatedY); - mSuggestionStripContainer.dispatchTouchEvent(me); + mSuggestionStripView.dispatchTouchEvent(me); return true; } } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 385e884ab..a7798e335 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -31,7 +31,6 @@ import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.Rect; import android.inputmethodservice.InputMethodService; import android.media.AudioManager; import android.net.ConnectivityManager; @@ -51,7 +50,6 @@ import android.util.Printer; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.View; -import android.view.ViewGroup.LayoutParams; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; @@ -76,6 +74,7 @@ import com.android.inputmethod.keyboard.MainKeyboardView; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.personalization.PersonalizationDictionaryHelper; +import com.android.inputmethod.latin.personalization.PersonalizationDictionarySessionRegister; import com.android.inputmethod.latin.personalization.PersonalizationPredictionDictionary; import com.android.inputmethod.latin.personalization.UserHistoryPredictionDictionary; import com.android.inputmethod.latin.settings.Settings; @@ -150,9 +149,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private final Settings mSettings; - private View mExtractArea; - private View mKeyPreviewBackingView; - private View mSuggestionsContainer; + private View mInputView; + private int mInputViewMinHeight; private SuggestionStripView mSuggestionStripView; // Never null private SuggestedWords mSuggestedWords = SuggestedWords.EMPTY; @@ -473,6 +471,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen KeyboardSwitcher.init(this); AudioAndHapticFeedbackManager.init(this); AccessibilityUtils.init(this); + PersonalizationDictionarySessionRegister.init(this); super.onCreate(); @@ -653,6 +652,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mOptionsDialog.dismiss(); } } + PersonalizationDictionarySessionRegister.onConfigurationChanged(this, conf); super.onConfigurationChanged(conf); } @@ -661,18 +661,25 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen return mKeyboardSwitcher.onCreateInputView(mIsHardwareAcceleratedDrawingEnabled); } + private void setInputViewMinHeight(final int minHeight) { + if (mInputView != null && mInputViewMinHeight != minHeight) { + mInputView.setMinimumHeight(minHeight); + mInputViewMinHeight = minHeight; + } + } + @Override - public void setInputView(final View view) { - super.setInputView(view); - mExtractArea = getWindow().getWindow().getDecorView() - .findViewById(android.R.id.extractArea); - mKeyPreviewBackingView = view.findViewById(R.id.key_preview_backing); - mSuggestionsContainer = view.findViewById(R.id.suggestions_container); - mSuggestionStripView = (SuggestionStripView)view.findViewById(R.id.suggestion_strip_view); - if (mSuggestionStripView != null) - mSuggestionStripView.setListener(this, view); + public void setInputView(final View inputView) { + super.setInputView(inputView); + mInputView = inputView; + setInputViewMinHeight(0); + mSuggestionStripView = (SuggestionStripView)inputView.findViewById( + R.id.suggestion_strip_view); + if (mSuggestionStripView != null) { + mSuggestionStripView.setListener(this, inputView); + } if (LatinImeLogger.sVISUALDEBUG) { - mKeyPreviewBackingView.setBackgroundColor(0x10FF0000); + inputView.setBackgroundColor(0x10FF0000); } } @@ -848,8 +855,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mainKeyboardView.setSlidingKeyInputPreviewEnabled( currentSettingsValues.mSlidingKeyInputPreviewEnabled); mainKeyboardView.setGestureHandlingEnabledByUser( - currentSettingsValues.mGestureInputEnabled); - mainKeyboardView.setGesturePreviewMode(currentSettingsValues.mGesturePreviewTrailEnabled, + currentSettingsValues.mGestureInputEnabled, + currentSettingsValues.mGestureTrailEnabled, currentSettingsValues.mGestureFloatingPreviewTextEnabled); // If we have a user dictionary addition in progress, we should check now if we should @@ -1111,19 +1118,24 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private void setSuggestionStripShownInternal(final boolean shown, final boolean needsInputViewShown) { // TODO: Modify this if we support suggestions with hard keyboard - if (onEvaluateInputViewShown() && mSuggestionsContainer != null) { + if (onEvaluateInputViewShown() && mSuggestionStripView != null) { final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); final boolean inputViewShown = (mainKeyboardView != null) ? mainKeyboardView.isShown() : false; final boolean shouldShowSuggestions = shown && (needsInputViewShown ? inputViewShown : true); if (isFullscreenMode()) { - mSuggestionsContainer.setVisibility( + mSuggestionStripView.setVisibility( shouldShowSuggestions ? View.VISIBLE : View.GONE); } else { - mSuggestionsContainer.setVisibility( + mSuggestionStripView.setVisibility( shouldShowSuggestions ? View.VISIBLE : View.INVISIBLE); } + if (shouldShowSuggestions && mainKeyboardView != null) { + final int remainingHeight = getWindow().getWindow().getDecorView().getHeight() + - mainKeyboardView.getHeight() - mSuggestionStripView.getHeight(); + mSuggestionStripView.setMoreSuggestionsHeight(remainingHeight); + } } } @@ -1131,64 +1143,37 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen setSuggestionStripShownInternal(shown, /* needsInputViewShown */true); } - private int getAdjustedBackingViewHeight() { - final int currentHeight = mKeyPreviewBackingView.getHeight(); - if (currentHeight > 0) { - return currentHeight; - } - - final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); - if (mainKeyboardView == null) { - return 0; - } - final int keyboardHeight = mainKeyboardView.getHeight(); - final int suggestionsHeight = mSuggestionsContainer.getHeight(); - final int displayHeight = getResources().getDisplayMetrics().heightPixels; - final Rect rect = new Rect(); - mKeyPreviewBackingView.getWindowVisibleDisplayFrame(rect); - final int notificationBarHeight = rect.top; - final int remainingHeight = displayHeight - notificationBarHeight - suggestionsHeight - - keyboardHeight; - - final LayoutParams params = mKeyPreviewBackingView.getLayoutParams(); - params.height = mSuggestionStripView.setMoreSuggestionsHeight(remainingHeight); - mKeyPreviewBackingView.setLayoutParams(params); - return params.height; - } - @Override public void onComputeInsets(final InputMethodService.Insets outInsets) { super.onComputeInsets(outInsets); final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); - if (mainKeyboardView == null || mSuggestionsContainer == null) { + if (mainKeyboardView == null || mSuggestionStripView == null) { return; } - final int adjustedBackingHeight = getAdjustedBackingViewHeight(); - final boolean backingGone = (mKeyPreviewBackingView.getVisibility() == View.GONE); - final int backingHeight = backingGone ? 0 : adjustedBackingHeight; - // In fullscreen mode, the height of the extract area managed by InputMethodService should - // be considered. - // See {@link android.inputmethodservice.InputMethodService#onComputeInsets}. - final int extractHeight = isFullscreenMode() ? mExtractArea.getHeight() : 0; - final int suggestionsHeight = (mSuggestionsContainer.getVisibility() == View.GONE) ? 0 - : mSuggestionsContainer.getHeight(); - final int extraHeight = extractHeight + backingHeight + suggestionsHeight; - int visibleTopY = extraHeight; + // This method is never called when in fullscreen mode. + // The contentTop is the top coordinate of the keyboard. The application behind will be + // resized/panned above this coordibnate to be able to show an input field. + final int contentTop = mInputView.getHeight() - mainKeyboardView.getHeight(); + final int suggestionsHeight = (mSuggestionStripView.getVisibility() == View.VISIBLE) + ? mSuggestionStripView.getHeight() : 0; + // The visibleTop is the top coordinates of the visible part of this IME. The application + // behind will never be resized, but may be panned or scrolled. + final int visibleTop = mainKeyboardView.isShowingMoreKeysPanel() ? 0 + : contentTop - suggestionsHeight; + outInsets.contentTopInsets = contentTop; + outInsets.visibleTopInsets = visibleTop; // Need to set touchable region only if input view is being shown if (mainKeyboardView.isShown()) { - if (mSuggestionsContainer.getVisibility() == View.VISIBLE) { - visibleTopY -= suggestionsHeight; - } - final int touchY = mainKeyboardView.isShowingMoreKeysPanel() ? 0 : visibleTopY; - final int touchWidth = mainKeyboardView.getWidth(); - final int touchHeight = mainKeyboardView.getHeight() + extraHeight + final int touchLeft = 0; + final int touchTop = visibleTop; + final int touchRight = touchLeft + mainKeyboardView.getWidth(); + final int touchBottom = contentTop + mainKeyboardView.getHeight() // Extend touchable region below the keyboard. + EXTENDED_TOUCHABLE_REGION_HEIGHT; + // The touch event on touchableRegion will be delivered to this IME. + outInsets.touchableRegion.set(touchLeft, touchTop, touchRight, touchBottom); outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_REGION; - outInsets.touchableRegion.set(0, touchY, touchWidth, touchHeight); } - outInsets.contentTopInsets = visibleTopY; - outInsets.visibleTopInsets = visibleTopY; } @Override @@ -1211,11 +1196,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen @Override public void updateFullscreenMode() { super.updateFullscreenMode(); - - if (mKeyPreviewBackingView == null) return; - // In fullscreen mode, no need to have extra space to show the key preview. - // If not, we should have extra space above the keyboard to show the key preview. - mKeyPreviewBackingView.setVisibility(isFullscreenMode() ? View.GONE : View.VISIBLE); + if (!isFullscreenMode()) { + // Expand the input view to cover entire display to be able to show key previews and + // more suggestions view that may be displayed above the keyboard. + setInputViewMinHeight(getResources().getDisplayMetrics().heightPixels); + } } // This will reset the whole input state to the starting state. It will clear @@ -1512,6 +1497,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen case Constants.CODE_LANGUAGE_SWITCH: handleLanguageSwitchKey(); break; + case Constants.CODE_EMOJI: + // TODO: Implement emoji keyboard switch. + break; case Constants.CODE_ENTER: final EditorInfo editorInfo = getCurrentInputEditorInfo(); final int imeOptionsActionId = @@ -2529,7 +2517,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen final int maxFreq = AutoCorrectionUtils.getMaxFrequency( suggest.getUnigramDictionaries(), suggestion); if (maxFreq == 0) return null; - userHistoryPredictionDictionary.addToUserHistory(prevWord, secondWord, maxFreq > 0); + userHistoryPredictionDictionary + .addToPersonalizationPredictionDictionary(prevWord, secondWord, maxFreq > 0); return prevWord; } diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index b69e3f8d2..35920f8cb 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -654,9 +654,11 @@ public final class RichInputConnection { + "\"" + periodSpace + "\" just before the cursor."); return false; } + // Double-space results in ". ". A backspace to cancel this should result in a single + // space in the text field, so we replace ". " with a single space. deleteSurroundingText(2, 0); - final String doubleSpace = " "; - commitText(doubleSpace, 1); + final String singleSpace = " "; + commitText(singleSpace, 1); if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_revertDoubleSpacePeriod(); } diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java index 167c6915c..c7b063daf 100644 --- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java +++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java @@ -145,21 +145,21 @@ public final class BinaryDictIOUtils { * Reads unigrams and bigrams from the binary file. * Doesn't make the memory representation of the dictionary. * - * @param buffer the buffer to read. + * @param reader the reader. * @param words the map to store the address as a key and the word as a value. * @param frequencies the map to store the address as a key and the frequency as a value. * @param bigrams the map to store the address as a key and the list of address as a value. * @throws IOException * @throws UnsupportedFormatException */ - public static void readUnigramsAndBigramsBinary(final FusionDictionaryBufferInterface buffer, + public static void readUnigramsAndBigramsBinary(final BinaryDictReader reader, final Map<Integer, String> words, final Map<Integer, Integer> frequencies, final Map<Integer, ArrayList<PendingAttribute>> bigrams) throws IOException, UnsupportedFormatException { // Read header - final FileHeader header = BinaryDictInputOutput.readHeader(buffer); - readUnigramsAndBigramsBinaryInner(buffer, header.mHeaderSize, words, frequencies, bigrams, - header.mFormatOptions); + final FileHeader header = BinaryDictInputOutput.readHeader(reader.getBuffer()); + readUnigramsAndBigramsBinaryInner(reader.getBuffer(), header.mHeaderSize, words, + frequencies, bigrams, header.mFormatOptions); } /** diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java index 1b187d85d..504349a0b 100644 --- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java +++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java @@ -66,6 +66,7 @@ public final class BinaryDictInputOutput { public void position(int newPosition); public void put(final byte b); public int limit(); + @UsedForTesting public int capacity(); } @@ -1210,49 +1211,38 @@ public final class BinaryDictInputOutput { ByteArrayOutputStream headerBuffer = new ByteArrayOutputStream(256); // The magic number in big-endian order. - if (version >= FormatSpec.FIRST_VERSION_WITH_HEADER_SIZE) { - // Magic number for version 2+. - headerBuffer.write((byte) (0xFF & (FormatSpec.VERSION_2_MAGIC_NUMBER >> 24))); - headerBuffer.write((byte) (0xFF & (FormatSpec.VERSION_2_MAGIC_NUMBER >> 16))); - headerBuffer.write((byte) (0xFF & (FormatSpec.VERSION_2_MAGIC_NUMBER >> 8))); - headerBuffer.write((byte) (0xFF & FormatSpec.VERSION_2_MAGIC_NUMBER)); - // Dictionary version. - headerBuffer.write((byte) (0xFF & (version >> 8))); - headerBuffer.write((byte) (0xFF & version)); - } else { - // Magic number for version 1. - headerBuffer.write((byte) (0xFF & (FormatSpec.VERSION_1_MAGIC_NUMBER >> 8))); - headerBuffer.write((byte) (0xFF & FormatSpec.VERSION_1_MAGIC_NUMBER)); - // Dictionary version. - headerBuffer.write((byte) (0xFF & version)); - } + // Magic number for all versions. + headerBuffer.write((byte) (0xFF & (FormatSpec.MAGIC_NUMBER >> 24))); + headerBuffer.write((byte) (0xFF & (FormatSpec.MAGIC_NUMBER >> 16))); + headerBuffer.write((byte) (0xFF & (FormatSpec.MAGIC_NUMBER >> 8))); + headerBuffer.write((byte) (0xFF & FormatSpec.MAGIC_NUMBER)); + // Dictionary version. + headerBuffer.write((byte) (0xFF & (version >> 8))); + headerBuffer.write((byte) (0xFF & version)); + // Options flags final int options = makeOptionsValue(dict, formatOptions); headerBuffer.write((byte) (0xFF & (options >> 8))); headerBuffer.write((byte) (0xFF & options)); - if (version >= FormatSpec.FIRST_VERSION_WITH_HEADER_SIZE) { - final int headerSizeOffset = headerBuffer.size(); - // Placeholder to be written later with header size. - for (int i = 0; i < 4; ++i) { - headerBuffer.write(0); - } - // Write out the options. - for (final String key : dict.mOptions.mAttributes.keySet()) { - final String value = dict.mOptions.mAttributes.get(key); - CharEncoding.writeString(headerBuffer, key); - CharEncoding.writeString(headerBuffer, value); - } - final int size = headerBuffer.size(); - final byte[] bytes = headerBuffer.toByteArray(); - // Write out the header size. - bytes[headerSizeOffset] = (byte) (0xFF & (size >> 24)); - bytes[headerSizeOffset + 1] = (byte) (0xFF & (size >> 16)); - bytes[headerSizeOffset + 2] = (byte) (0xFF & (size >> 8)); - bytes[headerSizeOffset + 3] = (byte) (0xFF & (size >> 0)); - destination.write(bytes); - } else { - headerBuffer.writeTo(destination); - } + final int headerSizeOffset = headerBuffer.size(); + // Placeholder to be written later with header size. + for (int i = 0; i < 4; ++i) { + headerBuffer.write(0); + } + // Write out the options. + for (final String key : dict.mOptions.mAttributes.keySet()) { + final String value = dict.mOptions.mAttributes.get(key); + CharEncoding.writeString(headerBuffer, key); + CharEncoding.writeString(headerBuffer, value); + } + final int size = headerBuffer.size(); + final byte[] bytes = headerBuffer.toByteArray(); + // Write out the header size. + bytes[headerSizeOffset] = (byte) (0xFF & (size >> 24)); + bytes[headerSizeOffset + 1] = (byte) (0xFF & (size >> 16)); + bytes[headerSizeOffset + 2] = (byte) (0xFF & (size >> 8)); + bytes[headerSizeOffset + 3] = (byte) (0xFF & (size >> 0)); + destination.write(bytes); headerBuffer.close(); @@ -1658,10 +1648,8 @@ public final class BinaryDictInputOutput { */ private static int getFormatVersion(final FusionDictionaryBufferInterface buffer) throws IOException { - final int magic_v1 = buffer.readUnsignedShort(); - if (FormatSpec.VERSION_1_MAGIC_NUMBER == magic_v1) return buffer.readUnsignedByte(); - final int magic_v2 = (magic_v1 << 16) + buffer.readUnsignedShort(); - if (FormatSpec.VERSION_2_MAGIC_NUMBER == magic_v2) return buffer.readUnsignedShort(); + final int magic = buffer.readInt(); + if (FormatSpec.MAGIC_NUMBER == magic) return buffer.readUnsignedShort(); return FormatSpec.NOT_A_VERSION_NUMBER; } @@ -1695,18 +1683,15 @@ public final class BinaryDictInputOutput { final HashMap<String, String> attributes = new HashMap<String, String>(); final int headerSize; - if (version < FormatSpec.FIRST_VERSION_WITH_HEADER_SIZE) { - headerSize = buffer.position(); - } else { - headerSize = buffer.readInt(); - populateOptions(buffer, headerSize, attributes); - buffer.position(headerSize); - } + headerSize = buffer.readInt(); if (headerSize < 0) { throw new UnsupportedFormatException("header size can't be negative."); } + populateOptions(buffer, headerSize, attributes); + buffer.position(headerSize); + final FileHeader header = new FileHeader(headerSize, new FusionDictionary.DictionaryOptions(attributes, 0 != (optionsFlags & FormatSpec.GERMAN_UMLAUT_PROCESSING_FLAG), @@ -1738,23 +1723,30 @@ public final class BinaryDictInputOutput { * FusionDictionary structure. The optional dict argument is an existing dictionary to * which words from the buffer should be added. If it is null, a new dictionary is created. * - * @param buffer the buffer to read. + * @param reader the reader. * @param dict an optional dictionary to add words to, or null. * @return the created (or merged) dictionary. */ @UsedForTesting - public static FusionDictionary readDictionaryBinary( - final FusionDictionaryBufferInterface buffer, final FusionDictionary dict) - throws IOException, UnsupportedFormatException { + public static FusionDictionary readDictionaryBinary(final BinaryDictReader reader, + final FusionDictionary dict) throws FileNotFoundException, IOException, + UnsupportedFormatException { // clear cache wordCache.clear(); + // if the buffer has not been opened, open the buffer with bytebuffer. + if (reader.getBuffer() == null) reader.openBuffer( + new BinaryDictReader.FusionDictionaryBufferFromByteBufferFactory()); + if (reader.getBuffer() == null) { + MakedictLog.e("Cannot open the buffer"); + } + // Read header - final FileHeader header = readHeader(buffer); + final FileHeader header = readHeader(reader.getBuffer()); Map<Integer, Node> reverseNodeMapping = new TreeMap<Integer, Node>(); Map<Integer, CharGroup> reverseGroupMapping = new TreeMap<Integer, CharGroup>(); - final Node root = readNode(buffer, header.mHeaderSize, reverseNodeMapping, + final Node root = readNode(reader.getBuffer(), header.mHeaderSize, reverseNodeMapping, reverseGroupMapping, header.mFormatOptions); FusionDictionary newDict = new FusionDictionary(root, header.mDictionaryOptions); diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictReader.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictReader.java new file mode 100644 index 000000000..57a583228 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictReader.java @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.latin.makedict; + +import com.android.inputmethod.annotations.UsedForTesting; +import com.android.inputmethod.latin.makedict.BinaryDictInputOutput.FusionDictionaryBufferInterface; +import com.android.inputmethod.latin.utils.ByteArrayWrapper; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.FileChannel; + +public class BinaryDictReader { + + public interface FusionDictionaryBufferFactory { + public FusionDictionaryBufferInterface getFusionDictionaryBuffer(final File file) + throws FileNotFoundException, IOException; + } + + /** + * Creates FusionDictionaryBuffer from a ByteBuffer + */ + public static final class FusionDictionaryBufferFromByteBufferFactory + implements FusionDictionaryBufferFactory { + @Override + public FusionDictionaryBufferInterface getFusionDictionaryBuffer(final File file) + throws FileNotFoundException, IOException { + FileInputStream inStream = null; + ByteBuffer buffer = null; + try { + inStream = new FileInputStream(file); + buffer = inStream.getChannel().map(FileChannel.MapMode.READ_ONLY, + 0, file.length()); + } finally { + if (inStream != null) { + inStream.close(); + } + } + if (buffer != null) { + return new BinaryDictInputOutput.ByteBufferWrapper(buffer); + } + return null; + } + } + + /** + * Creates FusionDictionaryBuffer from a byte array + */ + public static final class FusionDictionaryBufferFromByteArrayFactory + implements FusionDictionaryBufferFactory { + @Override + public FusionDictionaryBufferInterface getFusionDictionaryBuffer(final File file) + throws FileNotFoundException, IOException { + FileInputStream inStream = null; + try { + inStream = new FileInputStream(file); + final byte[] array = new byte[(int) file.length()]; + inStream.read(array); + return new ByteArrayWrapper(array); + } finally { + if (inStream != null) { + inStream.close(); + } + } + } + } + + private final File mDictionaryBinaryFile; + private FusionDictionaryBufferInterface mFusionDictionaryBuffer; + + public BinaryDictReader(final File file) { + mDictionaryBinaryFile = file; + mFusionDictionaryBuffer = null; + } + + public void openBuffer(final FusionDictionaryBufferFactory factory) + throws FileNotFoundException, IOException { + mFusionDictionaryBuffer = factory.getFusionDictionaryBuffer(mDictionaryBinaryFile); + } + + public FusionDictionaryBufferInterface getBuffer() { + return mFusionDictionaryBuffer; + } + + @UsedForTesting + public FusionDictionaryBufferInterface openAndGetBuffer( + final FusionDictionaryBufferFactory factory) + throws FileNotFoundException, IOException { + openBuffer(factory); + return getBuffer(); + } +} diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java index feadcda76..2bb5d8b6e 100644 --- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java @@ -16,6 +16,7 @@ package com.android.inputmethod.latin.makedict; +import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions; @@ -25,6 +26,40 @@ import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions public final class FormatSpec { /* + * File header layout is as follows: + * + * v | + * e | MAGIC_NUMBER + version of the file format, 2 bytes. + * r | + * sion + * + * o | + * p | not used 4 bits + * t | has bigrams ? 1 bit, 1 = yes, 0 = no : CONTAINS_BIGRAMS_FLAG + * i | FRENCH_LIGATURE_PROCESSING_FLAG + * o | supports dynamic updates ? 1 bit, 1 = yes, 0 = no : SUPPORTS_DYNAMIC_UPDATE + * n | GERMAN_UMLAUT_PROCESSING_FLAG + * f | + * lags + * + * h | + * e | size of the file header, 4bytes + * a | including the size of the magic number, the option flags and the header size + * d | + * ersize + * + * | attributes list + * + * attributes list is: + * <key> = | string of characters at the char format described below, with the terminator used + * | to signal the end of the string. + * <value> = | string of characters at the char format described below, with the terminator used + * | to signal the end of the string. + * if the size of already read < headersize, goto key. + * + */ + + /* * Array of Node(FusionDictionary.Node) layout is as follows: * * g | @@ -150,12 +185,10 @@ public final class FormatSpec { * if (FLAG_ATTRIBUTE_HAS_NEXT goto flags */ - static final int VERSION_1_MAGIC_NUMBER = 0x78B1; - public static final int VERSION_2_MAGIC_NUMBER = 0x9BC13AFE; - static final int MINIMUM_SUPPORTED_VERSION = 1; + public static final int MAGIC_NUMBER = 0x9BC13AFE; + static final int MINIMUM_SUPPORTED_VERSION = 2; static final int MAXIMUM_SUPPORTED_VERSION = 3; static final int NOT_A_VERSION_NUMBER = -1; - static final int FIRST_VERSION_WITH_HEADER_SIZE = 2; static final int FIRST_VERSION_WITH_DYNAMIC_UPDATE = 3; // These options need to be the same numeric values as the one in the native reading code. @@ -236,9 +269,12 @@ public final class FormatSpec { public static final class FormatOptions { public final int mVersion; public final boolean mSupportsDynamicUpdate; + @UsedForTesting public FormatOptions(final int version) { this(version, false); } + + @UsedForTesting public FormatOptions(final int version, final boolean supportsDynamicUpdate) { mVersion = version; if (version < FIRST_VERSION_WITH_DYNAMIC_UPDATE && supportsDynamicUpdate) { diff --git a/java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java b/java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java index 9d041f4eb..065e00e4a 100644 --- a/java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java +++ b/java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java @@ -28,9 +28,10 @@ import com.android.inputmethod.latin.ExpandableDictionary; import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.WordComposer; +import com.android.inputmethod.latin.makedict.BinaryDictReader; import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; import com.android.inputmethod.latin.settings.Settings; -import com.android.inputmethod.latin.utils.ByteArrayWrapper; +import com.android.inputmethod.latin.utils.CollectionUtils; import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils; import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils.BigramDictionaryInterface; import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils.OnAddWordListener; @@ -38,7 +39,6 @@ import com.android.inputmethod.latin.utils.UserHistoryForgettingCurveUtils; import com.android.inputmethod.latin.utils.UserHistoryForgettingCurveUtils.ForgettingCurveParams; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; @@ -49,9 +49,6 @@ import java.util.concurrent.locks.ReentrantLock; * This class is a base class of a dictionary for the personalized prediction language model. */ public abstract class DynamicPredictionDictionaryBase extends ExpandableDictionary { - public static void registerUpdateListener(PersonalizationDictionaryUpdateListener listener) { - // TODO: Implement - } private static final String TAG = DynamicPredictionDictionaryBase.class.getSimpleName(); public static final boolean DBG_SAVE_RESTORE = false; @@ -75,8 +72,11 @@ public abstract class DynamicPredictionDictionaryBase extends ExpandableDictiona private final ReentrantLock mBigramListLock = new ReentrantLock(); private final SharedPreferences mPrefs; + private final ArrayList<PersonalizationDictionaryUpdateSession> mSessions = + CollectionUtils.newArrayList(); + // Should always be false except when we use this class for test - @UsedForTesting boolean isTest = false; + @UsedForTesting boolean mIsTest = false; /* package */ DynamicPredictionDictionaryBase(final Context context, final String locale, final SharedPreferences sp, final String dictionaryType) { @@ -118,14 +118,15 @@ public abstract class DynamicPredictionDictionaryBase extends ExpandableDictiona } /** - * Pair will be added to the user history dictionary. + * Pair will be added to the personalization prediction dictionary. * * The first word may be null. That means we don't know the context, in other words, * it's only a unigram. The first word may also be an empty string : this means start * context, as in beginning of a sentence for example. * The second word may not be null (a NullPointerException would be thrown). */ - public int addToUserHistory(final String word1, final String word2, final boolean isValid) { + public int addToPersonalizationPredictionDictionary( + final String word1, final String word2, final boolean isValid) { if (word2.length() >= Constants.DICTIONARY_MAX_WORD_LENGTH || (word1 != null && word1.length() >= Constants.DICTIONARY_MAX_WORD_LENGTH)) { return -1; @@ -232,27 +233,17 @@ public abstract class DynamicPredictionDictionaryBase extends ExpandableDictiona }; // Load the dictionary from binary file - FileInputStream inStream = null; + final BinaryDictReader reader = new BinaryDictReader( + new File(getContext().getFilesDir(), fileName)); try { - final File file = new File(getContext().getFilesDir(), fileName); - final byte[] buffer = new byte[(int)file.length()]; - inStream = new FileInputStream(file); - inStream.read(buffer); - UserHistoryDictIOUtils.readDictionaryBinary( - new ByteArrayWrapper(buffer), listener); + reader.openBuffer(new BinaryDictReader.FusionDictionaryBufferFromByteArrayFactory()); + UserHistoryDictIOUtils.readDictionaryBinary(reader, listener); } catch (FileNotFoundException e) { // This is an expected condition: we don't have a user history dictionary for this // language yet. It will be created sometime later. } catch (IOException e) { Log.e(TAG, "IOException on opening a bytebuffer", e); } finally { - if (inStream != null) { - try { - inStream.close(); - } catch (IOException e) { - // do nothing - } - } if (PROFILE_SAVE_RESTORE) { final long diff = System.currentTimeMillis() - now; Log.d(TAG, "PROF: Load UserHistoryDictionary: " @@ -296,8 +287,8 @@ public abstract class DynamicPredictionDictionaryBase extends ExpandableDictiona @Override protected Void doInBackground(final Void... v) { - if (mDynamicPredictionDictionary.isTest) { - // If isTest == true, wait until the lock is released. + if (mDynamicPredictionDictionary.mIsTest) { + // If mIsTest == true, wait until the lock is released. mDynamicPredictionDictionary.mBigramListLock.lock(); try { doWriteTaskLocked(); @@ -393,9 +384,19 @@ public abstract class DynamicPredictionDictionaryBase extends ExpandableDictiona final String word1, final String word2, final boolean isValid) { mBigramListLock.lock(); try { - addToUserHistory(word1, word2, isValid); + addToPersonalizationPredictionDictionary(word1, word2, isValid); } finally { mBigramListLock.unlock(); } } + + public void registerUpdateSession(PersonalizationDictionaryUpdateSession session) { + session.setPredictionDictionary(mLocale, this); + mSessions.add(session); + session.onDictionaryReady(); + } + + public void unRegisterUpdateSession(PersonalizationDictionaryUpdateSession session) { + mSessions.remove(session); + } } diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionary.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionary.java index 19554d639..e38a235e9 100644 --- a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionary.java +++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionary.java @@ -27,7 +27,7 @@ import android.content.Context; public class PersonalizationDictionary extends ExpandableBinaryDictionary { private static final String NAME = "personalization"; - public static void registerUpdateListener(PersonalizationDictionaryUpdateListener listener) { + public static void registerUpdateListener(PersonalizationDictionaryUpdateSession listener) { // TODO: Implement } diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryHelper.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryHelper.java index 9f013df1c..b4fd25024 100644 --- a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryHelper.java +++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryHelper.java @@ -20,6 +20,7 @@ import com.android.inputmethod.latin.utils.CollectionUtils; import android.content.Context; import android.content.SharedPreferences; +import android.preference.PreferenceManager; import android.util.Log; import java.lang.ref.SoftReference; @@ -58,6 +59,15 @@ public class PersonalizationDictionaryHelper { } } + public static void registerPersonalizationDictionaryUpdateSession(final Context context, + final PersonalizationDictionaryUpdateSession session) { + final PersonalizationPredictionDictionary dictionary = + getPersonalizationPredictionDictionary(context, + context.getResources().getConfiguration().locale.toString(), + PreferenceManager.getDefaultSharedPreferences(context)); + dictionary.registerUpdateSession(session); + } + public static PersonalizationPredictionDictionary getPersonalizationPredictionDictionary( final Context context, final String locale, final SharedPreferences sp) { synchronized (sLangPersonalizationDictCache) { diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateListener.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionarySessionRegister.java index c78e5a95b..534d3c518 100644 --- a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateListener.java +++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionarySessionRegister.java @@ -16,6 +16,13 @@ package com.android.inputmethod.latin.personalization; -public interface PersonalizationDictionaryUpdateListener { - // TODO: Implement +import android.content.Context; +import android.content.res.Configuration; + +public class PersonalizationDictionarySessionRegister { + public static void init(Context context) { + } + + public static void onConfigurationChanged(final Context context, final Configuration conf) { + } } diff --git a/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateSession.java b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateSession.java new file mode 100644 index 000000000..e9dbbc273 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/personalization/PersonalizationDictionaryUpdateSession.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.latin.personalization; + +import java.lang.ref.WeakReference; +import java.util.ArrayList; + +/** + * This class is a session where a data provider can communicate with a personalization + * dictionary. + */ +public abstract class PersonalizationDictionaryUpdateSession { + /** + * This class is a parameter for a new unigram or bigram word which will be added + * to the personalization dictionary. + */ + public static class PersonalizationLanguageModelParam { + public final String mWord0; + public final String mWord1; + public final boolean mIsValid; + public final int mFrequency; + public PersonalizationLanguageModelParam(String word0, String word1, boolean isValid, + int frequency) { + mWord0 = word0; + mWord1 = word1; + mIsValid = isValid; + mFrequency = frequency; + } + } + + // TODO: Use a dynamic binary dictionary instead + public WeakReference<DynamicPredictionDictionaryBase> mPredictionDictionary; + public String mLocale; + + public abstract void onDictionaryReady(); + + public void setPredictionDictionary(String locale, DynamicPredictionDictionaryBase dictionary) { + mPredictionDictionary = new WeakReference<DynamicPredictionDictionaryBase>(dictionary); + mLocale = locale; + } + + protected DynamicPredictionDictionaryBase getPredictionDictionary() { + return mPredictionDictionary == null ? null : mPredictionDictionary.get(); + } + + private void unsetPredictionDictionary() { + final DynamicPredictionDictionaryBase dictionary = getPredictionDictionary(); + if (dictionary == null) { + return; + } + dictionary.unRegisterUpdateSession(this); + } + + + public void closeSession() { + unsetPredictionDictionary(); + } + + public void addToPersonalizationDictionary( + final ArrayList<PersonalizationLanguageModelParam> lmParams) { + final DynamicPredictionDictionaryBase dictionary = getPredictionDictionary(); + if (dictionary == null) { + return; + } + for (final PersonalizationLanguageModelParam lmParam : lmParams) { + dictionary.addToPersonalizationPredictionDictionary( + lmParam.mWord0, lmParam.mWord1, lmParam.mIsValid); + } + } +} diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java index 446777704..1677e1828 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java @@ -229,10 +229,10 @@ public final class SettingsFragment extends InputMethodSettingsFragment if (!Settings.readFromBuildConfigIfGestureInputEnabled(res)) { removePreference(Settings.PREF_GESTURE_SETTINGS, getPreferenceScreen()); - } else { - AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this); } + AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this); + setupKeyLongpressTimeoutSettings(prefs, res); setupKeypressVibrationDurationSettings(prefs, res); setupKeypressSoundVolumeSettings(prefs, res); diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java index 8aafb0738..a25cf620c 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java @@ -71,7 +71,7 @@ public final class SettingsValues { // Use bigrams to predict the next word when there is no input for it yet public final boolean mBigramPredictionEnabled; public final boolean mGestureInputEnabled; - public final boolean mGesturePreviewTrailEnabled; + public final boolean mGestureTrailEnabled; public final boolean mGestureFloatingPreviewTextEnabled; public final boolean mSlidingKeyInputPreviewEnabled; public final int mKeyLongpressTimeout; @@ -157,7 +157,7 @@ public final class SettingsValues { mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff); mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain); mGestureInputEnabled = Settings.readGestureInputEnabled(prefs, res); - mGesturePreviewTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true); + mGestureTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true); mGestureFloatingPreviewTextEnabled = prefs.getBoolean( Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true); mCorrectionEnabled = mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect; diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java index 692e7392c..eb6d7c106 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java @@ -20,7 +20,10 @@ import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.service.textservice.SpellCheckerService; +import android.text.InputType; import android.util.Log; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodSubtype; import android.view.textservice.SuggestionsInfo; import com.android.inputmethod.keyboard.KeyboardLayoutSet; @@ -33,6 +36,7 @@ import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.SynchronouslyLoadedContactsBinaryDictionary; import com.android.inputmethod.latin.SynchronouslyLoadedUserBinaryDictionary; import com.android.inputmethod.latin.UserBinaryDictionary; +import com.android.inputmethod.latin.utils.AdditionalSubtypeUtils; import com.android.inputmethod.latin.utils.CollectionUtils; import com.android.inputmethod.latin.utils.LocaleUtils; import com.android.inputmethod.latin.utils.StringUtils; @@ -58,6 +62,9 @@ public final class AndroidSpellCheckerService extends SpellCheckerService public static final String PREF_USE_CONTACTS_KEY = "pref_spellcheck_use_contacts"; + private static final int SPELLCHECKER_DUMMY_KEYBOARD_WIDTH = 480; + private static final int SPELLCHECKER_DUMMY_KEYBOARD_HEIGHT = 368; + private final static String[] EMPTY_STRING_ARRAY = new String[0]; private Map<String, DictionaryPool> mDictionaryPools = CollectionUtils.newSynchronizedTreeMap(); private Map<String, UserBinaryDictionary> mUserDictionaries = @@ -401,9 +408,9 @@ public final class AndroidSpellCheckerService extends SpellCheckerService public DictAndKeyboard createDictAndKeyboard(final Locale locale) { final int script = getScriptFromLocale(locale); final String keyboardLayoutName = getKeyboardLayoutNameForScript(script); - final KeyboardLayoutSet keyboardLayoutSet = - KeyboardLayoutSet.createKeyboardSetForSpellChecker(this, locale.toString(), - keyboardLayoutName); + final InputMethodSubtype subtype = AdditionalSubtypeUtils.createAdditionalSubtype( + locale.toString(), keyboardLayoutName, null); + final KeyboardLayoutSet keyboardLayoutSet = createKeyboardSetForSpellChecker(subtype); final DictionaryCollection dictionaryCollection = DictionaryFactory.createMainDictionaryFromManager(this, locale, @@ -431,4 +438,16 @@ public final class AndroidSpellCheckerService extends SpellCheckerService } return new DictAndKeyboard(dictionaryCollection, keyboardLayoutSet); } + + private KeyboardLayoutSet createKeyboardSetForSpellChecker(final InputMethodSubtype subtype) { + final EditorInfo editorInfo = new EditorInfo(); + editorInfo.inputType = InputType.TYPE_CLASS_TEXT; + final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder(this, editorInfo); + builder.setKeyboardGeometry( + SPELLCHECKER_DUMMY_KEYBOARD_WIDTH, SPELLCHECKER_DUMMY_KEYBOARD_HEIGHT); + builder.setSubtype(subtype); + builder.setIsSpellChecker(true /* isSpellChecker */); + builder.disableTouchPositionCorrectionData(); + return builder.build(); + } } diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java index 1dd04fc4d..bcf64a8e8 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java @@ -177,20 +177,9 @@ final class SuggestionStripLayoutHelper { return mMaxMoreSuggestionsRow; } - private int getMoreSuggestionsHeight() { - return mMaxMoreSuggestionsRow * mMoreSuggestionsRowHeight + mMoreSuggestionsBottomGap; - } - - public int setMoreSuggestionsHeight(final int remainingHeight) { - final int currentHeight = getMoreSuggestionsHeight(); - if (currentHeight <= remainingHeight) { - return currentHeight; - } - + public void setMoreSuggestionsHeight(final int remainingHeight) { mMaxMoreSuggestionsRow = (remainingHeight - mMoreSuggestionsBottomGap) / mMoreSuggestionsRowHeight; - final int newHeight = getMoreSuggestionsHeight(); - return newHeight; } private static Drawable getMoreSuggestionsHint(final Resources res, final float textSize, diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java index 497a791d9..2644f3c9c 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java @@ -135,8 +135,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick } } - public int setMoreSuggestionsHeight(final int remainingHeight) { - return mLayoutHelper.setMoreSuggestionsHeight(remainingHeight); + public void setMoreSuggestionsHeight(final int remainingHeight) { + mLayoutHelper.setMoreSuggestionsHeight(remainingHeight); } public boolean isShowingAddToDictionaryHint() { @@ -270,15 +270,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick return super.dispatchTouchEvent(me); } - final MoreKeysPanel moreKeysPanel = mMoreSuggestionsView; final int action = me.getAction(); - final long eventTime = me.getEventTime(); final int index = me.getActionIndex(); - final int id = me.getPointerId(index); final int x = (int)me.getX(index); final int y = (int)me.getY(index); - final int translatedX = moreKeysPanel.translateX(x); - final int translatedY = moreKeysPanel.translateY(y); if (mMoreSuggestionsMode == MORE_SUGGESTIONS_CHECKING_MODAL_OR_SLIDING) { if (Math.abs(x - mOriginX) >= mMoreSuggestionsModalTolerance @@ -295,7 +290,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick } // MORE_SUGGESTIONS_IN_SLIDING_MODE - mMoreSuggestionsView.processMotionEvent(action, translatedX, translatedY, id, eventTime); + me.setLocation(mMoreSuggestionsView.translateX(x), mMoreSuggestionsView.translateY(y)); + mMoreSuggestionsView.onTouchEvent(me); return true; } diff --git a/java/src/com/android/inputmethod/latin/utils/ResourceUtils.java b/java/src/com/android/inputmethod/latin/utils/ResourceUtils.java index ffec57548..22c92446a 100644 --- a/java/src/com/android/inputmethod/latin/utils/ResourceUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/ResourceUtils.java @@ -20,10 +20,12 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.os.Build; import android.text.TextUtils; +import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; import com.android.inputmethod.annotations.UsedForTesting; +import com.android.inputmethod.latin.R; import java.util.ArrayList; import java.util.HashMap; @@ -215,6 +217,35 @@ public final class ResourceUtils { return null; } + public static int getDefaultKeyboardWidth(final Resources res) { + final DisplayMetrics dm = res.getDisplayMetrics(); + return dm.widthPixels; + } + + public static int getDefaultKeyboardHeight(final Resources res) { + final DisplayMetrics dm = res.getDisplayMetrics(); + final String keyboardHeightString = getDeviceOverrideValue(res, R.array.keyboard_heights); + final float keyboardHeight; + if (TextUtils.isEmpty(keyboardHeightString)) { + keyboardHeight = res.getDimension(R.dimen.keyboardHeight); + } else { + keyboardHeight = Float.parseFloat(keyboardHeightString) * dm.density; + } + final float maxKeyboardHeight = res.getFraction( + R.fraction.maxKeyboardHeight, dm.heightPixels, dm.heightPixels); + float minKeyboardHeight = res.getFraction( + R.fraction.minKeyboardHeight, dm.heightPixels, dm.heightPixels); + if (minKeyboardHeight < 0.0f) { + // Specified fraction was negative, so it should be calculated against display + // width. + minKeyboardHeight = -res.getFraction( + R.fraction.minKeyboardHeight, dm.widthPixels, dm.widthPixels); + } + // Keyboard height will not exceed maxKeyboardHeight and will not be less than + // minKeyboardHeight. + return (int)Math.max(Math.min(keyboardHeight, maxKeyboardHeight), minKeyboardHeight); + } + public static boolean isValidFraction(final float fraction) { return fraction >= 0.0f; } diff --git a/java/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtils.java b/java/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtils.java index d02f7187e..a0ad27cfb 100644 --- a/java/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtils.java @@ -21,7 +21,7 @@ import android.util.Log; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.latin.makedict.BinaryDictIOUtils; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput; -import com.android.inputmethod.latin.makedict.BinaryDictInputOutput.FusionDictionaryBufferInterface; +import com.android.inputmethod.latin.makedict.BinaryDictReader; import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.FusionDictionary.Node; @@ -118,13 +118,13 @@ public final class UserHistoryDictIOUtils { /** * Reads dictionary from file. */ - public static void readDictionaryBinary(final FusionDictionaryBufferInterface buffer, + public static void readDictionaryBinary(final BinaryDictReader reader, final OnAddWordListener dict) { final Map<Integer, String> unigrams = CollectionUtils.newTreeMap(); final Map<Integer, Integer> frequencies = CollectionUtils.newTreeMap(); final Map<Integer, ArrayList<PendingAttribute>> bigrams = CollectionUtils.newTreeMap(); try { - BinaryDictIOUtils.readUnigramsAndBigramsBinary(buffer, unigrams, frequencies, + BinaryDictIOUtils.readUnigramsAndBigramsBinary(reader, unigrams, frequencies, bigrams); } catch (IOException e) { Log.e(TAG, "IO exception while reading file", e); diff --git a/java/src/com/android/inputmethod/latin/utils/UserLogRingCharBuffer.java b/java/src/com/android/inputmethod/latin/utils/UserLogRingCharBuffer.java index 161386e2e..a75d353c9 100644 --- a/java/src/com/android/inputmethod/latin/utils/UserLogRingCharBuffer.java +++ b/java/src/com/android/inputmethod/latin/utils/UserLogRingCharBuffer.java @@ -19,6 +19,7 @@ package com.android.inputmethod.latin.utils; import android.inputmethodservice.InputMethodService; import com.android.inputmethod.annotations.UsedForTesting; +import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.settings.Settings; public final class UserLogRingCharBuffer { @@ -64,6 +65,9 @@ public final class UserLogRingCharBuffer { if (!mEnabled) { return; } + if (LatinImeLogger.sUsabilityStudy) { + UsabilityStudyLogUtils.getInstance().writeChar(c, x, y); + } mCharBuf[mEnd] = c; mXBuf[mEnd] = x; mYBuf[mEnd] = y; diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java index 0bd493970..3a3408266 100644 --- a/java/src/com/android/inputmethod/research/ResearchLogger.java +++ b/java/src/com/android/inputmethod/research/ResearchLogger.java @@ -1414,7 +1414,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang "navigatePrevious", "clobberSettingsKey", "passwordInput", "shortcutKeyEnabled", "hasShortcutKey", "languageSwitchKeyEnabled", "isMultiLine", "tw", "th", "keys"); - public static void mainKeyboardView_setKeyboard(final Keyboard keyboard) { + public static void mainKeyboardView_setKeyboard(final Keyboard keyboard, + final int orientation) { final KeyboardId kid = keyboard.mId; final boolean isPasswordView = kid.passwordInput(); final ResearchLogger researchLogger = getInstance(); @@ -1422,7 +1423,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang researchLogger.enqueueEvent(LOGSTATEMENT_MAINKEYBOARDVIEW_SETKEYBOARD, KeyboardId.elementIdToName(kid.mElementId), kid.mLocale + ":" + kid.mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET), - kid.mOrientation, kid.mWidth, KeyboardId.modeName(kid.mMode), kid.imeAction(), + orientation, kid.mWidth, KeyboardId.modeName(kid.mMode), kid.imeAction(), kid.navigateNext(), kid.navigatePrevious(), kid.mClobberSettingsKey, isPasswordView, kid.mShortcutKeyEnabled, kid.mHasShortcutKey, kid.mLanguageSwitchKeyEnabled, kid.isMultiLine(), keyboard.mOccupiedWidth, diff --git a/native/jni/Android.mk b/native/jni/Android.mk index acd230ff2..a0c1c68ff 100644 --- a/native/jni/Android.mk +++ b/native/jni/Android.mk @@ -54,9 +54,6 @@ LATIN_IME_CORE_SRC_FILES := \ $(addprefix suggest/core/dictionary/, \ bigram_dictionary.cpp \ binary_dictionary_format_utils.cpp \ - binary_dictionary_header.cpp \ - binary_dictionary_header_reading_utils.cpp \ - binary_dictionary_terminal_attributes_reading_utils.cpp \ bloom_filter.cpp \ byte_array_utils.cpp \ dictionary.cpp \ @@ -71,7 +68,14 @@ LATIN_IME_CORE_SRC_FILES := \ suggest/core/policy/weighting.cpp \ suggest/core/session/dic_traverse_session.cpp \ $(addprefix suggest/policyimpl/dictionary/, \ + bigram/bigram_list_reading_utils.cpp \ + header/header_policy.cpp \ + header/header_reading_utils.cpp \ + shortcut/shortcut_list_reading_utils.cpp \ + dictionary_structure_with_buffer_policy_factory.cpp \ + dynamic_patricia_trie_node_reader.cpp \ dynamic_patricia_trie_policy.cpp \ + dynamic_patricia_trie_reading_utils.cpp \ patricia_trie_policy.cpp \ patricia_trie_reading_utils.cpp) \ suggest/policyimpl/gesture/gesture_suggest_policy_factory.cpp \ diff --git a/native/jni/src/suggest/core/dicnode/dic_node_proximity_filter.h b/native/jni/src/suggest/core/dicnode/dic_node_proximity_filter.h index 1a39f2ef3..c7ab571de 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node_proximity_filter.h +++ b/native/jni/src/suggest/core/dicnode/dic_node_proximity_filter.h @@ -20,11 +20,11 @@ #include "defines.h" #include "suggest/core/layout/proximity_info_state.h" #include "suggest/core/layout/proximity_info_utils.h" -#include "suggest/core/policy/dictionary_structure_policy.h" +#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h" namespace latinime { -class DicNodeProximityFilter : public DictionaryStructurePolicy::NodeFilter { +class DicNodeProximityFilter : public DictionaryStructureWithBufferPolicy::NodeFilter { public: DicNodeProximityFilter(const ProximityInfoState *const pInfoState, const int pointIndex, const bool exactOnly) diff --git a/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp b/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp index 6b4ef2fea..150eb6762 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp +++ b/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp @@ -21,10 +21,9 @@ #include "suggest/core/dicnode/dic_node.h" #include "suggest/core/dicnode/dic_node_proximity_filter.h" #include "suggest/core/dicnode/dic_node_vector.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" #include "suggest/core/dictionary/multi_bigram_map.h" #include "suggest/core/dictionary/probability_utils.h" -#include "suggest/core/policy/dictionary_structure_policy.h" +#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h" #include "utils/char_utils.h" namespace latinime { @@ -33,17 +32,17 @@ namespace latinime { // Node initialization utils // /////////////////////////////// -/* static */ void DicNodeUtils::initAsRoot(const BinaryDictionaryInfo *const binaryDictionaryInfo, +/* static */ void DicNodeUtils::initAsRoot( + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, const int prevWordNodePos, DicNode *const newRootNode) { - newRootNode->initAsRoot(binaryDictionaryInfo->getStructurePolicy()->getRootPosition(), - prevWordNodePos); + newRootNode->initAsRoot(dictionaryStructurePolicy->getRootPosition(), prevWordNodePos); } /*static */ void DicNodeUtils::initAsRootWithPreviousWord( - const BinaryDictionaryInfo *const binaryDictionaryInfo, + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, DicNode *const prevWordLastNode, DicNode *const newRootNode) { newRootNode->initAsRootWithPreviousWord( - prevWordLastNode, binaryDictionaryInfo->getStructurePolicy()->getRootPosition()); + prevWordLastNode, dictionaryStructurePolicy->getRootPosition()); } /* static */ void DicNodeUtils::initByCopy(DicNode *srcNode, DicNode *destNode) { @@ -67,12 +66,13 @@ namespace latinime { } /* static */ void DicNodeUtils::getAllChildDicNodes(DicNode *dicNode, - const BinaryDictionaryInfo *const binaryDictionaryInfo, DicNodeVector *childDicNodes) { - getProximityChildDicNodes(dicNode, binaryDictionaryInfo, 0, 0, false, childDicNodes); + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, + DicNodeVector *childDicNodes) { + getProximityChildDicNodes(dicNode, dictionaryStructurePolicy, 0, 0, false, childDicNodes); } /* static */ void DicNodeUtils::getProximityChildDicNodes(DicNode *dicNode, - const BinaryDictionaryInfo *const binaryDictionaryInfo, + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, const ProximityInfoState *pInfoState, const int pointIndex, bool exactOnly, DicNodeVector *childDicNodes) { if (dicNode->isTotalInputSizeExceedingLimit()) { @@ -82,8 +82,8 @@ namespace latinime { if (!dicNode->isLeavingNode()) { DicNodeUtils::createAndGetPassingChildNode(dicNode, &childrenFilter, childDicNodes); } else { - binaryDictionaryInfo->getStructurePolicy()->createAndGetAllChildNodes(dicNode, - binaryDictionaryInfo, &childrenFilter, childDicNodes); + dictionaryStructurePolicy->createAndGetAllChildNodes(dicNode, + &childrenFilter, childDicNodes); } } @@ -94,12 +94,13 @@ namespace latinime { * Computes the combined bigram / unigram cost for the given dicNode. */ /* static */ float DicNodeUtils::getBigramNodeImprobability( - const BinaryDictionaryInfo *const binaryDictionaryInfo, + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, const DicNode *const node, MultiBigramMap *multiBigramMap) { if (node->hasMultipleWords() && !node->isValidMultipleWordSuggestion()) { return static_cast<float>(MAX_VALUE_FOR_WEIGHTING); } - const int probability = getBigramNodeProbability(binaryDictionaryInfo, node, multiBigramMap); + const int probability = getBigramNodeProbability(dictionaryStructurePolicy, node, + multiBigramMap); // TODO: This equation to calculate the improbability looks unreasonable. Investigate this. const float cost = static_cast<float>(MAX_PROBABILITY - probability) / static_cast<float>(MAX_PROBABILITY); @@ -107,7 +108,7 @@ namespace latinime { } /* static */ int DicNodeUtils::getBigramNodeProbability( - const BinaryDictionaryInfo *const binaryDictionaryInfo, + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, const DicNode *const node, MultiBigramMap *multiBigramMap) { const int unigramProbability = node->getProbability(); const int wordPos = node->getPos(); @@ -118,8 +119,8 @@ namespace latinime { return ProbabilityUtils::backoff(unigramProbability); } if (multiBigramMap) { - return multiBigramMap->getBigramProbability( - binaryDictionaryInfo, prevWordPos, wordPos, unigramProbability); + return multiBigramMap->getBigramProbability(dictionaryStructurePolicy, prevWordPos, + wordPos, unigramProbability); } return ProbabilityUtils::backoff(unigramProbability); } diff --git a/native/jni/src/suggest/core/dicnode/dic_node_utils.h b/native/jni/src/suggest/core/dicnode/dic_node_utils.h index 4f12b29f4..8dc984fe1 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node_utils.h +++ b/native/jni/src/suggest/core/dicnode/dic_node_utils.h @@ -23,10 +23,10 @@ namespace latinime { -class BinaryDictionaryInfo; class DicNode; class DicNodeProximityFilter; class DicNodeVector; +class DictionaryStructureWithBufferPolicy; class ProximityInfoState; class MultiBigramMap; @@ -34,18 +34,22 @@ class DicNodeUtils { public: static int appendTwoWords(const int *src0, const int16_t length0, const int *src1, const int16_t length1, int *dest); - static void initAsRoot(const BinaryDictionaryInfo *const binaryDictionaryInfo, + static void initAsRoot( + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, const int prevWordNodePos, DicNode *newRootNode); - static void initAsRootWithPreviousWord(const BinaryDictionaryInfo *const binaryDictionaryInfo, + static void initAsRootWithPreviousWord( + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, DicNode *prevWordLastNode, DicNode *newRootNode); static void initByCopy(DicNode *srcNode, DicNode *destNode); static void getAllChildDicNodes(DicNode *dicNode, - const BinaryDictionaryInfo *const binaryDictionaryInfo, DicNodeVector *childDicNodes); - static float getBigramNodeImprobability(const BinaryDictionaryInfo *const binaryDictionaryInfo, + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, + DicNodeVector *childDicNodes); + static float getBigramNodeImprobability( + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, const DicNode *const node, MultiBigramMap *const multiBigramMap); // TODO: Move to private static void getProximityChildDicNodes(DicNode *dicNode, - const BinaryDictionaryInfo *const binaryDictionaryInfo, + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, const ProximityInfoState *pInfoState, const int pointIndex, bool exactOnly, DicNodeVector *childDicNodes); @@ -54,7 +58,8 @@ class DicNodeUtils { // Max number of bigrams to look up static const int MAX_BIGRAMS_CONSIDERED_PER_CONTEXT = 500; - static int getBigramNodeProbability(const BinaryDictionaryInfo *const binaryDictionaryInfo, + static int getBigramNodeProbability( + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy, const DicNode *const node, MultiBigramMap *multiBigramMap); static void createAndGetPassingChildNode(DicNode *dicNode, const DicNodeProximityFilter *const childrenFilter, DicNodeVector *childDicNodes); diff --git a/native/jni/src/suggest/core/dictionary/bigram_dictionary.cpp b/native/jni/src/suggest/core/dictionary/bigram_dictionary.cpp index 3751ae500..ebe76467a 100644 --- a/native/jni/src/suggest/core/dictionary/bigram_dictionary.cpp +++ b/native/jni/src/suggest/core/dictionary/bigram_dictionary.cpp @@ -22,15 +22,16 @@ #include "defines.h" #include "suggest/core/dictionary/binary_dictionary_bigrams_iterator.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" #include "suggest/core/dictionary/dictionary.h" #include "suggest/core/dictionary/probability_utils.h" +#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h" #include "utils/char_utils.h" namespace latinime { -BigramDictionary::BigramDictionary(const BinaryDictionaryInfo *const binaryDictionaryInfo) - : mBinaryDictionaryInfo(binaryDictionaryInfo) { +BigramDictionary::BigramDictionary( + const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy) + : mDictionaryStructurePolicy(dictionaryStructurePolicy) { if (DEBUG_DICT) { AKLOGI("BigramDictionary - constructor"); } @@ -112,13 +113,13 @@ int BigramDictionary::getPredictions(const int *prevWord, const int prevWordLeng int bigramCount = 0; int unigramProbability = 0; int bigramBuffer[MAX_WORD_LENGTH]; - BinaryDictionaryBigramsIterator bigramsIt(mBinaryDictionaryInfo, pos); + BinaryDictionaryBigramsIterator bigramsIt( + mDictionaryStructurePolicy->getBigramsStructurePolicy(), pos); while (bigramsIt.hasNext()) { bigramsIt.next(); - const int length = mBinaryDictionaryInfo->getStructurePolicy()-> - getCodePointsAndProbabilityAndReturnCodePointCount( - mBinaryDictionaryInfo, bigramsIt.getBigramPos(), MAX_WORD_LENGTH, - bigramBuffer, &unigramProbability); + const int length = mDictionaryStructurePolicy-> + getCodePointsAndProbabilityAndReturnCodePointCount(bigramsIt.getBigramPos(), + MAX_WORD_LENGTH, bigramBuffer, &unigramProbability); // Due to space constraints, the probability for bigrams is approximate - the lower the // unigram probability, the worse the precision. The theoritical maximum error in // resulting probability is 8 - although in the practice it's never bigger than 3 or 4 @@ -138,11 +139,10 @@ int BigramDictionary::getPredictions(const int *prevWord, const int prevWordLeng int BigramDictionary::getBigramListPositionForWord(const int *prevWord, const int prevWordLength, const bool forceLowerCaseSearch) const { if (0 >= prevWordLength) return NOT_A_DICT_POS; - int pos = mBinaryDictionaryInfo->getStructurePolicy()->getTerminalNodePositionOfWord( - mBinaryDictionaryInfo, prevWord, prevWordLength, forceLowerCaseSearch); + int pos = mDictionaryStructurePolicy->getTerminalNodePositionOfWord(prevWord, prevWordLength, + forceLowerCaseSearch); if (NOT_A_VALID_WORD_POS == pos) return NOT_A_DICT_POS; - return mBinaryDictionaryInfo->getStructurePolicy()->getBigramsPositionOfNode( - mBinaryDictionaryInfo, pos); + return mDictionaryStructurePolicy->getBigramsPositionOfNode(pos); } bool BigramDictionary::isValidBigram(const int *word0, int length0, const int *word1, @@ -150,11 +150,12 @@ bool BigramDictionary::isValidBigram(const int *word0, int length0, const int *w int pos = getBigramListPositionForWord(word0, length0, false /* forceLowerCaseSearch */); // getBigramListPositionForWord returns 0 if this word isn't in the dictionary or has no bigrams if (NOT_A_DICT_POS == pos) return false; - int nextWordPos = mBinaryDictionaryInfo->getStructurePolicy()->getTerminalNodePositionOfWord( - mBinaryDictionaryInfo, word1, length1, false /* forceLowerCaseSearch */); + int nextWordPos = mDictionaryStructurePolicy->getTerminalNodePositionOfWord(word1, length1, + false /* forceLowerCaseSearch */); if (NOT_A_VALID_WORD_POS == nextWordPos) return false; - BinaryDictionaryBigramsIterator bigramsIt(mBinaryDictionaryInfo, pos); + BinaryDictionaryBigramsIterator bigramsIt( + mDictionaryStructurePolicy->getBigramsStructurePolicy(), pos); while (bigramsIt.hasNext()) { bigramsIt.next(); if (bigramsIt.getBigramPos() == nextWordPos) { diff --git a/native/jni/src/suggest/core/dictionary/bigram_dictionary.h b/native/jni/src/suggest/core/dictionary/bigram_dictionary.h index 438c34cac..99b964c49 100644 --- a/native/jni/src/suggest/core/dictionary/bigram_dictionary.h +++ b/native/jni/src/suggest/core/dictionary/bigram_dictionary.h @@ -21,11 +21,11 @@ namespace latinime { -class BinaryDictionaryInfo; +class DictionaryStructureWithBufferPolicy; class BigramDictionary { public: - BigramDictionary(const BinaryDictionaryInfo *const binaryDictionaryInfo); + BigramDictionary(const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy); int getPredictions(const int *word, int length, int *outBigramCodePoints, int *outBigramProbability, int *outputTypes) const; @@ -40,7 +40,7 @@ class BigramDictionary { int getBigramListPositionForWord(const int *prevWord, const int prevWordLength, const bool forceLowerCaseSearch) const; - const BinaryDictionaryInfo *const mBinaryDictionaryInfo; + const DictionaryStructureWithBufferPolicy *const mDictionaryStructurePolicy; }; } // namespace latinime #endif // LATINIME_BIGRAM_DICTIONARY_H diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_bigrams_iterator.h b/native/jni/src/suggest/core/dictionary/binary_dictionary_bigrams_iterator.h index 8cbb12998..d16ac47fe 100644 --- a/native/jni/src/suggest/core/dictionary/binary_dictionary_bigrams_iterator.h +++ b/native/jni/src/suggest/core/dictionary/binary_dictionary_bigrams_iterator.h @@ -18,51 +18,41 @@ #define LATINIME_BINARY_DICTIONARY_BIGRAMS_ITERATOR_H #include "defines.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" -#include "suggest/core/dictionary/binary_dictionary_terminal_attributes_reading_utils.h" +#include "suggest/core/policy/dictionary_bigrams_structure_policy.h" namespace latinime { class BinaryDictionaryBigramsIterator { public: BinaryDictionaryBigramsIterator( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int pos) - : mBinaryDictionaryInfo(binaryDictionaryInfo), mPos(pos), mBigramFlags(0), - mBigramPos(NOT_A_DICT_POS), mHasNext(pos != NOT_A_DICT_POS) {} + const DictionaryBigramsStructurePolicy *const bigramsStructurePolicy, const int pos) + : mBigramsStructurePolicy(bigramsStructurePolicy), mPos(pos), + mBigramPos(NOT_A_DICT_POS), mProbability(NOT_A_PROBABILITY), + mHasNext(pos != NOT_A_DICT_POS) {} AK_FORCE_INLINE bool hasNext() const { return mHasNext; } AK_FORCE_INLINE void next() { - mBigramFlags = BinaryDictionaryTerminalAttributesReadingUtils::getFlagsAndForwardPointer( - mBinaryDictionaryInfo, &mPos); - mBigramPos = - BinaryDictionaryTerminalAttributesReadingUtils::getBigramAddressAndForwardPointer( - mBinaryDictionaryInfo, mBigramFlags, &mPos); - mHasNext = BinaryDictionaryTerminalAttributesReadingUtils::hasNext(mBigramFlags); + mBigramsStructurePolicy->getNextBigram(&mBigramPos, &mProbability, &mHasNext, &mPos); } AK_FORCE_INLINE int getProbability() const { - return BinaryDictionaryTerminalAttributesReadingUtils::getProbabilityFromFlags( - mBigramFlags); + return mProbability; } AK_FORCE_INLINE int getBigramPos() const { return mBigramPos; } - AK_FORCE_INLINE int getFlags() const { - return mBigramFlags; - } - private: DISALLOW_COPY_AND_ASSIGN(BinaryDictionaryBigramsIterator); - const BinaryDictionaryInfo *const mBinaryDictionaryInfo; + const DictionaryBigramsStructurePolicy *const mBigramsStructurePolicy; int mPos; - BinaryDictionaryTerminalAttributesReadingUtils::BigramFlags mBigramFlags; int mBigramPos; + int mProbability; bool mHasNext; }; } // namespace latinime diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_format_utils.cpp b/native/jni/src/suggest/core/dictionary/binary_dictionary_format_utils.cpp index 5d14a0554..15f2aa630 100644 --- a/native/jni/src/suggest/core/dictionary/binary_dictionary_format_utils.cpp +++ b/native/jni/src/suggest/core/dictionary/binary_dictionary_format_utils.cpp @@ -16,6 +16,8 @@ #include "suggest/core/dictionary/binary_dictionary_format_utils.h" +#include "suggest/core/dictionary/byte_array_utils.h" + namespace latinime { /** @@ -27,7 +29,6 @@ const int BinaryDictionaryFormatUtils::DICTIONARY_MINIMUM_SIZE = 4; /** * Format versions */ - // The versions of Latin IME that only handle format version 1 only test for the magic // number, so we had to change it so that version 2 files would be rejected by older // implementations. On this occasion, we made the magic number 32 bits long. @@ -61,8 +62,7 @@ const int BinaryDictionaryFormatUtils::HEADER_VERSION_2_MINIMUM_SIZE = 12; if (ByteArrayUtils::readUint16(dict, 4) == 2) { return VERSION_2; } else if (ByteArrayUtils::readUint16(dict, 4) == 3) { - // TODO: Support version 3 dictionary. - return UNKNOWN_VERSION; + return VERSION_3; } else { return UNKNOWN_VERSION; } diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_format_utils.h b/native/jni/src/suggest/core/dictionary/binary_dictionary_format_utils.h index 830684c70..62c7376e1 100644 --- a/native/jni/src/suggest/core/dictionary/binary_dictionary_format_utils.h +++ b/native/jni/src/suggest/core/dictionary/binary_dictionary_format_utils.h @@ -20,7 +20,6 @@ #include <stdint.h> #include "defines.h" -#include "suggest/core/dictionary/byte_array_utils.h" namespace latinime { diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_header.cpp b/native/jni/src/suggest/core/dictionary/binary_dictionary_header.cpp deleted file mode 100644 index 91c643a5f..000000000 --- a/native/jni/src/suggest/core/dictionary/binary_dictionary_header.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2013, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "suggest/core/dictionary/binary_dictionary_header.h" - -#include "defines.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" - -namespace latinime { - -const char *const BinaryDictionaryHeader::MULTIPLE_WORDS_DEMOTION_RATE_KEY = - "MULTIPLE_WORDS_DEMOTION_RATE"; -const float BinaryDictionaryHeader::DEFAULT_MULTI_WORD_COST_MULTIPLIER = 1.0f; -const float BinaryDictionaryHeader::MULTI_WORD_COST_MULTIPLIER_SCALE = 100.0f; - -BinaryDictionaryHeader::BinaryDictionaryHeader( - const BinaryDictionaryInfo *const binaryDictionaryInfo) - : mBinaryDictionaryInfo(binaryDictionaryInfo), - mDictionaryFlags(BinaryDictionaryHeaderReadingUtils::getFlags(binaryDictionaryInfo)), - mSize(BinaryDictionaryHeaderReadingUtils::getHeaderSize(binaryDictionaryInfo)), - mMultiWordCostMultiplier(readMultiWordCostMultiplier()) {} - -float BinaryDictionaryHeader::readMultiWordCostMultiplier() const { - const int headerValue = BinaryDictionaryHeaderReadingUtils::readHeaderValueInt( - mBinaryDictionaryInfo, MULTIPLE_WORDS_DEMOTION_RATE_KEY); - if (headerValue == S_INT_MIN) { - // not found - return DEFAULT_MULTI_WORD_COST_MULTIPLIER; - } - if (headerValue <= 0) { - return static_cast<float>(MAX_VALUE_FOR_WEIGHTING); - } - return MULTI_WORD_COST_MULTIPLIER_SCALE / static_cast<float>(headerValue); -} - -} // namespace latinime diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_header_reading_utils.cpp b/native/jni/src/suggest/core/dictionary/binary_dictionary_header_reading_utils.cpp deleted file mode 100644 index a57b0f859..000000000 --- a/native/jni/src/suggest/core/dictionary/binary_dictionary_header_reading_utils.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2013, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "suggest/core/dictionary/binary_dictionary_header_reading_utils.h" - -#include <cctype> -#include <cstdlib> - -#include "defines.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" - -namespace latinime { - -const int BinaryDictionaryHeaderReadingUtils::MAX_OPTION_KEY_LENGTH = 256; - -const int BinaryDictionaryHeaderReadingUtils::VERSION_2_HEADER_MAGIC_NUMBER_SIZE = 4; -const int BinaryDictionaryHeaderReadingUtils::VERSION_2_HEADER_DICTIONARY_VERSION_SIZE = 2; -const int BinaryDictionaryHeaderReadingUtils::VERSION_2_HEADER_FLAG_SIZE = 2; -const int BinaryDictionaryHeaderReadingUtils::VERSION_2_HEADER_SIZE_FIELD_SIZE = 4; - -const BinaryDictionaryHeaderReadingUtils::DictionaryFlags - BinaryDictionaryHeaderReadingUtils::NO_FLAGS = 0; -// Flags for special processing -// Those *must* match the flags in makedict (BinaryDictInputOutput#*_PROCESSING_FLAG) or -// something very bad (like, the apocalypse) will happen. Please update both at the same time. -const BinaryDictionaryHeaderReadingUtils::DictionaryFlags - BinaryDictionaryHeaderReadingUtils::GERMAN_UMLAUT_PROCESSING_FLAG = 0x1; -const BinaryDictionaryHeaderReadingUtils::DictionaryFlags - BinaryDictionaryHeaderReadingUtils::SUPPORTS_DYNAMIC_UPDATE_FLAG = 0x2; -const BinaryDictionaryHeaderReadingUtils::DictionaryFlags - BinaryDictionaryHeaderReadingUtils::FRENCH_LIGATURE_PROCESSING_FLAG = 0x4; - -/* static */ int BinaryDictionaryHeaderReadingUtils::getHeaderSize( - const BinaryDictionaryInfo *const binaryDictionaryInfo) { - switch (getHeaderVersion(binaryDictionaryInfo->getFormat())) { - case HEADER_VERSION_2: - // See the format of the header in the comment in - // BinaryDictionaryFormatUtils::detectFormatVersion() - return ByteArrayUtils::readUint32(binaryDictionaryInfo->getDictBuf(), - VERSION_2_HEADER_MAGIC_NUMBER_SIZE + VERSION_2_HEADER_DICTIONARY_VERSION_SIZE - + VERSION_2_HEADER_FLAG_SIZE); - default: - return S_INT_MAX; - } -} - -/* static */ BinaryDictionaryHeaderReadingUtils::DictionaryFlags - BinaryDictionaryHeaderReadingUtils::getFlags( - const BinaryDictionaryInfo *const binaryDictionaryInfo) { - switch (getHeaderVersion(binaryDictionaryInfo->getFormat())) { - case HEADER_VERSION_2: - return ByteArrayUtils::readUint16(binaryDictionaryInfo->getDictBuf(), - VERSION_2_HEADER_MAGIC_NUMBER_SIZE + VERSION_2_HEADER_DICTIONARY_VERSION_SIZE); - default: - return NO_FLAGS; - } -} - -// Returns if the key is found or not and reads the found value into outValue. -/* static */ bool BinaryDictionaryHeaderReadingUtils::readHeaderValue( - const BinaryDictionaryInfo *const binaryDictionaryInfo, - const char *const key, int *outValue, const int outValueSize) { - if (outValueSize <= 0) { - return false; - } - const int headerSize = getHeaderSize(binaryDictionaryInfo); - int pos = getHeaderOptionsPosition(binaryDictionaryInfo->getFormat()); - if (pos == NOT_A_DICT_POS) { - // The header doesn't have header options. - return false; - } - while (pos < headerSize) { - if(ByteArrayUtils::compareStringInBufferWithCharArray( - binaryDictionaryInfo->getDictBuf(), key, headerSize - pos, &pos) == 0) { - // The key was found. - const int length = ByteArrayUtils::readStringAndAdvancePosition( - binaryDictionaryInfo->getDictBuf(), outValueSize, outValue, &pos); - // Add a 0 terminator to the string. - outValue[length < outValueSize ? length : outValueSize - 1] = '\0'; - return true; - } - ByteArrayUtils::advancePositionToBehindString( - binaryDictionaryInfo->getDictBuf(), headerSize - pos, &pos); - } - // The key was not found. - return false; -} - -/* static */ int BinaryDictionaryHeaderReadingUtils::readHeaderValueInt( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const char *const key) { - const int bufferSize = LARGEST_INT_DIGIT_COUNT; - int intBuffer[bufferSize]; - char charBuffer[bufferSize]; - if (!readHeaderValue(binaryDictionaryInfo, key, intBuffer, bufferSize)) { - return S_INT_MIN; - } - for (int i = 0; i < bufferSize; ++i) { - charBuffer[i] = intBuffer[i]; - if (charBuffer[i] == '0') { - break; - } - if (!isdigit(charBuffer[i])) { - // If not a number, return S_INT_MIN - return S_INT_MIN; - } - } - return atoi(charBuffer); -} - -} // namespace latinime diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_header_reading_utils.h b/native/jni/src/suggest/core/dictionary/binary_dictionary_header_reading_utils.h deleted file mode 100644 index 61748227e..000000000 --- a/native/jni/src/suggest/core/dictionary/binary_dictionary_header_reading_utils.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2013, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef LATINIME_DICTIONARY_HEADER_READING_UTILS_H -#define LATINIME_DICTIONARY_HEADER_READING_UTILS_H - -#include <stdint.h> - -#include "defines.h" -#include "suggest/core/dictionary/binary_dictionary_format_utils.h" - -namespace latinime { - -class BinaryDictionaryInfo; - -class BinaryDictionaryHeaderReadingUtils { - public: - typedef uint16_t DictionaryFlags; - - static const int MAX_OPTION_KEY_LENGTH; - - static int getHeaderSize(const BinaryDictionaryInfo *const binaryDictionaryInfo); - - static DictionaryFlags getFlags(const BinaryDictionaryInfo *const binaryDictionaryInfo); - - static AK_FORCE_INLINE bool supportsDynamicUpdate(const DictionaryFlags flags) { - return (flags & SUPPORTS_DYNAMIC_UPDATE_FLAG) != 0; - } - - static AK_FORCE_INLINE bool requiresGermanUmlautProcessing(const DictionaryFlags flags) { - return (flags & GERMAN_UMLAUT_PROCESSING_FLAG) != 0; - } - - static AK_FORCE_INLINE bool requiresFrenchLigatureProcessing(const DictionaryFlags flags) { - return (flags & FRENCH_LIGATURE_PROCESSING_FLAG) != 0; - } - - static AK_FORCE_INLINE int getHeaderOptionsPosition( - const BinaryDictionaryFormatUtils::FORMAT_VERSION dictionaryFormat) { - switch (getHeaderVersion(dictionaryFormat)) { - case HEADER_VERSION_2: - return VERSION_2_HEADER_MAGIC_NUMBER_SIZE + VERSION_2_HEADER_DICTIONARY_VERSION_SIZE - + VERSION_2_HEADER_FLAG_SIZE + VERSION_2_HEADER_SIZE_FIELD_SIZE; - break; - default: - return NOT_A_DICT_POS; - } - } - - static bool readHeaderValue( - const BinaryDictionaryInfo *const binaryDictionaryInfo, - const char *const key, int *outValue, const int outValueSize); - - static int readHeaderValueInt( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const char *const key); - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryDictionaryHeaderReadingUtils); - - enum HEADER_VERSION { - HEADER_VERSION_2, - UNKNOWN_HEADER_VERSION - }; - - static const int VERSION_2_HEADER_MAGIC_NUMBER_SIZE; - static const int VERSION_2_HEADER_DICTIONARY_VERSION_SIZE; - static const int VERSION_2_HEADER_FLAG_SIZE; - static const int VERSION_2_HEADER_SIZE_FIELD_SIZE; - - static const DictionaryFlags NO_FLAGS; - // Flags for special processing - // Those *must* match the flags in makedict (FormatSpec#*_PROCESSING_FLAGS) or - // something very bad (like, the apocalypse) will happen. Please update both at the same time. - static const DictionaryFlags GERMAN_UMLAUT_PROCESSING_FLAG; - static const DictionaryFlags SUPPORTS_DYNAMIC_UPDATE_FLAG; - static const DictionaryFlags FRENCH_LIGATURE_PROCESSING_FLAG; - static const DictionaryFlags CONTAINS_BIGRAMS_FLAG; - - static HEADER_VERSION getHeaderVersion( - const BinaryDictionaryFormatUtils::FORMAT_VERSION formatVersion) { - switch(formatVersion) { - case BinaryDictionaryFormatUtils::VERSION_2: - // Fall through - case BinaryDictionaryFormatUtils::VERSION_3: - return HEADER_VERSION_2; - default: - return UNKNOWN_HEADER_VERSION; - } - } -}; -} -#endif /* LATINIME_DICTIONARY_HEADER_READING_UTILS_H */ diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_info.h b/native/jni/src/suggest/core/dictionary/binary_dictionary_info.h index cbea18f90..e50baae0b 100644 --- a/native/jni/src/suggest/core/dictionary/binary_dictionary_info.h +++ b/native/jni/src/suggest/core/dictionary/binary_dictionary_info.h @@ -20,27 +20,17 @@ #include <stdint.h> #include "defines.h" -#include "jni.h" -#include "suggest/core/dictionary/binary_dictionary_format_utils.h" -#include "suggest/core/dictionary/binary_dictionary_header.h" -#include "suggest/policyimpl/dictionary/dictionary_structure_policy_factory.h" -#include "utils/log_utils.h" namespace latinime { class BinaryDictionaryInfo { public: - AK_FORCE_INLINE BinaryDictionaryInfo(JNIEnv *env, const uint8_t *const dictBuf, + AK_FORCE_INLINE BinaryDictionaryInfo(const uint8_t *const dictBuf, const int dictSize, const int mmapFd, const int dictBufOffset, const bool isUpdatable) : mDictBuf(dictBuf), mDictSize(dictSize), mMmapFd(mmapFd), - mDictBufOffset(dictBufOffset), mIsUpdatable(isUpdatable), - mDictionaryFormat(BinaryDictionaryFormatUtils::detectFormatVersion( - mDictBuf, mDictSize)), - mDictionaryHeader(this), mDictRoot(mDictBuf + mDictionaryHeader.getSize()), - mStructurePolicy(DictionaryStructurePolicyFactory::getDictionaryStructurePolicy( - mDictionaryFormat)) { - logDictionaryInfo(env); - } + mDictBufOffset(dictBufOffset), mIsUpdatable(isUpdatable) {} + + ~BinaryDictionaryInfo() {} AK_FORCE_INLINE const uint8_t *getDictBuf() const { return mDictBuf; @@ -58,28 +48,12 @@ class BinaryDictionaryInfo { return mDictBufOffset; } - AK_FORCE_INLINE const uint8_t *getDictRoot() const { - return mDictRoot; - } - - AK_FORCE_INLINE BinaryDictionaryFormatUtils::FORMAT_VERSION getFormat() const { - return mDictionaryFormat; - } - - AK_FORCE_INLINE const BinaryDictionaryHeader *getHeader() const { - return &mDictionaryHeader; - } - AK_FORCE_INLINE bool isDynamicallyUpdatable() const { // TODO: Support dynamic dictionary formats. const bool isUpdatableDictionaryFormat = false; return mIsUpdatable && isUpdatableDictionaryFormat; } - AK_FORCE_INLINE const DictionaryStructurePolicy *getStructurePolicy() const { - return mStructurePolicy; - } - private: DISALLOW_COPY_AND_ASSIGN(BinaryDictionaryInfo); @@ -88,37 +62,6 @@ class BinaryDictionaryInfo { const int mMmapFd; const int mDictBufOffset; const bool mIsUpdatable; - const BinaryDictionaryFormatUtils::FORMAT_VERSION mDictionaryFormat; - const BinaryDictionaryHeader mDictionaryHeader; - const uint8_t *const mDictRoot; - const DictionaryStructurePolicy *const mStructurePolicy; - - AK_FORCE_INLINE void logDictionaryInfo(JNIEnv *const env) const { - const int BUFFER_SIZE = 16; - int dictionaryIdCodePointBuffer[BUFFER_SIZE]; - int versionStringCodePointBuffer[BUFFER_SIZE]; - int dateStringCodePointBuffer[BUFFER_SIZE]; - mDictionaryHeader.readHeaderValueOrQuestionMark("dictionary", - dictionaryIdCodePointBuffer, BUFFER_SIZE); - mDictionaryHeader.readHeaderValueOrQuestionMark("version", - versionStringCodePointBuffer, BUFFER_SIZE); - mDictionaryHeader.readHeaderValueOrQuestionMark("date", - dateStringCodePointBuffer, BUFFER_SIZE); - - char dictionaryIdCharBuffer[BUFFER_SIZE]; - char versionStringCharBuffer[BUFFER_SIZE]; - char dateStringCharBuffer[BUFFER_SIZE]; - intArrayToCharArray(dictionaryIdCodePointBuffer, BUFFER_SIZE, - dictionaryIdCharBuffer, BUFFER_SIZE); - intArrayToCharArray(versionStringCodePointBuffer, BUFFER_SIZE, - versionStringCharBuffer, BUFFER_SIZE); - intArrayToCharArray(dateStringCodePointBuffer, BUFFER_SIZE, - dateStringCharBuffer, BUFFER_SIZE); - - LogUtils::logToJava(env, - "Dictionary info: dictionary = %s ; version = %s ; date = %s ; filesize = %i", - dictionaryIdCharBuffer, versionStringCharBuffer, dateStringCharBuffer, mDictSize); - } }; } #endif /* LATINIME_BINARY_DICTIONARY_INFO_H */ diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_shortcut_iterator.h b/native/jni/src/suggest/core/dictionary/binary_dictionary_shortcut_iterator.h new file mode 100644 index 000000000..558e0a5c3 --- /dev/null +++ b/native/jni/src/suggest/core/dictionary/binary_dictionary_shortcut_iterator.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_BINARY_DICTIONARY_SHORTCUT_ITERATOR_H +#define LATINIME_BINARY_DICTIONARY_SHORTCUT_ITERATOR_H + +#include "defines.h" +#include "suggest/core/policy/dictionary_shortcuts_structure_policy.h" + +namespace latinime { + +class BinaryDictionaryShortcutIterator { + public: + BinaryDictionaryShortcutIterator( + const DictionaryShortcutsStructurePolicy *const shortcutStructurePolicy, + const int shortcutPos) + : mShortcutStructurePolicy(shortcutStructurePolicy), + mPos(shortcutStructurePolicy->getStartPos(shortcutPos)), + mHasNextShortcutTarget(shortcutPos != NOT_A_DICT_POS) {} + + AK_FORCE_INLINE bool hasNextShortcutTarget() const { + return mHasNextShortcutTarget; + } + + // Gets the shortcut target itself as an int string and put it to outTarget, put its length + // to outTargetLength, put whether it is whitelist to outIsWhitelist. + AK_FORCE_INLINE void nextShortcutTarget( + const int maxDepth, int *const outTarget, int *const outTargetLength, + bool *const outIsWhitelist) { + mShortcutStructurePolicy->getNextShortcut(maxDepth, outTarget, outTargetLength, + outIsWhitelist, &mHasNextShortcutTarget, &mPos); + } + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryDictionaryShortcutIterator); + + const DictionaryShortcutsStructurePolicy *const mShortcutStructurePolicy; + int mPos; + bool mHasNextShortcutTarget; +}; +} // namespace latinime +#endif // LATINIME_BINARY_DICTIONARY_SHORTCUT_ITERATOR_H diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_terminal_attributes_reading_utils.h b/native/jni/src/suggest/core/dictionary/binary_dictionary_terminal_attributes_reading_utils.h deleted file mode 100644 index 375fc7dff..000000000 --- a/native/jni/src/suggest/core/dictionary/binary_dictionary_terminal_attributes_reading_utils.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef LATINIME_BINARY_DICTIONARY_TERMINAL_ATTRIBUTES_READING_UTILS_H -#define LATINIME_BINARY_DICTIONARY_TERMINAL_ATTRIBUTES_READING_UTILS_H - -#include <stdint.h> - -#include "defines.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" -#include "suggest/core/dictionary/byte_array_utils.h" - -namespace latinime { - -class BinaryDictionaryTerminalAttributesReadingUtils { - public: - typedef uint8_t TerminalAttributeFlags; - typedef TerminalAttributeFlags BigramFlags; - typedef TerminalAttributeFlags ShortcutFlags; - - static AK_FORCE_INLINE TerminalAttributeFlags getFlagsAndForwardPointer( - const BinaryDictionaryInfo *const binaryDictionaryInfo, int *const pos) { - return ByteArrayUtils::readUint8AndAdvancePosition( - binaryDictionaryInfo->getDictRoot(), pos); - } - - static AK_FORCE_INLINE int getProbabilityFromFlags(const TerminalAttributeFlags flags) { - return flags & MASK_ATTRIBUTE_PROBABILITY; - } - - static AK_FORCE_INLINE bool hasNext(const TerminalAttributeFlags flags) { - return (flags & FLAG_ATTRIBUTE_HAS_NEXT) != 0; - } - - // Bigrams reading methods - static AK_FORCE_INLINE void skipExistingBigrams( - const BinaryDictionaryInfo *const binaryDictionaryInfo, int *const pos) { - BigramFlags flags = getFlagsAndForwardPointer(binaryDictionaryInfo, pos); - while (hasNext(flags)) { - *pos += attributeAddressSize(flags); - flags = getFlagsAndForwardPointer(binaryDictionaryInfo, pos); - } - *pos += attributeAddressSize(flags); - } - - static int getBigramAddressAndForwardPointer( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const BigramFlags flags, - int *const pos); - - // Shortcuts reading methods - // This method returns the size of the shortcut list region excluding the shortcut list size - // field at the beginning. - static AK_FORCE_INLINE int getShortcutListSizeAndForwardPointer( - const BinaryDictionaryInfo *const binaryDictionaryInfo, int *const pos) { - // readUint16andAdvancePosition() returns an offset *including* the uint16 field itself. - return ByteArrayUtils::readUint16AndAdvancePosition( - binaryDictionaryInfo->getDictRoot(), pos) - SHORTCUT_LIST_SIZE_FIELD_SIZE; - } - - static AK_FORCE_INLINE void skipShortcuts( - const BinaryDictionaryInfo *const binaryDictionaryInfo, int *const pos) { - const int shortcutListSize = getShortcutListSizeAndForwardPointer( - binaryDictionaryInfo, pos); - *pos += shortcutListSize; - } - - static AK_FORCE_INLINE bool isWhitelist(const ShortcutFlags flags) { - return getProbabilityFromFlags(flags) == WHITELIST_SHORTCUT_PROBABILITY; - } - - static AK_FORCE_INLINE int readShortcutTarget( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int maxLength, - int *const outWord, int *const pos) { - return ByteArrayUtils::readStringAndAdvancePosition( - binaryDictionaryInfo->getDictRoot(), maxLength, outWord, pos); - } - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryDictionaryTerminalAttributesReadingUtils); - - static const TerminalAttributeFlags MASK_ATTRIBUTE_ADDRESS_TYPE; - static const TerminalAttributeFlags FLAG_ATTRIBUTE_ADDRESS_TYPE_ONEBYTE; - static const TerminalAttributeFlags FLAG_ATTRIBUTE_ADDRESS_TYPE_TWOBYTES; - static const TerminalAttributeFlags FLAG_ATTRIBUTE_ADDRESS_TYPE_THREEBYTES; - static const TerminalAttributeFlags FLAG_ATTRIBUTE_OFFSET_NEGATIVE; - static const TerminalAttributeFlags FLAG_ATTRIBUTE_HAS_NEXT; - static const TerminalAttributeFlags MASK_ATTRIBUTE_PROBABILITY; - static const int ATTRIBUTE_ADDRESS_SHIFT; - static const int SHORTCUT_LIST_SIZE_FIELD_SIZE; - static const int WHITELIST_SHORTCUT_PROBABILITY; - - static AK_FORCE_INLINE bool isOffsetNegative(const TerminalAttributeFlags flags) { - return (flags & FLAG_ATTRIBUTE_OFFSET_NEGATIVE) != 0; - } - - static AK_FORCE_INLINE int attributeAddressSize(const TerminalAttributeFlags flags) { - return (flags & MASK_ATTRIBUTE_ADDRESS_TYPE) >> ATTRIBUTE_ADDRESS_SHIFT; - /* Note: this is a value-dependant optimization of what may probably be - more readably written this way: - switch (flags * BinaryFormat::MASK_ATTRIBUTE_ADDRESS_TYPE) { - case FLAG_ATTRIBUTE_ADDRESS_TYPE_ONEBYTE: return 1; - case FLAG_ATTRIBUTE_ADDRESS_TYPE_TWOBYTES: return 2; - case FLAG_ATTRIBUTE_ADDRESS_TYPE_THREEBYTE: return 3; - default: return 0; - } - */ - } -}; -} -#endif /* LATINIME_BINARY_DICTIONARY_TERMINAL_ATTRIBUTES_READING_UTILS_H */ diff --git a/native/jni/src/suggest/core/dictionary/dictionary.cpp b/native/jni/src/suggest/core/dictionary/dictionary.cpp index 4a9e38fe8..af00e9927 100644 --- a/native/jni/src/suggest/core/dictionary/dictionary.cpp +++ b/native/jni/src/suggest/core/dictionary/dictionary.cpp @@ -18,33 +18,39 @@ #include "suggest/core/dictionary/dictionary.h" -#include <map> // TODO: remove #include <stdint.h> #include "defines.h" -#include "jni.h" #include "suggest/core/dictionary/bigram_dictionary.h" +#include "suggest/core/policy/dictionary_header_structure_policy.h" #include "suggest/core/session/dic_traverse_session.h" #include "suggest/core/suggest.h" #include "suggest/core/suggest_options.h" +#include "suggest/policyimpl/dictionary/dictionary_structure_with_buffer_policy_factory.h" #include "suggest/policyimpl/gesture/gesture_suggest_policy_factory.h" #include "suggest/policyimpl/typing/typing_suggest_policy_factory.h" +#include "utils/log_utils.h" namespace latinime { Dictionary::Dictionary(JNIEnv *env, void *dict, int dictSize, int mmapFd, int dictBufOffset, bool isUpdatable) - : mBinaryDictionaryInfo(env, static_cast<const uint8_t *>(dict), dictSize, mmapFd, + : mBinaryDictionaryInfo(static_cast<const uint8_t *>(dict), dictSize, mmapFd, dictBufOffset, isUpdatable), - mBigramDictionary(new BigramDictionary(&mBinaryDictionaryInfo)), + mDictionaryStructureWithBufferPolicy(DictionaryStructureWithBufferPolicyFactory + ::newDictionaryStructureWithBufferPolicy( + static_cast<const uint8_t *>(dict), dictSize)), + mBigramDictionary(new BigramDictionary(mDictionaryStructureWithBufferPolicy)), mGestureSuggest(new Suggest(GestureSuggestPolicyFactory::getGestureSuggestPolicy())), mTypingSuggest(new Suggest(TypingSuggestPolicyFactory::getTypingSuggestPolicy())) { + logDictionaryInfo(env); } Dictionary::~Dictionary() { delete mBigramDictionary; delete mGestureSuggest; delete mTypingSuggest; + delete mDictionaryStructureWithBufferPolicy; } int Dictionary::getSuggestions(ProximityInfo *proximityInfo, DicTraverseSession *traverseSession, @@ -83,14 +89,12 @@ int Dictionary::getBigrams(const int *word, int length, int *outWords, int *freq } int Dictionary::getProbability(const int *word, int length) const { - const DictionaryStructurePolicy *const structurePolicy = - mBinaryDictionaryInfo.getStructurePolicy(); - int pos = structurePolicy->getTerminalNodePositionOfWord(&mBinaryDictionaryInfo, word, length, + int pos = getDictionaryStructurePolicy()->getTerminalNodePositionOfWord(word, length, false /* forceLowerCaseSearch */); if (NOT_A_VALID_WORD_POS == pos) { return NOT_A_PROBABILITY; } - return structurePolicy->getUnigramProbability(&mBinaryDictionaryInfo, pos); + return getDictionaryStructurePolicy()->getUnigramProbability(pos); } bool Dictionary::isValidBigram(const int *word0, int length0, const int *word1, int length1) const { @@ -126,4 +130,33 @@ void Dictionary::removeBigramWords(const int *const word0, const int length0, // TODO: Support dynamic update } +void Dictionary::logDictionaryInfo(JNIEnv *const env) const { + const int BUFFER_SIZE = 16; + int dictionaryIdCodePointBuffer[BUFFER_SIZE]; + int versionStringCodePointBuffer[BUFFER_SIZE]; + int dateStringCodePointBuffer[BUFFER_SIZE]; + const DictionaryHeaderStructurePolicy *const headerPolicy = + getDictionaryStructurePolicy()->getHeaderStructurePolicy(); + headerPolicy->readHeaderValueOrQuestionMark("dictionary", dictionaryIdCodePointBuffer, + BUFFER_SIZE); + headerPolicy->readHeaderValueOrQuestionMark("version", versionStringCodePointBuffer, + BUFFER_SIZE); + headerPolicy->readHeaderValueOrQuestionMark("date", dateStringCodePointBuffer, BUFFER_SIZE); + + char dictionaryIdCharBuffer[BUFFER_SIZE]; + char versionStringCharBuffer[BUFFER_SIZE]; + char dateStringCharBuffer[BUFFER_SIZE]; + intArrayToCharArray(dictionaryIdCodePointBuffer, BUFFER_SIZE, + dictionaryIdCharBuffer, BUFFER_SIZE); + intArrayToCharArray(versionStringCodePointBuffer, BUFFER_SIZE, + versionStringCharBuffer, BUFFER_SIZE); + intArrayToCharArray(dateStringCodePointBuffer, BUFFER_SIZE, + dateStringCharBuffer, BUFFER_SIZE); + + LogUtils::logToJava(env, + "Dictionary info: dictionary = %s ; version = %s ; date = %s ; filesize = %i", + dictionaryIdCharBuffer, versionStringCharBuffer, dateStringCharBuffer, + mBinaryDictionaryInfo.getDictSize()); +} + } // namespace latinime diff --git a/native/jni/src/suggest/core/dictionary/dictionary.h b/native/jni/src/suggest/core/dictionary/dictionary.h index 9f1e0729d..17ce47974 100644 --- a/native/jni/src/suggest/core/dictionary/dictionary.h +++ b/native/jni/src/suggest/core/dictionary/dictionary.h @@ -26,6 +26,7 @@ namespace latinime { class BigramDictionary; +class DictionaryStructureWithBufferPolicy; class DicTraverseSession; class ProximityInfo; class SuggestInterface; @@ -77,19 +78,27 @@ class Dictionary { void removeBigramWords(const int *const word0, const int length0, const int *const word1, const int length1); + // TODO: Remove. const BinaryDictionaryInfo *getBinaryDictionaryInfo() const { return &mBinaryDictionaryInfo; } + const DictionaryStructureWithBufferPolicy *getDictionaryStructurePolicy() const { + return mDictionaryStructureWithBufferPolicy; + } + virtual ~Dictionary(); private: DISALLOW_IMPLICIT_CONSTRUCTORS(Dictionary); const BinaryDictionaryInfo mBinaryDictionaryInfo; + DictionaryStructureWithBufferPolicy *const mDictionaryStructureWithBufferPolicy; const BigramDictionary *mBigramDictionary; SuggestInterface *mGestureSuggest; SuggestInterface *mTypingSuggest; + + void logDictionaryInfo(JNIEnv *const env) const; }; } // namespace latinime #endif // LATINIME_DICTIONARY_H diff --git a/native/jni/src/suggest/core/dictionary/digraph_utils.cpp b/native/jni/src/suggest/core/dictionary/digraph_utils.cpp index af378b1b7..3271c1bfb 100644 --- a/native/jni/src/suggest/core/dictionary/digraph_utils.cpp +++ b/native/jni/src/suggest/core/dictionary/digraph_utils.cpp @@ -19,7 +19,7 @@ #include <cstdlib> #include "defines.h" -#include "suggest/core/dictionary/binary_dictionary_header.h" +#include "suggest/core/policy/dictionary_header_structure_policy.h" #include "utils/char_utils.h" namespace latinime { @@ -35,8 +35,9 @@ const DigraphUtils::DigraphType DigraphUtils::USED_DIGRAPH_TYPES[] = { DIGRAPH_TYPE_GERMAN_UMLAUT, DIGRAPH_TYPE_FRENCH_LIGATURES }; /* static */ bool DigraphUtils::hasDigraphForCodePoint( - const BinaryDictionaryHeader *const header, const int compositeGlyphCodePoint) { - const DigraphUtils::DigraphType digraphType = getDigraphTypeForDictionary(header); + const DictionaryHeaderStructurePolicy *const headerPolicy, + const int compositeGlyphCodePoint) { + const DigraphUtils::DigraphType digraphType = getDigraphTypeForDictionary(headerPolicy); if (DigraphUtils::getDigraphForDigraphTypeAndCodePoint(digraphType, compositeGlyphCodePoint)) { return true; } @@ -45,11 +46,11 @@ const DigraphUtils::DigraphType DigraphUtils::USED_DIGRAPH_TYPES[] = // Returns the digraph type associated with the given dictionary. /* static */ DigraphUtils::DigraphType DigraphUtils::getDigraphTypeForDictionary( - const BinaryDictionaryHeader *const header) { - if (header->requiresGermanUmlautProcessing()) { + const DictionaryHeaderStructurePolicy *const headerPolicy) { + if (headerPolicy->requiresGermanUmlautProcessing()) { return DIGRAPH_TYPE_GERMAN_UMLAUT; } - if (header->requiresFrenchLigatureProcessing()) { + if (headerPolicy->requiresFrenchLigatureProcessing()) { return DIGRAPH_TYPE_FRENCH_LIGATURES; } return DIGRAPH_TYPE_NONE; diff --git a/native/jni/src/suggest/core/dictionary/digraph_utils.h b/native/jni/src/suggest/core/dictionary/digraph_utils.h index 9d74fe3a6..6ae16e390 100644 --- a/native/jni/src/suggest/core/dictionary/digraph_utils.h +++ b/native/jni/src/suggest/core/dictionary/digraph_utils.h @@ -21,7 +21,7 @@ namespace latinime { -class BinaryDictionaryHeader; +class DictionaryHeaderStructurePolicy; class DigraphUtils { public: @@ -39,14 +39,15 @@ class DigraphUtils { typedef struct { int first; int second; int compositeGlyph; } digraph_t; - static bool hasDigraphForCodePoint( - const BinaryDictionaryHeader *const header, const int compositeGlyphCodePoint); + static bool hasDigraphForCodePoint(const DictionaryHeaderStructurePolicy *const headerPolicy, + const int compositeGlyphCodePoint); static int getDigraphCodePointForIndex(const int compositeGlyphCodePoint, const DigraphCodePointIndex digraphCodePointIndex); private: DISALLOW_IMPLICIT_CONSTRUCTORS(DigraphUtils); - static DigraphType getDigraphTypeForDictionary(const BinaryDictionaryHeader *const header); + static DigraphType getDigraphTypeForDictionary( + const DictionaryHeaderStructurePolicy *const headerPolicy); static int getAllDigraphsForDigraphTypeAndReturnSize( const DigraphType digraphType, const digraph_t **const digraphs); static const digraph_t *getDigraphForCodePoint(const int compositeGlyphCodePoint); diff --git a/native/jni/src/suggest/core/dictionary/multi_bigram_map.h b/native/jni/src/suggest/core/dictionary/multi_bigram_map.h index d5eafe1bf..97d4cd161 100644 --- a/native/jni/src/suggest/core/dictionary/multi_bigram_map.h +++ b/native/jni/src/suggest/core/dictionary/multi_bigram_map.h @@ -21,9 +21,9 @@ #include "defines.h" #include "suggest/core/dictionary/binary_dictionary_bigrams_iterator.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" #include "suggest/core/dictionary/bloom_filter.h" #include "suggest/core/dictionary/probability_utils.h" +#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h" #include "utils/hash_map_compat.h" namespace latinime { @@ -38,7 +38,7 @@ class MultiBigramMap { // Look up the bigram probability for the given word pair from the cached bigram maps. // Also caches the bigrams if there is space remaining and they have not been cached already. - int getBigramProbability(const BinaryDictionaryInfo *const binaryDictionaryInfo, + int getBigramProbability(const DictionaryStructureWithBufferPolicy *const structurePolicy, const int wordPosition, const int nextWordPosition, const int unigramProbability) { hash_map_compat<int, BigramMap>::const_iterator mapPosition = mBigramMaps.find(wordPosition); @@ -46,12 +46,12 @@ class MultiBigramMap { return mapPosition->second.getBigramProbability(nextWordPosition, unigramProbability); } if (mBigramMaps.size() < MAX_CACHED_PREV_WORDS_IN_BIGRAM_MAP) { - addBigramsForWordPosition(binaryDictionaryInfo, wordPosition); + addBigramsForWordPosition(structurePolicy, wordPosition); return mBigramMaps[wordPosition].getBigramProbability( nextWordPosition, unigramProbability); } - return readBigramProbabilityFromBinaryDictionary(binaryDictionaryInfo, - wordPosition, nextWordPosition, unigramProbability); + return readBigramProbabilityFromBinaryDictionary(structurePolicy, wordPosition, + nextWordPosition, unigramProbability); } void clear() { @@ -66,10 +66,11 @@ class MultiBigramMap { BigramMap() : mBigramMap(DEFAULT_HASH_MAP_SIZE_FOR_EACH_BIGRAM_MAP), mBloomFilter() {} ~BigramMap() {} - void init(const BinaryDictionaryInfo *const binaryDictionaryInfo, const int nodePos) { - const int bigramsListPos = binaryDictionaryInfo->getStructurePolicy()-> - getBigramsPositionOfNode(binaryDictionaryInfo, nodePos); - BinaryDictionaryBigramsIterator bigramsIt(binaryDictionaryInfo, bigramsListPos); + void init(const DictionaryStructureWithBufferPolicy *const structurePolicy, + const int nodePos) { + const int bigramsListPos = structurePolicy->getBigramsPositionOfNode(nodePos); + BinaryDictionaryBigramsIterator bigramsIt(structurePolicy->getBigramsStructurePolicy(), + bigramsListPos); while (bigramsIt.hasNext()) { bigramsIt.next(); mBigramMap[bigramsIt.getBigramPos()] = bigramsIt.getProbability(); @@ -100,16 +101,16 @@ class MultiBigramMap { }; AK_FORCE_INLINE void addBigramsForWordPosition( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int position) { - mBigramMaps[position].init(binaryDictionaryInfo, position); + const DictionaryStructureWithBufferPolicy *const structurePolicy, const int position) { + mBigramMaps[position].init(structurePolicy, position); } AK_FORCE_INLINE int readBigramProbabilityFromBinaryDictionary( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int nodePos, + const DictionaryStructureWithBufferPolicy *const structurePolicy, const int nodePos, const int nextWordPosition, const int unigramProbability) { - const int bigramsListPos = binaryDictionaryInfo->getStructurePolicy()-> - getBigramsPositionOfNode(binaryDictionaryInfo, nodePos); - BinaryDictionaryBigramsIterator bigramsIt(binaryDictionaryInfo, bigramsListPos); + const int bigramsListPos = structurePolicy->getBigramsPositionOfNode(nodePos); + BinaryDictionaryBigramsIterator bigramsIt(structurePolicy->getBigramsStructurePolicy(), + bigramsListPos); while (bigramsIt.hasNext()) { bigramsIt.next(); if (bigramsIt.getBigramPos() == nextWordPosition) { diff --git a/native/jni/src/suggest/core/dictionary/shortcut_utils.h b/native/jni/src/suggest/core/dictionary/shortcut_utils.h index 3c2180937..461d7b454 100644 --- a/native/jni/src/suggest/core/dictionary/shortcut_utils.h +++ b/native/jni/src/suggest/core/dictionary/shortcut_utils.h @@ -19,21 +19,20 @@ #include "defines.h" #include "suggest/core/dicnode/dic_node_utils.h" -#include "suggest/core/dictionary/terminal_attributes.h" +#include "suggest/core/dictionary/binary_dictionary_shortcut_iterator.h" namespace latinime { class ShortcutUtils { public: - static int outputShortcuts(const TerminalAttributes *const terminalAttributes, + static int outputShortcuts(BinaryDictionaryShortcutIterator *const shortcutIt, int outputWordIndex, const int finalScore, int *const outputCodePoints, int *const frequencies, int *const outputTypes, const bool sameAsTyped) { - TerminalAttributes::ShortcutIterator iterator = terminalAttributes->getShortcutIterator(); int shortcutTarget[MAX_WORD_LENGTH]; - while (iterator.hasNextShortcutTarget() && outputWordIndex < MAX_RESULTS) { + while (shortcutIt->hasNextShortcutTarget() && outputWordIndex < MAX_RESULTS) { bool isWhilelist; int shortcutTargetStringLength; - iterator.nextShortcutTarget(MAX_WORD_LENGTH, shortcutTarget, + shortcutIt->nextShortcutTarget(MAX_WORD_LENGTH, shortcutTarget, &shortcutTargetStringLength, &isWhilelist); int shortcutScore; int kind; diff --git a/native/jni/src/suggest/core/dictionary/terminal_attributes.h b/native/jni/src/suggest/core/dictionary/terminal_attributes.h deleted file mode 100644 index 0da6504eb..000000000 --- a/native/jni/src/suggest/core/dictionary/terminal_attributes.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef LATINIME_TERMINAL_ATTRIBUTES_H -#define LATINIME_TERMINAL_ATTRIBUTES_H - -#include <stdint.h> - -#include "suggest/core/dictionary/binary_dictionary_info.h" -#include "suggest/core/dictionary/binary_dictionary_terminal_attributes_reading_utils.h" - -namespace latinime { - -/** - * This class encapsulates information about a terminal that allows to - * retrieve local node attributes like the list of shortcuts without - * exposing the format structure to the client. - */ -class TerminalAttributes { - public: - class ShortcutIterator { - public: - ShortcutIterator(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int shortcutPos, const bool hasShortcutList) - : mBinaryDictionaryInfo(binaryDictionaryInfo), mPos(shortcutPos), - mHasNextShortcutTarget(hasShortcutList) {} - - inline bool hasNextShortcutTarget() const { - return mHasNextShortcutTarget; - } - - // Gets the shortcut target itself as an int string and put it to outTarget, put its length - // to outTargetLength, put whether it is whitelist to outIsWhitelist. - AK_FORCE_INLINE void nextShortcutTarget( - const int maxDepth, int *const outTarget, int *const outTargetLength, - bool *const outIsWhitelist) { - const BinaryDictionaryTerminalAttributesReadingUtils::ShortcutFlags flags = - BinaryDictionaryTerminalAttributesReadingUtils::getFlagsAndForwardPointer( - mBinaryDictionaryInfo, &mPos); - mHasNextShortcutTarget = - BinaryDictionaryTerminalAttributesReadingUtils::hasNext(flags); - if (outIsWhitelist) { - *outIsWhitelist = - BinaryDictionaryTerminalAttributesReadingUtils::isWhitelist(flags); - } - if (outTargetLength) { - *outTargetLength = - BinaryDictionaryTerminalAttributesReadingUtils::readShortcutTarget( - mBinaryDictionaryInfo, maxDepth, outTarget, &mPos); - } - } - - private: - const BinaryDictionaryInfo *const mBinaryDictionaryInfo; - int mPos; - bool mHasNextShortcutTarget; - }; - - TerminalAttributes(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int shortcutPos) - : mBinaryDictionaryInfo(binaryDictionaryInfo), mShortcutListSizePos(shortcutPos) {} - - inline ShortcutIterator getShortcutIterator() const { - int shortcutPos = mShortcutListSizePos; - const bool hasShortcutList = shortcutPos != NOT_A_DICT_POS; - if (hasShortcutList) { - BinaryDictionaryTerminalAttributesReadingUtils::getShortcutListSizeAndForwardPointer( - mBinaryDictionaryInfo, &shortcutPos); - } - // shortcutPos is never used if hasShortcutList is false. - return ShortcutIterator(mBinaryDictionaryInfo, shortcutPos, hasShortcutList); - } - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(TerminalAttributes); - const BinaryDictionaryInfo *const mBinaryDictionaryInfo; - const int mShortcutListSizePos; -}; -} // namespace latinime -#endif // LATINIME_TERMINAL_ATTRIBUTES_H diff --git a/native/jni/src/suggest/core/policy/dictionary_bigrams_structure_policy.h b/native/jni/src/suggest/core/policy/dictionary_bigrams_structure_policy.h new file mode 100644 index 000000000..661ef1b1a --- /dev/null +++ b/native/jni/src/suggest/core/policy/dictionary_bigrams_structure_policy.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2013, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_DICTIONARY_BIGRAMS_STRUCTURE_POLICY_H +#define LATINIME_DICTIONARY_BIGRAMS_STRUCTURE_POLICY_H + +#include "defines.h" + +namespace latinime { + +/* + * This class abstracts structure of bigrams. + */ +class DictionaryBigramsStructurePolicy { + public: + virtual ~DictionaryBigramsStructurePolicy() {} + + virtual void getNextBigram(int *const outBigramPos, int *const outProbability, + bool *const outHasNext, int *const pos) const = 0; + virtual void skipAllBigrams(int *const pos) const = 0; + + protected: + DictionaryBigramsStructurePolicy() {} + + private: + DISALLOW_COPY_AND_ASSIGN(DictionaryBigramsStructurePolicy); +}; +} // namespace latinime +#endif /* LATINIME_DICTIONARY_BIGRAMS_STRUCTURE_POLICY_H */ diff --git a/native/jni/src/suggest/core/policy/dictionary_header_structure_policy.h b/native/jni/src/suggest/core/policy/dictionary_header_structure_policy.h new file mode 100644 index 000000000..a6829b476 --- /dev/null +++ b/native/jni/src/suggest/core/policy/dictionary_header_structure_policy.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2013, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_DICTIONARY_HEADER_STRUCTURE_POLICY_H +#define LATINIME_DICTIONARY_HEADER_STRUCTURE_POLICY_H + +#include "defines.h" + +namespace latinime { + +/* + * This class abstracts structure of dictionaries. + * Implement this policy to support additional dictionaries. + */ +class DictionaryHeaderStructurePolicy { + public: + virtual ~DictionaryHeaderStructurePolicy() {} + + virtual bool supportsDynamicUpdate() const = 0; + + virtual bool requiresGermanUmlautProcessing() const = 0; + + virtual bool requiresFrenchLigatureProcessing() const = 0; + + virtual float getMultiWordCostMultiplier() const = 0; + + virtual void readHeaderValueOrQuestionMark(const char *const key, int *outValue, + int outValueSize) const = 0; + + protected: + DictionaryHeaderStructurePolicy() {} + + private: + DISALLOW_COPY_AND_ASSIGN(DictionaryHeaderStructurePolicy); +}; +} // namespace latinime +#endif /* LATINIME_DICTIONARY_HEADER_STRUCTURE_POLICY_H */ diff --git a/native/jni/src/suggest/core/policy/dictionary_shortcuts_structure_policy.h b/native/jni/src/suggest/core/policy/dictionary_shortcuts_structure_policy.h new file mode 100644 index 000000000..40b6c2de1 --- /dev/null +++ b/native/jni/src/suggest/core/policy/dictionary_shortcuts_structure_policy.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2013, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_DICTIONARY_SHORTCUTS_STRUCTURE_POLICY_H +#define LATINIME_DICTIONARY_SHORTCUTS_STRUCTURE_POLICY_H + +#include "defines.h" + +namespace latinime { + +/* + * This class abstracts structure of shortcuts. + */ +class DictionaryShortcutsStructurePolicy { + public: + virtual ~DictionaryShortcutsStructurePolicy() {} + + virtual int getStartPos(const int pos) const = 0; + + virtual void getNextShortcut(const int maxCodePointCount, int *const outCodePoint, + int *const outCodePointCount, bool *const outIsWhitelist, bool *const outHasNext, + int *const pos) const = 0; + + virtual void skipAllShortcuts(int *const pos) const = 0; + + protected: + DictionaryShortcutsStructurePolicy() {} + + private: + DISALLOW_COPY_AND_ASSIGN(DictionaryShortcutsStructurePolicy); +}; +} // namespace latinime +#endif /* LATINIME_DICTIONARY_SHORTCUTS_STRUCTURE_POLICY_H */ diff --git a/native/jni/src/suggest/core/policy/dictionary_structure_policy.h b/native/jni/src/suggest/core/policy/dictionary_structure_with_buffer_policy.h index cc14c982c..1b34f03f0 100644 --- a/native/jni/src/suggest/core/policy/dictionary_structure_policy.h +++ b/native/jni/src/suggest/core/policy/dictionary_structure_with_buffer_policy.h @@ -21,15 +21,17 @@ namespace latinime { -class BinaryDictionaryInfo; class DicNode; class DicNodeVector; +class DictionaryBigramsStructurePolicy; +class DictionaryHeaderStructurePolicy; +class DictionaryShortcutsStructurePolicy; /* * This class abstracts structure of dictionaries. * Implement this policy to support additional dictionaries. */ -class DictionaryStructurePolicy { +class DictionaryStructureWithBufferPolicy { public: // This provides a filtering method for filtering new node. class NodeFilter { @@ -44,36 +46,37 @@ class DictionaryStructurePolicy { DISALLOW_COPY_AND_ASSIGN(NodeFilter); }; + virtual ~DictionaryStructureWithBufferPolicy() {} + virtual int getRootPosition() const = 0; virtual void createAndGetAllChildNodes(const DicNode *const dicNode, - const BinaryDictionaryInfo *const binaryDictionaryInfo, const NodeFilter *const nodeFilter, DicNodeVector *const childDicNodes) const = 0; virtual int getCodePointsAndProbabilityAndReturnCodePointCount( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int nodePos, const int maxCodePointCount, int *const outCodePoints, int *const outUnigramProbability) const = 0; - virtual int getTerminalNodePositionOfWord( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int *const inWord, + virtual int getTerminalNodePositionOfWord(const int *const inWord, const int length, const bool forceLowerCaseSearch) const = 0; - virtual int getUnigramProbability(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const = 0; + virtual int getUnigramProbability(const int nodePos) const = 0; + + virtual int getShortcutPositionOfNode(const int nodePos) const = 0; + + virtual int getBigramsPositionOfNode(const int nodePos) const = 0; + + virtual const DictionaryHeaderStructurePolicy *getHeaderStructurePolicy() const = 0; - virtual int getShortcutPositionOfNode(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const = 0; + virtual const DictionaryBigramsStructurePolicy *getBigramsStructurePolicy() const = 0; - virtual int getBigramsPositionOfNode(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const = 0; + virtual const DictionaryShortcutsStructurePolicy *getShortcutsStructurePolicy() const = 0; protected: - DictionaryStructurePolicy() {} - virtual ~DictionaryStructurePolicy() {} + DictionaryStructureWithBufferPolicy() {} private: - DISALLOW_COPY_AND_ASSIGN(DictionaryStructurePolicy); + DISALLOW_COPY_AND_ASSIGN(DictionaryStructureWithBufferPolicy); }; } // namespace latinime #endif /* LATINIME_DICTIONARY_STRUCTURE_POLICY_H */ diff --git a/native/jni/src/suggest/core/policy/weighting.cpp b/native/jni/src/suggest/core/policy/weighting.cpp index 58729229f..f9b777df2 100644 --- a/native/jni/src/suggest/core/policy/weighting.cpp +++ b/native/jni/src/suggest/core/policy/weighting.cpp @@ -148,7 +148,7 @@ static inline void profile(const CorrectionType correctionType, DicNode *const n case CT_TERMINAL: { const float languageImprobability = DicNodeUtils::getBigramNodeImprobability( - traverseSession->getBinaryDictionaryInfo(), dicNode, multiBigramMap); + traverseSession->getDictionaryStructurePolicy(), dicNode, multiBigramMap); return weighting->getTerminalLanguageCost(traverseSession, dicNode, languageImprobability); } case CT_TERMINAL_INSERTION: diff --git a/native/jni/src/suggest/core/session/dic_traverse_session.cpp b/native/jni/src/suggest/core/session/dic_traverse_session.cpp index 7651b19a0..0ca583f90 100644 --- a/native/jni/src/suggest/core/session/dic_traverse_session.cpp +++ b/native/jni/src/suggest/core/session/dic_traverse_session.cpp @@ -17,32 +17,30 @@ #include "suggest/core/session/dic_traverse_session.h" #include "defines.h" -#include "jni.h" -#include "suggest/core/dictionary/binary_dictionary_header.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" #include "suggest/core/dictionary/dictionary.h" +#include "suggest/core/policy/dictionary_header_structure_policy.h" +#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h" namespace latinime { void DicTraverseSession::init(const Dictionary *const dictionary, const int *prevWord, int prevWordLength, const SuggestOptions *const suggestOptions) { mDictionary = dictionary; - const BinaryDictionaryInfo *const binaryDictionaryInfo = - mDictionary->getBinaryDictionaryInfo(); - mMultiWordCostMultiplier = binaryDictionaryInfo->getHeader()->getMultiWordCostMultiplier(); + mMultiWordCostMultiplier = getDictionaryStructurePolicy()->getHeaderStructurePolicy() + ->getMultiWordCostMultiplier(); mSuggestOptions = suggestOptions; if (!prevWord) { mPrevWordPos = NOT_A_VALID_WORD_POS; return; } // TODO: merge following similar calls to getTerminalPosition into one case-insensitive call. - mPrevWordPos = binaryDictionaryInfo->getStructurePolicy()->getTerminalNodePositionOfWord( - binaryDictionaryInfo, prevWord, prevWordLength, false /* forceLowerCaseSearch */); + mPrevWordPos = getDictionaryStructurePolicy()->getTerminalNodePositionOfWord( + prevWord, prevWordLength, false /* forceLowerCaseSearch */); if (mPrevWordPos == NOT_A_VALID_WORD_POS) { // Check bigrams for lower-cased previous word if original was not found. Useful for // auto-capitalized words like "The [current_word]". - mPrevWordPos = binaryDictionaryInfo->getStructurePolicy()->getTerminalNodePositionOfWord( - binaryDictionaryInfo, prevWord, prevWordLength, true /* forceLowerCaseSearch */); + mPrevWordPos = getDictionaryStructurePolicy()->getTerminalNodePositionOfWord( + prevWord, prevWordLength, true /* forceLowerCaseSearch */); } } @@ -56,8 +54,9 @@ void DicTraverseSession::setupForGetSuggestions(const ProximityInfo *pInfo, maxSpatialDistance, maxPointerCount); } -const BinaryDictionaryInfo *DicTraverseSession::getBinaryDictionaryInfo() const { - return mDictionary->getBinaryDictionaryInfo(); +const DictionaryStructureWithBufferPolicy *DicTraverseSession::getDictionaryStructurePolicy() + const { + return mDictionary->getDictionaryStructurePolicy(); } void DicTraverseSession::resetCache(const int nextActiveCacheSize, const int maxWords) { diff --git a/native/jni/src/suggest/core/session/dic_traverse_session.h b/native/jni/src/suggest/core/session/dic_traverse_session.h index de57e041a..23de5cc65 100644 --- a/native/jni/src/suggest/core/session/dic_traverse_session.h +++ b/native/jni/src/suggest/core/session/dic_traverse_session.h @@ -28,8 +28,8 @@ namespace latinime { -class BinaryDictionaryInfo; class Dictionary; +class DictionaryStructureWithBufferPolicy; class ProximityInfo; class SuggestOptions; @@ -75,8 +75,7 @@ class DicTraverseSession { const int maxPointerCount); void resetCache(const int nextActiveCacheSize, const int maxWords); - // TODO: Remove - const BinaryDictionaryInfo *getBinaryDictionaryInfo() const; + const DictionaryStructureWithBufferPolicy *getDictionaryStructurePolicy() const; //-------------------- // getters and setters diff --git a/native/jni/src/suggest/core/suggest.cpp b/native/jni/src/suggest/core/suggest.cpp index 9376d7b93..3b77227a0 100644 --- a/native/jni/src/suggest/core/suggest.cpp +++ b/native/jni/src/suggest/core/suggest.cpp @@ -19,12 +19,12 @@ #include "suggest/core/dicnode/dic_node.h" #include "suggest/core/dicnode/dic_node_priority_queue.h" #include "suggest/core/dicnode/dic_node_vector.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" +#include "suggest/core/dictionary/binary_dictionary_shortcut_iterator.h" #include "suggest/core/dictionary/dictionary.h" #include "suggest/core/dictionary/digraph_utils.h" #include "suggest/core/dictionary/shortcut_utils.h" -#include "suggest/core/dictionary/terminal_attributes.h" #include "suggest/core/layout/proximity_info.h" +#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h" #include "suggest/core/policy/scoring.h" #include "suggest/core/policy/traversal.h" #include "suggest/core/policy/weighting.h" @@ -107,7 +107,7 @@ void Suggest::initializeSearch(DicTraverseSession *traverseSession, int commitPo MAX_RESULTS); // Create a new dic node here DicNode rootNode; - DicNodeUtils::initAsRoot(traverseSession->getBinaryDictionaryInfo(), + DicNodeUtils::initAsRoot(traverseSession->getDictionaryStructurePolicy(), traverseSession->getPrevWordPos(), &rootNode); traverseSession->getDicTraverseCache()->copyPushActive(&rootNode); } @@ -211,15 +211,14 @@ int Suggest::outputSuggestions(DicTraverseSession *traverseSession, int *frequen } if (!terminalDicNode->hasMultipleWords()) { - const BinaryDictionaryInfo *const binaryDictionaryInfo = - traverseSession->getBinaryDictionaryInfo(); - const TerminalAttributes terminalAttributes(traverseSession->getBinaryDictionaryInfo(), - binaryDictionaryInfo->getStructurePolicy()->getShortcutPositionOfNode( - binaryDictionaryInfo, terminalDicNode->getPos())); + BinaryDictionaryShortcutIterator shortcutIt( + traverseSession->getDictionaryStructurePolicy()->getShortcutsStructurePolicy(), + traverseSession->getDictionaryStructurePolicy() + ->getShortcutPositionOfNode(terminalDicNode->getPos())); // Shortcut is not supported for multiple words suggestions. // TODO: Check shortcuts during traversal for multiple words suggestions. const bool sameAsTyped = TRAVERSAL->sameAsTyped(traverseSession, terminalDicNode); - outputWordIndex = ShortcutUtils::outputShortcuts(&terminalAttributes, outputWordIndex, + outputWordIndex = ShortcutUtils::outputShortcuts(&shortcutIt, outputWordIndex, finalScore, outputCodePoints, frequencies, outputTypes, sameAsTyped); } DicNode::managedDelete(terminalDicNode); @@ -298,7 +297,7 @@ void Suggest::expandCurrentDicNodes(DicTraverseSession *traverseSession) const { } DicNodeUtils::getAllChildDicNodes( - &dicNode, traverseSession->getBinaryDictionaryInfo(), &childDicNodes); + &dicNode, traverseSession->getDictionaryStructurePolicy(), &childDicNodes); const int childDicNodesSize = childDicNodes.getSizeAndLock(); for (int i = 0; i < childDicNodesSize; ++i) { @@ -309,7 +308,8 @@ void Suggest::expandCurrentDicNodes(DicTraverseSession *traverseSession) const { continue; } if (DigraphUtils::hasDigraphForCodePoint( - traverseSession->getBinaryDictionaryInfo()->getHeader(), + traverseSession->getDictionaryStructurePolicy() + ->getHeaderStructurePolicy(), childDicNode->getNodeCodePoint())) { correctionDicNode.initByCopy(childDicNode); correctionDicNode.advanceDigraphIndex(); @@ -447,7 +447,7 @@ void Suggest::processDicNodeAsOmission( DicTraverseSession *traverseSession, DicNode *dicNode) const { DicNodeVector childDicNodes; DicNodeUtils::getAllChildDicNodes( - dicNode, traverseSession->getBinaryDictionaryInfo(), &childDicNodes); + dicNode, traverseSession->getDictionaryStructurePolicy(), &childDicNodes); const int size = childDicNodes.getSizeAndLock(); for (int i = 0; i < size; i++) { @@ -472,7 +472,8 @@ void Suggest::processDicNodeAsInsertion(DicTraverseSession *traverseSession, DicNode *dicNode) const { const int16_t pointIndex = dicNode->getInputIndex(0); DicNodeVector childDicNodes; - DicNodeUtils::getProximityChildDicNodes(dicNode, traverseSession->getBinaryDictionaryInfo(), + DicNodeUtils::getProximityChildDicNodes(dicNode, + traverseSession->getDictionaryStructurePolicy(), traverseSession->getProximityInfoState(0), pointIndex + 1, true, &childDicNodes); const int size = childDicNodes.getSizeAndLock(); for (int i = 0; i < size; i++) { @@ -490,14 +491,15 @@ void Suggest::processDicNodeAsTransposition(DicTraverseSession *traverseSession, DicNode *dicNode) const { const int16_t pointIndex = dicNode->getInputIndex(0); DicNodeVector childDicNodes1; - DicNodeUtils::getProximityChildDicNodes(dicNode, traverseSession->getBinaryDictionaryInfo(), + DicNodeUtils::getProximityChildDicNodes(dicNode, + traverseSession->getDictionaryStructurePolicy(), traverseSession->getProximityInfoState(0), pointIndex + 1, false, &childDicNodes1); const int childSize1 = childDicNodes1.getSizeAndLock(); for (int i = 0; i < childSize1; i++) { if (childDicNodes1[i]->hasChildren()) { DicNodeVector childDicNodes2; DicNodeUtils::getProximityChildDicNodes( - childDicNodes1[i], traverseSession->getBinaryDictionaryInfo(), + childDicNodes1[i], traverseSession->getDictionaryStructurePolicy(), traverseSession->getProximityInfoState(0), pointIndex, false, &childDicNodes2); const int childSize2 = childDicNodes2.getSizeAndLock(); for (int j = 0; j < childSize2; j++) { @@ -538,7 +540,7 @@ void Suggest::createNextWordDicNode(DicTraverseSession *traverseSession, DicNode // Create a non-cached node here. DicNode newDicNode; DicNodeUtils::initAsRootWithPreviousWord( - traverseSession->getBinaryDictionaryInfo(), dicNode, &newDicNode); + traverseSession->getDictionaryStructurePolicy(), dicNode, &newDicNode); const CorrectionType correctionType = spaceSubstitution ? CT_NEW_WORD_SPACE_SUBSTITUTION : CT_NEW_WORD_SPACE_OMITTION; Weighting::addCostAndForwardInputIndex(WEIGHTING, correctionType, traverseSession, dicNode, diff --git a/native/jni/src/suggest/policyimpl/dictionary/bigram/bigram_list_policy.h b/native/jni/src/suggest/policyimpl/dictionary/bigram/bigram_list_policy.h new file mode 100644 index 000000000..beb9bee27 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/bigram/bigram_list_policy.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_BIGRAM_LIST_POLICY_H +#define LATINIME_BIGRAM_LIST_POLICY_H + +#include <stdint.h> + +#include "defines.h" +#include "suggest/core/policy/dictionary_bigrams_structure_policy.h" +#include "suggest/policyimpl/dictionary/bigram/bigram_list_reading_utils.h" + +namespace latinime { + +class BigramListPolicy : public DictionaryBigramsStructurePolicy { + public: + explicit BigramListPolicy(const uint8_t *const bigramsBuf) : mBigramsBuf(bigramsBuf) {} + + ~BigramListPolicy() {} + + void getNextBigram(int *const outBigramPos, int *const outProbability, bool *const outHasNext, + int *const pos) const { + const BigramListReadingUtils::BigramFlags flags = + BigramListReadingUtils::getFlagsAndForwardPointer(mBigramsBuf, pos); + *outBigramPos = BigramListReadingUtils::getBigramAddressAndForwardPointer( + mBigramsBuf, flags, pos); + *outProbability = BigramListReadingUtils::getProbabilityFromFlags(flags); + *outHasNext = BigramListReadingUtils::hasNext(flags); + } + + void skipAllBigrams(int *const pos) const { + BigramListReadingUtils::skipExistingBigrams(mBigramsBuf, pos); + } + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(BigramListPolicy); + + const uint8_t *const mBigramsBuf; +}; +} // namespace latinime +#endif // LATINIME_BIGRAM_LIST_POLICY_H diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_terminal_attributes_reading_utils.cpp b/native/jni/src/suggest/policyimpl/dictionary/bigram/bigram_list_reading_utils.cpp index 20b77b3b2..6f4fcbfc2 100644 --- a/native/jni/src/suggest/core/dictionary/binary_dictionary_terminal_attributes_reading_utils.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/bigram/bigram_list_reading_utils.cpp @@ -14,46 +14,42 @@ * limitations under the License. */ -#include "suggest/core/dictionary/binary_dictionary_terminal_attributes_reading_utils.h" +#include "suggest/policyimpl/dictionary/bigram/bigram_list_reading_utils.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" #include "suggest/core/dictionary/byte_array_utils.h" namespace latinime { -typedef BinaryDictionaryTerminalAttributesReadingUtils TaUtils; - -const TaUtils::TerminalAttributeFlags TaUtils::MASK_ATTRIBUTE_ADDRESS_TYPE = 0x30; -const TaUtils::TerminalAttributeFlags TaUtils::FLAG_ATTRIBUTE_ADDRESS_TYPE_ONEBYTE = 0x10; -const TaUtils::TerminalAttributeFlags TaUtils::FLAG_ATTRIBUTE_ADDRESS_TYPE_TWOBYTES = 0x20; -const TaUtils::TerminalAttributeFlags TaUtils::FLAG_ATTRIBUTE_ADDRESS_TYPE_THREEBYTES = 0x30; -const TaUtils::TerminalAttributeFlags TaUtils::FLAG_ATTRIBUTE_OFFSET_NEGATIVE = 0x40; +const BigramListReadingUtils::BigramFlags BigramListReadingUtils::MASK_ATTRIBUTE_ADDRESS_TYPE = + 0x30; +const BigramListReadingUtils::BigramFlags + BigramListReadingUtils::FLAG_ATTRIBUTE_ADDRESS_TYPE_ONEBYTE = 0x10; +const BigramListReadingUtils::BigramFlags + BigramListReadingUtils::FLAG_ATTRIBUTE_ADDRESS_TYPE_TWOBYTES = 0x20; +const BigramListReadingUtils::BigramFlags + BigramListReadingUtils::FLAG_ATTRIBUTE_ADDRESS_TYPE_THREEBYTES = 0x30; +const BigramListReadingUtils::BigramFlags + BigramListReadingUtils::FLAG_ATTRIBUTE_OFFSET_NEGATIVE = 0x40; // Flag for presence of more attributes -const TaUtils::TerminalAttributeFlags TaUtils::FLAG_ATTRIBUTE_HAS_NEXT = 0x80; +const BigramListReadingUtils::BigramFlags BigramListReadingUtils::FLAG_ATTRIBUTE_HAS_NEXT = 0x80; // Mask for attribute probability, stored on 4 bits inside the flags byte. -const TaUtils::TerminalAttributeFlags TaUtils::MASK_ATTRIBUTE_PROBABILITY = 0x0F; -const int TaUtils::ATTRIBUTE_ADDRESS_SHIFT = 4; -const int TaUtils::SHORTCUT_LIST_SIZE_FIELD_SIZE = 2; -// The numeric value of the shortcut probability that means 'whitelist'. -const int TaUtils::WHITELIST_SHORTCUT_PROBABILITY = 15; +const BigramListReadingUtils::BigramFlags + BigramListReadingUtils::MASK_ATTRIBUTE_PROBABILITY = 0x0F; +const int BigramListReadingUtils::ATTRIBUTE_ADDRESS_SHIFT = 4; -/* static */ int TaUtils::getBigramAddressAndForwardPointer( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const TerminalAttributeFlags flags, - int *const pos) { +/* static */ int BigramListReadingUtils::getBigramAddressAndForwardPointer( + const uint8_t *const bigramsBuf, const BigramFlags flags, int *const pos) { int offset = 0; const int origin = *pos; switch (MASK_ATTRIBUTE_ADDRESS_TYPE & flags) { case FLAG_ATTRIBUTE_ADDRESS_TYPE_ONEBYTE: - offset = ByteArrayUtils::readUint8AndAdvancePosition( - binaryDictionaryInfo->getDictRoot(), pos); + offset = ByteArrayUtils::readUint8AndAdvancePosition(bigramsBuf, pos); break; case FLAG_ATTRIBUTE_ADDRESS_TYPE_TWOBYTES: - offset = ByteArrayUtils::readUint16AndAdvancePosition( - binaryDictionaryInfo->getDictRoot(), pos); + offset = ByteArrayUtils::readUint16AndAdvancePosition(bigramsBuf, pos); break; case FLAG_ATTRIBUTE_ADDRESS_TYPE_THREEBYTES: - offset = ByteArrayUtils::readUint24AndAdvancePosition( - binaryDictionaryInfo->getDictRoot(), pos); + offset = ByteArrayUtils::readUint24AndAdvancePosition(bigramsBuf, pos); break; } if (isOffsetNegative(flags)) { diff --git a/native/jni/src/suggest/policyimpl/dictionary/bigram/bigram_list_reading_utils.h b/native/jni/src/suggest/policyimpl/dictionary/bigram/bigram_list_reading_utils.h new file mode 100644 index 000000000..6b2bfe8c9 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/bigram/bigram_list_reading_utils.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_BIGRAM_LIST_READING_UTILS_H +#define LATINIME_BIGRAM_LIST_READING_UTILS_H + +#include <stdint.h> + +#include "defines.h" +#include "suggest/core/dictionary/byte_array_utils.h" + +namespace latinime { + +class BigramListReadingUtils { +public: + typedef uint8_t BigramFlags; + + static AK_FORCE_INLINE BigramFlags getFlagsAndForwardPointer( + const uint8_t *const bigramsBuf, int *const pos) { + return ByteArrayUtils::readUint8AndAdvancePosition(bigramsBuf, pos); + } + + static AK_FORCE_INLINE int getProbabilityFromFlags(const BigramFlags flags) { + return flags & MASK_ATTRIBUTE_PROBABILITY; + } + + static AK_FORCE_INLINE bool hasNext(const BigramFlags flags) { + return (flags & FLAG_ATTRIBUTE_HAS_NEXT) != 0; + } + + // Bigrams reading methods + static AK_FORCE_INLINE void skipExistingBigrams(const uint8_t *const bigramsBuf, + int *const pos) { + BigramFlags flags = getFlagsAndForwardPointer(bigramsBuf, pos); + while (hasNext(flags)) { + *pos += attributeAddressSize(flags); + flags = getFlagsAndForwardPointer(bigramsBuf, pos); + } + *pos += attributeAddressSize(flags); + } + + static int getBigramAddressAndForwardPointer(const uint8_t *const bigramsBuf, + const BigramFlags flags, int *const pos); + +private: + DISALLOW_IMPLICIT_CONSTRUCTORS(BigramListReadingUtils); + + static const BigramFlags MASK_ATTRIBUTE_ADDRESS_TYPE; + static const BigramFlags FLAG_ATTRIBUTE_ADDRESS_TYPE_ONEBYTE; + static const BigramFlags FLAG_ATTRIBUTE_ADDRESS_TYPE_TWOBYTES; + static const BigramFlags FLAG_ATTRIBUTE_ADDRESS_TYPE_THREEBYTES; + static const BigramFlags FLAG_ATTRIBUTE_OFFSET_NEGATIVE; + static const BigramFlags FLAG_ATTRIBUTE_HAS_NEXT; + static const BigramFlags MASK_ATTRIBUTE_PROBABILITY; + static const int ATTRIBUTE_ADDRESS_SHIFT; + + static AK_FORCE_INLINE bool isOffsetNegative(const BigramFlags flags) { + return (flags & FLAG_ATTRIBUTE_OFFSET_NEGATIVE) != 0; + } + + static AK_FORCE_INLINE int attributeAddressSize(const BigramFlags flags) { + return (flags & MASK_ATTRIBUTE_ADDRESS_TYPE) >> ATTRIBUTE_ADDRESS_SHIFT; + /* Note: this is a value-dependant optimization of what may probably be + more readably written this way: + switch (flags * BinaryFormat::MASK_ATTRIBUTE_ADDRESS_TYPE) { + case FLAG_ATTRIBUTE_ADDRESS_TYPE_ONEBYTE: return 1; + case FLAG_ATTRIBUTE_ADDRESS_TYPE_TWOBYTES: return 2; + case FLAG_ATTRIBUTE_ADDRESS_TYPE_THREEBYTE: return 3; + default: return 0; + } + */ + } +}; +} // namespace latinime +#endif // LATINIME_BIGRAM_LIST_READING_UTILS_H diff --git a/native/jni/src/suggest/policyimpl/dictionary/dictionary_structure_policy_factory.h b/native/jni/src/suggest/policyimpl/dictionary/dictionary_structure_with_buffer_policy_factory.cpp index c0df89f49..3054e4ea6 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/dictionary_structure_policy_factory.h +++ b/native/jni/src/suggest/policyimpl/dictionary/dictionary_structure_with_buffer_policy_factory.cpp @@ -14,8 +14,9 @@ * limitations under the License. */ -#ifndef LATINIME_DICTIONARY_STRUCTURE_POLICY_FACTORY_H -#define LATINIME_DICTIONARY_STRUCTURE_POLICY_FACTORY_H +#include "suggest/policyimpl/dictionary/dictionary_structure_with_buffer_policy_factory.h" + +#include <stdint.h> #include "defines.h" #include "suggest/core/dictionary/binary_dictionary_format_utils.h" @@ -24,25 +25,18 @@ namespace latinime { -class DictionaryStructurePolicy; - -class DictionaryStructurePolicyFactory { - public: - static const DictionaryStructurePolicy *getDictionaryStructurePolicy( - const BinaryDictionaryFormatUtils::FORMAT_VERSION dictionaryFormat) { - switch (dictionaryFormat) { - case BinaryDictionaryFormatUtils::VERSION_2: - return PatriciaTriePolicy::getInstance(); - case BinaryDictionaryFormatUtils::VERSION_3: - return DynamicPatriciaTriePolicy::getInstance(); - default: - ASSERT(false); - return 0; - } +/* static */ DictionaryStructureWithBufferPolicy *DictionaryStructureWithBufferPolicyFactory + ::newDictionaryStructureWithBufferPolicy(const uint8_t *const dictBuf, + const int dictSize) { + switch (BinaryDictionaryFormatUtils::detectFormatVersion(dictBuf, dictSize)) { + case BinaryDictionaryFormatUtils::VERSION_2: + return new PatriciaTriePolicy(dictBuf); + case BinaryDictionaryFormatUtils::VERSION_3: + return new DynamicPatriciaTriePolicy(dictBuf); + default: + ASSERT(false); + return 0; } +} - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(DictionaryStructurePolicyFactory); -}; } // namespace latinime -#endif // LATINIME_DICTIONARY_STRUCTURE_POLICY_FACTORY_H diff --git a/native/jni/src/suggest/policyimpl/dictionary/dictionary_structure_with_buffer_policy_factory.h b/native/jni/src/suggest/policyimpl/dictionary/dictionary_structure_with_buffer_policy_factory.h new file mode 100644 index 000000000..53eb8f927 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/dictionary_structure_with_buffer_policy_factory.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_DICTIONARY_STRUCTURE_WITH_BUFFER_POLICY_FACTORY_H +#define LATINIME_DICTIONARY_STRUCTURE_WITH_BUFFER_POLICY_FACTORY_H + +#include <stdint.h> + +#include "defines.h" +#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h" + +namespace latinime { + +class DictionaryStructureWithBufferPolicyFactory { + public: + static DictionaryStructureWithBufferPolicy *newDictionaryStructureWithBufferPolicy( + const uint8_t *const dictBuf, const int dictSize); + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(DictionaryStructureWithBufferPolicyFactory); +}; +} // namespace latinime +#endif // LATINIME_DICTIONARY_STRUCTURE_WITH_BUFFER_POLICY_FACTORY_H diff --git a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.cpp b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.cpp new file mode 100644 index 000000000..77a85c86d --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2013, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.h" + +#include "suggest/core/policy/dictionary_bigrams_structure_policy.h" +#include "suggest/core/policy/dictionary_shortcuts_structure_policy.h" +#include "suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h" + +namespace latinime { + +void DynamicPatriciaTrieNodeReader::fetchNodeInfoFromBufferAndProcessMovedNode(const int nodePos, + const int maxCodePointCount, int *const outCodePoints) { + int pos = nodePos; + mFlags = PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(mDictRoot, &pos); + const int parentPos = + DynamicPatriciaTrieReadingUtils::getParentPosAndAdvancePosition(mDictRoot, &pos); + mParentPos = (parentPos != 0) ? mNodePos + parentPos : NOT_A_DICT_POS; + if (outCodePoints != 0) { + mCodePointCount = PatriciaTrieReadingUtils::getCharsAndAdvancePosition( + mDictRoot, mFlags, maxCodePointCount, outCodePoints, &pos); + } else { + mCodePointCount = PatriciaTrieReadingUtils::skipCharacters( + mDictRoot, mFlags, MAX_WORD_LENGTH, &pos); + } + if (isTerminal()) { + mProbability = PatriciaTrieReadingUtils::readProbabilityAndAdvancePosition(mDictRoot, &pos); + } else { + mProbability = NOT_A_PROBABILITY; + } + if (hasChildren()) { + mChildrenPos = DynamicPatriciaTrieReadingUtils::readChildrenPositionAndAdvancePosition( + mDictRoot, mFlags, &pos); + } else { + mChildrenPos = NOT_A_DICT_POS; + } + if (PatriciaTrieReadingUtils::hasShortcutTargets(mFlags)) { + mShortcutPos = pos; + mShortcutsPolicy->skipAllShortcuts(&pos); + } else { + mShortcutPos = NOT_A_DICT_POS; + } + if (PatriciaTrieReadingUtils::hasBigrams(mFlags)) { + mBigramPos = pos; + mBigramsPolicy->skipAllBigrams(&pos); + } else { + mBigramPos = NOT_A_DICT_POS; + } + // Update siblingPos if needed. + if (mSiblingPos == NOT_A_VALID_WORD_POS) { + // Sibling position is the tail position of current node. + mSiblingPos = pos; + } + // Read destination node if the read node is a moved node. + if (DynamicPatriciaTrieReadingUtils::isMoved(mFlags)) { + // The destination position is stored at the same place as the parent position. + fetchNodeInfoFromBufferAndProcessMovedNode(mParentPos, maxCodePointCount, outCodePoints); + } +} + +} diff --git a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.h b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.h new file mode 100644 index 000000000..e990809e8 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.h @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2013, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_DYNAMIC_PATRICIA_TRIE_NODE_READER_H +#define LATINIME_DYNAMIC_PATRICIA_TRIE_NODE_READER_H + +#include <stdint.h> + +#include "defines.h" +#include "suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h" +#include "suggest/policyimpl/dictionary/patricia_trie_reading_utils.h" + +namespace latinime { + +class DictionaryBigramsStructurePolicy; +class DictionaryShortcutsStructurePolicy; + +/* + * This class is used for helping to read nodes of dynamic patricia trie. This class handles moved + * node and reads node attributes. + */ +class DynamicPatriciaTrieNodeReader { + public: + DynamicPatriciaTrieNodeReader(const uint8_t *const dictRoot, + const DictionaryBigramsStructurePolicy *const bigramsPolicy, + const DictionaryShortcutsStructurePolicy *const shortcutsPolicy) + : mDictRoot(dictRoot), mBigramsPolicy(bigramsPolicy), + mShortcutsPolicy(shortcutsPolicy), mNodePos(NOT_A_VALID_WORD_POS), mFlags(0), + mParentPos(NOT_A_DICT_POS), mCodePointCount(0), mProbability(NOT_A_PROBABILITY), + mChildrenPos(NOT_A_DICT_POS), mShortcutPos(NOT_A_DICT_POS), + mBigramPos(NOT_A_DICT_POS), mSiblingPos(NOT_A_VALID_WORD_POS) {} + + ~DynamicPatriciaTrieNodeReader() {} + + // Reads node information from dictionary buffer and updates members with the information. + AK_FORCE_INLINE void fetchNodeInfoFromBuffer(const int nodePos) { + fetchNodeInfoFromBufferAndGetNodeCodePoints(nodePos , 0 /* maxCodePointCount */, + 0 /* outCodePoints */); + } + + AK_FORCE_INLINE void fetchNodeInfoFromBufferAndGetNodeCodePoints(const int nodePos, + const int maxCodePointCount, int *const outCodePoints) { + mNodePos = nodePos; + mSiblingPos = NOT_A_VALID_WORD_POS; + fetchNodeInfoFromBufferAndProcessMovedNode(mNodePos, maxCodePointCount, outCodePoints); + } + + AK_FORCE_INLINE int getNodePos() const { + return mNodePos; + } + + // Flags + AK_FORCE_INLINE bool isDeleted() const { + return DynamicPatriciaTrieReadingUtils::isDeleted(mFlags); + } + + AK_FORCE_INLINE bool hasChildren() const { + return PatriciaTrieReadingUtils::hasChildrenInFlags(mFlags); + } + + AK_FORCE_INLINE bool isTerminal() const { + return PatriciaTrieReadingUtils::isTerminal(mFlags); + } + + AK_FORCE_INLINE bool isBlacklisted() const { + return PatriciaTrieReadingUtils::isBlacklisted(mFlags); + } + + AK_FORCE_INLINE bool isNotAWord() const { + return PatriciaTrieReadingUtils::isNotAWord(mFlags); + } + + // Parent node position + AK_FORCE_INLINE int getParentPos() const { + return mParentPos; + } + + // Number of code points + AK_FORCE_INLINE uint8_t getCodePointCount() const { + return mCodePointCount; + } + + // Probability + AK_FORCE_INLINE int getProbability() const { + return mProbability; + } + + // Children node group position + AK_FORCE_INLINE int getChildrenPos() const { + return mChildrenPos; + } + + // Shortcutlist position + AK_FORCE_INLINE int getShortcutPos() const { + return mShortcutPos; + } + + // Bigrams position + AK_FORCE_INLINE int getBigramsPos() const { + return mBigramPos; + } + + // Sibling node position + AK_FORCE_INLINE int getSiblingNodePos() const { + return mSiblingPos; + } + + private: + DISALLOW_COPY_AND_ASSIGN(DynamicPatriciaTrieNodeReader); + + // TODO: Consolidate mDictRoot. + const uint8_t *const mDictRoot; + const DictionaryBigramsStructurePolicy *const mBigramsPolicy; + const DictionaryShortcutsStructurePolicy *const mShortcutsPolicy; + int mNodePos; + DynamicPatriciaTrieReadingUtils::NodeFlags mFlags; + int mParentPos; + uint8_t mCodePointCount; + int mProbability; + int mChildrenPos; + int mShortcutPos; + int mBigramPos; + int mSiblingPos; + + void fetchNodeInfoFromBufferAndProcessMovedNode(const int nodePos, const int maxCodePointCount, + int *const outCodePoints); +}; +} // namespace latinime +#endif /* LATINIME_DYNAMIC_PATRICIA_TRIE_NODE_READER_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp index c7314ecf1..7d3b2e28e 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.cpp @@ -14,56 +14,221 @@ * limitations under the License. */ -#include "suggest/policyimpl/dictionary/patricia_trie_policy.h" +#include "suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.h" #include "defines.h" #include "suggest/core/dicnode/dic_node.h" #include "suggest/core/dicnode/dic_node_vector.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" +#include "suggest/policyimpl/dictionary/dynamic_patricia_trie_node_reader.h" +#include "suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h" +#include "suggest/policyimpl/dictionary/patricia_trie_reading_utils.h" namespace latinime { -const DynamicPatriciaTriePolicy DynamicPatriciaTriePolicy::sInstance; +// To avoid infinite loop caused by invalid or malicious forward links. +const int DynamicPatriciaTriePolicy::MAX_CHILD_COUNT_TO_AVOID_INFINITE_LOOP = 100000; void DynamicPatriciaTriePolicy::createAndGetAllChildNodes(const DicNode *const dicNode, - const BinaryDictionaryInfo *const binaryDictionaryInfo, const NodeFilter *const nodeFilter, DicNodeVector *const childDicNodes) const { - // TODO: Implement. + if (!dicNode->hasChildren()) { + return; + } + DynamicPatriciaTrieNodeReader nodeReader(mDictRoot, getBigramsStructurePolicy(), + getShortcutsStructurePolicy()); + int mergedNodeCodePoints[MAX_WORD_LENGTH]; + int nextPos = dicNode->getChildrenPos(); + int totalChildCount = 0; + do { + const int childCount = PatriciaTrieReadingUtils::getGroupCountAndAdvancePosition( + mDictRoot, &nextPos); + totalChildCount += childCount; + if (childCount <= 0 || totalChildCount > MAX_CHILD_COUNT_TO_AVOID_INFINITE_LOOP) { + // Invalid dictionary. + AKLOGI("Invalid dictionary. childCount: %d, totalChildCount: %d, MAX: %d", + childCount, totalChildCount, MAX_CHILD_COUNT_TO_AVOID_INFINITE_LOOP); + ASSERT(false); + return; + } + for (int i = 0; i < childCount; i++) { + nodeReader.fetchNodeInfoFromBufferAndGetNodeCodePoints(nextPos, MAX_WORD_LENGTH, + mergedNodeCodePoints); + if (!nodeReader.isDeleted() && !nodeFilter->isFilteredOut(mergedNodeCodePoints[0])) { + // Push child node when the node is not deleted and not filtered out. + childDicNodes->pushLeavingChild(dicNode, nodeReader.getNodePos(), + nodeReader.getChildrenPos(), nodeReader.getProbability(), + nodeReader.isTerminal(), nodeReader.hasChildren(), + nodeReader.isBlacklisted() || nodeReader.isNotAWord(), + nodeReader.getCodePointCount(), mergedNodeCodePoints); + } + nextPos = nodeReader.getSiblingNodePos(); + } + nextPos = DynamicPatriciaTrieReadingUtils::getForwardLinkPosition(mDictRoot, nextPos); + } while (DynamicPatriciaTrieReadingUtils::isValidForwardLinkPosition(nextPos)); } int DynamicPatriciaTriePolicy::getCodePointsAndProbabilityAndReturnCodePointCount( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int nodePos, const int maxCodePointCount, int *const outCodePoints, int *const outUnigramProbability) const { - // TODO: Implement. - return 0; + if (nodePos == NOT_A_VALID_WORD_POS) { + *outUnigramProbability = NOT_A_PROBABILITY; + return 0; + } + // This method traverses parent nodes from the terminal by following parent pointers; thus, + // node code points are stored in the buffer in the reverse order. + int reverseCodePoints[maxCodePointCount]; + int mergedNodeCodePoints[maxCodePointCount]; + int codePointCount = 0; + + DynamicPatriciaTrieNodeReader nodeReader(mDictRoot, getBigramsStructurePolicy(), + getShortcutsStructurePolicy()); + // First, read terminal node and get its probability. + nodeReader.fetchNodeInfoFromBufferAndGetNodeCodePoints(nodePos, maxCodePointCount, + mergedNodeCodePoints); + // Store terminal node probability. + *outUnigramProbability = nodeReader.getProbability(); + // Store terminal node code points to buffer in the reverse order. + for (int i = nodeReader.getCodePointCount() - 1; i >= 0; --i) { + reverseCodePoints[codePointCount++] = mergedNodeCodePoints[i]; + } + // Then, follow parent pos toward the root node. + while (nodeReader.getParentPos() != NOT_A_DICT_POS) { + // codePointCount must be incremented at least once in each iteration to ensure preventing + // infinite loop. + if (nodeReader.isDeleted() || codePointCount > maxCodePointCount + || nodeReader.getCodePointCount() <= 0) { + // The nodePos is not a valid terminal node position in the dictionary. + *outUnigramProbability = NOT_A_PROBABILITY; + return 0; + } + // Read parent node. + nodeReader.fetchNodeInfoFromBufferAndGetNodeCodePoints(nodeReader.getParentPos(), + maxCodePointCount, mergedNodeCodePoints); + // Store node code points to buffer in the reverse order. + for (int i = nodeReader.getCodePointCount() - 1; i >= 0; --i) { + reverseCodePoints[codePointCount++] = mergedNodeCodePoints[i]; + } + } + // Reverse the stored code points to output them. + for (int i = 0; i < codePointCount; ++i) { + outCodePoints[i] = reverseCodePoints[codePointCount - i - 1]; + } + return codePointCount; } -int DynamicPatriciaTriePolicy::getTerminalNodePositionOfWord( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int *const inWord, +int DynamicPatriciaTriePolicy::getTerminalNodePositionOfWord(const int *const inWord, const int length, const bool forceLowerCaseSearch) const { - // TODO: Implement. - return NOT_A_DICT_POS; + int searchCodePoints[length]; + for (int i = 0; i < length; ++i) { + searchCodePoints[i] = forceLowerCaseSearch ? CharUtils::toLowerCase(inWord[i]) : inWord[i]; + } + int mergedNodeCodePoints[MAX_WORD_LENGTH]; + int currentLength = 0; + int pos = getRootPosition(); + DynamicPatriciaTrieNodeReader nodeReader(mDictRoot, getBigramsStructurePolicy(), + getShortcutsStructurePolicy()); + while (currentLength <= length) { + // When foundMatchedNode becomes true, currentLength is increased at least once. + bool foundMatchedNode = false; + int totalChildCount = 0; + do { + const int childCount = PatriciaTrieReadingUtils::getGroupCountAndAdvancePosition( + mDictRoot, &pos); + totalChildCount += childCount; + if (childCount <= 0 || totalChildCount > MAX_CHILD_COUNT_TO_AVOID_INFINITE_LOOP) { + // Invalid dictionary. + AKLOGI("Invalid dictionary. childCount: %d, totalChildCount: %d, MAX: %d", + childCount, totalChildCount, MAX_CHILD_COUNT_TO_AVOID_INFINITE_LOOP); + ASSERT(false); + return NOT_A_VALID_WORD_POS; + } + for (int i = 0; i < childCount; i++) { + nodeReader.fetchNodeInfoFromBufferAndGetNodeCodePoints(pos, MAX_WORD_LENGTH, + mergedNodeCodePoints); + if (nodeReader.isDeleted() || nodeReader.getCodePointCount() <= 0) { + // Skip deleted or empty node. + pos = nodeReader.getSiblingNodePos(); + continue; + } + bool matched = true; + for (int j = 0; j < nodeReader.getCodePointCount(); ++j) { + if (mergedNodeCodePoints[j] != searchCodePoints[currentLength + j]) { + // Different code point is found. + matched = false; + break; + } + } + if (matched) { + currentLength += nodeReader.getCodePointCount(); + if (length == currentLength) { + // Terminal position is found. + return nodeReader.getNodePos(); + } + if (!nodeReader.hasChildren()) { + return NOT_A_VALID_WORD_POS; + } + foundMatchedNode = true; + // Advance to the children nodes. + pos = nodeReader.getChildrenPos(); + break; + } + // Try next sibling node. + pos = nodeReader.getSiblingNodePos(); + } + if (foundMatchedNode) { + break; + } + // If the matched node is not found in the current node group, try to follow the + // forward link. + pos = DynamicPatriciaTrieReadingUtils::getForwardLinkPosition( + mDictRoot, pos); + } while (DynamicPatriciaTrieReadingUtils::isValidForwardLinkPosition(pos)); + if (!foundMatchedNode) { + // Matched node is not found. + return NOT_A_VALID_WORD_POS; + } + } + // If we already traversed the tree further than the word is long, there means + // there was no match (or we would have found it). + return NOT_A_VALID_WORD_POS; } -int DynamicPatriciaTriePolicy::getUnigramProbability( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int nodePos) const { - // TODO: Implement. - return NOT_A_PROBABILITY; +int DynamicPatriciaTriePolicy::getUnigramProbability(const int nodePos) const { + if (nodePos == NOT_A_VALID_WORD_POS) { + return NOT_A_PROBABILITY; + } + DynamicPatriciaTrieNodeReader nodeReader(mDictRoot, getBigramsStructurePolicy(), + getShortcutsStructurePolicy()); + nodeReader.fetchNodeInfoFromBuffer(nodePos); + if (nodeReader.isDeleted() || nodeReader.isBlacklisted() || nodeReader.isNotAWord()) { + return NOT_A_PROBABILITY; + } + return nodeReader.getProbability(); } -int DynamicPatriciaTriePolicy::getShortcutPositionOfNode( - const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const { - // TODO: Implement. - return NOT_A_DICT_POS; +int DynamicPatriciaTriePolicy::getShortcutPositionOfNode(const int nodePos) const { + if (nodePos == NOT_A_VALID_WORD_POS) { + return NOT_A_DICT_POS; + } + DynamicPatriciaTrieNodeReader nodeReader(mDictRoot, getBigramsStructurePolicy(), + getShortcutsStructurePolicy()); + nodeReader.fetchNodeInfoFromBuffer(nodePos); + if (nodeReader.isDeleted()) { + return NOT_A_DICT_POS; + } + return nodeReader.getShortcutPos(); } -int DynamicPatriciaTriePolicy::getBigramsPositionOfNode( - const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const { - // TODO: Implement. - return NOT_A_DICT_POS; +int DynamicPatriciaTriePolicy::getBigramsPositionOfNode(const int nodePos) const { + if (nodePos == NOT_A_VALID_WORD_POS) { + return NOT_A_DICT_POS; + } + DynamicPatriciaTrieNodeReader nodeReader(mDictRoot, getBigramsStructurePolicy(), + getShortcutsStructurePolicy()); + nodeReader.fetchNodeInfoFromBuffer(nodePos); + if (nodeReader.isDeleted()) { + return NOT_A_DICT_POS; + } + return nodeReader.getBigramsPos(); } } // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.h b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.h index 39dfb86fd..56475b137 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.h +++ b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_policy.h @@ -17,53 +17,68 @@ #ifndef LATINIME_DYNAMIC_PATRICIA_TRIE_POLICY_H #define LATINIME_DYNAMIC_PATRICIA_TRIE_POLICY_H +#include <stdint.h> + #include "defines.h" -#include "suggest/core/policy/dictionary_structure_policy.h" +#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h" +#include "suggest/policyimpl/dictionary/bigram/bigram_list_policy.h" +#include "suggest/policyimpl/dictionary/header/header_policy.h" +#include "suggest/policyimpl/dictionary/shortcut/shortcut_list_policy.h" namespace latinime { -class BinaryDictionaryInfo; class DicNode; class DicNodeVector; -class DynamicPatriciaTriePolicy : public DictionaryStructurePolicy { +class DynamicPatriciaTriePolicy : public DictionaryStructureWithBufferPolicy { public: - static AK_FORCE_INLINE const DynamicPatriciaTriePolicy *getInstance() { - return &sInstance; - } + DynamicPatriciaTriePolicy(const uint8_t *const dictBuf) + : mHeaderPolicy(dictBuf), mDictRoot(dictBuf + mHeaderPolicy.getSize()), + mBigramListPolicy(mDictRoot), mShortcutListPolicy(mDictRoot) {} + + ~DynamicPatriciaTriePolicy() {} AK_FORCE_INLINE int getRootPosition() const { return 0; } void createAndGetAllChildNodes(const DicNode *const dicNode, - const BinaryDictionaryInfo *const binaryDictionaryInfo, const NodeFilter *const nodeFilter, DicNodeVector *const childDicNodes) const; int getCodePointsAndProbabilityAndReturnCodePointCount( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int terminalNodePos, const int maxCodePointCount, int *const outCodePoints, int *const outUnigramProbability) const; - int getTerminalNodePositionOfWord( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int *const inWord, + int getTerminalNodePositionOfWord(const int *const inWord, const int length, const bool forceLowerCaseSearch) const; - int getUnigramProbability(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const; + int getUnigramProbability(const int nodePos) const; + + int getShortcutPositionOfNode(const int nodePos) const; - int getShortcutPositionOfNode(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const; + int getBigramsPositionOfNode(const int nodePos) const; - int getBigramsPositionOfNode(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const; + const DictionaryHeaderStructurePolicy *getHeaderStructurePolicy() const { + return &mHeaderPolicy; + } + + const DictionaryBigramsStructurePolicy *getBigramsStructurePolicy() const { + return &mBigramListPolicy; + } + + const DictionaryShortcutsStructurePolicy *getShortcutsStructurePolicy() const { + return &mShortcutListPolicy; + } private: - DISALLOW_COPY_AND_ASSIGN(DynamicPatriciaTriePolicy); - static const DynamicPatriciaTriePolicy sInstance; + DISALLOW_IMPLICIT_CONSTRUCTORS(DynamicPatriciaTriePolicy); + static const int MAX_CHILD_COUNT_TO_AVOID_INFINITE_LOOP; - DynamicPatriciaTriePolicy() {} - ~DynamicPatriciaTriePolicy() {} + const HeaderPolicy mHeaderPolicy; + // TODO: Consolidate mDictRoot. + const uint8_t *const mDictRoot; + const BigramListPolicy mBigramListPolicy; + const ShortcutListPolicy mShortcutListPolicy; }; } // namespace latinime #endif // LATINIME_DYNAMIC_PATRICIA_TRIE_POLICY_H diff --git a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h index f44c2651a..5398d7e37 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h +++ b/native/jni/src/suggest/policyimpl/dictionary/dynamic_patricia_trie_reading_utils.h @@ -39,8 +39,7 @@ class DynamicPatriciaTrieReadingUtils { static AK_FORCE_INLINE int getParentPosAndAdvancePosition(const uint8_t *const buffer, int *const pos) { - const int base = *pos; - return base + ByteArrayUtils::readSint24AndAdvancePosition(buffer, pos); + return ByteArrayUtils::readSint24AndAdvancePosition(buffer, pos); } static int readChildrenPositionAndAdvancePosition(const uint8_t *const buffer, diff --git a/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp new file mode 100644 index 000000000..eb828b58c --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2013, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "suggest/policyimpl/dictionary/header/header_policy.h" + +namespace latinime { + +const char *const HeaderPolicy::MULTIPLE_WORDS_DEMOTION_RATE_KEY = + "MULTIPLE_WORDS_DEMOTION_RATE"; +const float HeaderPolicy::DEFAULT_MULTI_WORD_COST_MULTIPLIER = 1.0f; +const float HeaderPolicy::MULTI_WORD_COST_MULTIPLIER_SCALE = 100.0f; + +float HeaderPolicy::readMultiWordCostMultiplier() const { + const int headerValue = HeaderReadingUtils::readHeaderValueInt( + mDictBuf, MULTIPLE_WORDS_DEMOTION_RATE_KEY); + if (headerValue == S_INT_MIN) { + // not found + return DEFAULT_MULTI_WORD_COST_MULTIPLIER; + } + if (headerValue <= 0) { + return static_cast<float>(MAX_VALUE_FOR_WEIGHTING); + } + return MULTI_WORD_COST_MULTIPLIER_SCALE / static_cast<float>(headerValue); +} + +} // namespace latinime diff --git a/native/jni/src/suggest/core/dictionary/binary_dictionary_header.h b/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.h index 240512bce..e3e6fc077 100644 --- a/native/jni/src/suggest/core/dictionary/binary_dictionary_header.h +++ b/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.h @@ -14,38 +14,40 @@ * limitations under the License. */ -#ifndef LATINIME_BINARY_DICTIONARY_HEADER_H -#define LATINIME_BINARY_DICTIONARY_HEADER_H +#ifndef LATINIME_HEADER_POLICY_H +#define LATINIME_HEADER_POLICY_H + +#include <stdint.h> #include "defines.h" -#include "suggest/core/dictionary/binary_dictionary_header_reading_utils.h" +#include "suggest/core/policy/dictionary_header_structure_policy.h" +#include "suggest/policyimpl/dictionary/header/header_reading_utils.h" namespace latinime { -class BinaryDictionaryInfo; - -/** - * This class abstracts dictionary header structures and provide interface to access dictionary - * header information. - */ -class BinaryDictionaryHeader { +class HeaderPolicy : public DictionaryHeaderStructurePolicy { public: - explicit BinaryDictionaryHeader(const BinaryDictionaryInfo *const binaryDictionaryInfo); + explicit HeaderPolicy(const uint8_t *const dictBuf) + : mDictBuf(dictBuf), mDictionaryFlags(HeaderReadingUtils::getFlags(dictBuf)), + mSize(HeaderReadingUtils::getHeaderSize(dictBuf)), + mMultiWordCostMultiplier(readMultiWordCostMultiplier()) {} + + ~HeaderPolicy() {} AK_FORCE_INLINE int getSize() const { return mSize; } AK_FORCE_INLINE bool supportsDynamicUpdate() const { - return BinaryDictionaryHeaderReadingUtils::supportsDynamicUpdate(mDictionaryFlags); + return HeaderReadingUtils::supportsDynamicUpdate(mDictionaryFlags); } AK_FORCE_INLINE bool requiresGermanUmlautProcessing() const { - return BinaryDictionaryHeaderReadingUtils::requiresGermanUmlautProcessing(mDictionaryFlags); + return HeaderReadingUtils::requiresGermanUmlautProcessing(mDictionaryFlags); } AK_FORCE_INLINE bool requiresFrenchLigatureProcessing() const { - return BinaryDictionaryHeaderReadingUtils::requiresFrenchLigatureProcessing( + return HeaderReadingUtils::requiresFrenchLigatureProcessing( mDictionaryFlags); } @@ -60,7 +62,7 @@ class BinaryDictionaryHeader { outValue[0] = '\0'; return; } - if (!BinaryDictionaryHeaderReadingUtils::readHeaderValue(mBinaryDictionaryInfo, + if (!HeaderReadingUtils::readHeaderValue(mDictBuf, key, outValue, outValueSize)) { outValue[0] = '?'; outValue[1] = '\0'; @@ -68,18 +70,19 @@ class BinaryDictionaryHeader { } private: - DISALLOW_COPY_AND_ASSIGN(BinaryDictionaryHeader); + DISALLOW_IMPLICIT_CONSTRUCTORS(HeaderPolicy); static const char *const MULTIPLE_WORDS_DEMOTION_RATE_KEY; static const float DEFAULT_MULTI_WORD_COST_MULTIPLIER; static const float MULTI_WORD_COST_MULTIPLIER_SCALE; - const BinaryDictionaryInfo *const mBinaryDictionaryInfo; - const BinaryDictionaryHeaderReadingUtils::DictionaryFlags mDictionaryFlags; + const uint8_t *const mDictBuf; + const HeaderReadingUtils::DictionaryFlags mDictionaryFlags; const int mSize; const float mMultiWordCostMultiplier; float readMultiWordCostMultiplier() const; }; + } // namespace latinime -#endif // LATINIME_BINARY_DICTIONARY_HEADER_H +#endif /* LATINIME_HEADER_POLICY_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/header/header_reading_utils.cpp b/native/jni/src/suggest/policyimpl/dictionary/header/header_reading_utils.cpp new file mode 100644 index 000000000..70f45dfa8 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/header/header_reading_utils.cpp @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2013, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "suggest/policyimpl/dictionary/header/header_reading_utils.h" + +#include <cctype> +#include <cstdlib> + +#include "defines.h" +#include "suggest/core/dictionary/byte_array_utils.h" + +namespace latinime { + +const int HeaderReadingUtils::MAX_OPTION_KEY_LENGTH = 256; + +const int HeaderReadingUtils::HEADER_MAGIC_NUMBER_SIZE = 4; +const int HeaderReadingUtils::HEADER_DICTIONARY_VERSION_SIZE = 2; +const int HeaderReadingUtils::HEADER_FLAG_SIZE = 2; +const int HeaderReadingUtils::HEADER_SIZE_FIELD_SIZE = 4; + +const HeaderReadingUtils::DictionaryFlags + HeaderReadingUtils::NO_FLAGS = 0; +// Flags for special processing +// Those *must* match the flags in makedict (BinaryDictInputOutput#*_PROCESSING_FLAG) or +// something very bad (like, the apocalypse) will happen. Please update both at the same time. +const HeaderReadingUtils::DictionaryFlags + HeaderReadingUtils::GERMAN_UMLAUT_PROCESSING_FLAG = 0x1; +const HeaderReadingUtils::DictionaryFlags + HeaderReadingUtils::SUPPORTS_DYNAMIC_UPDATE_FLAG = 0x2; +const HeaderReadingUtils::DictionaryFlags + HeaderReadingUtils::FRENCH_LIGATURE_PROCESSING_FLAG = 0x4; + +/* static */ int HeaderReadingUtils::getHeaderSize(const uint8_t *const dictBuf) { + // See the format of the header in the comment in + // BinaryDictionaryFormatUtils::detectFormatVersion() + return ByteArrayUtils::readUint32(dictBuf, HEADER_MAGIC_NUMBER_SIZE + + HEADER_DICTIONARY_VERSION_SIZE + HEADER_FLAG_SIZE); +} + +/* static */ HeaderReadingUtils::DictionaryFlags + HeaderReadingUtils::getFlags(const uint8_t *const dictBuf) { + return ByteArrayUtils::readUint16(dictBuf, + HEADER_MAGIC_NUMBER_SIZE + HEADER_DICTIONARY_VERSION_SIZE); +} + +// Returns if the key is found or not and reads the found value into outValue. +/* static */ bool HeaderReadingUtils::readHeaderValue(const uint8_t *const dictBuf, + const char *const key, int *outValue, const int outValueSize) { + if (outValueSize <= 0) { + return false; + } + const int headerSize = getHeaderSize(dictBuf); + int pos = getHeaderOptionsPosition(); + if (pos == NOT_A_DICT_POS) { + // The header doesn't have header options. + return false; + } + while (pos < headerSize) { + if(ByteArrayUtils::compareStringInBufferWithCharArray( + dictBuf, key, headerSize - pos, &pos) == 0) { + // The key was found. + const int length = ByteArrayUtils::readStringAndAdvancePosition(dictBuf, outValueSize, + outValue, &pos); + // Add a 0 terminator to the string. + outValue[length < outValueSize ? length : outValueSize - 1] = '\0'; + return true; + } + ByteArrayUtils::advancePositionToBehindString(dictBuf, headerSize - pos, &pos); + } + // The key was not found. + return false; +} + +/* static */ int HeaderReadingUtils::readHeaderValueInt( + const uint8_t *const dictBuf, const char *const key) { + const int bufferSize = LARGEST_INT_DIGIT_COUNT; + int intBuffer[bufferSize]; + char charBuffer[bufferSize]; + if (!readHeaderValue(dictBuf, key, intBuffer, bufferSize)) { + return S_INT_MIN; + } + for (int i = 0; i < bufferSize; ++i) { + charBuffer[i] = intBuffer[i]; + if (charBuffer[i] == '0') { + break; + } + if (!isdigit(charBuffer[i])) { + // If not a number, return S_INT_MIN + return S_INT_MIN; + } + } + return atoi(charBuffer); +} + +} // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/header/header_reading_utils.h b/native/jni/src/suggest/policyimpl/dictionary/header/header_reading_utils.h new file mode 100644 index 000000000..c94919640 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/header/header_reading_utils.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2013, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_HEADER_READING_UTILS_H +#define LATINIME_HEADER_READING_UTILS_H + +#include <stdint.h> + +#include "defines.h" + +namespace latinime { + +class HeaderReadingUtils { + public: + typedef uint16_t DictionaryFlags; + + static const int MAX_OPTION_KEY_LENGTH; + + static int getHeaderSize(const uint8_t *const dictBuf); + + static DictionaryFlags getFlags(const uint8_t *const dictBuf); + + static AK_FORCE_INLINE bool supportsDynamicUpdate(const DictionaryFlags flags) { + return (flags & SUPPORTS_DYNAMIC_UPDATE_FLAG) != 0; + } + + static AK_FORCE_INLINE bool requiresGermanUmlautProcessing(const DictionaryFlags flags) { + return (flags & GERMAN_UMLAUT_PROCESSING_FLAG) != 0; + } + + static AK_FORCE_INLINE bool requiresFrenchLigatureProcessing(const DictionaryFlags flags) { + return (flags & FRENCH_LIGATURE_PROCESSING_FLAG) != 0; + } + + static AK_FORCE_INLINE int getHeaderOptionsPosition() { + return HEADER_MAGIC_NUMBER_SIZE + HEADER_DICTIONARY_VERSION_SIZE + HEADER_FLAG_SIZE + + HEADER_SIZE_FIELD_SIZE; + } + + static bool readHeaderValue(const uint8_t *const dictBuf, + const char *const key, int *outValue, const int outValueSize); + + static int readHeaderValueInt(const uint8_t *const dictBuf, const char *const key); + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(HeaderReadingUtils); + + static const int HEADER_MAGIC_NUMBER_SIZE; + static const int HEADER_DICTIONARY_VERSION_SIZE; + static const int HEADER_FLAG_SIZE; + static const int HEADER_SIZE_FIELD_SIZE; + + static const DictionaryFlags NO_FLAGS; + // Flags for special processing + // Those *must* match the flags in makedict (FormatSpec#*_PROCESSING_FLAGS) or + // something very bad (like, the apocalypse) will happen. Please update both at the same time. + static const DictionaryFlags GERMAN_UMLAUT_PROCESSING_FLAG; + static const DictionaryFlags SUPPORTS_DYNAMIC_UPDATE_FLAG; + static const DictionaryFlags FRENCH_LIGATURE_PROCESSING_FLAG; + static const DictionaryFlags CONTAINS_BIGRAMS_FLAG; +}; +} +#endif /* LATINIME_HEADER_READING_UTILS_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/patricia_trie_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/patricia_trie_policy.cpp index 097f7c86a..8ce2b3ea0 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/patricia_trie_policy.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/patricia_trie_policy.cpp @@ -20,55 +20,44 @@ #include "defines.h" #include "suggest/core/dicnode/dic_node.h" #include "suggest/core/dicnode/dic_node_vector.h" -#include "suggest/core/dictionary/binary_dictionary_info.h" -#include "suggest/core/dictionary/binary_dictionary_terminal_attributes_reading_utils.h" #include "suggest/policyimpl/dictionary/binary_format.h" #include "suggest/policyimpl/dictionary/patricia_trie_reading_utils.h" namespace latinime { -const PatriciaTriePolicy PatriciaTriePolicy::sInstance; - void PatriciaTriePolicy::createAndGetAllChildNodes(const DicNode *const dicNode, - const BinaryDictionaryInfo *const binaryDictionaryInfo, const NodeFilter *const nodeFilter, DicNodeVector *const childDicNodes) const { if (!dicNode->hasChildren()) { return; } int nextPos = dicNode->getChildrenPos(); const int childCount = PatriciaTrieReadingUtils::getGroupCountAndAdvancePosition( - binaryDictionaryInfo->getDictRoot(), &nextPos); + mDictRoot, &nextPos); for (int i = 0; i < childCount; i++) { - nextPos = createAndGetLeavingChildNode(dicNode, nextPos, binaryDictionaryInfo, - nodeFilter, childDicNodes); + nextPos = createAndGetLeavingChildNode(dicNode, nextPos, nodeFilter, childDicNodes); } } int PatriciaTriePolicy::getCodePointsAndProbabilityAndReturnCodePointCount( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int nodePos, const int maxCodePointCount, int *const outCodePoints, int *const outUnigramProbability) const { - return BinaryFormat::getCodePointsAndProbabilityAndReturnCodePointCount( - binaryDictionaryInfo->getDictRoot(), nodePos, + return BinaryFormat::getCodePointsAndProbabilityAndReturnCodePointCount(mDictRoot, nodePos, maxCodePointCount, outCodePoints, outUnigramProbability); } -int PatriciaTriePolicy::getTerminalNodePositionOfWord( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int *const inWord, +int PatriciaTriePolicy::getTerminalNodePositionOfWord(const int *const inWord, const int length, const bool forceLowerCaseSearch) const { - return BinaryFormat::getTerminalPosition(binaryDictionaryInfo->getDictRoot(), inWord, + return BinaryFormat::getTerminalPosition(mDictRoot, inWord, length, forceLowerCaseSearch); } -int PatriciaTriePolicy::getUnigramProbability( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int nodePos) const { +int PatriciaTriePolicy::getUnigramProbability(const int nodePos) const { if (nodePos == NOT_A_VALID_WORD_POS) { return NOT_A_PROBABILITY; } - const uint8_t *const dictRoot = binaryDictionaryInfo->getDictRoot(); int pos = nodePos; const PatriciaTrieReadingUtils::NodeFlags flags = - PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictRoot, &pos); + PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(mDictRoot, &pos); if (!PatriciaTrieReadingUtils::isTerminal(flags)) { return NOT_A_PROBABILITY; } @@ -79,81 +68,73 @@ int PatriciaTriePolicy::getUnigramProbability( // for shortcuts). return NOT_A_PROBABILITY; } - PatriciaTrieReadingUtils::skipCharacters(dictRoot, flags, MAX_WORD_LENGTH, &pos); - return PatriciaTrieReadingUtils::readProbabilityAndAdvancePosition(dictRoot, &pos); + PatriciaTrieReadingUtils::skipCharacters(mDictRoot, flags, MAX_WORD_LENGTH, &pos); + return PatriciaTrieReadingUtils::readProbabilityAndAdvancePosition(mDictRoot, &pos); } -int PatriciaTriePolicy::getShortcutPositionOfNode( - const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const { +int PatriciaTriePolicy::getShortcutPositionOfNode(const int nodePos) const { if (nodePos == NOT_A_VALID_WORD_POS) { return NOT_A_DICT_POS; } - const uint8_t *const dictRoot = binaryDictionaryInfo->getDictRoot(); int pos = nodePos; const PatriciaTrieReadingUtils::NodeFlags flags = - PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictRoot, &pos); + PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(mDictRoot, &pos); if (!PatriciaTrieReadingUtils::hasShortcutTargets(flags)) { return NOT_A_DICT_POS; } - PatriciaTrieReadingUtils::skipCharacters(dictRoot, flags, MAX_WORD_LENGTH, &pos); + PatriciaTrieReadingUtils::skipCharacters(mDictRoot, flags, MAX_WORD_LENGTH, &pos); if (PatriciaTrieReadingUtils::isTerminal(flags)) { - PatriciaTrieReadingUtils::readProbabilityAndAdvancePosition(dictRoot, &pos); + PatriciaTrieReadingUtils::readProbabilityAndAdvancePosition(mDictRoot, &pos); } if (PatriciaTrieReadingUtils::hasChildrenInFlags(flags)) { - PatriciaTrieReadingUtils::readChildrenPositionAndAdvancePosition(dictRoot, flags, &pos); + PatriciaTrieReadingUtils::readChildrenPositionAndAdvancePosition(mDictRoot, flags, &pos); } return pos; } -int PatriciaTriePolicy::getBigramsPositionOfNode( - const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const { +int PatriciaTriePolicy::getBigramsPositionOfNode(const int nodePos) const { if (nodePos == NOT_A_VALID_WORD_POS) { return NOT_A_DICT_POS; } - const uint8_t *const dictRoot = binaryDictionaryInfo->getDictRoot(); int pos = nodePos; const PatriciaTrieReadingUtils::NodeFlags flags = - PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictRoot, &pos); + PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(mDictRoot, &pos); if (!PatriciaTrieReadingUtils::hasBigrams(flags)) { return NOT_A_DICT_POS; } - PatriciaTrieReadingUtils::skipCharacters(dictRoot, flags, MAX_WORD_LENGTH, &pos); + PatriciaTrieReadingUtils::skipCharacters(mDictRoot, flags, MAX_WORD_LENGTH, &pos); if (PatriciaTrieReadingUtils::isTerminal(flags)) { - PatriciaTrieReadingUtils::readProbabilityAndAdvancePosition(dictRoot, &pos); + PatriciaTrieReadingUtils::readProbabilityAndAdvancePosition(mDictRoot, &pos); } if (PatriciaTrieReadingUtils::hasChildrenInFlags(flags)) { - PatriciaTrieReadingUtils::readChildrenPositionAndAdvancePosition(dictRoot, flags, &pos); + PatriciaTrieReadingUtils::readChildrenPositionAndAdvancePosition(mDictRoot, flags, &pos); } if (PatriciaTrieReadingUtils::hasShortcutTargets(flags)) { - BinaryDictionaryTerminalAttributesReadingUtils::skipShortcuts(binaryDictionaryInfo, &pos); + mShortcutListPolicy.skipAllShortcuts(&pos);; } return pos; } int PatriciaTriePolicy::createAndGetLeavingChildNode(const DicNode *const dicNode, - const int nodePos, const BinaryDictionaryInfo *const binaryDictionaryInfo, - const NodeFilter *const childrenFilter, DicNodeVector *childDicNodes) const { - const uint8_t *const dictRoot = binaryDictionaryInfo->getDictRoot(); + const int nodePos, const NodeFilter *const childrenFilter, + DicNodeVector *childDicNodes) const { int pos = nodePos; const PatriciaTrieReadingUtils::NodeFlags flags = - PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictRoot, &pos); + PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(mDictRoot, &pos); int mergedNodeCodePoints[MAX_WORD_LENGTH]; const int mergedNodeCodePointCount = PatriciaTrieReadingUtils::getCharsAndAdvancePosition( - dictRoot, flags, MAX_WORD_LENGTH, mergedNodeCodePoints, &pos); + mDictRoot, flags, MAX_WORD_LENGTH, mergedNodeCodePoints, &pos); const int probability = (PatriciaTrieReadingUtils::isTerminal(flags))? - PatriciaTrieReadingUtils::readProbabilityAndAdvancePosition(dictRoot, &pos) + PatriciaTrieReadingUtils::readProbabilityAndAdvancePosition(mDictRoot, &pos) : NOT_A_PROBABILITY; const int childrenPos = PatriciaTrieReadingUtils::hasChildrenInFlags(flags) ? PatriciaTrieReadingUtils::readChildrenPositionAndAdvancePosition( - dictRoot, flags, &pos) : NOT_A_DICT_POS; + mDictRoot, flags, &pos) : NOT_A_DICT_POS; if (PatriciaTrieReadingUtils::hasShortcutTargets(flags)) { - BinaryDictionaryTerminalAttributesReadingUtils::skipShortcuts(binaryDictionaryInfo, &pos); + getShortcutsStructurePolicy()->skipAllShortcuts(&pos); } if (PatriciaTrieReadingUtils::hasBigrams(flags)) { - BinaryDictionaryTerminalAttributesReadingUtils::skipExistingBigrams( - binaryDictionaryInfo, &pos); + getBigramsStructurePolicy()->skipAllBigrams(&pos); } if (!childrenFilter->isFilteredOut(mergedNodeCodePoints[0])) { childDicNodes->pushLeavingChild(dicNode, nodePos, childrenPos, probability, diff --git a/native/jni/src/suggest/policyimpl/dictionary/patricia_trie_policy.h b/native/jni/src/suggest/policyimpl/dictionary/patricia_trie_policy.h index 71f256eee..bebe1bfff 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/patricia_trie_policy.h +++ b/native/jni/src/suggest/policyimpl/dictionary/patricia_trie_policy.h @@ -17,52 +17,68 @@ #ifndef LATINIME_PATRICIA_TRIE_POLICY_H #define LATINIME_PATRICIA_TRIE_POLICY_H +#include <stdint.h> + #include "defines.h" -#include "suggest/core/policy/dictionary_structure_policy.h" +#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h" +#include "suggest/policyimpl/dictionary/bigram/bigram_list_policy.h" +#include "suggest/policyimpl/dictionary/header/header_policy.h" +#include "suggest/policyimpl/dictionary/shortcut/shortcut_list_policy.h" namespace latinime { -class PatriciaTriePolicy : public DictionaryStructurePolicy { +class DicNode; +class DicNodeVector; + +class PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy { public: - static AK_FORCE_INLINE const PatriciaTriePolicy *getInstance() { - return &sInstance; - } + PatriciaTriePolicy(const uint8_t *const dictBuf) + : mHeaderPolicy(dictBuf), mDictRoot(dictBuf + mHeaderPolicy.getSize()), + mBigramListPolicy(mDictRoot), mShortcutListPolicy(mDictRoot) {} + + ~PatriciaTriePolicy() {} AK_FORCE_INLINE int getRootPosition() const { return 0; } void createAndGetAllChildNodes(const DicNode *const dicNode, - const BinaryDictionaryInfo *const binaryDictionaryInfo, const NodeFilter *const nodeFilter, DicNodeVector *const childDicNodes) const; int getCodePointsAndProbabilityAndReturnCodePointCount( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int terminalNodePos, const int maxCodePointCount, int *const outCodePoints, int *const outUnigramProbability) const; - int getTerminalNodePositionOfWord( - const BinaryDictionaryInfo *const binaryDictionaryInfo, const int *const inWord, + int getTerminalNodePositionOfWord(const int *const inWord, const int length, const bool forceLowerCaseSearch) const; - int getUnigramProbability(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const; + int getUnigramProbability(const int nodePos) const; + + int getShortcutPositionOfNode(const int nodePos) const; - int getShortcutPositionOfNode(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const; + int getBigramsPositionOfNode(const int nodePos) const; - int getBigramsPositionOfNode(const BinaryDictionaryInfo *const binaryDictionaryInfo, - const int nodePos) const; + const DictionaryHeaderStructurePolicy *getHeaderStructurePolicy() const { + return &mHeaderPolicy; + } + + const DictionaryBigramsStructurePolicy *getBigramsStructurePolicy() const { + return &mBigramListPolicy; + } + + const DictionaryShortcutsStructurePolicy *getShortcutsStructurePolicy() const { + return &mShortcutListPolicy; + } private: - DISALLOW_COPY_AND_ASSIGN(PatriciaTriePolicy); - static const PatriciaTriePolicy sInstance; + DISALLOW_IMPLICIT_CONSTRUCTORS(PatriciaTriePolicy); - PatriciaTriePolicy() {} - ~PatriciaTriePolicy() {} + const HeaderPolicy mHeaderPolicy; + const uint8_t *const mDictRoot; + const BigramListPolicy mBigramListPolicy; + const ShortcutListPolicy mShortcutListPolicy; int createAndGetLeavingChildNode(const DicNode *const dicNode, const int nodePos, - const BinaryDictionaryInfo *const binaryDictionaryInfo, const NodeFilter *const nodeFilter, DicNodeVector *const childDicNodes) const; }; } // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/shortcut/shortcut_list_policy.h b/native/jni/src/suggest/policyimpl/dictionary/shortcut/shortcut_list_policy.h new file mode 100644 index 000000000..3c7fab033 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/shortcut/shortcut_list_policy.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_SHORTCUT_LIST_POLICY_H +#define LATINIME_SHORTCUT_LIST_POLICY_H + +#include <stdint.h> + +#include "defines.h" +#include "suggest/core/policy/dictionary_shortcuts_structure_policy.h" +#include "suggest/policyimpl/dictionary/shortcut/shortcut_list_reading_utils.h" + +namespace latinime { + +class ShortcutListPolicy : public DictionaryShortcutsStructurePolicy { + public: + explicit ShortcutListPolicy(const uint8_t *const shortcutBuf) + : mShortcutsBuf(shortcutBuf) {} + + ~ShortcutListPolicy() {} + + int getStartPos(const int pos) const { + int listPos = pos; + ShortcutListReadingUtils::getShortcutListSizeAndForwardPointer(mShortcutsBuf, &listPos); + return listPos; + } + + void getNextShortcut(const int maxCodePointCount, int *const outCodePoint, + int *const outCodePointCount, bool *const outIsWhitelist, bool *const outHasNext, + int *const pos) const { + const ShortcutListReadingUtils::ShortcutFlags flags = + ShortcutListReadingUtils::getFlagsAndForwardPointer(mShortcutsBuf, pos); + if (outHasNext) { + *outHasNext = ShortcutListReadingUtils::hasNext(flags); + } + if (outIsWhitelist) { + *outIsWhitelist = ShortcutListReadingUtils::isWhitelist(flags); + } + if (outCodePoint) { + *outCodePointCount = ShortcutListReadingUtils::readShortcutTarget( + mShortcutsBuf, maxCodePointCount, outCodePoint, pos); + } + } + + void skipAllShortcuts(int *const pos) const { + const int shortcutListSize = ShortcutListReadingUtils + ::getShortcutListSizeAndForwardPointer(mShortcutsBuf, pos); + *pos += shortcutListSize; + } + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(ShortcutListPolicy); + + const uint8_t *const mShortcutsBuf; +}; +} // namespace latinime +#endif // LATINIME_SHORTCUT_LIST_POLICY_H diff --git a/native/jni/src/suggest/policyimpl/dictionary/shortcut/shortcut_list_reading_utils.cpp b/native/jni/src/suggest/policyimpl/dictionary/shortcut/shortcut_list_reading_utils.cpp new file mode 100644 index 000000000..e70bb5071 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/shortcut/shortcut_list_reading_utils.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "suggest/policyimpl/dictionary/shortcut/shortcut_list_reading_utils.h" + +namespace latinime { + +// Flag for presence of more attributes +const ShortcutListReadingUtils::ShortcutFlags + ShortcutListReadingUtils::FLAG_ATTRIBUTE_HAS_NEXT = 0x80; +// Mask for attribute probability, stored on 4 bits inside the flags byte. +const ShortcutListReadingUtils::ShortcutFlags + ShortcutListReadingUtils::MASK_ATTRIBUTE_PROBABILITY = 0x0F; +const int ShortcutListReadingUtils::SHORTCUT_LIST_SIZE_FIELD_SIZE = 2; +// The numeric value of the shortcut probability that means 'whitelist'. +const int ShortcutListReadingUtils::WHITELIST_SHORTCUT_PROBABILITY = 15; + +} // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/shortcut/shortcut_list_reading_utils.h b/native/jni/src/suggest/policyimpl/dictionary/shortcut/shortcut_list_reading_utils.h new file mode 100644 index 000000000..e92fa5f9f --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/shortcut/shortcut_list_reading_utils.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LATINIME_SHORTCUT_LIST_READING_UTILS_H +#define LATINIME_SHORTCUT_LIST_READING_UTILS_H + +#include <stdint.h> + +#include "defines.h" +#include "suggest/core/dictionary/byte_array_utils.h" + +namespace latinime { + +class ShortcutListReadingUtils { + public: + typedef uint8_t ShortcutFlags; + + static AK_FORCE_INLINE ShortcutFlags getFlagsAndForwardPointer( + const uint8_t *const dictRoot, int *const pos) { + return ByteArrayUtils::readUint8AndAdvancePosition(dictRoot, pos); + } + + static AK_FORCE_INLINE int getProbabilityFromFlags(const ShortcutFlags flags) { + return flags & MASK_ATTRIBUTE_PROBABILITY; + } + + static AK_FORCE_INLINE bool hasNext(const ShortcutFlags flags) { + return (flags & FLAG_ATTRIBUTE_HAS_NEXT) != 0; + } + + // This method returns the size of the shortcut list region excluding the shortcut list size + // field at the beginning. + static AK_FORCE_INLINE int getShortcutListSizeAndForwardPointer( + const uint8_t *const dictRoot, int *const pos) { + // readUint16andAdvancePosition() returns an offset *including* the uint16 field itself. + return ByteArrayUtils::readUint16AndAdvancePosition(dictRoot, pos) + - SHORTCUT_LIST_SIZE_FIELD_SIZE; + } + + static AK_FORCE_INLINE void skipShortcuts(const uint8_t *const dictRoot, int *const pos) { + const int shortcutListSize = getShortcutListSizeAndForwardPointer(dictRoot, pos); + *pos += shortcutListSize; + } + + static AK_FORCE_INLINE bool isWhitelist(const ShortcutFlags flags) { + return getProbabilityFromFlags(flags) == WHITELIST_SHORTCUT_PROBABILITY; + } + + static AK_FORCE_INLINE int readShortcutTarget( + const uint8_t *const dictRoot, const int maxLength, int *const outWord, + int *const pos) { + return ByteArrayUtils::readStringAndAdvancePosition(dictRoot, maxLength, outWord, pos); + } + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(ShortcutListReadingUtils); + + static const ShortcutFlags FLAG_ATTRIBUTE_HAS_NEXT; + static const ShortcutFlags MASK_ATTRIBUTE_PROBABILITY; + static const int SHORTCUT_LIST_SIZE_FIELD_SIZE; + static const int WHITELIST_SHORTCUT_PROBABILITY; +}; +} // namespace latinime +#endif // LATINIME_SHORTCUT_LIST_READING_UTILS_H diff --git a/native/jni/src/suggest/policyimpl/typing/typing_weighting.h b/native/jni/src/suggest/policyimpl/typing/typing_weighting.h index 7cddb0882..b6aa85896 100644 --- a/native/jni/src/suggest/policyimpl/typing/typing_weighting.h +++ b/native/jni/src/suggest/policyimpl/typing/typing_weighting.h @@ -155,7 +155,8 @@ class TypingWeighting : public Weighting { float getNewWordBigramLanguageCost(const DicTraverseSession *const traverseSession, const DicNode *const dicNode, MultiBigramMap *const multiBigramMap) const { - return DicNodeUtils::getBigramNodeImprobability(traverseSession->getBinaryDictionaryInfo(), + return DicNodeUtils::getBigramNodeImprobability( + traverseSession->getDictionaryStructurePolicy(), dicNode, multiBigramMap) * ScoringParams::DISTANCE_WEIGHT_LANGUAGE; } diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java index 91401970a..d27a7a903 100644 --- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java +++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java @@ -179,7 +179,7 @@ public class InputLogicTests extends InputTestsBase { public void testCancelDoubleSpace() { final String STRING_TO_TYPE = "this "; - final String EXPECTED_RESULT = "this "; + final String EXPECTED_RESULT = "this "; type(STRING_TO_TYPE); type(Constants.CODE_DELETE); assertEquals("double space make a period", EXPECTED_RESULT, mEditText.getText().toString()); diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java index eb4f706cc..ead134b73 100644 --- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java +++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java @@ -204,17 +204,16 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { // view and only delegates to the parts of the code that care. So we don't include them here // to keep these tests as pinpoint as possible and avoid bringing it too many dependencies, // but keep them in mind if something breaks. Commenting them out as is should work. - //mLatinIME.onPressKey(codePoint); - for (final Key key : mKeyboard.mKeys) { - if (key.mCode == codePoint) { - final int x = key.mX + key.mWidth / 2; - final int y = key.mY + key.mHeight / 2; - mLatinIME.onCodeInput(codePoint, x, y); - return; - } + //mLatinIME.onPressKey(codePoint, 0 /* repeatCount */, true /* isSinglePointer */); + final Key key = mKeyboard.getKey(codePoint); + if (key != null) { + final int x = key.mX + key.mWidth / 2; + final int y = key.mY + key.mHeight / 2; + mLatinIME.onCodeInput(codePoint, x, y); + return; } mLatinIME.onCodeInput(codePoint, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE); - //mLatinIME.onReleaseKey(codePoint, false); + //mLatinIME.onReleaseKey(codePoint, false /* withSliding */); } protected void type(final String stringToType) { diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java index ef4ed3396..e4b5ad279 100644 --- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java +++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java @@ -27,15 +27,13 @@ import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.FusionDictionary.CharGroup; import com.android.inputmethod.latin.makedict.FusionDictionary.Node; import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString; -import com.android.inputmethod.latin.utils.ByteArrayWrapper; import com.android.inputmethod.latin.utils.CollectionUtils; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -120,31 +118,13 @@ public class BinaryDictIOTests extends AndroidTestCase { /** * Makes new buffer according to BUFFER_TYPE. */ - private FusionDictionaryBufferInterface getBuffer(final File file, final int bufferType) { - FileInputStream inStream = null; - try { - inStream = new FileInputStream(file); - if (bufferType == USE_BYTE_ARRAY) { - final byte[] array = new byte[(int)file.length()]; - inStream.read(array); - return new ByteArrayWrapper(array); - } else if (bufferType == USE_BYTE_BUFFER){ - final ByteBuffer buffer = inStream.getChannel().map( - FileChannel.MapMode.READ_ONLY, 0, file.length()); - return new BinaryDictInputOutput.ByteBufferWrapper(buffer); - } - } catch (IOException e) { - Log.e(TAG, "IOException while making buffer", e); - } finally { - if (inStream != null) { - try { - inStream.close(); - } catch (IOException e) { - Log.e(TAG, "IOException while closing stream", e); - } - } + private void getBuffer(final BinaryDictReader reader, final int bufferType) + throws FileNotFoundException, IOException { + if (bufferType == USE_BYTE_BUFFER) { + reader.openBuffer(new BinaryDictReader.FusionDictionaryBufferFromByteBufferFactory()); + } else if (bufferType == USE_BYTE_ARRAY) { + reader.openBuffer(new BinaryDictReader.FusionDictionaryBufferFromByteArrayFactory()); } - return null; } /** @@ -285,13 +265,14 @@ public class BinaryDictIOTests extends AndroidTestCase { final SparseArray<List<Integer>> bigrams, final Map<String, List<String>> shortcutMap, final int bufferType) { long now, diff = -1; - final FusionDictionaryBufferInterface buffer = getBuffer(file, bufferType); - assertNotNull(buffer); + final BinaryDictReader reader = new BinaryDictReader(file); FusionDictionary dict = null; try { + getBuffer(reader, bufferType); + assertNotNull(reader.getBuffer()); now = System.currentTimeMillis(); - dict = BinaryDictInputOutput.readDictionaryBinary(buffer, null); + dict = BinaryDictInputOutput.readDictionaryBinary(reader, null); diff = System.currentTimeMillis() - now; } catch (IOException e) { Log.e(TAG, "IOException while reading dictionary", e); @@ -421,11 +402,12 @@ public class BinaryDictIOTests extends AndroidTestCase { final Map<Integer, Integer> resultFreqs = CollectionUtils.newTreeMap(); long now = -1, diff = -1; - final FusionDictionaryBufferInterface buffer = getBuffer(file, bufferType); - assertNotNull("Can't get buffer.", buffer); + final BinaryDictReader reader = new BinaryDictReader(file); try { + getBuffer(reader, bufferType); + assertNotNull("Can't get buffer.", reader.getBuffer()); now = System.currentTimeMillis(); - BinaryDictIOUtils.readUnigramsAndBigramsBinary(buffer, resultWords, resultFreqs, + BinaryDictIOUtils.readUnigramsAndBigramsBinary(reader, resultWords, resultFreqs, resultBigrams); diff = System.currentTimeMillis() - now; } catch (IOException e) { @@ -562,7 +544,16 @@ public class BinaryDictIOTests extends AndroidTestCase { addUnigrams(sWords.size(), dict, sWords, null /* shortcutMap */); timeWritingDictToFile(file, dict, VERSION3_WITH_DYNAMIC_UPDATE); - final FusionDictionaryBufferInterface buffer = getBuffer(file, USE_BYTE_ARRAY); + final BinaryDictReader reader = new BinaryDictReader(file); + FusionDictionaryBufferInterface buffer = null; + try { + buffer = reader.openAndGetBuffer( + new BinaryDictReader.FusionDictionaryBufferFromByteArrayFactory()); + } catch (IOException e) { + // ignore + Log.e(TAG, "IOException while opening the buffer", e); + } + assertNotNull("Can't get the buffer", buffer); try { // too long word @@ -614,7 +605,16 @@ public class BinaryDictIOTests extends AndroidTestCase { addUnigrams(sWords.size(), dict, sWords, null /* shortcutMap */); timeWritingDictToFile(file, dict, VERSION3_WITH_DYNAMIC_UPDATE); - final FusionDictionaryBufferInterface buffer = getBuffer(file, USE_BYTE_ARRAY); + final BinaryDictReader reader = new BinaryDictReader(file); + FusionDictionaryBufferInterface buffer = null; + try { + buffer = reader.openAndGetBuffer( + new BinaryDictReader.FusionDictionaryBufferFromByteArrayFactory()); + } catch (IOException e) { + // ignore + Log.e(TAG, "IOException while opening the buffer", e); + } + assertNotNull("Can't get the buffer", buffer); try { MoreAsserts.assertNotEqual(FormatSpec.NOT_VALID_WORD, diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictReaderTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictReaderTests.java new file mode 100644 index 000000000..5f6950a4e --- /dev/null +++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictReaderTests.java @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.latin.makedict; + +import com.android.inputmethod.latin.makedict.BinaryDictInputOutput.FusionDictionaryBufferInterface; +import com.android.inputmethod.latin.makedict.BinaryDictReader.FusionDictionaryBufferFactory; +import com.android.inputmethod.latin.makedict.BinaryDictReader.FusionDictionaryBufferFromByteArrayFactory; +import com.android.inputmethod.latin.makedict.BinaryDictReader.FusionDictionaryBufferFromByteBufferFactory; + +import android.test.AndroidTestCase; +import android.util.Log; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + +/** + * Unit tests for BinaryDictReader + */ +public class BinaryDictReaderTests extends AndroidTestCase { + private static final String TAG = BinaryDictReaderTests.class.getSimpleName(); + + private final byte[] data = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + // Utilities for testing + public void writeDataToFile(final File file) { + FileOutputStream outStream = null; + try { + outStream = new FileOutputStream(file); + outStream.write(data); + } catch (IOException e) { + fail ("Can't write data to the test file"); + } finally { + if (outStream != null) { + try { + outStream.close(); + } catch (IOException e) { + Log.e(TAG, "Failed to close the output stream", e); + } + } + } + } + + @SuppressWarnings("null") + public void runTestOpenBuffer(final String testName, + final FusionDictionaryBufferFactory factory) { + File testFile = null; + try { + testFile = File.createTempFile(testName, ".tmp", getContext().getCacheDir()); + } catch (IOException e) { + Log.e(TAG, "IOException while the creating temporary file", e); + } + + assertNotNull(testFile); + final BinaryDictReader reader = new BinaryDictReader(testFile); + try { + reader.openBuffer(factory); + } catch (Exception e) { + Log.e(TAG, "Failed to open the buffer", e); + } + + writeDataToFile(testFile); + + try { + reader.openBuffer(factory); + } catch (Exception e) { + Log.e(TAG, "Raised the exception while opening buffer", e); + } + + assertEquals(testFile.length(), reader.getBuffer().capacity()); + } + + public void testOpenBufferWithByteBuffer() { + runTestOpenBuffer("testOpenBufferWithByteBuffer", + new FusionDictionaryBufferFromByteBufferFactory()); + } + + public void testOpenBufferWithByteArray() { + runTestOpenBuffer("testOpenBufferWithByteArray", + new FusionDictionaryBufferFromByteArrayFactory()); + } + + @SuppressWarnings("null") + public void runTestGetBuffer(final String testName, + final FusionDictionaryBufferFactory factory) { + File testFile = null; + try { + testFile = File.createTempFile(testName, ".tmp", getContext().getCacheDir()); + } catch (IOException e) { + Log.e(TAG, "IOException while the creating temporary file", e); + } + + final BinaryDictReader reader = new BinaryDictReader(testFile); + + // the default return value of getBuffer() must be null. + assertNull("the default return value of getBuffer() is not null", reader.getBuffer()); + + writeDataToFile(testFile); + assertTrue(testFile.exists()); + Log.d(TAG, "file length = " + testFile.length()); + + FusionDictionaryBufferInterface buffer = null; + try { + buffer = reader.openAndGetBuffer(factory); + } catch (IOException e) { + Log.e(TAG, "Failed to open and get the buffer", e); + } + assertNotNull("the buffer must not be null", buffer); + + for (int i = 0; i < data.length; ++i) { + assertEquals(data[i], buffer.readUnsignedByte()); + } + } + + public void testGetBufferWithByteBuffer() { + runTestGetBuffer("testGetBufferWithByteBuffer", + new FusionDictionaryBufferFromByteBufferFactory()); + } + + public void testGetBufferWithByteArray() { + runTestGetBuffer("testGetBufferWithByteArray", + new FusionDictionaryBufferFromByteArrayFactory()); + } +} diff --git a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java index 8f9ef1ddd..b3e2ee0ff 100644 --- a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java +++ b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java @@ -93,7 +93,7 @@ public class UserHistoryDictionaryTests extends AndroidTestCase { final UserHistoryPredictionDictionary dict = PersonalizationDictionaryHelper.getUserHistoryPredictionDictionary( getContext(), locale, mPrefs); - dict.isTest = true; + dict.mIsTest = true; addToDict(dict, words); diff --git a/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java index e165850ac..baebda2ed 100644 --- a/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtilsTests.java @@ -126,13 +126,13 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { // fr azerty F French // fr_CA qwerty F French (Canada) // de qwertz F German - // zz qwerty F No language (QWERTY) + // zz qwerty F Alphabet (QWERTY) // fr qwertz T French (QWERTZ) // de qwerty T German (QWERTY) // en_US azerty T English (US) (AZERTY) exception // en_UK dvorak T English (UK) (Dvorak) exception // es_US colemak T Spanish (US) (Colemak) exception - // zz pc T No language (PC) + // zz pc T Alphabet (PC) public void testPredefinedSubtypesInEnglishSystemLocale() { final RunInLocale<Void> tests = new RunInLocale<Void>() { @@ -150,7 +150,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(FR_CA)); assertEquals("de ", "German", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(DE)); - assertEquals("zz ", "No language (QWERTY)", + assertEquals("zz ", "Alphabet (QWERTY)", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(ZZ)); return null; } @@ -172,7 +172,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(EN_UK_DVORAK)); assertEquals("es_US colemak","Spanish (US) (Colemak)", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(ES_US_COLEMAK)); - assertEquals("zz azerty", "No language (PC)", + assertEquals("zz pc", "Alphabet (PC)", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(ZZ_PC)); return null; } @@ -196,7 +196,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { // en_US azerty T Anglais (États-Unis) (AZERTY) exception // en_UK dvorak T Anglais (Royaume-Uni) (Dvorak) exception // es_US colemak T Espagnol (États-Unis) (Colemak) exception - // zz pc T Aucune langue (PC) + // zz pc T Alphabet (PC) public void testPredefinedSubtypesInFrenchSystemLocale() { final RunInLocale<Void> tests = new RunInLocale<Void>() { @@ -214,7 +214,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(FR_CA)); assertEquals("de ", "Allemand", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(DE)); - assertEquals("zz ", "Aucune langue (QWERTY)", + assertEquals("zz ", "Alphabet (QWERTY)", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(ZZ)); return null; } @@ -236,7 +236,7 @@ public class SubtypeLocaleUtilsTests extends AndroidTestCase { SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(EN_UK_DVORAK)); assertEquals("es_US colemak","Espagnol (États-Unis) (Colemak)", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(ES_US_COLEMAK)); - assertEquals("zz azerty", "Aucune langue (PC)", + assertEquals("zz pc", "Alphabet (PC)", SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(ZZ_PC)); return null; } diff --git a/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java index b6798392f..ce62bf21a 100644 --- a/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java @@ -21,16 +21,15 @@ import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.LargeTest; import android.util.Log; +import com.android.inputmethod.latin.makedict.BinaryDictReader; import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.FusionDictionary.CharGroup; import com.android.inputmethod.latin.personalization.UserHistoryDictionaryBigramList; -import com.android.inputmethod.latin.utils.ByteArrayWrapper; import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils.BigramDictionaryInterface; import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils.OnAddWordListener; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; @@ -147,27 +146,15 @@ public class UserHistoryDictIOUtilsTests extends AndroidTestCase } private void readDictFromFile(final File file, final OnAddWordListener listener) { - FileInputStream inStream = null; - + final BinaryDictReader reader = new BinaryDictReader(file); try { - inStream = new FileInputStream(file); - final byte[] buffer = new byte[(int)file.length()]; - inStream.read(buffer); - - UserHistoryDictIOUtils.readDictionaryBinary(new ByteArrayWrapper(buffer), listener); + reader.openBuffer(new BinaryDictReader.FusionDictionaryBufferFromByteArrayFactory()); } catch (FileNotFoundException e) { Log.e(TAG, "file not found", e); } catch (IOException e) { Log.e(TAG, "IOException", e); - } finally { - if (inStream != null) { - try { - inStream.close(); - } catch (IOException e) { - // do nothing - } - } } + UserHistoryDictIOUtils.readDictionaryBinary(reader, listener); } public void testGenerateFusionDictionary() { diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java index c2c77d61a..d0b460af0 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin.dicttool; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput; +import com.android.inputmethod.latin.makedict.BinaryDictReader; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.UnsupportedFormatException; @@ -185,16 +186,15 @@ public final class BinaryDictOffdeviceUtils { crash(filename, new RuntimeException( filename + " does not seem to be a dictionary file")); } else { - final FileInputStream inStream = new FileInputStream(decodedSpec.mFile); - final ByteBuffer buffer = inStream.getChannel().map( - FileChannel.MapMode.READ_ONLY, 0, decodedSpec.mFile.length()); + final BinaryDictReader reader = new BinaryDictReader(decodedSpec.mFile); + reader.openBuffer( + new BinaryDictReader.FusionDictionaryBufferFromByteArrayFactory()); if (report) { System.out.println("Format : Binary dictionary format"); System.out.println("Packaging : " + decodedSpec.describeChain()); System.out.println("Uncompressed size : " + decodedSpec.mFile.length()); } - return BinaryDictInputOutput.readDictionaryBinary( - new BinaryDictInputOutput.ByteBufferWrapper(buffer), null); + return BinaryDictInputOutput.readDictionaryBinary(reader, null); } } } catch (IOException e) { diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java index cc890f60c..9bce988ac 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin.dicttool; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput; +import com.android.inputmethod.latin.makedict.BinaryDictReader; import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.MakedictLog; @@ -265,24 +266,10 @@ public class DictionaryMaker { */ private static FusionDictionary readBinaryFile(final String binaryFilename) throws FileNotFoundException, IOException, UnsupportedFormatException { - FileInputStream inStream = null; - - try { - final File file = new File(binaryFilename); - inStream = new FileInputStream(file); - final ByteBuffer buffer = inStream.getChannel().map( - FileChannel.MapMode.READ_ONLY, 0, file.length()); - return BinaryDictInputOutput.readDictionaryBinary( - new BinaryDictInputOutput.ByteBufferWrapper(buffer), null); - } finally { - if (inStream != null) { - try { - inStream.close(); - } catch (IOException e) { - // do nothing - } - } - } + final File file = new File(binaryFilename); + final BinaryDictReader reader = new BinaryDictReader(file); + reader.openBuffer(new BinaryDictReader.FusionDictionaryBufferFromByteBufferFactory()); + return BinaryDictInputOutput.readDictionaryBinary(reader, null); } /** diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java index 554bd2478..fb1cc8493 100644 --- a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java +++ b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin.dicttool; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput; +import com.android.inputmethod.latin.makedict.BinaryDictReader; import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions; @@ -69,11 +70,9 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase { assertEquals("Wrong decode spec", BinaryDictOffdeviceUtils.COMPRESSION, step); } assertEquals("Wrong decode spec", 3, decodeSpec.mDecoderSpec.size()); - final FileInputStream inStream = new FileInputStream(decodeSpec.mFile); - final ByteBuffer buffer = inStream.getChannel().map( - FileChannel.MapMode.READ_ONLY, 0, decodeSpec.mFile.length()); - final FusionDictionary resultDict = BinaryDictInputOutput.readDictionaryBinary( - new BinaryDictInputOutput.ByteBufferWrapper(buffer), + final BinaryDictReader reader = new BinaryDictReader(decodeSpec.mFile); + reader.openBuffer(new BinaryDictReader.FusionDictionaryBufferFromByteBufferFactory()); + final FusionDictionary resultDict = BinaryDictInputOutput.readDictionaryBinary(reader, null /* dict : an optional dictionary to add words to, or null */); assertEquals("Dictionary can't be read back correctly", resultDict.findWordInTree(resultDict.mRoot, "foo").getFrequency(), TEST_FREQ); diff --git a/tools/maketext/Android.mk b/tools/make-keyboard-text/Android.mk index 77914cae6..87601489e 100644 --- a/tools/maketext/Android.mk +++ b/tools/make-keyboard-text/Android.mk @@ -19,7 +19,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES += $(call all-java-files-under,src) LOCAL_JAR_MANIFEST := etc/manifest.txt LOCAL_JAVA_RESOURCE_DIRS := res -LOCAL_MODULE := maketext +LOCAL_MODULE := make-keyboard-text include $(BUILD_HOST_JAVA_LIBRARY) include $(LOCAL_PATH)/etc/Android.mk diff --git a/tools/maketext/etc/Android.mk b/tools/make-keyboard-text/etc/Android.mk index 475676b3a..0fbf4ffe9 100644 --- a/tools/maketext/etc/Android.mk +++ b/tools/make-keyboard-text/etc/Android.mk @@ -15,6 +15,6 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_PREBUILT_EXECUTABLES := maketext +LOCAL_PREBUILT_EXECUTABLES := make-keyboard-text include $(BUILD_HOST_PREBUILT) diff --git a/tools/maketext/etc/maketext b/tools/make-keyboard-text/etc/make-keyboard-text index 0edd36020..156f9ec5f 100755 --- a/tools/maketext/etc/maketext +++ b/tools/make-keyboard-text/etc/make-keyboard-text @@ -33,7 +33,7 @@ progdir=`pwd` prog="${progdir}"/`basename "${prog}"` cd "${oldwd}" -jarfile=maketext.jar +jarfile=make-keyboard-text.jar frameworkdir="$progdir" if [ ! -r "$frameworkdir/$jarfile" ] then diff --git a/tools/make-keyboard-text/etc/manifest.txt b/tools/make-keyboard-text/etc/manifest.txt new file mode 100644 index 000000000..8ad4db059 --- /dev/null +++ b/tools/make-keyboard-text/etc/manifest.txt @@ -0,0 +1 @@ +Main-Class: com.android.inputmethod.keyboard.tools.MakeKeyboardText diff --git a/tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl b/tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl index 479a766fb..4cd9c236b 100644 --- a/tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl +++ b/tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl @@ -27,18 +27,18 @@ import java.util.HashMap; /** * !!!!! DO NOT EDIT THIS FILE !!!!! * - * This file is generated by tools/maketext. The base template file is - * tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl + * This file is generated by tools/make-keyboard-text. The base template file is + * tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl * * This file must be updated when any text resources in keyboard layout files have been changed. * These text resources are referred as "!text/<resource_name>" in keyboard XML definitions, * and should be defined in - * tools/maketext/res/values-<locale>/donottranslate-more-keys.xml + * tools/make-keyboard-text/res/values-<locale>/donottranslate-more-keys.xml * * To update this file, please run the following commands. * $ cd $ANDROID_BUILD_TOP - * $ mmm packages/inputmethods/LatinIME/tools/maketext - * $ maketext -java packages/inputmethods/LatinIME/java/src + * $ mmm packages/inputmethods/LatinIME/tools/make-keyboard-text + * $ make-keyboard-text -java packages/inputmethods/LatinIME/java/src * * The updated source file will be generated to the following path (this file). * packages/inputmethods/LatinIME/java/src/com/android/inputmethod/keyboard/internal/ diff --git a/tools/maketext/res/values-af/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-af/donottranslate-more-keys.xml index ee96f442d..ee96f442d 100644 --- a/tools/maketext/res/values-af/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-af/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-ar/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml index cace240b6..8b86b1ba2 100644 --- a/tools/maketext/res/values-ar/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml @@ -81,7 +81,7 @@ <!-- U+061F: "؟" ARABIC QUESTION MARK U+060C: "،" ARABIC COMMA U+061B: "؛" ARABIC SEMICOLON --> - <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(,)"</string> + <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(|),)|("</string> <string name="more_keys_for_apostrophe">"؟,؛,!,:,-,/,\',\""</string> <!-- U+266A: "♪" EIGHTH NOTE --> <string name="more_keys_for_bullet">♪</string> diff --git a/tools/maketext/res/values-az/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-az/donottranslate-more-keys.xml index db1784c17..db1784c17 100644 --- a/tools/maketext/res/values-az/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-az/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-be/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-be/donottranslate-more-keys.xml index 4723503f1..4723503f1 100644 --- a/tools/maketext/res/values-be/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-be/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-bg/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-bg/donottranslate-more-keys.xml index 5262133de..5262133de 100644 --- a/tools/maketext/res/values-bg/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-bg/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-ca/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml index 8624dfb65..8624dfb65 100644 --- a/tools/maketext/res/values-ca/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-cs/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-cs/donottranslate-more-keys.xml index 5ce1d3bc8..5ce1d3bc8 100644 --- a/tools/maketext/res/values-cs/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-cs/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-da/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-da/donottranslate-more-keys.xml index cbaf9f497..cbaf9f497 100644 --- a/tools/maketext/res/values-da/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-da/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-de/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-de/donottranslate-more-keys.xml index 9dc8717ec..9dc8717ec 100644 --- a/tools/maketext/res/values-de/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-de/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-el/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-el/donottranslate-more-keys.xml index 964dba081..964dba081 100644 --- a/tools/maketext/res/values-el/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-el/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-en/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml index 969a5041b..969a5041b 100644 --- a/tools/maketext/res/values-en/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-eo/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-eo/donottranslate-more-keys.xml index e929869e2..e929869e2 100644 --- a/tools/maketext/res/values-eo/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-eo/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-es/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-es/donottranslate-more-keys.xml index 0e58c1440..0e58c1440 100644 --- a/tools/maketext/res/values-es/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-es/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-et/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-et/donottranslate-more-keys.xml index d037044bd..d037044bd 100644 --- a/tools/maketext/res/values-et/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-et/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-fa/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml index 7c8496d6f..6d13d6bb6 100644 --- a/tools/maketext/res/values-fa/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml @@ -89,7 +89,7 @@ <!-- U+061F: "؟" ARABIC QUESTION MARK U+060C: "،" ARABIC COMMA U+061B: "؛" ARABIC SEMICOLON --> - <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(,)"</string> + <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(|),)|("</string> <!-- U+266A: "♪" EIGHTH NOTE --> <string name="more_keys_for_bullet">♪</string> <!-- U+2605: "★" BLACK STAR diff --git a/tools/maketext/res/values-fi/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-fi/donottranslate-more-keys.xml index 25b785845..25b785845 100644 --- a/tools/maketext/res/values-fi/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-fi/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-fr/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-fr/donottranslate-more-keys.xml index 7b11a183d..7b11a183d 100644 --- a/tools/maketext/res/values-fr/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-fr/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-hi/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-hi/donottranslate-more-keys.xml index 98ad2cb3e..98ad2cb3e 100644 --- a/tools/maketext/res/values-hi/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-hi/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-hr/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-hr/donottranslate-more-keys.xml index 022bd2a87..022bd2a87 100644 --- a/tools/maketext/res/values-hr/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-hr/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-hu/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-hu/donottranslate-more-keys.xml index ce2f5d057..ce2f5d057 100644 --- a/tools/maketext/res/values-hu/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-hu/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-is/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-is/donottranslate-more-keys.xml index 4b4d986b8..4b4d986b8 100644 --- a/tools/maketext/res/values-is/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-is/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-it/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-it/donottranslate-more-keys.xml index 17dd03108..17dd03108 100644 --- a/tools/maketext/res/values-it/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-it/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-iw/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml index 64d42272f..9d2e01ebd 100644 --- a/tools/maketext/res/values-iw/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml @@ -23,6 +23,7 @@ U+05D1: "ב" HEBREW LETTER BET U+05D2: "ג" HEBREW LETTER GIMEL --> <string name="label_to_alpha_key">אבג</string> + <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,\\,,\?,\@,&,\\%,+,;,/,(|),)|("</string> <!-- U+2605: "★" BLACK STAR --> <string name="more_keys_for_star">★</string> <!-- U+00B1: "±" PLUS-MINUS SIGN diff --git a/tools/maketext/res/values-ka/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ka/donottranslate-more-keys.xml index 8c2add44c..8c2add44c 100644 --- a/tools/maketext/res/values-ka/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ka/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-kk/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-kk/donottranslate-more-keys.xml index 0e953ff21..0e953ff21 100644 --- a/tools/maketext/res/values-kk/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-kk/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-ky/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ky/donottranslate-more-keys.xml index 8d8c5fbf2..8d8c5fbf2 100644 --- a/tools/maketext/res/values-ky/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ky/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-lt/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-lt/donottranslate-more-keys.xml index 7e2b8a076..7e2b8a076 100644 --- a/tools/maketext/res/values-lt/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-lt/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-lv/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-lv/donottranslate-more-keys.xml index c64e37bc8..c64e37bc8 100644 --- a/tools/maketext/res/values-lv/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-lv/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-mk/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-mk/donottranslate-more-keys.xml index 2db75c8f5..2db75c8f5 100644 --- a/tools/maketext/res/values-mk/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-mk/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-mn/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-mn/donottranslate-more-keys.xml index fd1853e85..fd1853e85 100644 --- a/tools/maketext/res/values-mn/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-mn/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-nb/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-nb/donottranslate-more-keys.xml index 2cecb5e65..2cecb5e65 100644 --- a/tools/maketext/res/values-nb/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-nb/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-nl/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-nl/donottranslate-more-keys.xml index e5d82951a..e5d82951a 100644 --- a/tools/maketext/res/values-nl/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-nl/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-pl/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-pl/donottranslate-more-keys.xml index b5cf6a0fa..b5cf6a0fa 100644 --- a/tools/maketext/res/values-pl/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-pl/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-pt/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-pt/donottranslate-more-keys.xml index 0c9065f27..0c9065f27 100644 --- a/tools/maketext/res/values-pt/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-pt/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-rm/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-rm/donottranslate-more-keys.xml index aa0d7f817..aa0d7f817 100644 --- a/tools/maketext/res/values-rm/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-rm/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-ro/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ro/donottranslate-more-keys.xml index f399eb28e..f399eb28e 100644 --- a/tools/maketext/res/values-ro/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ro/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-ru/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ru/donottranslate-more-keys.xml index f62c90ffc..f62c90ffc 100644 --- a/tools/maketext/res/values-ru/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ru/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-sk/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-sk/donottranslate-more-keys.xml index 2ed538e5b..2ed538e5b 100644 --- a/tools/maketext/res/values-sk/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-sk/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-sl/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-sl/donottranslate-more-keys.xml index 1e5d1d71f..1e5d1d71f 100644 --- a/tools/maketext/res/values-sl/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-sl/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-sr/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-sr/donottranslate-more-keys.xml index c00d2a665..c00d2a665 100644 --- a/tools/maketext/res/values-sr/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-sr/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-sv/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-sv/donottranslate-more-keys.xml index a36a13eb2..a36a13eb2 100644 --- a/tools/maketext/res/values-sv/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-sv/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-sw/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-sw/donottranslate-more-keys.xml index 968a80c1c..968a80c1c 100644 --- a/tools/maketext/res/values-sw/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-sw/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-th/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-th/donottranslate-more-keys.xml index 6350d4b8e..6350d4b8e 100644 --- a/tools/maketext/res/values-th/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-th/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-tl/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-tl/donottranslate-more-keys.xml index 383d55ccf..383d55ccf 100644 --- a/tools/maketext/res/values-tl/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-tl/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-tr/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-tr/donottranslate-more-keys.xml index 1161811d4..1161811d4 100644 --- a/tools/maketext/res/values-tr/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-tr/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-uk/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-uk/donottranslate-more-keys.xml index cc05cc697..cc05cc697 100644 --- a/tools/maketext/res/values-uk/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-uk/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-vi/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-vi/donottranslate-more-keys.xml index fa98ea9e1..fa98ea9e1 100644 --- a/tools/maketext/res/values-vi/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-vi/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-zu/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml index 191791530..191791530 100644 --- a/tools/maketext/res/values-zu/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values-zz/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-zz/donottranslate-more-keys.xml index eb984a469..eb984a469 100644 --- a/tools/maketext/res/values-zz/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-zz/donottranslate-more-keys.xml diff --git a/tools/maketext/res/values/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml index 4cf26505f..4cf26505f 100644 --- a/tools/maketext/res/values/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/ArrayInitializerFormatter.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/ArrayInitializerFormatter.java index 3365c7273..331003e67 100644 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/ArrayInitializerFormatter.java +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/ArrayInitializerFormatter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.inputmethod.latin.maketext; +package com.android.inputmethod.keyboard.tools; import java.io.PrintStream; diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/JarUtils.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java index 6d6bc0ea6..a74096e79 100644 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/JarUtils.java +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.inputmethod.latin.maketext; +package com.android.inputmethod.keyboard.tools; import java.io.IOException; import java.io.InputStream; diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/LabelText.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java index 4a9236962..36a03f8dc 100644 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/LabelText.java +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java @@ -14,14 +14,14 @@ * the License. */ -package com.android.inputmethod.latin.maketext; +package com.android.inputmethod.keyboard.tools; import java.util.Arrays; import java.util.LinkedList; import java.util.NoSuchElementException; import java.util.jar.JarFile; -public class LabelText { +public class MakeKeyboardText { static class Options { private static final String OPTION_JAVA = "-java"; @@ -31,7 +31,7 @@ public class LabelText { if (message != null) { System.err.println(message); } - System.err.println("usage: makelabel " + OPTION_JAVA + " <java_output_dir>"); + System.err.println("usage: make-keyboard-text " + OPTION_JAVA + " <java_output_dir>"); System.exit(1); } @@ -58,7 +58,7 @@ public class LabelText { public static void main(final String[] args) { final Options options = new Options(args); - final JarFile jar = JarUtils.getJarFile(LabelText.class); + final JarFile jar = JarUtils.getJarFile(MakeKeyboardText.class); final MoreKeysResources resources = new MoreKeysResources(jar); resources.writeToJava(options.mJava); } diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/MoreKeysResources.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java index 50a0c9958..2643e01ec 100644 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/MoreKeysResources.java +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.inputmethod.latin.maketext; +package com.android.inputmethod.keyboard.tools; import java.io.Closeable; import java.io.File; @@ -42,7 +42,7 @@ public class MoreKeysResources { private static final String EMPTY_STRING_VAR = "EMPTY"; private static final String NO_LANGUAGE_CODE = "zz"; - private static final String NO_LANGUAGE_DISPLAY_NAME = "No language"; + private static final String NO_LANGUAGE_DISPLAY_NAME = "Alphabet"; private final JarFile mJar; // Language to string resources map. diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/StringResource.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResource.java index 568a896a9..a49b8fe70 100644 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/StringResource.java +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResource.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.inputmethod.latin.maketext; +package com.android.inputmethod.keyboard.tools; public class StringResource { public final String mName; diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/StringResourceMap.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java index ff133425c..cc7ff6a9c 100644 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/StringResourceMap.java +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.inputmethod.latin.maketext; +package com.android.inputmethod.keyboard.tools; import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/tools/maketext/etc/manifest.txt b/tools/maketext/etc/manifest.txt deleted file mode 100644 index bfd1a52be..000000000 --- a/tools/maketext/etc/manifest.txt +++ /dev/null @@ -1 +0,0 @@ -Main-Class: com.android.inputmethod.latin.maketext.LabelText |