aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--java/res/values-cs/strings.xml6
-rw-r--r--java/res/values-et/strings.xml6
-rw-r--r--java/res/values-fi/strings.xml6
-rw-r--r--java/res/values-hi/strings.xml6
-rw-r--r--java/res/values-hr/strings.xml6
-rw-r--r--java/res/values-hu/strings.xml6
-rw-r--r--java/res/values-in/strings.xml6
-rw-r--r--java/res/values-ja/strings.xml6
-rw-r--r--java/res/values-ko/strings.xml6
-rw-r--r--java/res/values-lt/strings.xml6
-rw-r--r--java/res/values-lv/strings.xml6
-rw-r--r--java/res/values-ms/strings.xml6
-rw-r--r--java/res/values-pt/strings.xml6
-rw-r--r--java/res/values-ro/strings.xml6
-rw-r--r--java/res/values-ru/strings.xml6
-rw-r--r--java/res/values-sk/strings.xml6
-rw-r--r--java/res/values-sl/strings.xml6
-rw-r--r--java/res/values-sr/strings.xml6
-rw-r--r--java/res/values-sw/strings.xml6
-rw-r--r--java/res/values-tr/strings.xml6
-rw-r--r--java/res/values-vi/strings.xml6
-rw-r--r--java/res/values-zh-rCN/strings.xml6
-rw-r--r--java/res/values/dimens.xml8
-rw-r--r--java/res/values/strings.xml9
-rw-r--r--java/res/xml/method.xml53
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java16
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java73
-rw-r--r--java/src/com/android/inputmethod/keyboard/MainKeyboardView.java8
-rw-r--r--java/src/com/android/inputmethod/keyboard/PointerTracker.java46
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java7
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java125
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java172
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java31
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java18
-rw-r--r--native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp31
-rw-r--r--native/jni/com_android_inputmethod_keyboard_ProximityInfo.h33
-rw-r--r--native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp37
-rw-r--r--native/jni/com_android_inputmethod_latin_BinaryDictionary.h33
-rw-r--r--native/jni/com_android_inputmethod_latin_NativeUtils.cpp33
-rw-r--r--native/jni/com_android_inputmethod_latin_NativeUtils.h33
-rw-r--r--native/jni/jni_common.cpp37
-rw-r--r--native/jni/jni_common.h32
-rw-r--r--native/jni/src/additional_proximity_chars.cpp2
-rw-r--r--native/jni/src/additional_proximity_chars.h8
-rw-r--r--native/jni/src/basechars.cpp4
-rw-r--r--native/jni/src/bigram_dictionary.cpp38
-rw-r--r--native/jni/src/bigram_dictionary.h2
-rw-r--r--native/jni/src/binary_format.h76
-rw-r--r--native/jni/src/bloom_filter.h2
-rw-r--r--native/jni/src/char_utils.cpp1
-rw-r--r--native/jni/src/char_utils.h2
-rw-r--r--native/jni/src/correction.cpp22
-rw-r--r--native/jni/src/correction.h20
-rw-r--r--native/jni/src/correction_state.h1
-rw-r--r--native/jni/src/debug.h43
-rw-r--r--native/jni/src/defines.h35
-rw-r--r--native/jni/src/dictionary.cpp31
-rw-r--r--native/jni/src/dictionary.h1
-rw-r--r--native/jni/src/proximity_info.cpp4
-rw-r--r--native/jni/src/proximity_info.h2
-rw-r--r--native/jni/src/proximity_info_state.cpp4
-rw-r--r--native/jni/src/proximity_info_state.h10
-rw-r--r--native/jni/src/terminal_attributes.h11
-rw-r--r--native/jni/src/unigram_dictionary.cpp85
-rw-r--r--native/jni/src/unigram_dictionary.h35
-rw-r--r--native/jni/src/words_priority_queue.h45
-rw-r--r--native/jni/src/words_priority_queue_pool.h13
-rw-r--r--tools/maketext/res/values-sr/donottranslate-more-keys.xml19
-rw-r--r--tools/maketext/res/values-sw/donottranslate-more-keys.xml65
-rw-r--r--tools/maketext/res/values-tl/donottranslate-more-keys.xml70
70 files changed, 1025 insertions, 593 deletions
diff --git a/java/res/values-cs/strings.xml b/java/res/values-cs/strings.xml
index 0e16c3a45..1d9c8e38c 100644
--- a/java/res/values-cs/strings.xml
+++ b/java/res/values-cs/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Velmi agresivní"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Návrhy dalšího slova"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Na základě předchozího slova"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Zadávání gesty"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Napište slovo zadáním jeho písmen."</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>
diff --git a/java/res/values-et/strings.xml b/java/res/values-et/strings.xml
index 750f22265..cedbde055 100644
--- a/java/res/values-et/strings.xml
+++ b/java/res/values-et/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Väga agressiivne"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Järgmise sõna soovitused"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Eelmise sõna põhjal"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Liigutusega sisest."</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Sisestage sõna, kirjutades sõna tähed sõrmega"</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>
diff --git a/java/res/values-fi/strings.xml b/java/res/values-fi/strings.xml
index abb5cf488..898d522ba 100644
--- a/java/res/values-fi/strings.xml
+++ b/java/res/values-fi/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Hyvin aggressiivinen"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Seuraavan sanan ehdotukset"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Perustuu edelliseen sanan"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Eleiden syöttö"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Syötä sana piirtämällä kirjaimet sormella"</string>
<string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g> : Tallennettu"</string>
<string name="label_go_key" msgid="1635148082137219148">"Siirry"</string>
<string name="label_next_key" msgid="362972844525672568">"Seur."</string>
diff --git a/java/res/values-hi/strings.xml b/java/res/values-hi/strings.xml
index cfa34920b..22c9efb1f 100644
--- a/java/res/values-hi/strings.xml
+++ b/java/res/values-hi/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"बहुत तीव्र"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"अगले शब्द सुझाव"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"पिछले शब्द के आधार पर"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"जेस्‍चर इनपुट"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"किसी शब्द के अक्षरों को ट्रेस करके कोई शब्द इनपुट करें"</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>
diff --git a/java/res/values-hr/strings.xml b/java/res/values-hr/strings.xml
index 19bf1b973..e7c508d90 100644
--- a/java/res/values-hr/strings.xml
+++ b/java/res/values-hr/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Vrlo agresivno"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Prijedlozi za sljedeću riječ"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Na temelju prethodne riječi"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Unos pokretom"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Unos riječi ispisivanjem slova riječi"</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>
diff --git a/java/res/values-hu/strings.xml b/java/res/values-hu/strings.xml
index db4522f63..637b5e482 100644
--- a/java/res/values-hu/strings.xml
+++ b/java/res/values-hu/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Nagyon agresszív"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Következő szóra vonatkozó javaslatok"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Az előző szó alapján"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Kézi bevitel"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Szó beírása a betűk megrajzolásával"</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>
diff --git a/java/res/values-in/strings.xml b/java/res/values-in/strings.xml
index d47fc4704..d5c6d48a4 100644
--- a/java/res/values-in/strings.xml
+++ b/java/res/values-in/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Sangat agresif"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Saran kata berikutnya"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Berdasarkan kata sebelumnya"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Masukan isyarat"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Masukkan kata dengan melacak huruf dari sebuah kata"</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>
diff --git a/java/res/values-ja/strings.xml b/java/res/values-ja/strings.xml
index 7eba97e3e..9d31d5cec 100644
--- a/java/res/values-ja/strings.xml
+++ b/java/res/values-ja/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"最も強い"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"次の入力候補"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"前の語句に基づいた入力候補表示"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"ジェスチャー入力"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"単語の文字をトレースして単語を入力"</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>
diff --git a/java/res/values-ko/strings.xml b/java/res/values-ko/strings.xml
index c193dea8e..8b4a498d0 100644
--- a/java/res/values-ko/strings.xml
+++ b/java/res/values-ko/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"강"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"다음 검색어 추천"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"이전 단어에 기반한 추천"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"동작 입력"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"단어를 구성하는 문자를 따라감으로써 단어를 입력"</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>
diff --git a/java/res/values-lt/strings.xml b/java/res/values-lt/strings.xml
index 5eea2203a..e52452e30 100644
--- a/java/res/values-lt/strings.xml
+++ b/java/res/values-lt/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Labai agresyviai"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Kito žodžio pasiūlymai"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Pagal ankstesnį žodį"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Įvestis gestais"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Įveskite žodį brėždami jo raides"</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>
diff --git a/java/res/values-lv/strings.xml b/java/res/values-lv/strings.xml
index a7364d607..274dd2f27 100644
--- a/java/res/values-lv/strings.xml
+++ b/java/res/values-lv/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Ļoti radikāla"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Nākamie vārdu ieteikumi"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Pamatojoties uz iepriekšējo vārdu"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Ievade ar žestu"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Ievadiet vārdu, norādot tā burtus."</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>
diff --git a/java/res/values-ms/strings.xml b/java/res/values-ms/strings.xml
index 0a9cb04fa..5100bb901 100644
--- a/java/res/values-ms/strings.xml
+++ b/java/res/values-ms/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Sangat agresif"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Cadangan perkataan seterusnya"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Berdasarkan perkataan sebelumnya"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Input gerak isyarat"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Masukkan perkataan dengan menyurih huruf perkataan itu."</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>
diff --git a/java/res/values-pt/strings.xml b/java/res/values-pt/strings.xml
index 011b18a5d..fc5ccaa00 100644
--- a/java/res/values-pt/strings.xml
+++ b/java/res/values-pt/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Muito agressivo"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Sugestões para a palavra seguinte"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Com base na palavra anterior"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Entrada por gesto"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Introduza uma palavra traçando suas letras"</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>
diff --git a/java/res/values-ro/strings.xml b/java/res/values-ro/strings.xml
index e92ce2d89..d0473464c 100644
--- a/java/res/values-ro/strings.xml
+++ b/java/res/values-ro/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Foarte exigentă"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Sugestii pentru cuvântul următor"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Bazate pe cuvântul precedent"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Utilizaţi gesturi"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Introduceţi un cuvânt desenând literele acestuia"</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>
diff --git a/java/res/values-ru/strings.xml b/java/res/values-ru/strings.xml
index 4995c5a7d..7e12ddb22 100644
--- a/java/res/values-ru/strings.xml
+++ b/java/res/values-ru/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Очень активно"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Подсказка для следующего слова"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Подсказки, основанные на предыдущих словах"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Ввод жестами"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Перемещайте палец от буквы к букве, чтобы составить слово"</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>
diff --git a/java/res/values-sk/strings.xml b/java/res/values-sk/strings.xml
index 0421ccd0e..619f41fc5 100644
--- a/java/res/values-sk/strings.xml
+++ b/java/res/values-sk/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Veľmi agresívne"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Návrhy ďalšieho slova"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Na základe predchádzajúceho slova"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Zadávanie gestami"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Napíšte slovo zadaním jeho písmen"</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>
diff --git a/java/res/values-sl/strings.xml b/java/res/values-sl/strings.xml
index fc9744e66..1df021d1f 100644
--- a/java/res/values-sl/strings.xml
+++ b/java/res/values-sl/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Zelo strogo"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Predlogi za naslednjo besedo"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Na podlagi prejšnje besede"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Vnos s potezo"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Vnašanje besede z izsleditvijo črk"</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>
diff --git a/java/res/values-sr/strings.xml b/java/res/values-sr/strings.xml
index ea27c8a90..7febdf0dc 100644
--- a/java/res/values-sr/strings.xml
+++ b/java/res/values-sr/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Веома агресивно"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Предлози за следећу реч"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"На основу претходне речи"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Унос покретом"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Унесите реч исписивањем слова речи"</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>
diff --git a/java/res/values-sw/strings.xml b/java/res/values-sw/strings.xml
index 6647d4348..eed8e994f 100644
--- a/java/res/values-sw/strings.xml
+++ b/java/res/values-sw/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Changamfu zaidi"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Mapendekezo ya neno lifuatalo"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Kulingana na neno la awali"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Ingizo la ishara"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Ingiza neno kwa kufuatilia herufi za neno"</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">"Ifuatayo"</string>
diff --git a/java/res/values-tr/strings.xml b/java/res/values-tr/strings.xml
index bb1b979d2..32d8d9882 100644
--- a/java/res/values-tr/strings.xml
+++ b/java/res/values-tr/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Çok geniş ölçekte"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Sonraki kelime önerileri"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Önceki kelimeye dayanarak"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Hareket girişi"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Bir kelimeyi harflerini izleyerek girin"</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>
diff --git a/java/res/values-vi/strings.xml b/java/res/values-vi/strings.xml
index 9f087cddf..e4ffa913c 100644
--- a/java/res/values-vi/strings.xml
+++ b/java/res/values-vi/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Rất linh hoạt"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"Đề xuất từ tiếp theo"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"Dựa trên từ trước đó"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"Nhập bằng cử chỉ"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"Nhập từ bằng cách lần theo các chữ cái của từ"</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>
diff --git a/java/res/values-zh-rCN/strings.xml b/java/res/values-zh-rCN/strings.xml
index 696a43291..3b70b6030 100644
--- a/java/res/values-zh-rCN/strings.xml
+++ b/java/res/values-zh-rCN/strings.xml
@@ -58,10 +58,8 @@
<string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"改动极大"</string>
<string name="bigram_prediction" msgid="5809665643352206540">"下一字词建议"</string>
<string name="bigram_prediction_summary" msgid="3253961591626441019">"根据上一个字词提供建议"</string>
- <!-- no translation found for gesture_input (3310827802759290774) -->
- <skip />
- <!-- no translation found for gesture_input_summary (7019742443455085809) -->
- <skip />
+ <string name="gesture_input" msgid="3310827802759290774">"手指操作输入"</string>
+ <string name="gesture_input_summary" msgid="7019742443455085809">"连笔书写输入字词"</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>
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index 925eb55fa..b47897f3c 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -93,4 +93,12 @@
<dimen name="more_suggestions_hint_text_size">27dp</dimen>
<integer name="suggestions_count_in_strip">3</integer>
<integer name="center_suggestion_percentile">36</integer>
+
+ <!-- Gesture preview parameters -->
+ <dimen name="gesture_preview_trail_width">2.5dp</dimen>
+ <dimen name="gesture_preview_text_size">35dp</dimen>
+ <dimen name="gesture_preview_text_offset">75dp</dimen>
+ <dimen name="gesture_preview_text_shadow_border">17.5dp</dimen>
+ <dimen name="gesture_preview_text_shading_border">7.5dp</dimen>
+ <dimen name="gesture_preview_text_connector_width">1.0dp</dimen>
</resources>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 9e8c59cd8..25d982793 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -309,6 +309,15 @@
<!-- Description for English (United States) keyboard subtype with explicit keyboard layout [CHAR LIMIT=25]
This should be identical to subtype_en_US aside from the trailing (%s). -->
<string name="subtype_with_layout_en_US">English (US) (<xliff:g id="layout">%s</xliff:g>)</string>
+ <!-- TODO: Uncomment once we can handle IETF language tag with script name specified.
+ Description for Serbian Cyrillic keyboard subtype [CHAR LIMIT=25]
+ <string name="subtype_serbian_cyrillic">Serbian (Cyrillic)</string>
+ Description for Serbian Latin keyboard subtype [CHAR LIMIT=25]
+ <string name="subtype_serbian_latin">Serbian (Latin)</string>
+ Description for Serbian Latin keyboard subtype with explicit keyboard layout [CHAR LIMIT=25]
+ This should be identical to subtype_serbian_latin aside from the trailing (%s).
+ <string name="subtype_with_layout_sr-Latn">Serbian (Latin) (<xliff:g id="layout">%s</xliff:g>)</string>
+ -->
<!-- Description for language agnostic keyboard subtype [CHAR LIMIT=25] -->
<string name="subtype_no_language">No language</string>
<!-- Description for language agnostic QWERTY keyboard subtype [CHAR LIMIT=25] -->
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index 7f8a23a0e..b448e00a3 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -26,6 +26,7 @@
be: Belarusian/east_slavic
bg: Bulgarian/bulgarian
bg: Bulgarian/bulgarian_bds
+ ca: Catalan/spanish
cs: Czech/qwertz
da: Danish/nordic
de: German/qwertz
@@ -41,14 +42,16 @@
hi: Hindi/hindi
hr: Croatian/qwertz
hu: Hungarian/qwertz
+ in: Indonesian/qwerty # "id" is official language code of Indonesian.
is: Icelandic/qwerty
it: Italian/qwerty
- iw: Hebrew/hebrew
+ iw: Hebrew/hebrew # "he" is official language code of Hebrew.
ka: Georgian/georgian
ky: Kyrgyz/east_slavic
lt: Lithuanian/qwerty
lv: Latvian/qwerty
mk: Macedonian/south_slavic
+ ms: Malay/qwerty
nb: Norwegian Bokmål/nordic
nl: Dutch/qwerty
pl: Polish/qwerty
@@ -59,8 +62,11 @@
sk: Slovak/qwerty
sl: Slovenian/qwerty
sr: Serbian/south_slavic
+ (sr-Latn: Serbian/qwerty) # not yet implemented.
sv: Swedish/nordic
+ sw: Swahili/qwerty
th: Thai/thai
+ tl: Tagalog/spanish
tr: Turkish/qwerty
uk: Ukrainian/east_slavic
vi: Vietnamese/qwerty
@@ -110,6 +116,12 @@
/>
<subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic"
+ android:imeSubtypeLocale="ca"
+ android:imeSubtypeMode="keyboard"
+ android:imeSubtypeExtraValue="KeyboardLayoutSet=spanish,AsciiCapable"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_generic"
android:imeSubtypeLocale="cs"
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
@@ -186,6 +198,13 @@
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/>
+ <!-- Java uses the deprecated "in" code instead of the standard "id" code for Indonesian. -->
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_generic"
+ android:imeSubtypeLocale="in"
+ android:imeSubtypeMode="keyboard"
+ android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
+ />
<subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic"
android:imeSubtypeLocale="is"
@@ -237,6 +256,12 @@
/>
<subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic"
+ android:imeSubtypeLocale="ms"
+ android:imeSubtypeMode="keyboard"
+ android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_generic"
android:imeSubtypeLocale="nb"
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
@@ -295,6 +320,20 @@
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="SupportTouchPositionCorrection"
/>
+ <!-- TODO: Uncomment once we can handle IETF language tag with script name specified.
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_serbian_cyrillic"
+ android:imeSubtypeLocale="sr"
+ android:imeSubtypeMode="keyboard"
+ android:imeSubtypeExtraValue="SupportTouchPositionCorrection"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_serbian_latin"
+ android:imeSubtypeLocale="sr-Latn"
+ android:imeSubtypeMode="keyboard"
+ android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
+ />
+ -->
<subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic"
android:imeSubtypeLocale="sv"
@@ -303,12 +342,24 @@
/>
<subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic"
+ android:imeSubtypeLocale="sw"
+ android:imeSubtypeMode="keyboard"
+ android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_generic"
android:imeSubtypeLocale="th"
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=thai"
/>
<subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic"
+ android:imeSubtypeLocale="tl"
+ android:imeSubtypeMode="keyboard"
+ android:imeSubtypeExtraValue="KeyboardLayoutSet=spanish,AsciiCapable"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_generic"
android:imeSubtypeLocale="tr"
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index d637ab5f1..f27d79382 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -74,7 +74,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
private MainKeyboardView mKeyboardView;
private LatinIME mLatinIME;
private Resources mResources;
- private SettingsValues mCurrentSettingsValues;
private KeyboardState mState;
@@ -136,7 +135,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
}
public void loadKeyboard(EditorInfo editorInfo, SettingsValues settingsValues) {
- mCurrentSettingsValues = settingsValues;
final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder(
mThemeContext, editorInfo);
builder.setScreenGeometry(mThemeContext.getResources().getConfiguration().orientation,
@@ -171,20 +169,20 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
}
private void setKeyboard(final Keyboard keyboard) {
- final Keyboard oldKeyboard = mKeyboardView.getKeyboard();
- mKeyboardView.setGestureInputEnabled(mCurrentSettingsValues.mGestureInputEnabled);
- mKeyboardView.setKeyboard(keyboard);
+ final MainKeyboardView keyboardView = mKeyboardView;
+ final Keyboard oldKeyboard = keyboardView.getKeyboard();
+ keyboardView.setKeyboard(keyboard);
mCurrentInputView.setKeyboardGeometry(keyboard.mTopPadding);
- mKeyboardView.setKeyPreviewPopupEnabled(
+ keyboardView.setKeyPreviewPopupEnabled(
SettingsValues.isKeyPreviewPopupEnabled(mPrefs, mResources),
SettingsValues.getKeyPreviewPopupDismissDelay(mPrefs, mResources));
- mKeyboardView.updateAutoCorrectionState(mIsAutoCorrectionActive);
- mKeyboardView.updateShortcutKey(mSubtypeSwitcher.isShortcutImeReady());
+ keyboardView.updateAutoCorrectionState(mIsAutoCorrectionActive);
+ keyboardView.updateShortcutKey(mSubtypeSwitcher.isShortcutImeReady());
final boolean subtypeChanged = (oldKeyboard == null)
|| !keyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
final boolean needsToDisplayLanguage = mSubtypeSwitcher.needsToDisplayLanguage(
keyboard.mId.mLocale);
- mKeyboardView.startDisplayLanguageOnSpacebar(subtypeChanged, needsToDisplayLanguage,
+ keyboardView.startDisplayLanguageOnSpacebar(subtypeChanged, needsToDisplayLanguage,
ImfUtils.hasMultipleEnabledIMEsOrSubtypes(mLatinIME, true));
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index f751fa53c..f1f942ccb 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -35,9 +35,9 @@ import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.RelativeLayout;
import android.widget.TextView;
+import com.android.inputmethod.keyboard.internal.PreviewPlacerView;
import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
@@ -97,9 +97,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
// The maximum key label width in the proportion to the key width.
private static final float MAX_LABEL_RATIO = 0.90f;
- private final static int GESTURE_DRAWING_WIDTH = 5;
- private final static int GESTURE_DRAWING_COLOR = 0xff33b5e5;
-
// Main keyboard
private Keyboard mKeyboard;
protected final KeyDrawParams mKeyDrawParams;
@@ -109,10 +106,10 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
protected final KeyPreviewDrawParams mKeyPreviewDrawParams;
private boolean mShowKeyPreviewPopup = true;
private int mDelayAfterPreview;
- private ViewGroup mPreviewPlacer;
+ private PreviewPlacerView mPreviewPlacer;
- /** True if the gesture input is enabled. */
- protected boolean mGestureInputEnabled;
+ /** True if {@link KeyboardView} should handle gesture events. */
+ protected boolean mShouldHandleGesture;
// Drawing
/** True if the entire keyboard needs to be dimmed. */
@@ -125,14 +122,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
private final HashSet<Key> mInvalidatedKeys = new HashSet<Key>();
/** The region of invalidated keys */
private final Rect mInvalidatedKeysRect = new Rect();
- /** The region of invalidated gestures */
- private final Rect mInvalidatedGesturesRect = new Rect();
/** The keyboard bitmap buffer for faster updates */
private Bitmap mBuffer;
/** The canvas for the above mutable keyboard bitmap */
private Canvas mCanvas;
private final Paint mPaint = new Paint();
- private final Paint mGesturePaint = new Paint();
private final Paint.FontMetrics mFontMetrics = new Paint.FontMetrics();
// This sparse array caches key label text height in pixel indexed by key label text size.
private static final SparseArray<Float> sTextHeightCache = new SparseArray<Float>();
@@ -382,13 +376,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
mDelayAfterPreview = mKeyPreviewDrawParams.mLingerTimeout;
mPaint.setAntiAlias(true);
-
- // TODO: These paint parameters should be specified via attribute of the view and styleable.
- mGesturePaint.setAntiAlias(true);
- mGesturePaint.setStyle(Paint.Style.STROKE);
- mGesturePaint.setStrokeJoin(Paint.Join.ROUND);
- mGesturePaint.setColor(GESTURE_DRAWING_COLOR);
- mGesturePaint.setStrokeWidth(GESTURE_DRAWING_WIDTH);
}
// Read fraction value in TypedArray as float.
@@ -443,8 +430,8 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
return mShowKeyPreviewPopup;
}
- public void setGestureInputEnabled(boolean gestureInputEnabled) {
- mGestureInputEnabled = gestureInputEnabled;
+ public void setGestureHandlingMode(boolean shouldHandleGesture) {
+ mShouldHandleGesture = shouldHandleGesture;
}
@Override
@@ -888,26 +875,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
mDrawingHandler.dismissKeyPreview(mDelayAfterPreview, tracker);
}
- private static class PreviewView extends RelativeLayout {
- KeyPreviewDrawParams mParams;
- Paint mGesturePaint;
-
- public PreviewView(Context context, KeyPreviewDrawParams params, Paint gesturePaint) {
- super(context);
- setWillNotDraw(false);
- mParams = params;
- mGesturePaint = gesturePaint;
- }
-
- @Override
- public void onDraw(Canvas canvas) {
- super.onDraw(canvas);
- canvas.translate(mParams.mCoordinates[0], mParams.mCoordinates[1]);
- PointerTracker.drawGestureTrailForAllPointerTrackers(canvas, mGesturePaint);
- canvas.translate(-mParams.mCoordinates[0], -mParams.mCoordinates[1]);
- }
- }
-
private void addKeyPreview(TextView keyPreview) {
if (mPreviewPlacer == null) {
createPreviewPlacer();
@@ -917,29 +884,31 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
private void createPreviewPlacer() {
- mPreviewPlacer = new PreviewView(getContext(), mKeyPreviewDrawParams, mGesturePaint);
+ mPreviewPlacer = new PreviewPlacerView(getContext());
+ final int[] viewOrigin = new int[2];
+ getLocationInWindow(viewOrigin);
+ mPreviewPlacer.setOrigin(viewOrigin[0], viewOrigin[1]);
final ViewGroup windowContentView =
(ViewGroup)getRootView().findViewById(android.R.id.content);
windowContentView.addView(mPreviewPlacer);
}
+ public void showGesturePreviewText(String gesturePreviewText) {
+ // TDOD: Add user settings option to control drawing gesture trail.
+ if (mPreviewPlacer == null) {
+ createPreviewPlacer();
+ }
+ mPreviewPlacer.setGesturePreviewText(gesturePreviewText);
+ mPreviewPlacer.invalidate();
+ }
+
@Override
public void showGestureTrail(PointerTracker tracker) {
+ // TDOD: Add user settings option to control drawing gesture trail.
if (mPreviewPlacer == null) {
createPreviewPlacer();
}
- final Rect r = tracker.getBoundingBox();
- if (!r.isEmpty()) {
- // Invalidate the rectangular region encompassing the gesture. This is needed because
- // past points along the gesture will fade and gradually disappear.
- final KeyPreviewDrawParams params = mKeyPreviewDrawParams;
- mInvalidatedGesturesRect.set(r);
- mInvalidatedGesturesRect.offset(params.mCoordinates[0], params.mCoordinates[1]);
- mInvalidatedGesturesRect.inset(-GESTURE_DRAWING_WIDTH, -GESTURE_DRAWING_WIDTH);
- mPreviewPlacer.invalidate(mInvalidatedGesturesRect);
- } else {
- mPreviewPlacer.invalidate();
- }
+ mPreviewPlacer.invalidatePointer(tracker);
}
@SuppressWarnings("deprecation") // setBackgroundDrawable is replaced by setBackground in API16
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 8c234e4e6..110f3c3e3 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -461,7 +461,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
super.setKeyboard(keyboard);
mKeyDetector.setKeyboard(
keyboard, -getPaddingLeft(), -getPaddingTop() + mVerticalCorrection);
- PointerTracker.setKeyDetector(mKeyDetector, mGestureInputEnabled);
+ PointerTracker.setKeyDetector(mKeyDetector, mShouldHandleGesture);
mTouchScreenRegulator.setKeyboard(keyboard);
mMoreKeysPanelCache.clear();
@@ -479,6 +479,12 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
AccessibleKeyboardViewProxy.getInstance().setKeyboard(keyboard);
}
+ @Override
+ public void setGestureHandlingMode(final boolean shouldHandleGesture) {
+ super.setGestureHandlingMode(shouldHandleGesture);
+ PointerTracker.setKeyDetector(mKeyDetector, shouldHandleGesture);
+ }
+
/**
* Returns whether the device has distinct multi-touch panel.
* @return true if the device has distinct multi-touch panel.
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index 4a5ecf986..67857d111 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -18,7 +18,6 @@ package com.android.inputmethod.keyboard;
import android.graphics.Canvas;
import android.graphics.Paint;
-import android.graphics.Rect;
import android.os.SystemClock;
import android.util.Log;
import android.view.MotionEvent;
@@ -42,8 +41,8 @@ public class PointerTracker {
private static final boolean DEBUG_LISTENER = false;
private static boolean DEBUG_MODE = LatinImeLogger.sDBG;
- // TODO: There should be an option to turn on/off the gesture input.
- private static boolean sIsGestureEnabled = true;
+ /** True if {@link PointerTracker}s should handle gesture events. */
+ private static boolean sShouldHandleGesture = false;
private static final int MIN_GESTURE_RECOGNITION_TIME = 100; // msec
@@ -199,7 +198,7 @@ public class PointerTracker {
sNeedsPhantomSuddenMoveEventHack = needsPhantomSuddenMoveEventHack;
setParameters(MainKeyboardView.PointerTrackerParams.DEFAULT);
- updateGestureInputEnabledState(null, false /* gestureInputEnabled */);
+ updateGestureHandlingMode(null, false /* shouldHandleGesture */);
}
public static void setParameters(MainKeyboardView.PointerTrackerParams params) {
@@ -208,14 +207,13 @@ public class PointerTracker {
params.mTouchNoiseThresholdDistance * params.mTouchNoiseThresholdDistance);
}
- private static void updateGestureInputEnabledState(Keyboard keyboard,
- boolean gestureInputEnabled) {
- if (!gestureInputEnabled
+ private static void updateGestureHandlingMode(Keyboard keyboard, boolean shouldHandleGesture) {
+ if (!shouldHandleGesture
|| AccessibilityUtils.getInstance().isTouchExplorationEnabled()
|| (keyboard != null && keyboard.mId.passwordInput())) {
- sIsGestureEnabled = false;
+ sShouldHandleGesture = false;
} else {
- sIsGestureEnabled = true;
+ sShouldHandleGesture = true;
}
}
@@ -243,7 +241,7 @@ public class PointerTracker {
}
}
- public static void setKeyDetector(KeyDetector keyDetector, boolean gestureInputEnabledByUser) {
+ public static void setKeyDetector(KeyDetector keyDetector, boolean shouldHandleGesture) {
final int trackersSize = sTrackers.size();
for (int i = 0; i < trackersSize; ++i) {
final PointerTracker tracker = sTrackers.get(i);
@@ -252,7 +250,7 @@ public class PointerTracker {
tracker.mKeyboardLayoutHasBeenChanged = true;
}
final Keyboard keyboard = keyDetector.getKeyboard();
- updateGestureInputEnabledState(keyboard, gestureInputEnabledByUser);
+ updateGestureHandlingMode(keyboard, shouldHandleGesture);
}
public static void dismissAllKeyPreviews() {
@@ -297,17 +295,6 @@ public class PointerTracker {
sAggregratedPointers.reset();
}
- // TODO: To handle multi-touch gestures we may want to move this method to
- // {@link PointerTrackerQueue}.
- public static void drawGestureTrailForAllPointerTrackers(Canvas canvas, Paint paint) {
- final int trackersSize = sTrackers.size();
- for (int i = 0; i < trackersSize; ++i) {
- final PointerTracker tracker = sTrackers.get(i);
- tracker.mGestureStroke.drawGestureTrail(canvas, paint, tracker.getLastX(),
- tracker.getLastY());
- }
- }
-
private PointerTracker(int id, KeyEventHandler handler) {
if (handler == null)
throw new NullPointerException();
@@ -525,6 +512,12 @@ public class PointerTracker {
mDrawingProxy.invalidateKey(key);
}
+ public void drawGestureTrail(Canvas canvas, Paint paint) {
+ if (mInGesture) {
+ mGestureStroke.drawGestureTrail(canvas, paint, mLastX, mLastY);
+ }
+ }
+
public int getLastX() {
return mLastX;
}
@@ -536,9 +529,6 @@ public class PointerTracker {
public long getDownTime() {
return mDownTime;
}
- public Rect getBoundingBox() {
- return mGestureStroke.getBoundingBox();
- }
private Key onDownKey(int x, int y, long eventTime) {
mDownTime = eventTime;
@@ -669,8 +659,8 @@ public class PointerTracker {
if (queue != null && queue.size() == 1) {
mIsPossibleGesture = false;
// A gesture should start only from the letter key.
- if (sIsGestureEnabled && mIsAlphabetKeyboard && !mIsShowingMoreKeysPanel && key != null
- && Keyboard.isLetterCode(key.mCode)) {
+ if (sShouldHandleGesture && mIsAlphabetKeyboard && !mIsShowingMoreKeysPanel
+ && key != null && Keyboard.isLetterCode(key.mCode)) {
mIsPossibleGesture = true;
// TODO: pointer times should be relative to first down even in entire batch input
// instead of resetting to 0 for each new down event.
@@ -714,7 +704,7 @@ public class PointerTracker {
private void onGestureMoveEvent(PointerTracker tracker, int x, int y, long eventTime,
boolean isHistorical, Key key) {
final int gestureTime = (int)(eventTime - tracker.getDownTime());
- if (sIsGestureEnabled && mIsPossibleGesture) {
+ if (sShouldHandleGesture && mIsPossibleGesture) {
final GestureStroke stroke = mGestureStroke;
stroke.addPoint(x, y, gestureTime, isHistorical);
if (!mInGesture && stroke.isStartOfAGesture(gestureTime, sWasInGesture)) {
diff --git a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
index c16b70ef0..28d6c1d07 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
@@ -16,7 +16,6 @@ package com.android.inputmethod.keyboard.internal;
import android.graphics.Canvas;
import android.graphics.Paint;
-import android.graphics.Rect;
import android.util.FloatMath;
import com.android.inputmethod.latin.Constants;
@@ -41,7 +40,6 @@ public class GestureStroke {
private int mMinGestureLength;
private int mMinGestureLengthWhileInGesture;
private int mMinGestureSampleLength;
- private final Rect mDrawingRect = new Rect();
// TODO: Move some of these to resource.
private static final float MIN_GESTURE_LENGTH_RATIO_TO_KEY_WIDTH = 1.0f;
@@ -90,7 +88,6 @@ public class GestureStroke {
mEventTimes.setLength(0);
mXCoordinates.setLength(0);
mYCoordinates.setLength(0);
- mDrawingRect.setEmpty();
}
private void updateLastPoint(final int x, final int y, final int time) {
@@ -198,8 +195,4 @@ public class GestureStroke {
}
}
}
-
- public Rect getBoundingBox() {
- return mDrawingRect;
- }
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
index d732fc061..308e2411e 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
@@ -2098,6 +2098,24 @@ public final class KeyboardTextsSet {
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null,
/* ~34 */
+ // TODO: Move these to sr-Latn once we can handle IETF language tag with script name specified.
+ // BEGIN: More keys definitions for Serbian (Latin)
+ // U+0161: "š" LATIN SMALL LETTER S WITH CARON
+ // U+00DF: "ß" LATIN SMALL LETTER SHARP S
+ // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
+ // <string name="more_keys_for_s">&#x0161;,&#x00DF;,&#x015B;</string>
+ // U+010D: "č" LATIN SMALL LETTER C WITH CARON
+ // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
+ // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
+ // <string name="more_keys_for_c">&#x010D;,&#x00E7;,&#x0107;</string>
+ // U+010F: "ď" LATIN SMALL LETTER D WITH CARON
+ // <string name="more_keys_for_d">&#x010F;</string>
+ // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
+ // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
+ // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
+ // <string name="more_keys_for_z">&#x017E;,&#x017A;,&#x017C;</string>
+ // END: More keys definitions for Serbian (Latin)
+ // BEGIN: More keys definitions for Serbian (Cyrillic)
// U+0437: "з" CYRILLIC SMALL LETTER ZE
/* 35 */ "\u0437",
// U+045B: "ћ" CYRILLIC SMALL LETTER TSHE
@@ -2111,6 +2129,7 @@ public final class KeyboardTextsSet {
// U+045D: "ѝ" CYRILLIC SMALL LETTER I WITH GRAVE
/* 40 */ "\u045D",
/* 41 */ null,
+ // END: More keys definitions for Serbian (Cyrillic)
// U+2018: "‘" LEFT SINGLE QUOTATION MARK
// U+2019: "’" RIGHT SINGLE QUOTATION MARK
// U+201A: "‚" SINGLE LOW-9 QUOTATION MARK
@@ -2169,6 +2188,110 @@ public final class KeyboardTextsSet {
/* 24 */ "\u00E6",
};
+ /* Language sw: Swahili */
+ private static final String[] LANGUAGE_sw = {
+ // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+ // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
+ // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
+ // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
+ // U+00E6: "æ" LATIN SMALL LETTER AE
+ // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
+ // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
+ // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
+ /* 0 */ "\u00E0,\u00E1,\u00E2,\u00E4,\u00E6,\u00E3,\u00E5,\u0101",
+ // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+ // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
+ // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
+ // U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
+ /* 1 */ "\u00E8,\u00E9,\u00EA,\u00EB,\u0113",
+ // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+ // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
+ // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+ // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
+ // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
+ /* 2 */ "\u00EE,\u00EF,\u00ED,\u012B,\u00EC",
+ // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+ // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
+ // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+ // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+ // U+0153: "œ" LATIN SMALL LIGATURE OE
+ // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
+ // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
+ // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
+ /* 3 */ "\u00F4,\u00F6,\u00F2,\u00F3,\u0153,\u00F8,\u014D,\u00F5",
+ // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+ // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+ // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
+ // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+ // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
+ /* 4 */ "\u00FB,\u00FC,\u00F9,\u00FA,\u016B",
+ // U+00DF: "ß" LATIN SMALL LETTER SHARP S
+ /* 5 */ "\u00DF",
+ // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
+ /* 6 */ "\u00F1",
+ // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
+ /* 7 */ "\u00E7",
+ /* 8~ */
+ null, null, null, null, null, null, null,
+ /* ~14 */
+ /* 15 */ "g\'",
+ };
+
+ /* Language tl: Tagalog */
+ private static final String[] LANGUAGE_tl = {
+ // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
+ // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+ // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
+ // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
+ // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
+ // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
+ // U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK
+ // U+00E6: "æ" LATIN SMALL LETTER AE
+ // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
+ // U+00AA: "ª" FEMININE ORDINAL INDICATOR
+ /* 0 */ "\u00E1,\u00E0,\u00E4,\u00E2,\u00E3,\u00E5,\u0105,\u00E6,\u0101,\u00AA",
+ // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+ // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
+ // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
+ // U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
+ // U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
+ // U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
+ /* 1 */ "\u00E9,\u00E8,\u00EB,\u00EA,\u0119,\u0117,\u0113",
+ // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+ // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
+ // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
+ // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+ // U+012F: "į" LATIN SMALL LETTER I WITH OGONEK
+ // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
+ /* 2 */ "\u00ED,\u00EF,\u00EC,\u00EE,\u012F,\u012B",
+ // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+ // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+ // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
+ // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+ // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
+ // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
+ // U+0153: "œ" LATIN SMALL LIGATURE OE
+ // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
+ // U+00BA: "º" MASCULINE ORDINAL INDICATOR
+ /* 3 */ "\u00F3,\u00F2,\u00F6,\u00F4,\u00F5,\u00F8,\u0153,\u014D,\u00BA",
+ // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+ // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+ // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
+ // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+ // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
+ /* 4 */ "\u00FA,\u00FC,\u00F9,\u00FB,\u016B",
+ /* 5 */ null,
+ // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
+ // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
+ /* 6 */ "\u00F1,\u0144",
+ // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
+ // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
+ // U+010D: "č" LATIN SMALL LETTER C WITH CARON
+ /* 7 */ "\u00E7,\u0107,\u010D",
+ };
+
/* Language tr: Turkish */
private static final String[] LANGUAGE_tr = {
// U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
@@ -2477,6 +2600,8 @@ public final class KeyboardTextsSet {
"sl", LANGUAGE_sl, /* Slovenian */
"sr", LANGUAGE_sr, /* Serbian */
"sv", LANGUAGE_sv, /* Swedish */
+ "sw", LANGUAGE_sw, /* Swahili */
+ "tl", LANGUAGE_tl, /* Tagalog */
"tr", LANGUAGE_tr, /* Turkish */
"uk", LANGUAGE_uk, /* Ukrainian */
"vi", LANGUAGE_vi, /* Vietnamese */
diff --git a/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java b/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java
new file mode 100644
index 000000000..2a53c59bb
--- /dev/null
+++ b/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard.internal;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Paint.Align;
+import android.text.TextUtils;
+import android.util.SparseArray;
+import android.widget.RelativeLayout;
+
+import com.android.inputmethod.keyboard.PointerTracker;
+import com.android.inputmethod.latin.R;
+
+public class PreviewPlacerView extends RelativeLayout {
+ // TODO: Move these parameters to attributes of {@link KeyboardView}.
+ private final static int GESTURE_DRAWING_COLOR = 0xff33b5e5;
+ private static final int GESTURE_PREVIEW_TEXT_COLOR = Color.WHITE;
+ private static final int GESTURE_PREVIEW_TEXT_SHADING_COLOR = 0xff33b5e5;
+ private static final int GESTURE_PREVIEW_TEXT_SHADOW_COLOR = 0xff252525;
+ private static final int GESTURE_PREVIEW_CONNECTOR_COLOR = Color.WHITE;
+
+ private final Paint mGesturePaint;
+ private final int mGesturePreviewTraileWidth;
+ private final Paint mTextPaint;
+ private final int mGesturePreviewTextOffset;
+ private final int mGesturePreviewTextShadowBorder;
+ private final int mGesturePreviewTextShadingBorder;
+ private final int mGesturePreviewTextConnectorWidth;
+
+ private int mXOrigin;
+ private int mYOrigin;
+
+ private final SparseArray<PointerTracker> mPointers = new SparseArray<PointerTracker>();
+
+ private String mGesturePreviewText;
+
+ public PreviewPlacerView(Context context) {
+ super(context);
+ setWillNotDraw(false);
+
+ final Resources res = getResources();
+ // TODO: Move these parameters to attributes of {@link KeyboardView}.
+ mGesturePreviewTraileWidth = res.getDimensionPixelSize(
+ R.dimen.gesture_preview_trail_width);
+ final int textSize = res.getDimensionPixelSize(R.dimen.gesture_preview_text_size);
+ mGesturePreviewTextOffset = res.getDimensionPixelSize(
+ R.dimen.gesture_preview_text_offset);
+ mGesturePreviewTextShadowBorder = res.getDimensionPixelOffset(
+ R.dimen.gesture_preview_text_shadow_border);
+ mGesturePreviewTextShadingBorder = res.getDimensionPixelOffset(
+ R.dimen.gesture_preview_text_shading_border);
+ mGesturePreviewTextConnectorWidth = res.getDimensionPixelOffset(
+ R.dimen.gesture_preview_text_connector_width);
+
+ mGesturePaint = new Paint();
+ mGesturePaint.setAntiAlias(true);
+ mGesturePaint.setStyle(Paint.Style.STROKE);
+ mGesturePaint.setStrokeJoin(Paint.Join.ROUND);
+ mGesturePaint.setColor(GESTURE_DRAWING_COLOR);
+ mGesturePaint.setStrokeWidth(mGesturePreviewTraileWidth);
+
+ mTextPaint = new Paint();
+ mTextPaint.setAntiAlias(true);
+ mTextPaint.setStrokeJoin(Paint.Join.ROUND);
+ mTextPaint.setTextAlign(Align.CENTER);
+ mTextPaint.setTextSize(textSize);
+ }
+
+ public void setOrigin(int x, int y) {
+ mXOrigin = x;
+ mYOrigin = y;
+ }
+
+ public void invalidatePointer(PointerTracker tracker) {
+ synchronized (mPointers) {
+ mPointers.put(tracker.mPointerId, tracker);
+ // TODO: Should narrow the invalidate region.
+ invalidate();
+ }
+ }
+
+ @Override
+ public void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ // TDOD: Add user settings option to control drawing gesture trail and gesture preview.
+ synchronized (mPointers) {
+ canvas.translate(mXOrigin, mYOrigin);
+ final int trackerCount = mPointers.size();
+ boolean floatingPreviewHasDrawn = false;
+ for (int index = 0; index < trackerCount; index++) {
+ final PointerTracker tracker = mPointers.valueAt(index);
+ tracker.drawGestureTrail(canvas, mGesturePaint);
+ // TODO: Figure out more cleaner way to draw gesture preview text.
+ if (!floatingPreviewHasDrawn) {
+ drawGesturePreviewText(canvas, tracker, mGesturePreviewText);
+ floatingPreviewHasDrawn = true;
+ }
+ }
+ canvas.translate(-mXOrigin, -mYOrigin);
+ }
+ }
+
+ public void setGesturePreviewText(String gesturePreviewText) {
+ mGesturePreviewText = gesturePreviewText;
+ invalidate();
+ }
+
+ private void drawGesturePreviewText(Canvas canvas, PointerTracker tracker,
+ String gesturePreviewText) {
+ if (TextUtils.isEmpty(gesturePreviewText)) {
+ return;
+ }
+
+ final Paint paint = mTextPaint;
+ final int lastX = tracker.getLastX();
+ final int lastY = tracker.getLastY();
+ final int textSize = (int)paint.getTextSize();
+ final int canvasWidth = canvas.getWidth();
+
+ final int halfTextWidth = (int)paint.measureText(gesturePreviewText) / 2 + textSize;
+ final int textX = Math.min(Math.max(lastX, halfTextWidth), canvasWidth - halfTextWidth);
+
+ int textY = Math.max(-textSize, lastY - mGesturePreviewTextOffset);
+ if (textY < 0) {
+ // Paint black text shadow if preview extends above keyboard region.
+ paint.setStyle(Paint.Style.FILL_AND_STROKE);
+ paint.setColor(GESTURE_PREVIEW_TEXT_SHADOW_COLOR);
+ paint.setStrokeWidth(mGesturePreviewTextShadowBorder);
+ canvas.drawText(gesturePreviewText, textX, textY, paint);
+ }
+
+ // Paint the vertical line connecting the touch point to the preview text.
+ paint.setStyle(Paint.Style.STROKE);
+ paint.setColor(GESTURE_PREVIEW_CONNECTOR_COLOR);
+ paint.setStrokeWidth(mGesturePreviewTextConnectorWidth);
+ final int lineTopY = textY - textSize / 4;
+ canvas.drawLine(lastX, lastY, lastX, lineTopY, paint);
+ if (lastX != textX) {
+ // Paint the horizontal line connection the touch point to the preview text.
+ canvas.drawLine(lastX, lineTopY, textX, lineTopY, paint);
+ }
+
+ // Paint the shading for the text preview
+ paint.setStyle(Paint.Style.FILL_AND_STROKE);
+ paint.setColor(GESTURE_PREVIEW_TEXT_SHADING_COLOR);
+ paint.setStrokeWidth(mGesturePreviewTextShadingBorder);
+ canvas.drawText(gesturePreviewText, textX, textY, paint);
+
+ // Paint the text preview
+ paint.setColor(GESTURE_PREVIEW_TEXT_COLOR);
+ paint.setStyle(Paint.Style.FILL);
+ canvas.drawText(gesturePreviewText, textX, textY, paint);
+ }
+}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index d4b59c4cd..9f9d07b3a 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -82,7 +82,8 @@ import java.util.Locale;
* Input method implementation for Qwerty'ish keyboard.
*/
public class LatinIME extends InputMethodService implements KeyboardActionListener,
- SuggestionStripView.Listener, TargetApplicationGetter.OnTargetApplicationKnownListener {
+ SuggestionStripView.Listener, TargetApplicationGetter.OnTargetApplicationKnownListener,
+ Suggest.SuggestInitializationListener {
private static final String TAG = LatinIME.class.getSimpleName();
private static final boolean TRACE = false;
private static boolean DEBUG;
@@ -426,6 +427,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
resetContactsDictionary(null == mSuggest ? null : mSuggest.getContactsDictionary());
}
+ @Override
+ public void onUpdateMainDictionaryAvailability(boolean isMainDictionaryAvailable) {
+ mIsMainDictionaryAvailable = isMainDictionaryAvailable;
+ updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability();
+ }
+
private void initSuggest() {
final Locale subtypeLocale = mSubtypeSwitcher.getCurrentSubtypeLocale();
final String localeStr = subtypeLocale.toString();
@@ -437,7 +444,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} else {
oldContactsDictionary = null;
}
- mSuggest = new Suggest(this, subtypeLocale);
+ mSuggest = new Suggest(this /* Context */, subtypeLocale,
+ this /* SuggestInitializationListener */);
if (mCurrentSettings.mCorrectionEnabled) {
mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold);
}
@@ -673,6 +681,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
switcher.loadKeyboard(editorInfo, mCurrentSettings);
+ updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability();
if (mSuggestionStripView != null)
mSuggestionStripView.clear();
@@ -1334,6 +1343,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mWordComposer.setBatchInputPointers(batchPointers);
final SuggestedWords suggestedWords = getSuggestedWords();
showSuggestionStrip(suggestedWords, null);
+ final String gesturePreviewText = (suggestedWords.size() > 0)
+ ? suggestedWords.getWord(0) : null;
+ mKeyboardSwitcher.getKeyboardView().showGesturePreviewText(gesturePreviewText);
}
@Override
@@ -1341,6 +1353,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mWordComposer.setBatchInputPointers(batchPointers);
final SuggestedWords suggestedWords = getSuggestedWords();
showSuggestionStrip(suggestedWords, null);
+ mKeyboardSwitcher.getKeyboardView().showGesturePreviewText(null);
if (suggestedWords == null || suggestedWords.size() == 0) {
return;
}
@@ -2044,18 +2057,28 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void onRefreshKeyboard() {
// When the device locale is changed in SetupWizard etc., this method may get called via
// onConfigurationChanged before SoftInputWindow is shown.
+ initSuggest();
+ loadSettings();
if (mKeyboardSwitcher.getKeyboardView() != null) {
// Reload keyboard because the current language has been changed.
mKeyboardSwitcher.loadKeyboard(getCurrentInputEditorInfo(), mCurrentSettings);
+ updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability();
}
- initSuggest();
- loadSettings();
// Since we just changed languages, we should re-evaluate suggestions with whatever word
// we are currently composing. If we are not composing anything, we may want to display
// predictions or punctuation signs (which is done by the updateSuggestionStrip anyway).
mHandler.postUpdateSuggestionStrip();
}
+ private void updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability() {
+ final MainKeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView();
+ if (keyboardView != null) {
+ final boolean shouldHandleGesture = mCurrentSettings.mGestureInputEnabled
+ && mIsMainDictionaryAvailable;
+ keyboardView.setGestureHandlingMode(shouldHandleGesture);
+ }
+ }
+
// TODO: Remove this method from {@link LatinIME} and move {@link FeedbackManager} to
// {@link KeyboardSwitcher}. Called from KeyboardSwitcher
public void hapticAndAudioFeedback(final int primaryCode) {
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 598ef1de7..3e3cf76f1 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -42,6 +42,10 @@ public class Suggest {
// TODO: rename this to CORRECTION_ON
public static final int CORRECTION_FULL = 1;
+ public interface SuggestInitializationListener {
+ public void onUpdateMainDictionaryAvailability(boolean isMainDictionaryAvailable);
+ }
+
private static final boolean DBG = LatinImeLogger.sDBG;
private Dictionary mMainDictionary;
@@ -55,11 +59,14 @@ public class Suggest {
private float mAutoCorrectionThreshold;
// Locale used for upper- and title-casing words
- final private Locale mLocale;
+ private final Locale mLocale;
+ private final SuggestInitializationListener mListener;
- public Suggest(final Context context, final Locale locale) {
+ public Suggest(final Context context, final Locale locale,
+ final SuggestInitializationListener listener) {
initAsynchronously(context, locale);
mLocale = locale;
+ mListener = listener;
}
/* package for test */ Suggest(final Context context, final File dictionary,
@@ -67,6 +74,7 @@ public class Suggest {
final Dictionary mainDict = DictionaryFactory.createDictionaryForTest(context, dictionary,
startOffset, length /* useFullEditDistance */, false, locale);
mLocale = locale;
+ mListener = null;
mMainDictionary = mainDict;
addOrReplaceDictionary(mDictionaries, Dictionary.TYPE_MAIN, mainDict);
initWhitelistAndAutocorrectAndPool(context, locale);
@@ -98,6 +106,9 @@ public class Suggest {
public void resetMainDict(final Context context, final Locale locale) {
mMainDictionary = null;
+ if (mListener != null) {
+ mListener.onUpdateMainDictionaryAvailability(hasMainDictionary());
+ }
new Thread("InitializeBinaryDictionary") {
@Override
public void run() {
@@ -105,6 +116,9 @@ public class Suggest {
DictionaryFactory.createMainDictionaryFromManager(context, locale);
addOrReplaceDictionary(mDictionaries, Dictionary.TYPE_MAIN, newMainDict);
mMainDictionary = newMainDict;
+ if (mListener != null) {
+ mListener.onUpdateMainDictionaryAvailability(hasMainDictionary());
+ }
}
}.start();
}
diff --git a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
index 9eb437c06..0a8aabf4f 100644
--- a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
+++ b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 2011, 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.
-*/
+ *
+ * Copyright 2011, 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.
+ */
#define LOG_TAG "LatinIME: jni: ProximityInfo"
@@ -85,5 +85,4 @@ int register_ProximityInfo(JNIEnv *env) {
return registerNativeMethods(env, kClassPathName, sKeyboardMethods,
sizeof(sKeyboardMethods) / sizeof(sKeyboardMethods[0]));
}
-
} // namespace latinime
diff --git a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
index 4a1e83b09..f5ccf2053 100644
--- a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
+++ b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 2011, 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.
-*/
+ *
+ * Copyright 2011, 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 _COM_ANDROID_INPUTMETHOD_KEYBOARD_PROXIMITYINFO_H
#define _COM_ANDROID_INPUTMETHOD_KEYBOARD_PROXIMITYINFO_H
@@ -24,6 +24,5 @@ namespace latinime {
int register_ProximityInfo(JNIEnv *env);
-}
-
+} // namespace latinime
#endif // _COM_ANDROID_INPUTMETHOD_KEYBOARD_PROXIMITYINFO_H
diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
index 0a282b865..8725b0c9d 100644
--- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
+++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 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.
-*/
+ *
+ * Copyright 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.
+ */
#define LOG_TAG "LatinIME: jni: BinaryDictionary"
@@ -42,7 +42,7 @@
namespace latinime {
-void releaseDictBuf(void* dictBuf, const size_t length, int fd);
+void releaseDictBuf(void *dictBuf, const size_t length, int fd);
static jlong latinime_BinaryDictionary_open(JNIEnv *env, jobject object,
jstring sourceDir, jlong dictOffset, jlong dictSize,
@@ -235,7 +235,7 @@ static void latinime_BinaryDictionary_close(JNIEnv *env, jobject object, jlong d
delete dictionary;
}
-void releaseDictBuf(void* dictBuf, const size_t length, int fd) {
+void releaseDictBuf(void *dictBuf, const size_t length, int fd) {
#ifdef USE_MMAP_FOR_DICTIONARY
int ret = munmap(dictBuf, length);
if (ret != 0) {
@@ -263,9 +263,8 @@ static JNINativeMethod sMethods[] = {
};
int register_BinaryDictionary(JNIEnv *env) {
- const char* const kClassPathName = "com/android/inputmethod/latin/BinaryDictionary";
+ const char *const kClassPathName = "com/android/inputmethod/latin/BinaryDictionary";
return registerNativeMethods(env, kClassPathName, sMethods,
sizeof(sMethods) / sizeof(sMethods[0]));
}
-
} // namespace latinime
diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.h b/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
index 1b1ba7f0f..0b67e6b95 100644
--- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
+++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 2011, 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.
-*/
+ *
+ * Copyright 2011, 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 _COM_ANDROID_INPUTMETHOD_LATIN_BINARYDICTIONARY_H
#define _COM_ANDROID_INPUTMETHOD_LATIN_BINARYDICTIONARY_H
@@ -24,6 +24,5 @@ namespace latinime {
int register_BinaryDictionary(JNIEnv *env);
-}
-
+} // namespace latinime
#endif // _COM_ANDROID_INPUTMETHOD_LATIN_BINARYDICTIONARY_H
diff --git a/native/jni/com_android_inputmethod_latin_NativeUtils.cpp b/native/jni/com_android_inputmethod_latin_NativeUtils.cpp
index c1e586a4b..32d895405 100644
--- a/native/jni/com_android_inputmethod_latin_NativeUtils.cpp
+++ b/native/jni/com_android_inputmethod_latin_NativeUtils.cpp
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+ *
+ * Copyright 2012, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include "com_android_inputmethod_latin_NativeUtils.h"
#include "jni.h"
@@ -32,9 +32,8 @@ static JNINativeMethod sMethods[] = {
};
int register_NativeUtils(JNIEnv *env) {
- const char* const kClassPathName = "com/android/inputmethod/latin/NativeUtils";
+ const char *const kClassPathName = "com/android/inputmethod/latin/NativeUtils";
return registerNativeMethods(env, kClassPathName, sMethods,
sizeof(sMethods) / sizeof(sMethods[0]));
}
-
} // namespace latinime
diff --git a/native/jni/com_android_inputmethod_latin_NativeUtils.h b/native/jni/com_android_inputmethod_latin_NativeUtils.h
index 13a348a5c..4d29d7d47 100644
--- a/native/jni/com_android_inputmethod_latin_NativeUtils.h
+++ b/native/jni/com_android_inputmethod_latin_NativeUtils.h
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+ *
+ * Copyright 2012, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef _COM_ANDROID_INPUTMETHOD_LATIN_NATIVEUTILS_H
#define _COM_ANDROID_INPUTMETHOD_LATIN_NATIVEUTILS_H
@@ -24,6 +24,5 @@ namespace latinime {
int register_NativeUtils(JNIEnv *env);
-}
-
+} // namespace latinime
#endif // _COM_ANDROID_INPUTMETHOD_LATIN_NATIVEUTILS_H
diff --git a/native/jni/jni_common.cpp b/native/jni/jni_common.cpp
index 1314bab27..8d7bce79e 100644
--- a/native/jni/jni_common.cpp
+++ b/native/jni/jni_common.cpp
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 2011, 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.
-*/
+ *
+ * Copyright 2011, 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.
+ */
#define LOG_TAG "LatinIME: jni"
@@ -33,8 +33,8 @@ using namespace latinime;
/*
* Returns the JNI version on success, -1 on failure.
*/
-jint JNI_OnLoad(JavaVM* vm, void* reserved) {
- JNIEnv* env = 0;
+jint JNI_OnLoad(JavaVM *vm, void *reserved) {
+ JNIEnv *env = 0;
jint result = -1;
if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
@@ -67,7 +67,7 @@ bail:
namespace latinime {
-int registerNativeMethods(JNIEnv* env, const char* className, JNINativeMethod* methods,
+int registerNativeMethods(JNIEnv *env, const char *className, JNINativeMethod *methods,
int numMethods) {
jclass clazz = env->FindClass(className);
if (clazz == 0) {
@@ -82,5 +82,4 @@ int registerNativeMethods(JNIEnv* env, const char* className, JNINativeMethod* m
env->DeleteLocalRef(clazz);
return JNI_TRUE;
}
-
} // namespace latinime
diff --git a/native/jni/jni_common.h b/native/jni/jni_common.h
index 6741443ac..32f9fa9b8 100644
--- a/native/jni/jni_common.h
+++ b/native/jni/jni_common.h
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 2011, 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.
-*/
+ *
+ * Copyright 2011, 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_JNI_COMMON_H
#define LATINIME_JNI_COMMON_H
@@ -54,7 +54,5 @@ inline void safeReleaseFloatArrayElements(JNIEnv *env, jfloatArray jArray, jfloa
env->ReleaseFloatArrayElements(jArray, cArray, 0);
}
}
-
} // namespace latinime
-
#endif // LATINIME_JNI_COMMON_H
diff --git a/native/jni/src/additional_proximity_chars.cpp b/native/jni/src/additional_proximity_chars.cpp
index 224f020f2..de8764678 100644
--- a/native/jni/src/additional_proximity_chars.cpp
+++ b/native/jni/src/additional_proximity_chars.cpp
@@ -38,4 +38,4 @@ const int32_t AdditionalProximityChars::EN_US_ADDITIONAL_O[EN_US_ADDITIONAL_O_SI
const int32_t AdditionalProximityChars::EN_US_ADDITIONAL_U[EN_US_ADDITIONAL_U_SIZE] = {
'a', 'e', 'i', 'o'
};
-}
+} // namespace latinime
diff --git a/native/jni/src/additional_proximity_chars.h b/native/jni/src/additional_proximity_chars.h
index 82c31f860..ba76cfced 100644
--- a/native/jni/src/additional_proximity_chars.h
+++ b/native/jni/src/additional_proximity_chars.h
@@ -45,7 +45,7 @@ class AdditionalProximityChars {
}
public:
- static int getAdditionalCharsSize(const std::string* locale_str, const int32_t c) {
+ static int getAdditionalCharsSize(const std::string *locale_str, const int32_t c) {
if (!isEnLocale(locale_str)) {
return 0;
}
@@ -65,7 +65,7 @@ class AdditionalProximityChars {
}
}
- static const int32_t* getAdditionalChars(const std::string *locale_str, const int32_t c) {
+ static const int32_t *getAdditionalChars(const std::string *locale_str, const int32_t c) {
if (!isEnLocale(locale_str)) {
return 0;
}
@@ -89,7 +89,5 @@ class AdditionalProximityChars {
return getAdditionalCharsSize(locale_str, c) > 0;
}
};
-
-}
-
+} // namespace latinime
#endif // LATINIME_ADDITIONAL_PROXIMITY_CHARS_H
diff --git a/native/jni/src/basechars.cpp b/native/jni/src/basechars.cpp
index 31f1e18a8..c91e5f741 100644
--- a/native/jni/src/basechars.cpp
+++ b/native/jni/src/basechars.cpp
@@ -18,7 +18,7 @@
namespace latinime {
-/**
+/*
* 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
@@ -187,8 +187,6 @@ const unsigned short BASE_CHARS[BASE_CHARS_SIZE] = {
0x0423, 0x0443, 0x0423, 0x0443, 0x0427, 0x0447, 0x04f6, 0x04f7,
0x042b, 0x044b, 0x04fa, 0x04fb, 0x04fc, 0x04fd, 0x04fe, 0x04ff,
};
-
// generated with:
// cat UnicodeData.txt | perl -e 'while (<>) { @foo = split(/;/); $foo[5] =~ s/<.*> //; $base[hex($foo[0])] = hex($foo[5]);} for ($i = 0; $i < 0x500; $i += 8) { for ($j = $i; $j < $i + 8; $j++) { printf("0x%04x, ", $base[$j] ? $base[$j] : $j)}; print "\n"; }'
-
} // namespace latinime
diff --git a/native/jni/src/bigram_dictionary.cpp b/native/jni/src/bigram_dictionary.cpp
index 8057e410a..4f5493ad1 100644
--- a/native/jni/src/bigram_dictionary.cpp
+++ b/native/jni/src/bigram_dictionary.cpp
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+ *
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include <string.h>
@@ -103,7 +103,7 @@ int BigramDictionary::getBigrams(const int32_t *prevWord, int prevWordLength, in
// TODO: remove unused arguments, and refrain from storing stuff in members of this class
// TODO: have "in" arguments before "out" ones, and make out args explicit in the name
- const uint8_t* const root = DICT;
+ const uint8_t *const root = DICT;
int pos = getBigramListPositionForWord(prevWord, prevWordLength,
false /* forceLowerCaseSearch */);
// getBigramListPositionForWord returns 0 if this word isn't in the dictionary or has no bigrams
@@ -149,7 +149,7 @@ int BigramDictionary::getBigrams(const int32_t *prevWord, int prevWordLength, in
int BigramDictionary::getBigramListPositionForWord(const int32_t *prevWord,
const int prevWordLength, const bool forceLowerCaseSearch) const {
if (0 >= prevWordLength) return 0;
- const uint8_t* const root = DICT;
+ const uint8_t *const root = DICT;
int pos = BinaryFormat::getTerminalPosition(root, prevWord, prevWordLength,
forceLowerCaseSearch);
@@ -170,7 +170,7 @@ int BigramDictionary::getBigramListPositionForWord(const int32_t *prevWord,
void BigramDictionary::fillBigramAddressToFrequencyMapAndFilter(const int32_t *prevWord,
const int prevWordLength, std::map<int, int> *map, uint8_t *filter) const {
memset(filter, 0, BIGRAM_FILTER_BYTE_SIZE);
- const uint8_t* const root = DICT;
+ const uint8_t *const root = DICT;
int pos = getBigramListPositionForWord(prevWord, prevWordLength,
false /* forceLowerCaseSearch */);
if (0 == pos) {
@@ -209,7 +209,7 @@ bool BigramDictionary::checkFirstCharacter(unsigned short *word, int *inputCodes
bool BigramDictionary::isValidBigram(const int32_t *word1, int length1, const int32_t *word2,
int length2) const {
- const uint8_t* const root = DICT;
+ const uint8_t *const root = DICT;
int pos = getBigramListPositionForWord(word1, length1, false /* forceLowerCaseSearch */);
// getBigramListPositionForWord returns 0 if this word isn't in the dictionary or has no bigrams
if (0 == pos) return false;
diff --git a/native/jni/src/bigram_dictionary.h b/native/jni/src/bigram_dictionary.h
index 0b3577ad8..f66e27b8a 100644
--- a/native/jni/src/bigram_dictionary.h
+++ b/native/jni/src/bigram_dictionary.h
@@ -53,7 +53,5 @@ class BigramDictionary {
// TODO: Re-implement proximity correction for bigram correction
static const int MAX_ALTERNATIVES = 1;
};
-
} // namespace latinime
-
#endif // LATINIME_BIGRAM_DICTIONARY_H
diff --git a/native/jni/src/binary_format.h b/native/jni/src/binary_format.h
index 474c854fe..4155ef401 100644
--- a/native/jni/src/binary_format.h
+++ b/native/jni/src/binary_format.h
@@ -46,29 +46,29 @@ class BinaryFormat {
const static int CHARACTER_ARRAY_TERMINATOR_SIZE = 1;
const static int SHORTCUT_LIST_SIZE_SIZE = 2;
- static int detectFormat(const uint8_t* const dict);
- static unsigned int getHeaderSize(const uint8_t* const dict);
- static unsigned int getFlags(const uint8_t* const dict);
- static int getGroupCountAndForwardPointer(const uint8_t* const dict, int* pos);
- static uint8_t getFlagsAndForwardPointer(const uint8_t* const dict, int* pos);
- static int32_t getCharCodeAndForwardPointer(const uint8_t* const dict, int* pos);
- static int readFrequencyWithoutMovingPointer(const uint8_t* const dict, const int pos);
- static int skipOtherCharacters(const uint8_t* const dict, const int pos);
+ static int detectFormat(const uint8_t *const dict);
+ static unsigned int getHeaderSize(const uint8_t *const dict);
+ static unsigned int getFlags(const uint8_t *const dict);
+ static int getGroupCountAndForwardPointer(const uint8_t *const dict, int *pos);
+ static uint8_t getFlagsAndForwardPointer(const uint8_t *const dict, int *pos);
+ static int32_t getCharCodeAndForwardPointer(const uint8_t *const dict, int *pos);
+ static int readFrequencyWithoutMovingPointer(const uint8_t *const dict, const int pos);
+ static int skipOtherCharacters(const uint8_t *const dict, const int pos);
static int skipChildrenPosition(const uint8_t flags, const int pos);
static int skipFrequency(const uint8_t flags, const int pos);
- static int skipShortcuts(const uint8_t* const dict, const uint8_t flags, const int pos);
- static int skipBigrams(const uint8_t* const dict, const uint8_t flags, const int pos);
- static int skipAllAttributes(const uint8_t* const dict, const uint8_t flags, const int pos);
- static int skipChildrenPosAndAttributes(const uint8_t* const dict, const uint8_t flags,
+ static int skipShortcuts(const uint8_t *const dict, const uint8_t flags, const int pos);
+ static int skipBigrams(const uint8_t *const dict, const uint8_t flags, const int pos);
+ static int skipAllAttributes(const uint8_t *const dict, const uint8_t flags, const int pos);
+ static int skipChildrenPosAndAttributes(const uint8_t *const dict, const uint8_t flags,
const int pos);
- static int readChildrenPosition(const uint8_t* const dict, const uint8_t flags, const int pos);
+ static int readChildrenPosition(const uint8_t *const dict, const uint8_t flags, const int pos);
static bool hasChildrenInFlags(const uint8_t flags);
- static int getAttributeAddressAndForwardPointer(const uint8_t* const dict, const uint8_t flags,
+ static int getAttributeAddressAndForwardPointer(const uint8_t *const dict, const uint8_t flags,
int *pos);
- static int getTerminalPosition(const uint8_t* const root, const int32_t* const inWord,
+ static int getTerminalPosition(const uint8_t *const root, const int32_t *const inWord,
const int length, const bool forceLowerCaseSearch);
- static int getWordAtAddress(const uint8_t* const root, const int address, const int maxDepth,
- uint16_t* outWord, int* outUnigramFrequency);
+ static int getWordAtAddress(const uint8_t *const root, const int address, const int maxDepth,
+ uint16_t *outWord, int *outUnigramFrequency);
static int computeFrequencyForBigram(const int unigramFreq, const int bigramFreq);
static int getProbability(const int position, const std::map<int, int> *bigramMap,
const uint8_t *bigramFilter, const int unigramFreq);
@@ -83,7 +83,7 @@ class BinaryFormat {
const static unsigned int NO_FLAGS = 0;
};
-inline int BinaryFormat::detectFormat(const uint8_t* const dict) {
+inline int BinaryFormat::detectFormat(const uint8_t *const dict) {
// The magic number is stored big-endian.
const uint32_t magicNumber = (dict[0] << 24) + (dict[1] << 16) + (dict[2] << 8) + dict[3];
switch (magicNumber) {
@@ -105,7 +105,7 @@ inline int BinaryFormat::detectFormat(const uint8_t* const dict) {
}
}
-inline unsigned int BinaryFormat::getFlags(const uint8_t* const dict) {
+inline unsigned int BinaryFormat::getFlags(const uint8_t *const dict) {
switch (detectFormat(dict)) {
case 1:
return NO_FLAGS;
@@ -114,7 +114,7 @@ inline unsigned int BinaryFormat::getFlags(const uint8_t* const dict) {
}
}
-inline unsigned int BinaryFormat::getHeaderSize(const uint8_t* const dict) {
+inline unsigned int BinaryFormat::getHeaderSize(const uint8_t *const dict) {
switch (detectFormat(dict)) {
case 1:
return FORMAT_VERSION_1_HEADER_SIZE;
@@ -126,17 +126,17 @@ inline unsigned int BinaryFormat::getHeaderSize(const uint8_t* const dict) {
}
}
-inline int BinaryFormat::getGroupCountAndForwardPointer(const uint8_t* const dict, int* pos) {
+inline int BinaryFormat::getGroupCountAndForwardPointer(const uint8_t *const dict, int *pos) {
const int msb = dict[(*pos)++];
if (msb < 0x80) return msb;
return ((msb & 0x7F) << 8) | dict[(*pos)++];
}
-inline uint8_t BinaryFormat::getFlagsAndForwardPointer(const uint8_t* const dict, int* pos) {
+inline uint8_t BinaryFormat::getFlagsAndForwardPointer(const uint8_t *const dict, int *pos) {
return dict[(*pos)++];
}
-inline int32_t BinaryFormat::getCharCodeAndForwardPointer(const uint8_t* const dict, int* pos) {
+inline int32_t BinaryFormat::getCharCodeAndForwardPointer(const uint8_t *const dict, int *pos) {
const int origin = *pos;
const int32_t character = dict[origin];
if (character < MINIMAL_ONE_BYTE_CHARACTER_VALUE) {
@@ -155,12 +155,12 @@ inline int32_t BinaryFormat::getCharCodeAndForwardPointer(const uint8_t* const d
}
}
-inline int BinaryFormat::readFrequencyWithoutMovingPointer(const uint8_t* const dict,
+inline int BinaryFormat::readFrequencyWithoutMovingPointer(const uint8_t *const dict,
const int pos) {
return dict[pos];
}
-inline int BinaryFormat::skipOtherCharacters(const uint8_t* const dict, const int pos) {
+inline int BinaryFormat::skipOtherCharacters(const uint8_t *const dict, const int pos) {
int currentPos = pos;
int32_t character = dict[currentPos++];
while (CHARACTER_ARRAY_TERMINATOR != character) {
@@ -186,7 +186,7 @@ static inline int attributeAddressSize(const uint8_t flags) {
*/
}
-static inline int skipExistingBigrams(const uint8_t* const dict, const int pos) {
+static inline int skipExistingBigrams(const uint8_t *const dict, const int pos) {
int currentPos = pos;
uint8_t flags = BinaryFormat::getFlagsAndForwardPointer(dict, &currentPos);
while (flags & UnigramDictionary::FLAG_ATTRIBUTE_HAS_NEXT) {
@@ -203,7 +203,7 @@ static inline int childrenAddressSize(const uint8_t flags) {
/* See the note in attributeAddressSize. The same applies here */
}
-static inline int shortcutByteSize(const uint8_t* const dict, const int pos) {
+static inline int shortcutByteSize(const uint8_t *const dict, const int pos) {
return ((int)(dict[pos] << 8)) + (dict[pos + 1]);
}
@@ -215,7 +215,7 @@ inline int BinaryFormat::skipFrequency(const uint8_t flags, const int pos) {
return UnigramDictionary::FLAG_IS_TERMINAL & flags ? pos + 1 : pos;
}
-inline int BinaryFormat::skipShortcuts(const uint8_t* const dict, const uint8_t flags,
+inline int BinaryFormat::skipShortcuts(const uint8_t *const dict, const uint8_t flags,
const int pos) {
if (UnigramDictionary::FLAG_HAS_SHORTCUT_TARGETS & flags) {
return pos + shortcutByteSize(dict, pos);
@@ -224,7 +224,7 @@ inline int BinaryFormat::skipShortcuts(const uint8_t* const dict, const uint8_t
}
}
-inline int BinaryFormat::skipBigrams(const uint8_t* const dict, const uint8_t flags,
+inline int BinaryFormat::skipBigrams(const uint8_t *const dict, const uint8_t flags,
const int pos) {
if (UnigramDictionary::FLAG_HAS_BIGRAMS & flags) {
return skipExistingBigrams(dict, pos);
@@ -233,7 +233,7 @@ inline int BinaryFormat::skipBigrams(const uint8_t* const dict, const uint8_t fl
}
}
-inline int BinaryFormat::skipAllAttributes(const uint8_t* const dict, const uint8_t flags,
+inline int BinaryFormat::skipAllAttributes(const uint8_t *const dict, const uint8_t flags,
const int pos) {
// This function skips all attributes: shortcuts and bigrams.
int newPos = pos;
@@ -242,7 +242,7 @@ inline int BinaryFormat::skipAllAttributes(const uint8_t* const dict, const uint
return newPos;
}
-inline int BinaryFormat::skipChildrenPosAndAttributes(const uint8_t* const dict,
+inline int BinaryFormat::skipChildrenPosAndAttributes(const uint8_t *const dict,
const uint8_t flags, const int pos) {
int currentPos = pos;
currentPos = skipChildrenPosition(flags, currentPos);
@@ -250,7 +250,7 @@ inline int BinaryFormat::skipChildrenPosAndAttributes(const uint8_t* const dict,
return currentPos;
}
-inline int BinaryFormat::readChildrenPosition(const uint8_t* const dict, const uint8_t flags,
+inline int BinaryFormat::readChildrenPosition(const uint8_t *const dict, const uint8_t flags,
const int pos) {
int offset = 0;
switch (UnigramDictionary::MASK_GROUP_ADDRESS_TYPE & flags) {
@@ -279,7 +279,7 @@ inline bool BinaryFormat::hasChildrenInFlags(const uint8_t flags) {
!= (UnigramDictionary::MASK_GROUP_ADDRESS_TYPE & flags));
}
-inline int BinaryFormat::getAttributeAddressAndForwardPointer(const uint8_t* const dict,
+inline int BinaryFormat::getAttributeAddressAndForwardPointer(const uint8_t *const dict,
const uint8_t flags, int *pos) {
int offset = 0;
const int origin = *pos;
@@ -309,8 +309,8 @@ inline int BinaryFormat::getAttributeAddressAndForwardPointer(const uint8_t* con
// This function gets the byte position of the last chargroup of the exact matching word in the
// dictionary. If no match is found, it returns NOT_VALID_WORD.
-inline int BinaryFormat::getTerminalPosition(const uint8_t* const root,
- const int32_t* const inWord, const int length, const bool forceLowerCaseSearch) {
+inline int BinaryFormat::getTerminalPosition(const uint8_t *const root,
+ const int32_t *const inWord, const int length, const bool forceLowerCaseSearch) {
int pos = 0;
int wordPos = 0;
@@ -396,8 +396,8 @@ inline int BinaryFormat::getTerminalPosition(const uint8_t* const root,
* outUnigramFrequency: a pointer to an int to write the frequency into.
* Return value : the length of the word, of 0 if the word was not found.
*/
-inline int BinaryFormat::getWordAtAddress(const uint8_t* const root, const int address,
- const int maxDepth, uint16_t* outWord, int* outUnigramFrequency) {
+inline int BinaryFormat::getWordAtAddress(const uint8_t *const root, const int address,
+ const int maxDepth, uint16_t *outWord, int *outUnigramFrequency) {
int pos = 0;
int wordPos = 0;
@@ -557,7 +557,5 @@ inline int BinaryFormat::getProbability(const int position, const std::map<int,
return backoff(unigramFreq);
}
}
-
} // namespace latinime
-
#endif // LATINIME_BINARY_FORMAT_H
diff --git a/native/jni/src/bloom_filter.h b/native/jni/src/bloom_filter.h
index 7ae6a1fa4..47177dcba 100644
--- a/native/jni/src/bloom_filter.h
+++ b/native/jni/src/bloom_filter.h
@@ -32,7 +32,5 @@ static inline bool isInFilter(const uint8_t *filter, const int position) {
const unsigned int bucket = position % BIGRAM_FILTER_MODULO;
return filter[bucket >> 3] & (1 << (bucket & 0x7));
}
-
} // namespace latinime
-
#endif // LATINIME_BLOOM_FILTER_H
diff --git a/native/jni/src/char_utils.cpp b/native/jni/src/char_utils.cpp
index a31a0632c..9d2bc85b3 100644
--- a/native/jni/src/char_utils.cpp
+++ b/native/jni/src/char_utils.cpp
@@ -895,5 +895,4 @@ unsigned short latin_tolower(unsigned short c) {
compare_pair_capital);
return p ? p->small : c;
}
-
} // namespace latinime
diff --git a/native/jni/src/char_utils.h b/native/jni/src/char_utils.h
index 21dca9a0a..edd96bbb0 100644
--- a/native/jni/src/char_utils.h
+++ b/native/jni/src/char_utils.h
@@ -62,7 +62,5 @@ inline static unsigned short toLowerCase(const unsigned short c) {
inline static unsigned short toBaseLowerCase(const unsigned short c) {
return toLowerCase(toBaseChar(c));
}
-
} // namespace latinime
-
#endif // LATINIME_CHAR_UTILS_H
diff --git a/native/jni/src/correction.cpp b/native/jni/src/correction.cpp
index 827067b9f..74e256fe5 100644
--- a/native/jni/src/correction.cpp
+++ b/native/jni/src/correction.cpp
@@ -633,7 +633,7 @@ Correction::CorrectionType Correction::processCharAndCalcState(
Correction::~Correction() {
}
-inline static int getQuoteCount(const unsigned short* word, const int length) {
+inline static int getQuoteCount(const unsigned short *word, const int length) {
int quoteCount = 0;
for (int i = 0; i < length; ++i) {
if(word[i] == '\'') {
@@ -653,7 +653,7 @@ inline static bool isUpperCase(unsigned short c) {
/* static */
int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex,
- const int outputIndex, const int freq, int* editDistanceTable, const Correction* correction,
+ const int outputIndex, const int freq, int *editDistanceTable, const Correction *correction,
const int inputLength) {
const int excessivePos = correction->getExcessivePos();
const int typedLetterMultiplier = correction->TYPED_LETTER_MULTIPLIER;
@@ -677,7 +677,7 @@ int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex
// TODO: use mExcessiveCount
const int matchCount = inputLength - correction->mProximityCount - excessiveCount;
- const unsigned short* word = correction->mWord;
+ const unsigned short *word = correction->mWord;
const bool skipped = skippedCount > 0;
const int quoteDiffCount = max(0, getQuoteCount(word, outputLength)
@@ -916,7 +916,7 @@ int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex
/* static */
int Correction::RankingAlgorithm::calcFreqForSplitMultipleWords(
const int *freqArray, const int *wordLengthArray, const int wordCount,
- const Correction* correction, const bool isSpaceProximity, const unsigned short *word) {
+ const Correction *correction, const bool isSpaceProximity, const unsigned short *word) {
const int typedLetterMultiplier = correction->TYPED_LETTER_MULTIPLIER;
bool firstCapitalizedWordDemotion = false;
@@ -1046,10 +1046,10 @@ int Correction::RankingAlgorithm::calcFreqForSplitMultipleWords(
/* Damerau-Levenshtein distance */
inline static int editDistanceInternal(
- int* editDistanceTable, const unsigned short* before,
- const int beforeLength, const unsigned short* after, const int afterLength) {
+ int *editDistanceTable, const unsigned short *before,
+ const int beforeLength, const unsigned short *after, const int afterLength) {
// dp[li][lo] dp[a][b] = dp[ a * lo + b]
- int* dp = editDistanceTable;
+ int *dp = editDistanceTable;
const int li = beforeLength + 1;
const int lo = afterLength + 1;
for (int i = 0; i < li; ++i) {
@@ -1085,8 +1085,8 @@ inline static int editDistanceInternal(
return dp[li * lo - 1];
}
-int Correction::RankingAlgorithm::editDistance(const unsigned short* before,
- const int beforeLength, const unsigned short* after, const int afterLength) {
+int Correction::RankingAlgorithm::editDistance(const unsigned short *before,
+ const int beforeLength, const unsigned short *after, const int afterLength) {
int table[(beforeLength + 1) * (afterLength + 1)];
return editDistanceInternal(table, before, beforeLength, after, afterLength);
}
@@ -1114,8 +1114,8 @@ int Correction::RankingAlgorithm::editDistance(const unsigned short* before,
// So, we can normalize original score by dividing pow(2, min(b.l(),a.l())) * 255 * 2.
/* static */
-float Correction::RankingAlgorithm::calcNormalizedScore(const unsigned short* before,
- const int beforeLength, const unsigned short* after, const int afterLength,
+float Correction::RankingAlgorithm::calcNormalizedScore(const unsigned short *before,
+ const int beforeLength, const unsigned short *after, const int afterLength,
const int score) {
if (0 == beforeLength || 0 == afterLength) {
return 0;
diff --git a/native/jni/src/correction.h b/native/jni/src/correction.h
index ae7b3a5f8..13f951af5 100644
--- a/native/jni/src/correction.h
+++ b/native/jni/src/correction.h
@@ -138,9 +138,9 @@ class Correction {
int getFreqForSplitMultipleWords(
const int *freqArray, const int *wordLengthArray, const int wordCount,
const bool isSpaceProximity, const unsigned short *word);
- int getFinalProbability(const int probability, unsigned short **word, int* wordLength);
+ int getFinalProbability(const int probability, unsigned short **word, int *wordLength);
int getFinalProbabilityForSubQueue(const int probability, unsigned short **word,
- int* wordLength, const int inputLength);
+ int *wordLength, const int inputLength);
CorrectionType processCharAndCalcState(const int32_t c, const bool isTerminal);
@@ -163,15 +163,15 @@ class Correction {
class RankingAlgorithm {
public:
static int calculateFinalProbability(const int inputIndex, const int depth,
- const int probability, int *editDistanceTable, const Correction* correction,
+ const int probability, int *editDistanceTable, const Correction *correction,
const int inputLength);
static int calcFreqForSplitMultipleWords(const int *freqArray, const int *wordLengthArray,
- const int wordCount, const Correction* correction, const bool isSpaceProximity,
+ const int wordCount, const Correction *correction, const bool isSpaceProximity,
const unsigned short *word);
- static float calcNormalizedScore(const unsigned short* before, const int beforeLength,
- const unsigned short* after, const int afterLength, const int score);
- static int editDistance(const unsigned short* before,
- const int beforeLength, const unsigned short* after, const int afterLength);
+ static float calcNormalizedScore(const unsigned short *before, const int beforeLength,
+ const unsigned short *after, const int afterLength, const int score);
+ static int editDistance(const unsigned short *before,
+ const int beforeLength, const unsigned short *after, const int afterLength);
private:
static const int CODE_SPACE = ' ';
static const int MAX_INITIAL_SCORE = 255;
@@ -184,7 +184,7 @@ class Correction {
proximityInfo, inputCodes, inputLength, xCoordinates, yCoordinates);
}
- const unsigned short* getPrimaryInputWord() const {
+ const unsigned short *getPrimaryInputWord() const {
return mProximityInfoState.getPrimaryInputWord();
}
@@ -203,7 +203,7 @@ class Correction {
inline CorrectionType processUnrelatedCorrectionType();
inline void addCharToCurrentWord(const int32_t c);
inline int getFinalProbabilityInternal(const int probability, unsigned short **word,
- int* wordLength, const int inputLength);
+ int *wordLength, const int inputLength);
static const int TYPED_LETTER_MULTIPLIER = 2;
static const int FULL_WORD_MULTIPLIER = 2;
diff --git a/native/jni/src/correction_state.h b/native/jni/src/correction_state.h
index 5b2cbd3a2..a63d4aa94 100644
--- a/native/jni/src/correction_state.h
+++ b/native/jni/src/correction_state.h
@@ -79,6 +79,5 @@ inline static void initCorrectionState(CorrectionState *state, const int rootPos
state->mSkipping = false;
state->mAdditionalProximityMatching = false;
}
-
} // namespace latinime
#endif // LATINIME_CORRECTION_STATE_H
diff --git a/native/jni/src/debug.h b/native/jni/src/debug.h
index 376ba59d9..2fee6e83f 100644
--- a/native/jni/src/debug.h
+++ b/native/jni/src/debug.h
@@ -1,26 +1,26 @@
/*
-**
-** Copyright 2011, 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.
-*/
+ *
+ * Copyright 2011, 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_DEBUG_H
#define LATINIME_DEBUG_H
#include "defines.h"
-static inline unsigned char* convertToUnibyteString(unsigned short* input, unsigned char* output,
+static inline unsigned char *convertToUnibyteString(unsigned short *input, unsigned char *output,
const unsigned int length) {
unsigned int i = 0;
for (; i <= length && input[i] != 0; ++i)
@@ -29,8 +29,8 @@ static inline unsigned char* convertToUnibyteString(unsigned short* input, unsig
return output;
}
-static inline unsigned char* convertToUnibyteStringAndReplaceLastChar(unsigned short* input,
- unsigned char* output, const unsigned int length, unsigned char c) {
+static inline unsigned char *convertToUnibyteStringAndReplaceLastChar(unsigned short *input,
+ unsigned char *output, const unsigned int length, unsigned char c) {
unsigned int i = 0;
for (; i <= length && input[i] != 0; ++i)
output[i] = input[i] & 0xFF;
@@ -39,7 +39,7 @@ static inline unsigned char* convertToUnibyteStringAndReplaceLastChar(unsigned s
return output;
}
-static inline void LOGI_S16(unsigned short* string, const unsigned int length) {
+static inline void LOGI_S16(unsigned short *string, const unsigned int length) {
unsigned char tmp_buffer[length];
convertToUnibyteString(string, tmp_buffer, length);
AKLOGI(">> %s", tmp_buffer);
@@ -49,7 +49,7 @@ static inline void LOGI_S16(unsigned short* string, const unsigned int length) {
// usleep(10);
}
-static inline void LOGI_S16_PLUS(unsigned short* string, const unsigned int length,
+static inline void LOGI_S16_PLUS(unsigned short *string, const unsigned int length,
unsigned char c) {
unsigned char tmp_buffer[length+1];
convertToUnibyteStringAndReplaceLastChar(string, tmp_buffer, length, c);
@@ -58,7 +58,7 @@ static inline void LOGI_S16_PLUS(unsigned short* string, const unsigned int leng
// usleep(10);
}
-static inline void printDebug(const char* tag, int* codes, int codesSize, int MAX_PROXIMITY_CHARS) {
+static inline void printDebug(const char *tag, int *codes, int codesSize, int MAX_PROXIMITY_CHARS) {
unsigned char *buf = (unsigned char*)malloc((1 + codesSize) * sizeof(*buf));
buf[codesSize] = 0;
@@ -68,5 +68,4 @@ static inline void printDebug(const char* tag, int* codes, int codesSize, int MA
free(buf);
}
-
#endif // LATINIME_DEBUG_H
diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h
index c7d3bf313..a4086f58d 100644
--- a/native/jni/src/defines.h
+++ b/native/jni/src/defines.h
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+ *
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef LATINIME_DEFINES_H
#define LATINIME_DEFINES_H
@@ -26,7 +26,7 @@
#define DUMP_WORD(word, length) do { dumpWord(word, length); } while(0)
#define DUMP_WORD_INT(word, length) do { dumpWordInt(word, length); } while(0)
-static inline void dumpWord(const unsigned short* word, const int length) {
+static inline void dumpWord(const unsigned short *word, const int length) {
static char charBuf[50];
for (int i = 0; i < length; ++i) {
@@ -36,7 +36,7 @@ static inline void dumpWord(const unsigned short* word, const int length) {
AKLOGI("[ %s ]", charBuf);
}
-static inline void dumpWordInt(const int* word, const int length) {
+static inline void dumpWordInt(const int *word, const int length) {
static char charBuf[50];
for (int i = 0; i < length; ++i) {
@@ -313,5 +313,4 @@ typedef enum {
// Additional proximity char which can differ by language.
ADDITIONAL_PROXIMITY_CHAR
} ProximityType;
-
#endif // LATINIME_DEFINES_H
diff --git a/native/jni/src/dictionary.cpp b/native/jni/src/dictionary.cpp
index f3166e75a..4703a38e8 100644
--- a/native/jni/src/dictionary.cpp
+++ b/native/jni/src/dictionary.cpp
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 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.
-*/
+ *
+ * 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.
+ */
#include <stdio.h>
@@ -63,5 +63,4 @@ bool Dictionary::isValidBigram(const int32_t *word1, int length1, const int32_t
int length2) const {
return mBigramDictionary->isValidBigram(word1, length1, word2, length2);
}
-
} // namespace latinime
diff --git a/native/jni/src/dictionary.h b/native/jni/src/dictionary.h
index 7911403dc..f625813a6 100644
--- a/native/jni/src/dictionary.h
+++ b/native/jni/src/dictionary.h
@@ -113,5 +113,4 @@ inline int Dictionary::wideStrLen(unsigned short *str) {
return end - str;
}
} // namespace latinime
-
#endif // LATINIME_DICTIONARY_H
diff --git a/native/jni/src/proximity_info.cpp b/native/jni/src/proximity_info.cpp
index a4a641160..393791f97 100644
--- a/native/jni/src/proximity_info.cpp
+++ b/native/jni/src/proximity_info.cpp
@@ -110,7 +110,7 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const {
if (DEBUG_PROXIMITY_INFO) {
AKLOGI("hasSpaceProximity: index %d, %d, %d", startIndex, x, y);
}
- int32_t* proximityCharsArray = mProximityCharsArray;
+ int32_t *proximityCharsArray = mProximityCharsArray;
for (int i = 0; i < MAX_PROXIMITY_CHARS_SIZE; ++i) {
if (DEBUG_PROXIMITY_INFO) {
AKLOGI("Index: %d", mProximityCharsArray[startIndex + i]);
@@ -171,7 +171,7 @@ void ProximityInfo::calculateNearbyKeyCodes(
return;
}
- const int32_t* additionalProximityChars =
+ const int32_t *additionalProximityChars =
AdditionalProximityChars::getAdditionalChars(&mLocaleStr, primaryKey);
for (int j = 0; j < additionalProximitySize; ++j) {
const int32_t ac = additionalProximityChars[j];
diff --git a/native/jni/src/proximity_info.h b/native/jni/src/proximity_info.h
index d58935c6b..abd07dd3e 100644
--- a/native/jni/src/proximity_info.h
+++ b/native/jni/src/proximity_info.h
@@ -141,7 +141,5 @@ class ProximityInfo {
int mCodeToKeyIndex[MAX_CHAR_CODE + 1];
// TODO: move to correction.h
};
-
} // namespace latinime
-
#endif // LATINIME_PROXIMITY_INFO_H
diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp
index 149299eb6..d481a3bc7 100644
--- a/native/jni/src/proximity_info_state.cpp
+++ b/native/jni/src/proximity_info_state.cpp
@@ -28,8 +28,8 @@
namespace latinime {
void ProximityInfoState::initInputParams(
- const ProximityInfo* proximityInfo, const int32_t* inputCodes, const int inputLength,
- const int* xCoordinates, const int* yCoordinates) {
+ const ProximityInfo *proximityInfo, const int32_t *inputCodes, const int inputLength,
+ const int *xCoordinates, const int *yCoordinates) {
mProximityInfo = proximityInfo;
mHasTouchPositionCorrectionData = proximityInfo->hasTouchPositionCorrectionData();
mMostCommonKeyWidthSquare = proximityInfo->getMostCommonKeyWidthSquare();
diff --git a/native/jni/src/proximity_info_state.h b/native/jni/src/proximity_info_state.h
index 717871c90..a5fe528c1 100644
--- a/native/jni/src/proximity_info_state.h
+++ b/native/jni/src/proximity_info_state.h
@@ -43,14 +43,14 @@ class ProximityInfoState {
// Defined in proximity_info_state.cpp //
/////////////////////////////////////////
void initInputParams(
- const ProximityInfo* proximityInfo, const int32_t* inputCodes, const int inputLength,
- const int* xCoordinates, const int* yCoordinates);
+ const ProximityInfo *proximityInfo, const int32_t *inputCodes, const int inputLength,
+ const int *xCoordinates, const int *yCoordinates);
/////////////////////////////////////////
// Defined here //
/////////////////////////////////////////
ProximityInfoState() {};
- inline const int* getProximityCharsAt(const int index) const {
+ inline const int *getProximityCharsAt(const int index) const {
return mInputCodes + (index * MAX_PROXIMITY_CHARS_SIZE_INTERNAL);
}
@@ -154,7 +154,7 @@ class ProximityInfoState {
inputIndex * MAX_PROXIMITY_CHARS_SIZE_INTERNAL + proximityIndex];
}
- inline const unsigned short* getPrimaryInputWord() const {
+ inline const unsigned short *getPrimaryInputWord() const {
return mPrimaryInputWord;
}
@@ -215,7 +215,5 @@ class ProximityInfoState {
int mInputLength;
unsigned short mPrimaryInputWord[MAX_WORD_LENGTH_INTERNAL];
};
-
} // namespace latinime
-
#endif // LATINIME_PROXIMITY_INFO_STATE_H
diff --git a/native/jni/src/terminal_attributes.h b/native/jni/src/terminal_attributes.h
index c712f502d..755635fba 100644
--- a/native/jni/src/terminal_attributes.h
+++ b/native/jni/src/terminal_attributes.h
@@ -29,12 +29,12 @@ namespace latinime {
class TerminalAttributes {
public:
class ShortcutIterator {
- const uint8_t* const mDict;
+ const uint8_t *const mDict;
bool mHasNextShortcutTarget;
int mPos;
public:
- ShortcutIterator(const uint8_t* dict, const int pos, const uint8_t flags) : mDict(dict),
+ ShortcutIterator(const uint8_t *dict, const int pos, const uint8_t flags) : mDict(dict),
mPos(pos) {
mHasNextShortcutTarget = (0 != (flags & UnigramDictionary::FLAG_HAS_SHORTCUT_TARGETS));
}
@@ -46,7 +46,7 @@ class TerminalAttributes {
// Gets the shortcut target itself as a uint16_t string. For parameters and return value
// see BinaryFormat::getWordAtAddress.
// TODO: make the output an uint32_t* to handle the whole unicode range.
- inline int getNextShortcutTarget(const int maxDepth, uint16_t* outWord) {
+ inline int getNextShortcutTarget(const int maxDepth, uint16_t *outWord) {
const int shortcutFlags = BinaryFormat::getFlagsAndForwardPointer(mDict, &mPos);
mHasNextShortcutTarget =
0 != (shortcutFlags & UnigramDictionary::FLAG_ATTRIBUTE_HAS_NEXT);
@@ -63,12 +63,12 @@ class TerminalAttributes {
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(TerminalAttributes);
- const uint8_t* const mDict;
+ const uint8_t *const mDict;
const uint8_t mFlags;
const int mStartPos;
public:
- TerminalAttributes(const uint8_t* const dict, const uint8_t flags, const int pos) :
+ TerminalAttributes(const uint8_t *const dict, const uint8_t flags, const int pos) :
mDict(dict), mFlags(flags), mStartPos(pos) {
}
@@ -79,5 +79,4 @@ class TerminalAttributes {
}
};
} // namespace latinime
-
#endif // LATINIME_TERMINAL_ATTRIBUTES_H
diff --git a/native/jni/src/unigram_dictionary.cpp b/native/jni/src/unigram_dictionary.cpp
index 0ffb3eb63..b121d08a8 100644
--- a/native/jni/src/unigram_dictionary.cpp
+++ b/native/jni/src/unigram_dictionary.cpp
@@ -1,19 +1,19 @@
/*
-**
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
+ *
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include <assert.h>
#include <string.h>
@@ -40,7 +40,7 @@ const UnigramDictionary::digraph_t UnigramDictionary::FRENCH_LIGATURES_DIGRAPHS[
{ 'o', 'e', 0x0153 } }; // U+0153 : LATIN SMALL LIGATURE OE
// TODO: check the header
-UnigramDictionary::UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultiplier,
+UnigramDictionary::UnigramDictionary(const uint8_t *const streamStart, int typedLetterMultiplier,
int fullWordMultiplier, int maxWordLength, int maxWords, const unsigned int flags)
: DICT_ROOT(streamStart), MAX_WORD_LENGTH(maxWordLength), MAX_WORDS(maxWords),
TYPED_LETTER_MULTIPLIER(typedLetterMultiplier), FULL_WORD_MULTIPLIER(fullWordMultiplier),
@@ -68,7 +68,7 @@ static inline void addWord(
// Return the replacement code point for a digraph, or 0 if none.
int UnigramDictionary::getDigraphReplacement(const int *codes, const int i, const int codesSize,
- const digraph_t* const digraphs, const unsigned int digraphsSize) const {
+ const digraph_t *const digraphs, const unsigned int digraphsSize) const {
// There can't be a digraph if we don't have at least 2 characters to examine
if (i + 2 > codesSize) return false;
@@ -103,7 +103,7 @@ void UnigramDictionary::getWordWithDigraphSuggestionsRec(ProximityInfo *proximit
const bool useFullEditDistance, const int *codesSrc,
const int codesRemain, const int currentDepth, int *codesDest, Correction *correction,
WordsPriorityQueuePool *queuePool,
- const digraph_t* const digraphs, const unsigned int digraphsSize) const {
+ const digraph_t *const digraphs, const unsigned int digraphsSize) const {
const int startIndex = codesDest - codesBuffer;
if (currentDepth < MAX_DIGRAPH_SEARCH_DEPTH) {
@@ -222,7 +222,7 @@ int UnigramDictionary::getSuggestions(ProximityInfo *proximityInfo,
AKLOGI("Returning %d words", suggestedWordsCount);
/// Print the returned words
for (int j = 0; j < suggestedWordsCount; ++j) {
- short unsigned int* w = outWords + j * MAX_WORD_LENGTH;
+ short unsigned int *w = outWords + j * MAX_WORD_LENGTH;
char s[MAX_WORD_LENGTH];
for (int i = 0; i <= MAX_WORD_LENGTH; i++) s[i] = w[i];
(void)s;
@@ -259,7 +259,7 @@ void UnigramDictionary::getWordSuggestions(ProximityInfo *proximityInfo,
PROF_START(4);
bool hasAutoCorrectionCandidate = false;
- WordsPriorityQueue* masterQueue = queuePool->getMasterQueue();
+ WordsPriorityQueue *masterQueue = queuePool->getMasterQueue();
if (masterQueue->size() > 0) {
float nsForMaster = masterQueue->getHighestNormalizedScore(
correction->getPrimaryInputWord(), inputLength, 0, 0, 0);
@@ -284,11 +284,11 @@ void UnigramDictionary::getWordSuggestions(ProximityInfo *proximityInfo,
if (DEBUG_DICT) {
queuePool->dumpSubQueue1TopSuggestions();
for (int i = 0; i < SUB_QUEUE_MAX_COUNT; ++i) {
- WordsPriorityQueue* queue = queuePool->getSubQueue(FIRST_WORD_INDEX, i);
+ WordsPriorityQueue *queue = queuePool->getSubQueue(FIRST_WORD_INDEX, i);
if (queue->size() > 0) {
- WordsPriorityQueue::SuggestedWord* sw = queue->top();
+ WordsPriorityQueue::SuggestedWord *sw = queue->top();
const int score = sw->mScore;
- const unsigned short* word = sw->mWord;
+ const unsigned short *word = sw->mWord;
const int wordLength = sw->mWordLength;
float ns = Correction::RankingAlgorithm::calcNormalizedScore(
correction->getPrimaryInputWord(), i, word, wordLength, score);
@@ -383,7 +383,7 @@ inline void UnigramDictionary::onTerminal(const int probability,
const bool addToSubQueue = inputIndex < SUB_QUEUE_MAX_COUNT;
int wordLength;
- unsigned short* wordPointer;
+ unsigned short *wordPointer;
if ((currentWordIndex == FIRST_WORD_INDEX) && addToMasterQueue) {
WordsPriorityQueue *masterQueue = queuePool->getMasterQueue();
@@ -430,11 +430,11 @@ inline void UnigramDictionary::onTerminal(const int probability,
int UnigramDictionary::getSubStringSuggestion(
ProximityInfo *proximityInfo, const int *xcoordinates, const int *ycoordinates,
const int *codes, const bool useFullEditDistance, Correction *correction,
- WordsPriorityQueuePool* queuePool, const int inputLength,
+ WordsPriorityQueuePool *queuePool, const int inputLength,
const bool hasAutoCorrectionCandidate, const int currentWordIndex,
const int inputWordStartPos, const int inputWordLength,
const int outputWordStartPos, const bool isSpaceProximity, int *freqArray,
- int*wordLengthArray, unsigned short* outputWord, int *outputWordLength) const {
+ int*wordLengthArray, unsigned short *outputWord, int *outputWordLength) const {
if (inputWordLength > MULTIPLE_WORDS_SUGGESTION_MAX_WORD_LENGTH) {
return FLAG_MULTIPLE_SUGGEST_ABORT;
}
@@ -477,7 +477,7 @@ int UnigramDictionary::getSubStringSuggestion(
// TODO: Remove the safety net above //
//////////////////////////////////////////////
- unsigned short* tempOutputWord = 0;
+ unsigned short *tempOutputWord = 0;
int nextWordLength = 0;
// TODO: Optimize init suggestion
initSuggestions(proximityInfo, xcoordinates, ycoordinates, codes,
@@ -508,7 +508,7 @@ int UnigramDictionary::getSubStringSuggestion(
}
}
}
- WordsPriorityQueue* queue = queuePool->getSubQueue(currentWordIndex, inputWordLength);
+ WordsPriorityQueue *queue = queuePool->getSubQueue(currentWordIndex, inputWordLength);
// TODO: Return the correct value depending on doAutoCompletion
if (!queue || queue->size() <= 0) {
return FLAG_MULTIPLE_SUGGEST_ABORT;
@@ -579,10 +579,10 @@ int UnigramDictionary::getSubStringSuggestion(
void UnigramDictionary::getMultiWordsSuggestionRec(ProximityInfo *proximityInfo,
const int *xcoordinates, const int *ycoordinates, const int *codes,
const bool useFullEditDistance, const int inputLength,
- Correction *correction, WordsPriorityQueuePool* queuePool,
+ Correction *correction, WordsPriorityQueuePool *queuePool,
const bool hasAutoCorrectionCandidate, const int startInputPos, const int startWordIndex,
- const int outputWordLength, int *freqArray, int* wordLengthArray,
- unsigned short* outputWord) const {
+ const int outputWordLength, int *freqArray, int *wordLengthArray,
+ unsigned short *outputWord) const {
if (startWordIndex >= (MULTIPLE_WORDS_SUGGESTION_MAX_WORDS - 1)) {
// Return if the last word index
return;
@@ -660,7 +660,7 @@ void UnigramDictionary::getMultiWordsSuggestionRec(ProximityInfo *proximityInfo,
void UnigramDictionary::getSplitMultipleWordsSuggestions(ProximityInfo *proximityInfo,
const int *xcoordinates, const int *ycoordinates, const int *codes,
const bool useFullEditDistance, const int inputLength,
- Correction *correction, WordsPriorityQueuePool* queuePool,
+ Correction *correction, WordsPriorityQueuePool *queuePool,
const bool hasAutoCorrectionCandidate) const {
if (inputLength >= MAX_WORD_LENGTH) return;
if (DEBUG_DICT) {
@@ -705,9 +705,9 @@ inline int UnigramDictionary::getMostFrequentWordLike(const int startInputIndex,
// In and out parameters may point to the same location. This function takes care
// not to use any input parameters after it wrote into its outputs.
static inline bool testCharGroupForContinuedLikeness(const uint8_t flags,
- const uint8_t* const root, const int startPos,
- const uint16_t* const inWord, const int startInputIndex,
- int32_t* outNewWord, int* outInputIndex, int* outPos) {
+ const uint8_t *const root, const int startPos,
+ const uint16_t *const inWord, const int startInputIndex,
+ int32_t *outNewWord, int *outInputIndex, int *outPos) {
const bool hasMultipleChars = (0 != (UnigramDictionary::FLAG_HAS_MULTIPLE_CHARS & flags));
int pos = startPos;
int32_t character = BinaryFormat::getCharCodeAndForwardPointer(root, &pos);
@@ -743,8 +743,8 @@ static inline bool testCharGroupForContinuedLikeness(const uint8_t flags,
// It will compare the frequency to the max frequency, and if greater, will
// copy the word into the output buffer. In output value maxFreq, it will
// write the new maximum frequency if it changed.
-static inline void onTerminalWordLike(const int freq, int32_t* newWord, const int length,
- short unsigned int* outWord, int* maxFreq) {
+static inline void onTerminalWordLike(const int freq, int32_t *newWord, const int length,
+ short unsigned int *outWord, int *maxFreq) {
if (freq > *maxFreq) {
for (int q = 0; q < length; ++q)
outWord[q] = newWord[q];
@@ -755,12 +755,12 @@ static inline void onTerminalWordLike(const int freq, int32_t* newWord, const in
// Will find the highest frequency of the words like the one passed as an argument,
// that is, everything that only differs by case/accents.
-int UnigramDictionary::getMostFrequentWordLikeInner(const uint16_t * const inWord,
- const int length, short unsigned int* outWord) const {
+int UnigramDictionary::getMostFrequentWordLikeInner(const uint16_t *const inWord,
+ const int length, short unsigned int *outWord) const {
int32_t newWord[MAX_WORD_LENGTH_INTERNAL];
int depth = 0;
int maxFreq = -1;
- const uint8_t* const root = DICT_ROOT;
+ const uint8_t *const root = DICT_ROOT;
int stackChildCount[MAX_WORD_LENGTH_INTERNAL];
int stackInputIndex[MAX_WORD_LENGTH_INTERNAL];
int stackSiblingPos[MAX_WORD_LENGTH_INTERNAL];
@@ -816,8 +816,8 @@ int UnigramDictionary::getMostFrequentWordLikeInner(const uint16_t * const inWor
return maxFreq;
}
-int UnigramDictionary::getFrequency(const int32_t* const inWord, const int length) const {
- const uint8_t* const root = DICT_ROOT;
+int UnigramDictionary::getFrequency(const int32_t *const inWord, const int length) const {
+ const uint8_t *const root = DICT_ROOT;
int pos = BinaryFormat::getTerminalPosition(root, inWord, length,
false /* forceLowerCaseSearch */);
if (NOT_VALID_WORD == pos) {
@@ -991,5 +991,4 @@ inline bool UnigramDictionary::processCurrentNode(const int initialPos,
*newChildrenPosition = childrenPos;
return true;
}
-
} // namespace latinime
diff --git a/native/jni/src/unigram_dictionary.h b/native/jni/src/unigram_dictionary.h
index ac14fc0bc..f6aef2bfd 100644
--- a/native/jni/src/unigram_dictionary.h
+++ b/native/jni/src/unigram_dictionary.h
@@ -73,9 +73,9 @@ class UnigramDictionary {
static const int FLAG_MULTIPLE_SUGGEST_ABORT = 0;
static const int FLAG_MULTIPLE_SUGGEST_SKIP = 1;
static const int FLAG_MULTIPLE_SUGGEST_CONTINUE = 2;
- UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultipler,
+ UnigramDictionary(const uint8_t *const streamStart, int typedLetterMultipler,
int fullWordMultiplier, int maxWordLength, int maxWords, const unsigned int flags);
- int getFrequency(const int32_t* const inWord, const int length) const;
+ int getFrequency(const int32_t *const inWord, const int length) const;
int getBigramPosition(int pos, unsigned short *word, int offset, int length) const;
int getSuggestions(
ProximityInfo *proximityInfo, const int *xcoordinates, const int *ycoordinates,
@@ -92,14 +92,14 @@ class UnigramDictionary {
const bool useFullEditDistance, Correction *correction,
WordsPriorityQueuePool *queuePool) const;
int getDigraphReplacement(const int *codes, const int i, const int codesSize,
- const digraph_t* const digraphs, const unsigned int digraphsSize) const;
+ const digraph_t *const digraphs, const unsigned int digraphsSize) const;
void getWordWithDigraphSuggestionsRec(ProximityInfo *proximityInfo,
- const int *xcoordinates, const int* ycoordinates, const int *codesBuffer,
+ const int *xcoordinates, const int *ycoordinates, const int *codesBuffer,
int *xCoordinatesBuffer, int *yCoordinatesBuffer, const int codesBufferSize,
const std::map<int, int> *bigramMap, const uint8_t *bigramFilter,
- const bool useFullEditDistance, const int* codesSrc, const int codesRemain,
- const int currentDepth, int* codesDest, Correction *correction,
- WordsPriorityQueuePool* queuePool, const digraph_t* const digraphs,
+ const bool useFullEditDistance, const int *codesSrc, const int codesRemain,
+ const int currentDepth, int *codesDest, Correction *correction,
+ WordsPriorityQueuePool *queuePool, const digraph_t *const digraphs,
const unsigned int digraphsSize) const;
void initSuggestions(ProximityInfo *proximityInfo, const int *xcoordinates,
const int *ycoordinates, const int *codes, const int codesSize,
@@ -107,16 +107,16 @@ class UnigramDictionary {
void getOneWordSuggestions(ProximityInfo *proximityInfo, const int *xcoordinates,
const int *ycoordinates, const int *codes, const std::map<int, int> *bigramMap,
const uint8_t *bigramFilter, const bool useFullEditDistance, const int inputLength,
- Correction *correction, WordsPriorityQueuePool* queuePool) const;
+ Correction *correction, WordsPriorityQueuePool *queuePool) const;
void getSuggestionCandidates(
const bool useFullEditDistance, const int inputLength,
const std::map<int, int> *bigramMap, const uint8_t *bigramFilter,
- Correction *correction, WordsPriorityQueuePool* queuePool, const bool doAutoCompletion,
+ Correction *correction, WordsPriorityQueuePool *queuePool, const bool doAutoCompletion,
const int maxErrors, const int currentWordIndex) const;
void getSplitMultipleWordsSuggestions(ProximityInfo *proximityInfo,
const int *xcoordinates, const int *ycoordinates, const int *codes,
const bool useFullEditDistance, const int inputLength,
- Correction *correction, WordsPriorityQueuePool* queuePool,
+ Correction *correction, WordsPriorityQueuePool *queuePool,
const bool hasAutoCorrectionCandidate) const;
void onTerminal(const int freq, const TerminalAttributes& terminalAttributes,
Correction *correction, WordsPriorityQueuePool *queuePool, const bool addToMasterQueue,
@@ -128,25 +128,25 @@ class UnigramDictionary {
const int currentWordIndex) const;
int getMostFrequentWordLike(const int startInputIndex, const int inputLength,
Correction *correction, unsigned short *word) const;
- int getMostFrequentWordLikeInner(const uint16_t* const inWord, const int length,
+ int getMostFrequentWordLikeInner(const uint16_t *const inWord, const int length,
short unsigned int *outWord) const;
int getSubStringSuggestion(
ProximityInfo *proximityInfo, const int *xcoordinates, const int *ycoordinates,
const int *codes, const bool useFullEditDistance, Correction *correction,
- WordsPriorityQueuePool* queuePool, const int inputLength,
+ WordsPriorityQueuePool *queuePool, const int inputLength,
const bool hasAutoCorrectionCandidate, const int currentWordIndex,
const int inputWordStartPos, const int inputWordLength,
const int outputWordStartPos, const bool isSpaceProximity, int *freqArray,
- int *wordLengthArray, unsigned short* outputWord, int *outputWordLength) const;
+ int *wordLengthArray, unsigned short *outputWord, int *outputWordLength) const;
void getMultiWordsSuggestionRec(ProximityInfo *proximityInfo,
const int *xcoordinates, const int *ycoordinates, const int *codes,
const bool useFullEditDistance, const int inputLength,
- Correction *correction, WordsPriorityQueuePool* queuePool,
+ Correction *correction, WordsPriorityQueuePool *queuePool,
const bool hasAutoCorrectionCandidate, const int startPos, const int startWordIndex,
- const int outputWordLength, int *freqArray, int* wordLengthArray,
- unsigned short* outputWord) const;
+ const int outputWordLength, int *freqArray, int *wordLengthArray,
+ unsigned short *outputWord) const;
- const uint8_t* const DICT_ROOT;
+ const uint8_t *const DICT_ROOT;
const int MAX_WORD_LENGTH;
const int MAX_WORDS;
const int TYPED_LETTER_MULTIPLIER;
@@ -160,5 +160,4 @@ class UnigramDictionary {
static const digraph_t FRENCH_LIGATURES_DIGRAPHS[];
};
} // namespace latinime
-
#endif // LATINIME_UNIGRAM_DICTIONARY_H
diff --git a/native/jni/src/words_priority_queue.h b/native/jni/src/words_priority_queue.h
index 9c6d28d60..fc9c55e63 100644
--- a/native/jni/src/words_priority_queue.h
+++ b/native/jni/src/words_priority_queue.h
@@ -33,7 +33,7 @@ class WordsPriorityQueue {
int mWordLength;
bool mUsed;
- void setParams(int score, unsigned short* word, int wordLength) {
+ void setParams(int score, unsigned short *word, int wordLength) {
mScore = score;
mWordLength = wordLength;
memcpy(mWord, word, sizeof(unsigned short) * wordLength);
@@ -55,8 +55,8 @@ class WordsPriorityQueue {
delete[] mSuggestedWords;
}
- void push(int score, unsigned short* word, int wordLength) {
- SuggestedWord* sw = 0;
+ void push(int score, unsigned short *word, int wordLength) {
+ SuggestedWord *sw = 0;
if (mSuggestions.size() >= MAX_WORDS) {
sw = mSuggestions.top();
const int minScore = sw->mScore;
@@ -86,21 +86,21 @@ class WordsPriorityQueue {
}
}
- SuggestedWord* top() {
+ SuggestedWord *top() {
if (mSuggestions.empty()) return 0;
- SuggestedWord* sw = mSuggestions.top();
+ SuggestedWord *sw = mSuggestions.top();
return sw;
}
- int outputSuggestions(const unsigned short* before, const int beforeLength,
+ int outputSuggestions(const unsigned short *before, const int beforeLength,
int *frequencies, unsigned short *outputChars) {
mHighestSuggestedWord = 0;
const unsigned int size = min(
MAX_WORDS, static_cast<unsigned int>(mSuggestions.size()));
- SuggestedWord* swBuffer[size];
+ SuggestedWord *swBuffer[size];
int index = size - 1;
while (!mSuggestions.empty() && index >= 0) {
- SuggestedWord* sw = mSuggestions.top();
+ SuggestedWord *sw = mSuggestions.top();
if (DEBUG_WORDS_PRIORITY_QUEUE) {
AKLOGI("dump word. %d", sw->mScore);
DUMP_WORD(sw->mWord, sw->mWordLength);
@@ -110,11 +110,11 @@ class WordsPriorityQueue {
--index;
}
if (size >= 2) {
- SuggestedWord* nsMaxSw = 0;
+ SuggestedWord *nsMaxSw = 0;
unsigned int maxIndex = 0;
float maxNs = 0;
for (unsigned int i = 0; i < size; ++i) {
- SuggestedWord* tempSw = swBuffer[i];
+ SuggestedWord *tempSw = swBuffer[i];
if (!tempSw) {
continue;
}
@@ -131,13 +131,13 @@ class WordsPriorityQueue {
}
}
for (unsigned int i = 0; i < size; ++i) {
- SuggestedWord* sw = swBuffer[i];
+ SuggestedWord *sw = swBuffer[i];
if (!sw) {
AKLOGE("SuggestedWord is null %d", i);
continue;
}
const unsigned int wordLength = sw->mWordLength;
- char* targetAdr = (char*) outputChars + i * MAX_WORD_LENGTH * sizeof(short);
+ char *targetAdr = (char*) outputChars + i * MAX_WORD_LENGTH * sizeof(short);
frequencies[i] = sw->mScore;
memcpy(targetAdr, sw->mWord, (wordLength) * sizeof(short));
if (wordLength < MAX_WORD_LENGTH) {
@@ -155,7 +155,7 @@ class WordsPriorityQueue {
void clear() {
mHighestSuggestedWord = 0;
while (!mSuggestions.empty()) {
- SuggestedWord* sw = mSuggestions.top();
+ SuggestedWord *sw = mSuggestions.top();
if (DEBUG_WORDS_PRIORITY_QUEUE) {
AKLOGI("Clear word. %d", sw->mScore);
DUMP_WORD(sw->mWord, sw->mWordLength);
@@ -172,8 +172,8 @@ class WordsPriorityQueue {
DUMP_WORD(mHighestSuggestedWord->mWord, mHighestSuggestedWord->mWordLength);
}
- float getHighestNormalizedScore(const unsigned short* before, const int beforeLength,
- unsigned short** outWord, int *outScore, int *outLength) {
+ float getHighestNormalizedScore(const unsigned short *before, const int beforeLength,
+ unsigned short **outWord, int *outScore, int *outLength) {
if (!mHighestSuggestedWord) {
return 0.0;
}
@@ -189,7 +189,7 @@ class WordsPriorityQueue {
}
};
- SuggestedWord* getFreeSuggestedWord(int score, unsigned short* word,
+ SuggestedWord *getFreeSuggestedWord(int score, unsigned short *word,
int wordLength) {
for (unsigned int i = 0; i < MAX_WORD_LENGTH; ++i) {
if (!mSuggestedWords[i].mUsed) {
@@ -200,10 +200,10 @@ class WordsPriorityQueue {
return 0;
}
- static float getNormalizedScore(SuggestedWord* sw, const unsigned short* before,
- const int beforeLength, unsigned short** outWord, int *outScore, int *outLength) {
+ static float getNormalizedScore(SuggestedWord *sw, const unsigned short *before,
+ const int beforeLength, unsigned short **outWord, int *outScore, int *outLength) {
const int score = sw->mScore;
- unsigned short* word = sw->mWord;
+ unsigned short *word = sw->mWord;
const int wordLength = sw->mWordLength;
if (outScore) {
*outScore = score;
@@ -223,9 +223,8 @@ class WordsPriorityQueue {
Suggestions mSuggestions;
const unsigned int MAX_WORDS;
const unsigned int MAX_WORD_LENGTH;
- SuggestedWord* mSuggestedWords;
- SuggestedWord* mHighestSuggestedWord;
+ SuggestedWord *mSuggestedWords;
+ SuggestedWord *mHighestSuggestedWord;
};
-}
-
+} // namespace latinime
#endif // LATINIME_WORDS_PRIORITY_QUEUE_H
diff --git a/native/jni/src/words_priority_queue_pool.h b/native/jni/src/words_priority_queue_pool.h
index b4e2bed26..aff307404 100644
--- a/native/jni/src/words_priority_queue_pool.h
+++ b/native/jni/src/words_priority_queue_pool.h
@@ -44,11 +44,11 @@ class WordsPriorityQueuePool {
}
}
- WordsPriorityQueue* getMasterQueue() {
+ WordsPriorityQueue *getMasterQueue() {
return mMasterQueue;
}
- WordsPriorityQueue* getSubQueue(const int wordIndex, const int inputWordLength) {
+ WordsPriorityQueue *getSubQueue(const int wordIndex, const int inputWordLength) {
if (wordIndex >= MULTIPLE_WORDS_SUGGESTION_MAX_WORDS) {
return 0;
}
@@ -70,7 +70,7 @@ class WordsPriorityQueuePool {
inline void clearSubQueue(const int wordIndex) {
for (int i = 0; i < SUB_QUEUE_MAX_COUNT; ++i) {
- WordsPriorityQueue* queue = getSubQueue(wordIndex, i);
+ WordsPriorityQueue *queue = getSubQueue(wordIndex, i);
if (queue) {
queue->clear();
}
@@ -86,12 +86,11 @@ class WordsPriorityQueuePool {
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(WordsPriorityQueuePool);
- WordsPriorityQueue* mMasterQueue;
- WordsPriorityQueue* mSubQueues[SUB_QUEUE_MAX_COUNT * MULTIPLE_WORDS_SUGGESTION_MAX_WORDS];
+ WordsPriorityQueue *mMasterQueue;
+ WordsPriorityQueue *mSubQueues[SUB_QUEUE_MAX_COUNT * MULTIPLE_WORDS_SUGGESTION_MAX_WORDS];
char mMasterQueueBuf[sizeof(WordsPriorityQueue)];
char mSubQueueBuf[MULTIPLE_WORDS_SUGGESTION_MAX_WORDS
* SUB_QUEUE_MAX_COUNT * sizeof(WordsPriorityQueue)];
};
-}
-
+} // namespace latinime
#endif // LATINIME_WORDS_PRIORITY_QUEUE_POOL_H
diff --git a/tools/maketext/res/values-sr/donottranslate-more-keys.xml b/tools/maketext/res/values-sr/donottranslate-more-keys.xml
index e85d3d7a2..dcf0e857e 100644
--- a/tools/maketext/res/values-sr/donottranslate-more-keys.xml
+++ b/tools/maketext/res/values-sr/donottranslate-more-keys.xml
@@ -18,6 +18,24 @@
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- TODO: Move these to sr-Latn once we can handle IETF language tag with script name specified.
+ BEGIN: More keys definitions for Serbian (Latin)
+ U+0161: "š" LATIN SMALL LETTER S WITH CARON
+ U+00DF: "ß" LATIN SMALL LETTER SHARP S
+ U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
+ <string name="more_keys_for_s">&#x0161;,&#x00DF;,&#x015B;</string>
+ U+010D: "č" LATIN SMALL LETTER C WITH CARON
+ U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
+ U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
+ <string name="more_keys_for_c">&#x010D;,&#x00E7;,&#x0107;</string>
+ U+010F: "ď" LATIN SMALL LETTER D WITH CARON
+ <string name="more_keys_for_d">&#x010F;</string>
+ U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
+ U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
+ U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
+ <string name="more_keys_for_z">&#x017E;,&#x017A;,&#x017C;</string>
+ END: More keys definitions for Serbian (Latin) -->
+ <!-- BEGIN: More keys definitions for Serbian (Cyrillic) -->
<!-- U+0437: "з" CYRILLIC SMALL LETTER ZE -->
<string name="keylabel_for_south_slavic_row1_6">&#x0437;</string>
<!-- U+045B: "ћ" CYRILLIC SMALL LETTER TSHE -->
@@ -30,6 +48,7 @@
<string name="more_keys_for_cyrillic_ie">&#x0450;</string>
<!-- U+045D: "ѝ" CYRILLIC SMALL LETTER I WITH GRAVE -->
<string name="more_keys_for_cyrillic_i">&#x045D;</string>
+ <!-- END: More keys definitions for Serbian (Cyrillic) -->
<!-- U+2018: "‘" LEFT SINGLE QUOTATION MARK
U+2019: "’" RIGHT SINGLE QUOTATION MARK
U+201A: "‚" SINGLE LOW-9 QUOTATION MARK
diff --git a/tools/maketext/res/values-sw/donottranslate-more-keys.xml b/tools/maketext/res/values-sw/donottranslate-more-keys.xml
new file mode 100644
index 000000000..968a80c1c
--- /dev/null
+++ b/tools/maketext/res/values-sw/donottranslate-more-keys.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- This is the same as English except more_keys_for_g. -->
+ <!-- U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+ U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
+ U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
+ U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
+ U+00E6: "æ" LATIN SMALL LETTER AE
+ U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
+ U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
+ U+0101: "ā" LATIN SMALL LETTER A WITH MACRON -->
+ <string name="more_keys_for_a">&#x00E0;,&#x00E1;,&#x00E2;,&#x00E4;,&#x00E6;,&#x00E3;,&#x00E5;,&#x0101;</string>
+ <!-- U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+ U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
+ U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
+ U+0113: "ē" LATIN SMALL LETTER E WITH MACRON -->
+ <string name="more_keys_for_e">&#x00E8;,&#x00E9;,&#x00EA;,&#x00EB;,&#x0113;</string>
+ <!-- U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+ U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
+ U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+ U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
+ U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE -->
+ <string name="more_keys_for_i">&#x00EE;,&#x00EF;,&#x00ED;,&#x012B;,&#x00EC;</string>
+ <!-- U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+ U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
+ U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+ U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+ U+0153: "œ" LATIN SMALL LIGATURE OE
+ U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
+ U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
+ U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE -->
+ <string name="more_keys_for_o">&#x00F4;,&#x00F6;,&#x00F2;,&#x00F3;,&#x0153;,&#x00F8;,&#x014D;,&#x00F5;</string>
+ <!-- U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+ U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+ U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
+ U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+ U+016B: "ū" LATIN SMALL LETTER U WITH MACRON -->
+ <string name="more_keys_for_u">&#x00FB;,&#x00FC;,&#x00F9;,&#x00FA;,&#x016B;</string>
+ <!-- U+00DF: "ß" LATIN SMALL LETTER SHARP S -->
+ <string name="more_keys_for_s">&#x00DF;</string>
+ <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE -->
+ <string name="more_keys_for_n">&#x00F1;</string>
+ <!-- U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA -->
+ <string name="more_keys_for_c">&#x00E7;</string>
+ <string name="more_keys_for_g">g\'</string>
+</resources>
diff --git a/tools/maketext/res/values-tl/donottranslate-more-keys.xml b/tools/maketext/res/values-tl/donottranslate-more-keys.xml
new file mode 100644
index 000000000..383d55ccf
--- /dev/null
+++ b/tools/maketext/res/values-tl/donottranslate-more-keys.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
+ U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+ U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
+ U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
+ U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
+ U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
+ U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK
+ U+00E6: "æ" LATIN SMALL LETTER AE
+ U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
+ U+00AA: "ª" FEMININE ORDINAL INDICATOR -->
+ <string name="more_keys_for_a">&#x00E1;,&#x00E0;,&#x00E4;,&#x00E2;,&#x00E3;,&#x00E5;,&#x0105;,&#x00E6;,&#x0101;,&#x00AA;</string>
+ <!-- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+ U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
+ U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
+ U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
+ U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
+ U+0113: "ē" LATIN SMALL LETTER E WITH MACRON -->
+ <string name="more_keys_for_e">&#x00E9;,&#x00E8;,&#x00EB;,&#x00EA;,&#x0119;,&#x0117;,&#x0113;</string>
+ <!-- U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+ U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
+ U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
+ U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+ U+012F: "į" LATIN SMALL LETTER I WITH OGONEK
+ U+012B: "ī" LATIN SMALL LETTER I WITH MACRON -->
+ <string name="more_keys_for_i">&#x00ED;,&#x00EF;,&#x00EC;,&#x00EE;,&#x012F;,&#x012B;</string>
+ <!-- U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+ U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+ U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
+ U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+ U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
+ U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
+ U+0153: "œ" LATIN SMALL LIGATURE OE
+ U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
+ U+00BA: "º" MASCULINE ORDINAL INDICATOR -->
+ <string name="more_keys_for_o">&#x00F3;,&#x00F2;,&#x00F6;,&#x00F4;,&#x00F5;,&#x00F8;,&#x0153;,&#x014D;,&#x00BA;</string>
+ <!-- U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+ U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+ U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
+ U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+ U+016B: "ū" LATIN SMALL LETTER U WITH MACRON -->
+ <string name="more_keys_for_u">&#x00FA;,&#x00FC;,&#x00F9;,&#x00FB;,&#x016B;</string>
+ <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
+ U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE -->
+ <string name="more_keys_for_n">&#x00F1;,&#x0144;</string>
+ <!-- U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
+ U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
+ U+010D: "č" LATIN SMALL LETTER C WITH CARON -->
+ <string name="more_keys_for_c">&#x00E7;,&#x0107;,&#x010D;</string>
+</resources>