diff options
350 files changed, 4633 insertions, 2656 deletions
diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml index 031d62e0c..a8dabd274 100644 --- a/java/AndroidManifest.xml +++ b/java/AndroidManifest.xml @@ -18,7 +18,7 @@ coreApp="true" package="com.android.inputmethod.latin"> - <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" /> + <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" /> diff --git a/java/res/color/emoji_tab_label_color_ics.xml b/java/res/color/emoji_tab_label_color_holo.xml index 36e1d3020..373e9314b 100644 --- a/java/res/color/emoji_tab_label_color_ics.xml +++ b/java/res/color/emoji_tab_label_color_holo.xml @@ -21,13 +21,13 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" - android:color="@color/key_text_color_ics" /> + android:color="@color/key_text_color_holo" /> <item android:state_pressed="true" - android:color="@color/key_text_color_ics" /> + android:color="@color/key_text_color_holo" /> <item android:state_selected="true" - android:color="@color/key_text_color_ics" /> + android:color="@color/key_text_color_holo" /> <item - android:color="@color/key_text_inactivated_color_ics" /> + android:color="@color/key_text_inactivated_color_holo" /> </selector> diff --git a/java/res/color/key_text_color_ics.xml b/java/res/color/key_text_color_holo.xml index c6f111ad2..d034a945f 100644 --- a/java/res/color/key_text_color_ics.xml +++ b/java/res/color/key_text_color_holo.xml @@ -17,32 +17,32 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Functional keys. --> <item android:state_single="true" android:state_pressed="true" - android:color="@color/key_text_color_functional_ics" /> + android:color="@color/key_text_color_functional_holo" /> <item android:state_single="true" - android:color="@color/key_text_color_functional_ics" /> + android:color="@color/key_text_color_functional_holo" /> <!-- Action keys. --> <item android:state_active="true" android:state_pressed="true" - android:color="@color/key_text_color_normal_ics" /> + android:color="@color/key_text_color_normal_holo" /> <item android:state_active="true" - android:color="@color/key_text_color_normal_ics" /> + android:color="@color/key_text_color_normal_holo" /> <!-- Toggle keys. Use checkable/checked state. --> <item android:state_checkable="true" android:state_checked="true" android:state_pressed="true" - android:color="@color/key_text_color_normal_ics" /> + android:color="@color/key_text_color_normal_holo" /> <item android:state_checkable="true" android:state_pressed="true" - android:color="@color/key_text_color_normal_ics" /> + android:color="@color/key_text_color_normal_holo" /> <item android:state_checkable="true" android:state_checked="true" - android:color="@color/key_text_color_normal_ics" /> + android:color="@color/key_text_color_normal_holo" /> <item android:state_checkable="true" - android:color="@color/key_text_color_normal_ics" /> + android:color="@color/key_text_color_normal_holo" /> <!-- Empty background keys. --> <item android:state_empty="true" - android:color="@color/key_text_color_normal_ics" /> + android:color="@color/key_text_color_normal_holo" /> <!-- Normal keys. --> <item android:state_pressed="true" - android:color="@color/key_text_color_normal_ics" /> - <item android:color="@color/key_text_color_normal_ics" /> + android:color="@color/key_text_color_normal_holo" /> + <item android:color="@color/key_text_color_normal_holo" /> </selector> diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_active_ics.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_active_ics.9.png Binary files differnew file mode 100644 index 000000000..9aa8db60e --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_active_ics.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_active_holo.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_active_klp.9.png Binary files differindex fa2cb8542..fa2cb8542 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_active_holo.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_active_klp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on_ics.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on_ics.9.png Binary files differnew file mode 100644 index 000000000..9f4587b4a --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on_ics.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on_holo.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on_klp.9.png Binary files differindex 814e40235..814e40235 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on_holo.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on_klp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_ics.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_ics.9.png Binary files differnew file mode 100644 index 000000000..7ec33dd20 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_ics.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_holo.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_klp.9.png Binary files differindex 90abe3940..90abe3940 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_holo.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_klp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off_ics.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off_ics.9.png Binary files differnew file mode 100644 index 000000000..655bc01b1 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off_ics.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off_holo.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off_klp.9.png Binary files differindex 48eeb3f54..48eeb3f54 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off_holo.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off_klp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on_ics.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on_ics.9.png Binary files differnew file mode 100644 index 000000000..138e915d9 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on_ics.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on_holo.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on_klp.9.png Binary files differindex 71e0683cd..71e0683cd 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on_holo.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on_klp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_light_pressed_ics.9.png b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed_ics.9.png Binary files differnew file mode 100644 index 000000000..5612c51a1 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed_ics.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_light_pressed_holo.9.png b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed_klp.9.png Binary files differindex 6768241a7..6768241a7 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_light_pressed_holo.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed_klp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_ics.9.png b/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_ics.9.png Binary files differnew file mode 100644 index 000000000..c2e8b3779 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_ics.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_holo.9.png b/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_klp.9.png Binary files differindex 10f8e97e4..10f8e97e4 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_holo.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_klp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_background_ics.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_background_ics.9.png Binary files differnew file mode 100644 index 000000000..28b406a5c --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_background_ics.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_background_holo.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_background_klp.9.png Binary files differindex 50ed568ff..50ed568ff 100644 --- a/java/res/drawable-hdpi/keyboard_key_feedback_background_holo.9.png +++ b/java/res/drawable-hdpi/keyboard_key_feedback_background_klp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_left_background_ics.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_left_background_ics.9.png Binary files differnew file mode 100644 index 000000000..e42cd88dc --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_left_background_ics.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_left_background_holo.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_left_background_klp.9.png Binary files differindex 9fa6d0003..9fa6d0003 100644 --- a/java/res/drawable-hdpi/keyboard_key_feedback_left_background_holo.9.png +++ b/java/res/drawable-hdpi/keyboard_key_feedback_left_background_klp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_left_more_background_ics.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_left_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..160344073 --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_left_more_background_ics.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_left_more_background_holo.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_left_more_background_klp.9.png Binary files differindex c73269b7e..c73269b7e 100644 --- a/java/res/drawable-hdpi/keyboard_key_feedback_left_more_background_holo.9.png +++ b/java/res/drawable-hdpi/keyboard_key_feedback_left_more_background_klp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_more_background_ics.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..a40d4277c --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_more_background_ics.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_more_background_holo.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_more_background_klp.9.png Binary files differindex fffd4021e..fffd4021e 100644 --- a/java/res/drawable-hdpi/keyboard_key_feedback_more_background_holo.9.png +++ b/java/res/drawable-hdpi/keyboard_key_feedback_more_background_klp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_right_background_ics.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_right_background_ics.9.png Binary files differnew file mode 100644 index 000000000..1f6807376 --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_right_background_ics.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_right_background_holo.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_right_background_klp.9.png Binary files differindex 61c23c19b..61c23c19b 100644 --- a/java/res/drawable-hdpi/keyboard_key_feedback_right_background_holo.9.png +++ b/java/res/drawable-hdpi/keyboard_key_feedback_right_background_klp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_right_more_background_ics.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_right_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..ec53593d9 --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_right_more_background_ics.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_right_more_background_holo.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_right_more_background_klp.9.png Binary files differindex 827d74363..827d74363 100644 --- a/java/res/drawable-hdpi/keyboard_key_feedback_right_more_background_holo.9.png +++ b/java/res/drawable-hdpi/keyboard_key_feedback_right_more_background_klp.9.png diff --git a/java/res/drawable-hdpi/keyboard_popup_panel_background_holo.9.png b/java/res/drawable-hdpi/keyboard_popup_panel_background_holo.9.png Binary files differdeleted file mode 100644 index dc2fc7dfc..000000000 --- a/java/res/drawable-hdpi/keyboard_popup_panel_background_holo.9.png +++ /dev/null diff --git a/java/res/drawable-hdpi/keyboard_popup_panel_background_ics.9.png b/java/res/drawable-hdpi/keyboard_popup_panel_background_ics.9.png Binary files differnew file mode 100644 index 000000000..53d7b6fb3 --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_popup_panel_background_ics.9.png diff --git a/java/res/drawable-hdpi/keyboard_popup_panel_background_klp.9.png b/java/res/drawable-hdpi/keyboard_popup_panel_background_klp.9.png Binary files differnew file mode 100644 index 000000000..f9dd3b8b1 --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_popup_panel_background_klp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_active_ics.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_active_ics.9.png Binary files differnew file mode 100644 index 000000000..e810c7789 --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_active_ics.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_active_holo.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_active_klp.9.png Binary files differindex 8e9a34957..8e9a34957 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_active_holo.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_active_klp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on_ics.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on_ics.9.png Binary files differnew file mode 100644 index 000000000..f3fc64114 --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on_ics.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on_holo.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on_klp.9.png Binary files differindex b7b2dca43..b7b2dca43 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on_holo.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on_klp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_ics.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_ics.9.png Binary files differnew file mode 100644 index 000000000..8f340d355 --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_ics.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_holo.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_klp.9.png Binary files differindex 4a92b80dd..4a92b80dd 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_holo.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_klp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off_ics.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off_ics.9.png Binary files differnew file mode 100644 index 000000000..53ea5f894 --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off_ics.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off_holo.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off_klp.9.png Binary files differindex 72125a065..72125a065 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off_holo.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off_klp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on_ics.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on_ics.9.png Binary files differnew file mode 100644 index 000000000..69c84e7ec --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on_ics.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on_holo.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on_klp.9.png Binary files differindex 82413d4cc..82413d4cc 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on_holo.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on_klp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_light_pressed_ics.9.png b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed_ics.9.png Binary files differnew file mode 100644 index 000000000..c39dd4a94 --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed_ics.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_light_pressed_holo.9.png b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed_klp.9.png Binary files differindex 049385984..049385984 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_light_pressed_holo.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed_klp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_ics.9.png b/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_ics.9.png Binary files differnew file mode 100644 index 000000000..93a6e7921 --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_ics.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_holo.9.png b/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_klp.9.png Binary files differindex ee0aae28b..ee0aae28b 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_holo.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_klp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_background_ics.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_background_ics.9.png Binary files differnew file mode 100644 index 000000000..7a9f640d1 --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_background_ics.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_background_holo.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_background_klp.9.png Binary files differindex 564f5460c..564f5460c 100644 --- a/java/res/drawable-mdpi/keyboard_key_feedback_background_holo.9.png +++ b/java/res/drawable-mdpi/keyboard_key_feedback_background_klp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_left_background_ics.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_left_background_ics.9.png Binary files differnew file mode 100644 index 000000000..5b06f09bb --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_left_background_ics.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_left_background_holo.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_left_background_klp.9.png Binary files differindex 427c87061..427c87061 100644 --- a/java/res/drawable-mdpi/keyboard_key_feedback_left_background_holo.9.png +++ b/java/res/drawable-mdpi/keyboard_key_feedback_left_background_klp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_left_more_background_ics.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_left_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..fd992d6f4 --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_left_more_background_ics.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_left_more_background_holo.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_left_more_background_klp.9.png Binary files differindex ea757296d..ea757296d 100644 --- a/java/res/drawable-mdpi/keyboard_key_feedback_left_more_background_holo.9.png +++ b/java/res/drawable-mdpi/keyboard_key_feedback_left_more_background_klp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_more_background_ics.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..128dcd6ad --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_more_background_ics.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_more_background_holo.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_more_background_klp.9.png Binary files differindex 1911c429f..1911c429f 100644 --- a/java/res/drawable-mdpi/keyboard_key_feedback_more_background_holo.9.png +++ b/java/res/drawable-mdpi/keyboard_key_feedback_more_background_klp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_right_background_ics.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_right_background_ics.9.png Binary files differnew file mode 100644 index 000000000..0b08d1747 --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_right_background_ics.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_right_background_holo.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_right_background_klp.9.png Binary files differindex cdef116d2..cdef116d2 100644 --- a/java/res/drawable-mdpi/keyboard_key_feedback_right_background_holo.9.png +++ b/java/res/drawable-mdpi/keyboard_key_feedback_right_background_klp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_right_more_background_ics.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_right_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..cf0b33c1d --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_right_more_background_ics.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_right_more_background_holo.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_right_more_background_klp.9.png Binary files differindex dea5d076c..dea5d076c 100644 --- a/java/res/drawable-mdpi/keyboard_key_feedback_right_more_background_holo.9.png +++ b/java/res/drawable-mdpi/keyboard_key_feedback_right_more_background_klp.9.png diff --git a/java/res/drawable-mdpi/keyboard_popup_panel_background_holo.9.png b/java/res/drawable-mdpi/keyboard_popup_panel_background_holo.9.png Binary files differdeleted file mode 100644 index 441edc30b..000000000 --- a/java/res/drawable-mdpi/keyboard_popup_panel_background_holo.9.png +++ /dev/null diff --git a/java/res/drawable-mdpi/keyboard_popup_panel_background_ics.9.png b/java/res/drawable-mdpi/keyboard_popup_panel_background_ics.9.png Binary files differnew file mode 100644 index 000000000..61988a8e1 --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_popup_panel_background_ics.9.png diff --git a/java/res/drawable-mdpi/keyboard_popup_panel_background_klp.9.png b/java/res/drawable-mdpi/keyboard_popup_panel_background_klp.9.png Binary files differnew file mode 100644 index 000000000..896505518 --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_popup_panel_background_klp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_active_ics.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_active_ics.9.png Binary files differnew file mode 100644 index 000000000..d990c0258 --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_active_ics.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_active_holo.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_active_klp.9.png Binary files differindex a2f6ac0e2..a2f6ac0e2 100644 --- a/java/res/drawable-xhdpi/btn_keyboard_key_dark_active_holo.9.png +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_active_klp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_normal_on_ics.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_normal_on_ics.9.png Binary files differnew file mode 100644 index 000000000..ab8fb2e86 --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_normal_on_ics.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_normal_on_holo.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_normal_on_klp.9.png Binary files differindex 20251a000..20251a000 100644 --- a/java/res/drawable-xhdpi/btn_keyboard_key_dark_normal_on_holo.9.png +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_normal_on_klp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_ics.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_ics.9.png Binary files differnew file mode 100644 index 000000000..3871689ef --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_ics.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_holo.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_klp.9.png Binary files differindex 84d173967..84d173967 100644 --- a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_holo.9.png +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_klp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_off_ics.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_off_ics.9.png Binary files differnew file mode 100644 index 000000000..912506368 --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_off_ics.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_off_holo.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_off_klp.9.png Binary files differindex ee4490eac..ee4490eac 100644 --- a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_off_holo.9.png +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_off_klp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_on_ics.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_on_ics.9.png Binary files differnew file mode 100644 index 000000000..35ce67fdc --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_on_ics.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_on_holo.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_on_klp.9.png Binary files differindex e8124776c..e8124776c 100644 --- a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_on_holo.9.png +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_on_klp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_light_pressed_ics.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_light_pressed_ics.9.png Binary files differnew file mode 100644 index 000000000..c23a4b225 --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_light_pressed_ics.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_light_pressed_holo.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_light_pressed_klp.9.png Binary files differindex f770962c3..f770962c3 100644 --- a/java/res/drawable-xhdpi/btn_keyboard_key_light_pressed_holo.9.png +++ b/java/res/drawable-xhdpi/btn_keyboard_key_light_pressed_klp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_ics.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_ics.9.png Binary files differnew file mode 100644 index 000000000..0c7bfdace --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_ics.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_holo.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_klp.9.png Binary files differindex 891d00024..891d00024 100644 --- a/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_holo.9.png +++ b/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_klp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_background_ics.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_background_ics.9.png Binary files differnew file mode 100644 index 000000000..d999127f2 --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_background_ics.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_background_holo.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_background_klp.9.png Binary files differindex e8c65f677..e8c65f677 100644 --- a/java/res/drawable-xhdpi/keyboard_key_feedback_background_holo.9.png +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_background_klp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_left_background_ics.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_left_background_ics.9.png Binary files differnew file mode 100644 index 000000000..c4d694136 --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_left_background_ics.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_left_background_holo.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_left_background_klp.9.png Binary files differindex 543bc763e..543bc763e 100644 --- a/java/res/drawable-xhdpi/keyboard_key_feedback_left_background_holo.9.png +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_left_background_klp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_left_more_background_ics.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_left_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..5429c1785 --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_left_more_background_ics.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_left_more_background_holo.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_left_more_background_klp.9.png Binary files differindex ec42aadb6..ec42aadb6 100644 --- a/java/res/drawable-xhdpi/keyboard_key_feedback_left_more_background_holo.9.png +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_left_more_background_klp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_more_background_ics.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..5135a0869 --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_more_background_ics.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_more_background_holo.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_more_background_klp.9.png Binary files differindex 319e9d7cf..319e9d7cf 100644 --- a/java/res/drawable-xhdpi/keyboard_key_feedback_more_background_holo.9.png +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_more_background_klp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_right_background_ics.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_right_background_ics.9.png Binary files differnew file mode 100644 index 000000000..19a77a29f --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_right_background_ics.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_right_background_holo.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_right_background_klp.9.png Binary files differindex 052032be7..052032be7 100644 --- a/java/res/drawable-xhdpi/keyboard_key_feedback_right_background_holo.9.png +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_right_background_klp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_right_more_background_ics.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_right_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..ae2ffff8e --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_right_more_background_ics.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_right_more_background_holo.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_right_more_background_klp.9.png Binary files differindex c7e9d1c9e..c7e9d1c9e 100644 --- a/java/res/drawable-xhdpi/keyboard_key_feedback_right_more_background_holo.9.png +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_right_more_background_klp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_popup_panel_background_holo.9.png b/java/res/drawable-xhdpi/keyboard_popup_panel_background_holo.9.png Binary files differdeleted file mode 100644 index dde1856e3..000000000 --- a/java/res/drawable-xhdpi/keyboard_popup_panel_background_holo.9.png +++ /dev/null diff --git a/java/res/drawable-xhdpi/keyboard_popup_panel_background_ics.9.png b/java/res/drawable-xhdpi/keyboard_popup_panel_background_ics.9.png Binary files differnew file mode 100644 index 000000000..1dee699f4 --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_popup_panel_background_ics.9.png diff --git a/java/res/drawable-xhdpi/keyboard_popup_panel_background_klp.9.png b/java/res/drawable-xhdpi/keyboard_popup_panel_background_klp.9.png Binary files differnew file mode 100644 index 000000000..36df715b6 --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_popup_panel_background_klp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_active_ics.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_active_ics.9.png Binary files differnew file mode 100644 index 000000000..680421eaf --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_active_ics.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_active_holo.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_active_klp.9.png Binary files differindex 17f0a7a58..17f0a7a58 100644 --- a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_active_holo.9.png +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_active_klp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_normal_on_ics.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_normal_on_ics.9.png Binary files differnew file mode 100644 index 000000000..40f5011c0 --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_normal_on_ics.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_normal_on_holo.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_normal_on_klp.9.png Binary files differindex 97f96258e..97f96258e 100644 --- a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_normal_on_holo.9.png +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_normal_on_klp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_ics.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_ics.9.png Binary files differnew file mode 100644 index 000000000..6ff6319d3 --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_ics.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_holo.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_klp.9.png Binary files differindex dfb16a76b..dfb16a76b 100644 --- a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_holo.9.png +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_klp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_off_ics.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_off_ics.9.png Binary files differnew file mode 100644 index 000000000..818ea70fd --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_off_ics.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_off_holo.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_off_klp.9.png Binary files differindex bf1d34686..bf1d34686 100644 --- a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_off_holo.9.png +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_off_klp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_on_ics.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_on_ics.9.png Binary files differnew file mode 100644 index 000000000..a476d2a9e --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_on_ics.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_on_holo.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_on_klp.9.png Binary files differindex 962277165..962277165 100644 --- a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_on_holo.9.png +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_on_klp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_light_pressed_ics.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_light_pressed_ics.9.png Binary files differnew file mode 100644 index 000000000..3c17c5eec --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_light_pressed_ics.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_light_pressed_holo.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_light_pressed_klp.9.png Binary files differindex 17144b673..17144b673 100644 --- a/java/res/drawable-xxhdpi/btn_keyboard_key_light_pressed_holo.9.png +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_light_pressed_klp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_popup_selected_ics.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_popup_selected_ics.9.png Binary files differnew file mode 100644 index 000000000..6d2af5942 --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_popup_selected_ics.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_popup_selected_holo.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_popup_selected_klp.9.png Binary files differindex 0cbb2ec84..0cbb2ec84 100644 --- a/java/res/drawable-xxhdpi/btn_keyboard_key_popup_selected_holo.9.png +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_popup_selected_klp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_background_ics.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_background_ics.9.png Binary files differnew file mode 100644 index 000000000..bd1ef3cd9 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_background_ics.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_background_holo.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_background_klp.9.png Binary files differindex 11eee94f3..11eee94f3 100644 --- a/java/res/drawable-xxhdpi/keyboard_key_feedback_background_holo.9.png +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_background_klp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_left_background_ics.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_background_ics.9.png Binary files differnew file mode 100644 index 000000000..65af4b569 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_background_ics.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_left_background_holo.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_background_klp.9.png Binary files differindex 2079e0462..2079e0462 100644 --- a/java/res/drawable-xxhdpi/keyboard_key_feedback_left_background_holo.9.png +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_background_klp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_left_more_background_ics.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..ac6750dcb --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_more_background_ics.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_left_more_background_holo.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_more_background_klp.9.png Binary files differindex c4178d9a8..c4178d9a8 100644 --- a/java/res/drawable-xxhdpi/keyboard_key_feedback_left_more_background_holo.9.png +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_more_background_klp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_more_background_ics.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..cea7c05f6 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_more_background_ics.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_more_background_holo.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_more_background_klp.9.png Binary files differindex 121411a06..121411a06 100644 --- a/java/res/drawable-xxhdpi/keyboard_key_feedback_more_background_holo.9.png +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_more_background_klp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_right_background_ics.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_background_ics.9.png Binary files differnew file mode 100644 index 000000000..520fa7c6b --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_background_ics.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_right_background_holo.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_background_klp.9.png Binary files differindex d3d8733fd..d3d8733fd 100644 --- a/java/res/drawable-xxhdpi/keyboard_key_feedback_right_background_holo.9.png +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_background_klp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_right_more_background_ics.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_more_background_ics.9.png Binary files differnew file mode 100644 index 000000000..eee221758 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_more_background_ics.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_right_more_background_holo.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_more_background_klp.9.png Binary files differindex d7ec8bcb2..d7ec8bcb2 100644 --- a/java/res/drawable-xxhdpi/keyboard_key_feedback_right_more_background_holo.9.png +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_more_background_klp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_popup_panel_background_holo.9.png b/java/res/drawable-xxhdpi/keyboard_popup_panel_background_holo.9.png Binary files differdeleted file mode 100644 index ca576deaf..000000000 --- a/java/res/drawable-xxhdpi/keyboard_popup_panel_background_holo.9.png +++ /dev/null diff --git a/java/res/drawable-xxhdpi/keyboard_popup_panel_background_ics.9.png b/java/res/drawable-xxhdpi/keyboard_popup_panel_background_ics.9.png Binary files differnew file mode 100644 index 000000000..721c24400 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_popup_panel_background_ics.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_popup_panel_background_klp.9.png b/java/res/drawable-xxhdpi/keyboard_popup_panel_background_klp.9.png Binary files differnew file mode 100644 index 000000000..91d5d7f90 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_popup_panel_background_klp.9.png diff --git a/java/res/drawable/btn_keyboard_key_functional_ics.xml b/java/res/drawable/btn_keyboard_key_functional_ics.xml index 5dcde5fa9..847ca72f4 100644 --- a/java/res/drawable/btn_keyboard_key_functional_ics.xml +++ b/java/res/drawable/btn_keyboard_key_functional_ics.xml @@ -17,6 +17,6 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Functional keys. --> <item android:state_pressed="true" - android:drawable="@drawable/btn_keyboard_key_dark_pressed_holo" /> + android:drawable="@drawable/btn_keyboard_key_dark_pressed_ics" /> <item android:drawable="@drawable/btn_keyboard_key_dark_normal_holo" /> </selector> diff --git a/java/res/drawable/btn_keyboard_key_functional_klp.xml b/java/res/drawable/btn_keyboard_key_functional_klp.xml new file mode 100644 index 000000000..0e17ed234 --- /dev/null +++ b/java/res/drawable/btn_keyboard_key_functional_klp.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- Functional keys. --> + <item android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_dark_pressed_klp" /> + <item android:drawable="@drawable/btn_keyboard_key_dark_normal_holo" /> +</selector> diff --git a/java/res/drawable/btn_keyboard_key_ics.xml b/java/res/drawable/btn_keyboard_key_ics.xml index 0c86e163e..259bb9ba5 100644 --- a/java/res/drawable/btn_keyboard_key_ics.xml +++ b/java/res/drawable/btn_keyboard_key_ics.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2011 The Android Open Source Project +<!-- 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. @@ -17,23 +17,23 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Functional keys. --> <item android:state_single="true" android:state_pressed="true" - android:drawable="@drawable/btn_keyboard_key_dark_pressed_holo" /> + android:drawable="@drawable/btn_keyboard_key_dark_pressed_ics" /> <item android:state_single="true" android:drawable="@drawable/btn_keyboard_key_dark_normal_holo" /> <!-- Action keys. --> <item android:state_active="true" android:state_pressed="true" - android:drawable="@drawable/btn_keyboard_key_dark_pressed_holo" /> + android:drawable="@drawable/btn_keyboard_key_dark_pressed_ics" /> <item android:state_active="true" - android:drawable="@drawable/btn_keyboard_key_dark_active_holo" /> + android:drawable="@drawable/btn_keyboard_key_dark_active_ics" /> <!-- Toggle keys. Use checkable/checked state. --> <item android:state_checkable="true" android:state_checked="true" android:state_pressed="true" - android:drawable="@drawable/btn_keyboard_key_dark_pressed_on_holo" /> + android:drawable="@drawable/btn_keyboard_key_dark_pressed_on_ics" /> <item android:state_checkable="true" android:state_pressed="true" - android:drawable="@drawable/btn_keyboard_key_dark_pressed_off_holo" /> + android:drawable="@drawable/btn_keyboard_key_dark_pressed_off_ics" /> <item android:state_checkable="true" android:state_checked="true" - android:drawable="@drawable/btn_keyboard_key_dark_normal_on_holo" /> + android:drawable="@drawable/btn_keyboard_key_dark_normal_on_ics" /> <item android:state_checkable="true" android:drawable="@drawable/btn_keyboard_key_dark_normal_off_holo" /> @@ -43,6 +43,6 @@ <!-- Normal keys. --> <item android:state_pressed="true" - android:drawable="@drawable/btn_keyboard_key_light_pressed_holo" /> + android:drawable="@drawable/btn_keyboard_key_light_pressed_ics" /> <item android:drawable="@drawable/btn_keyboard_key_light_normal_holo" /> </selector> diff --git a/java/res/drawable/btn_keyboard_key_klp.xml b/java/res/drawable/btn_keyboard_key_klp.xml new file mode 100644 index 000000000..16b5fa00b --- /dev/null +++ b/java/res/drawable/btn_keyboard_key_klp.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- Functional keys. --> + <item android:state_single="true" android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_dark_pressed_klp" /> + <item android:state_single="true" + android:drawable="@drawable/btn_keyboard_key_dark_normal_holo" /> + + <!-- Action keys. --> + <item android:state_active="true" android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_dark_pressed_klp" /> + <item android:state_active="true" + android:drawable="@drawable/btn_keyboard_key_dark_active_klp" /> + + <!-- Toggle keys. Use checkable/checked state. --> + <item android:state_checkable="true" android:state_checked="true" android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_dark_pressed_on_klp" /> + <item android:state_checkable="true" android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_dark_pressed_off_klp" /> + <item android:state_checkable="true" android:state_checked="true" + android:drawable="@drawable/btn_keyboard_key_dark_normal_on_klp" /> + <item android:state_checkable="true" + android:drawable="@drawable/btn_keyboard_key_dark_normal_off_holo" /> + + <!-- Empty background keys. --> + <item android:state_empty="true" + android:drawable="@drawable/transparent" /> + + <!-- Normal keys. --> + <item android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_light_pressed_klp" /> + <item android:drawable="@drawable/btn_keyboard_key_light_normal_holo" /> +</selector> diff --git a/java/res/drawable/btn_keyboard_key_popup_ics.xml b/java/res/drawable/btn_keyboard_key_popup_ics.xml index b99679ba1..31b613176 100644 --- a/java/res/drawable/btn_keyboard_key_popup_ics.xml +++ b/java/res/drawable/btn_keyboard_key_popup_ics.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2011 The Android Open Source Project +<!-- 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. @@ -16,6 +16,6 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" - android:drawable="@drawable/btn_keyboard_key_popup_selected_holo" /> + android:drawable="@drawable/btn_keyboard_key_popup_selected_ics" /> <item android:drawable="@drawable/transparent" /> </selector> diff --git a/java/res/drawable/btn_keyboard_key_popup_klp.xml b/java/res/drawable/btn_keyboard_key_popup_klp.xml new file mode 100644 index 000000000..62cbca8ae --- /dev/null +++ b/java/res/drawable/btn_keyboard_key_popup_klp.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_popup_selected_klp" /> + <item android:drawable="@drawable/transparent" /> +</selector> diff --git a/java/res/drawable/btn_suggestion_ics.xml b/java/res/drawable/btn_suggestion_ics.xml index e4257e327..8f528ee4b 100644 --- a/java/res/drawable/btn_suggestion_ics.xml +++ b/java/res/drawable/btn_suggestion_ics.xml @@ -2,7 +2,7 @@ <!-- /* ** -** Copyright 2011, The Android Open Source Project +** Copyright 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. @@ -23,5 +23,5 @@ > <item android:state_pressed="true" - android:drawable="@drawable/btn_keyboard_key_popup_selected_holo" /> + android:drawable="@drawable/btn_keyboard_key_popup_selected_ics" /> </selector> diff --git a/java/res/drawable/btn_suggestion_klp.xml b/java/res/drawable/btn_suggestion_klp.xml new file mode 100644 index 000000000..471165bdf --- /dev/null +++ b/java/res/drawable/btn_suggestion_klp.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<selector + xmlns:android="http://schemas.android.com/apk/res/android" +> + <item + android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_popup_selected_klp" /> +</selector> diff --git a/java/res/drawable/keyboard_key_feedback_ics.xml b/java/res/drawable/keyboard_key_feedback_ics.xml index 3c8850e6c..b52a61fbf 100644 --- a/java/res/drawable/keyboard_key_feedback_ics.xml +++ b/java/res/drawable/keyboard_key_feedback_ics.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2011 The Android Open Source Project +<!-- 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. @@ -20,17 +20,17 @@ > <!-- Left edge --> <item latin:state_left_edge="true" latin:state_has_morekeys="true" - android:drawable="@drawable/keyboard_key_feedback_left_more_background_holo" /> + android:drawable="@drawable/keyboard_key_feedback_left_more_background_ics" /> <item latin:state_left_edge="true" - android:drawable="@drawable/keyboard_key_feedback_left_background_holo" /> + android:drawable="@drawable/keyboard_key_feedback_left_background_ics" /> <!-- Right edge --> <item latin:state_right_edge="true" latin:state_has_morekeys="true" - android:drawable="@drawable/keyboard_key_feedback_right_more_background_holo" /> + android:drawable="@drawable/keyboard_key_feedback_right_more_background_ics" /> <item latin:state_right_edge="true" - android:drawable="@drawable/keyboard_key_feedback_right_background_holo" /> + android:drawable="@drawable/keyboard_key_feedback_right_background_ics" /> <item latin:state_has_morekeys="true" - android:drawable="@drawable/keyboard_key_feedback_more_background_holo" /> - <item android:drawable="@drawable/keyboard_key_feedback_background_holo" /> + android:drawable="@drawable/keyboard_key_feedback_more_background_ics" /> + <item android:drawable="@drawable/keyboard_key_feedback_background_ics" /> </selector> diff --git a/java/res/drawable/keyboard_key_feedback_klp.xml b/java/res/drawable/keyboard_key_feedback_klp.xml new file mode 100644 index 000000000..a38655641 --- /dev/null +++ b/java/res/drawable/keyboard_key_feedback_klp.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<selector + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" +> + <!-- Left edge --> + <item latin:state_left_edge="true" latin:state_has_morekeys="true" + android:drawable="@drawable/keyboard_key_feedback_left_more_background_klp" /> + <item latin:state_left_edge="true" + android:drawable="@drawable/keyboard_key_feedback_left_background_klp" /> + + <!-- Right edge --> + <item latin:state_right_edge="true" latin:state_has_morekeys="true" + android:drawable="@drawable/keyboard_key_feedback_right_more_background_klp" /> + <item latin:state_right_edge="true" + android:drawable="@drawable/keyboard_key_feedback_right_background_klp" /> + + <item latin:state_has_morekeys="true" + android:drawable="@drawable/keyboard_key_feedback_more_background_klp" /> + <item android:drawable="@drawable/keyboard_key_feedback_background_klp" /> +</selector> diff --git a/java/res/layout/key_preview_ics.xml b/java/res/layout/key_preview_ics.xml index 222e8846c..33b6947ef 100644 --- a/java/res/layout/key_preview_ics.xml +++ b/java/res/layout/key_preview_ics.xml @@ -2,7 +2,7 @@ <!-- /* ** -** Copyright 2012, The Android Open Source Project +** Copyright 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. diff --git a/java/res/layout/key_preview_klp.xml b/java/res/layout/key_preview_klp.xml new file mode 100644 index 000000000..160aeb9a9 --- /dev/null +++ b/java/res/layout/key_preview_klp.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<TextView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@drawable/keyboard_key_feedback_klp" + android:minWidth="32dp" + android:gravity="center" +/> diff --git a/java/res/values-af/strings-action-keys.xml b/java/res/values-af/strings-action-keys.xml new file mode 100644 index 000000000..615dc1205 --- /dev/null +++ b/java/res/values-af/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Gaan"</string> + <string name="label_next_key" msgid="362972844525672568">"Volgende"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Vorige"</string> + <string name="label_done_key" msgid="2441578748772529288">"Klaar"</string> + <string name="label_send_key" msgid="2815056534433717444">"Stuur"</string> + <string name="label_pause_key" msgid="181098308428035340">"Laat wag"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Wag"</string> +</resources> diff --git a/java/res/values-af/strings.xml b/java/res/values-af/strings.xml index adf9e5bf5..a4ae86b41 100644 --- a/java/res/values-af/strings.xml +++ b/java/res/values-af/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dinamiese sweefvoorskou"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Sien die voorgestelde woord tydens gebare"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Gestoor"</string> - <string name="label_go_key" msgid="1635148082137219148">"Gaan"</string> - <string name="label_next_key" msgid="362972844525672568">"Volgende"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Vorige"</string> - <string name="label_done_key" msgid="2441578748772529288">"Klaar"</string> - <string name="label_send_key" msgid="2815056534433717444">"Stuur"</string> - <string name="label_pause_key" msgid="181098308428035340">"Laat wag"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Wag"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Koppel \'n kopstuk om te hoor hoe wagwoordsleutels hardop gesê word."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Huidige teks is %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Geen teks ingevoer nie"</string> diff --git a/java/res/values-am/strings-action-keys.xml b/java/res/values-am/strings-action-keys.xml new file mode 100644 index 000000000..45196a4b4 --- /dev/null +++ b/java/res/values-am/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"ሂድ"</string> + <string name="label_next_key" msgid="362972844525672568">"በመቀጠል"</string> + <string name="label_previous_key" msgid="1211868118071386787">"ቀዳሚ"</string> + <string name="label_done_key" msgid="2441578748772529288">"ተከናውኗል"</string> + <string name="label_send_key" msgid="2815056534433717444">" ይላኩ"</string> + <string name="label_pause_key" msgid="181098308428035340">"ላፍታ አቁም"</string> + <string name="label_wait_key" msgid="6402152600878093134">"ቆይ"</string> +</resources> diff --git a/java/res/values-am/strings.xml b/java/res/values-am/strings.xml index 42f60a41f..a29e22987 100644 --- a/java/res/values-am/strings.xml +++ b/java/res/values-am/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"ተለዋዋጭ ተንሳፋፊ ቅድመ-እይታ"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"ምልክት እየሰጡ ሳሉ በአስተያየት የተጠቆመው ቃል ይመልከቱ"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : ተቀምጧል"</string> - <string name="label_go_key" msgid="1635148082137219148">"ሂድ"</string> - <string name="label_next_key" msgid="362972844525672568">"በመቀጠል"</string> - <string name="label_previous_key" msgid="1211868118071386787">"ቀዳሚ"</string> - <string name="label_done_key" msgid="2441578748772529288">"ተከናውኗል"</string> - <string name="label_send_key" msgid="2815056534433717444">" ይላኩ"</string> - <string name="label_pause_key" msgid="181098308428035340">"ላፍታ አቁም"</string> - <string name="label_wait_key" msgid="6402152600878093134">"ቆይ"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"የይለፍቃል ቁልፎች ጮክ በለው ሲነገሩ ለመስማት የጆሮ ማዳመጫ ሰካ::"</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"የአሁኑ ፅሁፍ %s ነው"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"ምንም ፅሁፍ አልገባም"</string> diff --git a/java/res/values-ar/strings-action-keys.xml b/java/res/values-ar/strings-action-keys.xml new file mode 100644 index 000000000..99e8f6a73 --- /dev/null +++ b/java/res/values-ar/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"تنفيذ"</string> + <string name="label_next_key" msgid="362972844525672568">"التالي"</string> + <string name="label_previous_key" msgid="1211868118071386787">"السابق"</string> + <string name="label_done_key" msgid="2441578748772529288">"تم"</string> + <string name="label_send_key" msgid="2815056534433717444">"إرسال"</string> + <string name="label_pause_key" msgid="181098308428035340">"توقف مؤقت"</string> + <string name="label_wait_key" msgid="6402152600878093134">"انتظار"</string> +</resources> diff --git a/java/res/values-ar/strings.xml b/java/res/values-ar/strings.xml index 201976a5a..71f92fb5d 100644 --- a/java/res/values-ar/strings.xml +++ b/java/res/values-ar/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"معاينة نصوص متحركة ديناميكية"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"مشاهدة الكلمة المقترحة أثناء الإيماءة"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : تم الحفظ"</string> - <string name="label_go_key" msgid="1635148082137219148">"تنفيذ"</string> - <string name="label_next_key" msgid="362972844525672568">"التالي"</string> - <string name="label_previous_key" msgid="1211868118071386787">"السابق"</string> - <string name="label_done_key" msgid="2441578748772529288">"تم"</string> - <string name="label_send_key" msgid="2815056534433717444">"إرسال"</string> - <string name="label_pause_key" msgid="181098308428035340">"توقف مؤقت"</string> - <string name="label_wait_key" msgid="6402152600878093134">"انتظار"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"يمكنك توصيل سماعة رأس لسماع مفاتيح كلمة المرور منطوقة بصوت عالٍ."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"النص الحالي هو %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"لم يتم إدخال نص"</string> diff --git a/java/res/values-be/strings-action-keys.xml b/java/res/values-be/strings-action-keys.xml new file mode 100644 index 000000000..91416c8b7 --- /dev/null +++ b/java/res/values-be/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Пачаць"</string> + <string name="label_next_key" msgid="362972844525672568">"Далей"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Назад"</string> + <string name="label_done_key" msgid="2441578748772529288">"Гатова"</string> + <string name="label_send_key" msgid="2815056534433717444">"Адправіць"</string> + <string name="label_pause_key" msgid="181098308428035340">"Паўза"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Чакае"</string> +</resources> diff --git a/java/res/values-be/strings.xml b/java/res/values-be/strings.xml index d9b970807..02972f07e 100644 --- a/java/res/values-be/strings.xml +++ b/java/res/values-be/strings.xml @@ -77,13 +77,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Дынамічны плаваючы прагляд"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Праглядаць прапанаванае слова падчас жэсту"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Захаваныя"</string> - <string name="label_go_key" msgid="1635148082137219148">"Пачаць"</string> - <string name="label_next_key" msgid="362972844525672568">"Далей"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Назад"</string> - <string name="label_done_key" msgid="2441578748772529288">"Гатова"</string> - <string name="label_send_key" msgid="2815056534433717444">"Адправіць"</string> - <string name="label_pause_key" msgid="181098308428035340">"Паўза"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Чакае"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Каб праслухаць паролi, падключыце гарнiтуру."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Бягучы тэкст %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Тэкст не ўведзены"</string> diff --git a/java/res/values-bg/strings-action-keys.xml b/java/res/values-bg/strings-action-keys.xml new file mode 100644 index 000000000..609bf415b --- /dev/null +++ b/java/res/values-bg/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Старт"</string> + <string name="label_next_key" msgid="362972844525672568">"Напред"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Пред."</string> + <string name="label_done_key" msgid="2441578748772529288">"Готово"</string> + <string name="label_send_key" msgid="2815056534433717444">"Изпращане"</string> + <string name="label_pause_key" msgid="181098308428035340">"Пауза"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Чака"</string> +</resources> diff --git a/java/res/values-bg/strings.xml b/java/res/values-bg/strings.xml index eecc0f0e0..69dec9661 100644 --- a/java/res/values-bg/strings.xml +++ b/java/res/values-bg/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Динамична плаваща визуализация"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Преглед на предложената дума при използване на жестове"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Запазено"</string> - <string name="label_go_key" msgid="1635148082137219148">"Старт"</string> - <string name="label_next_key" msgid="362972844525672568">"Напред"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Пред."</string> - <string name="label_done_key" msgid="2441578748772529288">"Готово"</string> - <string name="label_send_key" msgid="2815056534433717444">"Изпращане"</string> - <string name="label_pause_key" msgid="181098308428035340">"Пауза"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Чака"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Включете слушалки, за да чуете клавишите за паролата на висок глас."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Текущият текст е %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Няма въведен текст"</string> diff --git a/java/res/values-ca/strings-action-keys.xml b/java/res/values-ca/strings-action-keys.xml new file mode 100644 index 000000000..0c0c84efd --- /dev/null +++ b/java/res/values-ca/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Vés"</string> + <string name="label_next_key" msgid="362972844525672568">"Següent"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Ant."</string> + <string name="label_done_key" msgid="2441578748772529288">"Fet"</string> + <string name="label_send_key" msgid="2815056534433717444">"Envia"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Espera"</string> +</resources> diff --git a/java/res/values-ca/strings.xml b/java/res/values-ca/strings.xml index ad3c92e68..95021211d 100644 --- a/java/res/values-ca/strings.xml +++ b/java/res/values-ca/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Visualitz. prèvia dinàmica flotant"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Consulta la paraula suggerida mentre fas el gest"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: desada"</string> - <string name="label_go_key" msgid="1635148082137219148">"Vés"</string> - <string name="label_next_key" msgid="362972844525672568">"Següent"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Ant."</string> - <string name="label_done_key" msgid="2441578748772529288">"Fet"</string> - <string name="label_send_key" msgid="2815056534433717444">"Envia"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Espera"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Connecta un auricular per escoltar les claus de la contrasenya en veu alta."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"El text actual és %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"No s\'ha introduït cap text"</string> diff --git a/java/res/values-cs/strings-action-keys.xml b/java/res/values-cs/strings-action-keys.xml new file mode 100644 index 000000000..700fc78f2 --- /dev/null +++ b/java/res/values-cs/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Přejít"</string> + <string name="label_next_key" msgid="362972844525672568">"Další"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Před."</string> + <string name="label_done_key" msgid="2441578748772529288">"Hotovo"</string> + <string name="label_send_key" msgid="2815056534433717444">"Odeslat"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pauza"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Čekat"</string> +</resources> diff --git a/java/res/values-cs/strings.xml b/java/res/values-cs/strings.xml index 930d30595..0f38f45ca 100644 --- a/java/res/values-cs/strings.xml +++ b/java/res/values-cs/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dynamický plovoucí náhled"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Zobrazení navrhovaného slova při psaní gesty"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: Uloženo"</string> - <string name="label_go_key" msgid="1635148082137219148">"Přejít"</string> - <string name="label_next_key" msgid="362972844525672568">"Další"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Před."</string> - <string name="label_done_key" msgid="2441578748772529288">"Hotovo"</string> - <string name="label_send_key" msgid="2815056534433717444">"Odeslat"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pauza"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Čekat"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Chcete-li slyšet, které klávesy jste při zadávání hesla stiskli, připojte sluchátka."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Aktuální text je %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Není zadán žádný text"</string> diff --git a/java/res/values-da/strings-action-keys.xml b/java/res/values-da/strings-action-keys.xml new file mode 100644 index 000000000..332f2830d --- /dev/null +++ b/java/res/values-da/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Gå"</string> + <string name="label_next_key" msgid="362972844525672568">"Næste"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Forr."</string> + <string name="label_done_key" msgid="2441578748772529288">"Udfør"</string> + <string name="label_send_key" msgid="2815056534433717444">"Send"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Vent"</string> +</resources> diff --git a/java/res/values-da/strings.xml b/java/res/values-da/strings.xml index 93d5c4e9b..839d7cd9e 100644 --- a/java/res/values-da/strings.xml +++ b/java/res/values-da/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dynamisk flydende eks.visning"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Se det foreslåede ord, mens berøringer udføres"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: Gemt"</string> - <string name="label_go_key" msgid="1635148082137219148">"Gå"</string> - <string name="label_next_key" msgid="362972844525672568">"Næste"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Forr."</string> - <string name="label_done_key" msgid="2441578748772529288">"Udfør"</string> - <string name="label_send_key" msgid="2815056534433717444">"Send"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Vent"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Tilslut et headset for at høre indtastningen blive læst højt ved angivelse af adgangskode."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Nuværende tekst er %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Der er ingen indtastet tekst"</string> diff --git a/java/res/values-de/strings-action-keys.xml b/java/res/values-de/strings-action-keys.xml new file mode 100644 index 000000000..5ec047546 --- /dev/null +++ b/java/res/values-de/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Los"</string> + <string name="label_next_key" msgid="362972844525672568">"Weiter"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Zurück"</string> + <string name="label_done_key" msgid="2441578748772529288">"Fertig"</string> + <string name="label_send_key" msgid="2815056534433717444">"Senden"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Warten"</string> +</resources> diff --git a/java/res/values-de/strings.xml b/java/res/values-de/strings.xml index ac5192623..5e35b9ff9 100644 --- a/java/res/values-de/strings.xml +++ b/java/res/values-de/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dyn. unverankerter Vorschlag"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Vorgeschlagenes Wort bei Bewegung anzeigen"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: gespeichert"</string> - <string name="label_go_key" msgid="1635148082137219148">"Los"</string> - <string name="label_next_key" msgid="362972844525672568">"Weiter"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Zurück"</string> - <string name="label_done_key" msgid="2441578748772529288">"Fertig"</string> - <string name="label_send_key" msgid="2815056534433717444">"Senden"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Warten"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Schließen Sie ein Headset an, um das Passwort gesprochen zu hören."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Aktueller Text lautet %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Kein Text eingegeben"</string> diff --git a/java/res/values-el/strings-action-keys.xml b/java/res/values-el/strings-action-keys.xml new file mode 100644 index 000000000..b890c4b1d --- /dev/null +++ b/java/res/values-el/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Μετ."</string> + <string name="label_next_key" msgid="362972844525672568">"Επόμενο"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Προηγ"</string> + <string name="label_done_key" msgid="2441578748772529288">"Τέλος"</string> + <string name="label_send_key" msgid="2815056534433717444">"Αποστολή"</string> + <string name="label_pause_key" msgid="181098308428035340">"Παύση"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Αναμ."</string> +</resources> diff --git a/java/res/values-el/strings.xml b/java/res/values-el/strings.xml index 54b3c3efa..a719077c0 100644 --- a/java/res/values-el/strings.xml +++ b/java/res/values-el/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Προεπισκόπ. δυναμικής κίνησης"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Εμφάνιση της προτεινόμενης λέξης κατά την κίνηση"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Αποθηκεύτηκε"</string> - <string name="label_go_key" msgid="1635148082137219148">"Μετ."</string> - <string name="label_next_key" msgid="362972844525672568">"Επόμενο"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Προηγ"</string> - <string name="label_done_key" msgid="2441578748772529288">"Τέλος"</string> - <string name="label_send_key" msgid="2815056534433717444">"Αποστολή"</string> - <string name="label_pause_key" msgid="181098308428035340">"Παύση"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Αναμ."</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Συνδέστε ένα σετ ακουστικών για να ακούσετε τα πλήκτρα του κωδικού πρόσβασης να εκφωνούνται δυνατά."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Το τρέχον κείμενο είναι %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Δεν υπάρχει κείμενο"</string> diff --git a/java/res/values-en-rGB/strings-action-keys.xml b/java/res/values-en-rGB/strings-action-keys.xml new file mode 100644 index 000000000..062907c76 --- /dev/null +++ b/java/res/values-en-rGB/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Go"</string> + <string name="label_next_key" msgid="362972844525672568">"Next"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Prev"</string> + <string name="label_done_key" msgid="2441578748772529288">"Done"</string> + <string name="label_send_key" msgid="2815056534433717444">"Send"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Wait"</string> +</resources> diff --git a/java/res/values-en-rGB/strings.xml b/java/res/values-en-rGB/strings.xml index bdffb94c1..9e860ecfa 100644 --- a/java/res/values-en-rGB/strings.xml +++ b/java/res/values-en-rGB/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dynamic floating preview"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"See the suggested word while gesturing"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Saved"</string> - <string name="label_go_key" msgid="1635148082137219148">"Go"</string> - <string name="label_next_key" msgid="362972844525672568">"Next"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Prev"</string> - <string name="label_done_key" msgid="2441578748772529288">"Done"</string> - <string name="label_send_key" msgid="2815056534433717444">"Send"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Wait"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Plug in a headset to hear password keys spoken aloud."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Current text is %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"No text entered"</string> diff --git a/java/res/values-en-rIN/strings-action-keys.xml b/java/res/values-en-rIN/strings-action-keys.xml new file mode 100644 index 000000000..062907c76 --- /dev/null +++ b/java/res/values-en-rIN/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Go"</string> + <string name="label_next_key" msgid="362972844525672568">"Next"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Prev"</string> + <string name="label_done_key" msgid="2441578748772529288">"Done"</string> + <string name="label_send_key" msgid="2815056534433717444">"Send"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Wait"</string> +</resources> diff --git a/java/res/values-en-rIN/strings.xml b/java/res/values-en-rIN/strings.xml index bdffb94c1..9e860ecfa 100644 --- a/java/res/values-en-rIN/strings.xml +++ b/java/res/values-en-rIN/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dynamic floating preview"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"See the suggested word while gesturing"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Saved"</string> - <string name="label_go_key" msgid="1635148082137219148">"Go"</string> - <string name="label_next_key" msgid="362972844525672568">"Next"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Prev"</string> - <string name="label_done_key" msgid="2441578748772529288">"Done"</string> - <string name="label_send_key" msgid="2815056534433717444">"Send"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Wait"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Plug in a headset to hear password keys spoken aloud."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Current text is %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"No text entered"</string> diff --git a/java/res/values-es-rUS/strings-action-keys.xml b/java/res/values-es-rUS/strings-action-keys.xml new file mode 100644 index 000000000..b3ad7094b --- /dev/null +++ b/java/res/values-es-rUS/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Ir"</string> + <string name="label_next_key" msgid="362972844525672568">"Siguiente"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Ant."</string> + <string name="label_done_key" msgid="2441578748772529288">"Listo"</string> + <string name="label_send_key" msgid="2815056534433717444">"Enviar"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Espera"</string> +</resources> diff --git a/java/res/values-es-rUS/strings.xml b/java/res/values-es-rUS/strings.xml index 2d7872aaa..1ac080e9c 100644 --- a/java/res/values-es-rUS/strings.xml +++ b/java/res/values-es-rUS/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Vista previa dinámica flotante"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Mira la palabra sugerida mientras haces gestos"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: guardada"</string> - <string name="label_go_key" msgid="1635148082137219148">"Ir"</string> - <string name="label_next_key" msgid="362972844525672568">"Siguiente"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Ant."</string> - <string name="label_done_key" msgid="2441578748772529288">"Listo"</string> - <string name="label_send_key" msgid="2815056534433717444">"Enviar"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Espera"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Enchufa tus auriculares para escuchar en voz alta qué teclas presionas al ingresar una contraseña."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"El texto actual es %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"No se ingresó texto."</string> diff --git a/java/res/values-es/strings-action-keys.xml b/java/res/values-es/strings-action-keys.xml new file mode 100644 index 000000000..7c0035074 --- /dev/null +++ b/java/res/values-es/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Ir"</string> + <string name="label_next_key" msgid="362972844525672568">"Sig."</string> + <string name="label_previous_key" msgid="1211868118071386787">"Anterior"</string> + <string name="label_done_key" msgid="2441578748772529288">"Ok"</string> + <string name="label_send_key" msgid="2815056534433717444">"Enviar"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Espera"</string> +</resources> diff --git a/java/res/values-es/strings.xml b/java/res/values-es/strings.xml index 4dfc57fa6..d9477da93 100644 --- a/java/res/values-es/strings.xml +++ b/java/res/values-es/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Vista previa dinámica flotante"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Ver palabra sugerida al hacer gestos"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: guardada"</string> - <string name="label_go_key" msgid="1635148082137219148">"Ir"</string> - <string name="label_next_key" msgid="362972844525672568">"Sig."</string> - <string name="label_previous_key" msgid="1211868118071386787">"Anterior"</string> - <string name="label_done_key" msgid="2441578748772529288">"Ok"</string> - <string name="label_send_key" msgid="2815056534433717444">"Enviar"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Espera"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Conecta un auricular para escuchar las contraseñas en voz alta."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"El texto actual es %s."</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"No se ha introducido texto."</string> diff --git a/java/res/values-et-rEE/strings-action-keys.xml b/java/res/values-et-rEE/strings-action-keys.xml new file mode 100644 index 000000000..07bdb8491 --- /dev/null +++ b/java/res/values-et-rEE/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Mine"</string> + <string name="label_next_key" msgid="362972844525672568">"Edasi"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Eelm."</string> + <string name="label_done_key" msgid="2441578748772529288">"Valmis"</string> + <string name="label_send_key" msgid="2815056534433717444">"Saada"</string> + <string name="label_pause_key" msgid="181098308428035340">"Peata"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Oota"</string> +</resources> diff --git a/java/res/values-et-rEE/strings.xml b/java/res/values-et-rEE/strings.xml index 3a27a8892..dc46e8cb2 100644 --- a/java/res/values-et-rEE/strings.xml +++ b/java/res/values-et-rEE/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dünaamiline ujuv eelvaade"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Soovitatud sõna vaatamine joonistusega sisestamise ajal"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : salvestatud"</string> - <string name="label_go_key" msgid="1635148082137219148">"Mine"</string> - <string name="label_next_key" msgid="362972844525672568">"Edasi"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Eelm."</string> - <string name="label_done_key" msgid="2441578748772529288">"Valmis"</string> - <string name="label_send_key" msgid="2815056534433717444">"Saada"</string> - <string name="label_pause_key" msgid="181098308428035340">"Peata"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Oota"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Ühendage peakomplekt, et kuulata paroole."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Praegune tekst on %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Teksti ei ole sisestatud"</string> diff --git a/java/res/values-fa/strings-action-keys.xml b/java/res/values-fa/strings-action-keys.xml new file mode 100644 index 000000000..a3262ed73 --- /dev/null +++ b/java/res/values-fa/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"برو"</string> + <string name="label_next_key" msgid="362972844525672568">"بعدی"</string> + <string name="label_previous_key" msgid="1211868118071386787">"قبلی"</string> + <string name="label_done_key" msgid="2441578748772529288">"انجام شد"</string> + <string name="label_send_key" msgid="2815056534433717444">"ارسال"</string> + <string name="label_pause_key" msgid="181098308428035340">"توقف موقت"</string> + <string name="label_wait_key" msgid="6402152600878093134">"منتظر بمانید"</string> +</resources> diff --git a/java/res/values-fa/strings.xml b/java/res/values-fa/strings.xml index 0c194f795..cfd33c259 100644 --- a/java/res/values-fa/strings.xml +++ b/java/res/values-fa/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"پیشنمایش متحرک پویا"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"مشاهده کلمه پیشنهادی در حین انجام حرکات"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : ذخیره شد"</string> - <string name="label_go_key" msgid="1635148082137219148">"برو"</string> - <string name="label_next_key" msgid="362972844525672568">"بعدی"</string> - <string name="label_previous_key" msgid="1211868118071386787">"قبلی"</string> - <string name="label_done_key" msgid="2441578748772529288">"انجام شد"</string> - <string name="label_send_key" msgid="2815056534433717444">"ارسال"</string> - <string name="label_pause_key" msgid="181098308428035340">"توقف موقت"</string> - <string name="label_wait_key" msgid="6402152600878093134">"منتظر بمانید"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"برای شنیدن کلیدهای گذرواژه که با صدای بلند خوانده میشوند، از هدست استفاده کنید."</string> <!-- String.format failed for translation --> <!-- no translation found for spoken_current_text_is (2485723011272583845) --> diff --git a/java/res/values-fi/strings-action-keys.xml b/java/res/values-fi/strings-action-keys.xml new file mode 100644 index 000000000..dfe1d8e73 --- /dev/null +++ b/java/res/values-fi/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Mene"</string> + <string name="label_next_key" msgid="362972844525672568">"Seur."</string> + <string name="label_previous_key" msgid="1211868118071386787">"Edel."</string> + <string name="label_done_key" msgid="2441578748772529288">"Valmis"</string> + <string name="label_send_key" msgid="2815056534433717444">"Läh."</string> + <string name="label_pause_key" msgid="181098308428035340">"Tauko"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Odota"</string> +</resources> diff --git a/java/res/values-fi/strings.xml b/java/res/values-fi/strings.xml index cee1b7d24..cc2dcd6cf 100644 --- a/java/res/values-fi/strings.xml +++ b/java/res/values-fi/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dynaaminen kelluva esikatselu"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Näytä ehdotettu sana piirron aikana"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: tallennettu"</string> - <string name="label_go_key" msgid="1635148082137219148">"Mene"</string> - <string name="label_next_key" msgid="362972844525672568">"Seur."</string> - <string name="label_previous_key" msgid="1211868118071386787">"Edel."</string> - <string name="label_done_key" msgid="2441578748772529288">"Valmis"</string> - <string name="label_send_key" msgid="2815056534433717444">"Läh."</string> - <string name="label_pause_key" msgid="181098308428035340">"Tauko"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Odota"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Liitä kuulokkeet, niin kuulet mitä näppäimiä painat kirjoittaessasi salasanaa."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Nykyinen teksti on %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Ei kirjoitettua tekstiä"</string> diff --git a/java/res/values-fr-rCA/strings-action-keys.xml b/java/res/values-fr-rCA/strings-action-keys.xml new file mode 100644 index 000000000..774e502da --- /dev/null +++ b/java/res/values-fr-rCA/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Aller"</string> + <string name="label_next_key" msgid="362972844525672568">"Suivant"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Préc."</string> + <string name="label_done_key" msgid="2441578748772529288">"Terminé"</string> + <string name="label_send_key" msgid="2815056534433717444">"Envoyer"</string> + <string name="label_pause_key" msgid="181098308428035340">"Suspendre"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Attendre"</string> +</resources> diff --git a/java/res/values-fr-rCA/strings.xml b/java/res/values-fr-rCA/strings.xml index 6f33539ce..61df43282 100644 --- a/java/res/values-fr-rCA/strings.xml +++ b/java/res/values-fr-rCA/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Aperçu flottant dynamique"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Afficher le mot suggéré lors des gestes"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : enregistré"</string> - <string name="label_go_key" msgid="1635148082137219148">"Aller"</string> - <string name="label_next_key" msgid="362972844525672568">"Suivant"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Préc."</string> - <string name="label_done_key" msgid="2441578748772529288">"Terminé"</string> - <string name="label_send_key" msgid="2815056534433717444">"Envoyer"</string> - <string name="label_pause_key" msgid="181098308428035340">"Suspendre"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Attendre"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Branchez des écouteurs pour entendre l\'énoncé à haute voix des touches lors de la saisie du mot de passe."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Le texte actuel est %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Aucun texte saisi"</string> diff --git a/java/res/values-fr/strings-action-keys.xml b/java/res/values-fr/strings-action-keys.xml new file mode 100644 index 000000000..a22b78816 --- /dev/null +++ b/java/res/values-fr/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"OK"</string> + <string name="label_next_key" msgid="362972844525672568">"Suiv."</string> + <string name="label_previous_key" msgid="1211868118071386787">"Préc."</string> + <string name="label_done_key" msgid="2441578748772529288">"OK"</string> + <string name="label_send_key" msgid="2815056534433717444">"Envoi"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Délai"</string> +</resources> diff --git a/java/res/values-fr/strings.xml b/java/res/values-fr/strings.xml index b850df94f..c0840b221 100644 --- a/java/res/values-fr/strings.xml +++ b/java/res/values-fr/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Aperçu flottant dynamique"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Afficher le mot suggéré lors des gestes"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : enregistré"</string> - <string name="label_go_key" msgid="1635148082137219148">"OK"</string> - <string name="label_next_key" msgid="362972844525672568">"Suiv."</string> - <string name="label_previous_key" msgid="1211868118071386787">"Préc."</string> - <string name="label_done_key" msgid="2441578748772529288">"OK"</string> - <string name="label_send_key" msgid="2815056534433717444">"Envoi"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Délai"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Branchez des écouteurs pour entendre l\'énoncé à haute voix des touches lors de la saisie du mot de passe."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Le texte actuel est %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Aucun texte saisi"</string> diff --git a/java/res/values-hi/strings-action-keys.xml b/java/res/values-hi/strings-action-keys.xml new file mode 100644 index 000000000..456aece7c --- /dev/null +++ b/java/res/values-hi/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"जाएं"</string> + <string name="label_next_key" msgid="362972844525672568">"अगला"</string> + <string name="label_previous_key" msgid="1211868118071386787">"पिछला"</string> + <string name="label_done_key" msgid="2441578748772529288">"पूर्ण"</string> + <string name="label_send_key" msgid="2815056534433717444">"भेजें"</string> + <string name="label_pause_key" msgid="181098308428035340">"पॉज़ करें"</string> + <string name="label_wait_key" msgid="6402152600878093134">"प्रतीक्षा करें"</string> +</resources> diff --git a/java/res/values-hi/strings.xml b/java/res/values-hi/strings.xml index 6d2d5d2fe..08d7315a5 100644 --- a/java/res/values-hi/strings.xml +++ b/java/res/values-hi/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"गतिशील फ़्लोटिंग पूर्वावलोकन"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"जेस्चर बनाते समय सुझाया गया शब्द देखें"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: सहेजा गया"</string> - <string name="label_go_key" msgid="1635148082137219148">"जाएं"</string> - <string name="label_next_key" msgid="362972844525672568">"अगला"</string> - <string name="label_previous_key" msgid="1211868118071386787">"पिछला"</string> - <string name="label_done_key" msgid="2441578748772529288">"पूर्ण"</string> - <string name="label_send_key" msgid="2815056534433717444">"भेजें"</string> - <string name="label_pause_key" msgid="181098308428035340">"पॉज़ करें"</string> - <string name="label_wait_key" msgid="6402152600878093134">"प्रतीक्षा करें"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"ज़ोर से बोली गई पासवर्ड कुंजियां सुनने के लिए हेडसेट प्लग इन करें."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"वर्तमान पाठ %s है"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"कोई पाठ दर्ज नहीं किया गया"</string> diff --git a/java/res/values-hr/strings-action-keys.xml b/java/res/values-hr/strings-action-keys.xml new file mode 100644 index 000000000..c475c799f --- /dev/null +++ b/java/res/values-hr/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Idi"</string> + <string name="label_next_key" msgid="362972844525672568">"Dalje"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Pret."</string> + <string name="label_done_key" msgid="2441578748772529288">"Gotovo"</string> + <string name="label_send_key" msgid="2815056534433717444">"Pošalji"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pauza"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Pričekaj"</string> +</resources> diff --git a/java/res/values-hr/strings.xml b/java/res/values-hr/strings.xml index ee2e68a1f..e5f4731ba 100644 --- a/java/res/values-hr/strings.xml +++ b/java/res/values-hr/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dinamički plutajući pregled"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Vidi predloženu riječ tijekom pokreta"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Spremljeno"</string> - <string name="label_go_key" msgid="1635148082137219148">"Idi"</string> - <string name="label_next_key" msgid="362972844525672568">"Dalje"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Pret."</string> - <string name="label_done_key" msgid="2441578748772529288">"Gotovo"</string> - <string name="label_send_key" msgid="2815056534433717444">"Pošalji"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pauza"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Pričekaj"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Priključite slušalice da biste čuli tipke zaporke izgovorene naglas."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Trenutačni tekst je %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Nije unesen tekst"</string> diff --git a/java/res/values-hu/strings-action-keys.xml b/java/res/values-hu/strings-action-keys.xml new file mode 100644 index 000000000..eb72ac8d0 --- /dev/null +++ b/java/res/values-hu/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Ugrás"</string> + <string name="label_next_key" msgid="362972844525672568">"Tovább"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Előző"</string> + <string name="label_done_key" msgid="2441578748772529288">"Kész"</string> + <string name="label_send_key" msgid="2815056534433717444">"Küldés"</string> + <string name="label_pause_key" msgid="181098308428035340">"Szün."</string> + <string name="label_wait_key" msgid="6402152600878093134">"Vár"</string> +</resources> diff --git a/java/res/values-hu/strings.xml b/java/res/values-hu/strings.xml index 71fce941e..bcd229675 100644 --- a/java/res/values-hu/strings.xml +++ b/java/res/values-hu/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dinamikus lebegő előnézet"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"A javasolt szó megtekintése kézmozdulat közben"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : mentve"</string> - <string name="label_go_key" msgid="1635148082137219148">"Ugrás"</string> - <string name="label_next_key" msgid="362972844525672568">"Tovább"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Előző"</string> - <string name="label_done_key" msgid="2441578748772529288">"Kész"</string> - <string name="label_send_key" msgid="2815056534433717444">"Küldés"</string> - <string name="label_pause_key" msgid="181098308428035340">"Szün."</string> - <string name="label_wait_key" msgid="6402152600878093134">"Vár"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Csatlakoztasson egy headsetet, ha hallani szeretné a jelszót felolvasva."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"A jelenlegi szöveg: %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Szöveg nincs megadva"</string> diff --git a/java/res/values-hy-rAM/strings-action-keys.xml b/java/res/values-hy-rAM/strings-action-keys.xml new file mode 100644 index 000000000..f9400559f --- /dev/null +++ b/java/res/values-hy-rAM/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Առաջ"</string> + <string name="label_next_key" msgid="362972844525672568">"Հաջորդը"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Նխրդ"</string> + <string name="label_done_key" msgid="2441578748772529288">"Կատարված է"</string> + <string name="label_send_key" msgid="2815056534433717444">"Ուղարկել"</string> + <string name="label_pause_key" msgid="181098308428035340">"Դադար"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Սպասել"</string> +</resources> diff --git a/java/res/values-hy-rAM/strings.xml b/java/res/values-hy-rAM/strings.xml index b7ca149dd..76b0a08b9 100644 --- a/java/res/values-hy-rAM/strings.xml +++ b/java/res/values-hy-rAM/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Դինամիկ սահող նախատեսք"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Տեսեք առաջարկված բառը՝ ժեստի միջոցով"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>` պահված է"</string> - <string name="label_go_key" msgid="1635148082137219148">"Առաջ"</string> - <string name="label_next_key" msgid="362972844525672568">"Հաջորդը"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Նխրդ"</string> - <string name="label_done_key" msgid="2441578748772529288">"Կատարված է"</string> - <string name="label_send_key" msgid="2815056534433717444">"Ուղարկել"</string> - <string name="label_pause_key" msgid="181098308428035340">"Դադար"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Սպասել"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Միացրեք ականջակալը՝ բարձրաձայն արտասանվող գաղտնաբառը լսելու համար:"</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Տվյալ տեքստը %s է"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Տեքստ չի մուտքագրվել"</string> diff --git a/java/res/values-in/strings-action-keys.xml b/java/res/values-in/strings-action-keys.xml new file mode 100644 index 000000000..85f7e7809 --- /dev/null +++ b/java/res/values-in/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Buka"</string> + <string name="label_next_key" msgid="362972844525672568">"Berikutnya"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Sblm"</string> + <string name="label_done_key" msgid="2441578748772529288">"Selesai"</string> + <string name="label_send_key" msgid="2815056534433717444">"Kirimkan"</string> + <string name="label_pause_key" msgid="181098308428035340">"Jeda"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Tunggu"</string> +</resources> diff --git a/java/res/values-in/strings.xml b/java/res/values-in/strings.xml index a731478a5..99aa8640a 100644 --- a/java/res/values-in/strings.xml +++ b/java/res/values-in/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Pratinjau mengambang dinamis"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Lihat kata yang disarankan saat melakukan isyarat"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Telah disimpan"</string> - <string name="label_go_key" msgid="1635148082137219148">"Buka"</string> - <string name="label_next_key" msgid="362972844525672568">"Berikutnya"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Sblm"</string> - <string name="label_done_key" msgid="2441578748772529288">"Selesai"</string> - <string name="label_send_key" msgid="2815056534433717444">"Kirimkan"</string> - <string name="label_pause_key" msgid="181098308428035340">"Jeda"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Tunggu"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Pasang headset untuk mendengar tombol sandi yang diucapkan dengan keras."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Teks saat ini adalah %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Tidak ada teks yang dimasukkan"</string> diff --git a/java/res/values-is/strings-action-keys.xml b/java/res/values-is/strings-action-keys.xml new file mode 100644 index 000000000..49c6199c5 --- /dev/null +++ b/java/res/values-is/strings-action-keys.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Áfram"</string> + <string name="label_next_key" msgid="362972844525672568">"Næsta"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Fyrra"</string> + <string name="label_done_key" msgid="2441578748772529288">"Lokið"</string> + <string name="label_send_key" msgid="2815056534433717444">"Senda"</string> + <!-- no translation found for label_pause_key (181098308428035340) --> + <skip /> + <!-- no translation found for label_wait_key (6402152600878093134) --> + <skip /> +</resources> diff --git a/java/res/values-is/strings.xml b/java/res/values-is/strings.xml index 5cc643db6..6f685d395 100644 --- a/java/res/values-is/strings.xml +++ b/java/res/values-is/strings.xml @@ -128,15 +128,6 @@ <skip /> <!-- no translation found for added_word (8993883354622484372) --> <skip /> - <string name="label_go_key" msgid="1635148082137219148">"Áfram"</string> - <string name="label_next_key" msgid="362972844525672568">"Næsta"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Fyrra"</string> - <string name="label_done_key" msgid="2441578748772529288">"Lokið"</string> - <string name="label_send_key" msgid="2815056534433717444">"Senda"</string> - <!-- no translation found for label_pause_key (181098308428035340) --> - <skip /> - <!-- no translation found for label_wait_key (6402152600878093134) --> - <skip /> <!-- no translation found for spoken_use_headphones (896961781287283493) --> <skip /> <!-- no translation found for spoken_current_text_is (2485723011272583845) --> diff --git a/java/res/values-it/strings-action-keys.xml b/java/res/values-it/strings-action-keys.xml new file mode 100644 index 000000000..ecf02f58c --- /dev/null +++ b/java/res/values-it/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Vai"</string> + <string name="label_next_key" msgid="362972844525672568">"Avanti"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Indietro"</string> + <string name="label_done_key" msgid="2441578748772529288">"Fine"</string> + <string name="label_send_key" msgid="2815056534433717444">"Invia"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Attesa"</string> +</resources> diff --git a/java/res/values-it/strings.xml b/java/res/values-it/strings.xml index ec27fd5a7..7dd9692b9 100644 --- a/java/res/values-it/strings.xml +++ b/java/res/values-it/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Anteprima mobile dinamica"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Visualizza la parola suggerita durante il gesto"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : parola salvata"</string> - <string name="label_go_key" msgid="1635148082137219148">"Vai"</string> - <string name="label_next_key" msgid="362972844525672568">"Avanti"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Indietro"</string> - <string name="label_done_key" msgid="2441578748772529288">"Fine"</string> - <string name="label_send_key" msgid="2815056534433717444">"Invia"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Attesa"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Collega gli auricolari per ascoltare la pronuncia dei tasti premuti per la password."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Il testo attuale è %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Nessun testo inserito"</string> diff --git a/java/res/values-iw/strings-action-keys.xml b/java/res/values-iw/strings-action-keys.xml new file mode 100644 index 000000000..cfd6a7b4e --- /dev/null +++ b/java/res/values-iw/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"התחל"</string> + <string name="label_next_key" msgid="362972844525672568">"הבא"</string> + <string name="label_previous_key" msgid="1211868118071386787">"הקודם"</string> + <string name="label_done_key" msgid="2441578748772529288">"בוצע"</string> + <string name="label_send_key" msgid="2815056534433717444">"שלח"</string> + <string name="label_pause_key" msgid="181098308428035340">"השהה"</string> + <string name="label_wait_key" msgid="6402152600878093134">"המתן"</string> +</resources> diff --git a/java/res/values-iw/strings.xml b/java/res/values-iw/strings.xml index 664bfcf30..dd185af91 100644 --- a/java/res/values-iw/strings.xml +++ b/java/res/values-iw/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"תצוגה צפה דינמית"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"ראה את המילה המוצעת תוך כדי הזזת האצבע"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : נשמרה"</string> - <string name="label_go_key" msgid="1635148082137219148">"התחל"</string> - <string name="label_next_key" msgid="362972844525672568">"הבא"</string> - <string name="label_previous_key" msgid="1211868118071386787">"הקודם"</string> - <string name="label_done_key" msgid="2441578748772529288">"בוצע"</string> - <string name="label_send_key" msgid="2815056534433717444">"שלח"</string> - <string name="label_pause_key" msgid="181098308428035340">"השהה"</string> - <string name="label_wait_key" msgid="6402152600878093134">"המתן"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"חבר אוזניות כדי לשמוע הקראה של מפתחות סיסמה."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"הטקסט הנוכחי הוא %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"לא הוזן טקסט"</string> diff --git a/java/res/values-ja/strings-action-keys.xml b/java/res/values-ja/strings-action-keys.xml new file mode 100644 index 000000000..342dc9a4d --- /dev/null +++ b/java/res/values-ja/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"実行"</string> + <string name="label_next_key" msgid="362972844525672568">"次へ"</string> + <string name="label_previous_key" msgid="1211868118071386787">"前へ"</string> + <string name="label_done_key" msgid="2441578748772529288">"完了"</string> + <string name="label_send_key" msgid="2815056534433717444">"送信"</string> + <string name="label_pause_key" msgid="181098308428035340">"停止"</string> + <string name="label_wait_key" msgid="6402152600878093134">"待機"</string> +</resources> diff --git a/java/res/values-ja/strings.xml b/java/res/values-ja/strings.xml index fd546d9da..f7e51d320 100644 --- a/java/res/values-ja/strings.xml +++ b/java/res/values-ja/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"動的フローティングプレビュー"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"ジェスチャーで入力候補を表示できます"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>:保存しました"</string> - <string name="label_go_key" msgid="1635148082137219148">"実行"</string> - <string name="label_next_key" msgid="362972844525672568">"次へ"</string> - <string name="label_previous_key" msgid="1211868118071386787">"前へ"</string> - <string name="label_done_key" msgid="2441578748772529288">"完了"</string> - <string name="label_send_key" msgid="2815056534433717444">"送信"</string> - <string name="label_pause_key" msgid="181098308428035340">"停止"</string> - <string name="label_wait_key" msgid="6402152600878093134">"待機"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"パスワードのキーが音声出力されるのでヘッドセットを接続してください。"</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"現在のテキスト:%s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"テキストが入力されていません"</string> diff --git a/java/res/values-ka-rGE/strings-action-keys.xml b/java/res/values-ka-rGE/strings-action-keys.xml new file mode 100644 index 000000000..13066ad8a --- /dev/null +++ b/java/res/values-ka-rGE/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"წასვლა"</string> + <string name="label_next_key" msgid="362972844525672568">"შემდ."</string> + <string name="label_previous_key" msgid="1211868118071386787">"წინა"</string> + <string name="label_done_key" msgid="2441578748772529288">"დასრულდა"</string> + <string name="label_send_key" msgid="2815056534433717444">"გაგზ."</string> + <string name="label_pause_key" msgid="181098308428035340">"პაუზა"</string> + <string name="label_wait_key" msgid="6402152600878093134">"მოცდა"</string> +</resources> diff --git a/java/res/values-ka-rGE/strings.xml b/java/res/values-ka-rGE/strings.xml index 62249616f..71ed65783 100644 --- a/java/res/values-ka-rGE/strings.xml +++ b/java/res/values-ka-rGE/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"დინამიურად მოლივლივე გადახედვა"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"ჟესტიკულაციისას შეთავაზებული სიტყვის ნახვა"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : შეინახა"</string> - <string name="label_go_key" msgid="1635148082137219148">"წასვლა"</string> - <string name="label_next_key" msgid="362972844525672568">"შემდ."</string> - <string name="label_previous_key" msgid="1211868118071386787">"წინა"</string> - <string name="label_done_key" msgid="2441578748772529288">"დასრულდა"</string> - <string name="label_send_key" msgid="2815056534433717444">"გაგზ."</string> - <string name="label_pause_key" msgid="181098308428035340">"პაუზა"</string> - <string name="label_wait_key" msgid="6402152600878093134">"მოცდა"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"შეაერთეთ ყურსაცვამი, რათა მოისმინოთ აკრეფილი პაროლის კლავიშების სახელები."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"მიმდინარე ტექსტი არის %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"ტექსტი არ შეყვანილა"</string> diff --git a/java/res/values-kk/strings-action-keys.xml b/java/res/values-kk/strings-action-keys.xml new file mode 100644 index 000000000..95c84a2ca --- /dev/null +++ b/java/res/values-kk/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Өту"</string> + <string name="label_next_key" msgid="362972844525672568">"Келесі"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Алдағы"</string> + <string name="label_done_key" msgid="2441578748772529288">"Дайын"</string> + <string name="label_send_key" msgid="2815056534433717444">"Жіберу"</string> + <string name="label_pause_key" msgid="181098308428035340">"Тоқтата тұру"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Күту"</string> +</resources> diff --git a/java/res/values-kk/strings.xml b/java/res/values-kk/strings.xml index 4c78be579..947ff2fe9 100644 --- a/java/res/values-kk/strings.xml +++ b/java/res/values-kk/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Динамикалық қалқымалы қарап шығу"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Қимылдау кезінде ұсынылған сөзді көру"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Сақталды"</string> - <string name="label_go_key" msgid="1635148082137219148">"Өту"</string> - <string name="label_next_key" msgid="362972844525672568">"Келесі"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Алдағы"</string> - <string name="label_done_key" msgid="2441578748772529288">"Дайын"</string> - <string name="label_send_key" msgid="2815056534433717444">"Жіберу"</string> - <string name="label_pause_key" msgid="181098308428035340">"Тоқтата тұру"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Күту"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Дауыспен айтылатын құпия сөз кілттерін есту үшін құлақаспап қосыңыз."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Ағымдағы мәтін - %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Мәтін енгізілмеген"</string> diff --git a/java/res/values-km-rKH/strings-action-keys.xml b/java/res/values-km-rKH/strings-action-keys.xml new file mode 100644 index 000000000..e90fba8bc --- /dev/null +++ b/java/res/values-km-rKH/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"ទៅ"</string> + <string name="label_next_key" msgid="362972844525672568">"បន្ទាប់"</string> + <string name="label_previous_key" msgid="1211868118071386787">"មុន"</string> + <string name="label_done_key" msgid="2441578748772529288">"រួចរាល់"</string> + <string name="label_send_key" msgid="2815056534433717444">"ផ្ញើ"</string> + <string name="label_pause_key" msgid="181098308428035340">"ផ្អាក"</string> + <string name="label_wait_key" msgid="6402152600878093134">"រង់ចាំ"</string> +</resources> diff --git a/java/res/values-km-rKH/strings.xml b/java/res/values-km-rKH/strings.xml index 79a0b2c9c..b9cd32da6 100644 --- a/java/res/values-km-rKH/strings.xml +++ b/java/res/values-km-rKH/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"មើលការអណ្ដែតដែលមានចលនាជាមុន"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"មើលពាក្យដែលបានស្នើខណៈពេលកំពុងធ្វើកាយវិការ"</string> <string name="added_word" msgid="8993883354622484372">"បានរក្សាទុក <xliff:g id="WORD">%s</xliff:g> ៖"</string> - <string name="label_go_key" msgid="1635148082137219148">"ទៅ"</string> - <string name="label_next_key" msgid="362972844525672568">"បន្ទាប់"</string> - <string name="label_previous_key" msgid="1211868118071386787">"មុន"</string> - <string name="label_done_key" msgid="2441578748772529288">"រួចរាល់"</string> - <string name="label_send_key" msgid="2815056534433717444">"ផ្ញើ"</string> - <string name="label_pause_key" msgid="181098308428035340">"ផ្អាក"</string> - <string name="label_wait_key" msgid="6402152600878093134">"រង់ចាំ"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"ដោតកាស ដើម្បីស្ដាប់ពាក្យសម្ងាត់។"</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"អត្ថបទបច្ចុប្បន្នគឺ %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"គ្មានអត្ថបទបានបញ្ចូល"</string> diff --git a/java/res/values-ko/strings-action-keys.xml b/java/res/values-ko/strings-action-keys.xml new file mode 100644 index 000000000..42991242b --- /dev/null +++ b/java/res/values-ko/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"이동"</string> + <string name="label_next_key" msgid="362972844525672568">"다음"</string> + <string name="label_previous_key" msgid="1211868118071386787">"이전"</string> + <string name="label_done_key" msgid="2441578748772529288">"완료"</string> + <string name="label_send_key" msgid="2815056534433717444">"전송"</string> + <string name="label_pause_key" msgid="181098308428035340">"일시 중지"</string> + <string name="label_wait_key" msgid="6402152600878093134">"대기"</string> +</resources> diff --git a/java/res/values-ko/strings.xml b/java/res/values-ko/strings.xml index 255e23440..259a142dd 100644 --- a/java/res/values-ko/strings.xml +++ b/java/res/values-ko/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"동적 플로팅 미리보기"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"제스처에 따라 추천 단어 보기"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: 저장됨"</string> - <string name="label_go_key" msgid="1635148082137219148">"이동"</string> - <string name="label_next_key" msgid="362972844525672568">"다음"</string> - <string name="label_previous_key" msgid="1211868118071386787">"이전"</string> - <string name="label_done_key" msgid="2441578748772529288">"완료"</string> - <string name="label_send_key" msgid="2815056534433717444">"전송"</string> - <string name="label_pause_key" msgid="181098308428035340">"일시 중지"</string> - <string name="label_wait_key" msgid="6402152600878093134">"대기"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"비밀번호 키를 음성으로 들으려면 헤드셋을 연결하세요."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"입력한 텍스트: %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"입력한 텍스트 없음"</string> diff --git a/java/res/values-ky/strings-action-keys.xml b/java/res/values-ky/strings-action-keys.xml new file mode 100644 index 000000000..5eda61e1b --- /dev/null +++ b/java/res/values-ky/strings-action-keys.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Баруу"</string> + <string name="label_next_key" msgid="362972844525672568">"Кийин"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Мурун"</string> + <string name="label_done_key" msgid="2441578748772529288">"Даяр"</string> + <string name="label_send_key" msgid="2815056534433717444">"Жибер"</string> + <!-- no translation found for label_pause_key (181098308428035340) --> + <skip /> + <!-- no translation found for label_wait_key (6402152600878093134) --> + <skip /> +</resources> diff --git a/java/res/values-ky/strings.xml b/java/res/values-ky/strings.xml index 45d855cf6..e30c4b965 100644 --- a/java/res/values-ky/strings.xml +++ b/java/res/values-ky/strings.xml @@ -112,19 +112,10 @@ <skip /> <!-- no translation found for added_word (8993883354622484372) --> <skip /> - <string name="label_go_key" msgid="1635148082137219148">"Баруу"</string> - <string name="label_next_key" msgid="362972844525672568">"Кийин"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Мурун"</string> - <string name="label_done_key" msgid="2441578748772529288">"Даяр"</string> - <string name="label_send_key" msgid="2815056534433717444">"Жибер"</string> <!-- no translation found for label_to_symbol_key (8516904117128967293) --> <skip /> <!-- no translation found for label_to_symbol_with_microphone_key (9035925553010061906) --> <skip /> - <!-- no translation found for label_pause_key (181098308428035340) --> - <skip /> - <!-- no translation found for label_wait_key (6402152600878093134) --> - <skip /> <!-- no translation found for spoken_use_headphones (896961781287283493) --> <skip /> <!-- no translation found for spoken_current_text_is (2485723011272583845) --> diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml index b874d4881..c97e68f11 100644 --- a/java/res/values-land/dimens.xml +++ b/java/res/values-land/dimens.xml @@ -31,10 +31,10 @@ <fraction name="key_bottom_gap_gb">5.941%p</fraction> <fraction name="key_horizontal_gap_gb">0.997%p</fraction> - <fraction name="keyboard_top_padding_ics">2.727%p</fraction> - <fraction name="keyboard_bottom_padding_ics">0.0%p</fraction> - <fraction name="key_bottom_gap_ics">5.368%p</fraction> - <fraction name="key_horizontal_gap_ics">1.020%p</fraction> + <fraction name="keyboard_top_padding_holo">2.727%p</fraction> + <fraction name="keyboard_bottom_padding_holo">0.0%p</fraction> + <fraction name="key_bottom_gap_holo">5.368%p</fraction> + <fraction name="key_horizontal_gap_holo">1.020%p</fraction> <!-- left or right padding of label alignment --> <dimen name="key_label_horizontal_padding">8dp</dimen> @@ -54,9 +54,9 @@ <fraction name="key_letter_ratio_5row">78%</fraction> <fraction name="key_uppercase_letter_ratio_5row">48%</fraction> - <dimen name="key_preview_offset_ics">1.6dp</dimen> + <dimen name="key_preview_offset_holo">1.6dp</dimen> <!-- popup_key_height x -0.5 --> - <dimen name="more_keys_keyboard_vertical_correction_ics">-22.4dp</dimen> + <dimen name="more_keys_keyboard_vertical_correction_holo">-22.4dp</dimen> <dimen name="suggestions_strip_height">36dp</dimen> <dimen name="more_suggestions_row_height">36dp</dimen> diff --git a/java/res/values-lo-rLA/strings-action-keys.xml b/java/res/values-lo-rLA/strings-action-keys.xml new file mode 100644 index 000000000..8cb6a241f --- /dev/null +++ b/java/res/values-lo-rLA/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"ໄປ"</string> + <string name="label_next_key" msgid="362972844525672568">"ຕໍ່ໄປ"</string> + <string name="label_previous_key" msgid="1211868118071386787">"ກ່ອນໜ້າ"</string> + <string name="label_done_key" msgid="2441578748772529288">"ແລ້ວໆ"</string> + <string name="label_send_key" msgid="2815056534433717444">"ສົ່ງ"</string> + <string name="label_pause_key" msgid="181098308428035340">"ຄ້າງໄວ້"</string> + <string name="label_wait_key" msgid="6402152600878093134">"ລໍຖ້າ"</string> +</resources> diff --git a/java/res/values-lo-rLA/strings.xml b/java/res/values-lo-rLA/strings.xml index 1597f9237..b1b02cce7 100644 --- a/java/res/values-lo-rLA/strings.xml +++ b/java/res/values-lo-rLA/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"ມີຄຳຕົວຢ່າງລອຍຂຶ້ນມາ"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"ເບິ່ງຄຳທີ່ຖືກແນະນຳໃນເວລາທີ່ກຳລັງຊີ້"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : ບັນທຶກແລ້ວ"</string> - <string name="label_go_key" msgid="1635148082137219148">"ໄປ"</string> - <string name="label_next_key" msgid="362972844525672568">"ຕໍ່ໄປ"</string> - <string name="label_previous_key" msgid="1211868118071386787">"ກ່ອນໜ້າ"</string> - <string name="label_done_key" msgid="2441578748772529288">"ແລ້ວໆ"</string> - <string name="label_send_key" msgid="2815056534433717444">"ສົ່ງ"</string> - <string name="label_pause_key" msgid="181098308428035340">"ຄ້າງໄວ້"</string> - <string name="label_wait_key" msgid="6402152600878093134">"ລໍຖ້າ"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"ສຽບສາຍຫູຟັງເພື່ອຟັງລະຫັດຜ່ານ."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"ຂໍ້ຄວາມປະຈຸບັນແມ່ນ %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"ບໍ່ມີການໃສ່ຂໍ້ຄວາມ"</string> diff --git a/java/res/values-lt/strings-action-keys.xml b/java/res/values-lt/strings-action-keys.xml new file mode 100644 index 000000000..c1309b75c --- /dev/null +++ b/java/res/values-lt/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Pradėti"</string> + <string name="label_next_key" msgid="362972844525672568">"Kitas"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Anks."</string> + <string name="label_done_key" msgid="2441578748772529288">"Atlikta"</string> + <string name="label_send_key" msgid="2815056534433717444">"Siųsti"</string> + <string name="label_pause_key" msgid="181098308428035340">"Prist."</string> + <string name="label_wait_key" msgid="6402152600878093134">"Lauk."</string> +</resources> diff --git a/java/res/values-lt/strings.xml b/java/res/values-lt/strings.xml index 1cb84d00b..4a6daab8b 100644 --- a/java/res/values-lt/strings.xml +++ b/java/res/values-lt/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dinaminė slankioji peržiūra"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Gestikuliuojant peržiūrėti siūlomą žodį"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: išsaugota"</string> - <string name="label_go_key" msgid="1635148082137219148">"Pradėti"</string> - <string name="label_next_key" msgid="362972844525672568">"Kitas"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Anks."</string> - <string name="label_done_key" msgid="2441578748772529288">"Atlikta"</string> - <string name="label_send_key" msgid="2815056534433717444">"Siųsti"</string> - <string name="label_pause_key" msgid="181098308428035340">"Prist."</string> - <string name="label_wait_key" msgid="6402152600878093134">"Lauk."</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Prijunkite ausines, kad išgirstumėte sakomus slaptažodžio klavišus."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Dabartinis tekstas yra %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Nėra įvesto teksto"</string> diff --git a/java/res/values-lv/strings-action-keys.xml b/java/res/values-lv/strings-action-keys.xml new file mode 100644 index 000000000..d6750d02a --- /dev/null +++ b/java/res/values-lv/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Sākt"</string> + <string name="label_next_key" msgid="362972844525672568">"Tālāk"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Iepr."</string> + <string name="label_done_key" msgid="2441578748772529288">"Gatavs"</string> + <string name="label_send_key" msgid="2815056534433717444">"Sūtīt"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pauze"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Gaidīt"</string> +</resources> diff --git a/java/res/values-lv/strings.xml b/java/res/values-lv/strings.xml index 221cc2e05..5770c2959 100644 --- a/java/res/values-lv/strings.xml +++ b/java/res/values-lv/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dinamisk. peldošais priekšsk."</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Skatiet ieteikto vārdu, veicot žestu."</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: saglabāts"</string> - <string name="label_go_key" msgid="1635148082137219148">"Sākt"</string> - <string name="label_next_key" msgid="362972844525672568">"Tālāk"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Iepr."</string> - <string name="label_done_key" msgid="2441578748772529288">"Gatavs"</string> - <string name="label_send_key" msgid="2815056534433717444">"Sūtīt"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pauze"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Gaidīt"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Pievienojiet austiņas, lai dzirdētu paroles rakstzīmes."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Pašreizējais teksts ir %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Nav ievadīts teksts"</string> diff --git a/java/res/values-mk/strings-action-keys.xml b/java/res/values-mk/strings-action-keys.xml new file mode 100644 index 000000000..40de51b00 --- /dev/null +++ b/java/res/values-mk/strings-action-keys.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Оди"</string> + <string name="label_next_key" msgid="362972844525672568">"Следно"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Претходно"</string> + <string name="label_done_key" msgid="2441578748772529288">"Готово"</string> + <string name="label_send_key" msgid="2815056534433717444">"Испрати"</string> + <!-- no translation found for label_pause_key (181098308428035340) --> + <skip /> + <!-- no translation found for label_wait_key (6402152600878093134) --> + <skip /> +</resources> diff --git a/java/res/values-mk/strings.xml b/java/res/values-mk/strings.xml index 6ee84fad1..6f685d395 100644 --- a/java/res/values-mk/strings.xml +++ b/java/res/values-mk/strings.xml @@ -128,15 +128,6 @@ <skip /> <!-- no translation found for added_word (8993883354622484372) --> <skip /> - <string name="label_go_key" msgid="1635148082137219148">"Оди"</string> - <string name="label_next_key" msgid="362972844525672568">"Следно"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Претходно"</string> - <string name="label_done_key" msgid="2441578748772529288">"Готово"</string> - <string name="label_send_key" msgid="2815056534433717444">"Испрати"</string> - <!-- no translation found for label_pause_key (181098308428035340) --> - <skip /> - <!-- no translation found for label_wait_key (6402152600878093134) --> - <skip /> <!-- no translation found for spoken_use_headphones (896961781287283493) --> <skip /> <!-- no translation found for spoken_current_text_is (2485723011272583845) --> diff --git a/java/res/values-mn-rMN/strings-action-keys.xml b/java/res/values-mn-rMN/strings-action-keys.xml new file mode 100644 index 000000000..7cf345e7c --- /dev/null +++ b/java/res/values-mn-rMN/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Явах"</string> + <string name="label_next_key" msgid="362972844525672568">"Дараах"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Өмнөх"</string> + <string name="label_done_key" msgid="2441578748772529288">"Дууссан"</string> + <string name="label_send_key" msgid="2815056534433717444">"Илгээх"</string> + <string name="label_pause_key" msgid="181098308428035340">"Пауз"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Хүлээх"</string> +</resources> diff --git a/java/res/values-mn-rMN/strings.xml b/java/res/values-mn-rMN/strings.xml index 5633cf8cf..658f6d8af 100644 --- a/java/res/values-mn-rMN/strings.xml +++ b/java/res/values-mn-rMN/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Динамик хөвөгчөөр урьдчилан харах"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Зангах явцад санал болгож буй үгийг харах"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Хадгалагдсан"</string> - <string name="label_go_key" msgid="1635148082137219148">"Явах"</string> - <string name="label_next_key" msgid="362972844525672568">"Дараах"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Өмнөх"</string> - <string name="label_done_key" msgid="2441578748772529288">"Дууссан"</string> - <string name="label_send_key" msgid="2815056534433717444">"Илгээх"</string> - <string name="label_pause_key" msgid="181098308428035340">"Пауз"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Хүлээх"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Нууц үгний товчнуудыг чангаар уншихыг сонсохын тулд чихэвчээ залгана уу."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Одоогийн текст %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Текст оруулаагүй"</string> diff --git a/java/res/values-ms-rMY/strings-action-keys.xml b/java/res/values-ms-rMY/strings-action-keys.xml new file mode 100644 index 000000000..5f14b84ec --- /dev/null +++ b/java/res/values-ms-rMY/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Pergi"</string> + <string name="label_next_key" msgid="362972844525672568">"Seterusnya"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Sblm"</string> + <string name="label_done_key" msgid="2441578748772529288">"Selesai"</string> + <string name="label_send_key" msgid="2815056534433717444">"Hantar"</string> + <string name="label_pause_key" msgid="181098308428035340">"Jeda"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Tunggu"</string> +</resources> diff --git a/java/res/values-ms-rMY/strings.xml b/java/res/values-ms-rMY/strings.xml index 41bb9f80c..a87454891 100644 --- a/java/res/values-ms-rMY/strings.xml +++ b/java/res/values-ms-rMY/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Pratonton terapung dinamik"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Lihat perkataan yang dicadangkan semasa membuat gerak isyarat"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Disimpan"</string> - <string name="label_go_key" msgid="1635148082137219148">"Pergi"</string> - <string name="label_next_key" msgid="362972844525672568">"Seterusnya"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Sblm"</string> - <string name="label_done_key" msgid="2441578748772529288">"Selesai"</string> - <string name="label_send_key" msgid="2815056534433717444">"Hantar"</string> - <string name="label_pause_key" msgid="181098308428035340">"Jeda"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Tunggu"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Pasangkan set kepala untuk mendengar kekunci kata laluan disebut dengan kuat."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Teks semasa adalah %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Tiada teks dimasukkan"</string> diff --git a/java/res/values-nb/strings-action-keys.xml b/java/res/values-nb/strings-action-keys.xml new file mode 100644 index 000000000..840e8c842 --- /dev/null +++ b/java/res/values-nb/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Utfør"</string> + <string name="label_next_key" msgid="362972844525672568">"Neste"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Forr."</string> + <string name="label_done_key" msgid="2441578748772529288">"Utfør"</string> + <string name="label_send_key" msgid="2815056534433717444">"Send"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Vent"</string> +</resources> diff --git a/java/res/values-nb/strings.xml b/java/res/values-nb/strings.xml index a473cce71..500fc3301 100644 --- a/java/res/values-nb/strings.xml +++ b/java/res/values-nb/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dynamisk flytende forhåndsvsn."</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Se det foreslåtte ordet mens du utfører bevegelser"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: Lagret"</string> - <string name="label_go_key" msgid="1635148082137219148">"Utfør"</string> - <string name="label_next_key" msgid="362972844525672568">"Neste"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Forr."</string> - <string name="label_done_key" msgid="2441578748772529288">"Utfør"</string> - <string name="label_send_key" msgid="2815056534433717444">"Send"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Vent"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Koble til hodetelefoner for å høre opplesing av bokstavene i passordet."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Gjeldende tekst er %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Ingen tekst er skrevet inn"</string> diff --git a/java/res/values-nl/strings-action-keys.xml b/java/res/values-nl/strings-action-keys.xml new file mode 100644 index 000000000..3a6967fc2 --- /dev/null +++ b/java/res/values-nl/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Start"</string> + <string name="label_next_key" msgid="362972844525672568">"Verder"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Vorig"</string> + <string name="label_done_key" msgid="2441578748772529288">"Gereed"</string> + <string name="label_send_key" msgid="2815056534433717444">"Zenden"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pauze"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Wacht"</string> +</resources> diff --git a/java/res/values-nl/strings.xml b/java/res/values-nl/strings.xml index 60db9f0e8..4413b273d 100644 --- a/java/res/values-nl/strings.xml +++ b/java/res/values-nl/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dynamisch zwevend voorbeeld"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Het voorgestelde woord weergeven tijdens het tekenen"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: opgeslagen"</string> - <string name="label_go_key" msgid="1635148082137219148">"Start"</string> - <string name="label_next_key" msgid="362972844525672568">"Verder"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Vorig"</string> - <string name="label_done_key" msgid="2441578748772529288">"Gereed"</string> - <string name="label_send_key" msgid="2815056534433717444">"Zenden"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pauze"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Wacht"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Sluit een headset aan om wachtwoordtoetsen hardop te laten voorlezen."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Huidige tekst is %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Geen tekst ingevoerd"</string> diff --git a/java/res/values-pl/strings-action-keys.xml b/java/res/values-pl/strings-action-keys.xml new file mode 100644 index 000000000..4bbceeacf --- /dev/null +++ b/java/res/values-pl/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"OK"</string> + <string name="label_next_key" msgid="362972844525672568">"Dalej"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Wstecz"</string> + <string name="label_done_key" msgid="2441578748772529288">"OK"</string> + <string name="label_send_key" msgid="2815056534433717444">"Wyślij"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pauza"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Czekaj"</string> +</resources> diff --git a/java/res/values-pl/strings.xml b/java/res/values-pl/strings.xml index c3ed2d897..d36cd49ba 100644 --- a/java/res/values-pl/strings.xml +++ b/java/res/values-pl/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dynamiczny podgląd słowa"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Podczas gestykulacji będzie widoczne podpowiadane słowo"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Zapisano"</string> - <string name="label_go_key" msgid="1635148082137219148">"OK"</string> - <string name="label_next_key" msgid="362972844525672568">"Dalej"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Wstecz"</string> - <string name="label_done_key" msgid="2441578748772529288">"OK"</string> - <string name="label_send_key" msgid="2815056534433717444">"Wyślij"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pauza"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Czekaj"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Podłącz zestaw słuchawkowy, aby usłyszeć znaki hasła wypowiadane na głos."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Aktualny tekst: %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Nie wprowadzono tekstu"</string> diff --git a/java/res/values-pt-rPT/strings-action-keys.xml b/java/res/values-pt-rPT/strings-action-keys.xml new file mode 100644 index 000000000..88d9ceb9b --- /dev/null +++ b/java/res/values-pt-rPT/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Ir"</string> + <string name="label_next_key" msgid="362972844525672568">"Avançar"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Ant."</string> + <string name="label_done_key" msgid="2441578748772529288">"OK"</string> + <string name="label_send_key" msgid="2815056534433717444">"Enviar"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Esp."</string> +</resources> diff --git a/java/res/values-pt-rPT/strings.xml b/java/res/values-pt-rPT/strings.xml index 2a4c2b823..c7eb06563 100644 --- a/java/res/values-pt-rPT/strings.xml +++ b/java/res/values-pt-rPT/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Pré-visual. flutuante dinâmica"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Ver palavra sugerida enquanto toca"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: guardada"</string> - <string name="label_go_key" msgid="1635148082137219148">"Ir"</string> - <string name="label_next_key" msgid="362972844525672568">"Avançar"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Ant."</string> - <string name="label_done_key" msgid="2441578748772529288">"OK"</string> - <string name="label_send_key" msgid="2815056534433717444">"Enviar"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Esp."</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Ligar auscultadores com microfone integrado para ouvir as teclas da palavra-passe."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"O texto atual é %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Nenhum texto digitado"</string> diff --git a/java/res/values-pt/strings-action-keys.xml b/java/res/values-pt/strings-action-keys.xml new file mode 100644 index 000000000..e007dc009 --- /dev/null +++ b/java/res/values-pt/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Ir"</string> + <string name="label_next_key" msgid="362972844525672568">"Avançar"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Volt."</string> + <string name="label_done_key" msgid="2441578748772529288">"Feito"</string> + <string name="label_send_key" msgid="2815056534433717444">"Enviar"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Esp."</string> +</resources> diff --git a/java/res/values-pt/strings.xml b/java/res/values-pt/strings.xml index c0e1aa6b1..2aa7f7739 100644 --- a/java/res/values-pt/strings.xml +++ b/java/res/values-pt/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Visualizaç. dinâmica flutuante"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Ver a palavra sugerida ao usar gestos"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Salvo"</string> - <string name="label_go_key" msgid="1635148082137219148">"Ir"</string> - <string name="label_next_key" msgid="362972844525672568">"Avançar"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Volt."</string> - <string name="label_done_key" msgid="2441578748772529288">"Feito"</string> - <string name="label_send_key" msgid="2815056534433717444">"Enviar"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Esp."</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Conecte um fone de ouvido para ouvir as chaves de senha em voz alta."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"O texto atual é %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Nenhum texto digitado"</string> diff --git a/java/res/values-rm/strings-action-keys.xml b/java/res/values-rm/strings-action-keys.xml new file mode 100644 index 000000000..fbe84b573 --- /dev/null +++ b/java/res/values-rm/strings-action-keys.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Dai"</string> + <string name="label_next_key" msgid="362972844525672568">"Vinavant"</string> + <!-- no translation found for label_previous_key (1211868118071386787) --> + <skip /> + <string name="label_done_key" msgid="2441578748772529288">"Finì"</string> + <string name="label_send_key" msgid="2815056534433717444">"Trametter"</string> + <!-- no translation found for label_pause_key (181098308428035340) --> + <skip /> + <!-- no translation found for label_wait_key (6402152600878093134) --> + <skip /> +</resources> diff --git a/java/res/values-rm/strings.xml b/java/res/values-rm/strings.xml index b956619c5..3f0bab963 100644 --- a/java/res/values-rm/strings.xml +++ b/java/res/values-rm/strings.xml @@ -123,16 +123,6 @@ <!-- no translation found for gesture_floating_preview_text_summary (4472696213996203533) --> <skip /> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Memorisà"</string> - <string name="label_go_key" msgid="1635148082137219148">"Dai"</string> - <string name="label_next_key" msgid="362972844525672568">"Vinavant"</string> - <!-- no translation found for label_previous_key (1211868118071386787) --> - <skip /> - <string name="label_done_key" msgid="2441578748772529288">"Finì"</string> - <string name="label_send_key" msgid="2815056534433717444">"Trametter"</string> - <!-- no translation found for label_pause_key (181098308428035340) --> - <skip /> - <!-- no translation found for label_wait_key (6402152600878093134) --> - <skip /> <!-- no translation found for spoken_use_headphones (896961781287283493) --> <skip /> <!-- no translation found for spoken_current_text_is (2485723011272583845) --> diff --git a/java/res/values-ro/strings-action-keys.xml b/java/res/values-ro/strings-action-keys.xml new file mode 100644 index 000000000..cdb913452 --- /dev/null +++ b/java/res/values-ro/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"OK"</string> + <string name="label_next_key" msgid="362972844525672568">"Înainte"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Înapoi"</string> + <string name="label_done_key" msgid="2441578748772529288">"Terminat"</string> + <string name="label_send_key" msgid="2815056534433717444">"Trimiteţi"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pauză"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Aşt."</string> +</resources> diff --git a/java/res/values-ro/strings.xml b/java/res/values-ro/strings.xml index c24ec01d1..ad4456aad 100644 --- a/java/res/values-ro/strings.xml +++ b/java/res/values-ro/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Sugestie flotantă dinamică"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Afişaţi cuvântul sugerat când utilizaţi gesturi"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: salvat"</string> - <string name="label_go_key" msgid="1635148082137219148">"OK"</string> - <string name="label_next_key" msgid="362972844525672568">"Înainte"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Înapoi"</string> - <string name="label_done_key" msgid="2441578748772529288">"Terminat"</string> - <string name="label_send_key" msgid="2815056534433717444">"Trimiteţi"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pauză"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Aşt."</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Conectaţi un set căşti-microfon pentru a auzi tastele apăsate când introduceţi parola."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Textul curent este %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Nu a fost introdus text"</string> diff --git a/java/res/values-ru/strings-action-keys.xml b/java/res/values-ru/strings-action-keys.xml new file mode 100644 index 000000000..331d28c6b --- /dev/null +++ b/java/res/values-ru/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Поиск"</string> + <string name="label_next_key" msgid="362972844525672568">"Далее"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Пред."</string> + <string name="label_done_key" msgid="2441578748772529288">"Готово"</string> + <string name="label_send_key" msgid="2815056534433717444">"Отправить"</string> + <string name="label_pause_key" msgid="181098308428035340">"Пауза"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Ждать"</string> +</resources> diff --git a/java/res/values-ru/strings.xml b/java/res/values-ru/strings.xml index 176e75eda..6db65e9ba 100644 --- a/java/res/values-ru/strings.xml +++ b/java/res/values-ru/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Показывать подсказки"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Показывать подсказки при вводе текста"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: сохранено"</string> - <string name="label_go_key" msgid="1635148082137219148">"Поиск"</string> - <string name="label_next_key" msgid="362972844525672568">"Далее"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Пред."</string> - <string name="label_done_key" msgid="2441578748772529288">"Готово"</string> - <string name="label_send_key" msgid="2815056534433717444">"Отправить"</string> - <string name="label_pause_key" msgid="181098308428035340">"Пауза"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Ждать"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Подключите гарнитуру, чтобы услышать пароль."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Введенный текст: %s."</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Текст не введен"</string> diff --git a/java/res/values-sk/strings-action-keys.xml b/java/res/values-sk/strings-action-keys.xml new file mode 100644 index 000000000..a646663d6 --- /dev/null +++ b/java/res/values-sk/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Hľadať"</string> + <string name="label_next_key" msgid="362972844525672568">"Ďalej"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Pred."</string> + <string name="label_done_key" msgid="2441578748772529288">"Hotovo"</string> + <string name="label_send_key" msgid="2815056534433717444">"Odoslať"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pozastaviť"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Čakajte"</string> +</resources> diff --git a/java/res/values-sk/strings.xml b/java/res/values-sk/strings.xml index bc5d6d297..9e5de1e89 100644 --- a/java/res/values-sk/strings.xml +++ b/java/res/values-sk/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dynamická plávajúca ukážka"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Zobrazenie navrhovaného slova pri písaní gestami"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Uložené"</string> - <string name="label_go_key" msgid="1635148082137219148">"Hľadať"</string> - <string name="label_next_key" msgid="362972844525672568">"Ďalej"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Pred."</string> - <string name="label_done_key" msgid="2441578748772529288">"Hotovo"</string> - <string name="label_send_key" msgid="2815056534433717444">"Odoslať"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pozastaviť"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Čakajte"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Ak si chcete pri zadávaní hesla vypočuť nahlas vyslovené klávesy, pripojte náhlavnú súpravu."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Aktuálny text je %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Nie je zadaný žiadny text"</string> diff --git a/java/res/values-sl/strings-action-keys.xml b/java/res/values-sl/strings-action-keys.xml new file mode 100644 index 000000000..7e6c7787e --- /dev/null +++ b/java/res/values-sl/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Pojdi"</string> + <string name="label_next_key" msgid="362972844525672568">"Naprej"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Nazaj"</string> + <string name="label_done_key" msgid="2441578748772529288">"Dokončano"</string> + <string name="label_send_key" msgid="2815056534433717444">"Pošlji"</string> + <string name="label_pause_key" msgid="181098308428035340">"Premor"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Čakaj"</string> +</resources> diff --git a/java/res/values-sl/strings.xml b/java/res/values-sl/strings.xml index c7d698b2f..76e169b3e 100644 --- a/java/res/values-sl/strings.xml +++ b/java/res/values-sl/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dinamični plavajoči predogled"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Prikaz predlagane besede med vnosom s prstom"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: shranjeno"</string> - <string name="label_go_key" msgid="1635148082137219148">"Pojdi"</string> - <string name="label_next_key" msgid="362972844525672568">"Naprej"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Nazaj"</string> - <string name="label_done_key" msgid="2441578748772529288">"Dokončano"</string> - <string name="label_send_key" msgid="2815056534433717444">"Pošlji"</string> - <string name="label_pause_key" msgid="181098308428035340">"Premor"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Čakaj"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Priključite slušalke, če želite slišati izgovorjene tipke gesla."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Trenutno besedilo je %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Ni vnesenega besedila"</string> diff --git a/java/res/values-sr/strings-action-keys.xml b/java/res/values-sr/strings-action-keys.xml new file mode 100644 index 000000000..b1f0910bd --- /dev/null +++ b/java/res/values-sr/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Иди"</string> + <string name="label_next_key" msgid="362972844525672568">"Следеће"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Прет."</string> + <string name="label_done_key" msgid="2441578748772529288">"Готово"</string> + <string name="label_send_key" msgid="2815056534433717444">"Пошаљи"</string> + <string name="label_pause_key" msgid="181098308428035340">"Пауза"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Чекај"</string> +</resources> diff --git a/java/res/values-sr/strings.xml b/java/res/values-sr/strings.xml index e93661a93..16de76074 100644 --- a/java/res/values-sr/strings.xml +++ b/java/res/values-sr/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Динамички плутајући преглед"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Приказује предложену реч при уносу покретом"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Сачувано"</string> - <string name="label_go_key" msgid="1635148082137219148">"Иди"</string> - <string name="label_next_key" msgid="362972844525672568">"Следеће"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Прет."</string> - <string name="label_done_key" msgid="2441578748772529288">"Готово"</string> - <string name="label_send_key" msgid="2815056534433717444">"Пошаљи"</string> - <string name="label_pause_key" msgid="181098308428035340">"Пауза"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Чекај"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Укључите слушалице да бисте чули наглас изговорене тастере за лозинку."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Тренутни текст је %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Текст није унет"</string> diff --git a/java/res/values-sv/strings-action-keys.xml b/java/res/values-sv/strings-action-keys.xml new file mode 100644 index 000000000..4e59fa501 --- /dev/null +++ b/java/res/values-sv/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Kör"</string> + <string name="label_next_key" msgid="362972844525672568">"Nästa"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Föreg"</string> + <string name="label_done_key" msgid="2441578748772529288">"Färdig"</string> + <string name="label_send_key" msgid="2815056534433717444">"Skicka"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Vänta"</string> +</resources> diff --git a/java/res/values-sv/strings.xml b/java/res/values-sv/strings.xml index 1b23e334e..32b8dbe22 100644 --- a/java/res/values-sv/strings.xml +++ b/java/res/values-sv/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Visa ordförslag vid svepskrivning"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Ordförslaget visas i rörelsen medan du skriver"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: sparat"</string> - <string name="label_go_key" msgid="1635148082137219148">"Kör"</string> - <string name="label_next_key" msgid="362972844525672568">"Nästa"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Föreg"</string> - <string name="label_done_key" msgid="2441578748772529288">"Färdig"</string> - <string name="label_send_key" msgid="2815056534433717444">"Skicka"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Vänta"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Anslut hörlurar om du vill att lösenordet ska läsas upp."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Nuvarande text är %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Ingen text har angetts"</string> diff --git a/java/res/values-sw/strings-action-keys.xml b/java/res/values-sw/strings-action-keys.xml new file mode 100644 index 000000000..55442534d --- /dev/null +++ b/java/res/values-sw/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Nenda"</string> + <string name="label_next_key" msgid="362972844525672568">"Inayofuata"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Iliyotangulia"</string> + <string name="label_done_key" msgid="2441578748772529288">"Kwisha"</string> + <string name="label_send_key" msgid="2815056534433717444">"Tuma"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pumzisha"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Subiri"</string> +</resources> diff --git a/java/res/values-sw/strings.xml b/java/res/values-sw/strings.xml index 9a22d20c5..f32fb7434 100644 --- a/java/res/values-sw/strings.xml +++ b/java/res/values-sw/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Kihakiki kinachobadilika cha kuelea"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Onyesha neno lililopendekezwa unapoonyesha ishara"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Imehifadhiwa"</string> - <string name="label_go_key" msgid="1635148082137219148">"Nenda"</string> - <string name="label_next_key" msgid="362972844525672568">"Inayofuata"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Iliyotangulia"</string> - <string name="label_done_key" msgid="2441578748772529288">"Kwisha"</string> - <string name="label_send_key" msgid="2815056534433717444">"Tuma"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pumzisha"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Subiri"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Chomeka plagi ya kifaa cha kichwa cha kusikiza ili kusikiliza msimbo wa nenosiri inayozungumwa kwa sauti ya juu."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Maandishi ya sasa ni %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Hakuna maandishi yaliyoingizwa"</string> diff --git a/java/res/values-sw540dp-land/dimens.xml b/java/res/values-sw540dp-land/dimens.xml index d79e8ca35..002493798 100644 --- a/java/res/values-sw540dp-land/dimens.xml +++ b/java/res/values-sw540dp-land/dimens.xml @@ -29,10 +29,10 @@ <fraction name="key_bottom_gap_gb">5.200%p</fraction> <fraction name="key_horizontal_gap_gb">1.447%p</fraction> - <fraction name="keyboard_top_padding_ics">2.727%p</fraction> - <fraction name="keyboard_bottom_padding_ics">0.0%p</fraction> - <fraction name="key_bottom_gap_ics">4.5%p</fraction> - <fraction name="key_horizontal_gap_ics">0.9%p</fraction> + <fraction name="keyboard_top_padding_holo">2.727%p</fraction> + <fraction name="keyboard_bottom_padding_holo">0.0%p</fraction> + <fraction name="key_bottom_gap_holo">4.5%p</fraction> + <fraction name="key_horizontal_gap_holo">0.9%p</fraction> <dimen name="popup_key_height">81.9dp</dimen> diff --git a/java/res/values-sw540dp/dimens.xml b/java/res/values-sw540dp/dimens.xml index b2f4ae043..801b7acb5 100644 --- a/java/res/values-sw540dp/dimens.xml +++ b/java/res/values-sw540dp/dimens.xml @@ -32,10 +32,10 @@ <fraction name="key_bottom_gap_gb">4.625%p</fraction> <fraction name="key_horizontal_gap_gb">2.113%p</fraction> - <fraction name="keyboard_top_padding_ics">2.335%p</fraction> - <fraction name="keyboard_bottom_padding_ics">4.0%p</fraction> - <fraction name="key_bottom_gap_ics">4.5%p</fraction> - <fraction name="key_horizontal_gap_ics">1.565%p</fraction> + <fraction name="keyboard_top_padding_holo">2.335%p</fraction> + <fraction name="keyboard_bottom_padding_holo">4.0%p</fraction> + <fraction name="key_bottom_gap_holo">4.5%p</fraction> + <fraction name="key_horizontal_gap_holo">1.565%p</fraction> <dimen name="more_keys_keyboard_key_horizontal_padding">6dp</dimen> <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. --> @@ -66,9 +66,9 @@ <fraction name="key_letter_ratio_5row">52%</fraction> <fraction name="key_uppercase_letter_ratio_5row">27%</fraction> - <dimen name="key_preview_offset_ics">8.0dp</dimen> + <dimen name="key_preview_offset_holo">8.0dp</dimen> <!-- popup_key_height x -0.5 --> - <dimen name="more_keys_keyboard_vertical_correction_ics">-31.5dp</dimen> + <dimen name="more_keys_keyboard_vertical_correction_holo">-31.5dp</dimen> <dimen name="suggestions_strip_height">44dp</dimen> <dimen name="more_suggestions_row_height">44dp</dimen> diff --git a/java/res/values-sw540dp/touch-position-correction.xml b/java/res/values-sw540dp/touch-position-correction.xml index df07c1295..932b8fc72 100644 --- a/java/res/values-sw540dp/touch-position-correction.xml +++ b/java/res/values-sw540dp/touch-position-correction.xml @@ -48,7 +48,7 @@ </string-array> <string-array - name="touch_position_correction_data_ics" + name="touch_position_correction_data_holo" translatable="false" > <!-- The default touch position data (See com.android.inputmethod.keyboard.ProximityInfo) diff --git a/java/res/values-sw768dp-land/dimens.xml b/java/res/values-sw768dp-land/dimens.xml index ce315b0fc..653f5e7d5 100644 --- a/java/res/values-sw768dp-land/dimens.xml +++ b/java/res/values-sw768dp-land/dimens.xml @@ -29,10 +29,10 @@ <fraction name="key_bottom_gap_gb">3.896%p</fraction> <fraction name="key_horizontal_gap_gb">1.195%p</fraction> - <fraction name="keyboard_top_padding_ics">1.896%p</fraction> - <fraction name="keyboard_bottom_padding_ics">0.0%p</fraction> - <fraction name="key_bottom_gap_ics">3.690%p</fraction> - <fraction name="key_horizontal_gap_ics">1.030%p</fraction> + <fraction name="keyboard_top_padding_holo">1.896%p</fraction> + <fraction name="keyboard_bottom_padding_holo">0.0%p</fraction> + <fraction name="key_bottom_gap_holo">3.690%p</fraction> + <fraction name="key_horizontal_gap_holo">1.030%p</fraction> <dimen name="popup_key_height">81.9dp</dimen> @@ -53,7 +53,7 @@ <fraction name="key_letter_ratio_5row">53%</fraction> <fraction name="key_uppercase_letter_ratio_5row">30%</fraction> - <dimen name="key_preview_offset_ics">8.0dp</dimen> + <dimen name="key_preview_offset_holo">8.0dp</dimen> <dimen name="suggestions_strip_padding">252.0dp</dimen> <fraction name="min_more_suggestions_width">50%</fraction> diff --git a/java/res/values-sw768dp/dimens.xml b/java/res/values-sw768dp/dimens.xml index c90da7fed..4671aa28b 100644 --- a/java/res/values-sw768dp/dimens.xml +++ b/java/res/values-sw768dp/dimens.xml @@ -30,10 +30,10 @@ <fraction name="key_bottom_gap_gb">4.687%p</fraction> <fraction name="key_horizontal_gap_gb">1.272%p</fraction> - <fraction name="keyboard_top_padding_ics">2.335%p</fraction> - <fraction name="keyboard_bottom_padding_ics">0.0%p</fraction> - <fraction name="key_bottom_gap_ics">3.312%p</fraction> - <fraction name="key_horizontal_gap_ics">1.066%p</fraction> + <fraction name="keyboard_top_padding_holo">2.335%p</fraction> + <fraction name="keyboard_bottom_padding_holo">0.0%p</fraction> + <fraction name="key_bottom_gap_holo">3.312%p</fraction> + <fraction name="key_horizontal_gap_holo">1.066%p</fraction> <dimen name="popup_key_height">63.0dp</dimen> @@ -66,9 +66,9 @@ <fraction name="key_letter_ratio_5row">51%</fraction> <fraction name="key_uppercase_letter_ratio_5row">33%</fraction> - <dimen name="key_preview_offset_ics">8.0dp</dimen> + <dimen name="key_preview_offset_holo">8.0dp</dimen> <!-- popup_key_height x -0.5 --> - <dimen name="more_keys_keyboard_vertical_correction_ics">-31.5dp</dimen> + <dimen name="more_keys_keyboard_vertical_correction_holo">-31.5dp</dimen> <dimen name="suggestions_strip_height">44dp</dimen> <dimen name="more_suggestions_row_height">44dp</dimen> diff --git a/java/res/values-th/strings-action-keys.xml b/java/res/values-th/strings-action-keys.xml new file mode 100644 index 000000000..3fd9b4d31 --- /dev/null +++ b/java/res/values-th/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"ไป"</string> + <string name="label_next_key" msgid="362972844525672568">"ถัดไป"</string> + <string name="label_previous_key" msgid="1211868118071386787">"ก่อนหน้า"</string> + <string name="label_done_key" msgid="2441578748772529288">"เสร็จสิ้น"</string> + <string name="label_send_key" msgid="2815056534433717444">"ส่ง"</string> + <string name="label_pause_key" msgid="181098308428035340">"หยุดชั่วคราว"</string> + <string name="label_wait_key" msgid="6402152600878093134">"รอ"</string> +</resources> diff --git a/java/res/values-th/strings.xml b/java/res/values-th/strings.xml index bb8b556ce..d18d5c157 100644 --- a/java/res/values-th/strings.xml +++ b/java/res/values-th/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"ดูตัวอย่างลอยแบบไดนามิก"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"ดูคำแนะนำในขณะที่ใช้ท่าทางสัมผัส"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : บันทึกแล้ว"</string> - <string name="label_go_key" msgid="1635148082137219148">"ไป"</string> - <string name="label_next_key" msgid="362972844525672568">"ถัดไป"</string> - <string name="label_previous_key" msgid="1211868118071386787">"ก่อนหน้า"</string> - <string name="label_done_key" msgid="2441578748772529288">"เสร็จสิ้น"</string> - <string name="label_send_key" msgid="2815056534433717444">"ส่ง"</string> - <string name="label_pause_key" msgid="181098308428035340">"หยุดชั่วคราว"</string> - <string name="label_wait_key" msgid="6402152600878093134">"รอ"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"เสียบชุดหูฟังเพื่อฟังเสียงเมื่อพิมพ์รหัสผ่าน"</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"ข้อความปัจจุบันคือ %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"ไม่มีข้อความ"</string> diff --git a/java/res/values-tl/strings-action-keys.xml b/java/res/values-tl/strings-action-keys.xml new file mode 100644 index 000000000..289c5e38a --- /dev/null +++ b/java/res/values-tl/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Punta"</string> + <string name="label_next_key" msgid="362972844525672568">"Susunod"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Nkrn"</string> + <string name="label_done_key" msgid="2441578748772529288">"Tapos na"</string> + <string name="label_send_key" msgid="2815056534433717444">"Ipadala"</string> + <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Intay"</string> +</resources> diff --git a/java/res/values-tl/strings.xml b/java/res/values-tl/strings.xml index 60ba0814c..e6a0aa705 100644 --- a/java/res/values-tl/strings.xml +++ b/java/res/values-tl/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dynamic na floating preview"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Tingnan ang iminungkahing salita habang gumagalaw"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Na-save"</string> - <string name="label_go_key" msgid="1635148082137219148">"Punta"</string> - <string name="label_next_key" msgid="362972844525672568">"Susunod"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Nkrn"</string> - <string name="label_done_key" msgid="2441578748772529288">"Tapos na"</string> - <string name="label_send_key" msgid="2815056534433717444">"Ipadala"</string> - <string name="label_pause_key" msgid="181098308428035340">"Pause"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Intay"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Mag-plug in ng headset upang marinig ang mga password key na binabanggit nang malakas."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Ang kasalukuyang teksto ay %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Walang tekstong inilagay"</string> diff --git a/java/res/values-tr/strings-action-keys.xml b/java/res/values-tr/strings-action-keys.xml new file mode 100644 index 000000000..b1b389aa8 --- /dev/null +++ b/java/res/values-tr/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Git"</string> + <string name="label_next_key" msgid="362972844525672568">"İleri"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Önceki"</string> + <string name="label_done_key" msgid="2441578748772529288">"Bitti"</string> + <string name="label_send_key" msgid="2815056534433717444">"Gönder"</string> + <string name="label_pause_key" msgid="181098308428035340">"Durkl"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Bekle"</string> +</resources> diff --git a/java/res/values-tr/strings.xml b/java/res/values-tr/strings.xml index 676cc3c7d..e5d999688 100644 --- a/java/res/values-tr/strings.xml +++ b/java/res/values-tr/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Dinamik kayan önizleme"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Hareket sırasında önerilen kelimeyi göster"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Kaydedildi"</string> - <string name="label_go_key" msgid="1635148082137219148">"Git"</string> - <string name="label_next_key" msgid="362972844525672568">"İleri"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Önceki"</string> - <string name="label_done_key" msgid="2441578748772529288">"Bitti"</string> - <string name="label_send_key" msgid="2815056534433717444">"Gönder"</string> - <string name="label_pause_key" msgid="181098308428035340">"Durkl"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Bekle"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Şifre tuşlarının sesli okunmasını dinlemek için mikrofonlu kulaklık takın."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Mevcut metin: %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Hiç metin girilmedi"</string> diff --git a/java/res/values-uk/strings-action-keys.xml b/java/res/values-uk/strings-action-keys.xml new file mode 100644 index 000000000..97c30389e --- /dev/null +++ b/java/res/values-uk/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"OK"</string> + <string name="label_next_key" msgid="362972844525672568">"Далі"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Назад"</string> + <string name="label_done_key" msgid="2441578748772529288">"Готово"</string> + <string name="label_send_key" msgid="2815056534433717444">"Надісл."</string> + <string name="label_pause_key" msgid="181098308428035340">"Пауза"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Чек."</string> +</resources> diff --git a/java/res/values-uk/strings.xml b/java/res/values-uk/strings.xml index 2a8b937c2..dc34ef58f 100644 --- a/java/res/values-uk/strings.xml +++ b/java/res/values-uk/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Динамічний спливаючий перегляд"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Показувати пропоноване слово під час введення тексту жестами"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : збережено"</string> - <string name="label_go_key" msgid="1635148082137219148">"OK"</string> - <string name="label_next_key" msgid="362972844525672568">"Далі"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Назад"</string> - <string name="label_done_key" msgid="2441578748772529288">"Готово"</string> - <string name="label_send_key" msgid="2815056534433717444">"Надісл."</string> - <string name="label_pause_key" msgid="181098308428035340">"Пауза"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Чек."</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Підключіть гарнітуру, щоб прослухати відтворені вголос символи пароля."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Поточний текст – %s."</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Текст не введено"</string> diff --git a/java/res/values-vi/strings-action-keys.xml b/java/res/values-vi/strings-action-keys.xml new file mode 100644 index 000000000..4cd7a9fea --- /dev/null +++ b/java/res/values-vi/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Tìm"</string> + <string name="label_next_key" msgid="362972844525672568">"Tiếp theo"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Trước"</string> + <string name="label_done_key" msgid="2441578748772529288">"Xong"</string> + <string name="label_send_key" msgid="2815056534433717444">"Gửi"</string> + <string name="label_pause_key" msgid="181098308428035340">"Tạm dừng"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Đợi"</string> +</resources> diff --git a/java/res/values-vi/strings.xml b/java/res/values-vi/strings.xml index 74ef95a83..5520a2e64 100644 --- a/java/res/values-vi/strings.xml +++ b/java/res/values-vi/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Xem trước nổi động"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Xem từ được đề xuất trong khi dùng cử chỉ"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Đã lưu"</string> - <string name="label_go_key" msgid="1635148082137219148">"Tìm"</string> - <string name="label_next_key" msgid="362972844525672568">"Tiếp theo"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Trước"</string> - <string name="label_done_key" msgid="2441578748772529288">"Xong"</string> - <string name="label_send_key" msgid="2815056534433717444">"Gửi"</string> - <string name="label_pause_key" msgid="181098308428035340">"Tạm dừng"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Đợi"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Cắm tai nghe để nghe mật khẩu."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Ký tự hiện tại là %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Không có ký tự nào được nhập"</string> diff --git a/java/res/values-zh-rCN/strings-action-keys.xml b/java/res/values-zh-rCN/strings-action-keys.xml new file mode 100644 index 000000000..af0472ee9 --- /dev/null +++ b/java/res/values-zh-rCN/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"开始"</string> + <string name="label_next_key" msgid="362972844525672568">"下个"</string> + <string name="label_previous_key" msgid="1211868118071386787">"后退"</string> + <string name="label_done_key" msgid="2441578748772529288">"完成"</string> + <string name="label_send_key" msgid="2815056534433717444">"发送"</string> + <string name="label_pause_key" msgid="181098308428035340">"暂停"</string> + <string name="label_wait_key" msgid="6402152600878093134">"等待"</string> +</resources> diff --git a/java/res/values-zh-rCN/strings.xml b/java/res/values-zh-rCN/strings.xml index c55269329..a5a326c29 100644 --- a/java/res/values-zh-rCN/strings.xml +++ b/java/res/values-zh-rCN/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"动态漂浮预览"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"在滑行输入过程中显示建议字词"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>:已保存"</string> - <string name="label_go_key" msgid="1635148082137219148">"开始"</string> - <string name="label_next_key" msgid="362972844525672568">"下个"</string> - <string name="label_previous_key" msgid="1211868118071386787">"后退"</string> - <string name="label_done_key" msgid="2441578748772529288">"完成"</string> - <string name="label_send_key" msgid="2815056534433717444">"发送"</string> - <string name="label_pause_key" msgid="181098308428035340">"暂停"</string> - <string name="label_wait_key" msgid="6402152600878093134">"等待"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"需要插入耳机才能听到密码的按键声。"</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"当前文本为%s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"未输入文字"</string> diff --git a/java/res/values-zh-rHK/strings-action-keys.xml b/java/res/values-zh-rHK/strings-action-keys.xml new file mode 100644 index 000000000..332519f0a --- /dev/null +++ b/java/res/values-zh-rHK/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"開始"</string> + <string name="label_next_key" msgid="362972844525672568">"下一步"</string> + <string name="label_previous_key" msgid="1211868118071386787">"上一步"</string> + <string name="label_done_key" msgid="2441578748772529288">"完成"</string> + <string name="label_send_key" msgid="2815056534433717444">"發送"</string> + <string name="label_pause_key" msgid="181098308428035340">"暫停"</string> + <string name="label_wait_key" msgid="6402152600878093134">"等候"</string> +</resources> diff --git a/java/res/values-zh-rHK/strings.xml b/java/res/values-zh-rHK/strings.xml index 1d4f36a62..ee833ce79 100644 --- a/java/res/values-zh-rHK/strings.xml +++ b/java/res/values-zh-rHK/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"動態浮動預覽"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"在啟用手勢輸入時顯示建議的字詞"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>:已儲存"</string> - <string name="label_go_key" msgid="1635148082137219148">"開始"</string> - <string name="label_next_key" msgid="362972844525672568">"下一步"</string> - <string name="label_previous_key" msgid="1211868118071386787">"上一步"</string> - <string name="label_done_key" msgid="2441578748772529288">"完成"</string> - <string name="label_send_key" msgid="2815056534433717444">"發送"</string> - <string name="label_pause_key" msgid="181098308428035340">"暫停"</string> - <string name="label_wait_key" msgid="6402152600878093134">"等候"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"插上耳機即可聽到系統朗讀密碼鍵。"</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"目前文字為 %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"未輸入文字"</string> diff --git a/java/res/values-zh-rTW/strings-action-keys.xml b/java/res/values-zh-rTW/strings-action-keys.xml new file mode 100644 index 000000000..80045b08d --- /dev/null +++ b/java/res/values-zh-rTW/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"前往"</string> + <string name="label_next_key" msgid="362972844525672568">"下一頁"</string> + <string name="label_previous_key" msgid="1211868118071386787">"上一頁"</string> + <string name="label_done_key" msgid="2441578748772529288">"完成"</string> + <string name="label_send_key" msgid="2815056534433717444">"傳送"</string> + <string name="label_pause_key" msgid="181098308428035340">"暫停"</string> + <string name="label_wait_key" msgid="6402152600878093134">"等待"</string> +</resources> diff --git a/java/res/values-zh-rTW/strings.xml b/java/res/values-zh-rTW/strings.xml index 4d39050f7..21b2bec7e 100644 --- a/java/res/values-zh-rTW/strings.xml +++ b/java/res/values-zh-rTW/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"動態浮動預覽"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"使用滑行輸入時顯示建議字詞"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>:已儲存"</string> - <string name="label_go_key" msgid="1635148082137219148">"前往"</string> - <string name="label_next_key" msgid="362972844525672568">"下一頁"</string> - <string name="label_previous_key" msgid="1211868118071386787">"上一頁"</string> - <string name="label_done_key" msgid="2441578748772529288">"完成"</string> - <string name="label_send_key" msgid="2815056534433717444">"傳送"</string> - <string name="label_pause_key" msgid="181098308428035340">"暫停"</string> - <string name="label_wait_key" msgid="6402152600878093134">"等待"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"連接耳機即可聽取系統朗讀密碼按鍵。"</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"目前文字為 %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"未輸入文字"</string> diff --git a/java/res/values-zu/strings-action-keys.xml b/java/res/values-zu/strings-action-keys.xml new file mode 100644 index 000000000..054b4946c --- /dev/null +++ b/java/res/values-zu/strings-action-keys.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="label_go_key" msgid="1635148082137219148">"Iya"</string> + <string name="label_next_key" msgid="362972844525672568">"Okulandelayo"</string> + <string name="label_previous_key" msgid="1211868118071386787">"Eledlule"</string> + <string name="label_done_key" msgid="2441578748772529288">"Kwenziwe"</string> + <string name="label_send_key" msgid="2815056534433717444">"Thumela"</string> + <string name="label_pause_key" msgid="181098308428035340">"Misa okwesikhashana"</string> + <string name="label_wait_key" msgid="6402152600878093134">"Linda"</string> +</resources> diff --git a/java/res/values-zu/strings.xml b/java/res/values-zu/strings.xml index d245c32d4..b8b753cde 100644 --- a/java/res/values-zu/strings.xml +++ b/java/res/values-zu/strings.xml @@ -74,13 +74,6 @@ <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Ukuhlola kuqala okuntantayo okunamandla"</string> <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Bona igama eliphakanyisiwe ngenkathi uthinta"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Kulondoloziwe"</string> - <string name="label_go_key" msgid="1635148082137219148">"Iya"</string> - <string name="label_next_key" msgid="362972844525672568">"Okulandelayo"</string> - <string name="label_previous_key" msgid="1211868118071386787">"Eledlule"</string> - <string name="label_done_key" msgid="2441578748772529288">"Kwenziwe"</string> - <string name="label_send_key" msgid="2815056534433717444">"Thumela"</string> - <string name="label_pause_key" msgid="181098308428035340">"Misa okwesikhashana"</string> - <string name="label_wait_key" msgid="6402152600878093134">"Linda"</string> <string name="spoken_use_headphones" msgid="896961781287283493">"Plaka ku-headset ukuze uzwe okhiye bephasiwedi ezindlebeni zakho bezwakala kakhulu."</string> <string name="spoken_current_text_is" msgid="2485723011272583845">"Umbhalo wamanje ngu %s"</string> <string name="spoken_no_text_entered" msgid="7479685225597344496">"Awukho umbhalo ofakiwe"</string> diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 31945d020..a7425f1e7 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -276,6 +276,8 @@ <attr name="keyLabel" format="string" /> <!-- The hint label to display on the key in conjunction with the label. --> <attr name="keyHintLabel" format="string" /> + <!-- The vertical adjustment of key hint label in proportion to its height. --> + <attr name="keyHintLabelVerticalAdjustment" format="fraction" /> <!-- The key label flags. --> <attr name="keyLabelFlags" format="integer"> <!-- This should be aligned with Key.LABEL_FLAGS__* --> @@ -295,14 +297,16 @@ <flag name="withIconLeft" value="0x1000" /> <flag name="withIconRight" value="0x2000" /> <flag name="autoXScale" value="0x4000" /> + <!-- The autoScale value implies autoXScale bit on to optimize scaling code path. --> + <flag name="autoScale" value="0xc000" /> <!-- If true, character case of code, altCode, moreKeys, keyOutputText, keyLabel, or keyHintLabel will never be subject to change. --> - <flag name="preserveCase" value="0x8000" /> + <flag name="preserveCase" value="0x10000" /> <!-- If true, use keyShiftedLetterHintActivatedColor for the shifted letter hint and keyTextInactivatedColor for the primary key top label. --> - <flag name="shiftedLetterActivated" value="0x10000" /> + <flag name="shiftedLetterActivated" value="0x20000" /> <!-- If true, use EditorInfo.actionLabel for the key label. --> - <flag name="fromCustomActionLabel" value="0x20000" /> + <flag name="fromCustomActionLabel" value="0x40000" /> <!-- If true, disable keyHintLabel. --> <flag name="disableKeyHintLabel" value="0x40000000" /> <!-- If true, disable additionalMoreKeys. --> diff --git a/java/res/values/colors.xml b/java/res/values/colors.xml index 94fadb964..93f25a7f6 100644 --- a/java/res/values/colors.xml +++ b/java/res/values/colors.xml @@ -39,20 +39,20 @@ <color name="typed_word_color_ics">#D833B5E5</color> <color name="suggested_word_color_ics">#B233B5E5</color> <color name="highlight_translucent_color_ics">#9933B5E5</color> - <color name="key_text_shadow_color_ics">@android:color/transparent</color> - <color name="key_text_inactivated_color_ics">#66E0E4E5</color> - <color name="key_hint_letter_color_ics">#80000000</color> - <color name="key_hint_label_color_ics">#A0FFFFFF</color> - <color name="key_shifted_letter_hint_inactivated_color_ics">#66E0E4E5</color> - <color name="key_shifted_letter_hint_activated_color_ics">@android:color/white</color> - <color name="spacebar_text_color_ics">#FFC0C0C0</color> - <color name="spacebar_text_shadow_color_ics">#80000000</color> - <color name="gesture_floating_preview_color_ics">#C0000000</color> + <color name="key_text_shadow_color_holo">@android:color/transparent</color> + <color name="key_text_inactivated_color_holo">#66E0E4E5</color> + <color name="key_hint_letter_color_holo">#80000000</color> + <color name="key_hint_label_color_holo">#A0FFFFFF</color> + <color name="key_shifted_letter_hint_inactivated_color_holo">#66E0E4E5</color> + <color name="key_shifted_letter_hint_activated_color_holo">@android:color/white</color> + <color name="spacebar_text_color_holo">#FFC0C0C0</color> + <color name="spacebar_text_shadow_color_holo">#80000000</color> + <color name="gesture_floating_preview_color_holo">#C0000000</color> <!-- Color resources for KLP theme. Base color = F0F0F0 --> - <color name="highlight_color_holo">#FFF0F0F0</color> - <color name="typed_word_color_holo">#D8F0F0F0</color> - <color name="suggested_word_color_holo">#B2F0F0F0</color> - <color name="highlight_translucent_color_holo">#99E0E0E0</color> + <color name="highlight_color_klp">#FFF0F0F0</color> + <color name="typed_word_color_klp">#D8F0F0F0</color> + <color name="suggested_word_color_klp">#B2F0F0F0</color> + <color name="highlight_translucent_color_klp">#99E0E0E0</color> <!-- Color resources for setup wizard and tutorial --> <color name="setup_background">#FFEBEBEB</color> <color name="setup_text_dark">#FF707070</color> @@ -66,6 +66,6 @@ <color name="emoji_key_background_color">#00000000</color> <color name="emoji_key_pressed_background_color">#30FFFFFF</color> - <color name="key_text_color_normal_ics">@android:color/white</color> - <color name="key_text_color_functional_ics">@android:color/white</color> + <color name="key_text_color_normal_holo">@android:color/white</color> + <color name="key_text_color_functional_holo">@android:color/white</color> </resources> diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 66b9b7082..61779d4b5 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -41,8 +41,8 @@ <integer name="config_keyboard_grid_width">32</integer> <integer name="config_keyboard_grid_height">16</integer> <integer name="config_double_space_period_timeout">1100</integer> - <!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. --> - <string name="config_default_keyboard_theme_index" translatable="false">0</string> + <!-- This configuration is an index of {@link KeyboardSwitcher#KEYBOARD_THEMES[]}. --> + <string name="config_default_keyboard_theme_index" translatable="false">2</string> <integer name="config_max_more_keys_column">5</integer> <!-- diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 18cb262e2..4588b10eb 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -37,10 +37,10 @@ <fraction name="key_bottom_gap_gb">6.495%p</fraction> <fraction name="key_horizontal_gap_gb">1.971%p</fraction> - <fraction name="keyboard_top_padding_ics">2.335%p</fraction> - <fraction name="keyboard_bottom_padding_ics">4.669%p</fraction> - <fraction name="key_bottom_gap_ics">6.127%p</fraction> - <fraction name="key_horizontal_gap_ics">1.739%p</fraction> + <fraction name="keyboard_top_padding_holo">2.335%p</fraction> + <fraction name="keyboard_bottom_padding_holo">4.669%p</fraction> + <fraction name="key_bottom_gap_holo">6.127%p</fraction> + <fraction name="key_horizontal_gap_holo">1.739%p</fraction> <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. --> <!-- popup_key_height x 1.2 --> @@ -71,9 +71,9 @@ <fraction name="key_letter_ratio_5row">64%</fraction> <fraction name="key_uppercase_letter_ratio_5row">41%</fraction> - <dimen name="key_preview_offset_ics">8.0dp</dimen> + <dimen name="key_preview_offset_holo">8.0dp</dimen> <!-- popup_key_height x -0.5 --> - <dimen name="more_keys_keyboard_vertical_correction_ics">-26.4dp</dimen> + <dimen name="more_keys_keyboard_vertical_correction_holo">-26.4dp</dimen> <dimen name="suggestions_strip_height">40dp</dimen> <dimen name="more_suggestions_key_horizontal_padding">12dp</dimen> diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index 4733aa257..af5ec061b 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -103,15 +103,30 @@ <!-- Keyboard theme names --> <string name="layout_gingerbread">Gingerbread</string> <string name="layout_ics">IceCreamSandwich</string> + <string name="layout_klp">KeyLimePie</string> <!-- For keyboard theme switcher dialog --> <string-array name="keyboard_layout_modes"> <item>@string/layout_ics</item> <item>@string/layout_gingerbread</item> + <item>@string/layout_klp</item> </string-array> + <!-- An element must be an index of {@link KeyboardSwitcher#KEYBOARD_THEMES[]}. --> <string-array name="keyboard_layout_modes_values"> <item>0</item> <item>1</item> + <item>2</item> + </string-array> + + <!-- For keyboard color scheme option dialog. --> + <string-array name="keyboard_color_schemes"> + <item>@string/keyboard_color_scheme_white</item> + <item>@string/keyboard_color_scheme_blue</item> + </string-array> + <!-- An element must be an index of {@link KeyboardSwitcher#KEYBOARD_THEMES[]}. --> + <string-array name="keyboard_color_schemes_values"> + <item>2</item> + <item>0</item> </string-array> <!-- Subtype locale display name exceptions. diff --git a/java/res/values/keyboard-icons-holo.xml b/java/res/values/keyboard-icons-holo.xml new file mode 100644 index 000000000..b49e1d10b --- /dev/null +++ b/java/res/values/keyboard-icons-holo.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:android="http://schemas.android.com/apk/res/android"> + <style name="KeyboardIcons.Holo"> + <!-- Keyboard icons --> + <!-- TODO: The following holo icon for phone (drawable-hdpi and drawable-xhdpi) are missing. + sym_keyboard_123_mic_holo + --> + <item name="iconShiftKey">@drawable/sym_keyboard_shift_holo_dark</item> + <item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo_dark</item> + <item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo_dark</item> + <item name="iconSpaceKey">@null</item> + <item name="iconEnterKey">@drawable/sym_keyboard_return_holo_dark</item> + <item name="iconSearchKey">@drawable/sym_keyboard_search_holo_dark</item> + <item name="iconTabKey">@drawable/sym_keyboard_tab_holo_dark</item> + <item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo_dark</item> + <item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic_holo_dark</item> + <item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space_holo_dark</item> + <item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_locked_holo_dark</item> + <item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo_dark</item> + <item name="iconTabKeyPreview">@drawable/sym_keyboard_feedback_tab</item> + <item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch_dark</item> + <item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_holo_dark</item> + <item name="iconZwjKey">@drawable/sym_keyboard_zwj_holo_dark</item> + <item name="iconEmojiKey">@drawable/sym_keyboard_smiley_holo_dark</item> + </style> +</resources> diff --git a/java/res/values/keypress-vibration-durations.xml b/java/res/values/keypress-vibration-durations.xml index ee0ac003c..cde4e4447 100644 --- a/java/res/values/keypress-vibration-durations.xml +++ b/java/res/values/keypress-vibration-durations.xml @@ -55,6 +55,8 @@ <item>MODEL=HTL22:MANUFACTURER=HTC,15</item> <!-- Motorola Razor M --> <item>MODEL=XT907:MANUFACTURER=motorola,30</item> + <!-- Motorola DVX --> + <item>MODEL=XT1035:MANUFACTURER=motorola,18</item> <!-- Sony Xperia Z, Z Ultra --> <item>MODEL=C6603|C6806:MANUFACTURER=Sony,35</item> <!-- Default value for unknown device. The negative value means system default. --> diff --git a/java/res/values/strings-action-keys.xml b/java/res/values/strings-action-keys.xml new file mode 100644 index 000000000..7003784c6 --- /dev/null +++ b/java/res/values/strings-action-keys.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Label for soft enter key when it performs GO action. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7] --> + <string name="label_go_key">Go</string> + <!-- Label for soft enter key when it performs NEXT action. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7] --> + <string name="label_next_key">Next</string> + <!-- Label for soft enter key when it performs PREVIOUS action. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7] --> + <string name="label_previous_key">Prev</string> + <!-- Label for soft enter key when it performs DONE action. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7] --> + <string name="label_done_key">Done</string> + <!-- Label for soft enter key when it performs SEND action. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7] --> + <string name="label_send_key">Send</string> + <!-- Label for "Pause" key of phone number keyboard. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7] --> + <string name="label_pause_key">Pause</string> + <!-- Label for "Wait" key of phone number keyboard. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7]--> + <string name="label_wait_key">Wait</string> +</resources> diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index a779c6efa..11b3ea3af 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -151,21 +151,6 @@ <!-- Indicates that a word has been added to the dictionary --> <string name="added_word"><xliff:g id="word">%s</xliff:g> : Saved</string> - <!-- Label for soft enter key when it performs GO action. Must be short to fit on key! [CHAR LIMIT=5] --> - <string name="label_go_key">Go</string> - <!-- Label for soft enter key when it performs NEXT action. Must be short to fit on key! [CHAR LIMIT=5] --> - <string name="label_next_key">Next</string> - <!-- Label for soft enter key when it performs PREVIOUS action. Must be short to fit on key! [CHAR LIMIT=5] --> - <string name="label_previous_key">Prev</string> - <!-- Label for soft enter key when it performs DONE action. Must be short to fit on key! [CHAR LIMIT=5] --> - <string name="label_done_key">Done</string> - <!-- Label for soft enter key when it performs SEND action. Must be short to fit on key! [CHAR LIMIT=5] --> - <string name="label_send_key">Send</string> - <!-- Label for "Pause" key of phone number keyboard. Must be short to fit on key! [CHAR LIMIT=5] --> - <string name="label_pause_key">Pause</string> - <!-- Label for "Wait" key of phone number keyboard. Must be short to fit on key! [CHAR LIMIT=5]--> - <string name="label_wait_key">Wait</string> - <!-- Spoken description to let the user know that when typing in a password, they can plug in a headset in to hear spoken descriptions of the keys they type. [CHAR LIMIT=NONE] --> <string name="spoken_use_headphones">Plug in a headset to hear password keys spoken aloud.</string> @@ -467,6 +452,13 @@ mobile devices. [CHAR LIMIT=25] --> <!-- Description for Emoji keyboard subtype [CHAR LIMIT=25] --> <string name="subtype_emoji">Emoji</string> + <!-- Title of the preference settings for switching keyboard color scheme [CHAR LIMIT=35] --> + <string name="keyboard_color_scheme">Color scheme</string> + <!-- The keyboard color scheme name, White [CHAR LIMIT=16] --> + <string name="keyboard_color_scheme_white">White</string> + <!-- The keyboard color scheme name, Blue [CHAR LIMIT=16] --> + <string name="keyboard_color_scheme_blue">Blue</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> <!-- Title of the option menu to add a new style entry in the preference settings [CHAR LIMIT=16] --> diff --git a/java/res/values/themes-common.xml b/java/res/values/themes-common.xml index 37607711d..298936d9c 100644 --- a/java/res/values/themes-common.xml +++ b/java/res/values/themes-common.xml @@ -30,7 +30,7 @@ <item name="maxMoreKeysColumn">@integer/config_max_more_keys_column</item> </style> <style name="KeyboardView"> - <item name="keyBackground">@drawable/btn_keyboard_key_ics</item> + <item name="keyBackground">@drawable/btn_keyboard_key_klp</item> <item name="keyLetterSize">@fraction/key_letter_ratio</item> <item name="keyLargeLetterRatio">@fraction/key_large_letter_ratio</item> <item name="keyLabelSize">@fraction/key_label_ratio</item> @@ -110,7 +110,7 @@ name="EmojiPalettesView" parent="KeyboardView" > - <item name="emojiTabLabelColor">@color/emoji_tab_label_color_ics</item> + <item name="emojiTabLabelColor">@color/emoji_tab_label_color_holo</item> </style> <style name="MoreKeysKeyboard" /> <style diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index a77e685c2..432ad5122 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -2,7 +2,7 @@ <!-- /* ** -** Copyright 2011, The Android Open Source Project +** Copyright 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. @@ -19,7 +19,7 @@ --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="KeyboardTheme.ICS" parent="KeyboardIcons.ICS"> + <style name="KeyboardTheme.ICS" parent="KeyboardIcons.Holo"> <item name="keyboardStyle">@style/Keyboard.ICS</item> <item name="keyboardViewStyle">@style/KeyboardView.ICS</item> <item name="mainKeyboardViewStyle">@style/MainKeyboardView.ICS</item> @@ -30,40 +30,17 @@ <item name="suggestionStripViewStyle">@style/SuggestionStripView.ICS</item> <item name="suggestionWordStyle">@style/SuggestionWord.ICS</item> </style> - <style name="KeyboardIcons.ICS"> - <!-- Keyboard icons --> - <!-- TODO: The following holo icon for phone (drawable-hdpi and drawable-xhdpi) are missing. - sym_keyboard_123_mic_holo - --> - <item name="iconShiftKey">@drawable/sym_keyboard_shift_holo_dark</item> - <item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo_dark</item> - <item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo_dark</item> - <item name="iconSpaceKey">@null</item> - <item name="iconEnterKey">@drawable/sym_keyboard_return_holo_dark</item> - <item name="iconSearchKey">@drawable/sym_keyboard_search_holo_dark</item> - <item name="iconTabKey">@drawable/sym_keyboard_tab_holo_dark</item> - <item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo_dark</item> - <item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic_holo_dark</item> - <item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space_holo_dark</item> - <item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_locked_holo_dark</item> - <item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo_dark</item> - <item name="iconTabKeyPreview">@drawable/sym_keyboard_feedback_tab</item> - <item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch_dark</item> - <item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_holo_dark</item> - <item name="iconZwjKey">@drawable/sym_keyboard_zwj_holo_dark</item> - <item name="iconEmojiKey">@drawable/sym_keyboard_smiley_holo_dark</item> - </style> <style name="Keyboard.ICS" parent="Keyboard" > <!-- This should be aligned with KeyboardSwitcher.KEYBOARD_THEMES[] --> - <item name="themeId">0</item> - <item name="keyboardTopPadding">@fraction/keyboard_top_padding_ics</item> - <item name="keyboardBottomPadding">@fraction/keyboard_bottom_padding_ics</item> - <item name="horizontalGap">@fraction/key_horizontal_gap_ics</item> - <item name="verticalGap">@fraction/key_bottom_gap_ics</item> - <item name="touchPositionCorrectionData">@array/touch_position_correction_data_ics</item> + <item name="themeId">2</item> + <item name="keyboardTopPadding">@fraction/keyboard_top_padding_holo</item> + <item name="keyboardBottomPadding">@fraction/keyboard_bottom_padding_holo</item> + <item name="horizontalGap">@fraction/key_horizontal_gap_holo</item> + <item name="verticalGap">@fraction/key_bottom_gap_holo</item> + <item name="touchPositionCorrectionData">@array/touch_position_correction_data_holo</item> </style> <style name="KeyboardView.ICS" @@ -72,14 +49,14 @@ <item name="android:background">@drawable/keyboard_background_holo</item> <item name="keyBackground">@drawable/btn_keyboard_key_ics</item> <item name="keyTypeface">bold</item> - <item name="keyTextColor">@color/key_text_color_ics</item> - <item name="keyTextInactivatedColor">@color/key_text_inactivated_color_ics</item> - <item name="keyHintLetterColor">@color/key_hint_letter_color_ics</item> - <item name="keyHintLabelColor">@color/key_hint_label_color_ics</item> - <item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_ics</item> - <item name="keyShiftedLetterHintActivatedColor">@color/key_shifted_letter_hint_activated_color_ics</item> - <item name="keyPreviewTextColor">@color/key_text_color_ics</item> - <item name="keyTextShadowColor">@color/key_text_shadow_color_ics</item> + <item name="keyTextColor">@color/key_text_color_holo</item> + <item name="keyTextInactivatedColor">@color/key_text_inactivated_color_holo</item> + <item name="keyHintLetterColor">@color/key_hint_letter_color_holo</item> + <item name="keyHintLabelColor">@color/key_hint_label_color_holo</item> + <item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_holo</item> + <item name="keyShiftedLetterHintActivatedColor">@color/key_shifted_letter_hint_activated_color_holo</item> + <item name="keyPreviewTextColor">@color/key_text_color_holo</item> + <item name="keyTextShadowColor">@color/key_text_shadow_color_holo</item> <item name="keyTextShadowRadius">0.0</item> </style> <style @@ -87,15 +64,15 @@ parent="KeyboardView.ICS" > <item name="keyPreviewLayout">@layout/key_preview_ics</item> - <item name="keyPreviewOffset">@dimen/key_preview_offset_ics</item> - <item name="gestureFloatingPreviewTextColor">@color/highlight_color_holo</item> - <item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_ics</item> - <item name="gestureTrailColor">@color/highlight_color_holo</item> - <item name="slidingKeyInputPreviewColor">@color/highlight_translucent_color_holo</item> + <item name="keyPreviewOffset">@dimen/key_preview_offset_holo</item> + <item name="gestureFloatingPreviewTextColor">@color/highlight_color_ics</item> + <item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_holo</item> + <item name="gestureTrailColor">@color/highlight_color_ics</item> + <item name="slidingKeyInputPreviewColor">@color/highlight_translucent_color_ics</item> <item name="autoCorrectionSpacebarLedEnabled">false</item> <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item> - <item name="spacebarTextColor">@color/spacebar_text_color_ics</item> - <item name="spacebarTextShadowColor">@color/spacebar_text_shadow_color_ics</item> + <item name="spacebarTextColor">@color/spacebar_text_color_holo</item> + <item name="spacebarTextShadowColor">@color/spacebar_text_shadow_color_holo</item> </style> <!-- Though {@link EmojiPalettesView} doesn't extend {@link KeyboardView}, some views inside it, for instance delete button, need themed {@link KeyboardView} attributes. --> @@ -104,7 +81,7 @@ parent="KeyboardView.ICS" > <item name="keyBackgroundEmojiFunctional">@drawable/btn_keyboard_key_functional_ics</item> - <item name="emojiTabLabelColor">@color/emoji_tab_label_color_ics</item> + <item name="emojiTabLabelColor">@color/emoji_tab_label_color_holo</item> </style> <style name="MoreKeysKeyboard.ICS" @@ -122,12 +99,12 @@ <item name="android:background">@null</item> <item name="keyBackground">@drawable/btn_keyboard_key_popup_ics</item> <item name="keyTypeface">normal</item> - <item name="verticalCorrection">@dimen/more_keys_keyboard_vertical_correction_ics</item> + <item name="verticalCorrection">@dimen/more_keys_keyboard_vertical_correction_holo</item> </style> <style name="MoreKeysKeyboardContainer.ICS" > - <item name="android:background">@drawable/keyboard_popup_panel_background_holo</item> + <item name="android:background">@drawable/keyboard_popup_panel_background_ics</item> </style> <style name="SuggestionStripView.ICS" @@ -135,10 +112,10 @@ > <item name="android:background">@drawable/keyboard_suggest_strip_holo</item> <item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item> - <item name="colorValidTypedWord">@color/typed_word_color_holo</item> - <item name="colorTypedWord">@color/typed_word_color_holo</item> - <item name="colorAutoCorrect">@color/highlight_color_holo</item> - <item name="colorSuggested">@color/suggested_word_color_holo</item> + <item name="colorValidTypedWord">@color/typed_word_color_ics</item> + <item name="colorTypedWord">@color/typed_word_color_ics</item> + <item name="colorAutoCorrect">@color/highlight_color_ics</item> + <item name="colorSuggested">@color/suggested_word_color_ics</item> <item name="alphaObsoleted">70%</item> </style> <style name="SuggestionWord.ICS"> diff --git a/java/res/values/themes-klp.xml b/java/res/values/themes-klp.xml new file mode 100644 index 000000000..a3730019d --- /dev/null +++ b/java/res/values/themes-klp.xml @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> + +<resources xmlns:android="http://schemas.android.com/apk/res/android"> + <style name="KeyboardTheme.KLP" parent="KeyboardIcons.Holo"> + <item name="keyboardStyle">@style/Keyboard.KLP</item> + <item name="keyboardViewStyle">@style/KeyboardView.KLP</item> + <item name="mainKeyboardViewStyle">@style/MainKeyboardView.KLP</item> + <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.KLP</item> + <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.KLP</item> + <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.KLP</item> + <item name="moreKeysKeyboardContainerStyle">@style/MoreKeysKeyboardContainer.KLP</item> + <item name="suggestionStripViewStyle">@style/SuggestionStripView.KLP</item> + <item name="suggestionWordStyle">@style/SuggestionWord.KLP</item> + </style> + <style + name="Keyboard.KLP" + parent="Keyboard" + > + <!-- This should be aligned with KeyboardSwitcher.KEYBOARD_THEMES[] --> + <item name="themeId">0</item> + <item name="keyboardTopPadding">@fraction/keyboard_top_padding_holo</item> + <item name="keyboardBottomPadding">@fraction/keyboard_bottom_padding_holo</item> + <item name="horizontalGap">@fraction/key_horizontal_gap_holo</item> + <item name="verticalGap">@fraction/key_bottom_gap_holo</item> + <item name="touchPositionCorrectionData">@array/touch_position_correction_data_holo</item> + </style> + <style + name="KeyboardView.KLP" + parent="KeyboardView" + > + <item name="android:background">@drawable/keyboard_background_holo</item> + <item name="keyBackground">@drawable/btn_keyboard_key_klp</item> + <item name="keyTypeface">bold</item> + <item name="keyTextColor">@color/key_text_color_holo</item> + <item name="keyTextInactivatedColor">@color/key_text_inactivated_color_holo</item> + <item name="keyHintLetterColor">@color/key_hint_letter_color_holo</item> + <item name="keyHintLabelColor">@color/key_hint_label_color_holo</item> + <item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_holo</item> + <item name="keyShiftedLetterHintActivatedColor">@color/key_shifted_letter_hint_activated_color_holo</item> + <item name="keyPreviewTextColor">@color/key_text_color_holo</item> + <item name="keyTextShadowColor">@color/key_text_shadow_color_holo</item> + <item name="keyTextShadowRadius">0.0</item> + </style> + <style + name="MainKeyboardView.KLP" + parent="KeyboardView.KLP" + > + <item name="keyPreviewLayout">@layout/key_preview_klp</item> + <item name="keyPreviewOffset">@dimen/key_preview_offset_holo</item> + <item name="gestureFloatingPreviewTextColor">@color/highlight_color_klp</item> + <item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_holo</item> + <item name="gestureTrailColor">@color/highlight_color_klp</item> + <item name="slidingKeyInputPreviewColor">@color/highlight_translucent_color_klp</item> + <item name="autoCorrectionSpacebarLedEnabled">false</item> + <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item> + <item name="spacebarTextColor">@color/spacebar_text_color_holo</item> + <item name="spacebarTextShadowColor">@color/spacebar_text_shadow_color_holo</item> + </style> + <!-- Though {@link EmojiPalettesView} doesn't extend {@link KeyboardView}, some views inside it, + for instance delete button, need themed {@link KeyboardView} attributes. --> + <style + name="EmojiPalettesView.KLP" + parent="KeyboardView.KLP" + > + <item name="keyBackgroundEmojiFunctional">@drawable/btn_keyboard_key_functional_klp</item> + <item name="emojiTabLabelColor">@color/emoji_tab_label_color_holo</item> + </style> + <style + name="MoreKeysKeyboard.KLP" + parent="Keyboard.KLP" + > + <item name="keyboardTopPadding">0%p</item> + <item name="keyboardBottomPadding">0%p</item> + <item name="horizontalGap">0%p</item> + <item name="touchPositionCorrectionData">@null</item> + </style> + <style + name="MoreKeysKeyboardView.KLP" + parent="KeyboardView.KLP" + > + <item name="android:background">@null</item> + <item name="keyBackground">@drawable/btn_keyboard_key_popup_klp</item> + <item name="keyTypeface">normal</item> + <item name="verticalCorrection">@dimen/more_keys_keyboard_vertical_correction_holo</item> + </style> + <style + name="MoreKeysKeyboardContainer.KLP" + > + <item name="android:background">@drawable/keyboard_popup_panel_background_klp</item> + </style> + <style + name="SuggestionStripView.KLP" + parent="SuggestionStripView" + > + <item name="android:background">@drawable/keyboard_suggest_strip_holo</item> + <item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item> + <item name="colorValidTypedWord">@color/typed_word_color_klp</item> + <item name="colorTypedWord">@color/typed_word_color_klp</item> + <item name="colorAutoCorrect">@color/highlight_color_klp</item> + <item name="colorSuggested">@color/suggested_word_color_klp</item> + <item name="alphaObsoleted">70%</item> + </style> + <style name="SuggestionWord.KLP"> + <item name="android:background">@drawable/btn_suggestion_klp</item> + </style> +</resources> diff --git a/java/res/values/touch-position-correction.xml b/java/res/values/touch-position-correction.xml index 9df517b32..becec0e0a 100644 --- a/java/res/values/touch-position-correction.xml +++ b/java/res/values/touch-position-correction.xml @@ -57,7 +57,7 @@ </string-array> <string-array - name="touch_position_correction_data_ics" + name="touch_position_correction_data_holo" translatable="false" > <!-- First row --> diff --git a/java/res/xml/key_f1.xml b/java/res/xml/key_f1.xml index 455f9ef59..72e38cb1a 100644 --- a/java/res/xml/key_f1.xml +++ b/java/res/xml/key_f1.xml @@ -47,7 +47,7 @@ <Key latin:keyLabel="!text/keylabel_for_comma" latin:keyLabelFlags="hasPopupHint" - latin:additionalMoreKeys="!text/more_keys_for_comma" + latin:additionalMoreKeys="!text/more_keys_for_comma,!text/shortcut_as_more_key" latin:keyStyle="f1MoreKeysStyle" /> </default> </switch> diff --git a/java/res/xml/key_nepali_traditional_period.xml b/java/res/xml/key_nepali_traditional_period.xml index 0f575c50b..1c389b009 100644 --- a/java/res/xml/key_nepali_traditional_period.xml +++ b/java/res/xml/key_nepali_traditional_period.xml @@ -39,10 +39,11 @@ set of Key definitions are needed based on the API version. --> <include latin:keyboardLayout="@xml/keystyle_devanagari_sign_virama" /> + <!-- U+002E: "." FULL STOP --> <Key latin:keyStyle="baseKeyDevanagariSignVirama" latin:keyLabelFlags="hasPopupHint" - latin:moreKeys="!fixedColumnOrder!4,.,!text/more_keys_for_punctuation" + latin:moreKeys="!fixedColumnOrder!9,.,!text/more_keys_for_punctuation" latin:backgroundType="functional" /> </default> </switch> diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 6c36b0e89..d2b447545 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -158,6 +158,14 @@ android:summary="@string/sliding_key_input_preview_summary" android:persistent="true" android:defaultValue="true" /> + <ListPreference + android:key="pref_keyboard_layout_20110916" + android:title="@string/keyboard_color_scheme" + android:summary="%s" + android:persistent="true" + android:entryValues="@array/keyboard_color_schemes_values" + android:entries="@array/keyboard_color_schemes" + android:defaultValue="@string/config_default_keyboard_theme_index" /> <PreferenceScreen android:fragment="com.android.inputmethod.latin.settings.AdditionalSubtypeSettings" android:key="custom_input_styles" diff --git a/java/res/xml/prefs_for_debug.xml b/java/res/xml/prefs_for_debug.xml index 5d89b9cb2..8d9508e38 100644 --- a/java/res/xml/prefs_for_debug.xml +++ b/java/res/xml/prefs_for_debug.xml @@ -28,6 +28,7 @@ <ListPreference android:key="pref_keyboard_layout_20110916" android:title="@string/keyboard_layout" + android:summary="%s" android:persistent="true" android:entryValues="@array/keyboard_layout_modes_values" android:entries="@array/keyboard_layout_modes" diff --git a/java/res/xml/row_dvorak4.xml b/java/res/xml/row_dvorak4.xml index 02a95acea..b78872fe4 100644 --- a/java/res/xml/row_dvorak4.xml +++ b/java/res/xml/row_dvorak4.xml @@ -27,42 +27,11 @@ <Key latin:keyStyle="toSymbolKeyStyle" latin:keyWidth="15%p" /> - <switch> - <case - latin:hasShortcutKey="true" - latin:keyboardLayoutSetElement="alphabet" - > - <Key - latin:keyLabel="q" - latin:backgroundType="normal" - latin:additionalMoreKeys="!text/shortcut_as_more_key" - latin:keyStyle="f1MoreKeysStyle" /> - </case> - <case - latin:hasShortcutKey="true" - > - <Key - latin:keyLabel="Q" - latin:backgroundType="normal" - latin:additionalMoreKeys="!text/shortcut_as_more_key" - latin:keyStyle="f1MoreKeysStyle" /> - </case> - <!-- latin:hasShortcutKey="false" --> - <case - latin:keyboardLayoutSetElement="alphabet" - > - <Key - latin:keyLabel="q" - latin:backgroundType="normal" - latin:keyStyle="f1MoreKeysStyle" /> - </case> - <default> - <Key - latin:keyLabel="Q" - latin:backgroundType="normal" - latin:keyStyle="f1MoreKeysStyle" /> - </default> - </switch> + <Key + latin:keyLabel="q" + latin:backgroundType="normal" + latin:additionalMoreKeys="!text/shortcut_as_more_key" + latin:keyStyle="f1MoreKeysStyle" /> <include latin:keyXPos="25%p" latin:keyboardLayout="@xml/key_space_5kw" /> diff --git a/java/res/xml/rowkeys_khmer1.xml b/java/res/xml/rowkeys_khmer1.xml index 25da66400..05d1a864a 100644 --- a/java/res/xml/rowkeys_khmer1.xml +++ b/java/res/xml/rowkeys_khmer1.xml @@ -64,6 +64,7 @@ <Key latin:keyLabel="័" latin:keyHintLabel="៚" + latin:keyHintLabelVerticalAdjustment="-30%" latin:moreKeys="៚" latin:keyLabelFlags="fontNormal" /> <!-- U+17CF: "៏" KHMER SIGN AHSDA --> diff --git a/java/res/xml/rowkeys_khmer2.xml b/java/res/xml/rowkeys_khmer2.xml index cba2d3b90..801f23ff6 100644 --- a/java/res/xml/rowkeys_khmer2.xml +++ b/java/res/xml/rowkeys_khmer2.xml @@ -31,12 +31,13 @@ latin:keyLabel="ឈ" latin:keyHintLabel="ៜ" latin:moreKeys="ៜ" - latin:keyLabelFlags="fontNormal" /> + latin:keyLabelFlags="fontNormal|autoScale" /> <!-- U+17BA: "ឺ" KHMER VOWEL SIGN YY U+17DD: "៝" KHMER SIGN ATTHACAN --> <Key latin:keyLabel="ឺ" latin:keyHintLabel="៝" + latin:keyHintLabelVerticalAdjustment="40%" latin:moreKeys="៝" latin:keyLabelFlags="fontNormal" /> <!-- U+17C2: "ែ" KHMER VOWEL SIGN AE --> @@ -69,7 +70,7 @@ <!-- U+17C5: "ៅ" KHMER VOWEL SIGN AU --> <Key latin:keyLabel="ៅ" - latin:keyLabelFlags="fontNormal" /> + latin:keyLabelFlags="fontNormal|autoScale" /> <!-- U+1797: "ភ" KHMER LETTER PHO --> <Key latin:keyLabel="ភ" @@ -77,7 +78,7 @@ <!-- U+17BF: "ឿ" KHMER VOWEL SIGN YA --> <Key latin:keyLabel="ឿ" - latin:keyLabelFlags="fontNormal" /> + latin:keyLabelFlags="fontNormal|autoScale" /> <!-- U+17B0: "ឰ" KHMER INDEPENDENT VOWEL QAI --> <Key latin:keyLabel="ឰ" @@ -119,7 +120,7 @@ <!-- U+17C4: "ោ" KHMER VOWEL SIGN OO --> <Key latin:keyLabel="ោ" - latin:keyLabelFlags="fontNormal" /> + latin:keyLabelFlags="fontNormal|autoScale" /> <!-- U+1795: "ផ" KHMER LETTER PHA --> <Key latin:keyLabel="ផ" @@ -127,7 +128,7 @@ <!-- U+17C0: "ៀ" KHMER VOWEL SIGN IE --> <Key latin:keyLabel="ៀ" - latin:keyLabelFlags="fontNormal" /> + latin:keyLabelFlags="fontNormal|autoScale" /> <!-- U+17AA: "ឪ" KHMER INDEPENDENT VOWEL QUUV U+17A7: "ឧ" KHMER INDEPENDENT VOWEL QU U+17B1: "ឱ" KHMER INDEPENDENT VOWEL QOO TYPE ONE diff --git a/java/res/xml/rowkeys_khmer3.xml b/java/res/xml/rowkeys_khmer3.xml index ff6c9ca51..f35ba5c56 100644 --- a/java/res/xml/rowkeys_khmer3.xml +++ b/java/res/xml/rowkeys_khmer3.xml @@ -70,7 +70,7 @@ <!-- U+17C4/U+17C7: "ោះ" KHMER VOWEL SIGN OO/KHMER SIGN REAHMUK --> <Key latin:keyLabel="ោះ" - latin:keyLabelFlags="fontNormal" /> + latin:keyLabelFlags="fontNormal|followKeyLetterRatio|autoScale" /> <!-- U+17C9: "៉" KHMER SIGN MUUSIKATOAN --> <Key latin:keyLabel="៉" diff --git a/java/res/xml/rowkeys_khmer4.xml b/java/res/xml/rowkeys_khmer4.xml index fe6c59125..598aed8d5 100644 --- a/java/res/xml/rowkeys_khmer4.xml +++ b/java/res/xml/rowkeys_khmer4.xml @@ -40,7 +40,7 @@ <!-- U+17C1/U+17C7: "េះ" KHMER VOWEL SIGN E/KHMER SIGN REAHMUK --> <Key latin:keyLabel="េះ" - latin:keyLabelFlags="fontNormal" /> + latin:keyLabelFlags="fontNormal|followKeyLetterRatio|autoScale" /> <!-- U+1796: "ព" KHMER LETTER PO U+179E: "ឞ" KHMER LETTER SSO --> <Key @@ -51,7 +51,7 @@ <!-- U+178E: "ណ" KHMER LETTER NNO --> <Key latin:keyLabel="ណ" - latin:keyLabelFlags="fontNormal" /> + latin:keyLabelFlags="fontNormal|autoScale" /> <!-- U+17C6: "ំ" KHMER SIGN NIKAHIT --> <Key latin:keyLabel="ំ" diff --git a/java/src/com/android/inputmethod/keyboard/EmojiLayoutParams.java b/java/src/com/android/inputmethod/keyboard/EmojiLayoutParams.java index ceb44e79f..967448c28 100644 --- a/java/src/com/android/inputmethod/keyboard/EmojiLayoutParams.java +++ b/java/src/com/android/inputmethod/keyboard/EmojiLayoutParams.java @@ -40,13 +40,13 @@ public class EmojiLayoutParams { public EmojiLayoutParams(Resources res) { final int defaultKeyboardHeight = ResourceUtils.getDefaultKeyboardHeight(res); final int defaultKeyboardWidth = ResourceUtils.getDefaultKeyboardWidth(res); - mKeyVerticalGap = (int) res.getFraction(R.fraction.key_bottom_gap_ics, + mKeyVerticalGap = (int) res.getFraction(R.fraction.key_bottom_gap_holo, (int) defaultKeyboardHeight, (int) defaultKeyboardHeight); - mBottomPadding = (int) res.getFraction(R.fraction.keyboard_bottom_padding_ics, + mBottomPadding = (int) res.getFraction(R.fraction.keyboard_bottom_padding_holo, (int) defaultKeyboardHeight, (int) defaultKeyboardHeight); - mTopPadding = (int) res.getFraction(R.fraction.keyboard_top_padding_ics, + mTopPadding = (int) res.getFraction(R.fraction.keyboard_top_padding_holo, (int) defaultKeyboardHeight, (int) defaultKeyboardHeight); - mKeyHorizontalGap = (int) (res.getFraction(R.fraction.key_horizontal_gap_ics, + mKeyHorizontalGap = (int) (res.getFraction(R.fraction.key_horizontal_gap_holo, defaultKeyboardWidth, defaultKeyboardWidth)); mEmojiCategoryPageIdViewHeight = (int) (res.getDimension(R.dimen.emoji_category_page_id_height)); diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index f7ec9509d..d3f628dcf 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -84,10 +84,16 @@ public class Key implements Comparable<Key> { private static final int LABEL_FLAGS_HAS_HINT_LABEL = 0x800; private static final int LABEL_FLAGS_WITH_ICON_LEFT = 0x1000; private static final int LABEL_FLAGS_WITH_ICON_RIGHT = 0x2000; + // The bit to calculate the ratio of key label width against key width. If autoXScale bit is on + // and autoYScale bit is off, the key label may be shrunk only for X-direction. + // If both autoXScale and autoYScale bits are on, the key label text size may be auto scaled. private static final int LABEL_FLAGS_AUTO_X_SCALE = 0x4000; - private static final int LABEL_FLAGS_PRESERVE_CASE = 0x8000; - private static final int LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED = 0x10000; - private static final int LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL = 0x20000; + private static final int LABEL_FLAGS_AUTO_Y_SCALE = 0x8000; + private static final int LABEL_FLAGS_AUTO_SCALE = LABEL_FLAGS_AUTO_X_SCALE + | LABEL_FLAGS_AUTO_Y_SCALE; + private static final int LABEL_FLAGS_PRESERVE_CASE = 0x10000; + private static final int LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED = 0x20000; + private static final int LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL = 0x40000; private static final int LABEL_FLAGS_DISABLE_HINT_LABEL = 0x40000000; private static final int LABEL_FLAGS_DISABLE_ADDITIONAL_MORE_KEYS = 0x80000000; @@ -702,10 +708,14 @@ public class Key implements Comparable<Key> { return (mLabelFlags & LABEL_FLAGS_WITH_ICON_RIGHT) != 0; } - public final boolean needsXScale() { + public final boolean needsAutoXScale() { return (mLabelFlags & LABEL_FLAGS_AUTO_X_SCALE) != 0; } + public final boolean needsAutoScale() { + return (mLabelFlags & LABEL_FLAGS_AUTO_SCALE) == LABEL_FLAGS_AUTO_SCALE; + } + public final boolean isShiftedLetterActivated() { return (mLabelFlags & LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED) != 0; } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index b7521b998..a6b293f2f 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -27,6 +27,7 @@ import android.view.View; import android.view.inputmethod.EditorInfo; import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy; +import com.android.inputmethod.compat.InputMethodServiceCompatUtils; import com.android.inputmethod.keyboard.KeyboardLayoutSet.KeyboardLayoutSetException; import com.android.inputmethod.keyboard.internal.KeyboardState; import com.android.inputmethod.latin.InputView; @@ -57,9 +58,13 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { } } + private static final int INDEX_THEME_ICS = 0; + private static final int INDEX_THEME_GB = 1; + private static final int INDEX_THEME_KLP = 2; private static final KeyboardTheme[] KEYBOARD_THEMES = { - new KeyboardTheme(0, R.style.KeyboardTheme_ICS), - new KeyboardTheme(1, R.style.KeyboardTheme_GB), + new KeyboardTheme(INDEX_THEME_ICS, R.style.KeyboardTheme_ICS), + new KeyboardTheme(INDEX_THEME_GB, R.style.KeyboardTheme_GB), + new KeyboardTheme(INDEX_THEME_KLP, R.style.KeyboardTheme_KLP), }; private SubtypeSwitcher mSubtypeSwitcher; @@ -71,6 +76,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { private EmojiPalettesView mEmojiPalettesView; private LatinIME mLatinIME; private Resources mResources; + private boolean mIsHardwareAcceleratedDrawingEnabled; private KeyboardState mState; @@ -80,7 +86,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { * what user actually typed. */ private boolean mIsAutoCorrectionActive; - private KeyboardTheme mKeyboardTheme = KEYBOARD_THEMES[0]; + private KeyboardTheme mKeyboardTheme = KEYBOARD_THEMES[INDEX_THEME_KLP]; private Context mThemeContext; private static final KeyboardSwitcher sInstance = new KeyboardSwitcher(); @@ -104,7 +110,16 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mPrefs = prefs; mSubtypeSwitcher = SubtypeSwitcher.getInstance(); mState = new KeyboardState(this); - setContextThemeWrapper(latinIme, getKeyboardTheme(latinIme, prefs)); + mIsHardwareAcceleratedDrawingEnabled = + InputMethodServiceCompatUtils.enableHardwareAcceleration(mLatinIME); + } + + public void updateKeyboardTheme() { + final boolean themeUpdated = updateKeyboardThemeAndContextThemeWrapper( + mLatinIME, getKeyboardTheme(mLatinIME, mPrefs)); + if (themeUpdated && mKeyboardView != null) { + mLatinIME.setInputView(onCreateInputView(mIsHardwareAcceleratedDrawingEnabled)); + } } private static KeyboardTheme getKeyboardTheme(final Context context, @@ -124,12 +139,15 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { return KEYBOARD_THEMES[Integer.valueOf(defaultIndex)]; } - private void setContextThemeWrapper(final Context context, final KeyboardTheme keyboardTheme) { + private boolean updateKeyboardThemeAndContextThemeWrapper(final Context context, + final KeyboardTheme keyboardTheme) { if (mThemeContext == null || mKeyboardTheme.mThemeId != keyboardTheme.mThemeId) { mKeyboardTheme = keyboardTheme; mThemeContext = new ContextThemeWrapper(context, keyboardTheme.mStyleId); KeyboardLayoutSet.clearKeyboardCache(); + return true; } + return false; } public void loadKeyboard(final EditorInfo editorInfo, final SettingsValues settingsValues) { @@ -361,7 +379,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mKeyboardView.closing(); } - setContextThemeWrapper(mLatinIME, mKeyboardTheme); + updateKeyboardThemeAndContextThemeWrapper(mLatinIME, mKeyboardTheme); mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate( R.layout.input_view, null); mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame); diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 5578713a0..dcd90070e 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -113,9 +113,6 @@ public class KeyboardView extends View { private final Canvas mOffscreenCanvas = new Canvas(); private final Paint mPaint = new Paint(); private final Paint.FontMetrics mFontMetrics = new Paint.FontMetrics(); - private static final char[] KEY_LABEL_REFERENCE_CHAR = { 'M' }; - private static final char[] KEY_NUMERIC_HINT_LABEL_REFERENCE_CHAR = { '8' }; - public KeyboardView(final Context context, final AttributeSet attrs) { this(context, attrs, R.attr.keyboardViewStyle); } @@ -370,10 +367,8 @@ public class KeyboardView extends View { if (label != null) { paint.setTypeface(key.selectTypeface(params)); paint.setTextSize(key.selectTextSize(params)); - final float labelCharHeight = TypefaceUtils.getCharHeight( - KEY_LABEL_REFERENCE_CHAR, paint); - final float labelCharWidth = TypefaceUtils.getCharWidth( - KEY_LABEL_REFERENCE_CHAR, paint); + final float labelCharHeight = TypefaceUtils.getReferenceCharHeight(paint); + final float labelCharWidth = TypefaceUtils.getReferenceCharWidth(paint); // Vertical label text alignment. final float baseline = centerY + labelCharHeight / 2.0f; @@ -391,12 +386,12 @@ public class KeyboardView extends View { positionX = centerX - labelCharWidth * 7.0f / 4.0f; paint.setTextAlign(Align.LEFT); } else if (key.hasLabelWithIconLeft() && icon != null) { - labelWidth = TypefaceUtils.getLabelWidth(label, paint) + icon.getIntrinsicWidth() + labelWidth = TypefaceUtils.getStringWidth(label, paint) + icon.getIntrinsicWidth() + LABEL_ICON_MARGIN * keyWidth; positionX = centerX + labelWidth / 2.0f; paint.setTextAlign(Align.RIGHT); } else if (key.hasLabelWithIconRight() && icon != null) { - labelWidth = TypefaceUtils.getLabelWidth(label, paint) + icon.getIntrinsicWidth() + labelWidth = TypefaceUtils.getStringWidth(label, paint) + icon.getIntrinsicWidth() + LABEL_ICON_MARGIN * keyWidth; positionX = centerX - labelWidth / 2.0f; paint.setTextAlign(Align.LEFT); @@ -404,9 +399,15 @@ public class KeyboardView extends View { positionX = centerX; paint.setTextAlign(Align.CENTER); } - if (key.needsXScale()) { - paint.setTextScaleX(Math.min(1.0f, - (keyWidth * MAX_LABEL_RATIO) / TypefaceUtils.getLabelWidth(label, paint))); + if (key.needsAutoXScale()) { + final float ratio = Math.min(1.0f, (keyWidth * MAX_LABEL_RATIO) / + TypefaceUtils.getStringWidth(label, paint)); + if (key.needsAutoScale()) { + final float autoSize = paint.getTextSize() * ratio; + paint.setTextSize(autoSize); + } else { + paint.setTextScaleX(ratio); + } } paint.setColor(key.selectTextColor(params)); @@ -451,36 +452,35 @@ public class KeyboardView extends View { // TODO: Should add a way to specify type face for hint letters paint.setTypeface(Typeface.DEFAULT_BOLD); blendAlpha(paint, params.mAnimAlpha); + final float labelCharHeight = TypefaceUtils.getReferenceCharHeight(paint); + final float labelCharWidth = TypefaceUtils.getReferenceCharWidth(paint); + final KeyVisualAttributes visualAttr = key.getVisualAttributes(); + final float adjustmentY = (visualAttr == null) ? 0.0f + : visualAttr.mHintLabelVerticalAdjustment * labelCharHeight; final float hintX, hintY; if (key.hasHintLabel()) { // The hint label is placed just right of the key label. Used mainly on // "phone number" layout. // TODO: Generalize the following calculations. - hintX = positionX - + TypefaceUtils.getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint) * 2.0f; - hintY = centerY - + TypefaceUtils.getCharHeight(KEY_LABEL_REFERENCE_CHAR, paint) / 2.0f; + hintX = positionX + labelCharWidth * 2.0f; + hintY = centerY + labelCharHeight / 2.0f; paint.setTextAlign(Align.LEFT); } else if (key.hasShiftedLetterHint()) { // The hint label is placed at top-right corner of the key. Used mainly on tablet. - hintX = keyWidth - mKeyShiftedLetterHintPadding - - TypefaceUtils.getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint) / 2.0f; + hintX = keyWidth - mKeyShiftedLetterHintPadding - labelCharWidth / 2.0f; paint.getFontMetrics(mFontMetrics); hintY = -mFontMetrics.top; paint.setTextAlign(Align.CENTER); } else { // key.hasHintLetter() // The hint letter is placed at top-right corner of the key. Used mainly on phone. - final float keyNumericHintLabelReferenceCharWidth = - TypefaceUtils.getCharWidth(KEY_NUMERIC_HINT_LABEL_REFERENCE_CHAR, paint); - final float keyHintLabelStringWidth = - TypefaceUtils.getStringWidth(hintLabel, paint); + final float hintDigitWidth = TypefaceUtils.getReferenceDigitWidth(paint); + final float hintLabelWidth = TypefaceUtils.getStringWidth(hintLabel, paint); hintX = keyWidth - mKeyHintLetterPadding - - Math.max(keyNumericHintLabelReferenceCharWidth, keyHintLabelStringWidth) - / 2.0f; + - Math.max(hintDigitWidth, hintLabelWidth) / 2.0f; hintY = -paint.ascent(); paint.setTextAlign(Align.CENTER); } - canvas.drawText(hintLabel, 0, hintLabel.length(), hintX, hintY, paint); + canvas.drawText(hintLabel, 0, hintLabel.length(), hintX, hintY + adjustmentY, paint); if (LatinImeLogger.sVISUALDEBUG) { final Paint line = new Paint(); @@ -530,7 +530,7 @@ public class KeyboardView extends View { paint.setColor(params.mHintLabelColor); paint.setTextAlign(Align.CENTER); final float hintX = keyWidth - mKeyHintLetterPadding - - TypefaceUtils.getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint) / 2.0f; + - TypefaceUtils.getReferenceCharWidth(paint) / 2.0f; final float hintY = keyHeight - mKeyPopupHintLetterPadding; canvas.drawText(POPUP_HINT_CHAR, hintX, hintY, paint); diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 13db47004..a638b238c 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -1193,7 +1193,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack private boolean fitsTextIntoWidth(final int width, final String text, final Paint paint) { final int maxTextWidth = width - mLanguageOnSpacebarHorizontalMargin * 2; paint.setTextScaleX(1.0f); - final float textWidth = TypefaceUtils.getLabelWidth(text, paint); + final float textWidth = TypefaceUtils.getStringWidth(text, paint); if (textWidth < width) { return true; } @@ -1204,7 +1204,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack } paint.setTextScaleX(scaleX); - return TypefaceUtils.getLabelWidth(text, paint) < maxTextWidth; + return TypefaceUtils.getStringWidth(text, paint) < maxTextWidth; } // Layout language name on spacebar. diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java index 8256d4623..385123998 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java @@ -327,7 +327,7 @@ public final class MoreKeysKeyboard extends Keyboard { // If the label is single letter, minKeyWidth is enough to hold the label. if (label != null && StringUtils.codePointCount(label) > 1) { maxWidth = Math.max(maxWidth, - (int)(TypefaceUtils.getLabelWidth(label, paint) + padding)); + (int)(TypefaceUtils.getStringWidth(label, paint) + padding)); } } return maxWidth; diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java b/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java index 8bdad364c..c3e0aa685 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java @@ -47,6 +47,8 @@ public final class KeyVisualAttributes { public final int mShiftedLetterHintActivatedColor; public final int mPreviewTextColor; + public final float mHintLabelVerticalAdjustment; + private static final int[] VISUAL_ATTRIBUTE_IDS = { R.styleable.Keyboard_Key_keyTypeface, R.styleable.Keyboard_Key_keyLetterSize, @@ -65,6 +67,7 @@ public final class KeyVisualAttributes { R.styleable.Keyboard_Key_keyShiftedLetterHintInactivatedColor, R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor, R.styleable.Keyboard_Key_keyPreviewTextColor, + R.styleable.Keyboard_Key_keyHintLabelVerticalAdjustment, }; private static final SparseIntArray sVisualAttributeIds = new SparseIntArray(); private static final int ATTR_DEFINED = 1; @@ -127,5 +130,8 @@ public final class KeyVisualAttributes { mShiftedLetterHintActivatedColor = keyAttr.getColor( R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor, 0); mPreviewTextColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyPreviewTextColor, 0); + + mHintLabelVerticalAdjustment = ResourceUtils.getFraction(keyAttr, + R.styleable.Keyboard_Key_keyHintLabelVerticalAdjustment, 0.0f); } } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java index 98515c893..b3975dc50 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java @@ -87,11 +87,11 @@ public final class KeyboardTextsSet { return (text == null) ? LANGUAGE_DEFAULT[id] : text; } + // These texts' name should be aligned with the @string/<name> in + // values*/strings-action-keys.xml. private static final String[] RESOURCE_NAMES = { - // These texts' name should be aligned with the @string/<name> in values/strings.xml. // Labels for action. "label_go_key", - // "label_search_key", "label_send_key", "label_next_key", "label_done_key", @@ -284,7 +284,7 @@ public final class KeyboardTextsSet { /* 56 */ "\u00A2,\u00A3,\u20AC,\u00A5,\u20B1", /* 57 */ "$", /* 58 */ "$,\u00A2,\u20AC,\u00A3,\u00A5,\u20B1", - /* 59 */ "!fixedColumnOrder!4,#,!,\\,,?,-,:,',@", + /* 59 */ "!fixedColumnOrder!8,;,/,(,),#,!,\\,,?,&,\\%,+,\",-,:,',@", // U+2020: "†" DAGGER // U+2021: "‡" DOUBLE DAGGER // U+2605: "★" BLACK STAR @@ -795,7 +795,7 @@ public final class KeyboardTextsSet { null, null, null, null, null, null, null, null, null, null, null, null, null, null, /* ~58 */ // U+00B7: "·" MIDDLE DOT - /* 59 */ "!fixedColumnOrder!4,\u00B7,!,\\,,?,:,;,@", + /* 59 */ "!fixedColumnOrder!9,;,/,(,),#,\u00B7,!,\\,,?,&,\\%,+,\",-,:,',@", /* 60~ */ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, @@ -1981,7 +1981,7 @@ public final class KeyboardTextsSet { // U+20AA: "₪" NEW SHEQEL SIGN /* 57 */ "\u20AA", /* 58 */ null, - /* 59 */ null, + /* 59 */ "!fixedColumnOrder!8,;,/,(|),)|(,#,!,\\,,?,&,\\%,+,\",-,:,',@", // U+2605: "★" BLACK STAR /* 60 */ "\u2605", /* 61 */ null, diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index 710c3eaac..d059cc8a9 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -23,7 +23,6 @@ import android.util.Log; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.latin.makedict.FormatSpec; -import com.android.inputmethod.latin.personalization.DynamicPersonalizationDictionaryWriter; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.utils.AsyncResultHolder; import com.android.inputmethod.latin.utils.CollectionUtils; @@ -53,10 +52,6 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { /** Whether to print debug output to log */ private static boolean DEBUG = false; - // TODO: Remove. - /** Whether to call binary dictionary dynamically updating methods. */ - public static final boolean ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE = true; - private static final int TIMEOUT_FOR_READ_OPS_IN_MILLISECONDS = 100; /** @@ -164,11 +159,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { private static AbstractDictionaryWriter getDictionaryWriter(final Context context, final String dictType, final boolean isDynamicPersonalizationDictionary) { if (isDynamicPersonalizationDictionary) { - if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) { - return null; - } else { - return new DynamicPersonalizationDictionaryWriter(context, dictType); - } + return null; } else { return new DictionaryWriter(context, dictType); } @@ -244,7 +235,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { getExecutor(mFilename).execute(new Runnable() { @Override public void run() { - if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE && mDictionaryWriter == null) { + if (mDictionaryWriter == null) { mBinaryDictionary.close(); final File file = new File(mContext.getFilesDir(), mFilename); BinaryDictionary.createEmptyDictFile(file.getAbsolutePath(), @@ -286,7 +277,6 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { * Check whether GC is needed and run GC if required. */ protected void runGCIfRequired(final boolean mindsBlockByGC) { - if (!ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) return; getExecutor(mFilename).execute(new Runnable() { @Override public void run() { @@ -296,7 +286,6 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { } private void runGCIfRequiredInternalLocked(final boolean mindsBlockByGC) { - if (!ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) return; // Calls to needsToRunGC() need to be serialized. if (mBinaryDictionary.needsToRunGC(mindsBlockByGC)) { if (setIsRegeneratingIfNotRegenerating()) { @@ -327,14 +316,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { getExecutor(mFilename).execute(new Runnable() { @Override public void run() { - if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) { - runGCIfRequiredInternalLocked(true /* mindsBlockByGC */); - mBinaryDictionary.addUnigramWord(word, frequency); - } else { - // TODO: Remove. - mDictionaryWriter.addUnigramWord(word, shortcutTarget, frequency, shortcutFreq, - isNotAWord); - } + runGCIfRequiredInternalLocked(true /* mindsBlockByGC */); + mBinaryDictionary.addUnigramWord(word, frequency); } }); } @@ -352,14 +335,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { getExecutor(mFilename).execute(new Runnable() { @Override public void run() { - if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) { - runGCIfRequiredInternalLocked(true /* mindsBlockByGC */); - mBinaryDictionary.addBigramWords(word0, word1, frequency); - } else { - // TODO: Remove. - mDictionaryWriter.addBigramWords(word0, word1, frequency, isValid, - 0 /* lastTouchedTime */); - } + runGCIfRequiredInternalLocked(true /* mindsBlockByGC */); + mBinaryDictionary.addBigramWords(word0, word1, frequency); } }); } @@ -376,13 +353,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { getExecutor(mFilename).execute(new Runnable() { @Override public void run() { - if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) { - runGCIfRequiredInternalLocked(true /* mindsBlockByGC */); - mBinaryDictionary.removeBigramWords(word0, word1); - } else { - // TODO: Remove. - mDictionaryWriter.removeBigramWords(word0, word1); - } + runGCIfRequiredInternalLocked(true /* mindsBlockByGC */); + mBinaryDictionary.removeBigramWords(word0, word1); } }); } @@ -396,46 +368,20 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { if (isRegenerating()) { return null; } - final ArrayList<SuggestedWordInfo> suggestions = CollectionUtils.newArrayList(); final AsyncResultHolder<ArrayList<SuggestedWordInfo>> holder = new AsyncResultHolder<ArrayList<SuggestedWordInfo>>(); getExecutor(mFilename).executePrioritized(new Runnable() { @Override public void run() { - if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) { - if (mBinaryDictionary == null) { - holder.set(null); - return; - } - final ArrayList<SuggestedWordInfo> binarySuggestion = - mBinaryDictionary.getSuggestionsWithSessionId(composer, prevWord, - proximityInfo, blockOffensiveWords, additionalFeaturesOptions, - sessionId); - holder.set(binarySuggestion); - } else { - final ArrayList<SuggestedWordInfo> inMemDictSuggestion = - composer.isBatchMode() ? null : - mDictionaryWriter.getSuggestionsWithSessionId(composer, - prevWord, proximityInfo, blockOffensiveWords, - additionalFeaturesOptions, sessionId); - // TODO: Remove checking mIsUpdatable and use native suggestion. - if (mBinaryDictionary != null && !mIsUpdatable) { - final ArrayList<SuggestedWordInfo> binarySuggestion = - mBinaryDictionary.getSuggestionsWithSessionId(composer, prevWord, - proximityInfo, blockOffensiveWords, - additionalFeaturesOptions, sessionId); - if (inMemDictSuggestion == null) { - holder.set(binarySuggestion); - } else if (binarySuggestion == null) { - holder.set(inMemDictSuggestion); - } else { - binarySuggestion.addAll(inMemDictSuggestion); - holder.set(binarySuggestion); - } - } else { - holder.set(inMemDictSuggestion); - } + if (mBinaryDictionary == null) { + holder.set(null); + return; } + final ArrayList<SuggestedWordInfo> binarySuggestion = + mBinaryDictionary.getSuggestionsWithSessionId(composer, prevWord, + proximityInfo, blockOffensiveWords, additionalFeaturesOptions, + sessionId); + holder.set(binarySuggestion); } }); return holder.get(null, TIMEOUT_FOR_READ_OPS_IN_MILLISECONDS); @@ -542,20 +488,16 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { loadDictionaryAsync(); mDictionaryWriter.write(mFilename, getHeaderAttributeMap()); } else { - if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) { - if (mBinaryDictionary == null || !mBinaryDictionary.isValidDictionary()) { - final File file = new File(mContext.getFilesDir(), mFilename); - BinaryDictionary.createEmptyDictFile(file.getAbsolutePath(), - DICTIONARY_FORMAT_VERSION, getHeaderAttributeMap()); + if (mBinaryDictionary == null || !mBinaryDictionary.isValidDictionary()) { + final File file = new File(mContext.getFilesDir(), mFilename); + BinaryDictionary.createEmptyDictFile(file.getAbsolutePath(), + DICTIONARY_FORMAT_VERSION, getHeaderAttributeMap()); + } else { + if (mBinaryDictionary.needsToRunGC(false /* mindsBlockByGC */)) { + mBinaryDictionary.flushWithGC(); } else { - if (mBinaryDictionary.needsToRunGC(false /* mindsBlockByGC */)) { - mBinaryDictionary.flushWithGC(); - } else { - mBinaryDictionary.flush(); - } + mBinaryDictionary.flush(); } - } else { - mDictionaryWriter.write(mFilename, getHeaderAttributeMap()); } } } @@ -663,20 +605,6 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { } /** - * Load the dictionary to memory. - */ - protected void asyncLoadDictionaryToMemory() { - getExecutor(mFilename).executePrioritized(new Runnable() { - @Override - public void run() { - if (!ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) { - loadDictionaryAsync(); - } - } - }); - } - - /** * Generate binary dictionary using DictionaryWriter. */ protected void asyncFlashAllBinaryDictionary() { @@ -704,7 +632,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { } } - // TODO: Implement native binary methods once the dynamic dictionary implementation is done. + // TODO: Implement BinaryDictionary.isInDictionary(). @UsedForTesting public boolean isInDictionaryForTests(final String word) { final AsyncResultHolder<Boolean> holder = new AsyncResultHolder<Boolean>(); @@ -712,12 +640,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { @Override public void run() { if (mDictType == Dictionary.TYPE_USER_HISTORY) { - if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) { - holder.set(mBinaryDictionary.isValidWord(word)); - } else { - holder.set(((DynamicPersonalizationDictionaryWriter) mDictionaryWriter) - .isInBigramListForTests(word)); - } + holder.set(mBinaryDictionary.isValidWord(word)); } } }); diff --git a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java deleted file mode 100644 index 8fdff8f7e..000000000 --- a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java +++ /dev/null @@ -1,897 +0,0 @@ -/* - * Copyright (C) 2009 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; - -import android.text.TextUtils; -import android.util.Log; - -import com.android.inputmethod.annotations.UsedForTesting; -import com.android.inputmethod.keyboard.ProximityInfo; -import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; -import com.android.inputmethod.latin.utils.CollectionUtils; -import com.android.inputmethod.latin.utils.UserHistoryForgettingCurveUtils.ForgettingCurveParams; - -import java.util.ArrayList; -import java.util.LinkedList; - -/** - * Class for an in-memory dictionary that can grow dynamically and can - * be searched for suggestions and valid words. - */ -// TODO: Remove after binary dictionary supports dynamic update. -@UsedForTesting -public class ExpandableDictionary extends Dictionary { - private static final String TAG = ExpandableDictionary.class.getSimpleName(); - /** - * The weight to give to a word if it's length is the same as the number of typed characters. - */ - private static final int FULL_WORD_SCORE_MULTIPLIER = 2; - - private char[] mWordBuilder = new char[Constants.DICTIONARY_MAX_WORD_LENGTH]; - private int mMaxDepth; - private int mInputLength; - - private static final class Node { - char mCode; - int mFrequency; - boolean mTerminal; - Node mParent; - NodeArray mChildren; - ArrayList<char[]> mShortcutTargets; - boolean mShortcutOnly; - LinkedList<NextWord> mNGrams; // Supports ngram - } - - private static final class NodeArray { - Node[] mData; - int mLength = 0; - private static final int INCREMENT = 2; - - NodeArray() { - mData = new Node[INCREMENT]; - } - - void add(final Node n) { - if (mLength + 1 > mData.length) { - Node[] tempData = new Node[mLength + INCREMENT]; - if (mLength > 0) { - System.arraycopy(mData, 0, tempData, 0, mLength); - } - mData = tempData; - } - mData[mLength++] = n; - } - } - - public interface NextWord { - public Node getWordNode(); - public int getFrequency(); - public ForgettingCurveParams getFcParams(); - public int notifyTypedAgainAndGetFrequency(); - } - - private static final class NextStaticWord implements NextWord { - public final Node mWord; - private final int mFrequency; - public NextStaticWord(Node word, int frequency) { - mWord = word; - mFrequency = frequency; - } - - @Override - public Node getWordNode() { - return mWord; - } - - @Override - public int getFrequency() { - return mFrequency; - } - - @Override - public ForgettingCurveParams getFcParams() { - return null; - } - - @Override - public int notifyTypedAgainAndGetFrequency() { - return mFrequency; - } - } - - private static final class NextHistoryWord implements NextWord { - public final Node mWord; - public final ForgettingCurveParams mFcp; - - public NextHistoryWord(Node word, ForgettingCurveParams fcp) { - mWord = word; - mFcp = fcp; - } - - @Override - public Node getWordNode() { - return mWord; - } - - @Override - public int getFrequency() { - return mFcp.getFrequency(); - } - - @Override - public ForgettingCurveParams getFcParams() { - return mFcp; - } - - @Override - public int notifyTypedAgainAndGetFrequency() { - return mFcp.notifyTypedAgainAndGetFrequency(); - } - } - - private NodeArray mRoots; - - private int[][] mCodes; - - @UsedForTesting - public ExpandableDictionary(final String dictType) { - super(dictType); - clearDictionary(); - mCodes = new int[Constants.DICTIONARY_MAX_WORD_LENGTH][]; - } - - public int getMaxWordLength() { - return Constants.DICTIONARY_MAX_WORD_LENGTH; - } - - /** - * Add a word with an optional shortcut to the dictionary. - * @param word The word to add. - * @param shortcutTarget A shortcut target for this word, or null if none. - * @param frequency The frequency for this unigram. - * @param shortcutFreq The frequency of the shortcut (0~15, with 15 = whitelist). Ignored - * if shortcutTarget is null. - */ - @UsedForTesting - public void addWord(final String word, final String shortcutTarget, final int frequency, - final int shortcutFreq) { - if (word.length() >= Constants.DICTIONARY_MAX_WORD_LENGTH) { - return; - } - addWordRec(mRoots, word, 0, shortcutTarget, frequency, shortcutFreq, null); - } - - /** - * Add a word, recursively searching for its correct place in the trie tree. - * @param children The node to recursively search for addition. Initially, the root of the tree. - * @param word The word to add. - * @param depth The current depth in the tree. - * @param shortcutTarget A shortcut target for this word, or null if none. - * @param frequency The frequency for this unigram. - * @param shortcutFreq The frequency of the shortcut (0~15, with 15 = whitelist). Ignored - * if shortcutTarget is null. - * @param parentNode The parent node, for up linking. Initially null, as the root has no parent. - */ - private void addWordRec(final NodeArray children, final String word, final int depth, - final String shortcutTarget, final int frequency, final int shortcutFreq, - final Node parentNode) { - final int wordLength = word.length(); - if (wordLength <= depth) return; - final char c = word.charAt(depth); - // Does children have the current character? - final int childrenLength = children.mLength; - Node childNode = null; - for (int i = 0; i < childrenLength; i++) { - final Node node = children.mData[i]; - if (node.mCode == c) { - childNode = node; - break; - } - } - final boolean isShortcutOnly = (null != shortcutTarget); - if (childNode == null) { - childNode = new Node(); - childNode.mCode = c; - childNode.mParent = parentNode; - childNode.mShortcutOnly = isShortcutOnly; - children.add(childNode); - } - if (wordLength == depth + 1) { - // Terminate this word - childNode.mTerminal = true; - if (isShortcutOnly) { - if (null == childNode.mShortcutTargets) { - childNode.mShortcutTargets = CollectionUtils.newArrayList(); - } - childNode.mShortcutTargets.add(shortcutTarget.toCharArray()); - } else { - childNode.mShortcutOnly = false; - } - childNode.mFrequency = Math.max(frequency, childNode.mFrequency); - if (childNode.mFrequency > 255) childNode.mFrequency = 255; - return; - } - if (childNode.mChildren == null) { - childNode.mChildren = new NodeArray(); - } - addWordRec(childNode.mChildren, word, depth + 1, shortcutTarget, frequency, shortcutFreq, - childNode); - } - - @Override - public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer, - final String prevWord, final ProximityInfo proximityInfo, - final boolean blockOffensiveWords, final int[] additionalFeaturesOptions) { - if (composer.size() > 1) { - if (composer.size() >= Constants.DICTIONARY_MAX_WORD_LENGTH) { - return null; - } - final ArrayList<SuggestedWordInfo> suggestions = - getWordsInner(composer, prevWord, proximityInfo); - return suggestions; - } else { - if (TextUtils.isEmpty(prevWord)) return null; - final ArrayList<SuggestedWordInfo> suggestions = CollectionUtils.newArrayList(); - runBigramReverseLookUp(prevWord, suggestions); - return suggestions; - } - } - - private ArrayList<SuggestedWordInfo> getWordsInner(final WordComposer codes, - final String prevWordForBigrams, final ProximityInfo proximityInfo) { - final ArrayList<SuggestedWordInfo> suggestions = CollectionUtils.newArrayList(); - mInputLength = codes.size(); - if (mCodes.length < mInputLength) mCodes = new int[mInputLength][]; - final InputPointers ips = codes.getInputPointers(); - final int[] xCoordinates = ips.getXCoordinates(); - final int[] yCoordinates = ips.getYCoordinates(); - // Cache the codes so that we don't have to lookup an array list - for (int i = 0; i < mInputLength; i++) { - // TODO: Calculate proximity info here. - if (mCodes[i] == null || mCodes[i].length < 1) { - mCodes[i] = new int[ProximityInfo.MAX_PROXIMITY_CHARS_SIZE]; - } - final int x = xCoordinates != null && i < xCoordinates.length ? - xCoordinates[i] : Constants.NOT_A_COORDINATE; - final int y = xCoordinates != null && i < yCoordinates.length ? - yCoordinates[i] : Constants.NOT_A_COORDINATE; - proximityInfo.fillArrayWithNearestKeyCodes(x, y, codes.getCodeAt(i), mCodes[i]); - } - mMaxDepth = mInputLength * 3; - getWordsRec(mRoots, codes, mWordBuilder, 0, false, 1, 0, -1, suggestions); - for (int i = 0; i < mInputLength; i++) { - getWordsRec(mRoots, codes, mWordBuilder, 0, false, 1, 0, i, suggestions); - } - return suggestions; - } - - @Override - public synchronized boolean isValidWord(final String word) { - final Node node = searchNode(mRoots, word, 0, word.length()); - // If node is null, we didn't find the word, so it's not valid. - // If node.mShortcutOnly is true, then it exists as a shortcut but not as a word, - // so that means it's not a valid word. - // If node.mShortcutOnly is false, then it exists as a word (it may also exist as - // a shortcut, but this does not matter), so it's a valid word. - return (node == null) ? false : !node.mShortcutOnly; - } - - public boolean removeBigram(final String word0, final String word1) { - // Refer to addOrSetBigram() about word1.toLowerCase() - final Node firstWord = searchWord(mRoots, word0.toLowerCase(), 0, null); - final Node secondWord = searchWord(mRoots, word1, 0, null); - LinkedList<NextWord> bigrams = firstWord.mNGrams; - NextWord bigramNode = null; - if (bigrams == null || bigrams.size() == 0) { - return false; - } else { - for (NextWord nw : bigrams) { - if (nw.getWordNode() == secondWord) { - bigramNode = nw; - break; - } - } - } - if (bigramNode == null) { - return false; - } - return bigrams.remove(bigramNode); - } - - /** - * Returns the word's frequency or -1 if not found - */ - @UsedForTesting - public int getWordFrequency(final String word) { - // Case-sensitive search - final Node node = searchNode(mRoots, word, 0, word.length()); - return (node == null) ? -1 : node.mFrequency; - } - - public NextWord getBigramWord(final String word0, final String word1) { - // Refer to addOrSetBigram() about word0.toLowerCase() - final Node firstWord = searchWord(mRoots, word0.toLowerCase(), 0, null); - final Node secondWord = searchWord(mRoots, word1, 0, null); - LinkedList<NextWord> bigrams = firstWord.mNGrams; - if (bigrams == null || bigrams.size() == 0) { - return null; - } else { - for (NextWord nw : bigrams) { - if (nw.getWordNode() == secondWord) { - return nw; - } - } - } - return null; - } - - private static int computeSkippedWordFinalFreq(final int freq, final int snr, - final int inputLength) { - // The computation itself makes sense for >= 2, but the == 2 case returns 0 - // anyway so we may as well test against 3 instead and return the constant - if (inputLength >= 3) { - return (freq * snr * (inputLength - 2)) / (inputLength - 1); - } else { - return 0; - } - } - - /** - * Helper method to add a word and its shortcuts. - * - * @param node the terminal node - * @param word the word to insert, as an array of code points - * @param depth the depth of the node in the tree - * @param finalFreq the frequency for this word - * @param suggestions the suggestion collection to add the suggestions to - * @return whether there is still space for more words. - */ - private boolean addWordAndShortcutsFromNode(final Node node, final char[] word, final int depth, - final int finalFreq, final ArrayList<SuggestedWordInfo> suggestions) { - if (finalFreq > 0 && !node.mShortcutOnly) { - // Use KIND_CORRECTION always. This dictionary does not really have a notion of - // COMPLETION against CORRECTION; we could artificially add one by looking at - // the respective size of the typed word and the suggestion if it matters sometime - // in the future. - suggestions.add(new SuggestedWordInfo(new String(word, 0, depth + 1), finalFreq, - SuggestedWordInfo.KIND_CORRECTION, this /* sourceDict */, - SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */, - SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */)); - if (suggestions.size() >= Suggest.MAX_SUGGESTIONS) return false; - } - if (null != node.mShortcutTargets) { - final int length = node.mShortcutTargets.size(); - for (int shortcutIndex = 0; shortcutIndex < length; ++shortcutIndex) { - final char[] shortcut = node.mShortcutTargets.get(shortcutIndex); - suggestions.add(new SuggestedWordInfo(new String(shortcut, 0, shortcut.length), - finalFreq, SuggestedWordInfo.KIND_SHORTCUT, this /* sourceDict */, - SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */, - SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */)); - if (suggestions.size() > Suggest.MAX_SUGGESTIONS) return false; - } - } - return true; - } - - /** - * Recursively traverse the tree for words that match the input. Input consists of - * a list of arrays. Each item in the list is one input character position. An input - * character is actually an array of multiple possible candidates. This function is not - * optimized for speed, assuming that the user dictionary will only be a few hundred words in - * size. - * @param roots node whose children have to be search for matches - * @param codes the input character codes - * @param word the word being composed as a possible match - * @param depth the depth of traversal - the length of the word being composed thus far - * @param completion whether the traversal is now in completion mode - meaning that we've - * exhausted the input and we're looking for all possible suffixes. - * @param snr current weight of the word being formed - * @param inputIndex position in the input characters. This can be off from the depth in - * case we skip over some punctuations such as apostrophe in the traversal. That is, if you type - * "wouldve", it could be matching "would've", so the depth will be one more than the - * inputIndex - * @param suggestions the list in which to add suggestions - */ - // TODO: Share this routine with the native code for BinaryDictionary - private void getWordsRec(final NodeArray roots, final WordComposer codes, final char[] word, - final int depth, final boolean completion, final int snr, final int inputIndex, - final int skipPos, final ArrayList<SuggestedWordInfo> suggestions) { - final int count = roots.mLength; - final int codeSize = mInputLength; - // Optimization: Prune out words that are too long compared to how much was typed. - if (depth > mMaxDepth) { - return; - } - final int[] currentChars; - if (codeSize <= inputIndex) { - currentChars = null; - } else { - currentChars = mCodes[inputIndex]; - } - - for (int i = 0; i < count; i++) { - final Node node = roots.mData[i]; - final char c = node.mCode; - final char lowerC = toLowerCase(c); - final boolean terminal = node.mTerminal; - final NodeArray children = node.mChildren; - final int freq = node.mFrequency; - if (completion || currentChars == null) { - word[depth] = c; - if (terminal) { - final int finalFreq; - if (skipPos < 0) { - finalFreq = freq * snr; - } else { - finalFreq = computeSkippedWordFinalFreq(freq, snr, mInputLength); - } - if (!addWordAndShortcutsFromNode(node, word, depth, finalFreq, suggestions)) { - // No space left in the queue, bail out - return; - } - } - if (children != null) { - getWordsRec(children, codes, word, depth + 1, true, snr, inputIndex, - skipPos, suggestions); - } - } else if ((c == Constants.CODE_SINGLE_QUOTE - && currentChars[0] != Constants.CODE_SINGLE_QUOTE) || depth == skipPos) { - // Skip the ' and continue deeper - word[depth] = c; - if (children != null) { - getWordsRec(children, codes, word, depth + 1, completion, snr, inputIndex, - skipPos, suggestions); - } - } else { - // Don't use alternatives if we're looking for missing characters - final int alternativesSize = skipPos >= 0 ? 1 : currentChars.length; - for (int j = 0; j < alternativesSize; j++) { - final int addedAttenuation = (j > 0 ? 1 : 2); - final int currentChar = currentChars[j]; - if (currentChar == Constants.NOT_A_CODE) { - break; - } - if (currentChar == lowerC || currentChar == c) { - word[depth] = c; - - if (codeSize == inputIndex + 1) { - if (terminal) { - final int finalFreq; - if (skipPos < 0) { - finalFreq = freq * snr * addedAttenuation - * FULL_WORD_SCORE_MULTIPLIER; - } else { - finalFreq = computeSkippedWordFinalFreq(freq, - snr * addedAttenuation, mInputLength); - } - if (!addWordAndShortcutsFromNode(node, word, depth, finalFreq, - suggestions)) { - // No space left in the queue, bail out - return; - } - } - if (children != null) { - getWordsRec(children, codes, word, depth + 1, - true, snr * addedAttenuation, inputIndex + 1, - skipPos, suggestions); - } - } else if (children != null) { - getWordsRec(children, codes, word, depth + 1, - false, snr * addedAttenuation, inputIndex + 1, - skipPos, suggestions); - } - } - } - } - } - } - - public int setBigramAndGetFrequency(final String word0, final String word1, - final int frequency) { - return setBigramAndGetFrequency(word0, word1, frequency, null /* unused */); - } - - public int setBigramAndGetFrequency(final String word0, final String word1, - final ForgettingCurveParams fcp) { - return setBigramAndGetFrequency(word0, word1, 0 /* unused */, fcp); - } - - /** - * Adds bigrams to the in-memory trie structure that is being used to retrieve any word - * @param word0 the first word of this bigram - * @param word1 the second word of this bigram - * @param frequency frequency for this bigram - * @param fcp an instance of ForgettingCurveParams to use for decay policy - * @return returns the final bigram frequency - */ - private int setBigramAndGetFrequency(final String word0, final String word1, - final int frequency, final ForgettingCurveParams fcp) { - if (TextUtils.isEmpty(word0)) { - Log.e(TAG, "Invalid bigram previous word: " + word0); - return frequency; - } - // We don't want results to be different according to case of the looked up left hand side - // word. We do want however to return the correct case for the right hand side. - // So we want to squash the case of the left hand side, and preserve that of the right - // hand side word. - final String word0Lower = word0.toLowerCase(); - if (TextUtils.isEmpty(word0Lower) || TextUtils.isEmpty(word1)) { - Log.e(TAG, "Invalid bigram pair: " + word0 + ", " + word0Lower + ", " + word1); - return frequency; - } - final Node firstWord = searchWord(mRoots, word0Lower, 0, null); - final Node secondWord = searchWord(mRoots, word1, 0, null); - LinkedList<NextWord> bigrams = firstWord.mNGrams; - if (bigrams == null || bigrams.size() == 0) { - firstWord.mNGrams = CollectionUtils.newLinkedList(); - bigrams = firstWord.mNGrams; - } else { - for (NextWord nw : bigrams) { - if (nw.getWordNode() == secondWord) { - return nw.notifyTypedAgainAndGetFrequency(); - } - } - } - if (fcp != null) { - // history - firstWord.mNGrams.add(new NextHistoryWord(secondWord, fcp)); - } else { - firstWord.mNGrams.add(new NextStaticWord(secondWord, frequency)); - } - return frequency; - } - - /** - * Searches for the word and add the word if it does not exist. - * @return Returns the terminal node of the word we are searching for. - */ - private Node searchWord(final NodeArray children, final String word, final int depth, - final Node parentNode) { - final int wordLength = word.length(); - final char c = word.charAt(depth); - // Does children have the current character? - final int childrenLength = children.mLength; - Node childNode = null; - for (int i = 0; i < childrenLength; i++) { - final Node node = children.mData[i]; - if (node.mCode == c) { - childNode = node; - break; - } - } - if (childNode == null) { - childNode = new Node(); - childNode.mCode = c; - childNode.mParent = parentNode; - children.add(childNode); - } - if (wordLength == depth + 1) { - // Terminate this word - childNode.mTerminal = true; - return childNode; - } - if (childNode.mChildren == null) { - childNode.mChildren = new NodeArray(); - } - return searchWord(childNode.mChildren, word, depth + 1, childNode); - } - - private void runBigramReverseLookUp(final String previousWord, - final ArrayList<SuggestedWordInfo> suggestions) { - // Search for the lowercase version of the word only, because that's where bigrams - // store their sons. - final Node prevWord = searchNode(mRoots, previousWord.toLowerCase(), 0, - previousWord.length()); - if (prevWord != null && prevWord.mNGrams != null) { - reverseLookUp(prevWord.mNGrams, suggestions); - } - } - - // Local to reverseLookUp, but do not allocate each time. - private final char[] mLookedUpString = new char[Constants.DICTIONARY_MAX_WORD_LENGTH]; - - /** - * reverseLookUp retrieves the full word given a list of terminal nodes and adds those words - * to the suggestions list passed as an argument. - * @param terminalNodes list of terminal nodes we want to add - * @param suggestions the suggestion collection to add the word to - */ - private void reverseLookUp(final LinkedList<NextWord> terminalNodes, - final ArrayList<SuggestedWordInfo> suggestions) { - Node node; - int freq; - for (NextWord nextWord : terminalNodes) { - node = nextWord.getWordNode(); - freq = nextWord.getFrequency(); - int index = Constants.DICTIONARY_MAX_WORD_LENGTH; - do { - --index; - mLookedUpString[index] = node.mCode; - node = node.mParent; - } while (node != null && index > 0); - - // If node is null, we have a word longer than MAX_WORD_LENGTH in the dictionary. - // It's a little unclear how this can happen, but just in case it does it's safer - // to ignore the word in this case. - if (freq >= 0 && node == null) { - suggestions.add(new SuggestedWordInfo(new String(mLookedUpString, index, - Constants.DICTIONARY_MAX_WORD_LENGTH - index), - freq, SuggestedWordInfo.KIND_CORRECTION, this /* sourceDict */, - SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */, - SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */)); - } - } - } - - /** - * Recursively search for the terminal node of the word. - * - * One iteration takes the full word to search for and the current index of the recursion. - * - * @param children the node of the trie to search under. - * @param word the word to search for. Only read [offset..length] so there may be trailing chars - * @param offset the index in {@code word} this recursion should operate on. - * @param length the length of the input word. - * @return Returns the terminal node of the word if the word exists - */ - private Node searchNode(final NodeArray children, final CharSequence word, final int offset, - final int length) { - final int count = children.mLength; - final char currentChar = word.charAt(offset); - for (int j = 0; j < count; j++) { - final Node node = children.mData[j]; - if (node.mCode == currentChar) { - if (offset == length - 1) { - if (node.mTerminal) { - return node; - } - } else { - if (node.mChildren != null) { - Node returnNode = searchNode(node.mChildren, word, offset + 1, length); - if (returnNode != null) return returnNode; - } - } - } - } - return null; - } - - public void clearDictionary() { - mRoots = new NodeArray(); - } - - private static char toLowerCase(final char c) { - char baseChar = c; - if (c < BASE_CHARS.length) { - baseChar = BASE_CHARS[c]; - } - if (baseChar >= 'A' && baseChar <= 'Z') { - return (char)(baseChar | 32); - } else if (baseChar > 127) { - return Character.toLowerCase(baseChar); - } - return baseChar; - } - - /** - * Table mapping most combined Latin, Greek, and Cyrillic characters - * to their base characters. If c is in range, BASE_CHARS[c] == c - * if c is not a combined character, or the base character if it - * is combined. - * - * cf. native/jni/src/utils/char_utils.cpp - */ - private static final char BASE_CHARS[] = { - /* U+0000 */ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - /* U+0008 */ 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - /* U+0010 */ 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - /* U+0018 */ 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, - /* U+0020 */ 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - /* U+0028 */ 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, - /* U+0030 */ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - /* U+0038 */ 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, - /* U+0040 */ 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - /* U+0048 */ 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, - /* U+0050 */ 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - /* U+0058 */ 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, - /* U+0060 */ 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - /* U+0068 */ 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, - /* U+0070 */ 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - /* U+0078 */ 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, - /* U+0080 */ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - /* U+0088 */ 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - /* U+0090 */ 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - /* U+0098 */ 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - /* U+00A0 */ 0x0020, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - /* U+00A8 */ 0x0020, 0x00A9, 0x0061, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0020, - /* U+00B0 */ 0x00B0, 0x00B1, 0x0032, 0x0033, 0x0020, 0x03BC, 0x00B6, 0x00B7, - /* U+00B8 */ 0x0020, 0x0031, 0x006F, 0x00BB, 0x0031, 0x0031, 0x0033, 0x00BF, - /* U+00C0 */ 0x0041, 0x0041, 0x0041, 0x0041, 0x0041, 0x0041, 0x00C6, 0x0043, - /* U+00C8 */ 0x0045, 0x0045, 0x0045, 0x0045, 0x0049, 0x0049, 0x0049, 0x0049, - /* U+00D0 */ 0x00D0, 0x004E, 0x004F, 0x004F, 0x004F, 0x004F, 0x004F, 0x00D7, - /* U+00D8 */ 0x004F, 0x0055, 0x0055, 0x0055, 0x0055, 0x0059, 0x00DE, 0x0073, - // U+00D8: Manually changed from 00D8 to 004F - // TODO: Check if it's really acceptable to consider Ø a diacritical variant of O - // U+00DF: Manually changed from 00DF to 0073 - /* U+00E0 */ 0x0061, 0x0061, 0x0061, 0x0061, 0x0061, 0x0061, 0x00E6, 0x0063, - /* U+00E8 */ 0x0065, 0x0065, 0x0065, 0x0065, 0x0069, 0x0069, 0x0069, 0x0069, - /* U+00F0 */ 0x00F0, 0x006E, 0x006F, 0x006F, 0x006F, 0x006F, 0x006F, 0x00F7, - /* U+00F8 */ 0x006F, 0x0075, 0x0075, 0x0075, 0x0075, 0x0079, 0x00FE, 0x0079, - // U+00F8: Manually changed from 00F8 to 006F - // TODO: Check if it's really acceptable to consider ø a diacritical variant of o - /* U+0100 */ 0x0041, 0x0061, 0x0041, 0x0061, 0x0041, 0x0061, 0x0043, 0x0063, - /* U+0108 */ 0x0043, 0x0063, 0x0043, 0x0063, 0x0043, 0x0063, 0x0044, 0x0064, - /* U+0110 */ 0x0110, 0x0111, 0x0045, 0x0065, 0x0045, 0x0065, 0x0045, 0x0065, - /* U+0118 */ 0x0045, 0x0065, 0x0045, 0x0065, 0x0047, 0x0067, 0x0047, 0x0067, - /* U+0120 */ 0x0047, 0x0067, 0x0047, 0x0067, 0x0048, 0x0068, 0x0126, 0x0127, - /* U+0128 */ 0x0049, 0x0069, 0x0049, 0x0069, 0x0049, 0x0069, 0x0049, 0x0069, - /* U+0130 */ 0x0049, 0x0131, 0x0049, 0x0069, 0x004A, 0x006A, 0x004B, 0x006B, - /* U+0138 */ 0x0138, 0x004C, 0x006C, 0x004C, 0x006C, 0x004C, 0x006C, 0x004C, - /* U+0140 */ 0x006C, 0x004C, 0x006C, 0x004E, 0x006E, 0x004E, 0x006E, 0x004E, - // U+0141: Manually changed from 0141 to 004C - // U+0142: Manually changed from 0142 to 006C - /* U+0148 */ 0x006E, 0x02BC, 0x014A, 0x014B, 0x004F, 0x006F, 0x004F, 0x006F, - /* U+0150 */ 0x004F, 0x006F, 0x0152, 0x0153, 0x0052, 0x0072, 0x0052, 0x0072, - /* U+0158 */ 0x0052, 0x0072, 0x0053, 0x0073, 0x0053, 0x0073, 0x0053, 0x0073, - /* U+0160 */ 0x0053, 0x0073, 0x0054, 0x0074, 0x0054, 0x0074, 0x0166, 0x0167, - /* U+0168 */ 0x0055, 0x0075, 0x0055, 0x0075, 0x0055, 0x0075, 0x0055, 0x0075, - /* U+0170 */ 0x0055, 0x0075, 0x0055, 0x0075, 0x0057, 0x0077, 0x0059, 0x0079, - /* U+0178 */ 0x0059, 0x005A, 0x007A, 0x005A, 0x007A, 0x005A, 0x007A, 0x0073, - /* U+0180 */ 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, 0x0186, 0x0187, - /* U+0188 */ 0x0188, 0x0189, 0x018A, 0x018B, 0x018C, 0x018D, 0x018E, 0x018F, - /* U+0190 */ 0x0190, 0x0191, 0x0192, 0x0193, 0x0194, 0x0195, 0x0196, 0x0197, - /* U+0198 */ 0x0198, 0x0199, 0x019A, 0x019B, 0x019C, 0x019D, 0x019E, 0x019F, - /* U+01A0 */ 0x004F, 0x006F, 0x01A2, 0x01A3, 0x01A4, 0x01A5, 0x01A6, 0x01A7, - /* U+01A8 */ 0x01A8, 0x01A9, 0x01AA, 0x01AB, 0x01AC, 0x01AD, 0x01AE, 0x0055, - /* U+01B0 */ 0x0075, 0x01B1, 0x01B2, 0x01B3, 0x01B4, 0x01B5, 0x01B6, 0x01B7, - /* U+01B8 */ 0x01B8, 0x01B9, 0x01BA, 0x01BB, 0x01BC, 0x01BD, 0x01BE, 0x01BF, - /* U+01C0 */ 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x0044, 0x0044, 0x0064, 0x004C, - /* U+01C8 */ 0x004C, 0x006C, 0x004E, 0x004E, 0x006E, 0x0041, 0x0061, 0x0049, - /* U+01D0 */ 0x0069, 0x004F, 0x006F, 0x0055, 0x0075, 0x0055, 0x0075, 0x0055, - // U+01D5: Manually changed from 00DC to 0055 - // U+01D6: Manually changed from 00FC to 0075 - // U+01D7: Manually changed from 00DC to 0055 - /* U+01D8 */ 0x0075, 0x0055, 0x0075, 0x0055, 0x0075, 0x01DD, 0x0041, 0x0061, - // U+01D8: Manually changed from 00FC to 0075 - // U+01D9: Manually changed from 00DC to 0055 - // U+01DA: Manually changed from 00FC to 0075 - // U+01DB: Manually changed from 00DC to 0055 - // U+01DC: Manually changed from 00FC to 0075 - // U+01DE: Manually changed from 00C4 to 0041 - // U+01DF: Manually changed from 00E4 to 0061 - /* U+01E0 */ 0x0041, 0x0061, 0x00C6, 0x00E6, 0x01E4, 0x01E5, 0x0047, 0x0067, - // U+01E0: Manually changed from 0226 to 0041 - // U+01E1: Manually changed from 0227 to 0061 - /* U+01E8 */ 0x004B, 0x006B, 0x004F, 0x006F, 0x004F, 0x006F, 0x01B7, 0x0292, - // U+01EC: Manually changed from 01EA to 004F - // U+01ED: Manually changed from 01EB to 006F - /* U+01F0 */ 0x006A, 0x0044, 0x0044, 0x0064, 0x0047, 0x0067, 0x01F6, 0x01F7, - /* U+01F8 */ 0x004E, 0x006E, 0x0041, 0x0061, 0x00C6, 0x00E6, 0x004F, 0x006F, - // U+01FA: Manually changed from 00C5 to 0041 - // U+01FB: Manually changed from 00E5 to 0061 - // U+01FE: Manually changed from 00D8 to 004F - // TODO: Check if it's really acceptable to consider Ø a diacritical variant of O - // U+01FF: Manually changed from 00F8 to 006F - // TODO: Check if it's really acceptable to consider ø a diacritical variant of o - /* U+0200 */ 0x0041, 0x0061, 0x0041, 0x0061, 0x0045, 0x0065, 0x0045, 0x0065, - /* U+0208 */ 0x0049, 0x0069, 0x0049, 0x0069, 0x004F, 0x006F, 0x004F, 0x006F, - /* U+0210 */ 0x0052, 0x0072, 0x0052, 0x0072, 0x0055, 0x0075, 0x0055, 0x0075, - /* U+0218 */ 0x0053, 0x0073, 0x0054, 0x0074, 0x021C, 0x021D, 0x0048, 0x0068, - /* U+0220 */ 0x0220, 0x0221, 0x0222, 0x0223, 0x0224, 0x0225, 0x0041, 0x0061, - /* U+0228 */ 0x0045, 0x0065, 0x004F, 0x006F, 0x004F, 0x006F, 0x004F, 0x006F, - // U+022A: Manually changed from 00D6 to 004F - // U+022B: Manually changed from 00F6 to 006F - // U+022C: Manually changed from 00D5 to 004F - // U+022D: Manually changed from 00F5 to 006F - /* U+0230 */ 0x004F, 0x006F, 0x0059, 0x0079, 0x0234, 0x0235, 0x0236, 0x0237, - // U+0230: Manually changed from 022E to 004F - // U+0231: Manually changed from 022F to 006F - /* U+0238 */ 0x0238, 0x0239, 0x023A, 0x023B, 0x023C, 0x023D, 0x023E, 0x023F, - /* U+0240 */ 0x0240, 0x0241, 0x0242, 0x0243, 0x0244, 0x0245, 0x0246, 0x0247, - /* U+0248 */ 0x0248, 0x0249, 0x024A, 0x024B, 0x024C, 0x024D, 0x024E, 0x024F, - /* U+0250 */ 0x0250, 0x0251, 0x0252, 0x0253, 0x0254, 0x0255, 0x0256, 0x0257, - /* U+0258 */ 0x0258, 0x0259, 0x025A, 0x025B, 0x025C, 0x025D, 0x025E, 0x025F, - /* U+0260 */ 0x0260, 0x0261, 0x0262, 0x0263, 0x0264, 0x0265, 0x0266, 0x0267, - /* U+0268 */ 0x0268, 0x0269, 0x026A, 0x026B, 0x026C, 0x026D, 0x026E, 0x026F, - /* U+0270 */ 0x0270, 0x0271, 0x0272, 0x0273, 0x0274, 0x0275, 0x0276, 0x0277, - /* U+0278 */ 0x0278, 0x0279, 0x027A, 0x027B, 0x027C, 0x027D, 0x027E, 0x027F, - /* U+0280 */ 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0286, 0x0287, - /* U+0288 */ 0x0288, 0x0289, 0x028A, 0x028B, 0x028C, 0x028D, 0x028E, 0x028F, - /* U+0290 */ 0x0290, 0x0291, 0x0292, 0x0293, 0x0294, 0x0295, 0x0296, 0x0297, - /* U+0298 */ 0x0298, 0x0299, 0x029A, 0x029B, 0x029C, 0x029D, 0x029E, 0x029F, - /* U+02A0 */ 0x02A0, 0x02A1, 0x02A2, 0x02A3, 0x02A4, 0x02A5, 0x02A6, 0x02A7, - /* U+02A8 */ 0x02A8, 0x02A9, 0x02AA, 0x02AB, 0x02AC, 0x02AD, 0x02AE, 0x02AF, - /* U+02B0 */ 0x0068, 0x0266, 0x006A, 0x0072, 0x0279, 0x027B, 0x0281, 0x0077, - /* U+02B8 */ 0x0079, 0x02B9, 0x02BA, 0x02BB, 0x02BC, 0x02BD, 0x02BE, 0x02BF, - /* U+02C0 */ 0x02C0, 0x02C1, 0x02C2, 0x02C3, 0x02C4, 0x02C5, 0x02C6, 0x02C7, - /* U+02C8 */ 0x02C8, 0x02C9, 0x02CA, 0x02CB, 0x02CC, 0x02CD, 0x02CE, 0x02CF, - /* U+02D0 */ 0x02D0, 0x02D1, 0x02D2, 0x02D3, 0x02D4, 0x02D5, 0x02D6, 0x02D7, - /* U+02D8 */ 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x02DE, 0x02DF, - /* U+02E0 */ 0x0263, 0x006C, 0x0073, 0x0078, 0x0295, 0x02E5, 0x02E6, 0x02E7, - /* U+02E8 */ 0x02E8, 0x02E9, 0x02EA, 0x02EB, 0x02EC, 0x02ED, 0x02EE, 0x02EF, - /* U+02F0 */ 0x02F0, 0x02F1, 0x02F2, 0x02F3, 0x02F4, 0x02F5, 0x02F6, 0x02F7, - /* U+02F8 */ 0x02F8, 0x02F9, 0x02FA, 0x02FB, 0x02FC, 0x02FD, 0x02FE, 0x02FF, - /* U+0300 */ 0x0300, 0x0301, 0x0302, 0x0303, 0x0304, 0x0305, 0x0306, 0x0307, - /* U+0308 */ 0x0308, 0x0309, 0x030A, 0x030B, 0x030C, 0x030D, 0x030E, 0x030F, - /* U+0310 */ 0x0310, 0x0311, 0x0312, 0x0313, 0x0314, 0x0315, 0x0316, 0x0317, - /* U+0318 */ 0x0318, 0x0319, 0x031A, 0x031B, 0x031C, 0x031D, 0x031E, 0x031F, - /* U+0320 */ 0x0320, 0x0321, 0x0322, 0x0323, 0x0324, 0x0325, 0x0326, 0x0327, - /* U+0328 */ 0x0328, 0x0329, 0x032A, 0x032B, 0x032C, 0x032D, 0x032E, 0x032F, - /* U+0330 */ 0x0330, 0x0331, 0x0332, 0x0333, 0x0334, 0x0335, 0x0336, 0x0337, - /* U+0338 */ 0x0338, 0x0339, 0x033A, 0x033B, 0x033C, 0x033D, 0x033E, 0x033F, - /* U+0340 */ 0x0300, 0x0301, 0x0342, 0x0313, 0x0308, 0x0345, 0x0346, 0x0347, - /* U+0348 */ 0x0348, 0x0349, 0x034A, 0x034B, 0x034C, 0x034D, 0x034E, 0x034F, - /* U+0350 */ 0x0350, 0x0351, 0x0352, 0x0353, 0x0354, 0x0355, 0x0356, 0x0357, - /* U+0358 */ 0x0358, 0x0359, 0x035A, 0x035B, 0x035C, 0x035D, 0x035E, 0x035F, - /* U+0360 */ 0x0360, 0x0361, 0x0362, 0x0363, 0x0364, 0x0365, 0x0366, 0x0367, - /* U+0368 */ 0x0368, 0x0369, 0x036A, 0x036B, 0x036C, 0x036D, 0x036E, 0x036F, - /* U+0370 */ 0x0370, 0x0371, 0x0372, 0x0373, 0x02B9, 0x0375, 0x0376, 0x0377, - /* U+0378 */ 0x0378, 0x0379, 0x0020, 0x037B, 0x037C, 0x037D, 0x003B, 0x037F, - /* U+0380 */ 0x0380, 0x0381, 0x0382, 0x0383, 0x0020, 0x00A8, 0x0391, 0x00B7, - /* U+0388 */ 0x0395, 0x0397, 0x0399, 0x038B, 0x039F, 0x038D, 0x03A5, 0x03A9, - /* U+0390 */ 0x03CA, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - /* U+0398 */ 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - /* U+03A0 */ 0x03A0, 0x03A1, 0x03A2, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, - /* U+03A8 */ 0x03A8, 0x03A9, 0x0399, 0x03A5, 0x03B1, 0x03B5, 0x03B7, 0x03B9, - /* U+03B0 */ 0x03CB, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - /* U+03B8 */ 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - /* U+03C0 */ 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, - /* U+03C8 */ 0x03C8, 0x03C9, 0x03B9, 0x03C5, 0x03BF, 0x03C5, 0x03C9, 0x03CF, - /* U+03D0 */ 0x03B2, 0x03B8, 0x03A5, 0x03D2, 0x03D2, 0x03C6, 0x03C0, 0x03D7, - /* U+03D8 */ 0x03D8, 0x03D9, 0x03DA, 0x03DB, 0x03DC, 0x03DD, 0x03DE, 0x03DF, - /* U+03E0 */ 0x03E0, 0x03E1, 0x03E2, 0x03E3, 0x03E4, 0x03E5, 0x03E6, 0x03E7, - /* U+03E8 */ 0x03E8, 0x03E9, 0x03EA, 0x03EB, 0x03EC, 0x03ED, 0x03EE, 0x03EF, - /* U+03F0 */ 0x03BA, 0x03C1, 0x03C2, 0x03F3, 0x0398, 0x03B5, 0x03F6, 0x03F7, - /* U+03F8 */ 0x03F8, 0x03A3, 0x03FA, 0x03FB, 0x03FC, 0x03FD, 0x03FE, 0x03FF, - /* U+0400 */ 0x0415, 0x0415, 0x0402, 0x0413, 0x0404, 0x0405, 0x0406, 0x0406, - /* U+0408 */ 0x0408, 0x0409, 0x040A, 0x040B, 0x041A, 0x0418, 0x0423, 0x040F, - /* U+0410 */ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - /* U+0418 */ 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - // U+0419: Manually changed from 0418 to 0419 - /* U+0420 */ 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - /* U+0428 */ 0x0428, 0x0429, 0x042C, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - // U+042A: Manually changed from 042A to 042C - /* U+0430 */ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - /* U+0438 */ 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - // U+0439: Manually changed from 0438 to 0439 - /* U+0440 */ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - /* U+0448 */ 0x0448, 0x0449, 0x044C, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, - // U+044A: Manually changed from 044A to 044C - /* U+0450 */ 0x0435, 0x0435, 0x0452, 0x0433, 0x0454, 0x0455, 0x0456, 0x0456, - /* U+0458 */ 0x0458, 0x0459, 0x045A, 0x045B, 0x043A, 0x0438, 0x0443, 0x045F, - /* U+0460 */ 0x0460, 0x0461, 0x0462, 0x0463, 0x0464, 0x0465, 0x0466, 0x0467, - /* U+0468 */ 0x0468, 0x0469, 0x046A, 0x046B, 0x046C, 0x046D, 0x046E, 0x046F, - /* U+0470 */ 0x0470, 0x0471, 0x0472, 0x0473, 0x0474, 0x0475, 0x0474, 0x0475, - /* U+0478 */ 0x0478, 0x0479, 0x047A, 0x047B, 0x047C, 0x047D, 0x047E, 0x047F, - /* U+0480 */ 0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, - /* U+0488 */ 0x0488, 0x0489, 0x048A, 0x048B, 0x048C, 0x048D, 0x048E, 0x048F, - /* U+0490 */ 0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x0497, - /* U+0498 */ 0x0498, 0x0499, 0x049A, 0x049B, 0x049C, 0x049D, 0x049E, 0x049F, - /* U+04A0 */ 0x04A0, 0x04A1, 0x04A2, 0x04A3, 0x04A4, 0x04A5, 0x04A6, 0x04A7, - /* U+04A8 */ 0x04A8, 0x04A9, 0x04AA, 0x04AB, 0x04AC, 0x04AD, 0x04AE, 0x04AF, - /* U+04B0 */ 0x04B0, 0x04B1, 0x04B2, 0x04B3, 0x04B4, 0x04B5, 0x04B6, 0x04B7, - /* U+04B8 */ 0x04B8, 0x04B9, 0x04BA, 0x04BB, 0x04BC, 0x04BD, 0x04BE, 0x04BF, - /* U+04C0 */ 0x04C0, 0x0416, 0x0436, 0x04C3, 0x04C4, 0x04C5, 0x04C6, 0x04C7, - /* U+04C8 */ 0x04C8, 0x04C9, 0x04CA, 0x04CB, 0x04CC, 0x04CD, 0x04CE, 0x04CF, - /* U+04D0 */ 0x0410, 0x0430, 0x0410, 0x0430, 0x04D4, 0x04D5, 0x0415, 0x0435, - /* U+04D8 */ 0x04D8, 0x04D9, 0x04D8, 0x04D9, 0x0416, 0x0436, 0x0417, 0x0437, - /* U+04E0 */ 0x04E0, 0x04E1, 0x0418, 0x0438, 0x0418, 0x0438, 0x041E, 0x043E, - /* U+04E8 */ 0x04E8, 0x04E9, 0x04E8, 0x04E9, 0x042D, 0x044D, 0x0423, 0x0443, - /* U+04F0 */ 0x0423, 0x0443, 0x0423, 0x0443, 0x0427, 0x0447, 0x04F6, 0x04F7, - /* U+04F8 */ 0x042B, 0x044B, 0x04FA, 0x04FB, 0x04FC, 0x04FD, 0x04FE, 0x04FF, - }; -} diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 9936b3ea4..326c53f0e 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -809,6 +809,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen super.onStartInputView(editorInfo, restarting); mRichImm.clearSubtypeCaches(); final KeyboardSwitcher switcher = mKeyboardSwitcher; + switcher.updateKeyboardTheme(); final MainKeyboardView mainKeyboardView = switcher.getMainKeyboardView(); // If we are starting input in a different text field from before, we'll have to reload // settings, so currentSettingsValues can't be final. @@ -908,6 +909,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen false /* shouldFinishComposition */)) { // We try resetting the caches up to 5 times before giving up. mHandler.postResetCaches(isDifferentTextField, 5 /* remainingTries */); + // mLastSelection{Start,End} are reset later in this method, don't need to do it here canReachInputConnection = false; } else { if (isDifferentTextField) { @@ -987,10 +989,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (textLength > mLastSelectionStart || (textLength < Constants.EDITOR_CONTENTS_CACHE_SIZE && mLastSelectionStart < Constants.EDITOR_CONTENTS_CACHE_SIZE)) { + // It should not be possible to have only one of those variables be + // NOT_A_CURSOR_POSITION, so if they are equal, either the selection is zero-sized + // (simple cursor, no selection) or there is no cursor/we don't know its pos + final boolean wasEqual = mLastSelectionStart == mLastSelectionEnd; mLastSelectionStart = textLength; // We can't figure out the value of mLastSelectionEnd :( - // But at least if it's smaller than mLastSelectionStart something is wrong - if (mLastSelectionStart > mLastSelectionEnd) { + // But at least if it's smaller than mLastSelectionStart something is wrong, + // and if they used to be equal we also don't want to make it look like there is a + // selection. + if (wasEqual || mLastSelectionStart > mLastSelectionEnd) { mLastSelectionEnd = mLastSelectionStart; } } @@ -1441,7 +1449,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private boolean maybeDoubleSpacePeriod() { final SettingsValues currentSettingsValues = mSettings.getCurrent(); - if (!currentSettingsValues.mCorrectionEnabled) return false; if (!currentSettingsValues.mUseDoubleSpacePeriod) return false; if (!mHandler.isAcceptingDoubleSpacePeriod()) return false; // We only do this when we see two spaces and an accepted code point before the cursor. diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index f9f1e2385..b3cddba23 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -61,7 +61,7 @@ public final class RichInputConnection { * cursor may end up after all the keyboard-triggered updates have passed. We keep this to * compare it to the actual cursor position to guess whether the move was caused by a * keyboard command or not. - * It's not really the cursor position: the cursor may not be there yet, and it's also expected + * It's not really the cursor position: the cursor may not be there yet, and it's also expected * there be cases where it never actually comes to be there. */ private int mExpectedCursorPosition = INVALID_CURSOR_POSITION; // in chars, not code points @@ -305,7 +305,11 @@ public final class RichInputConnection { mCommittedTextBeforeComposingText.length() + mComposingText.length(); // If we have enough characters to satisfy the request, or if we have all characters in // the text field, then we can return the cached version right away. - if (cachedLength >= n || cachedLength >= mExpectedCursorPosition) { + // However, if we don't have an expected cursor position, then we should always + // go fetch the cache again (as it happens, INVALID_CURSOR_POSITION < 0, so we need to + // test for this explicitly) + if (INVALID_CURSOR_POSITION != mExpectedCursorPosition + && (cachedLength >= n || cachedLength >= mExpectedCursorPosition)) { final StringBuilder s = new StringBuilder(mCommittedTextBeforeComposingText); // We call #toString() here to create a temporary object. // In some situations, this method is called on a worker thread, and it's possible diff --git a/java/src/com/android/inputmethod/latin/personalization/DecayingExpandableBinaryDictionaryBase.java b/java/src/com/android/inputmethod/latin/personalization/DecayingExpandableBinaryDictionaryBase.java index c817d3eb5..e7a25d216 100644 --- a/java/src/com/android/inputmethod/latin/personalization/DecayingExpandableBinaryDictionaryBase.java +++ b/java/src/com/android/inputmethod/latin/personalization/DecayingExpandableBinaryDictionaryBase.java @@ -76,7 +76,6 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB mFileName = fileName; mPrefs = sp; if (mLocale != null && mLocale.length() > 1) { - asyncLoadDictionaryToMemory(); reloadDictionaryIfRequired(); } } @@ -86,9 +85,6 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB if (DBG_DUMP_ON_CLOSE) { dumpAllWordsForDebug(); } - if (!ExpandableBinaryDictionary.ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) { - closeBinaryDictionary(); - } // Flush pending writes. // TODO: Remove after this class become to use a dynamic binary dictionary. asyncFlashAllBinaryDictionary(); @@ -130,9 +126,8 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB (word0 != null && word0.length() >= Constants.DICTIONARY_MAX_WORD_LENGTH)) { return; } - final int frequency = ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE ? - (isValid ? FREQUENCY_FOR_WORDS_IN_DICTS : FREQUENCY_FOR_WORDS_NOT_IN_DICTS) : - FREQUENCY_FOR_TYPED; + final int frequency = isValid ? + FREQUENCY_FOR_WORDS_IN_DICTS : FREQUENCY_FOR_WORDS_NOT_IN_DICTS; addWordDynamically(word1, null /* shortcutTarget */, frequency, 0 /* shortcutFreq */, false /* isNotAWord */); // Do not insert a word as a bigram of itself diff --git a/java/src/com/android/inputmethod/latin/personalization/DynamicPersonalizationDictionaryWriter.java b/java/src/com/android/inputmethod/latin/personalization/DynamicPersonalizationDictionaryWriter.java deleted file mode 100644 index 6f152bb91..000000000 --- a/java/src/com/android/inputmethod/latin/personalization/DynamicPersonalizationDictionaryWriter.java +++ /dev/null @@ -1,190 +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. - */ - -package com.android.inputmethod.latin.personalization; - -import android.content.Context; - -import com.android.inputmethod.annotations.UsedForTesting; -import com.android.inputmethod.compat.ActivityManagerCompatUtils; -import com.android.inputmethod.keyboard.ProximityInfo; -import com.android.inputmethod.latin.AbstractDictionaryWriter; -import com.android.inputmethod.latin.ExpandableDictionary; -import com.android.inputmethod.latin.WordComposer; -import com.android.inputmethod.latin.ExpandableDictionary.NextWord; -import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; -import com.android.inputmethod.latin.makedict.DictEncoder; -import com.android.inputmethod.latin.makedict.FormatSpec; -import com.android.inputmethod.latin.makedict.UnsupportedFormatException; -import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils; -import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils.BigramDictionaryInterface; -import com.android.inputmethod.latin.utils.UserHistoryForgettingCurveUtils; -import com.android.inputmethod.latin.utils.UserHistoryForgettingCurveUtils.ForgettingCurveParams; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Map; - -// Currently this class is used to implement dynamic prodiction dictionary. -// TODO: Move to native code. -public class DynamicPersonalizationDictionaryWriter extends AbstractDictionaryWriter { - private static final String TAG = DynamicPersonalizationDictionaryWriter.class.getSimpleName(); - /** Maximum number of pairs. Pruning will start when databases goes above this number. */ - public static final int DEFAULT_MAX_HISTORY_BIGRAMS = 10000; - public static final int LOW_MEMORY_MAX_HISTORY_BIGRAMS = 2000; - - /** Any pair being typed or picked */ - private static final int FREQUENCY_FOR_TYPED = 2; - - private static final int BINARY_DICT_VERSION = 3; - private static final FormatSpec.FormatOptions FORMAT_OPTIONS = - new FormatSpec.FormatOptions(BINARY_DICT_VERSION, true /* supportsDynamicUpdate */); - - private final UserHistoryDictionaryBigramList mBigramList = - new UserHistoryDictionaryBigramList(); - private final ExpandableDictionary mExpandableDictionary; - private final int mMaxHistoryBigrams; - - public DynamicPersonalizationDictionaryWriter(final Context context, final String dictType) { - super(context, dictType); - mExpandableDictionary = new ExpandableDictionary(dictType); - final boolean isLowRamDevice = ActivityManagerCompatUtils.isLowRamDevice(context); - mMaxHistoryBigrams = isLowRamDevice ? - LOW_MEMORY_MAX_HISTORY_BIGRAMS : DEFAULT_MAX_HISTORY_BIGRAMS; - } - - @Override - public void clear() { - mBigramList.evictAll(); - mExpandableDictionary.clearDictionary(); - } - - /** - * Adds a word unigram to the fusion dictionary. Call updateBinaryDictionary when all changes - * are done to update the binary dictionary. - * @param word The word to add. - * @param shortcutTarget A shortcut target for this word, or null if none. - * @param frequency The frequency for this unigram. - * @param shortcutFreq The frequency of the shortcut (0~15, with 15 = whitelist). Ignored - * if shortcutTarget is null. - * @param isNotAWord true if this is not a word, i.e. shortcut only. - */ - @Override - public void addUnigramWord(final String word, final String shortcutTarget, final int frequency, - final int shortcutFreq, final boolean isNotAWord) { - if (mBigramList.size() > mMaxHistoryBigrams * 2) { - // Too many entries: just stop adding new vocabulary and wait next refresh. - return; - } - mExpandableDictionary.addWord(word, shortcutTarget, frequency, shortcutFreq); - mBigramList.addBigram(null, word, (byte)frequency); - } - - @Override - public void addBigramWords(final String word0, final String word1, final int frequency, - final boolean isValid, final long lastModifiedTime) { - if (mBigramList.size() > mMaxHistoryBigrams * 2) { - // Too many entries: just stop adding new vocabulary and wait next refresh. - return; - } - if (lastModifiedTime > 0) { - mExpandableDictionary.setBigramAndGetFrequency(word0, word1, - new ForgettingCurveParams(frequency, System.currentTimeMillis(), - lastModifiedTime)); - mBigramList.addBigram(word0, word1, (byte)frequency); - } else { - mExpandableDictionary.setBigramAndGetFrequency(word0, word1, - new ForgettingCurveParams(isValid)); - mBigramList.addBigram(word0, word1, (byte)frequency); - } - } - - @Override - public void removeBigramWords(final String word0, final String word1) { - if (mBigramList.removeBigram(word0, word1)) { - mExpandableDictionary.removeBigram(word0, word1); - } - } - - @Override - protected void writeDictionary(final DictEncoder dictEncoder, - final Map<String, String> attributeMap) throws IOException, UnsupportedFormatException { - UserHistoryDictIOUtils.writeDictionary(dictEncoder, - new FrequencyProvider(mBigramList, mExpandableDictionary, mMaxHistoryBigrams), - mBigramList, FORMAT_OPTIONS); - } - - private static class FrequencyProvider implements BigramDictionaryInterface { - private final UserHistoryDictionaryBigramList mBigramList; - private final ExpandableDictionary mExpandableDictionary; - private final int mMaxHistoryBigrams; - - public FrequencyProvider(final UserHistoryDictionaryBigramList bigramList, - final ExpandableDictionary expandableDictionary, final int maxHistoryBigrams) { - mBigramList = bigramList; - mExpandableDictionary = expandableDictionary; - mMaxHistoryBigrams = maxHistoryBigrams; - } - - @Override - public int getFrequency(final String word0, final String word1) { - final int freq; - if (word0 == null) { // unigram - freq = FREQUENCY_FOR_TYPED; - } else { // bigram - final NextWord nw = mExpandableDictionary.getBigramWord(word0, word1); - if (nw != null) { - final ForgettingCurveParams forgettingCurveParams = nw.getFcParams(); - final byte prevFc = mBigramList.getBigrams(word0).get(word1); - final byte fc = forgettingCurveParams.getFc(); - final boolean isValid = forgettingCurveParams.isValid(); - if (prevFc > 0 && prevFc == fc) { - freq = fc & 0xFF; - } else if (UserHistoryForgettingCurveUtils. - needsToSave(fc, isValid, mBigramList.size() <= mMaxHistoryBigrams)) { - freq = fc & 0xFF; - } else { - // Delete this entry - freq = -1; - } - } else { - // Delete this entry - freq = -1; - } - } - return freq; - } - } - - @Override - public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer, - final String prevWord, final ProximityInfo proximityInfo, - boolean blockOffensiveWords, final int[] additionalFeaturesOptions) { - return mExpandableDictionary.getSuggestions(composer, prevWord, proximityInfo, - blockOffensiveWords, additionalFeaturesOptions); - } - - @Override - public boolean isValidWord(final String word) { - return mExpandableDictionary.isValidWord(word); - } - - @UsedForTesting - public boolean isInBigramListForTests(final String word) { - // TODO: Use native method to determine whether the word is in dictionary or not - return mBigramList.containsKey(word) || mBigramList.getBigrams(null).containsKey(word); - } -} diff --git a/java/src/com/android/inputmethod/latin/settings/DebugSettings.java b/java/src/com/android/inputmethod/latin/settings/DebugSettings.java index 1b592b565..da1fb73fe 100644 --- a/java/src/com/android/inputmethod/latin/settings/DebugSettings.java +++ b/java/src/com/android/inputmethod/latin/settings/DebugSettings.java @@ -113,9 +113,7 @@ public final class DebugSettings extends PreferenceFragment mServiceNeedsRestart = true; } } else if (key.equals(PREF_FORCE_NON_DISTINCT_MULTITOUCH) - || key.equals(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT)) { - mServiceNeedsRestart = true; - } else if (key.equals(PREF_USE_ONLY_PERSONALIZATION_DICTIONARY_FOR_DEBUG)) { + || key.equals(PREF_USE_ONLY_PERSONALIZATION_DICTIONARY_FOR_DEBUG)) { mServiceNeedsRestart = true; } } diff --git a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java index acd47450b..0e1a33a6c 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java +++ b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java @@ -75,7 +75,7 @@ public final class MoreSuggestions extends Keyboard { while (index < size) { final String word = suggestedWords.getWord(index); // TODO: Should take care of text x-scaling. - mWidths[index] = (int)(TypefaceUtils.getLabelWidth(word, paint) + padding); + mWidths[index] = (int)(TypefaceUtils.getStringWidth(word, paint) + padding); final int numColumn = index - rowStartIndex + 1; final int columnWidth = (maxWidth - mDividerWidth * (numColumn - 1)) / numColumn; diff --git a/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java b/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java index d87f6f3c4..ef1d0f42c 100644 --- a/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java @@ -17,21 +17,25 @@ package com.android.inputmethod.latin.utils; import static com.android.inputmethod.latin.Constants.Subtype.KEYBOARD_MODE; +import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.EMOJI_CAPABLE; import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.IS_ADDITIONAL_SUBTYPE; import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.KEYBOARD_LAYOUT_SET; import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME; import android.os.Build; import android.text.TextUtils; +import android.util.Log; import android.view.inputmethod.InputMethodSubtype; import com.android.inputmethod.compat.InputMethodSubtypeCompatUtils; -import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.R; import java.util.ArrayList; +import java.util.Arrays; public final class AdditionalSubtypeUtils { + private static final String TAG = AdditionalSubtypeUtils.class.getSimpleName(); + private static final InputMethodSubtype[] EMPTY_SUBTYPE_ARRAY = new InputMethodSubtype[0]; private AdditionalSubtypeUtils() { @@ -43,6 +47,11 @@ public final class AdditionalSubtypeUtils { } private static final String LOCALE_AND_LAYOUT_SEPARATOR = ":"; + private static final int INDEX_OF_LOCALE = 0; + private static final int INDEX_OF_KEYBOARD_LAYOUT = 1; + private static final int INDEX_OF_EXTRA_VALUE = 2; + private static final int LENGTH_WITHOUT_EXTRA_VALUE = (INDEX_OF_KEYBOARD_LAYOUT + 1); + private static final int LENGTH_WITH_EXTRA_VALUE = (INDEX_OF_EXTRA_VALUE + 1); private static final String PREF_SUBTYPE_SEPARATOR = ";"; public static InputMethodSubtype createAdditionalSubtype(final String localeString, @@ -79,17 +88,6 @@ public final class AdditionalSubtypeUtils { : basePrefSubtype + LOCALE_AND_LAYOUT_SEPARATOR + extraValue; } - public static InputMethodSubtype createAdditionalSubtype(final String prefSubtype) { - final String elems[] = prefSubtype.split(LOCALE_AND_LAYOUT_SEPARATOR); - if (elems.length < 2 || elems.length > 3) { - throw new RuntimeException("Unknown additional subtype specified: " + prefSubtype); - } - final String localeString = elems[0]; - final String keyboardLayoutSetName = elems[1]; - final String extraValue = (elems.length == 3) ? elems[2] : null; - return createAdditionalSubtype(localeString, keyboardLayoutSetName, extraValue); - } - public static InputMethodSubtype[] createAdditionalSubtypesArray(final String prefSubtypes) { if (TextUtils.isEmpty(prefSubtypes)) { return EMPTY_SUBTYPE_ARRAY; @@ -98,7 +96,19 @@ public final class AdditionalSubtypeUtils { final ArrayList<InputMethodSubtype> subtypesList = CollectionUtils.newArrayList(prefSubtypeArray.length); for (final String prefSubtype : prefSubtypeArray) { - final InputMethodSubtype subtype = createAdditionalSubtype(prefSubtype); + final String elems[] = prefSubtype.split(LOCALE_AND_LAYOUT_SEPARATOR); + if (elems.length != LENGTH_WITHOUT_EXTRA_VALUE + && elems.length != LENGTH_WITH_EXTRA_VALUE) { + Log.w(TAG, "Unknown additional subtype specified: " + prefSubtype + " in " + + prefSubtypes); + continue; + } + final String localeString = elems[INDEX_OF_LOCALE]; + final String keyboardLayoutSetName = elems[INDEX_OF_KEYBOARD_LAYOUT]; + final String extraValue = (elems.length == LENGTH_WITH_EXTRA_VALUE) + ? elems[INDEX_OF_EXTRA_VALUE] : null; + final InputMethodSubtype subtype = createAdditionalSubtype( + localeString, keyboardLayoutSetName, extraValue); if (subtype.getNameResId() == SubtypeLocaleUtils.UNKNOWN_KEYBOARD_LAYOUT) { // Skip unknown keyboard layout subtype. This may happen when predefined keyboard // layout has been removed. @@ -137,31 +147,36 @@ public final class AdditionalSubtypeUtils { return sb.toString(); } - private static InputMethodSubtype buildInputMethodSubtype(int nameId, String localeString, - String layoutExtraValue, String additionalSubtypeExtraValue) { - // CAVEAT! If you want to change subtypeId after changing the extra values, - // you must change "getInputMethodSubtypeId". But it will remove the additional keyboard - // from the current users. So, you should be really careful to change it. - final int subtypeId = getInputMethodSubtypeId(nameId, localeString, layoutExtraValue, - additionalSubtypeExtraValue); + private static InputMethodSubtype buildInputMethodSubtype(final int nameId, + final String localeString, final String layoutExtraValue, + final String additionalSubtypeExtraValue) { + // To preserve additional subtype settings and user's selection across OS updates, subtype + // id shouldn't be changed. New attributes, such as emojiCapable, are carefully excluded + // from the calculation of subtype id. + final String compatibleExtraValue = StringUtils.joinCommaSplittableText( + layoutExtraValue, additionalSubtypeExtraValue); + final int compatibleSubtypeId = getInputMethodSubtypeId(localeString, compatibleExtraValue); final String extraValue; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - extraValue = layoutExtraValue + "," + additionalSubtypeExtraValue - + "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE - + "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE; + // Color Emoji is supported from KitKat. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + extraValue = StringUtils.appendToCommaSplittableTextIfNotExists( + EMOJI_CAPABLE, compatibleExtraValue); } else { - extraValue = layoutExtraValue + "," + additionalSubtypeExtraValue; + extraValue = compatibleExtraValue; } return InputMethodSubtypeCompatUtils.newInputMethodSubtype(nameId, R.drawable.ic_ime_switcher_dark, localeString, KEYBOARD_MODE, extraValue, - false, false, subtypeId); + false, false, compatibleSubtypeId); } - private static int getInputMethodSubtypeId(int nameId, String localeString, - String layoutExtraValue, String additionalSubtypeExtraValue) { - // TODO: Use InputMethodSubtypeBuilder once we use SDK version 19. - return (new InputMethodSubtype(nameId, R.drawable.ic_ime_switcher_dark, - localeString, KEYBOARD_MODE, layoutExtraValue + "," + additionalSubtypeExtraValue, - false, false)).hashCode(); + private static int getInputMethodSubtypeId(final String localeString, final String extraValue) { + // From the compatibility point of view, the calculation of subtype id has been copied from + // {@link InputMethodSubtype} of JellyBean MR2. + return Arrays.hashCode(new Object[] { + localeString, + KEYBOARD_MODE, + extraValue, + false /* isAuxiliary */, + false /* overrideImplicitlyEnabledSubtype */ }); } } diff --git a/java/src/com/android/inputmethod/latin/utils/StringUtils.java b/java/src/com/android/inputmethod/latin/utils/StringUtils.java index a36548392..4cc89d0a7 100644 --- a/java/src/com/android/inputmethod/latin/utils/StringUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/StringUtils.java @@ -39,6 +39,8 @@ public final class StringUtils { public static final int CAPITALIZE_FIRST = 1; // First only public static final int CAPITALIZE_ALL = 2; // All caps + private static final String EMPTY_STRING = ""; + private StringUtils() { // This utility class is not publicly instantiable. } @@ -80,6 +82,20 @@ public final class StringUtils { return containsInArray(text, extraValues.split(SEPARATOR_FOR_COMMA_SPLITTABLE_TEXT)); } + public static String joinCommaSplittableText(final String head, final String tail) { + if (TextUtils.isEmpty(head) && TextUtils.isEmpty(tail)) { + return EMPTY_STRING; + } + // Here either head or tail is not null. + if (TextUtils.isEmpty(head)) { + return tail; + } + if (TextUtils.isEmpty(tail)) { + return head; + } + return head + SEPARATOR_FOR_COMMA_SPLITTABLE_TEXT + tail; + } + public static String appendToCommaSplittableTextIfNotExists(final String text, final String extraValues) { if (TextUtils.isEmpty(extraValues)) { @@ -94,7 +110,7 @@ public final class StringUtils { public static String removeFromCommaSplittableTextIfExists(final String text, final String extraValues) { if (TextUtils.isEmpty(extraValues)) { - return ""; + return EMPTY_STRING; } final String[] elements = extraValues.split(SEPARATOR_FOR_COMMA_SPLITTABLE_TEXT); if (!containsInArray(text, elements)) { @@ -380,7 +396,7 @@ public final class StringUtils { @UsedForTesting public static String byteArrayToHexString(byte[] bytes) { if (bytes == null || bytes.length == 0) { - return ""; + return EMPTY_STRING; } final StringBuilder sb = new StringBuilder(); for (byte b : bytes) { @@ -444,7 +460,7 @@ public final class StringUtils { public static String listToJsonStr(List<Object> list) { if (list == null || list.isEmpty()) { - return ""; + return EMPTY_STRING; } final StringWriter sw = new StringWriter(); final JsonWriter writer = new JsonWriter(sw); @@ -470,6 +486,6 @@ public final class StringUtils { } catch (IOException e) { } } - return ""; + return EMPTY_STRING; } } diff --git a/java/src/com/android/inputmethod/latin/utils/TypefaceUtils.java b/java/src/com/android/inputmethod/latin/utils/TypefaceUtils.java index 47ea1ea75..087a7f255 100644 --- a/java/src/com/android/inputmethod/latin/utils/TypefaceUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/TypefaceUtils.java @@ -22,6 +22,9 @@ import android.graphics.Typeface; import android.util.SparseArray; public final class TypefaceUtils { + private static final char[] KEY_LABEL_REFERENCE_CHAR = { 'M' }; + private static final char[] KEY_NUMERIC_HINT_LABEL_REFERENCE_CHAR = { '8' }; + private TypefaceUtils() { // This utility class is not publicly instantiable. } @@ -31,7 +34,7 @@ public final class TypefaceUtils { // Working variable for the following method. private static final Rect sTextHeightBounds = new Rect(); - public static float getCharHeight(final char[] referenceChar, final Paint paint) { + private static float getCharHeight(final char[] referenceChar, final Paint paint) { final int key = getCharGeometryCacheKey(referenceChar[0], paint); synchronized (sTextHeightCache) { final Float cachedValue = sTextHeightCache.get(key); @@ -51,7 +54,7 @@ public final class TypefaceUtils { // Working variable for the following method. private static final Rect sTextWidthBounds = new Rect(); - public static float getCharWidth(final char[] referenceChar, final Paint paint) { + private static float getCharWidth(final char[] referenceChar, final Paint paint) { final int key = getCharGeometryCacheKey(referenceChar[0], paint); synchronized (sTextWidthCache) { final Float cachedValue = sTextWidthCache.get(key); @@ -66,11 +69,6 @@ public final class TypefaceUtils { } } - public static float getStringWidth(final String string, final Paint paint) { - paint.getTextBounds(string, 0, string.length(), sTextWidthBounds); - return sTextWidthBounds.width(); - } - private static int getCharGeometryCacheKey(final char referenceChar, final Paint paint) { final int labelSize = (int)paint.getTextSize(); final Typeface face = paint.getTypeface(); @@ -86,9 +84,25 @@ public final class TypefaceUtils { } } - public static float getLabelWidth(final String label, final Paint paint) { - final Rect textBounds = new Rect(); - paint.getTextBounds(label, 0, label.length(), textBounds); - return textBounds.width(); + public static float getReferenceCharHeight(final Paint paint) { + return getCharHeight(KEY_LABEL_REFERENCE_CHAR, paint); + } + + public static float getReferenceCharWidth(final Paint paint) { + return getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint); + } + + public static float getReferenceDigitWidth(final Paint paint) { + return getCharWidth(KEY_NUMERIC_HINT_LABEL_REFERENCE_CHAR, paint); + } + + // Working variable for the following method. + private static final Rect sStringWidthBounds = new Rect(); + + public static float getStringWidth(final String string, final Paint paint) { + synchronized (sStringWidthBounds) { + paint.getTextBounds(string, 0, string.length(), sStringWidthBounds); + return sStringWidthBounds.width(); + } } } diff --git a/native/jni/Android.mk b/native/jni/Android.mk index 333688015..b61a66ce6 100644 --- a/native/jni/Android.mk +++ b/native/jni/Android.mk @@ -68,26 +68,32 @@ LATIN_IME_CORE_SRC_FILES := \ suggest/core/policy/weighting.cpp \ suggest/core/session/dic_traverse_session.cpp \ $(addprefix suggest/policyimpl/dictionary/, \ - bigram/bigram_list_read_write_utils.cpp \ - bigram/dynamic_bigram_list_policy.cpp \ header/header_policy.cpp \ header/header_read_write_utils.cpp \ shortcut/shortcut_list_reading_utils.cpp \ structure/dictionary_structure_with_buffer_policy_factory.cpp) \ + $(addprefix suggest/policyimpl/dictionary/bigram/, \ + bigram_list_read_write_utils.cpp \ + dynamic_bigram_list_policy.cpp \ + ver4_bigram_list_policy.cpp) \ $(addprefix suggest/policyimpl/dictionary/structure/v2/, \ patricia_trie_policy.cpp \ patricia_trie_reading_utils.cpp) \ $(addprefix suggest/policyimpl/dictionary/structure/v3/, \ dynamic_patricia_trie_gc_event_listeners.cpp \ dynamic_patricia_trie_node_reader.cpp \ + dynamic_patricia_trie_node_writer.cpp \ dynamic_patricia_trie_policy.cpp \ dynamic_patricia_trie_reading_helper.cpp \ dynamic_patricia_trie_reading_utils.cpp \ + dynamic_patricia_trie_updating_helper.cpp \ dynamic_patricia_trie_writing_helper.cpp \ dynamic_patricia_trie_writing_utils.cpp) \ $(addprefix suggest/policyimpl/dictionary/structure/v4/, \ + content/bigram_dict_content.cpp \ ver4_dict_constants.cpp \ ver4_patricia_trie_node_reader.cpp \ + ver4_patricia_trie_node_writer.cpp \ ver4_patricia_trie_policy.cpp \ ver4_patricia_trie_reading_utils.cpp ) \ $(addprefix suggest/policyimpl/dictionary/utils/, \ diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp index 3becc7e39..c4383d754 100644 --- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp +++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp @@ -86,10 +86,10 @@ static jlong latinime_BinaryDictionary_open(JNIEnv *env, jclass clazz, jstring s char sourceDirChars[sourceDirUtf8Length + 1]; env->GetStringUTFRegion(sourceDir, 0, env->GetStringLength(sourceDir), sourceDirChars); sourceDirChars[sourceDirUtf8Length] = '\0'; - DictionaryStructureWithBufferPolicy::StructurePoilcyPtr dictionaryStructureWithBufferPolicy( + DictionaryStructureWithBufferPolicy::StructurePoilcyPtr dictionaryStructureWithBufferPolicy = DictionaryStructureWithBufferPolicyFactory::newDictionaryStructureWithBufferPolicy( sourceDirChars, static_cast<int>(dictOffset), static_cast<int>(dictSize), - isUpdatable == JNI_TRUE)); + isUpdatable == JNI_TRUE); if (!dictionaryStructureWithBufferPolicy.get()) { return 0; } diff --git a/native/jni/src/suggest/policyimpl/dictionary/bigram/ver4_bigram_list_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/bigram/ver4_bigram_list_policy.cpp new file mode 100644 index 000000000..94d7f1061 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/bigram/ver4_bigram_list_policy.cpp @@ -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. + */ + +#include "suggest/policyimpl/dictionary/bigram/ver4_bigram_list_policy.h" + +#include "suggest/policyimpl/dictionary/bigram/bigram_list_read_write_utils.h" +#include "suggest/policyimpl/dictionary/structure/v4/content/bigram_dict_content.h" +#include "suggest/policyimpl/dictionary/structure/v4/content/terminal_position_lookup_table.h" +#include "suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.h" + +namespace latinime { + +void Ver4BigramListPolicy::getNextBigram(int *const outBigramPos, int *const outProbability, + bool *const outHasNext, int *const bigramEntryPos) const { + int targetTerminalId = Ver4DictConstants::NOT_A_TERMINAL_ID; + mBigramDictContent->getBigramEntryAndAdvancePosition(outProbability, outHasNext, + &targetTerminalId, bigramEntryPos); + if (outBigramPos) { + // Lookup target PtNode position. + *outBigramPos = mTerminalPositionLookupTable->getTerminalPtNodePosition(targetTerminalId); + } +} + +bool Ver4BigramListPolicy::addNewEntry(const int terminalId, const int newTargetTerminalId, + const int newProbability, bool *const outAddedNewEntry) { + if (outAddedNewEntry) { + *outAddedNewEntry = false; + } + const int bigramListPos = mBigramDictContent->getBigramListHeadPos(terminalId); + if (bigramListPos == NOT_A_DICT_POS) { + // Updating PtNode doesn't have a bigram list. + // Create new bigram list. + if (!mBigramDictContent->createNewBigramList(terminalId)) { + return false; + } + // Write an entry. + int writingPos = mBigramDictContent->getBigramListHeadPos(terminalId); + if (!mBigramDictContent->writeBigramEntryAndAdvancePosition(newProbability, + false /* hasNext */, newTargetTerminalId, &writingPos)) { + return false; + } + return true; + } + + const int entryPosToUpdate = getEntryPosToUpdate(newTargetTerminalId, bigramListPos); + if (entryPosToUpdate != NOT_A_DICT_POS) { + // Overwrite existing entry. + int readingPos = entryPosToUpdate; + bool hasNext = false; + int probability = NOT_A_PROBABILITY; + int targetTerminalId = Ver4DictConstants::NOT_A_TERMINAL_ID; + mBigramDictContent->getBigramEntryAndAdvancePosition(&probability, &hasNext, + &targetTerminalId, &readingPos); + if (targetTerminalId == Ver4DictConstants::NOT_A_TERMINAL_ID && outAddedNewEntry) { + // Reuse invalid entry. + *outAddedNewEntry = true; + } + int writingPos = entryPosToUpdate; + return mBigramDictContent->writeBigramEntryAndAdvancePosition(newProbability, hasNext, + newTargetTerminalId, &writingPos); + } + + // Add new entry to the bigram list. + // Create new bigram list. + if (!mBigramDictContent->createNewBigramList(terminalId)) { + return false; + } + // Write new entry at a head position of the bigram list. + int writingPos = mBigramDictContent->getBigramListHeadPos(terminalId); + if (!mBigramDictContent->writeBigramEntryAndAdvancePosition(newProbability, + true /* hasNext */, newTargetTerminalId, &writingPos)) { + return false; + } + if (outAddedNewEntry) { + *outAddedNewEntry = true; + } + // Append existing entries by copying. + return mBigramDictContent->copyBigramList(bigramListPos, writingPos); +} + +bool Ver4BigramListPolicy::removeEntry(const int terminalId, const int targetTerminalId) { + const int bigramListPos = mBigramDictContent->getBigramListHeadPos(terminalId); + if (bigramListPos == NOT_A_DICT_POS) { + // Bigram list does't exist. + return false; + } + const int entryPosToUpdate = getEntryPosToUpdate(targetTerminalId, bigramListPos); + if (entryPosToUpdate == NOT_A_DICT_POS) { + // Bigram entry doesn't exist. + return false; + } + int readingPos = entryPosToUpdate; + bool hasNext = false; + int probability = NOT_A_PROBABILITY; + int originalTargetTerminalId = Ver4DictConstants::NOT_A_TERMINAL_ID; + mBigramDictContent->getBigramEntryAndAdvancePosition(&probability, &hasNext, + &originalTargetTerminalId, &readingPos); + if (targetTerminalId != originalTargetTerminalId) { + // Bigram entry doesn't exist. + return false; + } + int writingPos = entryPosToUpdate; + // Remove bigram entry by overwriting target terminal Id. + return mBigramDictContent->writeBigramEntryAndAdvancePosition(probability, hasNext, + Ver4DictConstants::NOT_A_TERMINAL_ID /* targetTerminalId */, &writingPos); +} + +int Ver4BigramListPolicy::getEntryPosToUpdate(const int targetTerminalIdToFind, + const int bigramListPos) const { + bool hasNext = true; + int invalidEntryPos = NOT_A_DICT_POS; + int readingPos = bigramListPos; + while(hasNext) { + const int entryPos = readingPos; + int targetTerminalId = Ver4DictConstants::NOT_A_TERMINAL_ID; + mBigramDictContent->getBigramEntryAndAdvancePosition(0 /* probability */, &hasNext, + &targetTerminalId, &readingPos); + if (targetTerminalId == targetTerminalIdToFind) { + // Entry with same target is found. + return entryPos; + } else if (targetTerminalId == Ver4DictConstants::NOT_A_TERMINAL_ID) { + // Invalid entry that can be reused is found. + invalidEntryPos = entryPos; + } + } + return invalidEntryPos; +} + +} // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/bigram/ver4_bigram_list_policy.h b/native/jni/src/suggest/policyimpl/dictionary/bigram/ver4_bigram_list_policy.h index 875a0ff9b..b3fe13d7d 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/bigram/ver4_bigram_list_policy.h +++ b/native/jni/src/suggest/policyimpl/dictionary/bigram/ver4_bigram_list_policy.h @@ -19,46 +19,37 @@ #include "defines.h" #include "suggest/core/policy/dictionary_bigrams_structure_policy.h" -#include "suggest/policyimpl/dictionary/bigram/bigram_list_read_write_utils.h" -#include "suggest/policyimpl/dictionary/structure/v4/content/bigram_dict_content.h" -#include "suggest/policyimpl/dictionary/structure/v4/content/terminal_position_lookup_table.h" namespace latinime { +class BigramDictContent; +class TerminalPositionLookupTable; + class Ver4BigramListPolicy : public DictionaryBigramsStructurePolicy { public: - Ver4BigramListPolicy(const BigramDictContent *const bigramDictContent, + Ver4BigramListPolicy(BigramDictContent *const bigramDictContent, const TerminalPositionLookupTable *const terminalPositionLookupTable) : mBigramDictContent(bigramDictContent), mTerminalPositionLookupTable(terminalPositionLookupTable) {} void getNextBigram(int *const outBigramPos, int *const outProbability, - bool *const outHasNext, int *const bigramEntryPos) const { - int bigramFlags = 0; - int targetTerminalId = Ver4DictConstants::NOT_A_TERMINAL_ID; - mBigramDictContent->getBigramEntryAndAdvancePosition(&bigramFlags, &targetTerminalId, - bigramEntryPos); - if (outProbability) { - *outProbability = BigramListReadWriteUtils::getProbabilityFromFlags(bigramFlags); - } - if (outHasNext) { - *outHasNext = BigramListReadWriteUtils::hasNext(bigramFlags); - } - if (outBigramPos) { - // Lookup target PtNode position. - *outBigramPos = - mTerminalPositionLookupTable->getTerminalPtNodePosition(targetTerminalId); - } - } + bool *const outHasNext, int *const bigramEntryPos) const; void skipAllBigrams(int *const pos) const { // Do nothing because we don't need to skip bigram lists in ver4 dictionaries. } + bool addNewEntry(const int terminalId, const int newTargetTerminalId, const int newProbability, + bool *const outAddedNewEntry); + + bool removeEntry(const int terminalId, const int targetTerminalId); + private: DISALLOW_IMPLICIT_CONSTRUCTORS(Ver4BigramListPolicy); - const BigramDictContent *const mBigramDictContent; + int getEntryPosToUpdate(const int targetTerminalIdToFind, const int bigramListPos) const; + + BigramDictContent *const mBigramDictContent; const TerminalPositionLookupTable *const mTerminalPositionLookupTable; }; } // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/shortcut/ver4_shortcut_list_policy.h b/native/jni/src/suggest/policyimpl/dictionary/shortcut/ver4_shortcut_list_policy.h new file mode 100644 index 000000000..12d3579fd --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/shortcut/ver4_shortcut_list_policy.h @@ -0,0 +1,71 @@ +/* + * 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_VER4_SHORTCUT_LIST_POLICY_H +#define LATINIME_VER4_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" +#include "suggest/policyimpl/dictionary/structure/v4/content/shortcut_dict_content.h" +#include "suggest/policyimpl/dictionary/structure/v4/content/terminal_position_lookup_table.h" + +namespace latinime { + +class Ver4ShortcutListPolicy : public DictionaryShortcutsStructurePolicy { + public: + Ver4ShortcutListPolicy(const ShortcutDictContent *const shortcutDictContent, + const TerminalPositionLookupTable *const terminalPositionLookupTable) + : mShortcutDictContent(shortcutDictContent), + mTerminalPositionLookupTable(terminalPositionLookupTable) {} + + ~Ver4ShortcutListPolicy() {} + + int getStartPos(const int pos) const { + // The first shortcut entry is located at the head position of the shortcut list. + return pos; + } + + void getNextShortcut(const int maxCodePointCount, int *const outCodePoint, + int *const outCodePointCount, bool *const outIsWhitelist, bool *const outHasNext, + int *const pos) const { + int shortcutFlags = 0; + if (outCodePoint && outCodePointCount) { + mShortcutDictContent->getShortcutEntryAndAdvancePosition(maxCodePointCount, + outCodePoint, outCodePointCount, &shortcutFlags, pos); + } + if (outHasNext) { + *outHasNext = ShortcutListReadingUtils::hasNext(shortcutFlags); + } + if (outIsWhitelist) { + *outIsWhitelist = ShortcutListReadingUtils::isWhitelist(shortcutFlags); + } + } + + void skipAllShortcuts(int *const pos) const { + // Do nothing because we don't need to skip shortcut lists in ver4 dictionaries. + } + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(Ver4ShortcutListPolicy); + + const ShortcutDictContent *const mShortcutDictContent; + const TerminalPositionLookupTable *const mTerminalPositionLookupTable; +}; +} // namespace latinime +#endif // LATINIME_VER4_SHORTCUT_LIST_POLICY_H diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/dictionary_structure_with_buffer_policy_factory.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/dictionary_structure_with_buffer_policy_factory.cpp index 3ab6a8e21..063b84cbf 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/dictionary_structure_with_buffer_policy_factory.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/dictionary_structure_with_buffer_policy_factory.cpp @@ -35,8 +35,8 @@ namespace latinime { const int bufOffset, const int size, const bool isUpdatable) { // Allocated buffer in MmapedBuffer::newBuffer() will be freed in the destructor of // MmappedBufferWrapper if the instance has the responsibility. - MmappedBuffer::MmappedBufferPtr mmappedBuffer(MmappedBuffer::openBuffer(path, bufOffset, size, - isUpdatable)); + MmappedBuffer::MmappedBufferPtr mmappedBuffer = MmappedBuffer::openBuffer(path, bufOffset, size, + isUpdatable); if (!mmappedBuffer.get()) { return DictionaryStructureWithBufferPolicy::StructurePoilcyPtr(0); } @@ -58,8 +58,8 @@ namespace latinime { } // Removing extension to get the base path. dictDirPath.erase(pos); - const Ver4DictBuffers::Ver4DictBuffersPtr dictBuffers( - Ver4DictBuffers::openVer4DictBuffers(dictDirPath.c_str(), mmappedBuffer)); + const Ver4DictBuffers::Ver4DictBuffersPtr dictBuffers = + Ver4DictBuffers::openVer4DictBuffers(dictDirPath.c_str(), mmappedBuffer); if (!dictBuffers.get()->isValid()) { AKLOGE("DICT: The dictionary doesn't satisfy ver4 format requirements."); ASSERT(false); diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/pt_common/pt_node_params.h b/native/jni/src/suggest/policyimpl/dictionary/structure/pt_common/pt_node_params.h index edc7b954c..6a4cfee3c 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/pt_common/pt_node_params.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/pt_common/pt_node_params.h @@ -86,6 +86,38 @@ class PtNodeParams { memcpy(mCodePoints, codePoints, sizeof(int) * mCodePointCount); } + // Construct new params by updating existing PtNode params. + PtNodeParams(const PtNodeParams *const ptNodeParams, + const PatriciaTrieReadingUtils::NodeFlags flags, const int parentPos, + const int codePointCount, const int *const codePoints, const int probability) + : mHeadPos(ptNodeParams->getHeadPos()), mFlags(flags), mParentPos(parentPos), + mCodePointCount(codePointCount), mCodePoints(), + mTerminalIdFieldPos(ptNodeParams->getTerminalIdFieldPos()), + mTerminalId(ptNodeParams->getTerminalId()), + mProbabilityFieldPos(ptNodeParams->getProbabilityFieldPos()), + mProbability(probability), + mChildrenPosFieldPos(ptNodeParams->getChildrenPosFieldPos()), + mChildrenPos(ptNodeParams->getChildrenPos()), + mBigramLinkedNodePos(ptNodeParams->getBigramLinkedNodePos()), + mShortcutPos(ptNodeParams->getShortcutPos()), + mBigramPos(ptNodeParams->getBigramsPos()), + mSiblingPos(ptNodeParams->getSiblingNodePos()) { + memcpy(mCodePoints, codePoints, sizeof(int) * mCodePointCount); + } + + PtNodeParams(const PatriciaTrieReadingUtils::NodeFlags flags, const int parentPos, + const int codePointCount, const int *const codePoints, const int probability) + : mHeadPos(NOT_A_DICT_POS), mFlags(flags), mParentPos(parentPos), + mCodePointCount(codePointCount), mCodePoints(), + mTerminalIdFieldPos(NOT_A_DICT_POS), + mTerminalId(Ver4DictConstants::NOT_A_TERMINAL_ID), + mProbabilityFieldPos(NOT_A_DICT_POS), mProbability(probability), + mChildrenPosFieldPos(NOT_A_DICT_POS), mChildrenPos(NOT_A_DICT_POS), + mBigramLinkedNodePos(NOT_A_DICT_POS), mShortcutPos(NOT_A_DICT_POS), + mBigramPos(NOT_A_DICT_POS), mSiblingPos(NOT_A_DICT_POS) { + memcpy(mCodePoints, codePoints, sizeof(int) * mCodePointCount); + } + AK_FORCE_INLINE bool isValid() const { return mCodePointCount > 0; } diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/pt_common/pt_node_writer.h b/native/jni/src/suggest/policyimpl/dictionary/structure/pt_common/pt_node_writer.h new file mode 100644 index 000000000..0f1e635bc --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/pt_common/pt_node_writer.h @@ -0,0 +1,59 @@ +/* + * 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_PT_NODE_WRITER_H +#define LATINIME_PT_NODE_WRITER_H + +#include "defines.h" + +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_params.h" + +namespace latinime { + +// Interface class used to write PtNode information. +class PtNodeWriter { + public: + virtual ~PtNodeWriter() {} + + virtual bool markPtNodeAsDeleted(const PtNodeParams *const toBeUpdatedPtNodeParams) = 0; + + virtual bool markPtNodeAsMoved(const PtNodeParams *const toBeUpdatedPtNodeParams, + const int movedPos, const int bigramLinkedNodePos) = 0; + + virtual bool updatePtNodeProbability(const PtNodeParams *const toBeUpdatedPtNodeParams, + const int probability) = 0; + + virtual bool updateChildrenPosition(const PtNodeParams *const toBeUpdatedPtNodeParams, + const int newChildrenPosition) = 0; + + virtual bool writePtNodeAndAdvancePosition(const PtNodeParams *const ptNodeParams, + int *const ptNodeWritingPos) = 0; + + virtual bool addNewBigramEntry(const PtNodeParams *const sourcePtNodeParams, + const PtNodeParams *const targetPtNodeParam, const int probability, + bool *const outAddedNewBigram) = 0; + + virtual bool removeBigramEntry(const PtNodeParams *const sourcePtNodeParams, + const PtNodeParams *const targetPtNodeParam) = 0; + + protected: + PtNodeWriter() {}; + + private: + DISALLOW_COPY_AND_ASSIGN(PtNodeWriter); +}; +} // namespace latinime +#endif /* LATINIME_PT_NODE_WRITER_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_gc_event_listeners.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_gc_event_listeners.cpp index db4e86da1..a252c6fb2 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_gc_event_listeners.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_gc_event_listeners.cpp @@ -18,6 +18,8 @@ #include "suggest/core/policy/dictionary_header_structure_policy.h" #include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_params.h" +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_writer.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_utils.h" #include "suggest/policyimpl/dictionary/utils/forgetting_curve_utils.h" namespace latinime { @@ -54,7 +56,7 @@ bool DynamicPatriciaTrieGcEventListeners } if (isUselessPtNode) { // Current PtNode is no longer needed. Mark it as deleted. - if (!mWritingHelper->markNodeAsDeleted(ptNodeParams)) { + if (!mPtNodeWriter->markPtNodeAsDeleted(ptNodeParams)) { return false; } } else { @@ -130,9 +132,7 @@ bool DynamicPatriciaTrieGcEventListeners::TraversePolicyToPlaceAndWriteValidPtNo ptNodeParams->getHeadPos(), writingPos)); mValidPtNodeCount++; // Writes current PtNode. - return mWritingHelper->writePtNodeToBufferByCopyingPtNodeInfo(mBufferToWrite, ptNodeParams, - ptNodeParams->getParentPos(), ptNodeParams->getCodePoints(), - ptNodeParams->getCodePointCount(), ptNodeParams->getProbability(), &writingPos); + return mPtNodeWriter->writePtNodeAndAdvancePosition(ptNodeParams, &writingPos); } bool DynamicPatriciaTrieGcEventListeners::TraversePolicyToUpdateAllPositionFields diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_gc_event_listeners.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_gc_event_listeners.h index cfe3c145c..a0b3b4d3a 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_gc_event_listeners.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_gc_event_listeners.h @@ -23,13 +23,13 @@ #include "suggest/policyimpl/dictionary/bigram/dynamic_bigram_list_policy.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.h" -#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_utils.h" #include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" #include "utils/hash_map_compat.h" namespace latinime { class DictionaryHeaderStructurePolicy; +class PtNodeWriter; class PtNodeParams; class DynamicPatriciaTrieGcEventListeners { @@ -42,9 +42,9 @@ class DynamicPatriciaTrieGcEventListeners { public: TraversePolicyToUpdateUnigramProbabilityAndMarkUselessPtNodesAsDeleted( const DictionaryHeaderStructurePolicy *const headerPolicy, - DynamicPatriciaTrieWritingHelper *const writingHelper, - BufferWithExtendableBuffer *const buffer, const bool isDecayingDict) - : mHeaderPolicy(headerPolicy), mWritingHelper(writingHelper), mBuffer(buffer), + PtNodeWriter *const ptNodeWriter, BufferWithExtendableBuffer *const buffer, + const bool isDecayingDict) + : mHeaderPolicy(headerPolicy), mPtNodeWriter(ptNodeWriter), mBuffer(buffer), mIsDecayingDict(isDecayingDict), mValueStack(), mChildrenValue(0), mValidUnigramCount(0) {} @@ -78,7 +78,7 @@ class DynamicPatriciaTrieGcEventListeners { TraversePolicyToUpdateUnigramProbabilityAndMarkUselessPtNodesAsDeleted); const DictionaryHeaderStructurePolicy *const mHeaderPolicy; - DynamicPatriciaTrieWritingHelper *const mWritingHelper; + PtNodeWriter *const mPtNodeWriter; BufferWithExtendableBuffer *const mBuffer; const bool mIsDecayingDict; std::vector<int> mValueStack; @@ -118,11 +118,10 @@ class DynamicPatriciaTrieGcEventListeners { : public DynamicPatriciaTrieReadingHelper::TraversingEventListener { public: TraversePolicyToPlaceAndWriteValidPtNodesToBuffer( - DynamicPatriciaTrieWritingHelper *const writingHelper, - BufferWithExtendableBuffer *const bufferToWrite, + PtNodeWriter *const ptNodeWriter, BufferWithExtendableBuffer *const bufferToWrite, DynamicPatriciaTrieWritingHelper::DictPositionRelocationMap *const dictPositionRelocationMap) - : mWritingHelper(writingHelper), mBufferToWrite(bufferToWrite), + : mPtNodeWriter(ptNodeWriter), mBufferToWrite(bufferToWrite), mDictPositionRelocationMap(dictPositionRelocationMap), mValidPtNodeCount(0), mPtNodeArraySizeFieldPos(NOT_A_DICT_POS) {}; @@ -137,7 +136,7 @@ class DynamicPatriciaTrieGcEventListeners { private: DISALLOW_IMPLICIT_CONSTRUCTORS(TraversePolicyToPlaceAndWriteValidPtNodesToBuffer); - DynamicPatriciaTrieWritingHelper *const mWritingHelper; + PtNodeWriter *const mPtNodeWriter; BufferWithExtendableBuffer *const mBufferToWrite; DynamicPatriciaTrieWritingHelper::DictPositionRelocationMap *const mDictPositionRelocationMap; @@ -149,13 +148,11 @@ class DynamicPatriciaTrieGcEventListeners { : public DynamicPatriciaTrieReadingHelper::TraversingEventListener { public: TraversePolicyToUpdateAllPositionFields( - DynamicPatriciaTrieWritingHelper *const writingHelper, DynamicBigramListPolicy *const bigramPolicy, BufferWithExtendableBuffer *const bufferToWrite, const DynamicPatriciaTrieWritingHelper::DictPositionRelocationMap *const dictPositionRelocationMap) - : mWritingHelper(writingHelper), mBigramPolicy(bigramPolicy), - mBufferToWrite(bufferToWrite), + : mBigramPolicy(bigramPolicy), mBufferToWrite(bufferToWrite), mDictPositionRelocationMap(dictPositionRelocationMap), mUnigramCount(0), mBigramCount(0) {}; @@ -178,7 +175,6 @@ class DynamicPatriciaTrieGcEventListeners { private: DISALLOW_IMPLICIT_CONSTRUCTORS(TraversePolicyToUpdateAllPositionFields); - DynamicPatriciaTrieWritingHelper *const mWritingHelper; DynamicBigramListPolicy *const mBigramPolicy; BufferWithExtendableBuffer *const mBufferToWrite; const DynamicPatriciaTrieWritingHelper::DictPositionRelocationMap *const diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_writer.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_writer.cpp new file mode 100644 index 000000000..3b1e16cc7 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_writer.cpp @@ -0,0 +1,236 @@ +/* + * 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/structure/v3/dynamic_patricia_trie_node_writer.h" + +#include "suggest/policyimpl/dictionary/bigram/dynamic_bigram_list_policy.h" +#include "suggest/policyimpl/dictionary/shortcut/dynamic_shortcut_list_policy.h" +#include "suggest/policyimpl/dictionary/structure/v2/patricia_trie_reading_utils.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_reader.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_utils.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_utils.h" +#include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" + +namespace latinime { + +const int DynamicPatriciaTrieNodeWriter::CHILDREN_POSITION_FIELD_SIZE = 3; + +bool DynamicPatriciaTrieNodeWriter::markPtNodeAsDeleted( + const PtNodeParams *const toBeUpdatedPtNodeParams) { + int pos = toBeUpdatedPtNodeParams->getHeadPos(); + const bool usesAdditionalBuffer = mBuffer->isInAdditionalBuffer(pos); + const uint8_t *const dictBuf = mBuffer->getBuffer(usesAdditionalBuffer); + if (usesAdditionalBuffer) { + pos -= mBuffer->getOriginalBufferSize(); + } + // Read original flags + const PatriciaTrieReadingUtils::NodeFlags originalFlags = + PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictBuf, &pos); + const PatriciaTrieReadingUtils::NodeFlags updatedFlags = + DynamicPatriciaTrieReadingUtils::updateAndGetFlags(originalFlags, false /* isMoved */, + true /* isDeleted */); + int writingPos = toBeUpdatedPtNodeParams->getHeadPos(); + // Update flags. + return DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mBuffer, updatedFlags, + &writingPos); +} + +bool DynamicPatriciaTrieNodeWriter::markPtNodeAsMoved( + const PtNodeParams *const toBeUpdatedPtNodeParams, + const int movedPos, const int bigramLinkedNodePos) { + int pos = toBeUpdatedPtNodeParams->getHeadPos(); + const bool usesAdditionalBuffer = mBuffer->isInAdditionalBuffer(pos); + const uint8_t *const dictBuf = mBuffer->getBuffer(usesAdditionalBuffer); + if (usesAdditionalBuffer) { + pos -= mBuffer->getOriginalBufferSize(); + } + // Read original flags + const PatriciaTrieReadingUtils::NodeFlags originalFlags = + PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictBuf, &pos); + const PatriciaTrieReadingUtils::NodeFlags updatedFlags = + DynamicPatriciaTrieReadingUtils::updateAndGetFlags(originalFlags, true /* isMoved */, + false /* isDeleted */); + int writingPos = toBeUpdatedPtNodeParams->getHeadPos(); + // Update flags. + if (!DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mBuffer, updatedFlags, + &writingPos)) { + return false; + } + // Update moved position, which is stored in the parent offset field. + if (!DynamicPatriciaTrieWritingUtils::writeParentPosOffsetAndAdvancePosition( + mBuffer, movedPos, toBeUpdatedPtNodeParams->getHeadPos(), &writingPos)) { + return false; + } + // Update bigram linked node position, which is stored in the children position field. + int childrenPosFieldPos = toBeUpdatedPtNodeParams->getChildrenPosFieldPos(); + if (!DynamicPatriciaTrieWritingUtils::writeChildrenPositionAndAdvancePosition( + mBuffer, bigramLinkedNodePos, &childrenPosFieldPos)) { + return false; + } + if (toBeUpdatedPtNodeParams->hasChildren()) { + // Update children's parent position. + mReadingHelper.initWithPtNodeArrayPos(toBeUpdatedPtNodeParams->getChildrenPos()); + while (!mReadingHelper.isEnd()) { + const PtNodeParams childPtNodeParams(mReadingHelper.getPtNodeParams()); + int parentOffsetFieldPos = childPtNodeParams.getHeadPos() + + DynamicPatriciaTrieWritingUtils::NODE_FLAG_FIELD_SIZE; + if (!DynamicPatriciaTrieWritingUtils::writeParentPosOffsetAndAdvancePosition( + mBuffer, bigramLinkedNodePos, childPtNodeParams.getHeadPos(), + &parentOffsetFieldPos)) { + // Parent offset cannot be written because of a bug or a broken dictionary; thus, + // we give up to update dictionary. + return false; + } + mReadingHelper.readNextSiblingNode(childPtNodeParams); + } + } + return true; +} + +bool DynamicPatriciaTrieNodeWriter::updatePtNodeProbability( + const PtNodeParams *const toBeUpdatedPtNodeParams, const int newProbability) { + if (!toBeUpdatedPtNodeParams->isTerminal()) { + return false; + } + int probabilityFieldPos = toBeUpdatedPtNodeParams->getProbabilityFieldPos(); + return DynamicPatriciaTrieWritingUtils::writeProbabilityAndAdvancePosition(mBuffer, + newProbability, &probabilityFieldPos); +} + +bool DynamicPatriciaTrieNodeWriter::updateChildrenPosition( + const PtNodeParams *const toBeUpdatedPtNodeParams, const int newChildrenPosition) { + int childrenPosFieldPos = toBeUpdatedPtNodeParams->getChildrenPosFieldPos(); + return DynamicPatriciaTrieWritingUtils::writeChildrenPositionAndAdvancePosition(mBuffer, + newChildrenPosition, &childrenPosFieldPos); +} + +bool DynamicPatriciaTrieNodeWriter::writePtNodeAndAdvancePosition( + const PtNodeParams *const ptNodeParams, int *const ptNodeWritingPos) { + const int nodePos = *ptNodeWritingPos; + // Write dummy flags. The Node flags are updated with appropriate flags at the last step of the + // PtNode writing. + if (!DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mBuffer, + 0 /* nodeFlags */, ptNodeWritingPos)) { + return false; + } + // Calculate a parent offset and write the offset. + if (!DynamicPatriciaTrieWritingUtils::writeParentPosOffsetAndAdvancePosition(mBuffer, + ptNodeParams->getParentPos(), nodePos, ptNodeWritingPos)) { + return false; + } + // Write code points + if (!DynamicPatriciaTrieWritingUtils::writeCodePointsAndAdvancePosition(mBuffer, + ptNodeParams->getCodePoints(), ptNodeParams->getCodePointCount(), ptNodeWritingPos)) { + return false; + } + // Write probability when the probability is a valid probability, which means this node is + // terminal. + if (ptNodeParams->getProbability() != NOT_A_PROBABILITY) { + if (!DynamicPatriciaTrieWritingUtils::writeProbabilityAndAdvancePosition(mBuffer, + ptNodeParams->getProbability(), ptNodeWritingPos)) { + return false; + } + } + // Write children position + if (!DynamicPatriciaTrieWritingUtils::writeChildrenPositionAndAdvancePosition(mBuffer, + ptNodeParams->getChildrenPos(), ptNodeWritingPos)) { + return false; + } + // Copy shortcut list when the originalShortcutListPos is valid dictionary position. + if (ptNodeParams->getShortcutPos() != NOT_A_DICT_POS) { + int fromPos = ptNodeParams->getShortcutPos(); + if (!mShortcutPolicy->copyAllShortcutsAndReturnIfSucceededOrNot(mBuffer, &fromPos, + ptNodeWritingPos)) { + return false; + } + } + // Copy bigram list when the originalBigramListPos is valid dictionary position. + int bigramCount = 0; + if (ptNodeParams->getBigramsPos() != NOT_A_DICT_POS) { + int fromPos = ptNodeParams->getBigramsPos(); + if (!mBigramPolicy->copyAllBigrams(mBuffer, &fromPos, ptNodeWritingPos, &bigramCount)) { + return false; + } + } + // Create node flags and write them. + PatriciaTrieReadingUtils::NodeFlags nodeFlags = + PatriciaTrieReadingUtils::createAndGetFlags(ptNodeParams->isBlacklisted(), + ptNodeParams->isNotAWord(), + ptNodeParams->getProbability() != NOT_A_PROBABILITY /* isTerminal */, + ptNodeParams->getShortcutPos() != NOT_A_DICT_POS /* hasShortcutTargets */, + bigramCount > 0 /* hasBigrams */, + ptNodeParams->getCodePointCount() > 1 /* hasMultipleChars */, + CHILDREN_POSITION_FIELD_SIZE); + int flagsFieldPos = nodePos; + if (!DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mBuffer, nodeFlags, + &flagsFieldPos)) { + return false; + } + return true; +} + +bool DynamicPatriciaTrieNodeWriter::addNewBigramEntry( + const PtNodeParams *const sourcePtNodeParams, + const PtNodeParams *const targetPtNodeParam, const int probability, + bool *const outAddedNewBigram) { + const int newNodePos = mBuffer->getTailPosition(); + int writingPos = newNodePos; + // Write a new PtNode using original PtNode's info to the tail of the dictionary in mBuffer. + if (!writePtNodeAndAdvancePosition(sourcePtNodeParams, &writingPos)) { + return false; + } + if (!markPtNodeAsMoved(sourcePtNodeParams, newNodePos, newNodePos)) { + return false; + } + const PtNodeParams newPtNodeParams( + mPtNodeReader->fetchNodeInfoInBufferFromPtNodePos(newNodePos)); + if (newPtNodeParams.getBigramsPos() != NOT_A_DICT_POS) { + // Insert a new bigram entry into the existing bigram list. + int bigramListPos = newPtNodeParams.getBigramsPos(); + return mBigramPolicy->addNewBigramEntryToBigramList(targetPtNodeParam->getHeadPos(), + probability, &bigramListPos, outAddedNewBigram); + } else { + // The PtNode doesn't have a bigram list. + *outAddedNewBigram = true; + // First, Write a bigram entry at the tail position of the PtNode. + if (!mBigramPolicy->writeNewBigramEntry(targetPtNodeParam->getHeadPos(), probability, + &writingPos)) { + return false; + } + // Then, Mark as the PtNode having bigram list in the flags. + const PatriciaTrieReadingUtils::NodeFlags updatedFlags = + PatriciaTrieReadingUtils::createAndGetFlags(newPtNodeParams.isBlacklisted(), + newPtNodeParams.isNotAWord(), + newPtNodeParams.getProbability() != NOT_A_PROBABILITY, + newPtNodeParams.getShortcutPos() != NOT_A_DICT_POS, true /* hasBigrams */, + newPtNodeParams.getCodePointCount() > 1, CHILDREN_POSITION_FIELD_SIZE); + writingPos = newNodePos; + // Write updated flags into the moved PtNode's flags field. + return DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mBuffer, updatedFlags, + &writingPos); + } +} + +bool DynamicPatriciaTrieNodeWriter::removeBigramEntry( + const PtNodeParams *const sourcePtNodeParams, const PtNodeParams *const targetPtNodeParam) { + if (sourcePtNodeParams->getBigramsPos() == NOT_A_DICT_POS) { + return false; + } + return mBigramPolicy->removeBigram(sourcePtNodeParams->getBigramsPos(), + targetPtNodeParam->getHeadPos()); +} + +} diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_writer.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_writer.h new file mode 100644 index 000000000..87ed1b159 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_writer.h @@ -0,0 +1,82 @@ +/* + * 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_WRITER_H +#define LATINIME_DYNAMIC_PATRICIA_TRIE_NODE_WRITER_H + +#include <stdint.h> + +#include "defines.h" +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_params.h" +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_writer.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_reader.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.h" + +namespace latinime { + +class BufferWithExtendableBuffer; +class DynamicBigramListPolicy; +class DynamicShortcutListPolicy; + +/* + * This class is used for helping to writes nodes of dynamic patricia trie. + */ +class DynamicPatriciaTrieNodeWriter : public PtNodeWriter { + public: + DynamicPatriciaTrieNodeWriter(BufferWithExtendableBuffer *const buffer, + const DynamicPatriciaTrieNodeReader *const ptNodeReader, + DynamicBigramListPolicy *const bigramPolicy, + DynamicShortcutListPolicy *const shortcutPolicy) + : mBuffer(buffer), mPtNodeReader(ptNodeReader), mReadingHelper(mBuffer, ptNodeReader), + mBigramPolicy(bigramPolicy), mShortcutPolicy(shortcutPolicy) {} + + virtual ~DynamicPatriciaTrieNodeWriter() {} + + virtual bool markPtNodeAsDeleted(const PtNodeParams *const toBeUpdatedPtNodeParams); + + virtual bool markPtNodeAsMoved(const PtNodeParams *const toBeUpdatedPtNodeParams, + const int movedPos, const int bigramLinkedNodePos); + + virtual bool updatePtNodeProbability(const PtNodeParams *const toBeUpdatedPtNodeParams, + const int newProbability); + + virtual bool updateChildrenPosition(const PtNodeParams *const toBeUpdatedPtNodeParams, + const int newChildrenPosition); + + virtual bool writePtNodeAndAdvancePosition(const PtNodeParams *const ptNodeParams, + int *const ptNodeWritingPos); + + virtual bool addNewBigramEntry(const PtNodeParams *const sourcePtNodeParams, + const PtNodeParams *const targetPtNodeParam, const int probability, + bool *const outAddedNewBigram); + + virtual bool removeBigramEntry(const PtNodeParams *const sourcePtNodeParams, + const PtNodeParams *const targetPtNodeParam); + + private: + DISALLOW_COPY_AND_ASSIGN(DynamicPatriciaTrieNodeWriter); + + static const int CHILDREN_POSITION_FIELD_SIZE; + + BufferWithExtendableBuffer *const mBuffer; + const DynamicPatriciaTrieNodeReader *const mPtNodeReader; + DynamicPatriciaTrieReadingHelper mReadingHelper; + DynamicBigramListPolicy *const mBigramPolicy; + DynamicShortcutListPolicy *const mShortcutPolicy; + +}; +} // namespace latinime +#endif /* LATINIME_DYNAMIC_PATRICIA_TRIE_NODE_WRITER_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_policy.cpp index 205d181e7..6b58f5fb7 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_policy.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_policy.cpp @@ -27,6 +27,7 @@ #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_reader.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_utils.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_updating_helper.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.h" #include "suggest/policyimpl/dictionary/utils/forgetting_curve_utils.h" #include "suggest/policyimpl/dictionary/utils/probability_utils.h" @@ -152,10 +153,8 @@ bool DynamicPatriciaTriePolicy::addUnigramWord(const int *const word, const int } DynamicPatriciaTrieReadingHelper readingHelper(&mBufferWithExtendableBuffer, &mNodeReader); readingHelper.initWithPtNodeArrayPos(getRootPosition()); - DynamicPatriciaTrieWritingHelper writingHelper(&mBufferWithExtendableBuffer, - &mBigramListPolicy, &mShortcutListPolicy, mHeaderPolicy.isDecayingDict()); bool addedNewUnigram = false; - if (writingHelper.addUnigramWord(&readingHelper, word, length, probability, + if (mUpdatingHelper.addUnigramWord(&readingHelper, word, length, probability, &addedNewUnigram)) { if (addedNewUnigram) { mUnigramCount++; @@ -187,10 +186,8 @@ bool DynamicPatriciaTriePolicy::addBigramWords(const int *const word0, const int if (word1Pos == NOT_A_DICT_POS) { return false; } - DynamicPatriciaTrieWritingHelper writingHelper(&mBufferWithExtendableBuffer, - &mBigramListPolicy, &mShortcutListPolicy, mHeaderPolicy.isDecayingDict()); bool addedNewBigram = false; - if (writingHelper.addBigramWords(word0Pos, word1Pos, probability, &addedNewBigram)) { + if (mUpdatingHelper.addBigramWords(word0Pos, word1Pos, probability, &addedNewBigram)) { if (addedNewBigram) { mBigramCount++; } @@ -221,9 +218,7 @@ bool DynamicPatriciaTriePolicy::removeBigramWords(const int *const word0, const if (word1Pos == NOT_A_DICT_POS) { return false; } - DynamicPatriciaTrieWritingHelper writingHelper(&mBufferWithExtendableBuffer, - &mBigramListPolicy, &mShortcutListPolicy, mHeaderPolicy.isDecayingDict()); - if (writingHelper.removeBigramWords(word0Pos, word1Pos)) { + if (mUpdatingHelper.removeBigramWords(word0Pos, word1Pos)) { mBigramCount--; return true; } else { @@ -236,8 +231,8 @@ void DynamicPatriciaTriePolicy::flush(const char *const filePath) { AKLOGI("Warning: flush() is called for non-updatable dictionary."); return; } - DynamicPatriciaTrieWritingHelper writingHelper(&mBufferWithExtendableBuffer, - &mBigramListPolicy, &mShortcutListPolicy, false /* needsToDecay */); + DynamicPatriciaTrieWritingHelper writingHelper(&mBufferWithExtendableBuffer, &mNodeReader, + &mNodeWriter, &mBigramListPolicy, &mShortcutListPolicy, false /* needsToDecay */); writingHelper.writeToDictFile(filePath, &mHeaderPolicy, mUnigramCount, mBigramCount); } @@ -251,8 +246,8 @@ void DynamicPatriciaTriePolicy::flushWithGC(const char *const filePath) { false /* mindsBlockByDecay */, mUnigramCount, mBigramCount, &mHeaderPolicy)); DynamicBigramListPolicy bigramListPolicyForGC(&mHeaderPolicy, &mBufferWithExtendableBuffer, &mShortcutListPolicy, needsToDecay); - DynamicPatriciaTrieWritingHelper writingHelper(&mBufferWithExtendableBuffer, - &bigramListPolicyForGC, &mShortcutListPolicy, needsToDecay); + DynamicPatriciaTrieWritingHelper writingHelper(&mBufferWithExtendableBuffer, &mNodeReader, + &mNodeWriter, &bigramListPolicyForGC, &mShortcutListPolicy, needsToDecay); writingHelper.writeToDictFileWithGC(getRootPosition(), filePath, &mHeaderPolicy); mNeedsToDecayForTesting = false; } diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_policy.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_policy.h index 7a81a9c0a..454698430 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_policy.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_policy.h @@ -23,6 +23,8 @@ #include "suggest/policyimpl/dictionary/header/header_policy.h" #include "suggest/policyimpl/dictionary/shortcut/dynamic_shortcut_list_policy.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_reader.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_writer.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_updating_helper.h" #include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" #include "suggest/policyimpl/dictionary/utils/format_utils.h" #include "suggest/policyimpl/dictionary/utils/mmapped_buffer.h" @@ -46,6 +48,10 @@ class DynamicPatriciaTriePolicy : public DictionaryStructureWithBufferPolicy { mBigramListPolicy(&mHeaderPolicy, &mBufferWithExtendableBuffer, &mShortcutListPolicy, mHeaderPolicy.isDecayingDict()), mNodeReader(&mBufferWithExtendableBuffer, &mBigramListPolicy, &mShortcutListPolicy), + mNodeWriter(&mBufferWithExtendableBuffer, &mNodeReader, &mBigramListPolicy, + &mShortcutListPolicy), + mUpdatingHelper(&mBufferWithExtendableBuffer, &mNodeReader, &mNodeWriter, + mHeaderPolicy.isDecayingDict()), mUnigramCount(mHeaderPolicy.getUnigramCount()), mBigramCount(mHeaderPolicy.getBigramCount()), mNeedsToDecayForTesting(false) {} @@ -117,6 +123,8 @@ class DynamicPatriciaTriePolicy : public DictionaryStructureWithBufferPolicy { DynamicShortcutListPolicy mShortcutListPolicy; DynamicBigramListPolicy mBigramListPolicy; DynamicPatriciaTrieNodeReader mNodeReader; + DynamicPatriciaTrieNodeWriter mNodeWriter; + DynamicPatriciaTrieUpdatingHelper mUpdatingHelper; int mUnigramCount; int mBigramCount; int mNeedsToDecayForTesting; diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.cpp index c3fe03d37..b3fdbeb78 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.cpp @@ -238,6 +238,9 @@ int DynamicPatriciaTrieReadingHelper::getTerminalPtNodePositionOfWord(const int } // All characters are matched. if (length == getTotalCodePointCount(ptNodeParams)) { + if (!ptNodeParams.isTerminal()) { + return NOT_A_DICT_POS; + } // Terminal position is found. return ptNodeParams.getHeadPos(); } diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_updating_helper.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_updating_helper.cpp new file mode 100644 index 000000000..cbc0d2304 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_updating_helper.cpp @@ -0,0 +1,279 @@ +/* + * 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/structure/v3/dynamic_patricia_trie_updating_helper.h" + +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_reader.h" +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_writer.h" +#include "suggest/policyimpl/dictionary/structure/v2/patricia_trie_reading_utils.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_utils.h" +#include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" +#include "suggest/policyimpl/dictionary/utils/forgetting_curve_utils.h" + +namespace latinime { + +const int DynamicPatriciaTrieUpdatingHelper::CHILDREN_POSITION_FIELD_SIZE = 3; + +bool DynamicPatriciaTrieUpdatingHelper::addUnigramWord( + DynamicPatriciaTrieReadingHelper *const readingHelper, + const int *const wordCodePoints, const int codePointCount, const int probability, + bool *const outAddedNewUnigram) { + int parentPos = NOT_A_DICT_POS; + while (!readingHelper->isEnd()) { + const PtNodeParams ptNodeParams(readingHelper->getPtNodeParams()); + if (!ptNodeParams.isValid()) { + break; + } + const int matchedCodePointCount = readingHelper->getPrevTotalCodePointCount(); + if (!readingHelper->isMatchedCodePoint(ptNodeParams, 0 /* index */, + wordCodePoints[matchedCodePointCount])) { + // The first code point is different from target code point. Skip this node and read + // the next sibling node. + readingHelper->readNextSiblingNode(ptNodeParams); + continue; + } + // Check following merged node code points. + const int nodeCodePointCount = ptNodeParams.getCodePointCount(); + for (int j = 1; j < nodeCodePointCount; ++j) { + const int nextIndex = matchedCodePointCount + j; + if (nextIndex >= codePointCount || !readingHelper->isMatchedCodePoint(ptNodeParams, j, + wordCodePoints[matchedCodePointCount + j])) { + *outAddedNewUnigram = true; + return reallocatePtNodeAndAddNewPtNodes(&ptNodeParams, j, + getUpdatedProbability(NOT_A_PROBABILITY /* originalProbability */, + probability), + wordCodePoints + matchedCodePointCount, + codePointCount - matchedCodePointCount); + } + } + // All characters are matched. + if (codePointCount == readingHelper->getTotalCodePointCount(ptNodeParams)) { + return setPtNodeProbability(&ptNodeParams, probability, outAddedNewUnigram); + } + if (!ptNodeParams.hasChildren()) { + *outAddedNewUnigram = true; + return createChildrenPtNodeArrayAndAChildPtNode(&ptNodeParams, + getUpdatedProbability(NOT_A_PROBABILITY /* originalProbability */, probability), + wordCodePoints + readingHelper->getTotalCodePointCount(ptNodeParams), + codePointCount - readingHelper->getTotalCodePointCount(ptNodeParams)); + } + // Advance to the children nodes. + parentPos = ptNodeParams.getHeadPos(); + readingHelper->readChildNode(ptNodeParams); + } + if (readingHelper->isError()) { + // The dictionary is invalid. + return false; + } + int pos = readingHelper->getPosOfLastForwardLinkField(); + *outAddedNewUnigram = true; + return createAndInsertNodeIntoPtNodeArray(parentPos, + wordCodePoints + readingHelper->getPrevTotalCodePointCount(), + codePointCount - readingHelper->getPrevTotalCodePointCount(), + getUpdatedProbability(NOT_A_PROBABILITY /* originalProbability */, probability), &pos); +} + +bool DynamicPatriciaTrieUpdatingHelper::addBigramWords(const int word0Pos, const int word1Pos, + const int probability, bool *const outAddedNewBigram) { + const PtNodeParams sourcePtNodeParams( + mPtNodeReader->fetchNodeInfoInBufferFromPtNodePos(word0Pos)); + const PtNodeParams targetPtNodeParams( + mPtNodeReader->fetchNodeInfoInBufferFromPtNodePos(word1Pos)); + return mPtNodeWriter->addNewBigramEntry(&sourcePtNodeParams, &targetPtNodeParams, probability, + outAddedNewBigram); +} + +// Remove a bigram relation from word0Pos to word1Pos. +bool DynamicPatriciaTrieUpdatingHelper::removeBigramWords(const int word0Pos, const int word1Pos) { + const PtNodeParams sourcePtNodeParams( + mPtNodeReader->fetchNodeInfoInBufferFromPtNodePos(word0Pos)); + const PtNodeParams targetPtNodeParams( + mPtNodeReader->fetchNodeInfoInBufferFromPtNodePos(word1Pos)); + return mPtNodeWriter->removeBigramEntry(&sourcePtNodeParams, &targetPtNodeParams); +} + +bool DynamicPatriciaTrieUpdatingHelper::createAndInsertNodeIntoPtNodeArray(const int parentPos, + const int *const nodeCodePoints, const int nodeCodePointCount, const int probability, + int *const forwardLinkFieldPos) { + const int newPtNodeArrayPos = mBuffer->getTailPosition(); + if (!DynamicPatriciaTrieWritingUtils::writeForwardLinkPositionAndAdvancePosition(mBuffer, + newPtNodeArrayPos, forwardLinkFieldPos)) { + return false; + } + return createNewPtNodeArrayWithAChildPtNode(parentPos, nodeCodePoints, nodeCodePointCount, + probability); +} + +bool DynamicPatriciaTrieUpdatingHelper::setPtNodeProbability( + const PtNodeParams *const originalPtNodeParams, const int probability, + bool *const outAddedNewUnigram) { + if (originalPtNodeParams->isTerminal()) { + // Overwrites the probability. + *outAddedNewUnigram = false; + const int probabilityToWrite = getUpdatedProbability( + originalPtNodeParams->getProbability(), probability); + return mPtNodeWriter->updatePtNodeProbability(originalPtNodeParams, probabilityToWrite); + } else { + // Make the node terminal and write the probability. + *outAddedNewUnigram = true; + const int movedPos = mBuffer->getTailPosition(); + int writingPos = movedPos; + const PtNodeParams ptNodeParamsToWrite(getUpdatedPtNodeParams(originalPtNodeParams, + originalPtNodeParams->getParentPos(), originalPtNodeParams->getCodePointCount(), + originalPtNodeParams->getCodePoints(), + getUpdatedProbability(NOT_A_PROBABILITY /* originalProbability */, probability))); + if (!mPtNodeWriter->writePtNodeAndAdvancePosition(&ptNodeParamsToWrite, &writingPos)) { + return false; + } + if (!mPtNodeWriter->markPtNodeAsMoved(originalPtNodeParams, movedPos, movedPos)) { + return false; + } + } + return true; +} + +bool DynamicPatriciaTrieUpdatingHelper::createChildrenPtNodeArrayAndAChildPtNode( + const PtNodeParams *const parentPtNodeParams, const int probability, + const int *const codePoints, const int codePointCount) { + const int newPtNodeArrayPos = mBuffer->getTailPosition(); + if (!mPtNodeWriter->updateChildrenPosition(parentPtNodeParams, newPtNodeArrayPos)) { + return false; + } + return createNewPtNodeArrayWithAChildPtNode(parentPtNodeParams->getHeadPos(), codePoints, + codePointCount, probability); +} + +bool DynamicPatriciaTrieUpdatingHelper::createNewPtNodeArrayWithAChildPtNode( + const int parentPtNodePos, const int *const nodeCodePoints, const int nodeCodePointCount, + const int probability) { + int writingPos = mBuffer->getTailPosition(); + if (!DynamicPatriciaTrieWritingUtils::writePtNodeArraySizeAndAdvancePosition(mBuffer, + 1 /* arraySize */, &writingPos)) { + return false; + } + const PtNodeParams ptNodeParamsToWrite(getPtNodeParamsForNewPtNode( + parentPtNodePos, nodeCodePointCount, nodeCodePoints, probability)); + if (!mPtNodeWriter->writePtNodeAndAdvancePosition(&ptNodeParamsToWrite, &writingPos)) { + return false; + } + if (!DynamicPatriciaTrieWritingUtils::writeForwardLinkPositionAndAdvancePosition(mBuffer, + NOT_A_DICT_POS /* forwardLinkPos */, &writingPos)) { + return false; + } + return true; +} + +// Returns whether the dictionary updating was succeeded or not. +bool DynamicPatriciaTrieUpdatingHelper::reallocatePtNodeAndAddNewPtNodes( + const PtNodeParams *const reallocatingPtNodeParams, const int overlappingCodePointCount, + const int probabilityOfNewPtNode, const int *const newNodeCodePoints, + const int newNodeCodePointCount) { + // When addsExtraChild is true, split the reallocating PtNode and add new child. + // Reallocating PtNode: abcde, newNode: abcxy. + // abc (1st, not terminal) __ de (2nd) + // \_ xy (extra child, terminal) + // Otherwise, this method makes 1st part terminal and write probabilityOfNewPtNode. + // Reallocating PtNode: abcde, newNode: abc. + // abc (1st, terminal) __ de (2nd) + const bool addsExtraChild = newNodeCodePointCount > overlappingCodePointCount; + const int firstPartOfReallocatedPtNodePos = mBuffer->getTailPosition(); + int writingPos = firstPartOfReallocatedPtNodePos; + // Write the 1st part of the reallocating node. The children position will be updated later + // with actual children position. + const int newProbability = addsExtraChild ? NOT_A_PROBABILITY : probabilityOfNewPtNode; + const PtNodeParams ptNodeParamsToWrite(getPtNodeParamsForNewPtNode( + reallocatingPtNodeParams->getParentPos(), overlappingCodePointCount, + reallocatingPtNodeParams->getCodePoints(), newProbability)); + if (!mPtNodeWriter->writePtNodeAndAdvancePosition(&ptNodeParamsToWrite, &writingPos)) { + return false; + } + const int actualChildrenPos = writingPos; + // Create new children PtNode array. + const size_t newPtNodeCount = addsExtraChild ? 2 : 1; + if (!DynamicPatriciaTrieWritingUtils::writePtNodeArraySizeAndAdvancePosition(mBuffer, + newPtNodeCount, &writingPos)) { + return false; + } + // Write the 2nd part of the reallocating node. + const int secondPartOfReallocatedPtNodePos = writingPos; + const PtNodeParams childPartPtNodeParams(getUpdatedPtNodeParams(reallocatingPtNodeParams, + firstPartOfReallocatedPtNodePos, + reallocatingPtNodeParams->getCodePointCount() - overlappingCodePointCount, + reallocatingPtNodeParams->getCodePoints() + overlappingCodePointCount, + reallocatingPtNodeParams->getProbability())); + if (!mPtNodeWriter->writePtNodeAndAdvancePosition(&childPartPtNodeParams, &writingPos)) { + return false; + } + if (addsExtraChild) { + const PtNodeParams extraChildPtNodeParams(getPtNodeParamsForNewPtNode( + firstPartOfReallocatedPtNodePos, newNodeCodePointCount - overlappingCodePointCount, + newNodeCodePoints + overlappingCodePointCount, probabilityOfNewPtNode)); + if (!mPtNodeWriter->writePtNodeAndAdvancePosition(&extraChildPtNodeParams, &writingPos)) { + return false; + } + } + if (!DynamicPatriciaTrieWritingUtils::writeForwardLinkPositionAndAdvancePosition(mBuffer, + NOT_A_DICT_POS /* forwardLinkPos */, &writingPos)) { + return false; + } + // Update original reallocating PtNode as moved. + if (!mPtNodeWriter->markPtNodeAsMoved(reallocatingPtNodeParams, firstPartOfReallocatedPtNodePos, + secondPartOfReallocatedPtNodePos)) { + return false; + } + // Load node info. Information of the 1st part will be fetched. + const PtNodeParams ptNodeParams( + mPtNodeReader->fetchNodeInfoInBufferFromPtNodePos(firstPartOfReallocatedPtNodePos)); + // Update children position. + return mPtNodeWriter->updateChildrenPosition(&ptNodeParams, actualChildrenPos); +} + +int DynamicPatriciaTrieUpdatingHelper::getUpdatedProbability(const int originalProbability, + const int newProbability) const { + if (mNeedsToDecay) { + return ForgettingCurveUtils::getUpdatedEncodedProbability(originalProbability, + newProbability); + } else { + return newProbability; + } +} + +const PtNodeParams DynamicPatriciaTrieUpdatingHelper::getUpdatedPtNodeParams( + const PtNodeParams *const originalPtNodeParams, const int parentPos, + const int codePointCount, const int *const codePoints, const int probability) const { + const PatriciaTrieReadingUtils::NodeFlags flags = PatriciaTrieReadingUtils::createAndGetFlags( + originalPtNodeParams->isBlacklisted(), originalPtNodeParams->isNotAWord(), + probability != NOT_A_PROBABILITY /* isTerminal */, + originalPtNodeParams->getShortcutPos() != NOT_A_DICT_POS /* hasShortcutTargets */, + originalPtNodeParams->getBigramsPos() != NOT_A_DICT_POS /* hasBigrams */, + codePointCount > 1 /* hasMultipleChars */, CHILDREN_POSITION_FIELD_SIZE); + return PtNodeParams(originalPtNodeParams, flags, parentPos, codePointCount, codePoints, + probability); +} + +const PtNodeParams DynamicPatriciaTrieUpdatingHelper::getPtNodeParamsForNewPtNode( + const int parentPos, const int codePointCount, const int *const codePoints, + const int probability) const { + const PatriciaTrieReadingUtils::NodeFlags flags = PatriciaTrieReadingUtils::createAndGetFlags( + false /* isBlacklisted */, false /* isNotAWord */, + probability != NOT_A_PROBABILITY /* isTerminal */, + false /* hasShortcutTargets */, false /* hasBigrams */, + codePointCount > 1 /* hasMultipleChars */, CHILDREN_POSITION_FIELD_SIZE); + return PtNodeParams(flags, parentPos, codePointCount, codePoints, probability); +} + +} // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_updating_helper.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_updating_helper.h new file mode 100644 index 000000000..b9800cd80 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_updating_helper.h @@ -0,0 +1,93 @@ +/* + * 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_UPDATING_HELPER_H +#define LATINIME_DYNAMIC_PATRICIA_TRIE_UPDATING_HELPER_H + +#include <stdint.h> + +#include "defines.h" +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_params.h" +#include "utils/hash_map_compat.h" + +namespace latinime { + +class BufferWithExtendableBuffer; +class DynamicPatriciaTrieReadingHelper; +class PtNodeReader; +class PtNodeWriter; + +// TODO: Move to pt_common. +class DynamicPatriciaTrieUpdatingHelper { + public: + DynamicPatriciaTrieUpdatingHelper(BufferWithExtendableBuffer *const buffer, + const PtNodeReader *const ptNodeReader, PtNodeWriter *const ptNodeWriter, + const bool needsToDecay) + : mBuffer(buffer), mPtNodeReader(ptNodeReader), mPtNodeWriter(ptNodeWriter), + mNeedsToDecay(needsToDecay) {} + + ~DynamicPatriciaTrieUpdatingHelper() {} + + // Add a word to the dictionary. If the word already exists, update the probability. + bool addUnigramWord(DynamicPatriciaTrieReadingHelper *const readingHelper, + const int *const wordCodePoints, const int codePointCount, const int probability, + bool *const outAddedNewUnigram); + + // Add a bigram relation from word0Pos to word1Pos. + bool addBigramWords(const int word0Pos, const int word1Pos, const int probability, + bool *const outAddedNewBigram); + + // Remove a bigram relation from word0Pos to word1Pos. + bool removeBigramWords(const int word0Pos, const int word1Pos); + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(DynamicPatriciaTrieUpdatingHelper); + + static const int CHILDREN_POSITION_FIELD_SIZE; + + BufferWithExtendableBuffer *const mBuffer; + const PtNodeReader *const mPtNodeReader; + PtNodeWriter *const mPtNodeWriter; + const bool mNeedsToDecay; + + bool createAndInsertNodeIntoPtNodeArray(const int parentPos, const int *const nodeCodePoints, + const int nodeCodePointCount, const int probability, int *const forwardLinkFieldPos); + + bool setPtNodeProbability(const PtNodeParams *const originalPtNodeParams, const int probability, + bool *const outAddedNewUnigram); + + bool createChildrenPtNodeArrayAndAChildPtNode(const PtNodeParams *const parentPtNodeParams, + const int probability, const int *const codePoints, const int codePointCount); + + bool createNewPtNodeArrayWithAChildPtNode(const int parentPos, const int *const nodeCodePoints, + const int nodeCodePointCount, const int probability); + + bool reallocatePtNodeAndAddNewPtNodes( + const PtNodeParams *const reallocatingPtNodeParams, const int overlappingCodePointCount, + const int probabilityOfNewPtNode, const int *const newNodeCodePoints, + const int newNodeCodePointCount); + + int getUpdatedProbability(const int originalProbability, const int newProbability) const; + + const PtNodeParams getUpdatedPtNodeParams(const PtNodeParams *const originalPtNodeParams, + const int parentPos, const int codePointCount, const int *const codePoints, + const int probability) const; + + const PtNodeParams getPtNodeParamsForNewPtNode(const int parentPos, const int codePointCount, + const int *const codePoints, const int probability) const; +}; +} // namespace latinime +#endif /* LATINIME_DYNAMIC_PATRICIA_TRIE_UPDATING_HELPER_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.cpp index 05caaebac..d97cec53b 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.cpp @@ -17,9 +17,12 @@ #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.h" #include "suggest/policyimpl/dictionary/bigram/dynamic_bigram_list_policy.h" +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_reader.h" +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_writer.h" #include "suggest/policyimpl/dictionary/structure/v2/patricia_trie_reading_utils.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_gc_event_listeners.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_reader.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_node_writer.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_utils.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_utils.h" @@ -31,122 +34,9 @@ namespace latinime { -const int DynamicPatriciaTrieWritingHelper::CHILDREN_POSITION_FIELD_SIZE = 3; // TODO: Make MAX_DICTIONARY_SIZE 8MB. const size_t DynamicPatriciaTrieWritingHelper::MAX_DICTIONARY_SIZE = 2 * 1024 * 1024; -bool DynamicPatriciaTrieWritingHelper::addUnigramWord( - DynamicPatriciaTrieReadingHelper *const readingHelper, - const int *const wordCodePoints, const int codePointCount, const int probability, - bool *const outAddedNewUnigram) { - int parentPos = NOT_A_DICT_POS; - while (!readingHelper->isEnd()) { - const PtNodeParams ptNodeParams(readingHelper->getPtNodeParams()); - if (!ptNodeParams.isValid()) { - break; - } - const int matchedCodePointCount = readingHelper->getPrevTotalCodePointCount(); - if (!readingHelper->isMatchedCodePoint(ptNodeParams, 0 /* index */, - wordCodePoints[matchedCodePointCount])) { - // The first code point is different from target code point. Skip this node and read - // the next sibling node. - readingHelper->readNextSiblingNode(ptNodeParams); - continue; - } - // Check following merged node code points. - const int nodeCodePointCount = ptNodeParams.getCodePointCount(); - for (int j = 1; j < nodeCodePointCount; ++j) { - const int nextIndex = matchedCodePointCount + j; - if (nextIndex >= codePointCount || !readingHelper->isMatchedCodePoint(ptNodeParams, j, - wordCodePoints[matchedCodePointCount + j])) { - *outAddedNewUnigram = true; - return reallocatePtNodeAndAddNewPtNodes(&ptNodeParams, j, - getUpdatedProbability(NOT_A_PROBABILITY /* originalProbability */, - probability), - wordCodePoints + matchedCodePointCount, - codePointCount - matchedCodePointCount); - } - } - // All characters are matched. - if (codePointCount == readingHelper->getTotalCodePointCount(ptNodeParams)) { - return setPtNodeProbability(&ptNodeParams, probability, outAddedNewUnigram); - } - if (!ptNodeParams.hasChildren()) { - *outAddedNewUnigram = true; - return createChildrenPtNodeArrayAndAChildPtNode(&ptNodeParams, - getUpdatedProbability(NOT_A_PROBABILITY /* originalProbability */, probability), - wordCodePoints + readingHelper->getTotalCodePointCount(ptNodeParams), - codePointCount - readingHelper->getTotalCodePointCount(ptNodeParams)); - } - // Advance to the children nodes. - parentPos = ptNodeParams.getHeadPos(); - readingHelper->readChildNode(ptNodeParams); - } - if (readingHelper->isError()) { - // The dictionary is invalid. - return false; - } - int pos = readingHelper->getPosOfLastForwardLinkField(); - *outAddedNewUnigram = true; - return createAndInsertNodeIntoPtNodeArray(parentPos, - wordCodePoints + readingHelper->getPrevTotalCodePointCount(), - codePointCount - readingHelper->getPrevTotalCodePointCount(), - getUpdatedProbability(NOT_A_PROBABILITY /* originalProbability */, probability), &pos); -} - -bool DynamicPatriciaTrieWritingHelper::addBigramWords(const int word0Pos, const int word1Pos, - const int probability, bool *const outAddedNewBigram) { - DynamicPatriciaTrieNodeReader nodeReader(mBuffer, mBigramPolicy, mShortcutPolicy); - const PtNodeParams ptNodeParams(nodeReader.fetchNodeInfoInBufferFromPtNodePos(word0Pos)); - // Move node to add bigram entry. - const int newNodePos = mBuffer->getTailPosition(); - if (!markNodeAsMovedAndSetPosition(&ptNodeParams, newNodePos, newNodePos)) { - return false; - } - int writingPos = newNodePos; - // Write a new PtNode using original PtNode's info to the tail of the dictionary in mBuffer. - if (!writePtNodeToBufferByCopyingPtNodeInfo(mBuffer, &ptNodeParams, ptNodeParams.getParentPos(), - ptNodeParams.getCodePoints(), ptNodeParams.getCodePointCount(), - ptNodeParams.getProbability(), &writingPos)) { - return false; - } - const PtNodeParams newPtNodeParams(nodeReader.fetchNodeInfoInBufferFromPtNodePos(newNodePos)); - if (newPtNodeParams.getBigramsPos() != NOT_A_DICT_POS) { - // Insert a new bigram entry into the existing bigram list. - int bigramListPos = newPtNodeParams.getBigramsPos(); - return mBigramPolicy->addNewBigramEntryToBigramList(word1Pos, probability, &bigramListPos, - outAddedNewBigram); - } else { - // The PtNode doesn't have a bigram list. - *outAddedNewBigram = true; - // First, Write a bigram entry at the tail position of the PtNode. - if (!mBigramPolicy->writeNewBigramEntry(word1Pos, probability, &writingPos)) { - return false; - } - // Then, Mark as the PtNode having bigram list in the flags. - const PatriciaTrieReadingUtils::NodeFlags updatedFlags = - PatriciaTrieReadingUtils::createAndGetFlags(newPtNodeParams.isBlacklisted(), - newPtNodeParams.isNotAWord(), - newPtNodeParams.getProbability() != NOT_A_PROBABILITY, - newPtNodeParams.getShortcutPos() != NOT_A_DICT_POS, true /* hasBigrams */, - newPtNodeParams.getCodePointCount() > 1, CHILDREN_POSITION_FIELD_SIZE); - writingPos = newNodePos; - // Write updated flags into the moved PtNode's flags field. - return DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mBuffer, updatedFlags, - &writingPos); - } -} - -// Remove a bigram relation from word0Pos to word1Pos. -bool DynamicPatriciaTrieWritingHelper::removeBigramWords(const int word0Pos, const int word1Pos) { - DynamicPatriciaTrieNodeReader nodeReader(mBuffer, mBigramPolicy, mShortcutPolicy); - const PtNodeParams ptNodeParams(nodeReader.fetchNodeInfoInBufferFromPtNodePos(word0Pos)); - if (ptNodeParams.getBigramsPos() == NOT_A_DICT_POS) { - return false; - } - return mBigramPolicy->removeBigram(ptNodeParams.getBigramsPos(), word1Pos); -} - void DynamicPatriciaTrieWritingHelper::writeToDictFile(const char *const fileName, const HeaderPolicy *const headerPolicy, const int unigramCount, const int bigramCount) { BufferWithExtendableBuffer headerBuffer( @@ -180,323 +70,17 @@ void DynamicPatriciaTrieWritingHelper::writeToDictFileWithGC(const int rootPtNod DictFileWritingUtils::flushAllHeaderAndBodyToFile(fileName, &headerBuffer, &newDictBuffer); } -bool DynamicPatriciaTrieWritingHelper::markNodeAsDeleted( - const PtNodeParams *const toBeUpdatedPtNodeParams) { - int pos = toBeUpdatedPtNodeParams->getHeadPos(); - const bool usesAdditionalBuffer = mBuffer->isInAdditionalBuffer(pos); - const uint8_t *const dictBuf = mBuffer->getBuffer(usesAdditionalBuffer); - if (usesAdditionalBuffer) { - pos -= mBuffer->getOriginalBufferSize(); - } - // Read original flags - const PatriciaTrieReadingUtils::NodeFlags originalFlags = - PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictBuf, &pos); - const PatriciaTrieReadingUtils::NodeFlags updatedFlags = - DynamicPatriciaTrieReadingUtils::updateAndGetFlags(originalFlags, false /* isMoved */, - true /* isDeleted */); - int writingPos = toBeUpdatedPtNodeParams->getHeadPos(); - // Update flags. - return DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mBuffer, updatedFlags, - &writingPos); -} - -bool DynamicPatriciaTrieWritingHelper::markNodeAsMovedAndSetPosition( - const PtNodeParams *const toBeUpdatedPtNodeParams, const int movedPos, - const int bigramLinkedNodePos) { - int pos = toBeUpdatedPtNodeParams->getHeadPos(); - const bool usesAdditionalBuffer = mBuffer->isInAdditionalBuffer(pos); - const uint8_t *const dictBuf = mBuffer->getBuffer(usesAdditionalBuffer); - if (usesAdditionalBuffer) { - pos -= mBuffer->getOriginalBufferSize(); - } - // Read original flags - const PatriciaTrieReadingUtils::NodeFlags originalFlags = - PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictBuf, &pos); - const PatriciaTrieReadingUtils::NodeFlags updatedFlags = - DynamicPatriciaTrieReadingUtils::updateAndGetFlags(originalFlags, true /* isMoved */, - false /* isDeleted */); - int writingPos = toBeUpdatedPtNodeParams->getHeadPos(); - // Update flags. - if (!DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mBuffer, updatedFlags, - &writingPos)) { - return false; - } - // Update moved position, which is stored in the parent offset field. - if (!DynamicPatriciaTrieWritingUtils::writeParentPosOffsetAndAdvancePosition( - mBuffer, movedPos, toBeUpdatedPtNodeParams->getHeadPos(), &writingPos)) { - return false; - } - // Update bigram linked node position, which is stored in the children position field. - int childrenPosFieldPos = toBeUpdatedPtNodeParams->getChildrenPosFieldPos(); - if (!DynamicPatriciaTrieWritingUtils::writeChildrenPositionAndAdvancePosition( - mBuffer, bigramLinkedNodePos, &childrenPosFieldPos)) { - return false; - } - if (toBeUpdatedPtNodeParams->hasChildren()) { - // Update children's parent position. - DynamicPatriciaTrieNodeReader nodeReader(mBuffer, mBigramPolicy, mShortcutPolicy); - DynamicPatriciaTrieReadingHelper readingHelper(mBuffer, &nodeReader); - readingHelper.initWithPtNodeArrayPos(toBeUpdatedPtNodeParams->getChildrenPos()); - while (!readingHelper.isEnd()) { - const PtNodeParams childPtNodeParams(readingHelper.getPtNodeParams()); - int parentOffsetFieldPos = childPtNodeParams.getHeadPos() - + DynamicPatriciaTrieWritingUtils::NODE_FLAG_FIELD_SIZE; - if (!DynamicPatriciaTrieWritingUtils::writeParentPosOffsetAndAdvancePosition( - mBuffer, bigramLinkedNodePos, childPtNodeParams.getHeadPos(), - &parentOffsetFieldPos)) { - // Parent offset cannot be written because of a bug or a broken dictionary; thus, - // we give up to update dictionary. - return false; - } - readingHelper.readNextSiblingNode(childPtNodeParams); - } - } - return true; -} - -// Write new PtNode at writingPos. -bool DynamicPatriciaTrieWritingHelper::writePtNodeWithFullInfoToBuffer( - BufferWithExtendableBuffer *const bufferToWrite, const bool isBlacklisted, - const bool isNotAWord, const int parentPos, const int *const codePoints, - const int codePointCount, const int probability, const int childrenPos, - const int originalBigramListPos, const int originalShortcutListPos, - int *const writingPos) { - const int nodePos = *writingPos; - // Write dummy flags. The Node flags are updated with appropriate flags at the last step of the - // PtNode writing. - if (!DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(bufferToWrite, - 0 /* nodeFlags */, writingPos)) { - return false; - } - // Calculate a parent offset and write the offset. - if (!DynamicPatriciaTrieWritingUtils::writeParentPosOffsetAndAdvancePosition(bufferToWrite, - parentPos, nodePos, writingPos)) { - return false; - } - // Write code points - if (!DynamicPatriciaTrieWritingUtils::writeCodePointsAndAdvancePosition(bufferToWrite, - codePoints, codePointCount, writingPos)) { - return false; - } - // Write probability when the probability is a valid probability, which means this node is - // terminal. - if (probability != NOT_A_PROBABILITY) { - if (!DynamicPatriciaTrieWritingUtils::writeProbabilityAndAdvancePosition(bufferToWrite, - probability, writingPos)) { - return false; - } - } - // Write children position - if (!DynamicPatriciaTrieWritingUtils::writeChildrenPositionAndAdvancePosition(bufferToWrite, - childrenPos, writingPos)) { - return false; - } - // Copy shortcut list when the originalShortcutListPos is valid dictionary position. - if (originalShortcutListPos != NOT_A_DICT_POS) { - int fromPos = originalShortcutListPos; - if (!mShortcutPolicy->copyAllShortcutsAndReturnIfSucceededOrNot(bufferToWrite, &fromPos, - writingPos)) { - return false; - } - } - // Copy bigram list when the originalBigramListPos is valid dictionary position. - int bigramCount = 0; - if (originalBigramListPos != NOT_A_DICT_POS) { - int fromPos = originalBigramListPos; - if (!mBigramPolicy->copyAllBigrams(bufferToWrite, &fromPos, writingPos, &bigramCount)) { - return false; - } - } - // Create node flags and write them. - PatriciaTrieReadingUtils::NodeFlags nodeFlags = - PatriciaTrieReadingUtils::createAndGetFlags(isBlacklisted, isNotAWord, - probability != NOT_A_PROBABILITY /* isTerminal */, - originalShortcutListPos != NOT_A_DICT_POS /* hasShortcutTargets */, - bigramCount > 0 /* hasBigrams */, codePointCount > 1 /* hasMultipleChars */, - CHILDREN_POSITION_FIELD_SIZE); - int flagsFieldPos = nodePos; - if (!DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(bufferToWrite, nodeFlags, - &flagsFieldPos)) { - return false; - } - return true; -} - -bool DynamicPatriciaTrieWritingHelper::writePtNodeToBuffer( - BufferWithExtendableBuffer *const bufferToWrite, const int parentPos, - const int *const codePoints, const int codePointCount, const int probability, - int *const writingPos) { - return writePtNodeWithFullInfoToBuffer(bufferToWrite, false /* isBlacklisted */, - false /* isNotAWord */, parentPos, codePoints, codePointCount, probability, - NOT_A_DICT_POS /* childrenPos */, NOT_A_DICT_POS /* originalBigramsPos */, - NOT_A_DICT_POS /* originalShortcutPos */, writingPos); -} - -bool DynamicPatriciaTrieWritingHelper::writePtNodeToBufferByCopyingPtNodeInfo( - BufferWithExtendableBuffer *const bufferToWrite, - const PtNodeParams *const originalPtNodeParams, const int parentPos, - const int *const codePoints, const int codePointCount, const int probability, - int *const writingPos) { - return writePtNodeWithFullInfoToBuffer(bufferToWrite, originalPtNodeParams->isBlacklisted(), - originalPtNodeParams->isNotAWord(), parentPos, codePoints, codePointCount, probability, - originalPtNodeParams->getChildrenPos(), originalPtNodeParams->getBigramsPos(), - originalPtNodeParams->getShortcutPos(), writingPos); -} - -bool DynamicPatriciaTrieWritingHelper::createAndInsertNodeIntoPtNodeArray(const int parentPos, - const int *const nodeCodePoints, const int nodeCodePointCount, const int probability, - int *const forwardLinkFieldPos) { - const int newPtNodeArrayPos = mBuffer->getTailPosition(); - if (!DynamicPatriciaTrieWritingUtils::writeForwardLinkPositionAndAdvancePosition(mBuffer, - newPtNodeArrayPos, forwardLinkFieldPos)) { - return false; - } - return createNewPtNodeArrayWithAChildPtNode(parentPos, nodeCodePoints, nodeCodePointCount, - probability); -} - -bool DynamicPatriciaTrieWritingHelper::setPtNodeProbability( - const PtNodeParams *const originalPtNodeParams, const int probability, - bool *const outAddedNewUnigram) { - if (originalPtNodeParams->isTerminal()) { - // Overwrites the probability. - *outAddedNewUnigram = false; - const int probabilityToWrite = getUpdatedProbability( - originalPtNodeParams->getProbability(), probability); - int probabilityFieldPos = originalPtNodeParams->getProbabilityFieldPos(); - if (!DynamicPatriciaTrieWritingUtils::writeProbabilityAndAdvancePosition(mBuffer, - probabilityToWrite, &probabilityFieldPos)) { - return false; - } - } else { - // Make the node terminal and write the probability. - *outAddedNewUnigram = true; - int movedPos = mBuffer->getTailPosition(); - if (!markNodeAsMovedAndSetPosition(originalPtNodeParams, movedPos, movedPos)) { - return false; - } - if (!writePtNodeToBufferByCopyingPtNodeInfo(mBuffer, originalPtNodeParams, - originalPtNodeParams->getParentPos(), originalPtNodeParams->getCodePoints(), - originalPtNodeParams->getCodePointCount(), - getUpdatedProbability(NOT_A_PROBABILITY /* originalProbability */, probability), - &movedPos)) { - return false; - } - } - return true; -} - -bool DynamicPatriciaTrieWritingHelper::createChildrenPtNodeArrayAndAChildPtNode( - const PtNodeParams *const parentPtNodeParams, const int probability, - const int *const codePoints, const int codePointCount) { - const int newPtNodeArrayPos = mBuffer->getTailPosition(); - int childrenPosFieldPos = parentPtNodeParams->getChildrenPosFieldPos(); - if (!DynamicPatriciaTrieWritingUtils::writeChildrenPositionAndAdvancePosition(mBuffer, - newPtNodeArrayPos, &childrenPosFieldPos)) { - return false; - } - return createNewPtNodeArrayWithAChildPtNode(parentPtNodeParams->getHeadPos(), codePoints, - codePointCount, probability); -} - -bool DynamicPatriciaTrieWritingHelper::createNewPtNodeArrayWithAChildPtNode( - const int parentPtNodePos, const int *const nodeCodePoints, const int nodeCodePointCount, - const int probability) { - int writingPos = mBuffer->getTailPosition(); - if (!DynamicPatriciaTrieWritingUtils::writePtNodeArraySizeAndAdvancePosition(mBuffer, - 1 /* arraySize */, &writingPos)) { - return false; - } - if (!writePtNodeToBuffer(mBuffer, parentPtNodePos, nodeCodePoints, nodeCodePointCount, - probability, &writingPos)) { - return false; - } - if (!DynamicPatriciaTrieWritingUtils::writeForwardLinkPositionAndAdvancePosition(mBuffer, - NOT_A_DICT_POS /* forwardLinkPos */, &writingPos)) { - return false; - } - return true; -} - -// Returns whether the dictionary updating was succeeded or not. -bool DynamicPatriciaTrieWritingHelper::reallocatePtNodeAndAddNewPtNodes( - const PtNodeParams *const reallocatingPtNodeParams, const int overlappingCodePointCount, - const int probabilityOfNewPtNode, const int *const newNodeCodePoints, - const int newNodeCodePointCount) { - // When addsExtraChild is true, split the reallocating PtNode and add new child. - // Reallocating PtNode: abcde, newNode: abcxy. - // abc (1st, not terminal) __ de (2nd) - // \_ xy (extra child, terminal) - // Otherwise, this method makes 1st part terminal and write probabilityOfNewPtNode. - // Reallocating PtNode: abcde, newNode: abc. - // abc (1st, terminal) __ de (2nd) - const bool addsExtraChild = newNodeCodePointCount > overlappingCodePointCount; - const int firstPartOfReallocatedPtNodePos = mBuffer->getTailPosition(); - int writingPos = firstPartOfReallocatedPtNodePos; - // Write the 1st part of the reallocating node. The children position will be updated later - // with actual children position. - const int newProbability = addsExtraChild ? NOT_A_PROBABILITY : probabilityOfNewPtNode; - if (!writePtNodeToBuffer(mBuffer, reallocatingPtNodeParams->getParentPos(), - reallocatingPtNodeParams->getCodePoints(), overlappingCodePointCount, newProbability, - &writingPos)) { - return false; - } - const int actualChildrenPos = writingPos; - // Create new children PtNode array. - const size_t newPtNodeCount = addsExtraChild ? 2 : 1; - if (!DynamicPatriciaTrieWritingUtils::writePtNodeArraySizeAndAdvancePosition(mBuffer, - newPtNodeCount, &writingPos)) { - return false; - } - // Write the 2nd part of the reallocating node. - const int secondPartOfReallocatedPtNodePos = writingPos; - if (!writePtNodeToBufferByCopyingPtNodeInfo(mBuffer, reallocatingPtNodeParams, - firstPartOfReallocatedPtNodePos, - reallocatingPtNodeParams->getCodePoints() + overlappingCodePointCount, - reallocatingPtNodeParams->getCodePointCount() - overlappingCodePointCount, - reallocatingPtNodeParams->getProbability(), &writingPos)) { - return false; - } - if (addsExtraChild) { - if (!writePtNodeToBuffer(mBuffer, firstPartOfReallocatedPtNodePos, - newNodeCodePoints + overlappingCodePointCount, - newNodeCodePointCount - overlappingCodePointCount, probabilityOfNewPtNode, - &writingPos)) { - return false; - } - } - if (!DynamicPatriciaTrieWritingUtils::writeForwardLinkPositionAndAdvancePosition(mBuffer, - NOT_A_DICT_POS /* forwardLinkPos */, &writingPos)) { - return false; - } - // Update original reallocating PtNode as moved. - if (!markNodeAsMovedAndSetPosition(reallocatingPtNodeParams, firstPartOfReallocatedPtNodePos, - secondPartOfReallocatedPtNodePos)) { - return false; - } - // Load node info. Information of the 1st part will be fetched. - DynamicPatriciaTrieNodeReader nodeReader(mBuffer, mBigramPolicy, mShortcutPolicy); - const PtNodeParams ptNodeParams( - nodeReader.fetchNodeInfoInBufferFromPtNodePos(firstPartOfReallocatedPtNodePos)); - // Update children position. - int childrenPosFieldPos = ptNodeParams.getChildrenPosFieldPos(); - if (!DynamicPatriciaTrieWritingUtils::writeChildrenPositionAndAdvancePosition(mBuffer, - actualChildrenPos, &childrenPosFieldPos)) { - return false; - } - return true; -} - +// TODO: Make this method version independent. bool DynamicPatriciaTrieWritingHelper::runGC(const int rootPtNodeArrayPos, const HeaderPolicy *const headerPolicy, BufferWithExtendableBuffer *const bufferToWrite, int *const outUnigramCount, int *const outBigramCount) { - DynamicPatriciaTrieNodeReader nodeReader(mBuffer, mBigramPolicy, mShortcutPolicy); - DynamicPatriciaTrieReadingHelper readingHelper(mBuffer, &nodeReader); + DynamicPatriciaTrieNodeReader ptNodeReader(mBuffer, mBigramPolicy, mShortcutPolicy); + DynamicPatriciaTrieReadingHelper readingHelper(mBuffer, &ptNodeReader); readingHelper.initWithPtNodeArrayPos(rootPtNodeArrayPos); DynamicPatriciaTrieGcEventListeners ::TraversePolicyToUpdateUnigramProbabilityAndMarkUselessPtNodesAsDeleted traversePolicyToUpdateUnigramProbabilityAndMarkUselessPtNodesAsDeleted( - headerPolicy, this, mBuffer, mNeedsToDecay); + headerPolicy, mPtNodeWriter, mBuffer, mNeedsToDecay); if (!readingHelper.traverseAllPtNodesInPostorderDepthFirstManner( &traversePolicyToUpdateUnigramProbabilityAndMarkUselessPtNodesAsDeleted)) { return false; @@ -521,8 +105,10 @@ bool DynamicPatriciaTrieWritingHelper::runGC(const int rootPtNodeArrayPos, // Mapping from positions in mBuffer to positions in bufferToWrite. DictPositionRelocationMap dictPositionRelocationMap; readingHelper.initWithPtNodeArrayPos(rootPtNodeArrayPos); + DynamicPatriciaTrieNodeWriter newPtNodeWriter(bufferToWrite, + &ptNodeReader, mBigramPolicy, mShortcutPolicy); DynamicPatriciaTrieGcEventListeners::TraversePolicyToPlaceAndWriteValidPtNodesToBuffer - traversePolicyToPlaceAndWriteValidPtNodesToBuffer(this, bufferToWrite, + traversePolicyToPlaceAndWriteValidPtNodesToBuffer(&newPtNodeWriter, bufferToWrite, &dictPositionRelocationMap); if (!readingHelper.traverseAllPtNodesInPtNodeArrayLevelPreorderDepthFirstManner( &traversePolicyToPlaceAndWriteValidPtNodesToBuffer)) { @@ -539,7 +125,7 @@ bool DynamicPatriciaTrieWritingHelper::runGC(const int rootPtNodeArrayPos, DynamicPatriciaTrieReadingHelper newDictReadingHelper(bufferToWrite, &newDictNodeReader); newDictReadingHelper.initWithPtNodeArrayPos(rootPtNodeArrayPos); DynamicPatriciaTrieGcEventListeners::TraversePolicyToUpdateAllPositionFields - traversePolicyToUpdateAllPositionFields(this, &newDictBigramPolicy, bufferToWrite, + traversePolicyToUpdateAllPositionFields(&newDictBigramPolicy, bufferToWrite, &dictPositionRelocationMap); if (!newDictReadingHelper.traverseAllPtNodesInPtNodeArrayLevelPreorderDepthFirstManner( &traversePolicyToUpdateAllPositionFields)) { @@ -550,14 +136,4 @@ bool DynamicPatriciaTrieWritingHelper::runGC(const int rootPtNodeArrayPos, return true; } -int DynamicPatriciaTrieWritingHelper::getUpdatedProbability(const int originalProbability, - const int newProbability) { - if (mNeedsToDecay) { - return ForgettingCurveUtils::getUpdatedEncodedProbability(originalProbability, - newProbability); - } else { - return newProbability; - } -} - } // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.h index 5614cb3ac..7223dea8b 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.h @@ -29,7 +29,8 @@ class DynamicBigramListPolicy; class DynamicPatriciaTrieReadingHelper; class DynamicShortcutListPolicy; class HeaderPolicy; -class PtNodeParams; +class PtNodeReader; +class PtNodeWriter; // TODO: Make it independent from a particular format and move to pt_common. class DynamicPatriciaTrieWritingHelper { @@ -51,87 +52,34 @@ class DynamicPatriciaTrieWritingHelper { static const size_t MAX_DICTIONARY_SIZE; DynamicPatriciaTrieWritingHelper(BufferWithExtendableBuffer *const buffer, + const PtNodeReader *const ptNodeReader, PtNodeWriter *const ptNodeWriter, DynamicBigramListPolicy *const bigramPolicy, DynamicShortcutListPolicy *const shortcutPolicy, const bool needsToDecay) - : mBuffer(buffer), mBigramPolicy(bigramPolicy), mShortcutPolicy(shortcutPolicy), + : mBuffer(buffer), mPtNodeReader(ptNodeReader), mPtNodeWriter(ptNodeWriter), + mBigramPolicy(bigramPolicy), mShortcutPolicy(shortcutPolicy), mNeedsToDecay(needsToDecay) {} ~DynamicPatriciaTrieWritingHelper() {} - // Add a word to the dictionary. If the word already exists, update the probability. - bool addUnigramWord(DynamicPatriciaTrieReadingHelper *const readingHelper, - const int *const wordCodePoints, const int codePointCount, const int probability, - bool *const outAddedNewUnigram); - - // Add a bigram relation from word0Pos to word1Pos. - bool addBigramWords(const int word0Pos, const int word1Pos, const int probability, - bool *const outAddedNewBigram); - - // Remove a bigram relation from word0Pos to word1Pos. - bool removeBigramWords(const int word0Pos, const int word1Pos); - void writeToDictFile(const char *const fileName, const HeaderPolicy *const headerPolicy, const int unigramCount, const int bigramCount); void writeToDictFileWithGC(const int rootPtNodeArrayPos, const char *const fileName, const HeaderPolicy *const headerPolicy); - // CAVEAT: This method must be called only from inner classes of - // DynamicPatriciaTrieGcEventListeners. - bool markNodeAsDeleted(const PtNodeParams *const toBeUpdatedPtNodeParams); - - // CAVEAT: This method must be called only from this class or inner classes of - // DynamicPatriciaTrieGcEventListeners. - bool writePtNodeToBufferByCopyingPtNodeInfo(BufferWithExtendableBuffer *const bufferToWrite, - const PtNodeParams *const originalPtNodeParams, const int parentPos, - const int *const codePoints, const int codePointCount, const int probability, - int *const writingPos); - private: DISALLOW_IMPLICIT_CONSTRUCTORS(DynamicPatriciaTrieWritingHelper); - static const int CHILDREN_POSITION_FIELD_SIZE; - BufferWithExtendableBuffer *const mBuffer; + const PtNodeReader *const mPtNodeReader; + PtNodeWriter *const mPtNodeWriter; DynamicBigramListPolicy *const mBigramPolicy; DynamicShortcutListPolicy *const mShortcutPolicy; const bool mNeedsToDecay; - bool markNodeAsMovedAndSetPosition(const PtNodeParams *const toBeUpdatedPtNodeParams, - const int movedPos, const int bigramLinkedNodePos); - - bool writePtNodeWithFullInfoToBuffer(BufferWithExtendableBuffer *const bufferToWrite, - const bool isBlacklisted, const bool isNotAWord, - const int parentPos, const int *const codePoints, const int codePointCount, - const int probability, const int childrenPos, const int originalBigramListPos, - const int originalShortcutListPos, int *const writingPos); - - bool writePtNodeToBuffer(BufferWithExtendableBuffer *const bufferToWrite, - const int parentPos, const int *const codePoints, const int codePointCount, - const int probability, int *const writingPos); - - bool createAndInsertNodeIntoPtNodeArray(const int parentPos, const int *const nodeCodePoints, - const int nodeCodePointCount, const int probability, int *const forwardLinkFieldPos); - - bool setPtNodeProbability(const PtNodeParams *const originalPtNodeParams, const int probability, - bool *const outAddedNewUnigram); - - bool createChildrenPtNodeArrayAndAChildPtNode(const PtNodeParams *const parentPtNodeParams, - const int probability, const int *const codePoints, const int codePointCount); - - bool createNewPtNodeArrayWithAChildPtNode(const int parentPos, const int *const nodeCodePoints, - const int nodeCodePointCount, const int probability); - - bool reallocatePtNodeAndAddNewPtNodes( - const PtNodeParams *const reallocatingPtNodeParams, const int overlappingCodePointCount, - const int probabilityOfNewPtNode, const int *const newNodeCodePoints, - const int newNodeCodePointCount); - bool runGC(const int rootPtNodeArrayPos, const HeaderPolicy *const headerPolicy, BufferWithExtendableBuffer *const bufferToWrite, int *const outUnigramCount, int *const outBigramCount); - - int getUpdatedProbability(const int originalProbability, const int newProbability); }; } // namespace latinime #endif /* LATINIME_DYNAMIC_PATRICIA_TRIE_WRITING_HELPER_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/bigram_dict_content.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/bigram_dict_content.cpp new file mode 100644 index 000000000..999460086 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/bigram_dict_content.cpp @@ -0,0 +1,75 @@ +/* + * 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/structure/v4/content/bigram_dict_content.h" + +#include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" + +namespace latinime { + +void BigramDictContent::getBigramEntryAndAdvancePosition(int *const outProbability, + bool *const outHasNext, int *const outTargetTerminalId, int *const bigramEntryPos) const { + const BufferWithExtendableBuffer *const bigramListBuffer = getContentBuffer(); + const int bigramFlags = bigramListBuffer->readUintAndAdvancePosition( + Ver4DictConstants::BIGRAM_FLAGS_FIELD_SIZE, bigramEntryPos); + if (outProbability) { + *outProbability = bigramFlags & Ver4DictConstants::BIGRAM_PROBABILITY_MASK; + } + if (outHasNext) { + *outHasNext = (bigramFlags & Ver4DictConstants::BIGRAM_HAS_NEXT_MASK) != 0; + } + const int targetTerminalId = bigramListBuffer->readUintAndAdvancePosition( + Ver4DictConstants::BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE, bigramEntryPos); + if (outTargetTerminalId) { + *outTargetTerminalId = + (targetTerminalId == Ver4DictConstants::INVALID_BIGRAM_TARGET_TERMINAL_ID) ? + Ver4DictConstants::NOT_A_TERMINAL_ID : targetTerminalId; + } +} + +bool BigramDictContent::writeBigramEntryAndAdvancePosition(const int probability, const int hasNext, + const int targetTerminalId, int *const entryWritingPos) { + BufferWithExtendableBuffer *const bigramListBuffer = getWritableContentBuffer(); + const int bigramFlags = createAndGetBigramFlags(probability, hasNext); + if (!bigramListBuffer->writeUintAndAdvancePosition(bigramFlags, + Ver4DictConstants::BIGRAM_FLAGS_FIELD_SIZE, entryWritingPos)) { + return false; + } + const int targetTerminalIdToWrite = + (targetTerminalId == Ver4DictConstants::NOT_A_TERMINAL_ID) ? + Ver4DictConstants::INVALID_BIGRAM_TARGET_TERMINAL_ID : targetTerminalId; + return bigramListBuffer->writeUintAndAdvancePosition(targetTerminalIdToWrite, + Ver4DictConstants::BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE, entryWritingPos); +} + +bool BigramDictContent::copyBigramList(const int bigramListPos, const int toPos) { + bool hasNext = true; + int readingPos = bigramListPos; + int writingPos = toPos; + while(hasNext) { + int probability = NOT_A_PROBABILITY; + int targetTerminalId = Ver4DictConstants::NOT_A_TERMINAL_ID; + getBigramEntryAndAdvancePosition(&probability, &hasNext, &targetTerminalId, + &readingPos); + if (!writeBigramEntryAndAdvancePosition(probability, hasNext, targetTerminalId, + &writingPos)) { + return false; + } + } + return true; +} + +} // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/bigram_dict_content.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/bigram_dict_content.h index 634c1f08e..bc9e4b619 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/bigram_dict_content.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/bigram_dict_content.h @@ -33,21 +33,15 @@ class BigramDictContent : public SparseTableDictContent { Ver4DictConstants::BIGRAM_ADDRESS_TABLE_BLOCK_SIZE, Ver4DictConstants::BIGRAM_ADDRESS_TABLE_DATA_SIZE) {} - void getBigramEntryAndAdvancePosition(int *const outBigramFlags, - int *const outTargetTerminalId, int *const bigramEntryPos) const { - const BufferWithExtendableBuffer *const bigramListBuffer = getContentBuffer(); - if (outBigramFlags) { - *outBigramFlags = bigramListBuffer->readUintAndAdvancePosition( - Ver4DictConstants::BIGRAM_FRAGS_FIELD_SIZE, bigramEntryPos); - } - if (outTargetTerminalId) { - *outTargetTerminalId = bigramListBuffer->readUintAndAdvancePosition( - Ver4DictConstants::BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE, bigramEntryPos); - } - } + BigramDictContent() + : SparseTableDictContent(Ver4DictConstants::BIGRAM_ADDRESS_TABLE_BLOCK_SIZE, + Ver4DictConstants::BIGRAM_ADDRESS_TABLE_DATA_SIZE) {} + + void getBigramEntryAndAdvancePosition(int *const outProbability, bool *const outHasNext, + int *const outTargetTerminalId, int *const bigramEntryPos) const; - // Returns head position of bigram list for a PtNode specified by terminalId. - int getBigramListHeadPos(const int terminalId) const { + // Returns head position of bigram list for a PtNode specified by terminalId. + int getBigramListHeadPos(const int terminalId) const { const SparseTable *const addressLookupTable = getAddressLookupTable(); if (!addressLookupTable->contains(terminalId)) { return NOT_A_DICT_POS; @@ -55,8 +49,23 @@ class BigramDictContent : public SparseTableDictContent { return addressLookupTable->get(terminalId); } + bool writeBigramEntryAndAdvancePosition(const int probability, const int hasNext, + const int targetTerminalId, int *const entryWritingPos); + + bool createNewBigramList(const int terminalId) { + const int bigramListPos = getContentBuffer()->getTailPosition(); + return getUpdatableAddressLookupTable()->set(terminalId, bigramListPos); + } + + bool copyBigramList(const int bigramListPos, const int toPos); + private: - DISALLOW_IMPLICIT_CONSTRUCTORS(BigramDictContent); + DISALLOW_COPY_AND_ASSIGN(BigramDictContent); + + int createAndGetBigramFlags(const int probability, const bool hasNext) const { + return (probability & Ver4DictConstants::BIGRAM_PROBABILITY_MASK) + | (hasNext ? Ver4DictConstants::BIGRAM_HAS_NEXT_MASK : 0); + } }; } // namespace latinime #endif /* LATINIME_BIGRAM_DICT_CONTENT_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/probability_dict_content.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/probability_dict_content.h index daaf08f61..c109cbf51 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/probability_dict_content.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/probability_dict_content.h @@ -31,6 +31,8 @@ class ProbabilityDictContent : public SingleDictContent { : SingleDictContent(dictDirPath, Ver4DictConstants::FREQ_FILE_EXTENSION, isUpdatable) {} + ProbabilityDictContent() {} + int getProbability(const int terminalId) const { if (terminalId < 0 || terminalId >= getSize()) { return NOT_A_PROBABILITY; @@ -38,8 +40,30 @@ class ProbabilityDictContent : public SingleDictContent { return Ver4PatriciaTrieReadingUtils::getProbability(getBuffer(), terminalId); } + bool setProbability(const int terminalId, const int probability) { + if (terminalId < 0 || terminalId > getSize()) { + return false; + } + if (terminalId == getSize()) { + // Write new entry. + int flagWritingPos = terminalId * (Ver4DictConstants::FLAGS_IN_PROBABILITY_FILE_SIZE + + Ver4DictConstants::PROBABILITY_SIZE); + const int dummyFlags = 0; + // Write dummy flags. + if (!getWritableBuffer()->writeUintAndAdvancePosition(dummyFlags, + Ver4DictConstants::FLAGS_IN_PROBABILITY_FILE_SIZE, &flagWritingPos)) { + return false; + } + } + int probabilityWritingPos = terminalId * (Ver4DictConstants::FLAGS_IN_PROBABILITY_FILE_SIZE + + Ver4DictConstants::PROBABILITY_SIZE) + + Ver4DictConstants::FLAGS_IN_PROBABILITY_FILE_SIZE; + return getWritableBuffer()->writeUintAndAdvancePosition(probability, + Ver4DictConstants::PROBABILITY_SIZE, &probabilityWritingPos); + } + private: - DISALLOW_IMPLICIT_CONSTRUCTORS(ProbabilityDictContent); + DISALLOW_COPY_AND_ASSIGN(ProbabilityDictContent); int getSize() const { return getBuffer()->getTailPosition() / (Ver4DictConstants::PROBABILITY_SIZE diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/shortcut_dict_content.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/shortcut_dict_content.h new file mode 100644 index 000000000..8463a1753 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/shortcut_dict_content.h @@ -0,0 +1,67 @@ +/* + * 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_DICT_CONTENT_H +#define LATINIME_SHORTCUT_DICT_CONTENT_H + +#include "defines.h" +#include "suggest/policyimpl/dictionary/structure/v4/content/sparse_table_dict_content.h" +#include "suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.h" + +namespace latinime { + +class ShortcutDictContent : public SparseTableDictContent { + public: + ShortcutDictContent(const char *const dictDirPath, const bool isUpdatable) + : SparseTableDictContent(dictDirPath, + Ver4DictConstants::SHORTCUT_LOOKUP_TABLE_FILE_EXTENSION, + Ver4DictConstants::SHORTCUT_CONTENT_TABLE_FILE_EXTENSION, + Ver4DictConstants::SHORTCUT_FILE_EXTENSION, isUpdatable, + Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_BLOCK_SIZE, + Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_DATA_SIZE) {} + + ShortcutDictContent() + : SparseTableDictContent(Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_BLOCK_SIZE, + Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_DATA_SIZE) {} + + void getShortcutEntryAndAdvancePosition(const int maxCodePointCount, + int *const outCodePoint, int *const outCodePointCount, int *const outShortcutFlags, + int *const shortcutEntryPos) const { + const BufferWithExtendableBuffer *const shortcutListBuffer = getContentBuffer(); + if (outShortcutFlags) { + *outShortcutFlags = shortcutListBuffer->readUintAndAdvancePosition( + Ver4DictConstants::SHORTCUT_FLAGS_FIELD_SIZE, shortcutEntryPos); + } + if (outCodePoint && outCodePointCount) { + shortcutListBuffer->readCodePointsAndAdvancePosition( + maxCodePointCount, outCodePoint, outCodePointCount, shortcutEntryPos); + } + } + + // Returns head position of shortcut list for a PtNode specified by terminalId. + int getShortcutListHeadPos(const int terminalId) const { + const SparseTable *const addressLookupTable = getAddressLookupTable(); + if (!addressLookupTable->contains(terminalId)) { + return NOT_A_DICT_POS; + } + return addressLookupTable->get(terminalId); + } + + private: + DISALLOW_COPY_AND_ASSIGN(ShortcutDictContent); +}; +} // namespace latinime +#endif /* LATINIME_SHORTCUT_DICT_CONTENT_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/single_dict_content.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/single_dict_content.h index 4cb96da6a..7669c1eca 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/single_dict_content.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/single_dict_content.h @@ -19,6 +19,7 @@ #include "defines.h" #include "suggest/policyimpl/dictionary/structure/v4/content/dict_content.h" +#include "suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.h" #include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" #include "suggest/policyimpl/dictionary/utils/mmapped_buffer.h" @@ -31,12 +32,17 @@ class SingleDictContent : public DictContent { : mMmappedBuffer(MmappedBuffer::openBuffer(dictDirPath, contentFileName, isUpdatable)), mExpandableContentBuffer(mMmappedBuffer.get() ? mMmappedBuffer.get()->getBuffer() : 0, mMmappedBuffer.get() ? mMmappedBuffer.get()->getBufferSize() : 0, - BufferWithExtendableBuffer::DEFAULT_MAX_ADDITIONAL_BUFFER_SIZE) {} + BufferWithExtendableBuffer::DEFAULT_MAX_ADDITIONAL_BUFFER_SIZE), + mIsValid(mMmappedBuffer.get() != 0) {} + + SingleDictContent() + : mMmappedBuffer(0), mExpandableContentBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE), + mIsValid(true) {} virtual ~SingleDictContent() {} virtual bool isValid() const { - return mMmappedBuffer.get() != 0; + return mIsValid; } protected: @@ -49,10 +55,11 @@ class SingleDictContent : public DictContent { } private: - DISALLOW_IMPLICIT_CONSTRUCTORS(SingleDictContent); + DISALLOW_COPY_AND_ASSIGN(SingleDictContent); const MmappedBuffer::MmappedBufferPtr mMmappedBuffer; BufferWithExtendableBuffer mExpandableContentBuffer; + const bool mIsValid; }; } // namespace latinime #endif /* LATINIME_SINGLE_DICT_CONTENT_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/sparse_table_dict_content.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/sparse_table_dict_content.h index 71868e9ca..5ae5f0ff1 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/sparse_table_dict_content.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/sparse_table_dict_content.h @@ -19,6 +19,7 @@ #include "defines.h" #include "suggest/policyimpl/dictionary/structure/v4/content/dict_content.h" +#include "suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.h" #include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" #include "suggest/policyimpl/dictionary/utils/mmapped_buffer.h" #include "suggest/policyimpl/dictionary/utils/sparse_table.h" @@ -49,20 +50,37 @@ class SparseTableDictContent : public DictContent { mContentBuffer.get() ? mContentBuffer.get()->getBufferSize() : 0, BufferWithExtendableBuffer::DEFAULT_MAX_ADDITIONAL_BUFFER_SIZE), mAddressLookupTable(&mExpandableLookupTableBuffer, &mExpandableAddressTableBuffer, - sparseTableBlockSize, sparseTableDataSize) {} + sparseTableBlockSize, sparseTableDataSize), + mIsValid(mLookupTableBuffer.get() != 0 && mAddressTableBuffer.get() != 0 + && mContentBuffer.get() != 0) {} + + SparseTableDictContent(const int sparseTableBlockSize, const int sparseTableDataSize) + : mLookupTableBuffer(0), mAddressTableBuffer(0), mContentBuffer(0), + mExpandableLookupTableBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE), + mExpandableAddressTableBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE), + mExpandableContentBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE), + mAddressLookupTable(&mExpandableLookupTableBuffer, &mExpandableAddressTableBuffer, + sparseTableBlockSize, sparseTableDataSize), mIsValid(true) {} virtual ~SparseTableDictContent() {} virtual bool isValid() const { - return mLookupTableBuffer.get() != 0 && mAddressTableBuffer.get() != 0 - && mContentBuffer.get() != 0; + return mIsValid; } protected: + SparseTable *getUpdatableAddressLookupTable() { + return &mAddressLookupTable; + } + const SparseTable *getAddressLookupTable() const { return &mAddressLookupTable; } + BufferWithExtendableBuffer *getWritableContentBuffer() { + return &mExpandableContentBuffer; + } + const BufferWithExtendableBuffer *getContentBuffer() const { return &mExpandableContentBuffer; } @@ -70,7 +88,6 @@ class SparseTableDictContent : public DictContent { private: DISALLOW_IMPLICIT_CONSTRUCTORS(SparseTableDictContent); - // TODO: Have sparse table. const MmappedBuffer::MmappedBufferPtr mLookupTableBuffer; const MmappedBuffer::MmappedBufferPtr mAddressTableBuffer; const MmappedBuffer::MmappedBufferPtr mContentBuffer; @@ -78,6 +95,7 @@ class SparseTableDictContent : public DictContent { BufferWithExtendableBuffer mExpandableAddressTableBuffer; BufferWithExtendableBuffer mExpandableContentBuffer; SparseTable mAddressLookupTable; + const bool mIsValid; }; } // namespace latinime #endif /* LATINIME_SPARSE_TABLE_DICT_CONTENT_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/terminal_position_lookup_table.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/terminal_position_lookup_table.h index 173d0da05..e016a2b5f 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/terminal_position_lookup_table.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/content/terminal_position_lookup_table.h @@ -38,6 +38,8 @@ class TerminalPositionLookupTable : public SingleDictContent { / Ver4DictConstants::TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE), mHeaderRegionSize(headerRegionSize) {} + TerminalPositionLookupTable() : mSize(0), mHeaderRegionSize(0) {} + int getTerminalPtNodePosition(const int terminalId) const { if (terminalId < 0 || terminalId >= mSize) { return NOT_A_DICT_POS; @@ -47,10 +49,28 @@ class TerminalPositionLookupTable : public SingleDictContent { readingPos) - mHeaderRegionSize; } + bool setTerminalPtNodePosition(const int terminalId, const int terminalPtNodePos) { + if (terminalId < 0 || terminalId > mSize) { + return NOT_A_DICT_POS; + } + if (terminalId == mSize) { + // Use new terminal id. + mSize += 1; + } + int writingPos = terminalId * Ver4DictConstants::TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE; + return getWritableBuffer()->writeUintAndAdvancePosition( + terminalPtNodePos + mHeaderRegionSize, + Ver4DictConstants::TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE, &writingPos); + } + + int getNextTerminalId() const { + return mSize; + } + private: - DISALLOW_IMPLICIT_CONSTRUCTORS(TerminalPositionLookupTable); + DISALLOW_COPY_AND_ASSIGN(TerminalPositionLookupTable); - const int mSize; + int mSize; const int mHeaderRegionSize; }; } // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_buffers.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_buffers.h index 4e10403f3..e468be591 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_buffers.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_buffers.h @@ -21,8 +21,7 @@ #include "suggest/policyimpl/dictionary/header/header_read_write_utils.h" #include "suggest/policyimpl/dictionary/structure/v4/content/bigram_dict_content.h" #include "suggest/policyimpl/dictionary/structure/v4/content/probability_dict_content.h" -#include "suggest/policyimpl/dictionary/structure/v4/content/single_dict_content.h" -#include "suggest/policyimpl/dictionary/structure/v4/content/sparse_table_dict_content.h" +#include "suggest/policyimpl/dictionary/structure/v4/content/shortcut_dict_content.h" #include "suggest/policyimpl/dictionary/structure/v4/content/terminal_position_lookup_table.h" #include "suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.h" #include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" @@ -34,61 +33,102 @@ class Ver4DictBuffers { public: typedef ExclusiveOwnershipPointer<Ver4DictBuffers> Ver4DictBuffersPtr; - static Ver4DictBuffersPtr openVer4DictBuffers(const char *const dictDirPath, + static AK_FORCE_INLINE Ver4DictBuffersPtr openVer4DictBuffers(const char *const dictDirPath, const MmappedBuffer::MmappedBufferPtr &dictBuffer) { const bool isUpdatable = dictBuffer.get() ? dictBuffer.get()->isUpdatable() : false; return Ver4DictBuffersPtr(new Ver4DictBuffers(dictDirPath, dictBuffer, isUpdatable)); } + static AK_FORCE_INLINE Ver4DictBuffersPtr createVer4DictBuffers() { + return Ver4DictBuffersPtr(new Ver4DictBuffers()); + } + AK_FORCE_INLINE bool isValid() const { return mDictBuffer.get() != 0 && mProbabilityDictContent.isValid() && mTerminalPositionLookupTable.isValid() && mBigramDictContent.isValid() && mShortcutDictContent.isValid(); } - AK_FORCE_INLINE uint8_t *getRawDictBuffer() const { - return mDictBuffer.get()->getBuffer(); + AK_FORCE_INLINE BufferWithExtendableBuffer *getWritableHeaderBuffer() { + return &mExpandableHeaderBuffer; } - AK_FORCE_INLINE int getRawDictBufferSize() const { - return mDictBuffer.get()->getBufferSize(); + AK_FORCE_INLINE BufferWithExtendableBuffer *getWritableTrieBuffer() { + return &mExpandableTrieBuffer; + } + + AK_FORCE_INLINE TerminalPositionLookupTable *getUpdatableTerminalPositionLookupTable() { + return &mTerminalPositionLookupTable; } AK_FORCE_INLINE const TerminalPositionLookupTable *getTerminalPositionLookupTable() const { return &mTerminalPositionLookupTable; } + AK_FORCE_INLINE ProbabilityDictContent *getUpdatableProbabilityDictContent() { + return &mProbabilityDictContent; + } + AK_FORCE_INLINE const ProbabilityDictContent *getProbabilityDictContent() const { return &mProbabilityDictContent; } + AK_FORCE_INLINE BigramDictContent *getUpdatableBigramDictContent() { + return &mBigramDictContent; + } + AK_FORCE_INLINE const BigramDictContent *getBigramDictContent() const { return &mBigramDictContent; } + AK_FORCE_INLINE const ShortcutDictContent *getShortcutDictContent() const { + return &mShortcutDictContent; + } + + AK_FORCE_INLINE bool isUpdatable() const { + return mIsUpdatable; + } + + bool flush(const char *const dictDirPath) { + // TODO: Implement. + return false; + } + private: - DISALLOW_IMPLICIT_CONSTRUCTORS(Ver4DictBuffers); + DISALLOW_COPY_AND_ASSIGN(Ver4DictBuffers); AK_FORCE_INLINE Ver4DictBuffers(const char *const dictDirPath, const MmappedBuffer::MmappedBufferPtr &dictBuffer, const bool isUpdatable) : mDictBuffer(dictBuffer), - // TODO: Quit using getHeaderSize. - mTerminalPositionLookupTable(dictDirPath, isUpdatable, - HeaderReadWriteUtils::getHeaderSize(mDictBuffer.get()->getBuffer())), + mHeaderSize(HeaderReadWriteUtils::getHeaderSize(mDictBuffer.get()->getBuffer())), + mExpandableHeaderBuffer(dictBuffer.get()->getBuffer(), mHeaderSize, + BufferWithExtendableBuffer::DEFAULT_MAX_ADDITIONAL_BUFFER_SIZE), + mExpandableTrieBuffer(dictBuffer.get()->getBuffer() + mHeaderSize, + dictBuffer.get()->getBufferSize() - mHeaderSize, + BufferWithExtendableBuffer::DEFAULT_MAX_ADDITIONAL_BUFFER_SIZE), + // TODO: Quit using header size. + mTerminalPositionLookupTable(dictDirPath, isUpdatable, mHeaderSize), mProbabilityDictContent(dictDirPath, isUpdatable), mBigramDictContent(dictDirPath, isUpdatable), - mShortcutDictContent(dictDirPath, - Ver4DictConstants::SHORTCUT_LOOKUP_TABLE_FILE_EXTENSION, - Ver4DictConstants::SHORTCUT_CONTENT_TABLE_FILE_EXTENSION, - Ver4DictConstants::SHORTCUT_FILE_EXTENSION, isUpdatable, - Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_BLOCK_SIZE, - Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_DATA_SIZE) {} + mShortcutDictContent(dictDirPath, isUpdatable), + mIsUpdatable(isUpdatable) {} + + AK_FORCE_INLINE Ver4DictBuffers() + : mDictBuffer(0), mHeaderSize(0), + mExpandableHeaderBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE), + mExpandableTrieBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE), + mTerminalPositionLookupTable(), mProbabilityDictContent(), + mBigramDictContent(), mShortcutDictContent(), mIsUpdatable(true) {} const MmappedBuffer::MmappedBufferPtr mDictBuffer; + const int mHeaderSize; + BufferWithExtendableBuffer mExpandableHeaderBuffer; + BufferWithExtendableBuffer mExpandableTrieBuffer; TerminalPositionLookupTable mTerminalPositionLookupTable; ProbabilityDictContent mProbabilityDictContent; BigramDictContent mBigramDictContent; - SparseTableDictContent mShortcutDictContent; + ShortcutDictContent mShortcutDictContent; + const int mIsUpdatable; }; } // namespace latinime #endif /* LATINIME_VER4_DICT_BUFFER_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.cpp index fb29c0c4a..af13a374a 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.cpp @@ -30,10 +30,15 @@ const char *const Ver4DictConstants::SHORTCUT_LOOKUP_TABLE_FILE_EXTENSION = ".sh const char *const Ver4DictConstants::SHORTCUT_CONTENT_TABLE_FILE_EXTENSION = ".shortcut_index_shortcut"; +// Version 4 dictionary size is implicitly limited to 8MB due to 3-byte offsets. +// TODO: Make MAX_DICTIONARY_SIZE 8MB. +const int Ver4DictConstants::MAX_DICTIONARY_SIZE = 2 * 1024 * 1024; + const int Ver4DictConstants::NOT_A_TERMINAL_ID = -1; const int Ver4DictConstants::PROBABILITY_SIZE = 1; const int Ver4DictConstants::FLAGS_IN_PROBABILITY_FILE_SIZE = 1; const int Ver4DictConstants::TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE = 3; +const int Ver4DictConstants::TERMINAL_ID_FIELD_SIZE = 4; const int Ver4DictConstants::BIGRAM_ADDRESS_TABLE_BLOCK_SIZE = 4; const int Ver4DictConstants::BIGRAM_ADDRESS_TABLE_DATA_SIZE = 4; @@ -41,6 +46,14 @@ const int Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_BLOCK_SIZE = 16; const int Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_DATA_SIZE = 4; const int Ver4DictConstants::BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE = 3; -const int Ver4DictConstants::BIGRAM_FRAGS_FIELD_SIZE = 1; +// Unsigned int max value of BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE-byte is used for representing +// invalid terminal ID in bigram lists. +const int Ver4DictConstants::INVALID_BIGRAM_TARGET_TERMINAL_ID = + (1 << (BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE * 8)) - 1; +const int Ver4DictConstants::BIGRAM_FLAGS_FIELD_SIZE = 1; +const int Ver4DictConstants::BIGRAM_PROBABILITY_MASK = 0x0F; +const int Ver4DictConstants::BIGRAM_HAS_NEXT_MASK = 0x80; + +const int Ver4DictConstants::SHORTCUT_FLAGS_FIELD_SIZE = 1; } // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.h index a0bebb75f..cfb7740be 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_dict_constants.h @@ -34,18 +34,27 @@ class Ver4DictConstants { static const char *const SHORTCUT_LOOKUP_TABLE_FILE_EXTENSION; static const char *const SHORTCUT_CONTENT_TABLE_FILE_EXTENSION; + static const int MAX_DICTIONARY_SIZE; + static const int NOT_A_TERMINAL_ID; static const int PROBABILITY_SIZE; static const int FLAGS_IN_PROBABILITY_FILE_SIZE; static const int TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE; + static const int TERMINAL_ID_FIELD_SIZE; static const int BIGRAM_ADDRESS_TABLE_BLOCK_SIZE; static const int BIGRAM_ADDRESS_TABLE_DATA_SIZE; static const int SHORTCUT_ADDRESS_TABLE_BLOCK_SIZE; static const int SHORTCUT_ADDRESS_TABLE_DATA_SIZE; - static const int BIGRAM_FRAGS_FIELD_SIZE; + static const int BIGRAM_FLAGS_FIELD_SIZE; static const int BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE; + static const int INVALID_BIGRAM_TARGET_TERMINAL_ID; + static const int BIGRAM_PROBABILITY_MASK; + static const int BIGRAM_HAS_NEXT_MASK; + + static const int SHORTCUT_FLAGS_FIELD_SIZE; + private: DISALLOW_IMPLICIT_CONSTRUCTORS(Ver4DictConstants); }; diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_writer.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_writer.cpp new file mode 100644 index 000000000..b572ee87f --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_writer.cpp @@ -0,0 +1,199 @@ +/* + * 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/structure/v4/ver4_patricia_trie_node_writer.h" + +#include "suggest/policyimpl/dictionary/bigram/ver4_bigram_list_policy.h" +#include "suggest/policyimpl/dictionary/shortcut/dynamic_shortcut_list_policy.h" +#include "suggest/policyimpl/dictionary/structure/v2/patricia_trie_reading_utils.h" +#include "suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_reader.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_utils.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_utils.h" +#include "suggest/policyimpl/dictionary/structure/v4/ver4_dict_buffers.h" +#include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" + +namespace latinime { + +const int Ver4PatriciaTrieNodeWriter::CHILDREN_POSITION_FIELD_SIZE = 3; + +bool Ver4PatriciaTrieNodeWriter::markPtNodeAsDeleted( + const PtNodeParams *const toBeUpdatedPtNodeParams) { + int pos = toBeUpdatedPtNodeParams->getHeadPos(); + const bool usesAdditionalBuffer = mTrieBuffer->isInAdditionalBuffer(pos); + const uint8_t *const dictBuf = mTrieBuffer->getBuffer(usesAdditionalBuffer); + if (usesAdditionalBuffer) { + pos -= mTrieBuffer->getOriginalBufferSize(); + } + // Read original flags + const PatriciaTrieReadingUtils::NodeFlags originalFlags = + PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictBuf, &pos); + const PatriciaTrieReadingUtils::NodeFlags updatedFlags = + DynamicPatriciaTrieReadingUtils::updateAndGetFlags(originalFlags, false /* isMoved */, + true /* isDeleted */); + int writingPos = toBeUpdatedPtNodeParams->getHeadPos(); + // Update flags. + return DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mTrieBuffer, updatedFlags, + &writingPos); +} + +bool Ver4PatriciaTrieNodeWriter::markPtNodeAsMoved( + const PtNodeParams *const toBeUpdatedPtNodeParams, + const int movedPos, const int bigramLinkedNodePos) { + int pos = toBeUpdatedPtNodeParams->getHeadPos(); + const bool usesAdditionalBuffer = mTrieBuffer->isInAdditionalBuffer(pos); + const uint8_t *const dictBuf = mTrieBuffer->getBuffer(usesAdditionalBuffer); + if (usesAdditionalBuffer) { + pos -= mTrieBuffer->getOriginalBufferSize(); + } + // Read original flags + const PatriciaTrieReadingUtils::NodeFlags originalFlags = + PatriciaTrieReadingUtils::getFlagsAndAdvancePosition(dictBuf, &pos); + const PatriciaTrieReadingUtils::NodeFlags updatedFlags = + DynamicPatriciaTrieReadingUtils::updateAndGetFlags(originalFlags, true /* isMoved */, + false /* isDeleted */); + int writingPos = toBeUpdatedPtNodeParams->getHeadPos(); + // Update flags. + if (!DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mTrieBuffer, updatedFlags, + &writingPos)) { + return false; + } + // Update moved position, which is stored in the parent offset field. + if (!DynamicPatriciaTrieWritingUtils::writeParentPosOffsetAndAdvancePosition( + mTrieBuffer, movedPos, toBeUpdatedPtNodeParams->getHeadPos(), &writingPos)) { + return false; + } + // Update bigram linked node position, which is stored in the children position field. + int childrenPosFieldPos = toBeUpdatedPtNodeParams->getChildrenPosFieldPos(); + if (!DynamicPatriciaTrieWritingUtils::writeChildrenPositionAndAdvancePosition( + mTrieBuffer, bigramLinkedNodePos, &childrenPosFieldPos)) { + return false; + } + if (toBeUpdatedPtNodeParams->hasChildren()) { + // Update children's parent position. + mReadingHelper.initWithPtNodeArrayPos(toBeUpdatedPtNodeParams->getChildrenPos()); + while (!mReadingHelper.isEnd()) { + const PtNodeParams childPtNodeParams(mReadingHelper.getPtNodeParams()); + int parentOffsetFieldPos = childPtNodeParams.getHeadPos() + + DynamicPatriciaTrieWritingUtils::NODE_FLAG_FIELD_SIZE; + if (!DynamicPatriciaTrieWritingUtils::writeParentPosOffsetAndAdvancePosition( + mTrieBuffer, bigramLinkedNodePos, childPtNodeParams.getHeadPos(), + &parentOffsetFieldPos)) { + // Parent offset cannot be written because of a bug or a broken dictionary; thus, + // we give up to update dictionary. + return false; + } + mReadingHelper.readNextSiblingNode(childPtNodeParams); + } + } + return true; +} + +bool Ver4PatriciaTrieNodeWriter::updatePtNodeProbability( + const PtNodeParams *const toBeUpdatedPtNodeParams, const int newProbability) { + if (!toBeUpdatedPtNodeParams->isTerminal()) { + return false; + } + return mBuffers->getUpdatableProbabilityDictContent()->setProbability( + toBeUpdatedPtNodeParams->getTerminalId(), newProbability); +} + +bool Ver4PatriciaTrieNodeWriter::updateChildrenPosition( + const PtNodeParams *const toBeUpdatedPtNodeParams, const int newChildrenPosition) { + int childrenPosFieldPos = toBeUpdatedPtNodeParams->getChildrenPosFieldPos(); + return DynamicPatriciaTrieWritingUtils::writeChildrenPositionAndAdvancePosition(mTrieBuffer, + newChildrenPosition, &childrenPosFieldPos); +} + +bool Ver4PatriciaTrieNodeWriter::writePtNodeAndAdvancePosition( + const PtNodeParams *const ptNodeParams, int *const ptNodeWritingPos) { + const int nodePos = *ptNodeWritingPos; + // Write dummy flags. The Node flags are updated with appropriate flags at the last step of the + // PtNode writing. + if (!DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mTrieBuffer, + 0 /* nodeFlags */, ptNodeWritingPos)) { + return false; + } + // Calculate a parent offset and write the offset. + if (!DynamicPatriciaTrieWritingUtils::writeParentPosOffsetAndAdvancePosition(mTrieBuffer, + ptNodeParams->getParentPos(), nodePos, ptNodeWritingPos)) { + return false; + } + // Write code points + if (!DynamicPatriciaTrieWritingUtils::writeCodePointsAndAdvancePosition(mTrieBuffer, + ptNodeParams->getCodePoints(), ptNodeParams->getCodePointCount(), ptNodeWritingPos)) { + return false; + } + int terminalId = Ver4DictConstants::NOT_A_TERMINAL_ID; + if (ptNodeParams->getTerminalId() != Ver4DictConstants::NOT_A_TERMINAL_ID) { + terminalId = ptNodeParams->getTerminalId(); + } else if (ptNodeParams->getProbability() != NOT_A_PROBABILITY) { + // Write terminal information using a new terminal id. + // Get a new unused terminal id. + terminalId = mBuffers->getTerminalPositionLookupTable()->getNextTerminalId(); + } + const int isTerminal = terminalId != Ver4DictConstants::NOT_A_TERMINAL_ID; + if (isTerminal) { + // Update the lookup table. + if (!mBuffers->getUpdatableTerminalPositionLookupTable()->setTerminalPtNodePosition( + terminalId, nodePos)) { + return false; + } + // Write terminal Id. + if (!mTrieBuffer->writeUintAndAdvancePosition(terminalId, + Ver4DictConstants::TERMINAL_ID_FIELD_SIZE, ptNodeWritingPos)) { + return false; + } + // Write probability. + if (!mBuffers->getUpdatableProbabilityDictContent()->setProbability( + terminalId, ptNodeParams->getProbability())) { + return false; + } + } + // Write children position + if (!DynamicPatriciaTrieWritingUtils::writeChildrenPositionAndAdvancePosition(mTrieBuffer, + ptNodeParams->getChildrenPos(), ptNodeWritingPos)) { + return false; + } + // Create node flags and write them. + PatriciaTrieReadingUtils::NodeFlags nodeFlags = + PatriciaTrieReadingUtils::createAndGetFlags(ptNodeParams->isBlacklisted(), + ptNodeParams->isNotAWord(), isTerminal, + false /* hasShortcutTargets */, false /* hasBigrams */, + ptNodeParams->getCodePointCount() > 1 /* hasMultipleChars */, + CHILDREN_POSITION_FIELD_SIZE); + int flagsFieldPos = nodePos; + if (!DynamicPatriciaTrieWritingUtils::writeFlagsAndAdvancePosition(mTrieBuffer, nodeFlags, + &flagsFieldPos)) { + return false; + } + return true; +} + +bool Ver4PatriciaTrieNodeWriter::addNewBigramEntry( + const PtNodeParams *const sourcePtNodeParams, + const PtNodeParams *const targetPtNodeParam, const int probability, + bool *const outAddedNewBigram) { + return mBigramPolicy->addNewEntry(sourcePtNodeParams->getTerminalId(), + targetPtNodeParam->getTerminalId(), probability, outAddedNewBigram); +} + +bool Ver4PatriciaTrieNodeWriter::removeBigramEntry( + const PtNodeParams *const sourcePtNodeParams, const PtNodeParams *const targetPtNodeParam) { + return mBigramPolicy->removeEntry(sourcePtNodeParams->getTerminalId(), + targetPtNodeParam->getTerminalId()); +} + +} diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_writer.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_writer.h new file mode 100644 index 000000000..d11952304 --- /dev/null +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_writer.h @@ -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. + */ + +#ifndef LATINIME_VER4_PATRICIA_TRIE_NODE_WRITER_H +#define LATINIME_VER4_PATRICIA_TRIE_NODE_WRITER_H + +#include <stdint.h> + +#include "defines.h" +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_params.h" +#include "suggest/policyimpl/dictionary/structure/pt_common/pt_node_writer.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.h" +#include "suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_reader.h" + +namespace latinime { + +class BufferWithExtendableBuffer; +class Ver4BigramListPolicy; +class Ver4DictBuffers; +class Ver4ShortcutListPolicy; + +/* + * This class is used for helping to writes nodes of ver4 patricia trie. + */ +class Ver4PatriciaTrieNodeWriter : public PtNodeWriter { + public: + Ver4PatriciaTrieNodeWriter(BufferWithExtendableBuffer *const trieBuffer, + Ver4DictBuffers *const buffers, const Ver4PatriciaTrieNodeReader *const ptNodeReader, + Ver4BigramListPolicy *const bigramPolicy, Ver4ShortcutListPolicy *const shortcutPolicy) + : mTrieBuffer(trieBuffer), mBuffers(buffers), mPtNodeReader(ptNodeReader), + mReadingHelper(mTrieBuffer, mPtNodeReader), + mBigramPolicy(bigramPolicy), mShortcutPolicy(shortcutPolicy) {} + + virtual ~Ver4PatriciaTrieNodeWriter() {} + + virtual bool markPtNodeAsDeleted(const PtNodeParams *const toBeUpdatedPtNodeParams); + + virtual bool markPtNodeAsMoved(const PtNodeParams *const toBeUpdatedPtNodeParams, + const int movedPos, const int bigramLinkedNodePos); + + virtual bool updatePtNodeProbability(const PtNodeParams *const toBeUpdatedPtNodeParams, + const int newProbability); + + virtual bool updateChildrenPosition(const PtNodeParams *const toBeUpdatedPtNodeParams, + const int newChildrenPosition); + + virtual bool writePtNodeAndAdvancePosition(const PtNodeParams *const ptNodeParams, + int *const ptNodeWritingPos); + + virtual bool addNewBigramEntry(const PtNodeParams *const sourcePtNodeParams, + const PtNodeParams *const targetPtNodeParam, const int probability, + bool *const outAddedNewBigram); + + virtual bool removeBigramEntry(const PtNodeParams *const sourcePtNodeParams, + const PtNodeParams *const targetPtNodeParam); + + private: + DISALLOW_COPY_AND_ASSIGN(Ver4PatriciaTrieNodeWriter); + + static const int CHILDREN_POSITION_FIELD_SIZE; + + BufferWithExtendableBuffer *const mTrieBuffer; + Ver4DictBuffers *const mBuffers; + const Ver4PatriciaTrieNodeReader *const mPtNodeReader; + DynamicPatriciaTrieReadingHelper mReadingHelper; + Ver4BigramListPolicy *const mBigramPolicy; + Ver4ShortcutListPolicy *const mShortcutPolicy; + +}; +} // namespace latinime +#endif /* LATINIME_VER4_PATRICIA_TRIE_NODE_WRITER_H */ diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.cpp index 43ad301db..698483a79 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.cpp @@ -19,18 +19,23 @@ #include "suggest/core/dicnode/dic_node.h" #include "suggest/core/dicnode/dic_node_vector.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_reading_helper.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_helper.h" #include "suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_reader.h" #include "suggest/policyimpl/dictionary/utils/forgetting_curve_utils.h" #include "suggest/policyimpl/dictionary/utils/probability_utils.h" namespace latinime { +const int Ver4PatriciaTriePolicy::MARGIN_TO_REFUSE_DYNAMIC_OPERATIONS = 1024; +const int Ver4PatriciaTriePolicy::MIN_DICT_SIZE_TO_REFUSE_DYNAMIC_OPERATIONS = + Ver4DictConstants::MAX_DICTIONARY_SIZE - MARGIN_TO_REFUSE_DYNAMIC_OPERATIONS; + void Ver4PatriciaTriePolicy::createAndGetAllChildDicNodes(const DicNode *const dicNode, DicNodeVector *const childDicNodes) const { if (!dicNode->hasChildren()) { return; } - DynamicPatriciaTrieReadingHelper readingHelper(&mDictBuffer, &mNodeReader); + DynamicPatriciaTrieReadingHelper readingHelper(mDictBuffer, &mNodeReader); readingHelper.initWithPtNodeArrayPos(dicNode->getChildrenPtNodeArrayPos()); while (!readingHelper.isEnd()) { const PtNodeParams ptNodeParams = readingHelper.getPtNodeParams(); @@ -58,7 +63,7 @@ void Ver4PatriciaTriePolicy::createAndGetAllChildDicNodes(const DicNode *const d int Ver4PatriciaTriePolicy::getCodePointsAndProbabilityAndReturnCodePointCount( const int ptNodePos, const int maxCodePointCount, int *const outCodePoints, int *const outUnigramProbability) const { - DynamicPatriciaTrieReadingHelper readingHelper(&mDictBuffer, &mNodeReader); + DynamicPatriciaTrieReadingHelper readingHelper(mDictBuffer, &mNodeReader); readingHelper.initWithPtNodePos(ptNodePos); return readingHelper.getCodePointsAndProbabilityAndReturnCodePointCount( maxCodePointCount, outCodePoints, outUnigramProbability); @@ -66,7 +71,7 @@ int Ver4PatriciaTriePolicy::getCodePointsAndProbabilityAndReturnCodePointCount( int Ver4PatriciaTriePolicy::getTerminalPtNodePositionOfWord(const int *const inWord, const int length, const bool forceLowerCaseSearch) const { - DynamicPatriciaTrieReadingHelper readingHelper(&mDictBuffer, &mNodeReader); + DynamicPatriciaTrieReadingHelper readingHelper(mDictBuffer, &mNodeReader); readingHelper.initWithPtNodeArrayPos(getRootPosition()); return readingHelper.getTerminalPtNodePositionOfWord(inWord, length, forceLowerCaseSearch); } @@ -108,7 +113,8 @@ int Ver4PatriciaTriePolicy::getShortcutPositionOfPtNode(const int ptNodePos) con if (ptNodeParams.isDeleted()) { return NOT_A_DICT_POS; } - return ptNodeParams.getTerminalId(); + return mBuffers.get()->getShortcutDictContent()->getShortcutListHeadPos( + ptNodeParams.getTerminalId()); } int Ver4PatriciaTriePolicy::getBigramsPositionOfPtNode(const int ptNodePos) const { @@ -125,20 +131,88 @@ int Ver4PatriciaTriePolicy::getBigramsPositionOfPtNode(const int ptNodePos) cons bool Ver4PatriciaTriePolicy::addUnigramWord(const int *const word, const int length, const int probability) { - // TODO: Implement. - return false; + if (!mBuffers.get()->isUpdatable()) { + AKLOGI("Warning: addUnigramWord() is called for non-updatable dictionary."); + return false; + } + if (mDictBuffer->getTailPosition() >= MIN_DICT_SIZE_TO_REFUSE_DYNAMIC_OPERATIONS) { + AKLOGE("The dictionary is too large to dynamically update. Dictionary size: %d", + mDictBuffer->getTailPosition()); + return false; + } + DynamicPatriciaTrieReadingHelper readingHelper(mDictBuffer, &mNodeReader); + readingHelper.initWithPtNodeArrayPos(getRootPosition()); + bool addedNewUnigram = false; + if (mUpdatingHelper.addUnigramWord(&readingHelper, word, length, probability, + &addedNewUnigram)) { + if (addedNewUnigram) { + mUnigramCount++; + } + return true; + } else { + return false; + } } bool Ver4PatriciaTriePolicy::addBigramWords(const int *const word0, const int length0, const int *const word1, const int length1, const int probability) { - // TODO: Implement. - return false; + if (!mBuffers.get()->isUpdatable()) { + AKLOGI("Warning: addBigramWords() is called for non-updatable dictionary."); + return false; + } + if (mDictBuffer->getTailPosition() >= MIN_DICT_SIZE_TO_REFUSE_DYNAMIC_OPERATIONS) { + AKLOGE("The dictionary is too large to dynamically update. Dictionary size: %d", + mDictBuffer->getTailPosition()); + return false; + } + const int word0Pos = getTerminalPtNodePositionOfWord(word0, length0, + false /* forceLowerCaseSearch */); + if (word0Pos == NOT_A_DICT_POS) { + return false; + } + const int word1Pos = getTerminalPtNodePositionOfWord(word1, length1, + false /* forceLowerCaseSearch */); + if (word1Pos == NOT_A_DICT_POS) { + return false; + } + bool addedNewBigram = false; + if (mUpdatingHelper.addBigramWords(word0Pos, word1Pos, probability, &addedNewBigram)) { + if (addedNewBigram) { + mBigramCount++; + } + return true; + } else { + return false; + } } bool Ver4PatriciaTriePolicy::removeBigramWords(const int *const word0, const int length0, const int *const word1, const int length1) { - // TODO: Implement. - return false; + if (!mBuffers.get()->isUpdatable()) { + AKLOGI("Warning: addBigramWords() is called for non-updatable dictionary."); + return false; + } + if (mDictBuffer->getTailPosition() >= MIN_DICT_SIZE_TO_REFUSE_DYNAMIC_OPERATIONS) { + AKLOGE("The dictionary is too large to dynamically update. Dictionary size: %d", + mDictBuffer->getTailPosition()); + return false; + } + const int word0Pos = getTerminalPtNodePositionOfWord(word0, length0, + false /* forceLowerCaseSearch */); + if (word0Pos == NOT_A_DICT_POS) { + return false; + } + const int word1Pos = getTerminalPtNodePositionOfWord(word1, length1, + false /* forceLowerCaseSearch */); + if (word1Pos == NOT_A_DICT_POS) { + return false; + } + if (mUpdatingHelper.removeBigramWords(word0Pos, word1Pos)) { + mBigramCount--; + return true; + } else { + return false; + } } void Ver4PatriciaTriePolicy::flush(const char *const filePath) { diff --git a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.h b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.h index d0be77d0b..e8fdf5513 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.h +++ b/native/jni/src/suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.h @@ -21,8 +21,11 @@ #include "suggest/core/policy/dictionary_structure_with_buffer_policy.h" #include "suggest/policyimpl/dictionary/bigram/ver4_bigram_list_policy.h" #include "suggest/policyimpl/dictionary/header/header_policy.h" +#include "suggest/policyimpl/dictionary/shortcut/ver4_shortcut_list_policy.h" +#include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_updating_helper.h" #include "suggest/policyimpl/dictionary/structure/v4/ver4_dict_buffers.h" #include "suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_reader.h" +#include "suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_node_writer.h" #include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" namespace latinime { @@ -35,13 +38,20 @@ class Ver4PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy { public: Ver4PatriciaTriePolicy(const Ver4DictBuffers::Ver4DictBuffersPtr &buffers) : mBuffers(buffers), - mHeaderPolicy(mBuffers.get()->getRawDictBuffer(), FormatUtils::VERSION_4), - mDictBuffer(mBuffers.get()->getRawDictBuffer() + mHeaderPolicy.getSize(), - mBuffers.get()->getRawDictBufferSize() - mHeaderPolicy.getSize(), - BufferWithExtendableBuffer::DEFAULT_MAX_ADDITIONAL_BUFFER_SIZE), - mBigramPolicy(mBuffers.get()->getBigramDictContent(), + mHeaderPolicy(mBuffers.get()->getWritableHeaderBuffer()->getBuffer( + false /* usesAdditionalBuffer*/), FormatUtils::VERSION_4), + mDictBuffer(mBuffers.get()->getWritableTrieBuffer()), + mBigramPolicy(mBuffers.get()->getUpdatableBigramDictContent(), mBuffers.get()->getTerminalPositionLookupTable()), - mNodeReader(&mDictBuffer, mBuffers.get()->getProbabilityDictContent()) {}; + mShortcutPolicy(mBuffers.get()->getShortcutDictContent(), + mBuffers.get()->getTerminalPositionLookupTable()), + mNodeReader(mDictBuffer, mBuffers.get()->getProbabilityDictContent()), + mNodeWriter(mDictBuffer, mBuffers.get(), &mNodeReader, &mBigramPolicy, + &mShortcutPolicy), + mUpdatingHelper(mDictBuffer, &mNodeReader, &mNodeWriter, + mHeaderPolicy.isDecayingDict()), + mUnigramCount(mHeaderPolicy.getUnigramCount()), + mBigramCount(mHeaderPolicy.getBigramCount()) {}; AK_FORCE_INLINE int getRootPosition() const { return 0; @@ -74,7 +84,7 @@ class Ver4PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy { } const DictionaryShortcutsStructurePolicy *getShortcutsStructurePolicy() const { - return 0; + return &mShortcutPolicy; } bool addUnigramWord(const int *const word, const int length, const int probability); @@ -97,11 +107,21 @@ class Ver4PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy { private: DISALLOW_IMPLICIT_CONSTRUCTORS(Ver4PatriciaTriePolicy); - const Ver4DictBuffers::Ver4DictBuffersPtr mBuffers; + // When the dictionary size is near the maximum size, we have to refuse dynamic operations to + // prevent the dictionary from overflowing. + static const int MARGIN_TO_REFUSE_DYNAMIC_OPERATIONS; + static const int MIN_DICT_SIZE_TO_REFUSE_DYNAMIC_OPERATIONS; + + Ver4DictBuffers::Ver4DictBuffersPtr mBuffers; const HeaderPolicy mHeaderPolicy; - BufferWithExtendableBuffer mDictBuffer; - const Ver4BigramListPolicy mBigramPolicy; + BufferWithExtendableBuffer *const mDictBuffer; + Ver4BigramListPolicy mBigramPolicy; + Ver4ShortcutListPolicy mShortcutPolicy; Ver4PatriciaTrieNodeReader mNodeReader; + Ver4PatriciaTrieNodeWriter mNodeWriter; + DynamicPatriciaTrieUpdatingHelper mUpdatingHelper; + int mUnigramCount; + int mBigramCount; }; } // namespace latinime #endif // LATINIME_VER4_PATRICIA_TRIE_POLICY_H diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.cpp b/native/jni/src/suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.cpp index ead2212a0..26eafcd44 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.cpp @@ -36,6 +36,24 @@ uint32_t BufferWithExtendableBuffer::readUintAndAdvancePosition(const int size, return value; } +void BufferWithExtendableBuffer::readCodePointsAndAdvancePosition(const int maxCodePointCount, + int *const outCodePoints, int *outCodePointCount, int *const pos) const { + const bool readingPosIsInAdditionalBuffer = isInAdditionalBuffer(*pos); + if (readingPosIsInAdditionalBuffer) { + *pos -= mOriginalBufferSize; + } + *outCodePointCount = ByteArrayUtils::readStringAndAdvancePosition( + getBuffer(readingPosIsInAdditionalBuffer), maxCodePointCount, outCodePointCount, pos); + if (readingPosIsInAdditionalBuffer) { + *pos += mOriginalBufferSize; + } +} + +bool BufferWithExtendableBuffer::writeUint(const uint32_t data, const int size, const int pos) { + int writingPos = pos; + return writeUintAndAdvancePosition(data, size, &writingPos); +} + bool BufferWithExtendableBuffer::writeUintAndAdvancePosition(const uint32_t data, const int size, int *const pos) { if (!(size >= 1 && size <= 4)) { @@ -59,7 +77,7 @@ bool BufferWithExtendableBuffer::writeUintAndAdvancePosition(const uint32_t data } bool BufferWithExtendableBuffer::writeCodePointsAndAdvancePosition(const int *const codePoints, - const int codePointCount, const bool writesTerminator ,int *const pos) { + const int codePointCount, const bool writesTerminator, int *const pos) { const size_t size = ByteArrayUtils::calculateRequiredByteCountToStoreCodePoints( codePoints, codePointCount, writesTerminator); if (!checkAndPrepareWriting(*pos, size)) { diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h b/native/jni/src/suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h index 5c1b4cd01..ee6107ad7 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h +++ b/native/jni/src/suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h @@ -75,6 +75,9 @@ class BufferWithExtendableBuffer { uint32_t readUintAndAdvancePosition(const int size, int *const pos) const; + void readCodePointsAndAdvancePosition(const int maxCodePointCount, + int *const outCodePoints, int *outCodePointCount, int *const pos) const; + AK_FORCE_INLINE int getOriginalBufferSize() const { return mOriginalBufferSize; } @@ -90,6 +93,8 @@ class BufferWithExtendableBuffer { * Writing is allowed for original buffer, already written region of additional buffer and the * tail of additional buffer. */ + bool writeUint(const uint32_t data, const int size, const int pos); + bool writeUintAndAdvancePosition(const uint32_t data, const int size, int *const pos); bool writeCodePointsAndAdvancePosition(const int *const codePoints, const int codePointCount, diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.cpp b/native/jni/src/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.cpp index b48e5b005..40f7d1f5c 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.cpp @@ -21,6 +21,7 @@ #include "suggest/policyimpl/dictionary/header/header_policy.h" #include "suggest/policyimpl/dictionary/structure/v3/dynamic_patricia_trie_writing_utils.h" +#include "suggest/policyimpl/dictionary/structure/v4/ver4_dict_buffers.h" #include "suggest/policyimpl/dictionary/utils/buffer_with_extendable_buffer.h" #include "suggest/policyimpl/dictionary/utils/format_utils.h" @@ -34,7 +35,7 @@ const char *const DictFileWritingUtils::TEMP_FILE_SUFFIX_FOR_WRITING_DICT_FILE = case 3: return createEmptyV3DictFile(filePath, attributeMap); case 4: - // TODO: Support version 4 dictionary format. + return createEmptyV4DictFile(filePath, attributeMap); return false; default: // Only version 3 dictionary is supported for now. @@ -58,6 +59,20 @@ const char *const DictFileWritingUtils::TEMP_FILE_SUFFIX_FOR_WRITING_DICT_FILE = return flushAllHeaderAndBodyToFile(filePath, &headerBuffer, &bodyBuffer); } +/* static */ bool DictFileWritingUtils::createEmptyV4DictFile(const char *const filePath, + const HeaderReadWriteUtils::AttributeMap *const attributeMap) { + Ver4DictBuffers::Ver4DictBuffersPtr dictBuffers = Ver4DictBuffers::createVer4DictBuffers(); + HeaderPolicy headerPolicy(FormatUtils::VERSION_4, attributeMap); + headerPolicy.writeHeaderToBuffer(dictBuffers.get()->getWritableHeaderBuffer(), + true /* updatesLastUpdatedTime */, true /* updatesLastDecayedTime */, + 0 /* unigramCount */, 0 /* bigramCount */, 0 /* extendedRegionSize */); + if (!DynamicPatriciaTrieWritingUtils::writeEmptyDictionary( + dictBuffers.get()->getWritableTrieBuffer(), 0 /* rootPos */)) { + return false; + } + return dictBuffers.get()->flush(filePath); +} + /* static */ bool DictFileWritingUtils::flushAllHeaderAndBodyToFile(const char *const filePath, BufferWithExtendableBuffer *const dictHeader, BufferWithExtendableBuffer *const dictBody) { const int tmpFileNameBufSize = strlen(filePath) @@ -69,21 +84,21 @@ const char *const DictFileWritingUtils::TEMP_FILE_SUFFIX_FOR_WRITING_DICT_FILE = TEMP_FILE_SUFFIX_FOR_WRITING_DICT_FILE); FILE *const file = fopen(tmpFileName, "wb"); if (!file) { - AKLOGE("Dictionary file %s cannnot be opened.", tmpFileName); + AKLOGE("Dictionary file %s cannot be opened.", tmpFileName); ASSERT(false); return false; } // Write the dictionary header. if (!writeBufferToFile(file, dictHeader)) { remove(tmpFileName); - AKLOGE("Dictionary header cannnot be written. size: %d", dictHeader->getTailPosition()); + AKLOGE("Dictionary header cannot be written. size: %d", dictHeader->getTailPosition()); ASSERT(false); return false; } // Write the dictionary body. if (!writeBufferToFile(file, dictBody)) { remove(tmpFileName); - AKLOGE("Dictionary body cannnot be written. size: %d", dictBody->getTailPosition()); + AKLOGE("Dictionary body cannot be written. size: %d", dictBody->getTailPosition()); ASSERT(false); return false; } diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.h b/native/jni/src/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.h index bd4ac66fd..3291f98c7 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.h +++ b/native/jni/src/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.h @@ -43,6 +43,9 @@ class DictFileWritingUtils { static bool createEmptyV3DictFile(const char *const filePath, const HeaderReadWriteUtils::AttributeMap *const attributeMap); + static bool createEmptyV4DictFile(const char *const filePath, + const HeaderReadWriteUtils::AttributeMap *const attributeMap); + static bool writeBufferToFile(FILE *const file, const BufferWithExtendableBuffer *const buffer); }; diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp b/native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp index 28af97351..e88d6e0a9 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/utils/mmapped_buffer.cpp @@ -35,7 +35,7 @@ namespace latinime { AKLOGE("DICT: Can't open the source. path=%s errno=%d", path, errno); return MmappedBufferPtr(0); } - const int pagesize = getpagesize(); + const int pagesize = sysconf(_SC_PAGESIZE); const int offset = bufferOffset % pagesize; int alignedOffset = bufferOffset - offset; int alignedSize = bufferSize + offset; diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/sparse_table.cpp b/native/jni/src/suggest/policyimpl/dictionary/utils/sparse_table.cpp index 2678b8c7b..9be35620c 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/utils/sparse_table.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/utils/sparse_table.cpp @@ -19,23 +19,68 @@ namespace latinime { const int SparseTable::NOT_EXIST = -1; +const int SparseTable::INDEX_SIZE = 4; bool SparseTable::contains(const int id) const { - const int readingPos = id / mBlockSize * mDataSize; + const int readingPos = getPosInIndexTable(id); if (id < 0 || mIndexTableBuffer->getTailPosition() <= readingPos) { return false; } - const int index = mIndexTableBuffer->readUint(mDataSize, readingPos); + const int index = mIndexTableBuffer->readUint(INDEX_SIZE, readingPos); return index != NOT_EXIST; } uint32_t SparseTable::get(const int id) const { - const int indexTableIndex = id / mBlockSize; - int readingPos = indexTableIndex * mDataSize; - const int index = mIndexTableBuffer->readUint(mDataSize, readingPos); + const int indexTableReadingPos = getPosInIndexTable(id); + const int index = mIndexTableBuffer->readUint(INDEX_SIZE, indexTableReadingPos); + const int contentTableReadingPos = getPosInContentTable(id, index); + return mContentTableBuffer->readUint(mDataSize, contentTableReadingPos); +} + +bool SparseTable::set(const int id, const uint32_t value) { + const int posInIndexTable = getPosInIndexTable(id); + // Extends the index table if needed. + if (mIndexTableBuffer->getTailPosition() < posInIndexTable) { + int tailPos = mIndexTableBuffer->getTailPosition(); + while(tailPos < posInIndexTable) { + if (!mIndexTableBuffer->writeUintAndAdvancePosition(NOT_EXIST, INDEX_SIZE, &tailPos)) { + return false; + } + } + } + if (contains(id)) { + // The entry is already in the content table. + const int index = mIndexTableBuffer->readUint(INDEX_SIZE, posInIndexTable); + return mContentTableBuffer->writeUint(value, mDataSize, getPosInContentTable(id, index)); + } + // The entry is not in the content table. + // Create new entry in the content table. + const int index = getIndexFromContentTablePos(mContentTableBuffer->getTailPosition()); + if (!mIndexTableBuffer->writeUint(index, INDEX_SIZE, posInIndexTable)) { + return false; + } + // Write a new block that containing the entry to be set. + int writingPos = getPosInContentTable(0 /* id */, index); + for (int i = 0; i < mBlockSize; ++i) { + if (!mContentTableBuffer->writeUintAndAdvancePosition(NOT_A_DICT_POS, mDataSize, + &writingPos)) { + return false; + } + } + return mContentTableBuffer->writeUint(value, mDataSize, getPosInContentTable(id, index)); +} + +int SparseTable::getIndexFromContentTablePos(const int contentTablePos) const { + return contentTablePos / mDataSize / mBlockSize; +} + +int SparseTable::getPosInIndexTable(const int id) const { + return (id / mBlockSize) * INDEX_SIZE; +} + +int SparseTable::getPosInContentTable(const int id, const int index) const { const int offset = id % mBlockSize; - readingPos = (index * mDataSize + offset) * mBlockSize; - return mContentTableBuffer->readUint(mDataSize, readingPos); + return (index * mDataSize + offset) * mBlockSize; } } // namespace latinime diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/sparse_table.h b/native/jni/src/suggest/policyimpl/dictionary/utils/sparse_table.h index d71756c63..21c167506 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/utils/sparse_table.h +++ b/native/jni/src/suggest/policyimpl/dictionary/utils/sparse_table.h @@ -38,10 +38,19 @@ class SparseTable { uint32_t get(const int id) const; + bool set(const int id, const uint32_t value); + private: DISALLOW_IMPLICIT_CONSTRUCTORS(SparseTable); + int getIndexFromContentTablePos(const int contentTablePos) const; + + int getPosInIndexTable(const int id) const; + + int getPosInContentTable(const int id, const int index) const; + static const int NOT_EXIST; + static const int INDEX_SIZE; BufferWithExtendableBuffer *const mIndexTableBuffer; BufferWithExtendableBuffer *const mContentTableBuffer; diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml index 09a63c590..4ca846be1 100644 --- a/tests/AndroidManifest.xml +++ b/tests/AndroidManifest.xml @@ -17,7 +17,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.inputmethod.latin.tests"> - <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" /> + <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> diff --git a/tests/src/com/android/inputmethod/latin/ExpandableDictionaryTests.java b/tests/src/com/android/inputmethod/latin/ExpandableDictionaryTests.java deleted file mode 100644 index 6aae1044e..000000000 --- a/tests/src/com/android/inputmethod/latin/ExpandableDictionaryTests.java +++ /dev/null @@ -1,58 +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. - */ - -package com.android.inputmethod.latin; - -import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.SmallTest; - -/** - * Unit test for ExpandableDictionary - */ -@SmallTest -public class ExpandableDictionaryTests extends AndroidTestCase { - - private final static int UNIGRAM_FREQ = 50; - // See UserBinaryDictionary for more information about this variable. - // For tests, its actual value does not matter. - private final static int SHORTCUT_FREQ = 14; - - public void testAddWordAndGetWordFrequency() { - final ExpandableDictionary dict = new ExpandableDictionary(Dictionary.TYPE_USER); - - // Add words - dict.addWord("abcde", "abcde", UNIGRAM_FREQ, SHORTCUT_FREQ); - dict.addWord("abcef", null, UNIGRAM_FREQ + 1, 0); - - // Check words - assertFalse(dict.isValidWord("abcde")); - assertEquals(UNIGRAM_FREQ, dict.getWordFrequency("abcde")); - assertTrue(dict.isValidWord("abcef")); - assertEquals(UNIGRAM_FREQ+1, dict.getWordFrequency("abcef")); - - dict.addWord("abc", null, UNIGRAM_FREQ + 2, 0); - assertTrue(dict.isValidWord("abc")); - assertEquals(UNIGRAM_FREQ + 2, dict.getWordFrequency("abc")); - - // Add existing word with lower frequency - dict.addWord("abc", null, UNIGRAM_FREQ, 0); - assertEquals(UNIGRAM_FREQ + 2, dict.getWordFrequency("abc")); - - // Add existing word with higher frequency - dict.addWord("abc", null, UNIGRAM_FREQ + 3, 0); - assertEquals(UNIGRAM_FREQ + 3, dict.getWordFrequency("abc")); - } -} diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java index b9b52a6f3..3cb980cb0 100644 --- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java +++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java @@ -44,8 +44,8 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { private static final String PREF_DEBUG_MODE = "debug_mode"; - // The message that sets the underline is posted with a 200 ms delay - protected static final int DELAY_TO_WAIT_FOR_UNDERLINE = 200; + // The message that sets the underline is posted with a 500 ms delay + protected static final int DELAY_TO_WAIT_FOR_UNDERLINE = 500; // The message that sets predictions is posted with a 200 ms delay protected static final int DELAY_TO_WAIT_FOR_PREDICTIONS = 200; diff --git a/tests/src/com/android/inputmethod/latin/Ver4BinaryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/Ver4BinaryDictionaryTests.java index e43335265..ad57e4c9f 100644 --- a/tests/src/com/android/inputmethod/latin/Ver4BinaryDictionaryTests.java +++ b/tests/src/com/android/inputmethod/latin/Ver4BinaryDictionaryTests.java @@ -78,7 +78,7 @@ public class Ver4BinaryDictionaryTests extends AndroidTestCase { final FusionDictionary dict = new FusionDictionary(new PtNodeArray(), getDictionaryOptions(TEST_LOCALE, dictVersion)); - DictEncoder encoder = new Ver4DictEncoder(getContext().getCacheDir()); + final DictEncoder encoder = new Ver4DictEncoder(getContext().getCacheDir()); try { encoder.writeDictionary(dict, FORMAT_OPTIONS); } catch (IOException e) { @@ -104,7 +104,7 @@ public class Ver4BinaryDictionaryTests extends AndroidTestCase { dict.add("aaa", frequency, null, false /* isNotAWord */); dict.add("ab", frequency, null, false /* isNotAWord */); - DictEncoder encoder = new Ver4DictEncoder(getContext().getCacheDir()); + final DictEncoder encoder = new Ver4DictEncoder(getContext().getCacheDir()); try { encoder.writeDictionary(dict, FORMAT_OPTIONS); } catch (IOException e) { @@ -112,8 +112,8 @@ public class Ver4BinaryDictionaryTests extends AndroidTestCase { } catch (UnsupportedFormatException e) { Log.e(TAG, "Unsupported format", e); } - File trieFile = getTrieFile(TEST_LOCALE, dictVersion); - BinaryDictionary binaryDictionary = new BinaryDictionary(trieFile.getAbsolutePath(), + final File trieFile = getTrieFile(TEST_LOCALE, dictVersion); + final BinaryDictionary binaryDictionary = new BinaryDictionary(trieFile.getAbsolutePath(), 0 /* offset */, trieFile.length(), true /* useFullEditDistance */, Locale.getDefault(), TEST_LOCALE, true /* isUpdatable */); assertTrue(binaryDictionary.isValidDictionary()); @@ -122,7 +122,7 @@ public class Ver4BinaryDictionaryTests extends AndroidTestCase { assertEquals(frequency, binaryDictionary.getFrequency("ab")); } - public static int getCalculatedBigramProbabiliy(BinaryDictionary binaryDictionary, + public static int getCalculatedBigramProbabiliy(final BinaryDictionary binaryDictionary, final int unigramFrequency, final int bigramFrequency) { final int bigramFrequencyDiff = BinaryDictEncoderUtils.getBigramFrequencyDiff( unigramFrequency, bigramFrequency); @@ -146,7 +146,7 @@ public class Ver4BinaryDictionaryTests extends AndroidTestCase { dict.setBigram("a", "ab", bigramFrequency1); dict.setBigram("aaa", "ab", bigramFrequency2); - DictEncoder encoder = new Ver4DictEncoder(getContext().getCacheDir()); + final DictEncoder encoder = new Ver4DictEncoder(getContext().getCacheDir()); try { encoder.writeDictionary(dict, FORMAT_OPTIONS); } catch (IOException e) { @@ -154,8 +154,8 @@ public class Ver4BinaryDictionaryTests extends AndroidTestCase { } catch (UnsupportedFormatException e) { Log.e(TAG, "Unsupported format", e); } - File trieFile = getTrieFile(TEST_LOCALE, dictVersion); - BinaryDictionary binaryDictionary = new BinaryDictionary(trieFile.getAbsolutePath(), + final File trieFile = getTrieFile(TEST_LOCALE, dictVersion); + final BinaryDictionary binaryDictionary = new BinaryDictionary(trieFile.getAbsolutePath(), 0 /* offset */, trieFile.length(), true /* useFullEditDistance */, Locale.getDefault(), TEST_LOCALE, true /* isUpdatable */); @@ -172,4 +172,130 @@ public class Ver4BinaryDictionaryTests extends AndroidTestCase { assertFalse(binaryDictionary.isValidBigram("ab", "a")); assertFalse(binaryDictionary.isValidBigram("ab", "aaa")); } + + // TODO: Add large tests. + public void testWriteUnigrams() { + final String dictVersion = Long.toString(System.currentTimeMillis()); + final FusionDictionary dict = new FusionDictionary(new PtNodeArray(), + getDictionaryOptions(TEST_LOCALE, dictVersion)); + final DictEncoder encoder = new Ver4DictEncoder(getContext().getCacheDir()); + try { + encoder.writeDictionary(dict, FORMAT_OPTIONS); + } catch (IOException e) { + Log.e(TAG, "IOException while writing dictionary", e); + } catch (UnsupportedFormatException e) { + Log.e(TAG, "Unsupported format", e); + } + final File trieFile = getTrieFile(TEST_LOCALE, dictVersion); + final BinaryDictionary binaryDictionary = new BinaryDictionary(trieFile.getAbsolutePath(), + 0 /* offset */, trieFile.length(), true /* useFullEditDistance */, + Locale.getDefault(), TEST_LOCALE, true /* isUpdatable */); + assertTrue(binaryDictionary.isValidDictionary()); + + final int probability = 100; + binaryDictionary.addUnigramWord("aaa", probability); + binaryDictionary.addUnigramWord("abc", probability); + binaryDictionary.addUnigramWord("bcd", probability); + binaryDictionary.addUnigramWord("x", probability); + binaryDictionary.addUnigramWord("y", probability); + + assertEquals(probability, binaryDictionary.getFrequency("aaa")); + assertEquals(probability, binaryDictionary.getFrequency("abc")); + assertEquals(probability, binaryDictionary.getFrequency("bcd")); + assertEquals(probability, binaryDictionary.getFrequency("x")); + assertEquals(probability, binaryDictionary.getFrequency("y")); + } + + public void testWriteBigrams() { + final String dictVersion = Long.toString(System.currentTimeMillis()); + final FusionDictionary dict = new FusionDictionary(new PtNodeArray(), + getDictionaryOptions(TEST_LOCALE, dictVersion)); + final DictEncoder encoder = new Ver4DictEncoder(getContext().getCacheDir()); + try { + encoder.writeDictionary(dict, FORMAT_OPTIONS); + } catch (IOException e) { + Log.e(TAG, "IOException while writing dictionary", e); + } catch (UnsupportedFormatException e) { + Log.e(TAG, "Unsupported format", e); + } + final File trieFile = getTrieFile(TEST_LOCALE, dictVersion); + final BinaryDictionary binaryDictionary = new BinaryDictionary(trieFile.getAbsolutePath(), + 0 /* offset */, trieFile.length(), true /* useFullEditDistance */, + Locale.getDefault(), TEST_LOCALE, true /* isUpdatable */); + assertTrue(binaryDictionary.isValidDictionary()); + + final int unigramProbability = 100; + final int bigramProbability = 10; + final int updatedBigramProbability = 15; + binaryDictionary.addUnigramWord("aaa", unigramProbability); + binaryDictionary.addUnigramWord("abb", unigramProbability); + binaryDictionary.addUnigramWord("bcc", unigramProbability); + binaryDictionary.addBigramWords("aaa", "abb", bigramProbability); + binaryDictionary.addBigramWords("aaa", "bcc", bigramProbability); + binaryDictionary.addBigramWords("abb", "aaa", bigramProbability); + binaryDictionary.addBigramWords("abb", "bcc", bigramProbability); + + final int probability = binaryDictionary.calculateProbability(unigramProbability, + bigramProbability); + assertEquals(true, binaryDictionary.isValidBigram("aaa", "abb")); + assertEquals(true, binaryDictionary.isValidBigram("aaa", "bcc")); + assertEquals(true, binaryDictionary.isValidBigram("abb", "aaa")); + assertEquals(true, binaryDictionary.isValidBigram("abb", "bcc")); + assertEquals(probability, binaryDictionary.getBigramProbability("aaa", "abb")); + assertEquals(probability, binaryDictionary.getBigramProbability("aaa", "bcc")); + assertEquals(probability, binaryDictionary.getBigramProbability("abb", "aaa")); + assertEquals(probability, binaryDictionary.getBigramProbability("abb", "bcc")); + } + + public void testRemoveBigramWords() { + final String dictVersion = Long.toString(System.currentTimeMillis()); + final FusionDictionary dict = new FusionDictionary(new PtNodeArray(), + getDictionaryOptions(TEST_LOCALE, dictVersion)); + final DictEncoder encoder = new Ver4DictEncoder(getContext().getCacheDir()); + try { + encoder.writeDictionary(dict, FORMAT_OPTIONS); + } catch (IOException e) { + Log.e(TAG, "IOException while writing dictionary", e); + } catch (UnsupportedFormatException e) { + Log.e(TAG, "Unsupported format", e); + } + final File trieFile = getTrieFile(TEST_LOCALE, dictVersion); + final BinaryDictionary binaryDictionary = new BinaryDictionary(trieFile.getAbsolutePath(), + 0 /* offset */, trieFile.length(), true /* useFullEditDistance */, + Locale.getDefault(), TEST_LOCALE, true /* isUpdatable */); + assertTrue(binaryDictionary.isValidDictionary()); + + final int unigramProbability = 100; + final int bigramProbability = 10; + binaryDictionary.addUnigramWord("aaa", unigramProbability); + binaryDictionary.addUnigramWord("abb", unigramProbability); + binaryDictionary.addUnigramWord("bcc", unigramProbability); + binaryDictionary.addBigramWords("aaa", "abb", bigramProbability); + binaryDictionary.addBigramWords("aaa", "bcc", bigramProbability); + binaryDictionary.addBigramWords("abb", "aaa", bigramProbability); + binaryDictionary.addBigramWords("abb", "bcc", bigramProbability); + + assertEquals(true, binaryDictionary.isValidBigram("aaa", "abb")); + assertEquals(true, binaryDictionary.isValidBigram("aaa", "bcc")); + assertEquals(true, binaryDictionary.isValidBigram("abb", "aaa")); + assertEquals(true, binaryDictionary.isValidBigram("abb", "bcc")); + + binaryDictionary.removeBigramWords("aaa", "abb"); + assertEquals(false, binaryDictionary.isValidBigram("aaa", "abb")); + binaryDictionary.addBigramWords("aaa", "abb", bigramProbability); + assertEquals(true, binaryDictionary.isValidBigram("aaa", "abb")); + + binaryDictionary.removeBigramWords("aaa", "bcc"); + assertEquals(false, binaryDictionary.isValidBigram("aaa", "bcc")); + binaryDictionary.removeBigramWords("abb", "aaa"); + assertEquals(false, binaryDictionary.isValidBigram("abb", "aaa")); + binaryDictionary.removeBigramWords("abb", "bcc"); + assertEquals(false, binaryDictionary.isValidBigram("abb", "bcc")); + + binaryDictionary.removeBigramWords("aaa", "abb"); + // Test remove non-existing bigram operation. + binaryDictionary.removeBigramWords("aaa", "abb"); + binaryDictionary.removeBigramWords("bcc", "aaa"); + } + } diff --git a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java index 7c1decb71..c3e062b65 100644 --- a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java +++ b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java @@ -214,9 +214,7 @@ public class UserHistoryDictionaryTests extends AndroidTestCase { public void testAddManyWords() { final String testFilenameSuffix = "testRandomWords" + System.currentTimeMillis(); - final int numberOfWords = - ExpandableBinaryDictionary.ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE ? - 10000 : 1000; + final int numberOfWords = 10000; final Random random = new Random(123456); clearHistory(testFilenameSuffix); try { diff --git a/tests/src/com/android/inputmethod/latin/utils/StringUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/StringUtilsTests.java index 4e396a1cf..21fcf1117 100644 --- a/tests/src/com/android/inputmethod/latin/utils/StringUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/utils/StringUtilsTests.java @@ -44,7 +44,7 @@ public class StringUtilsTests extends AndroidTestCase { })); } - public void testContainsInExtraValues() { + public void testContainsInCommaSplittableText() { assertFalse("null", StringUtils.containsInCommaSplittableText("key", null)); assertFalse("empty", StringUtils.containsInCommaSplittableText("key", "")); assertFalse("not in 1 element", @@ -56,7 +56,28 @@ public class StringUtilsTests extends AndroidTestCase { assertTrue("in 2 elements", StringUtils.containsInCommaSplittableText("key", "key1,key")); } - public void testAppendToExtraValuesIfNotExists() { + public void testJoinCommaSplittableText() { + assertEquals("2 nulls", "", + StringUtils.joinCommaSplittableText(null, null)); + assertEquals("null and empty", "", + StringUtils.joinCommaSplittableText(null, "")); + assertEquals("empty and null", "", + StringUtils.joinCommaSplittableText("", null)); + assertEquals("2 empties", "", + StringUtils.joinCommaSplittableText("", "")); + assertEquals("text and null", "text", + StringUtils.joinCommaSplittableText("text", null)); + assertEquals("text and empty", "text", + StringUtils.joinCommaSplittableText("text", "")); + assertEquals("null and text", "text", + StringUtils.joinCommaSplittableText(null, "text")); + assertEquals("empty and text", "text", + StringUtils.joinCommaSplittableText("", "text")); + assertEquals("2 texts", "text1,text2", + StringUtils.joinCommaSplittableText("text1", "text2")); + } + + public void testAppendToCommaSplittableTextIfNotExists() { assertEquals("null", "key", StringUtils.appendToCommaSplittableTextIfNotExists("key", null)); assertEquals("empty", "key", @@ -77,7 +98,7 @@ public class StringUtilsTests extends AndroidTestCase { StringUtils.appendToCommaSplittableTextIfNotExists("key", "key1,key,key3")); } - public void testRemoveFromExtraValuesIfExists() { + public void testRemoveFromCommaSplittableTextIfExists() { assertEquals("null", "", StringUtils.removeFromCommaSplittableTextIfExists("key", null)); assertEquals("empty", "", StringUtils.removeFromCommaSplittableTextIfExists("key", "")); diff --git a/tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl b/tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl index 4cd9c236b..072daa4e9 100644 --- a/tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl +++ b/tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl @@ -87,11 +87,11 @@ public final class KeyboardTextsSet { return (text == null) ? LANGUAGE_DEFAULT[id] : text; } + // These texts' name should be aligned with the @string/<name> in + // values*/strings-action-keys.xml. private static final String[] RESOURCE_NAMES = { - // These texts' name should be aligned with the @string/<name> in values/strings.xml. // Labels for action. "label_go_key", - // "label_search_key", "label_send_key", "label_next_key", "label_done_key", diff --git a/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml index 4cf742441..66393732c 100644 --- a/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml @@ -71,7 +71,7 @@ U+0142: "ł" LATIN SMALL LETTER L WITH STROKE --> <string name="more_keys_for_l">l·l,ł</string> <!-- U+00B7: "·" MIDDLE DOT --> - <string name="more_keys_for_punctuation">"!fixedColumnOrder!4,·,!,\\,,\?,:,;,\@"</string> + <string name="more_keys_for_punctuation">"!fixedColumnOrder!9,;,/,(,),#,·,!,\\,,\?,&,\\%,+,\",-,:,',\@"</string> <string name="more_keys_for_period">\?,·</string> <!-- U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA --> <string name="keylabel_for_spanish_row2_10">ç</string> diff --git a/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml index a1633316f..994e35ae9 100644 --- a/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml @@ -28,6 +28,7 @@ <!-- U+00B1: "±" PLUS-MINUS SIGN U+FB29: "﬩" HEBREW LETTER ALTERNATIVE PLUS SIGN --> <string name="more_keys_for_plus">±,﬩</string> + <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,;,/,(|),)|(,#,!,\\,,\?,&,\\%,+,\",-,:,',\@"</string> <!-- The all letters need to be mirrored are found at http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt --> <string name="more_keys_for_left_parenthesis">!fixedColumnOrder!3,<|>,{|},[|]</string> diff --git a/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml index 008ef3007..5f687db99 100644 --- a/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml @@ -83,7 +83,7 @@ <string name="more_keys_for_currency_dollar">¢,£,€,¥,₱</string> <string name="keylabel_for_currency">$</string> <string name="more_keys_for_currency">$,¢,€,£,¥,₱</string> - <string name="more_keys_for_punctuation">"!fixedColumnOrder!4,#,!,\\,,\?,-,:,',\@"</string> + <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,;,/,(,),#,!,\\,,\?,&,\\%,+,\",-,:,',\@"</string> <!-- U+2020: "†" DAGGER U+2021: "‡" DOUBLE DAGGER U+2605: "★" BLACK STAR --> |