diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index 29b8565ba..38ac20200 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -89,8 +89,8 @@ "Přidržením klávesy zobrazte možnosti"\n\n"Použijte interpunkční znaménka a diakritiku." "Nastavení klávesnice"\n\n"Dotkněte se klávesy ""?123"" a přidržte ji." ".com" - ".net" + ".cz" ".org" - ".biz" - ".cz" + ".net" + ".eu" diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml index 3af5e439a..d4dd23a65 100644 --- a/res/values-da/strings.xml +++ b/res/values-da/strings.xml @@ -16,8 +16,8 @@ "Android-tastatur" - "Android-tastaturindstillinger" - "Vibrer ved tastetryk" + "Indstillinger for Android-tastatur" + "Vibration ved tastetryk" "Lyd ved tastetryk" "Ret stavefejl" "Aktiver fejlretning af input" @@ -29,17 +29,17 @@ "Indstillinger for ordforslag" "Aktiver automatisk udfyldelse, når du indtaster" "Automatisk udfyldelse" - "Øg størrelsen på tekstfeltet" + "Forøg tekstfeltets størrelse" "Skjul ordforslag i landskabsvisning" "Skriv aut. med stort" - "Skriv første bogstav i en sætning med stort" + "Første bogstav i en sætning skrives med stort" "Foretag automatisk tegnsætning" "Hurtige løsninger" "Retter almindelige stavefejl" "Vis forslag" - "Vis forslag til ord, mens du indtaster" + "Vis ordforslag under indtastning" "Udfyld automatisk" "Mellemrumstast og tegnsætning indsætter automatisk fremhævet ord" @@ -70,15 +70,15 @@ "Tryk og hold på ordet længst til venstre for at føje det til ordbogen" "Berør dette tip for at fortsætte »" "Berør her for at lukke dette tip og begynde at indtaste!" - "Tastaturet åbner når som helst, du berører et tekstfelt" + "Tastaturet åbnes, når du berører et tekstfelt" "Berør og hold en tast nede for at vise accenter"\n"(ø, ö, ô, ó osv.)" "Skift til tal og symboler ved at røre denne tast" - "Gå tilbage til bogstaver ved at berøre denne tast igen" - "Berør og hold denne tast nede for at ændre tastaturindstillingerne, som f.eks. automatisk udfyldelse" + "Gå tilbage til bogstaverne ved at berøre denne tast igen" + "Berør og hold denne tast nede for at ændre indstillingerne for tastaturet, som f.eks. automatisk udfyldelse" "Prøv det!" "Gå" "Næste" - "Færdig" + "Udfør" "Send" "?123" "123" @@ -87,7 +87,7 @@ "Åbn tastaturet"\n\n"Tryk på et hvilket som helst tekstfelt." "Luk tastaturet"\n\n"Tryk på Tilbagetasten." "Tryk på og hold en tast nede for valgmuligheder"\n\n"Få adgang til tegnsætning og accenter." - "Tastaturindstillinger"\n\n"Tryk på og hold tasten ""?123"" nede." + "Indstillinger for tastatur"\n\n"Tryk på og hold tasten ""?123"" nede." ".com" ".net" ".org" diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index d5e7f8dc8..e28fcee29 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -39,9 +39,9 @@ "クイックフィックス" "よくある誤字・脱字を修正します" "入力候補を表示" - "入力時に入力候補を表示します" + "入力時に入力候補を表示する" "オートコンプリート" - "スペースまたは句読点キーで反転表示されている変換候補を挿入する" + "反転表示されている変換候補をスペースまたは句読点キーで挿入する" "なし" "基本" diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index 570780f78..e86c609ad 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -39,9 +39,9 @@ "빠른 수정" "자주 발생하는 오타를 수정합니다." "추천 단어 표시" - "글자를 입력하는 동안 추천 단어를 표시합니다." + "글자를 입력하는 동안 추천 단어를 표시" "자동 완성" - "스페이스바와 문장부호 키로 강조 표시된 단어를 자동 삽입합니다." + "스페이스바와 문장부호 키로 강조 표시된 단어를 자동 삽입" "없음" "기본" diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 978215ff4..6995e2272 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -86,7 +86,7 @@ "ALT" "Abra o teclado"\n\n"Toque em qualquer campo de texto." "Feche o teclado"\n\n"Pressione a tecla Voltar." - "Toque e mantenha pressionada uma tecla para ver as opções"\n\n"Acesse a pontuação e as pronúncias." + "Toque e mantenha pressionada uma tecla para ver as opções"\n\n"Acesse a pontuação e os acentos." "Configurações de teclado"\n\n"Toque e mantenha pressionada a tecla ""?123""." ".com" ".net" diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 25c5d341f..de7da45f0 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"> "Клавиатура Android" "Настройки клавиатуры Android" - "Вибрация при нажатии клавиш" - "Звук при нажатии клавиш" + "Виброотклик клавиш" + "Звук клавиш" "Исправлять опечатки" "Включить исправление ошибок при вводе" "Ошибки при вводе в горизонтальной ориентации" @@ -26,12 +26,12 @@ "Предложение слов" "Автоматически исправлять предыдущее слово" "Предложение слов" - "Настройки предложения слов" + "Настройки подсказок" "Включить автоматическое завершение слов при вводе" "Автоматическое завершение" "Увеличить размер текстового поля" "Скрывать предложение слов в горизонтальной ориентации" - "Заглавные автоматически" + "Автоподст. заглавных" "Делать заглавной первую букву предложения" "Автоматическая пунктуация" @@ -39,9 +39,9 @@ "Быстрое исправление" "Исправлять распространенные опечатки" "Предлагать варианты" - "Предлагать варианты во время ввода" + "Предлагать варианты слов во время ввода" "Автозавершение" - "Пробел или знак препинания вставляют выделенное слово" + "При нажатии пробела или знака препинания вставлять предложенное слово" "Нет" "Основной" diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index c68b795c9..8eb907d9d 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -18,7 +18,7 @@ "Android 键盘" "Android 键盘设置" "按键时振动" - "按键时发出声音" + "按键时播放音效" "纠正输入错误" "启用输入错误纠正" "横向输入错误" @@ -27,7 +27,7 @@ "自动纠正之前的字词" "字词建议" "字词建议设置" - "输入时启用自动完成" + "输入时启用自动填写功能" "自动完成" "增加文本域的大小" "在横向视图中隐藏字词建议" @@ -39,9 +39,9 @@ "快速纠正" "纠正常见的输入错误" "显示建议" - "输入时显示建议的字词" - "自动输入" - "按空格和标点会自动插入突出显示的字词" + "输入时启用联想提示" + "自动填写" + "按空格键和标点符号时自动插入突出显示的字词" "无" "基本模式" @@ -64,17 +64,17 @@ "ç" "ýÿ" "i" - "长按某些键可看到重音符号(例如 ø、ö 等)" + "按住某个键可看到重音符号(例如 ø、ö 等)" "随时可以通过按后退键 ↶ 关闭键盘" "访问数字和符号" "长按最左侧的字可将其添加到词典中" "轻触此提示继续 »" "轻触此处可关闭该提示,然后便可开始输入内容!" "轻触文本字段即可打开键盘" - "长按某些键可看到重音符号"\n"(例如 ø、ö、ô、ó 等)" + "按住某个键可看到重音符号"\n"(例如 ø、ö、ô、ó 等)" "轻触该键可切换到数字和符号输入模式" "再次轻触该键可返回字母输入模式" - "长按该键可更改键盘设置,例如自动输入" + "长按该键可更改键盘设置,例如自动填写" "试试吧!" "开始" "下一步" @@ -86,7 +86,7 @@ "ALT" "打开键盘"\n\n"轻触任意文本字段。" "关闭键盘"\n\n"按“返回”键。" - "长按某些键可开启其他字符选项"\n\n"访问标点和重音符号。" + "按住某个键可开启其他字符选项"\n\n"访问标点和重音符号。" "键盘设置"\n\n"长按 ""?123"" 键。" ".com" ".net" diff --git a/res/xml/popup_punctuation.xml b/res/xml/popup_punctuation.xml index 7f9f61129..518e3f1f2 100644 --- a/res/xml/popup_punctuation.xml +++ b/res/xml/popup_punctuation.xml @@ -27,7 +27,7 @@ - + diff --git a/src/com/android/inputmethod/latin/BinaryDictionary.java b/src/com/android/inputmethod/latin/BinaryDictionary.java index e7470a8fc..14c543514 100644 --- a/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -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); } diff --git a/src/com/android/inputmethod/latin/ContactsDictionary.java b/src/com/android/inputmethod/latin/ContactsDictionary.java index 6f7f4b6a4..fd7ba55fc 100644 --- a/src/com/android/inputmethod/latin/ContactsDictionary.java +++ b/src/com/android/inputmethod/latin/ContactsDictionary.java @@ -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 { + @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); + } + + } } diff --git a/src/com/android/inputmethod/latin/ExpandableDictionary.java b/src/com/android/inputmethod/latin/ExpandableDictionary.java index a136ee7f4..1589168ee 100644 --- a/src/com/android/inputmethod/latin/ExpandableDictionary.java +++ b/src/com/android/inputmethod/latin/ExpandableDictionary.java @@ -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) { diff --git a/src/com/android/inputmethod/latin/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java index 8b76dbd39..a6cf312d2 100644 --- a/src/com/android/inputmethod/latin/LatinIME.java +++ b/src/com/android/inputmethod/latin/LatinIME.java @@ -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; }