android-2.1_r1 snapshot

main
The Android Open Source Project 2010-01-12 15:19:19 -08:00
parent 68eb1b1932
commit 0477aa1614
12 changed files with 97 additions and 53 deletions

View File

@ -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">".net"</string>
<string name="popular_domain_1" msgid="1370572248164278467">".cz"</string>
<string name="popular_domain_2" msgid="3036812463748402878">".org"</string>
<string name="popular_domain_3" msgid="8718639560809452028">".biz"</string>
<string name="popular_domain_4" msgid="35359437471311470">".cz"</string>
<string name="popular_domain_3" msgid="8718639560809452028">".net"</string>
<string name="popular_domain_4" msgid="35359437471311470">".eu"</string>
</resources>

View File

@ -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">"Android-tastaturindstillinger"</string>
<string name="vibrate_on_keypress" msgid="5258079494276955460">"Vibrer ved tastetryk"</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="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">"Øg størrelsen på tekstfeltet"</string>
<string name="prediction_landscape" msgid="4874601565593216183">"Forøg tekstfeltets størrelse"</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">"Skriv første bogstav i en sætning med stort"</string>
<string name="auto_cap_summary" msgid="3260681697600786825">"Første bogstav i en sætning skrives 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 forslag til ord, mens du indtaster"</string>
<string name="show_suggestions_summary" msgid="1989672863935759654">"Vis ordforslag under indtastning"</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 åbner når som helst, du berører et tekstfelt"</b></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_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 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_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_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">"Færdig"</string>
<string name="label_done_key" msgid="2441578748772529288">"Udfør"</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>"Tastaturindstillinger"\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>"Indstillinger for tastatur"\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>

View File

@ -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>

View File

@ -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>

View File

@ -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 as pronúncias."</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="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>

View File

@ -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>

View File

@ -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>

View File

@ -27,7 +27,7 @@
<Row android:rowEdgeFlags="top">
<Key android:keyLabel=";" android:keyEdgeFlags="left" />
<Key android:keyLabel="\\" />
<Key android:keyLabel="," />
<Key android:keyLabel="&amp;" />
<Key android:keyLabel="(" />
<Key android:keyLabel=")" />

View File

@ -36,7 +36,6 @@ public class BinaryDictionary extends Dictionary {
private int mNativeDict;
private int[] mInputCodes = new int[MAX_WORD_LENGTH * MAX_ALTERNATIVES];
private WordCallback mWordCallback;
private char[] mOutputChars = new char[MAX_WORD_LENGTH * MAX_WORDS];
private int[] mFrequencies = new int[MAX_WORDS];
@ -75,7 +74,6 @@ public class BinaryDictionary extends Dictionary {
@Override
public void getWords(final WordComposer codes, final WordCallback callback) {
mWordCallback = callback;
final int codesSize = codes.size();
// Wont deal with really long words.
if (codesSize > MAX_WORD_LENGTH - 1) return;
@ -123,7 +121,7 @@ public class BinaryDictionary extends Dictionary {
@Override
public boolean isValidWord(CharSequence word) {
if (word == null) return false;
char[] chars = word.toString().toLowerCase().toCharArray();
char[] chars = word.toString().toCharArray();
return isValidWordNative(mNativeDict, chars, chars.length);
}

View File

@ -20,6 +20,8 @@ import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.SystemClock;
import android.provider.ContactsContract.Contacts;
public class ContactsDictionary extends ExpandableDictionary {
@ -37,6 +39,11 @@ public class ContactsDictionary extends ExpandableDictionary {
private long mLastLoadedContacts;
private boolean mUpdatingContacts;
// Use this lock before touching mUpdatingContacts & mRequiresDownload
private Object mUpdatingLock = new Object();
public ContactsDictionary(Context context) {
super(context);
// Perform a managed query. The Activity will handle closing and requerying the cursor
@ -46,11 +53,15 @@ public class ContactsDictionary extends ExpandableDictionary {
cres.registerContentObserver(Contacts.CONTENT_URI, true, mObserver = new ContentObserver(null) {
@Override
public void onChange(boolean self) {
mRequiresReload = true;
synchronized (mUpdatingLock) {
mRequiresReload = true;
}
}
});
loadDictionary();
synchronized (mUpdatingLock) {
loadDictionaryAsyncLocked();
}
}
public synchronized void close() {
@ -60,29 +71,37 @@ public class ContactsDictionary extends ExpandableDictionary {
}
}
private synchronized void loadDictionary() {
long now = android.os.SystemClock.uptimeMillis();
private synchronized void loadDictionaryAsyncLocked() {
long now = SystemClock.uptimeMillis();
if (mLastLoadedContacts == 0
|| now - mLastLoadedContacts > 30 * 60 * 1000 /* 30 minutes */) {
Cursor cursor = getContext().getContentResolver()
.query(Contacts.CONTENT_URI, PROJECTION, null, null, null);
if (cursor != null) {
addWords(cursor);
if (!mUpdatingContacts) {
mUpdatingContacts = true;
mRequiresReload = false;
new LoadContactsTask().execute();
}
mRequiresReload = false;
mLastLoadedContacts = now;
}
}
@Override
public synchronized void getWords(final WordComposer codes, final WordCallback callback) {
if (mRequiresReload) loadDictionary();
synchronized (mUpdatingLock) {
// If we need to update, start off a background task
if (mRequiresReload) loadDictionaryAsyncLocked();
// Currently updating contacts, don't return any results.
if (mUpdatingContacts) return;
}
super.getWords(codes, callback);
}
@Override
public synchronized boolean isValidWord(CharSequence word) {
if (mRequiresReload) loadDictionary();
synchronized (mUpdatingLock) {
// If we need to update, start off a background task
if (mRequiresReload) loadDictionaryAsyncLocked();
if (mUpdatingContacts) return false;
}
return super.isValidWord(word);
}
@ -115,7 +134,10 @@ public class ContactsDictionary extends ExpandableDictionary {
// Safeguard against adding really long words. Stack
// may overflow due to recursion
if (word.length() < maxWordLength) {
// Also don't add single letter words, possibly confuses
// capitalization of i.
final int wordLen = word.length();
if (wordLen < maxWordLength && wordLen > 1) {
super.addWord(word, 128);
}
}
@ -127,4 +149,27 @@ public class ContactsDictionary extends ExpandableDictionary {
}
cursor.close();
}
private class LoadContactsTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... v) {
Cursor cursor = getContext().getContentResolver()
.query(Contacts.CONTENT_URI, PROJECTION, null, null, null);
if (cursor != null) {
addWords(cursor);
}
mLastLoadedContacts = SystemClock.uptimeMillis();
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
synchronized (mUpdatingLock) {
mUpdatingContacts = false;
}
super.onPostExecute(result);
}
}
}

View File

@ -105,8 +105,8 @@ public class ExpandableDictionary extends Dictionary {
if (wordLength == depth + 1) {
// Terminate this word
childNode.terminal = true;
childNode.frequency += frequency; // If there are multiple similar words
if (childNode.frequency > 256) childNode.frequency = 256;
childNode.frequency = Math.max(frequency, childNode.frequency);
if (childNode.frequency > 255) childNode.frequency = 255;
return;
}
if (childNode.children == null) {

View File

@ -809,7 +809,8 @@ public class LatinIME extends InputMethodService
//|| mCorrectionMode == mSuggest.CORRECTION_FULL;
CharSequence typedWord = mWord.getTypedWord();
// If we're in basic correct
boolean typedWordValid = mSuggest.isValidWord(typedWord);
boolean typedWordValid = mSuggest.isValidWord(typedWord) ||
(preferCapitalization() && mSuggest.isValidWord(typedWord.toString().toLowerCase()));
if (mCorrectionMode == Suggest.CORRECTION_FULL) {
correctionAvailable |= typedWordValid;
}