diff options
-rw-r--r-- | dictionary/src/dictionary.cpp | 11 | ||||
-rw-r--r-- | dictionary/src/dictionary.h | 1 | ||||
-rw-r--r-- | res/values-cs/strings.xml | 6 | ||||
-rw-r--r-- | res/values-da/strings.xml | 20 | ||||
-rw-r--r-- | res/values-ja/strings.xml | 4 | ||||
-rw-r--r-- | res/values-ko/strings.xml | 4 | ||||
-rw-r--r-- | res/values-pt/strings.xml | 2 | ||||
-rw-r--r-- | res/values-ru/strings.xml | 12 | ||||
-rw-r--r-- | res/values-zh-rCN/strings.xml | 18 | ||||
-rw-r--r-- | res/values/strings.xml | 5 | ||||
-rwxr-xr-x | res/xml/kbd_extension.xml | 61 | ||||
-rwxr-xr-x | res/xml/kbd_symbols.xml | 9 | ||||
-rwxr-xr-x | res/xml/kbd_symbols_shift.xml | 15 | ||||
-rw-r--r-- | src/com/android/inputmethod/latin/KeyboardSwitcher.java | 7 | ||||
-rw-r--r-- | src/com/android/inputmethod/latin/LatinIME.java | 1 | ||||
-rw-r--r-- | src/com/android/inputmethod/latin/LatinKeyboard.java | 10 | ||||
-rw-r--r-- | src/com/android/inputmethod/latin/LatinKeyboardView.java | 116 |
17 files changed, 253 insertions, 49 deletions
diff --git a/dictionary/src/dictionary.cpp b/dictionary/src/dictionary.cpp index cc711f419..306aff527 100644 --- a/dictionary/src/dictionary.cpp +++ b/dictionary/src/dictionary.cpp @@ -51,6 +51,7 @@ Dictionary::~Dictionary() int Dictionary::getSuggestions(int *codes, int codesSize, unsigned short *outWords, int *frequencies, int maxWordLength, int maxWords, int maxAlternatives, int skipPos) { + int suggWords; mFrequencies = frequencies; mOutputChars = outWords; mInputCodes = codes; @@ -58,14 +59,16 @@ int Dictionary::getSuggestions(int *codes, int codesSize, unsigned short *outWor mMaxAlternatives = maxAlternatives; mMaxWordLength = maxWordLength; mMaxWords = maxWords; - mWords = 0; mSkipPos = skipPos; mMaxEditDistance = mInputLength < 5 ? 2 : mInputLength / 2; getWordsRec(0, 0, mInputLength * 3, false, 1, 0, 0); - if (DEBUG_DICT) LOGI("Returning %d words", mWords); - return mWords; + // Get the word count + suggWords = 0; + while (suggWords < mMaxWords && mFrequencies[suggWords] > 0) suggWords++; + if (DEBUG_DICT) LOGI("Returning %d words", suggWords); + return suggWords; } unsigned short @@ -138,8 +141,6 @@ Dictionary::addWord(unsigned short *word, int length, int frequency) *dest++ = *word++; } *dest = 0; // NULL terminate - // Update the word count - if (insertAt + 1 > mWords) mWords = insertAt + 1; if (DEBUG_DICT) LOGI("Added word at %d\n", insertAt); return true; } diff --git a/dictionary/src/dictionary.h b/dictionary/src/dictionary.h index 8f195ca9a..a12c035c8 100644 --- a/dictionary/src/dictionary.h +++ b/dictionary/src/dictionary.h @@ -60,7 +60,6 @@ private: int *mFrequencies; int mMaxWords; int mMaxWordLength; - int mWords; unsigned short *mOutputChars; int *mInputCodes; int mInputLength; diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index 38ac20200..29b8565ba 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -89,8 +89,8 @@ <string name="touch_and_hold" msgid="6154166367273010534"><font size="17"><b>"Přidržením klávesy zobrazte možnosti"\n</b></font><font size="3">\n</font>"Použijte interpunkční znaménka a diakritiku."</string> <string name="keyboard_settings" msgid="4585753477617374032"><font size="17"><b>"Nastavení klávesnice"\n</b></font><font size="3">\n</font>"Dotkněte se klávesy "<b>"?123"</b>" a přidržte ji."</string> <string name="popular_domain_0" msgid="3745279225122472969">".com"</string> - <string name="popular_domain_1" msgid="1370572248164278467">".cz"</string> + <string name="popular_domain_1" msgid="1370572248164278467">".net"</string> <string name="popular_domain_2" msgid="3036812463748402878">".org"</string> - <string name="popular_domain_3" msgid="8718639560809452028">".net"</string> - <string name="popular_domain_4" msgid="35359437471311470">".eu"</string> + <string name="popular_domain_3" msgid="8718639560809452028">".biz"</string> + <string name="popular_domain_4" msgid="35359437471311470">".cz"</string> </resources> diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml index d4dd23a65..3af5e439a 100644 --- a/res/values-da/strings.xml +++ b/res/values-da/strings.xml @@ -16,8 +16,8 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="english_ime_name" msgid="7252517407088836577">"Android-tastatur"</string> - <string name="english_ime_settings" msgid="6661589557206947774">"Indstillinger for Android-tastatur"</string> - <string name="vibrate_on_keypress" msgid="5258079494276955460">"Vibration ved tastetryk"</string> + <string name="english_ime_settings" msgid="6661589557206947774">"Android-tastaturindstillinger"</string> + <string name="vibrate_on_keypress" msgid="5258079494276955460">"Vibrer ved tastetryk"</string> <string name="sound_on_keypress" msgid="6093592297198243644">"Lyd ved tastetryk"</string> <string name="hit_correction" msgid="4855351009261318389">"Ret stavefejl"</string> <string name="hit_correction_summary" msgid="8761701873008070796">"Aktiver fejlretning af input"</string> @@ -29,17 +29,17 @@ <string name="prediction_category" msgid="7027100625580696660">"Indstillinger for ordforslag"</string> <string name="prediction_summary" msgid="459788228830873110">"Aktiver automatisk udfyldelse, når du indtaster"</string> <string name="auto_complete_dialog_title" msgid="2172048590607201920">"Automatisk udfyldelse"</string> - <string name="prediction_landscape" msgid="4874601565593216183">"Forøg tekstfeltets størrelse"</string> + <string name="prediction_landscape" msgid="4874601565593216183">"Øg størrelsen på tekstfeltet"</string> <string name="prediction_landscape_summary" msgid="6736551095997839472">"Skjul ordforslag i landskabsvisning"</string> <string name="auto_cap" msgid="1719746674854628252">"Skriv aut. med stort"</string> - <string name="auto_cap_summary" msgid="3260681697600786825">"Første bogstav i en sætning skrives med stort"</string> + <string name="auto_cap_summary" msgid="3260681697600786825">"Skriv første bogstav i en sætning med stort"</string> <string name="auto_punctuate" msgid="7276672334264521751">"Foretag automatisk tegnsætning"</string> <!-- no translation found for auto_punctuate_summary (6589441565817502132) --> <skip /> <string name="quick_fixes" msgid="5353213327680897927">"Hurtige løsninger"</string> <string name="quick_fixes_summary" msgid="3405028402510332373">"Retter almindelige stavefejl"</string> <string name="show_suggestions" msgid="507074425254289133">"Vis forslag"</string> - <string name="show_suggestions_summary" msgid="1989672863935759654">"Vis ordforslag under indtastning"</string> + <string name="show_suggestions_summary" msgid="1989672863935759654">"Vis forslag til ord, mens du indtaster"</string> <string name="auto_complete" msgid="1103196318775486023">"Udfyld automatisk"</string> <string name="auto_complete_summary" msgid="6113149638718274624">"Mellemrumstast og tegnsætning indsætter automatisk fremhævet ord"</string> <string-array name="prediction_modes"> @@ -70,15 +70,15 @@ <string name="tip_add_to_dictionary" msgid="1487293888469227817">"Tryk og hold på ordet længst til venstre for at føje det til ordbogen"</string> <string name="touch_to_continue" msgid="7869803257948414531">"Berør dette tip for at fortsætte »"</string> <string name="touch_to_finish" msgid="7990196086480585789">"Berør her for at lukke dette tip og begynde at indtaste!"</string> - <string name="tip_to_open_keyboard" msgid="6821200275486950452"><b>"Tastaturet åbnes, når du berører et tekstfelt"</b></string> + <string name="tip_to_open_keyboard" msgid="6821200275486950452"><b>"Tastaturet åbner når som helst, du berører et tekstfelt"</b></string> <string name="tip_to_view_accents" msgid="5433158573693308501"><b>"Berør og hold en tast nede for at vise accenter"\n"(ø, ö, ô, ó osv.)"</b></string> <string name="tip_to_open_symbols" msgid="7345139325622444880"><b>"Skift til tal og symboler ved at røre denne tast"</b></string> - <string name="tip_to_close_symbols" msgid="5227724217206927185"><b>"Gå tilbage til bogstaverne ved at berøre denne tast igen"</b></string> - <string name="tip_to_launch_settings" msgid="8402961128983196128"><b>"Berør og hold denne tast nede for at ændre indstillingerne for tastaturet, som f.eks. automatisk udfyldelse"</b></string> + <string name="tip_to_close_symbols" msgid="5227724217206927185"><b>"Gå tilbage til bogstaver ved at berøre denne tast igen"</b></string> + <string name="tip_to_launch_settings" msgid="8402961128983196128"><b>"Berør og hold denne tast nede for at ændre tastaturindstillingerne, som f.eks. automatisk udfyldelse"</b></string> <string name="tip_to_start_typing" msgid="7213843601369174313"><b>"Prøv det!"</b></string> <string name="label_go_key" msgid="1635148082137219148">"Gå"</string> <string name="label_next_key" msgid="362972844525672568">"Næste"</string> - <string name="label_done_key" msgid="2441578748772529288">"Udfør"</string> + <string name="label_done_key" msgid="2441578748772529288">"Færdig"</string> <string name="label_send_key" msgid="2815056534433717444">"Send"</string> <string name="label_symbol_key" msgid="6175820506864489453">"?123"</string> <string name="label_phone_key" msgid="4275497665515080551">"123"</string> @@ -87,7 +87,7 @@ <string name="open_the_keyboard" msgid="2215920976029260466"><font size="17"><b>"Åbn tastaturet"\n</b></font><font size="3">\n</font>"Tryk på et hvilket som helst tekstfelt."</string> <string name="close_the_keyboard" msgid="6251022259044940103"><font size="17"><b>"Luk tastaturet"\n</b></font><font size="3">\n</font>"Tryk på Tilbagetasten."</string> <string name="touch_and_hold" msgid="6154166367273010534"><font size="17"><b>"Tryk på og hold en tast nede for valgmuligheder"\n</b></font><font size="3">\n</font>"Få adgang til tegnsætning og accenter."</string> - <string name="keyboard_settings" msgid="4585753477617374032"><font size="17"><b>"Indstillinger for tastatur"\n</b></font><font size="3">\n</font>"Tryk på og hold tasten "<b>"?123"</b>" nede."</string> + <string name="keyboard_settings" msgid="4585753477617374032"><font size="17"><b>"Tastaturindstillinger"\n</b></font><font size="3">\n</font>"Tryk på og hold tasten "<b>"?123"</b>" nede."</string> <string name="popular_domain_0" msgid="3745279225122472969">".com"</string> <string name="popular_domain_1" msgid="1370572248164278467">".net"</string> <string name="popular_domain_2" msgid="3036812463748402878">".org"</string> diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index e28fcee29..d5e7f8dc8 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -39,9 +39,9 @@ <string name="quick_fixes" msgid="5353213327680897927">"クイックフィックス"</string> <string name="quick_fixes_summary" msgid="3405028402510332373">"よくある誤字・脱字を修正します"</string> <string name="show_suggestions" msgid="507074425254289133">"入力候補を表示"</string> - <string name="show_suggestions_summary" msgid="1989672863935759654">"入力時に入力候補を表示する"</string> + <string name="show_suggestions_summary" msgid="1989672863935759654">"入力時に入力候補を表示します"</string> <string name="auto_complete" msgid="1103196318775486023">"オートコンプリート"</string> - <string name="auto_complete_summary" msgid="6113149638718274624">"反転表示されている変換候補をスペースまたは句読点キーで挿入する"</string> + <string name="auto_complete_summary" msgid="6113149638718274624">"スペースまたは句読点キーで反転表示されている変換候補を挿入する"</string> <string-array name="prediction_modes"> <item msgid="4870266572388153286">"なし"</item> <item msgid="1669461741568287396">"基本"</item> diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index e86c609ad..570780f78 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -39,9 +39,9 @@ <string name="quick_fixes" msgid="5353213327680897927">"빠른 수정"</string> <string name="quick_fixes_summary" msgid="3405028402510332373">"자주 발생하는 오타를 수정합니다."</string> <string name="show_suggestions" msgid="507074425254289133">"추천 단어 표시"</string> - <string name="show_suggestions_summary" msgid="1989672863935759654">"글자를 입력하는 동안 추천 단어를 표시"</string> + <string name="show_suggestions_summary" msgid="1989672863935759654">"글자를 입력하는 동안 추천 단어를 표시합니다."</string> <string name="auto_complete" msgid="1103196318775486023">"자동 완성"</string> - <string name="auto_complete_summary" msgid="6113149638718274624">"스페이스바와 문장부호 키로 강조 표시된 단어를 자동 삽입"</string> + <string name="auto_complete_summary" msgid="6113149638718274624">"스페이스바와 문장부호 키로 강조 표시된 단어를 자동 삽입합니다."</string> <string-array name="prediction_modes"> <item msgid="4870266572388153286">"없음"</item> <item msgid="1669461741568287396">"기본"</item> diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 6995e2272..978215ff4 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -86,7 +86,7 @@ <string name="label_alt_key" msgid="2846315350346694811">"ALT"</string> <string name="open_the_keyboard" msgid="2215920976029260466"><font size="17"><b>"Abra o teclado"\n</b></font><font size="3">\n</font>"Toque em qualquer campo de texto."</string> <string name="close_the_keyboard" msgid="6251022259044940103"><font size="17"><b>"Feche o teclado"\n</b></font><font size="3">\n</font>"Pressione a tecla Voltar."</string> - <string name="touch_and_hold" msgid="6154166367273010534"><font size="17"><b>"Toque e mantenha pressionada uma tecla para ver as opções"\n</b></font><font size="3">\n</font>"Acesse a pontuação e os acentos."</string> + <string name="touch_and_hold" msgid="6154166367273010534"><font size="17"><b>"Toque e mantenha pressionada uma tecla para ver as opções"\n</b></font><font size="3">\n</font>"Acesse a pontuação e as pronúncias."</string> <string name="keyboard_settings" msgid="4585753477617374032"><font size="17"><b>"Configurações de teclado"\n</b></font><font size="3">\n</font>"Toque e mantenha pressionada a tecla "<b>"?123"</b>"."</string> <string name="popular_domain_0" msgid="3745279225122472969">".com"</string> <string name="popular_domain_1" msgid="1370572248164278467">".net"</string> diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index de7da45f0..25c5d341f 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -17,8 +17,8 @@ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="english_ime_name" msgid="7252517407088836577">"Клавиатура Android"</string> <string name="english_ime_settings" msgid="6661589557206947774">"Настройки клавиатуры Android"</string> - <string name="vibrate_on_keypress" msgid="5258079494276955460">"Виброотклик клавиш"</string> - <string name="sound_on_keypress" msgid="6093592297198243644">"Звук клавиш"</string> + <string name="vibrate_on_keypress" msgid="5258079494276955460">"Вибрация при нажатии клавиш"</string> + <string name="sound_on_keypress" msgid="6093592297198243644">"Звук при нажатии клавиш"</string> <string name="hit_correction" msgid="4855351009261318389">"Исправлять опечатки"</string> <string name="hit_correction_summary" msgid="8761701873008070796">"Включить исправление ошибок при вводе"</string> <string name="hit_correction_land" msgid="2567691684825205448">"Ошибки при вводе в горизонтальной ориентации"</string> @@ -26,12 +26,12 @@ <string name="auto_correction" msgid="7911639788808958255">"Предложение слов"</string> <string name="auto_correction_summary" msgid="6881047311475758267">"Автоматически исправлять предыдущее слово"</string> <string name="prediction" msgid="466220283138359837">"Предложение слов"</string> - <string name="prediction_category" msgid="7027100625580696660">"Настройки подсказок"</string> + <string name="prediction_category" msgid="7027100625580696660">"Настройки предложения слов"</string> <string name="prediction_summary" msgid="459788228830873110">"Включить автоматическое завершение слов при вводе"</string> <string name="auto_complete_dialog_title" msgid="2172048590607201920">"Автоматическое завершение"</string> <string name="prediction_landscape" msgid="4874601565593216183">"Увеличить размер текстового поля"</string> <string name="prediction_landscape_summary" msgid="6736551095997839472">"Скрывать предложение слов в горизонтальной ориентации"</string> - <string name="auto_cap" msgid="1719746674854628252">"Автоподст. заглавных"</string> + <string name="auto_cap" msgid="1719746674854628252">"Заглавные автоматически"</string> <string name="auto_cap_summary" msgid="3260681697600786825">"Делать заглавной первую букву предложения"</string> <string name="auto_punctuate" msgid="7276672334264521751">"Автоматическая пунктуация"</string> <!-- no translation found for auto_punctuate_summary (6589441565817502132) --> @@ -39,9 +39,9 @@ <string name="quick_fixes" msgid="5353213327680897927">"Быстрое исправление"</string> <string name="quick_fixes_summary" msgid="3405028402510332373">"Исправлять распространенные опечатки"</string> <string name="show_suggestions" msgid="507074425254289133">"Предлагать варианты"</string> - <string name="show_suggestions_summary" msgid="1989672863935759654">"Предлагать варианты слов во время ввода"</string> + <string name="show_suggestions_summary" msgid="1989672863935759654">"Предлагать варианты во время ввода"</string> <string name="auto_complete" msgid="1103196318775486023">"Автозавершение"</string> - <string name="auto_complete_summary" msgid="6113149638718274624">"При нажатии пробела или знака препинания вставлять предложенное слово"</string> + <string name="auto_complete_summary" msgid="6113149638718274624">"Пробел или знак препинания вставляют выделенное слово"</string> <string-array name="prediction_modes"> <item msgid="4870266572388153286">"Нет"</item> <item msgid="1669461741568287396">"Основной"</item> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 8eb907d9d..c68b795c9 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -18,7 +18,7 @@ <string name="english_ime_name" msgid="7252517407088836577">"Android 键盘"</string> <string name="english_ime_settings" msgid="6661589557206947774">"Android 键盘设置"</string> <string name="vibrate_on_keypress" msgid="5258079494276955460">"按键时振动"</string> - <string name="sound_on_keypress" msgid="6093592297198243644">"按键时播放音效"</string> + <string name="sound_on_keypress" msgid="6093592297198243644">"按键时发出声音"</string> <string name="hit_correction" msgid="4855351009261318389">"纠正输入错误"</string> <string name="hit_correction_summary" msgid="8761701873008070796">"启用输入错误纠正"</string> <string name="hit_correction_land" msgid="2567691684825205448">"横向输入错误"</string> @@ -27,7 +27,7 @@ <string name="auto_correction_summary" msgid="6881047311475758267">"自动纠正之前的字词"</string> <string name="prediction" msgid="466220283138359837">"字词建议"</string> <string name="prediction_category" msgid="7027100625580696660">"字词建议设置"</string> - <string name="prediction_summary" msgid="459788228830873110">"输入时启用自动填写功能"</string> + <string name="prediction_summary" msgid="459788228830873110">"输入时启用自动完成"</string> <string name="auto_complete_dialog_title" msgid="2172048590607201920">"自动完成"</string> <string name="prediction_landscape" msgid="4874601565593216183">"增加文本域的大小"</string> <string name="prediction_landscape_summary" msgid="6736551095997839472">"在横向视图中隐藏字词建议"</string> @@ -39,9 +39,9 @@ <string name="quick_fixes" msgid="5353213327680897927">"快速纠正"</string> <string name="quick_fixes_summary" msgid="3405028402510332373">"纠正常见的输入错误"</string> <string name="show_suggestions" msgid="507074425254289133">"显示建议"</string> - <string name="show_suggestions_summary" msgid="1989672863935759654">"输入时启用联想提示"</string> - <string name="auto_complete" msgid="1103196318775486023">"自动填写"</string> - <string name="auto_complete_summary" msgid="6113149638718274624">"按空格键和标点符号时自动插入突出显示的字词"</string> + <string name="show_suggestions_summary" msgid="1989672863935759654">"输入时显示建议的字词"</string> + <string name="auto_complete" msgid="1103196318775486023">"自动输入"</string> + <string name="auto_complete_summary" msgid="6113149638718274624">"按空格和标点会自动插入突出显示的字词"</string> <string-array name="prediction_modes"> <item msgid="4870266572388153286">"无"</item> <item msgid="1669461741568287396">"基本模式"</item> @@ -64,17 +64,17 @@ <string name="alternates_for_c" msgid="151699780720639892">"ç"</string> <string name="alternates_for_y" msgid="1722776806607271199">"ýÿ"</string> <string name="key_i" msgid="6483655742552255124">"i"</string> - <string name="tip_long_press" msgid="6101270866284343344">"按住某个键可看到重音符号(例如 ø、ö 等)"</string> + <string name="tip_long_press" msgid="6101270866284343344">"长按某些键可看到重音符号(例如 ø、ö 等)"</string> <string name="tip_dismiss" msgid="7585579046862204381">"随时可以通过按后退键 ↶ 关闭键盘"</string> <string name="tip_access_symbols" msgid="6344098517525531652">"访问数字和符号"</string> <string name="tip_add_to_dictionary" msgid="1487293888469227817">"长按最左侧的字可将其添加到词典中"</string> <string name="touch_to_continue" msgid="7869803257948414531">"轻触此提示继续 »"</string> <string name="touch_to_finish" msgid="7990196086480585789">"轻触此处可关闭该提示,然后便可开始输入内容!"</string> <string name="tip_to_open_keyboard" msgid="6821200275486950452"><b>"轻触文本字段即可打开键盘"</b></string> - <string name="tip_to_view_accents" msgid="5433158573693308501"><b>"按住某个键可看到重音符号"\n"(例如 ø、ö、ô、ó 等)"</b></string> + <string name="tip_to_view_accents" msgid="5433158573693308501"><b>"长按某些键可看到重音符号"\n"(例如 ø、ö、ô、ó 等)"</b></string> <string name="tip_to_open_symbols" msgid="7345139325622444880"><b>"轻触该键可切换到数字和符号输入模式"</b></string> <string name="tip_to_close_symbols" msgid="5227724217206927185"><b>"再次轻触该键可返回字母输入模式"</b></string> - <string name="tip_to_launch_settings" msgid="8402961128983196128"><b>"长按该键可更改键盘设置,例如自动填写"</b></string> + <string name="tip_to_launch_settings" msgid="8402961128983196128"><b>"长按该键可更改键盘设置,例如自动输入"</b></string> <string name="tip_to_start_typing" msgid="7213843601369174313"><b>"试试吧!"</b></string> <string name="label_go_key" msgid="1635148082137219148">"开始"</string> <string name="label_next_key" msgid="362972844525672568">"下一步"</string> @@ -86,7 +86,7 @@ <string name="label_alt_key" msgid="2846315350346694811">"ALT"</string> <string name="open_the_keyboard" msgid="2215920976029260466"><font size="17"><b>"打开键盘"\n</b></font><font size="3">\n</font>"轻触任意文本字段。"</string> <string name="close_the_keyboard" msgid="6251022259044940103"><font size="17"><b>"关闭键盘"\n</b></font><font size="3">\n</font>"按“返回”键。"</string> - <string name="touch_and_hold" msgid="6154166367273010534"><font size="17"><b>"按住某个键可开启其他字符选项"\n</b></font><font size="3">\n</font>"访问标点和重音符号。"</string> + <string name="touch_and_hold" msgid="6154166367273010534"><font size="17"><b>"长按某些键可开启其他字符选项"\n</b></font><font size="3">\n</font>"访问标点和重音符号。"</string> <string name="keyboard_settings" msgid="4585753477617374032"><font size="17"><b>"键盘设置"\n</b></font><font size="3">\n</font>"长按 "<b>"?123"</b>" 键。"</string> <string name="popular_domain_0" msgid="3745279225122472969">".com"</string> <string name="popular_domain_1" msgid="1370572248164278467">".net"</string> diff --git a/res/values/strings.xml b/res/values/strings.xml index ec9a8b731..753d0dc9e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -126,7 +126,10 @@ <!-- Accented forms of "y" --> <string name="alternates_for_y">ýÿ</string> - <!-- Label to display on the "i" key --> + <!-- Label to display on the lower "i" key. + Usually you don't need to modify this value, but if your locale requires some variant + for this character (e.g. \\u131 "Latin Small Letter Dotoless i"), please modify this + value. --> <string name="key_i">i</string> <!-- Tip to long press on keys --> diff --git a/res/xml/kbd_extension.xml b/res/xml/kbd_extension.xml new file mode 100755 index 000000000..c64f666d0 --- /dev/null +++ b/res/xml/kbd_extension.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2008, 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. +*/ +--> + +<Keyboard xmlns:android="http://schemas.android.com/apk/res/android" + android:keyWidth="10%p" + android:horizontalGap="0px" + android:verticalGap="0px" + android:keyHeight="@dimen/key_height" + > + + <Row android:rowEdgeFlags="top"> + <Key android:keyLabel="!" android:keyEdgeFlags="left"/> + <Key android:keyLabel="\@"/> + <Key android:keyLabel="\#"/> + <Key android:keyLabel="&"/> + <Key android:keyLabel="-"/> + <Key android:keyLabel="\'"/> + <Key android:keyLabel=":"/> + <Key android:keyLabel="""/> + <Key android:keyLabel="/"/> + <Key android:keyLabel="\?" android:keyEdgeFlags="right" + /> + </Row> + + <Row android:rowEdgeFlags="bottom"> + <Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left" + /> + <Key android:codes="50" android:keyLabel="2" + /> + <Key android:codes="51" android:keyLabel="3" + /> + <Key android:codes="52" android:keyLabel="4" + /> + <Key android:codes="53" android:keyLabel="5" + /> + <Key android:codes="54" android:keyLabel="6"/> + <Key android:codes="55" android:keyLabel="7" + /> + <Key android:codes="56" android:keyLabel="8"/> + <Key android:codes="57" android:keyLabel="9"/> + <Key android:codes="48" android:keyLabel="0" + android:keyEdgeFlags="right"/> + </Row> +</Keyboard> diff --git a/res/xml/kbd_symbols.xml b/res/xml/kbd_symbols.xml index f3b8833dc..b1b75c620 100755 --- a/res/xml/kbd_symbols.xml +++ b/res/xml/kbd_symbols.xml @@ -73,7 +73,7 @@ <Key android:codes="38" android:keyLabel="&"/> <Key android:codes="42" android:keyLabel="*" android:popupKeyboard="@xml/kbd_popup_template" - android:popupCharacters="†‡" + android:popupCharacters="†‡★" /> <Key android:codes="45" android:keyLabel="-" android:popupKeyboard="@xml/kbd_popup_template" @@ -105,7 +105,10 @@ android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="“”«»˝" /> - <Key android:codes="39" android:keyLabel="\'"/> + <Key android:codes="39" android:keyLabel="\'" + android:popupKeyboard="@xml/kbd_popup_template" + android:popupCharacters="‘’" + /> <Key android:codes="58" android:keyLabel=":"/> <Key android:codes="59" android:keyLabel=";"/> <Key android:codes="47" android:keyLabel="/" /> @@ -136,4 +139,4 @@ android:iconPreview="@drawable/sym_keyboard_feedback_return" /> </Row> -</Keyboard>
\ No newline at end of file +</Keyboard> diff --git a/res/xml/kbd_symbols_shift.xml b/res/xml/kbd_symbols_shift.xml index 56428a3ad..d83594a24 100755 --- a/res/xml/kbd_symbols_shift.xml +++ b/res/xml/kbd_symbols_shift.xml @@ -29,7 +29,10 @@ <Key android:keyLabel="~" android:keyEdgeFlags="left"/> <Key android:keyLabel="`"/> <Key android:keyLabel="|"/> - <Key android:keyLabel="•"/> + <Key android:keyLabel="•" + android:popupKeyboard="@xml/kbd_popup_template" + android:popupCharacters="♪♥♠♦♣" + /> <Key android:keyLabel="√"/> <Key android:keyLabel="π"/> <Key android:keyLabel="÷"/> @@ -44,7 +47,10 @@ <Key android:keyLabel="¢"/> <Key android:keyLabel="€"/> <Key android:keyLabel="°"/> - <Key android:keyLabel="^"/> + <Key android:keyLabel="^" + android:popupKeyboard="@xml/kbd_popup_template" + android:popupCharacters="↑↓←→" + /> <Key android:keyLabel="_"/> <Key android:keyLabel="=" android:popupKeyboard="@xml/kbd_popup_template" @@ -61,7 +67,10 @@ <Key android:keyLabel="™"/> <Key android:keyLabel="®"/> <Key android:keyLabel="©"/> - <Key android:keyLabel="¶"/> + <Key android:keyLabel="¶" + android:popupKeyboard="@xml/kbd_popup_template" + android:popupCharacters="§" + /> <Key android:keyLabel="\\"/> <Key android:keyLabel="<" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/src/com/android/inputmethod/latin/KeyboardSwitcher.java index c82587b71..c7f90946d 100644 --- a/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -147,6 +147,13 @@ public class KeyboardSwitcher { if (!mKeyboards.containsKey(id)) { LatinKeyboard keyboard = new LatinKeyboard( mContext, id.mXml, id.mMode); + if (id.mMode == KEYBOARDMODE_NORMAL + || id.mMode == KEYBOARDMODE_URL + || id.mMode == KEYBOARDMODE_IM + || id.mMode == KEYBOARDMODE_EMAIL) { + keyboard.setExtension(R.xml.kbd_extension); + } + if (id.mEnableShiftLock) { keyboard.enableShiftLock(); } diff --git a/src/com/android/inputmethod/latin/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java index a6cf312d2..d72710e5b 100644 --- a/src/com/android/inputmethod/latin/LatinIME.java +++ b/src/com/android/inputmethod/latin/LatinIME.java @@ -673,6 +673,7 @@ public class LatinIME extends InputMethodService } private void handleShift() { + mHandler.removeMessages(MSG_UPDATE_SHIFT_STATE); Keyboard currentKeyboard = mInputView.getKeyboard(); if (mKeyboardSwitcher.isAlphabetMode()) { // Alphabet keyboard diff --git a/src/com/android/inputmethod/latin/LatinKeyboard.java b/src/com/android/inputmethod/latin/LatinKeyboard.java index 9b04aa264..e68e01ded 100644 --- a/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -31,6 +31,8 @@ public class LatinKeyboard extends Keyboard { private Drawable mOldShiftPreviewIcon; private Key mShiftKey; private Key mEnterKey; + + private int mExtensionResId; private static final int SHIFT_OFF = 0; private static final int SHIFT_ON = 1; @@ -191,6 +193,14 @@ public class LatinKeyboard extends Keyboard { } } + public void setExtension(int resId) { + mExtensionResId = resId; + } + + public int getExtension() { + return mExtensionResId; + } + static class LatinKey extends Keyboard.Key { private boolean mShiftLockEnabled; diff --git a/src/com/android/inputmethod/latin/LatinKeyboardView.java b/src/com/android/inputmethod/latin/LatinKeyboardView.java index d9ff0aa8c..ecbd1adfb 100644 --- a/src/com/android/inputmethod/latin/LatinKeyboardView.java +++ b/src/com/android/inputmethod/latin/LatinKeyboardView.java @@ -16,6 +16,8 @@ package com.android.inputmethod.latin; +import java.util.List; + import android.content.Context; import android.graphics.Canvas; import android.inputmethodservice.Keyboard; @@ -25,9 +27,9 @@ import android.os.Handler; import android.os.Message; import android.os.SystemClock; import android.util.AttributeSet; +import android.view.LayoutInflater; import android.view.MotionEvent; - -import java.util.List; +import android.widget.PopupWindow; public class LatinKeyboardView extends KeyboardView { @@ -66,7 +68,115 @@ public class LatinKeyboardView extends KeyboardView { } } - + private boolean mExtensionVisible; + private LatinKeyboardView mExtension; + private PopupWindow mExtensionPopup; + private boolean mFirstEvent; + + @Override + public boolean onTouchEvent(MotionEvent me) { + if (((LatinKeyboard) getKeyboard()).getExtension() == 0) { + return super.onTouchEvent(me); + } + if (me.getY() < 0) { + if (mExtensionVisible) { + int action = me.getAction(); + if (mFirstEvent) action = MotionEvent.ACTION_DOWN; + mFirstEvent = false; + MotionEvent translated = MotionEvent.obtain(me.getEventTime(), me.getEventTime(), + action, + me.getX(), me.getY() + mExtension.getHeight(), me.getMetaState()); + boolean result = mExtension.onTouchEvent(translated); + translated.recycle(); + if (me.getAction() == MotionEvent.ACTION_UP + || me.getAction() == MotionEvent.ACTION_CANCEL) { + closeExtension(); + } + return result; + } else { + if (openExtension()) { + MotionEvent cancel = MotionEvent.obtain(me.getDownTime(), me.getEventTime(), + MotionEvent.ACTION_CANCEL, me.getX() - 100, me.getY() - 100, 0); + super.onTouchEvent(cancel); + cancel.recycle(); + if (mExtension.getHeight() > 0) { + MotionEvent translated = MotionEvent.obtain(me.getEventTime(), + me.getEventTime(), + MotionEvent.ACTION_DOWN, + me.getX(), me.getY() + mExtension.getHeight(), + me.getMetaState()); + mExtension.onTouchEvent(translated); + translated.recycle(); + } else { + mFirstEvent = true; + } + } + return true; + } + } else if (mExtensionVisible) { + closeExtension(); + // Send a down event into the main keyboard first + MotionEvent down = MotionEvent.obtain(me.getEventTime(), me.getEventTime(), + MotionEvent.ACTION_DOWN, + me.getX(), me.getY(), me.getMetaState()); + super.onTouchEvent(down); + down.recycle(); + // Send the actual event + return super.onTouchEvent(me); + } else { + return super.onTouchEvent(me); + } + } + + private boolean openExtension() { + if (((LatinKeyboard) getKeyboard()).getExtension() == 0) return false; + makePopupWindow(); + mExtensionVisible = true; + return true; + } + + private void makePopupWindow() { + if (mExtensionPopup == null) { + int[] windowLocation = new int[2]; + mExtensionPopup = new PopupWindow(getContext()); + mExtensionPopup.setBackgroundDrawable(null); + LayoutInflater li = (LayoutInflater) getContext().getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + mExtension = (LatinKeyboardView) li.inflate(R.layout.input, null); + mExtension.setOnKeyboardActionListener((LatinIME) getContext()); + mExtension.setPopupParent(this); + mExtension.setPopupOffset(0, -windowLocation[1]); + Keyboard keyboard; + mExtension.setKeyboard(keyboard = new LatinKeyboard(getContext(), + ((LatinKeyboard) getKeyboard()).getExtension())); + mExtensionPopup.setContentView(mExtension); + mExtensionPopup.setWidth(getWidth()); + mExtensionPopup.setHeight(keyboard.getHeight()); + getLocationInWindow(windowLocation); + // TODO: Fix the "- 30". + mExtension.setPopupOffset(0, -windowLocation[1] - 30); + mExtensionPopup.showAtLocation(this, 0, 0, -keyboard.getHeight() + + windowLocation[1]); + } else { + mExtension.setVisibility(VISIBLE); + } + } + + @Override + public void closing() { + super.closing(); + if (mExtensionPopup != null && mExtensionPopup.isShowing()) { + mExtensionPopup.dismiss(); + mExtensionPopup = null; + } + } + + private void closeExtension() { + mExtension.setVisibility(INVISIBLE); + mExtension.closing(); + mExtensionVisible = false; + } + /**************************** INSTRUMENTATION *******************************/ static final boolean DEBUG_AUTO_PLAY = false; |