From fae3131ea7ef4cb5b88bcdccba75eec664e96e07 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 24 Jul 2012 17:32:45 +0900 Subject: Add Indonesian keyboard layout Bug: 6867914 Change-Id: Id605cc20f3e38c4277c3705622f3078f307d971a --- java/res/xml/method.xml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'java') diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 7f8a23a0e..acb50a7fd 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -41,6 +41,7 @@ hi: Hindi/hindi hr: Croatian/qwertz hu: Hungarian/qwertz + id: Indonesian/qwerty is: Icelandic/qwerty it: Italian/qwerty iw: Hebrew/hebrew @@ -186,6 +187,12 @@ android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection" /> + Date: Tue, 24 Jul 2012 18:51:44 +0900 Subject: Add Tagalog keyboard layout Bug: 6867914 Change-Id: I78ca6216cc74f8d34291950c05c810c800a3ddba --- java/res/xml/method.xml | 7 +++ .../keyboard/internal/KeyboardTextsSet.java | 55 +++++++++++++++++ .../res/values-tl/donottranslate-more-keys.xml | 70 ++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 tools/maketext/res/values-tl/donottranslate-more-keys.xml (limited to 'java') diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 7f8a23a0e..e8a276daa 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -61,6 +61,7 @@ sr: Serbian/south_slavic sv: Swedish/nordic th: Thai/thai + tl: Tagalog/spanish tr: Turkish/qwerty uk: Ukrainian/east_slavic vi: Vietnamese/qwerty @@ -307,6 +308,12 @@ android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="KeyboardLayoutSet=thai" /> + + + + + á,à,ä,â,ã,å,ą,æ,ā,ª + + é,è,ë,ê,ę,ė,ē + + í,ï,ì,î,į,ī + + ó,ò,ö,ô,õ,ø,œ,ō,º + + ú,ü,ù,û,ū + + ñ,ń + + ç,ć,č + -- cgit v1.2.3-83-g751a From 5876e779e4d166a47c80ddd33f3321fda71a353e Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 24 Jul 2012 18:00:06 +0900 Subject: Add Malay keyboard layout Bug: 6867914 Change-Id: I51367d3822b68df506335695912e68bc24199604 --- java/res/xml/method.xml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'java') diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 7f8a23a0e..3d5ade144 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -49,6 +49,7 @@ lt: Lithuanian/qwerty lv: Latvian/qwerty mk: Macedonian/south_slavic + ms: Malay/qwerty nb: Norwegian Bokmål/nordic nl: Dutch/qwerty pl: Polish/qwerty @@ -235,6 +236,12 @@ android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="KeyboardLayoutSet=south_slavic" /> + Date: Tue, 24 Jul 2012 19:15:33 +0900 Subject: Add Catalan keyboard layout Bug: 6867914 Change-Id: I9ab4aecc0a9605510da4ce01e571d6c10c738e0e --- java/res/xml/method.xml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'java') diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index b2a8a04e3..949c3dcc0 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 @@ -110,6 +111,12 @@ android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="KeyboardLayoutSet=bulgarian_bds" /> + Date: Tue, 24 Jul 2012 17:18:47 +0900 Subject: Add Seriban Latin keyboard layout as comments Bug: 6867914 Bug: 6867842 Change-Id: I3434434628e72fdb127d158de6c17fdfa77ee9c8 --- java/res/values/strings.xml | 9 +++++++++ java/res/xml/method.xml | 15 +++++++++++++++ .../keyboard/internal/KeyboardTextsSet.java | 19 +++++++++++++++++++ .../res/values-sr/donottranslate-more-keys.xml | 19 +++++++++++++++++++ 4 files changed, 62 insertions(+) (limited to 'java') diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 12abf8469..cb793cb4d 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -303,6 +303,15 @@ English (US) (%s) + No language diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 575bbf2c6..6994009a0 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -61,6 +61,7 @@ sk: Slovak/qwerty sl: Slovenian/qwerty sr: Serbian/south_slavic + (sr-Latn: Serbian/qwerty) # not yet implemented. sv: Swedish/nordic th: Thai/thai tl: Tagalog/spanish @@ -310,6 +311,20 @@ android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="SupportTouchPositionCorrection" /> + š,ß,ś + // U+010D: "č" LATIN SMALL LETTER C WITH CARON + // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA + // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE + // č,ç,ć + // U+010F: "ď" LATIN SMALL LETTER D WITH CARON + // ď + // 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 + // ž,ź,ż + // 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 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 @@ */ --> + + з @@ -30,6 +48,7 @@ ѐ ѝ + - - - + "Zadávání gesty" + "Napište slovo zadáním jeho písmen." "%s: Uloženo" "Přejít" "Další" 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 @@ "Väga agressiivne" "Järgmise sõna soovitused" "Eelmise sõna põhjal" - - - - + "Liigutusega sisest." + "Sisestage sõna, kirjutades sõna tähed sõrmega" "%s : salvestatud" "Mine" "Edasi" 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 @@ "Hyvin aggressiivinen" "Seuraavan sanan ehdotukset" "Perustuu edelliseen sanan" - - - - + "Eleiden syöttö" + "Syötä sana piirtämällä kirjaimet sormella" "%s : Tallennettu" "Siirry" "Seur." 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 @@ "बहुत तीव्र" "अगले शब्द सुझाव" "पिछले शब्द के आधार पर" - - - - + "जेस्‍चर इनपुट" + "किसी शब्द के अक्षरों को ट्रेस करके कोई शब्द इनपुट करें" "%s: सहेजा गया" "जाएं" "अगला" 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 @@ "Vrlo agresivno" "Prijedlozi za sljedeću riječ" "Na temelju prethodne riječi" - - - - + "Unos pokretom" + "Unos riječi ispisivanjem slova riječi" "%s : Spremljeno" "Idi" "Dalje" 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 @@ "Nagyon agresszív" "Következő szóra vonatkozó javaslatok" "Az előző szó alapján" - - - - + "Kézi bevitel" + "Szó beírása a betűk megrajzolásával" "%s : mentve" "Ugrás" "Tovább" 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 @@ "Sangat agresif" "Saran kata berikutnya" "Berdasarkan kata sebelumnya" - - - - + "Masukan isyarat" + "Masukkan kata dengan melacak huruf dari sebuah kata" "%s : Telah disimpan" "Buka" "Berikutnya" 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 @@ "最も強い" "次の入力候補" "前の語句に基づいた入力候補表示" - - - - + "ジェスチャー入力" + "単語の文字をトレースして単語を入力" "%s:保存しました" "実行" "次へ" 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 @@ "강" "다음 검색어 추천" "이전 단어에 기반한 추천" - - - - + "동작 입력" + "단어를 구성하는 문자를 따라감으로써 단어를 입력" "%s: 저장됨" "이동" "다음" 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 @@ "Labai agresyviai" "Kito žodžio pasiūlymai" "Pagal ankstesnį žodį" - - - - + "Įvestis gestais" + "Įveskite žodį brėždami jo raides" "%s: išsaugota" "Pradėti" "Kitas" 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 @@ "Ļoti radikāla" "Nākamie vārdu ieteikumi" "Pamatojoties uz iepriekšējo vārdu" - - - - + "Ievade ar žestu" + "Ievadiet vārdu, norādot tā burtus." "%s: saglabāts" "Sākt" "Tālāk" 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 @@ "Sangat agresif" "Cadangan perkataan seterusnya" "Berdasarkan perkataan sebelumnya" - - - - + "Input gerak isyarat" + "Masukkan perkataan dengan menyurih huruf perkataan itu." "%s : Disimpan" "Pergi" "Seterusnya" 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 @@ "Muito agressivo" "Sugestões para a palavra seguinte" "Com base na palavra anterior" - - - - + "Entrada por gesto" + "Introduza uma palavra traçando suas letras" "%s : Salvo" "Ir" "Avançar" 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 @@ "Foarte exigentă" "Sugestii pentru cuvântul următor" "Bazate pe cuvântul precedent" - - - - + "Utilizaţi gesturi" + "Introduceţi un cuvânt desenând literele acestuia" "%s: salvat" "OK" "Înainte" 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 @@ "Очень активно" "Подсказка для следующего слова" "Подсказки, основанные на предыдущих словах" - - - - + "Ввод жестами" + "Перемещайте палец от буквы к букве, чтобы составить слово" "%s: сохранено" "Поиск" "Далее" 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 @@ "Veľmi agresívne" "Návrhy ďalšieho slova" "Na základe predchádzajúceho slova" - - - - + "Zadávanie gestami" + "Napíšte slovo zadaním jeho písmen" "%s : Uložené" "Hľadať" "Ďalej" 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 @@ "Zelo strogo" "Predlogi za naslednjo besedo" "Na podlagi prejšnje besede" - - - - + "Vnos s potezo" + "Vnašanje besede z izsleditvijo črk" "%s: shranjeno" "Pojdi" "Naprej" 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 @@ "Веома агресивно" "Предлози за следећу реч" "На основу претходне речи" - - - - + "Унос покретом" + "Унесите реч исписивањем слова речи" "%s : Сачувано" "Иди" "Следеће" 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 @@ "Changamfu zaidi" "Mapendekezo ya neno lifuatalo" "Kulingana na neno la awali" - - - - + "Ingizo la ishara" + "Ingiza neno kwa kufuatilia herufi za neno" "%s : Imehifadhiwa" "Nenda" "Ifuatayo" 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 @@ "Çok geniş ölçekte" "Sonraki kelime önerileri" "Önceki kelimeye dayanarak" - - - - + "Hareket girişi" + "Bir kelimeyi harflerini izleyerek girin" "%s : Kaydedildi" "Git" "İleri" 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 @@ "Rất linh hoạt" "Đề xuất từ tiếp theo" "Dựa trên từ trước đó" - - - - + "Nhập bằng cử chỉ" + "Nhập từ bằng cách lần theo các chữ cái của từ" "%s : Đã lưu" "Tìm" "Tiếp theo" 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 @@ "改动极大" "下一字词建议" "根据上一个字词提供建议" - - - - + "手指操作输入" + "连笔书写输入字词" "%s:已保存" "开始" "下一步" -- cgit v1.2.3-83-g751a From 369e54cc338d8115d63138663b882f56208d7ec3 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 24 Jul 2012 15:56:25 +0900 Subject: Add Suggest initialization finish listener Bug: 6860204 Change-Id: I1e4c03c99415cd9bdea5a8556ff4093c33f0f508 --- java/src/com/android/inputmethod/latin/LatinIME.java | 12 ++++++++++-- java/src/com/android/inputmethod/latin/Suggest.java | 18 ++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d4b59c4cd..05dcee50b 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; + // TODO: Update gesture input enable state. + } + 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); } 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(); } -- cgit v1.2.3-83-g751a From 42208100d87769006d0448db604a2efa1048b5d3 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 25 Jul 2012 12:48:03 +0900 Subject: Use obsolete language code of Indonesian The java.lang.Locale will transform the official language code "id" to the obsolete "in". (new Locale("id")).getLanguageCode() returns "in". To keep String representation and Locale compatible, we should use the obsolete "in" as string representation. This is exactly the same situation of Hebrew ("he" and "iw"). Bug: 6867914 Change-Id: I1a6ea6336d55cbf8a214f025aecf65308fb76140 --- java/res/xml/method.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'java') diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 41d439e95..b1315c002 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -42,10 +42,10 @@ hi: Hindi/hindi hr: Croatian/qwertz hu: Hungarian/qwertz - id: Indonesian/qwerty + 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 @@ -197,9 +197,10 @@ android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection" /> + -- cgit v1.2.3-83-g751a From 0657b9698a110f8e895448d829478982ce37b6d1 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 23 Jul 2012 14:59:19 +0900 Subject: Update gesture mode state when dictionary gets available Bug: 6860204 Change-Id: I840b7bf1983ab92fa4e0b180129176539e96409f --- .../inputmethod/keyboard/KeyboardSwitcher.java | 16 ++++++-------- .../android/inputmethod/keyboard/KeyboardView.java | 8 +++---- .../inputmethod/keyboard/MainKeyboardView.java | 8 ++++++- .../inputmethod/keyboard/PointerTracker.java | 25 +++++++++++----------- .../com/android/inputmethod/latin/LatinIME.java | 17 ++++++++++++--- 5 files changed, 44 insertions(+), 30 deletions(-) (limited to 'java') 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..a6c439294 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -111,8 +111,8 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { private int mDelayAfterPreview; private ViewGroup 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. */ @@ -443,8 +443,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 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..56c3d46b9 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -42,8 +42,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 +199,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 +208,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 +242,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 +251,7 @@ public class PointerTracker { tracker.mKeyboardLayoutHasBeenChanged = true; } final Keyboard keyboard = keyDetector.getKeyboard(); - updateGestureInputEnabledState(keyboard, gestureInputEnabledByUser); + updateGestureHandlingMode(keyboard, shouldHandleGesture); } public static void dismissAllKeyPreviews() { @@ -669,8 +668,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 +713,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/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 05dcee50b..7d79886fa 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -430,7 +430,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen @Override public void onUpdateMainDictionaryAvailability(boolean isMainDictionaryAvailable) { mIsMainDictionaryAvailable = isMainDictionaryAvailable; - // TODO: Update gesture input enable state. + updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability(); } private void initSuggest() { @@ -681,6 +681,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } switcher.loadKeyboard(editorInfo, mCurrentSettings); + updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability(); if (mSuggestionStripView != null) mSuggestionStripView.clear(); @@ -2052,18 +2053,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) { -- cgit v1.2.3-83-g751a From e68385871ac04d2c557d7997bb81be8a4e874f99 Mon Sep 17 00:00:00 2001 From: Tom Ouyang Date: Tue, 24 Jul 2012 19:46:24 -0700 Subject: Fix gesture trail rendering on tablet. Bug: 6867837 Change-Id: I54dceee1c83679f78462104d6cee1f2300a0cfc2 --- .../android/inputmethod/keyboard/KeyboardView.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index a6c439294..b9c591d4a 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -888,23 +888,26 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { mDrawingHandler.dismissKeyPreview(mDelayAfterPreview, tracker); } - private static class PreviewView extends RelativeLayout { - KeyPreviewDrawParams mParams; - Paint mGesturePaint; + private static class PreviewPlacerView extends RelativeLayout { + private final Paint mGesturePaint; + final int mCoordinateX; + final int mCoordinateY; - public PreviewView(Context context, KeyPreviewDrawParams params, Paint gesturePaint) { + public PreviewPlacerView(Context context, int coordinateX, int coordinateY, + Paint gesturePaint) { super(context); setWillNotDraw(false); - mParams = params; mGesturePaint = gesturePaint; + mCoordinateX = coordinateX; + mCoordinateY = coordinateY; } @Override public void onDraw(Canvas canvas) { super.onDraw(canvas); - canvas.translate(mParams.mCoordinates[0], mParams.mCoordinates[1]); + canvas.translate(mCoordinateX, mCoordinateY); PointerTracker.drawGestureTrailForAllPointerTrackers(canvas, mGesturePaint); - canvas.translate(-mParams.mCoordinates[0], -mParams.mCoordinates[1]); + canvas.translate(-mCoordinateX, -mCoordinateY); } } @@ -917,7 +920,9 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } private void createPreviewPlacer() { - mPreviewPlacer = new PreviewView(getContext(), mKeyPreviewDrawParams, mGesturePaint); + getLocationInWindow(mKeyPreviewDrawParams.mCoordinates); + mPreviewPlacer = new PreviewPlacerView(getContext(), mKeyPreviewDrawParams.mCoordinates[0], + mKeyPreviewDrawParams.mCoordinates[1], mGesturePaint); final ViewGroup windowContentView = (ViewGroup)getRootView().findViewById(android.R.id.content); windowContentView.addView(mPreviewPlacer); -- cgit v1.2.3-83-g751a From a28f6c9a18e9eaea3798e15786ada2a6db526440 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 25 Jul 2012 15:51:01 +0900 Subject: Add Swahili keyboard layout Bug: 6867914 Change-Id: I2b9b0a06ff49a2afe16ec7a0ace0503d1658d413 --- java/res/xml/method.xml | 7 +++ .../keyboard/internal/KeyboardTextsSet.java | 51 +++++++++++++++++ .../res/values-sw/donottranslate-more-keys.xml | 65 ++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 tools/maketext/res/values-sw/donottranslate-more-keys.xml (limited to 'java') diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index b1315c002..b448e00a3 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -64,6 +64,7 @@ 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 @@ -339,6 +340,12 @@ android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection" /> + + + + + + à,á,â,ä,æ,ã,å,ā + + è,é,ê,ë,ē + + î,ï,í,ī,ì + + ô,ö,ò,ó,œ,ø,ō,õ + + û,ü,ù,ú,ū + + ß + + ñ + + ç + g\' + -- cgit v1.2.3-83-g751a From 2f81757c3a5eb50d41ce19fb534f72cbf607a997 Mon Sep 17 00:00:00 2001 From: Tom Ouyang Date: Fri, 20 Jul 2012 21:01:44 +0900 Subject: Add dynamic floating preview for incremental gesture recognition. Change-Id: I7ba7ac24aa96a0ff19267997c5b58853079bc6dc --- java/res/values/dimens.xml | 8 + .../android/inputmethod/keyboard/KeyboardView.java | 70 ++------- .../inputmethod/keyboard/PointerTracker.java | 21 +-- .../keyboard/internal/GestureStroke.java | 7 - .../keyboard/internal/PreviewPlacerView.java | 172 +++++++++++++++++++++ .../com/android/inputmethod/latin/LatinIME.java | 4 + 6 files changed, 207 insertions(+), 75 deletions(-) create mode 100644 java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java (limited to 'java') 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 @@ 27dp 3 36 + + + 2.5dp + 35dp + 75dp + 17.5dp + 7.5dp + 1.0dp diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index b9c591d4a..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,7 +106,7 @@ 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 {@link KeyboardView} should handle gesture events. */ protected boolean mShouldHandleGesture; @@ -125,14 +122,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { private final HashSet mInvalidatedKeys = new HashSet(); /** 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 sTextHeightCache = new SparseArray(); @@ -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. @@ -888,29 +875,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { mDrawingHandler.dismissKeyPreview(mDelayAfterPreview, tracker); } - private static class PreviewPlacerView extends RelativeLayout { - private final Paint mGesturePaint; - final int mCoordinateX; - final int mCoordinateY; - - public PreviewPlacerView(Context context, int coordinateX, int coordinateY, - Paint gesturePaint) { - super(context); - setWillNotDraw(false); - mGesturePaint = gesturePaint; - mCoordinateX = coordinateX; - mCoordinateY = coordinateY; - } - - @Override - public void onDraw(Canvas canvas) { - super.onDraw(canvas); - canvas.translate(mCoordinateX, mCoordinateY); - PointerTracker.drawGestureTrailForAllPointerTrackers(canvas, mGesturePaint); - canvas.translate(-mCoordinateX, -mCoordinateY); - } - } - private void addKeyPreview(TextView keyPreview) { if (mPreviewPlacer == null) { createPreviewPlacer(); @@ -920,31 +884,31 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } private void createPreviewPlacer() { - getLocationInWindow(mKeyPreviewDrawParams.mCoordinates); - mPreviewPlacer = new PreviewPlacerView(getContext(), mKeyPreviewDrawParams.mCoordinates[0], - mKeyPreviewDrawParams.mCoordinates[1], 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/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index 56c3d46b9..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; @@ -296,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(); @@ -524,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; } @@ -535,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; 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/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 mPointers = new SparseArray(); + + 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 7d79886fa..9f9d07b3a 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1343,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 @@ -1350,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; } -- cgit v1.2.3-83-g751a From c4376db0f015e1c2f0eb6283cc275b2da03cbb19 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 25 Jul 2012 19:57:44 +0900 Subject: Remove unused setProximityCorrectionEnabled() methods Change-Id: I03aa6608ee435b36377de41684162b303740f571 --- .../com/android/inputmethod/keyboard/KeyDetector.java | 9 --------- .../android/inputmethod/keyboard/MainKeyboardView.java | 17 ----------------- java/src/com/android/inputmethod/latin/LatinIME.java | 1 - 3 files changed, 27 deletions(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java index 9abc79d3c..a3b7776b3 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java +++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java @@ -25,7 +25,6 @@ public class KeyDetector { private Keyboard mKeyboard; private int mCorrectionX; private int mCorrectionY; - private boolean mProximityCorrectOn; /** * This class handles key detection. @@ -64,14 +63,6 @@ public class KeyDetector { return mKeyboard; } - public void setProximityCorrectionEnabled(boolean enabled) { - mProximityCorrectOn = enabled; - } - - public boolean isProximityCorrectionEnabled() { - return mProximityCorrectOn; - } - public boolean alwaysAllowsSlidingInput() { return false; } diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 110f3c3e3..7b4a3d227 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -497,23 +497,6 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key mHasDistinctMultitouch = hasDistinctMultitouch; } - /** - * When enabled, calls to {@link KeyboardActionListener#onCodeInput} will include key - * codes for adjacent keys. When disabled, only the primary key code will be - * reported. - * @param enabled whether or not the proximity correction is enabled - */ - public void setProximityCorrectionEnabled(boolean enabled) { - mKeyDetector.setProximityCorrectionEnabled(enabled); - } - - /** - * Returns true if proximity correction is enabled. - */ - public boolean isProximityCorrectionEnabled() { - return mKeyDetector.isProximityCorrectionEnabled(); - } - @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 7d79886fa..296132c0d 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -693,7 +693,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen inputView.setKeyPreviewPopupEnabled(mCurrentSettings.mKeyPreviewPopupOn, mCurrentSettings.mKeyPreviewPopupDismissDelay); - inputView.setProximityCorrectionEnabled(true); if (TRACE) Debug.startMethodTracing("/data/trace/latinime"); } -- cgit v1.2.3-83-g751a From ba037c62acf3519ad224feaca696cc51f6de0818 Mon Sep 17 00:00:00 2001 From: alanv Date: Wed, 25 Jul 2012 11:03:41 -0700 Subject: Add accessibility descriptions for additional non-character keys. Bug: 6621009 Change-Id: I82fb2dc6af0fda795397e8be8c09a4f53b1656ab --- java/res/values/strings.xml | 6 ++++++ .../inputmethod/accessibility/KeyCodeDescriptionMapper.java | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'java') diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 12abf8469..9e8c59cd8 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -181,6 +181,12 @@ Search Dot + + Switch language + + Next + + Previous Shift enabled diff --git a/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java b/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java index 5ffd94a43..9b74070af 100644 --- a/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java +++ b/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java @@ -60,10 +60,8 @@ public class KeyCodeDescriptionMapper { // Manual label substitutions for key labels with no string resource mKeyLabelMap.put(":-)", R.string.spoken_description_smiley); - // Symbols that most TTS engines can't speak - mKeyCodeMap.put(' ', R.string.spoken_description_space); - // Special non-character codes defined in Keyboard + mKeyCodeMap.put(Keyboard.CODE_SPACE, R.string.spoken_description_space); mKeyCodeMap.put(Keyboard.CODE_DELETE, R.string.spoken_description_delete); mKeyCodeMap.put(Keyboard.CODE_ENTER, R.string.spoken_description_return); mKeyCodeMap.put(Keyboard.CODE_SETTINGS, R.string.spoken_description_settings); @@ -71,6 +69,9 @@ public class KeyCodeDescriptionMapper { mKeyCodeMap.put(Keyboard.CODE_SHORTCUT, R.string.spoken_description_mic); mKeyCodeMap.put(Keyboard.CODE_SWITCH_ALPHA_SYMBOL, R.string.spoken_description_to_symbol); mKeyCodeMap.put(Keyboard.CODE_TAB, R.string.spoken_description_tab); + mKeyCodeMap.put(Keyboard.CODE_LANGUAGE_SWITCH, R.string.spoken_description_language_switch); + mKeyCodeMap.put(Keyboard.CODE_ACTION_NEXT, R.string.spoken_description_action_next); + mKeyCodeMap.put(Keyboard.CODE_ACTION_PREVIOUS, R.string.spoken_description_action_previous); } /** @@ -274,8 +275,7 @@ public class KeyCodeDescriptionMapper { return context.getString(OBSCURED_KEY_RES_ID); } - final int resId = mKeyCodeMap.get(code); - if (resId != 0) { + if (mKeyCodeMap.indexOfKey(code) >= 0) { return context.getString(mKeyCodeMap.get(code)); } else if (isDefinedNonCtrl) { return Character.toString((char) code); -- cgit v1.2.3-83-g751a From d95121294a2005865afdfa386001181c871d8c7d Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Wed, 25 Jul 2012 14:58:15 -0700 Subject: Import translations. DO NOT MERGE Change-Id: I90620bd20eb0ed8f927709404822d815dc096223 Auto-generated-cl: translation import --- java/res/values-af/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'java') diff --git a/java/res/values-af/strings.xml b/java/res/values-af/strings.xml index 728d60c4d..0a5d048ef 100644 --- a/java/res/values-af/strings.xml +++ b/java/res/values-af/strings.xml @@ -58,8 +58,8 @@ "Baie aggressief" "Stel volgende woord voor" "Gebaseer op vorige woord" - "Invoer van gebaar" - "Voer \'n woord in deur die letters van \'n woord te volg" + "Gebaarinvoer" + "Voer \'n woord in deur die letters van \'n woord te trek" "%s : Gestoor" "Gaan" "Volgende" -- cgit v1.2.3-83-g751a From e55d78ab0cf8d27d6c22fd5fbc78714af8d6cc12 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Thu, 26 Jul 2012 08:45:07 +0900 Subject: Stop swallowing an UnsatisfiedLinkError Change-Id: I37d61274e1527229befabae2c392fd78e279b807 --- java/src/com/android/inputmethod/latin/JniUtils.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/latin/JniUtils.java b/java/src/com/android/inputmethod/latin/JniUtils.java index 4808b867a..86a3826d8 100644 --- a/java/src/com/android/inputmethod/latin/JniUtils.java +++ b/java/src/com/android/inputmethod/latin/JniUtils.java @@ -31,11 +31,7 @@ public class JniUtils { try { System.loadLibrary(JniLibName.JNI_LIB_NAME); } catch (UnsatisfiedLinkError ule) { - Log.e(TAG, "Could not load native library " + JniLibName.JNI_LIB_NAME); - if (LatinImeLogger.sDBG) { - throw new RuntimeException( - "Could not load native library " + JniLibName.JNI_LIB_NAME); - } + Log.e(TAG, "Could not load native library " + JniLibName.JNI_LIB_NAME, ule); } } } -- cgit v1.2.3-83-g751a From 55c01170c49cc8ebcb31ca70ac413ab469824e12 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 26 Jul 2012 12:38:47 +0900 Subject: Add Afrikaans keyboard layout Bug: 6867914 Change-Id: Ice35b20a0a51dda21c8271256064523bb5844952 --- java/res/xml/method.xml | 7 +++ .../keyboard/internal/KeyboardTextsSet.java | 54 +++++++++++++++++ .../res/values-af/donottranslate-more-keys.xml | 67 ++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 tools/maketext/res/values-af/donottranslate-more-keys.xml (limited to 'java') diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index b448e00a3..eb6dcf75a 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -22,6 +22,7 @@ + + + + â,ä,á,à,æ,ã,å,ā + + ê,ë,é,è,ę,ė,ē + + ì,ï,í,î,į,ī,ij + + ô,ö,ó,ò,õ,œ,ø,ō + + û,ü,ú,ù,ū + + ñ,ń + + ij + -- cgit v1.2.3-83-g751a From b90363e40cedcc75537f4c3c6ad378902ffa3ddf Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 26 Jul 2012 16:31:06 +0900 Subject: Fix Afrikaans more keys layout Bug: 6867914 Change-Id: I43178a729f4770743f9fea87bad539c54da045c5 --- .../keyboard/internal/KeyboardTextsSet.java | 29 +++++++-------- .../res/values-af/donottranslate-more-keys.xml | 42 +++++++++++----------- 2 files changed, 37 insertions(+), 34 deletions(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java index b6b6ffade..195223702 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java @@ -379,54 +379,55 @@ public final class KeyboardTextsSet { /* Language af: Afrikaans */ private static final String[] LANGUAGE_af = { - // This is the same as Dutch except promoting vowels with circumflex and diaeresis. + // This is the same as Dutch except more keys of y and demoting vowels with diaeresis. + // 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+00E1: "á" LATIN SMALL LETTER A WITH ACUTE // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE // 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 */ "\u00E2,\u00E4,\u00E1,\u00E0,\u00E6,\u00E3,\u00E5,\u0101", - // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX - // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS + /* 0 */ "\u00E1,\u00E2,\u00E4,\u00E0,\u00E6,\u00E3,\u00E5,\u0101", // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE + // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX + // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS // 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 */ "\u00EA,\u00EB,\u00E9,\u00E8,\u0119,\u0117,\u0113", - // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX - // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS + /* 1 */ "\u00E9,\u00E8,\u00EA,\u00EB,\u0119,\u0117,\u0113", // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE + // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS + // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX // U+012F: "į" LATIN SMALL LETTER I WITH OGONEK // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON // U+0133: "ij" LATIN SMALL LIGATURE IJ - /* 2 */ "\u00EC,\u00EF,\u00ED,\u00EE,\u012F,\u012B,\u0133", + /* 2 */ "\u00ED,\u00EC,\u00EF,\u00EE,\u012F,\u012B,\u0133", + // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS - // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE // U+0153: "œ" LATIN SMALL LIGATURE OE // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON - /* 3 */ "\u00F4,\u00F6,\u00F3,\u00F2,\u00F5,\u0153,\u00F8,\u014D", + /* 3 */ "\u00F3,\u00F4,\u00F6,\u00F2,\u00F5,\u0153,\u00F8,\u014D", + // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS - // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON - /* 4 */ "\u00FB,\u00FC,\u00FA,\u00F9,\u016B", + /* 4 */ "\u00FA,\u00FB,\u00FC,\u00F9,\u016B", /* 5 */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* 6 */ "\u00F1,\u0144", /* 7 */ null, + // U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE // U+0133: "ij" LATIN SMALL LIGATURE IJ - /* 8 */ "\u0133", + /* 8 */ "\u00FD,\u0133", }; /* Language ar: Arabic */ diff --git a/tools/maketext/res/values-af/donottranslate-more-keys.xml b/tools/maketext/res/values-af/donottranslate-more-keys.xml index 15a281a44..ee96f442d 100644 --- a/tools/maketext/res/values-af/donottranslate-more-keys.xml +++ b/tools/maketext/res/values-af/donottranslate-more-keys.xml @@ -18,50 +18,52 @@ */ --> - - + - â,ä,á,à,æ,ã,å,ā - - ê,ë,é,è,ę,ė,ē - - ì,ï,í,î,į,ī,ij - - ô,ö,ó,ò,õ,œ,ø,ō - - û,ü,ú,ù,ū + ú,û,ü,ù,ū ñ,ń - - ij + ý,ŷ,ÿ,ij + + ý,ij -- cgit v1.2.3-83-g751a From c902dfeb8f8b889e885565a000556419e0d8307f Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 26 Jul 2012 13:04:31 +0900 Subject: Fix gesture detection when sliding key input is disabled Bug: 6867837 Change-Id: Icbfa69928c436343db545860a7d63171f52266b6 --- .../com/android/inputmethod/keyboard/PointerTracker.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index 67857d111..bd896517b 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -794,13 +794,16 @@ public class PointerTracker { final int dx = x - lastX; final int dy = y - lastY; final int lastMoveSquared = dx * dx + dy * dy; + // TODO: Should find a way to balance gesture detection and this hack. if (sNeedsPhantomSuddenMoveEventHack - && lastMoveSquared >= mKeyQuarterWidthSquared) { + && lastMoveSquared >= mKeyQuarterWidthSquared + && !mIsPossibleGesture) { if (DEBUG_MODE) { Log.w(TAG, String.format("onMoveEvent:" + " phantom sudden move event is translated to " + "up[%d,%d]/down[%d,%d] events", lastX, lastY, x, y)); } + // TODO: This should be moved to outside of this nested if-clause? if (ProductionFlag.IS_EXPERIMENTAL) { ResearchLogger.pointerTracker_onMoveEvent(x, y, lastX, lastY); } @@ -816,7 +819,9 @@ public class PointerTracker { && !sPointerTrackerQueue.hasModifierKeyOlderThan(this)) { onUpEventInternal(x, y, eventTime); } - mKeyAlreadyProcessed = true; + if (!mIsPossibleGesture) { + mKeyAlreadyProcessed = true; + } setReleasedKeyGraphics(oldKey); } } @@ -832,7 +837,9 @@ public class PointerTracker { if (mIsAllowedSlidingKeyInput) { onMoveToNewKey(key, x, y); } else { - mKeyAlreadyProcessed = true; + if (!mIsPossibleGesture) { + mKeyAlreadyProcessed = true; + } } } } @@ -871,6 +878,7 @@ public class PointerTracker { private void onUpEventInternal(int x, int y, long eventTime) { mTimerProxy.cancelKeyTimers(); mIsInSlidingKeyInput = false; + mIsPossibleGesture = false; // Release the last pressed key. setReleasedKeyGraphics(mCurrentKey); if (mIsShowingMoreKeysPanel) { -- cgit v1.2.3-83-g751a From 97c8d288a8cdef93dbc9301e4f33e008345ae717 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 26 Jul 2012 16:35:15 +0900 Subject: Add Zulu keyboard Bug: 6867914 Change-Id: I13316ac2a554a8601f920e875d540e5375e12860 --- java/res/xml/method.xml | 7 +++ .../keyboard/internal/KeyboardTextsSet.java | 48 ++++++++++++++++ .../res/values-zu/donottranslate-more-keys.xml | 64 ++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 tools/maketext/res/values-zu/donottranslate-more-keys.xml (limited to 'java') diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index eb6dcf75a..acdf7645f 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -71,6 +71,7 @@ tr: Turkish/qwerty uk: Ukrainian/east_slavic vi: Vietnamese/qwerty + zu: Zulu/qwerty zz: QWERTY/qwerty --> @@ -383,6 +384,12 @@ android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable" /> + + + + + + à,á,â,ä,æ,ã,å,ā + + è,é,ê,ë,ē + + î,ï,í,ī,ì + + ô,ö,ò,ó,œ,ø,ō,õ + + û,ü,ù,ú,ū + + ß + + ñ + + ç + -- cgit v1.2.3-83-g751a From aa906c36aa31f51a38083e337f4307b49f133054 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 25 Jul 2012 19:31:19 +0900 Subject: Handle correctly the restarting argument Bug: 6851364 Change-Id: Ie939a43b8527a76aec213b702d3d850717f22a81 --- .../com/android/inputmethod/latin/LatinIME.java | 46 ++++++++++++++-------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index b390cc08c..6b5de486c 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -659,35 +659,49 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen accessUtils.onStartInputViewInternal(editorInfo, restarting); } - mSubtypeSwitcher.updateParametersOnStartInputView(); + if (!restarting) { + mSubtypeSwitcher.updateParametersOnStartInputView(); + } // The EditorInfo might have a flag that affects fullscreen mode. // Note: This call should be done by InputMethodService? updateFullscreenMode(); - mLastSelectionStart = editorInfo.initialSelStart; - mLastSelectionEnd = editorInfo.initialSelEnd; mApplicationSpecifiedCompletions = null; - inputView.closing(); - mEnteredText = null; - resetComposingState(true /* alsoResetLastComposedWord */); - mDeleteCount = 0; - mSpaceState = SPACE_STATE_NONE; - - loadSettings(); + final boolean selectionChanged = mLastSelectionStart != editorInfo.initialSelStart + || mLastSelectionEnd != editorInfo.initialSelEnd; + if (!restarting || selectionChanged) { + // If the selection changed, we reset the input state. Essentially, we come here with + // restarting == true when the app called setText() or similar. We should reset the + // state if the app set the text to something else, but keep it if it set a suggestion + // or something. + mEnteredText = null; + resetComposingState(true /* alsoResetLastComposedWord */); + mDeleteCount = 0; + mSpaceState = SPACE_STATE_NONE; - if (mSuggest != null && mCurrentSettings.mCorrectionEnabled) { - mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold); + if (mSuggestionStripView != null) { + mSuggestionStripView.clear(); + } } - switcher.loadKeyboard(editorInfo, mCurrentSettings); - updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability(); + if (!restarting) { + inputView.closing(); + loadSettings(); - if (mSuggestionStripView != null) - mSuggestionStripView.clear(); + if (mSuggest != null && mCurrentSettings.mCorrectionEnabled) { + mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold); + } + + switcher.loadKeyboard(editorInfo, mCurrentSettings); + updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability(); + } setSuggestionStripShownInternal( isSuggestionsStripVisible(), /* needsInputViewShown */ false); + mLastSelectionStart = editorInfo.initialSelStart; + mLastSelectionEnd = editorInfo.initialSelEnd; + mHandler.cancelUpdateSuggestionStrip(); mHandler.cancelDoubleSpacesTimer(); -- cgit v1.2.3-83-g751a From 99906b3fc2dcb447aafdd43dda0c4551513b293e Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 27 Jul 2012 14:25:53 +0900 Subject: Move SuddenJumpingTouchEventHandler to internal package Change-Id: Ifc9fb6322a2edbaac0b10e7134ee7e735f14937b --- .../inputmethod/keyboard/MainKeyboardView.java | 1 + .../keyboard/SuddenJumpingTouchEventHandler.java | 153 -------------------- .../internal/SuddenJumpingTouchEventHandler.java | 155 +++++++++++++++++++++ 3 files changed, 156 insertions(+), 153 deletions(-) delete mode 100644 java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java create mode 100644 java/src/com/android/inputmethod/keyboard/internal/SuddenJumpingTouchEventHandler.java (limited to 'java') diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 7b4a3d227..9c28419cf 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -43,6 +43,7 @@ import com.android.inputmethod.accessibility.AccessibilityUtils; import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy; import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy; import com.android.inputmethod.keyboard.PointerTracker.TimerProxy; +import com.android.inputmethod.keyboard.internal.SuddenJumpingTouchEventHandler; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.LatinIME; import com.android.inputmethod.latin.LatinImeLogger; diff --git a/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java b/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java deleted file mode 100644 index 2398c0850..000000000 --- a/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 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. - */ - -package com.android.inputmethod.keyboard; - -import android.content.Context; -import android.util.Log; -import android.view.MotionEvent; - -import com.android.inputmethod.latin.LatinImeLogger; -import com.android.inputmethod.latin.R; -import com.android.inputmethod.latin.Utils; -import com.android.inputmethod.latin.define.ProductionFlag; -import com.android.inputmethod.research.ResearchLogger; - -public class SuddenJumpingTouchEventHandler { - private static final String TAG = SuddenJumpingTouchEventHandler.class.getSimpleName(); - private static boolean DEBUG_MODE = LatinImeLogger.sDBG; - - public interface ProcessMotionEvent { - public boolean processMotionEvent(MotionEvent me); - } - - private final ProcessMotionEvent mView; - private final boolean mNeedsSuddenJumpingHack; - - /** Whether we've started dropping move events because we found a big jump */ - private boolean mDroppingEvents; - /** - * Whether multi-touch disambiguation needs to be disabled if a real multi-touch event has - * occured - */ - private boolean mDisableDisambiguation; - /** The distance threshold at which we start treating the touch session as a multi-touch */ - private int mJumpThresholdSquare = Integer.MAX_VALUE; - private int mLastX; - private int mLastY; - - public SuddenJumpingTouchEventHandler(Context context, ProcessMotionEvent view) { - mView = view; - mNeedsSuddenJumpingHack = Boolean.parseBoolean(Utils.getDeviceOverrideValue( - context.getResources(), R.array.sudden_jumping_touch_event_device_list, "false")); - } - - public void setKeyboard(Keyboard newKeyboard) { - // One-seventh of the keyboard width seems like a reasonable threshold - final int jumpThreshold = newKeyboard.mOccupiedWidth / 7; - mJumpThresholdSquare = jumpThreshold * jumpThreshold; - } - - /** - * This function checks to see if we need to handle any sudden jumps in the pointer location - * that could be due to a multi-touch being treated as a move by the firmware or hardware. - * Once a sudden jump is detected, all subsequent move events are discarded - * until an UP is received.

- * When a sudden jump is detected, an UP event is simulated at the last position and when - * the sudden moves subside, a DOWN event is simulated for the second key. - * @param me the motion event - * @return true if the event was consumed, so that it doesn't continue to be handled by - * {@link MainKeyboardView}. - */ - private boolean handleSuddenJumping(MotionEvent me) { - if (!mNeedsSuddenJumpingHack) - return false; - final int action = me.getAction(); - final int x = (int) me.getX(); - final int y = (int) me.getY(); - boolean result = false; - - // Real multi-touch event? Stop looking for sudden jumps - if (me.getPointerCount() > 1) { - mDisableDisambiguation = true; - } - if (mDisableDisambiguation) { - // If UP, reset the multi-touch flag - if (action == MotionEvent.ACTION_UP) mDisableDisambiguation = false; - return false; - } - - switch (action) { - case MotionEvent.ACTION_DOWN: - // Reset the "session" - mDroppingEvents = false; - mDisableDisambiguation = false; - break; - case MotionEvent.ACTION_MOVE: - // Is this a big jump? - final int distanceSquare = (mLastX - x) * (mLastX - x) + (mLastY - y) * (mLastY - y); - // Check the distance. - if (distanceSquare > mJumpThresholdSquare) { - // If we're not yet dropping events, start dropping and send an UP event - if (!mDroppingEvents) { - mDroppingEvents = true; - // Send an up event - MotionEvent translated = MotionEvent.obtain( - me.getEventTime(), me.getEventTime(), - MotionEvent.ACTION_UP, - mLastX, mLastY, me.getMetaState()); - mView.processMotionEvent(translated); - translated.recycle(); - } - result = true; - } else if (mDroppingEvents) { - // If moves are small and we're already dropping events, continue dropping - result = true; - } - break; - case MotionEvent.ACTION_UP: - if (mDroppingEvents) { - // Send a down event first, as we dropped a bunch of sudden jumps and assume that - // the user is releasing the touch on the second key. - MotionEvent translated = MotionEvent.obtain(me.getEventTime(), me.getEventTime(), - MotionEvent.ACTION_DOWN, - x, y, me.getMetaState()); - mView.processMotionEvent(translated); - translated.recycle(); - mDroppingEvents = false; - // Let the up event get processed as well, result = false - } - break; - } - // Track the previous coordinate - mLastX = x; - mLastY = y; - return result; - } - - public boolean onTouchEvent(MotionEvent me) { - // If there was a sudden jump, return without processing the actual motion event. - if (handleSuddenJumping(me)) { - if (DEBUG_MODE) - Log.w(TAG, "onTouchEvent: ignore sudden jump " + me); - if (ProductionFlag.IS_EXPERIMENTAL) { - ResearchLogger.suddenJumpingTouchEventHandler_onTouchEvent(me); - } - return true; - } - return mView.processMotionEvent(me); - } -} diff --git a/java/src/com/android/inputmethod/keyboard/internal/SuddenJumpingTouchEventHandler.java b/java/src/com/android/inputmethod/keyboard/internal/SuddenJumpingTouchEventHandler.java new file mode 100644 index 000000000..9e2cbec52 --- /dev/null +++ b/java/src/com/android/inputmethod/keyboard/internal/SuddenJumpingTouchEventHandler.java @@ -0,0 +1,155 @@ +/* + * Copyright (C) 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. + */ + +package com.android.inputmethod.keyboard.internal; + +import android.content.Context; +import android.util.Log; +import android.view.MotionEvent; + +import com.android.inputmethod.keyboard.Keyboard; +import com.android.inputmethod.keyboard.MainKeyboardView; +import com.android.inputmethod.latin.LatinImeLogger; +import com.android.inputmethod.latin.R; +import com.android.inputmethod.latin.Utils; +import com.android.inputmethod.latin.define.ProductionFlag; +import com.android.inputmethod.research.ResearchLogger; + +public class SuddenJumpingTouchEventHandler { + private static final String TAG = SuddenJumpingTouchEventHandler.class.getSimpleName(); + private static boolean DEBUG_MODE = LatinImeLogger.sDBG; + + public interface ProcessMotionEvent { + public boolean processMotionEvent(MotionEvent me); + } + + private final ProcessMotionEvent mView; + private final boolean mNeedsSuddenJumpingHack; + + /** Whether we've started dropping move events because we found a big jump */ + private boolean mDroppingEvents; + /** + * Whether multi-touch disambiguation needs to be disabled if a real multi-touch event has + * occured + */ + private boolean mDisableDisambiguation; + /** The distance threshold at which we start treating the touch session as a multi-touch */ + private int mJumpThresholdSquare = Integer.MAX_VALUE; + private int mLastX; + private int mLastY; + + public SuddenJumpingTouchEventHandler(Context context, ProcessMotionEvent view) { + mView = view; + mNeedsSuddenJumpingHack = Boolean.parseBoolean(Utils.getDeviceOverrideValue( + context.getResources(), R.array.sudden_jumping_touch_event_device_list, "false")); + } + + public void setKeyboard(Keyboard newKeyboard) { + // One-seventh of the keyboard width seems like a reasonable threshold + final int jumpThreshold = newKeyboard.mOccupiedWidth / 7; + mJumpThresholdSquare = jumpThreshold * jumpThreshold; + } + + /** + * This function checks to see if we need to handle any sudden jumps in the pointer location + * that could be due to a multi-touch being treated as a move by the firmware or hardware. + * Once a sudden jump is detected, all subsequent move events are discarded + * until an UP is received.

+ * When a sudden jump is detected, an UP event is simulated at the last position and when + * the sudden moves subside, a DOWN event is simulated for the second key. + * @param me the motion event + * @return true if the event was consumed, so that it doesn't continue to be handled by + * {@link MainKeyboardView}. + */ + private boolean handleSuddenJumping(MotionEvent me) { + if (!mNeedsSuddenJumpingHack) + return false; + final int action = me.getAction(); + final int x = (int) me.getX(); + final int y = (int) me.getY(); + boolean result = false; + + // Real multi-touch event? Stop looking for sudden jumps + if (me.getPointerCount() > 1) { + mDisableDisambiguation = true; + } + if (mDisableDisambiguation) { + // If UP, reset the multi-touch flag + if (action == MotionEvent.ACTION_UP) mDisableDisambiguation = false; + return false; + } + + switch (action) { + case MotionEvent.ACTION_DOWN: + // Reset the "session" + mDroppingEvents = false; + mDisableDisambiguation = false; + break; + case MotionEvent.ACTION_MOVE: + // Is this a big jump? + final int distanceSquare = (mLastX - x) * (mLastX - x) + (mLastY - y) * (mLastY - y); + // Check the distance. + if (distanceSquare > mJumpThresholdSquare) { + // If we're not yet dropping events, start dropping and send an UP event + if (!mDroppingEvents) { + mDroppingEvents = true; + // Send an up event + MotionEvent translated = MotionEvent.obtain( + me.getEventTime(), me.getEventTime(), + MotionEvent.ACTION_UP, + mLastX, mLastY, me.getMetaState()); + mView.processMotionEvent(translated); + translated.recycle(); + } + result = true; + } else if (mDroppingEvents) { + // If moves are small and we're already dropping events, continue dropping + result = true; + } + break; + case MotionEvent.ACTION_UP: + if (mDroppingEvents) { + // Send a down event first, as we dropped a bunch of sudden jumps and assume that + // the user is releasing the touch on the second key. + MotionEvent translated = MotionEvent.obtain(me.getEventTime(), me.getEventTime(), + MotionEvent.ACTION_DOWN, + x, y, me.getMetaState()); + mView.processMotionEvent(translated); + translated.recycle(); + mDroppingEvents = false; + // Let the up event get processed as well, result = false + } + break; + } + // Track the previous coordinate + mLastX = x; + mLastY = y; + return result; + } + + public boolean onTouchEvent(MotionEvent me) { + // If there was a sudden jump, return without processing the actual motion event. + if (handleSuddenJumping(me)) { + if (DEBUG_MODE) + Log.w(TAG, "onTouchEvent: ignore sudden jump " + me); + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.suddenJumpingTouchEventHandler_onTouchEvent(me); + } + return true; + } + return mView.processMotionEvent(me); + } +} -- cgit v1.2.3-83-g751a From 105767088196b9539c373ddcc7f3ff9d8e3e54fc Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 27 Jul 2012 19:32:47 +0900 Subject: Make PreviewPlacerView final This is a groundwork for the bug. Bug: 6883053 Change-Id: I51e9235d3bc7021790a88a44596c4314125a1ab3 --- .../android/inputmethod/keyboard/KeyboardView.java | 40 ++++++++++------------ 1 file changed, 18 insertions(+), 22 deletions(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index f1f942ccb..9c6543b61 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -106,7 +106,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { protected final KeyPreviewDrawParams mKeyPreviewDrawParams; private boolean mShowKeyPreviewPopup = true; private int mDelayAfterPreview; - private PreviewPlacerView mPreviewPlacer; + private final PreviewPlacerView mPreviewPlacerView; /** True if {@link KeyboardView} should handle gesture events. */ protected boolean mShouldHandleGesture; @@ -376,6 +376,8 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { mDelayAfterPreview = mKeyPreviewDrawParams.mLingerTimeout; mPaint.setAntiAlias(true); + + mPreviewPlacerView = new PreviewPlacerView(context); } // Read fraction value in TypedArray as float. @@ -876,39 +878,35 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } private void addKeyPreview(TextView keyPreview) { - if (mPreviewPlacer == null) { - createPreviewPlacer(); - } - mPreviewPlacer.addView( - keyPreview, ViewLayoutUtils.newLayoutParam(mPreviewPlacer, 0, 0)); + locatePreviewPlacerView(); + mPreviewPlacerView.addView( + keyPreview, ViewLayoutUtils.newLayoutParam(mPreviewPlacerView, 0, 0)); } - private void createPreviewPlacer() { - mPreviewPlacer = new PreviewPlacerView(getContext()); + private void locatePreviewPlacerView() { + if (mPreviewPlacerView.getParent() != null) { + return; + } final int[] viewOrigin = new int[2]; getLocationInWindow(viewOrigin); - mPreviewPlacer.setOrigin(viewOrigin[0], viewOrigin[1]); + mPreviewPlacerView.setOrigin(viewOrigin[0], viewOrigin[1]); final ViewGroup windowContentView = (ViewGroup)getRootView().findViewById(android.R.id.content); - windowContentView.addView(mPreviewPlacer); + windowContentView.addView(mPreviewPlacerView); } public void showGesturePreviewText(String gesturePreviewText) { // TDOD: Add user settings option to control drawing gesture trail. - if (mPreviewPlacer == null) { - createPreviewPlacer(); - } - mPreviewPlacer.setGesturePreviewText(gesturePreviewText); - mPreviewPlacer.invalidate(); + locatePreviewPlacerView(); + mPreviewPlacerView.setGesturePreviewText(gesturePreviewText); + mPreviewPlacerView.invalidate(); } @Override public void showGestureTrail(PointerTracker tracker) { // TDOD: Add user settings option to control drawing gesture trail. - if (mPreviewPlacer == null) { - createPreviewPlacer(); - } - mPreviewPlacer.invalidatePointer(tracker); + locatePreviewPlacerView(); + mPreviewPlacerView.invalidatePointer(tracker); } @SuppressWarnings("deprecation") // setBackgroundDrawable is replaced by setBackground in API16 @@ -1051,9 +1049,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { protected void onDetachedFromWindow() { super.onDetachedFromWindow(); closing(); - if (mPreviewPlacer != null) { - mPreviewPlacer.removeAllViews(); - } + mPreviewPlacerView.removeAllViews(); if (mBuffer != null) { mBuffer.recycle(); mBuffer = null; -- cgit v1.2.3-83-g751a From 6fc72cae206b67e2dbcc4c6a853a355995d068be Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 27 Jul 2012 03:45:42 +0900 Subject: Fix a bug with autocaps Port of Iece016f4 Bug: 6886405 Change-Id: I148c296d8a3841c40b6748e73ed2b0fff473b627 --- java/src/com/android/inputmethod/latin/LatinIME.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'java') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 6b5de486c..1aac734ba 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -701,6 +701,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mLastSelectionStart = editorInfo.initialSelStart; mLastSelectionEnd = editorInfo.initialSelEnd; + // If we come here something in the text state is very likely to have changed. + // We should update the shift state regardless of whether we are restarting or not, because + // this is not perceived as a layout change that may be disruptive like we may have with + // switcher.loadKeyboard; in apps like Talk, we come here when the text is sent and the + // field gets emptied and we need to re-evaluate the shift state, but not the whole layout + // which would be disruptive. + mKeyboardSwitcher.updateShiftState(); mHandler.cancelUpdateSuggestionStrip(); mHandler.cancelDoubleSpacesTimer(); -- cgit v1.2.3-83-g751a From e7c471a52f38c48cd38e412d88901bddb6f903a9 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 27 Jul 2012 23:13:28 +0900 Subject: Don't auto-correct when there are digits. Bug: 6667462 Change-Id: I796655f57c71c9f50ae6e38dd08b71df3998dbcf --- java/src/com/android/inputmethod/latin/Suggest.java | 2 +- java/src/com/android/inputmethod/latin/WordComposer.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 3e3cf76f1..5e2a04124 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -233,7 +233,7 @@ public class Suggest { // the current settings. It may also be useful to know, when the setting is off, whether // the word *would* have been auto-corrected. if (!isCorrectionEnabled || !allowsToBeAutoCorrected || !wordComposer.isComposingWord() - || suggestionsSet.isEmpty() + || suggestionsSet.isEmpty() || wordComposer.hasDigits() || wordComposer.isMostlyCaps() || wordComposer.isResumed() || !hasMainDictionary()) { // If we don't have a main dictionary, we never want to auto-correct. The reason for diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 6d346d179..5606a58e4 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -41,6 +41,7 @@ public class WordComposer { // Cache these values for performance private int mCapsCount; + private int mDigitsCount; private boolean mAutoCapitalized; private int mTrailingSingleQuotesCount; private int mCodePointSize; @@ -65,6 +66,7 @@ public class WordComposer { mTypedWord = new StringBuilder(source.mTypedWord); mInputPointers.copy(source.mInputPointers); mCapsCount = source.mCapsCount; + mDigitsCount = source.mDigitsCount; mIsFirstCharCapitalized = source.mIsFirstCharCapitalized; mAutoCapitalized = source.mAutoCapitalized; mTrailingSingleQuotesCount = source.mTrailingSingleQuotesCount; @@ -80,6 +82,7 @@ public class WordComposer { mTypedWord.setLength(0); mAutoCorrection = null; mCapsCount = 0; + mDigitsCount = 0; mIsFirstCharCapitalized = false; mTrailingSingleQuotesCount = 0; mIsResumed = false; @@ -141,6 +144,7 @@ public class WordComposer { mIsFirstCharCapitalized = isFirstCharCapitalized( newIndex, primaryCode, mIsFirstCharCapitalized); if (Character.isUpperCase(primaryCode)) mCapsCount++; + if (Character.isDigit(primaryCode)) mDigitsCount++; if (Keyboard.CODE_SINGLE_QUOTE == primaryCode) { ++mTrailingSingleQuotesCount; } else { @@ -213,6 +217,7 @@ public class WordComposer { mTypedWord.deleteCharAt(stringBuilderLength - 1); } if (Character.isUpperCase(lastChar)) mCapsCount--; + if (Character.isDigit(lastChar)) mDigitsCount--; refreshSize(); } // We may have deleted the last one. @@ -267,6 +272,13 @@ public class WordComposer { return mCapsCount > 1; } + /** + * Returns true if we have digits in the composing word. + */ + public boolean hasDigits() { + return mDigitsCount > 0; + } + /** * Saves the reason why the word is capitalized - whether it was automatic or * due to the user hitting shift in the middle of a sentence. @@ -322,6 +334,7 @@ public class WordComposer { lastComposedWord.deactivate(); } mCapsCount = 0; + mDigitsCount = 0; mIsBatchMode = false; mTypedWord.setLength(0); mTrailingSingleQuotesCount = 0; -- cgit v1.2.3-83-g751a From d157bb0d557aff7982ae55f69753b58cca95bda1 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Sat, 28 Jul 2012 21:24:29 +0900 Subject: Just a cosmetic cleanup Change-Id: Ie32fb8474b502220bdca9dbce30094bf5fb08e00 --- java/Android.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'java') diff --git a/java/Android.mk b/java/Android.mk index 52cc18b26..364973bea 100644 --- a/java/Android.mk +++ b/java/Android.mk @@ -28,9 +28,7 @@ LOCAL_JNI_SHARED_LIBRARIES := libjni_latinime # We want to install libjni_latinime.so to the system partition if LatinIME gets installed. LOCAL_REQUIRED_MODULES := libjni_latinime -LOCAL_STATIC_JAVA_LIBRARIES := android-common -LOCAL_STATIC_JAVA_LIBRARIES += inputmethod-common -LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4 +LOCAL_STATIC_JAVA_LIBRARIES := android-common inputmethod-common android-support-v4 # Do not compress dictionary files to mmap dict data runtime LOCAL_AAPT_FLAGS := -0 .dict -- cgit v1.2.3-83-g751a From efd8b838ee9415ba4ed692ecf136a918cfa02c54 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 30 Jul 2012 15:04:27 +0900 Subject: Add MoreKeySpec.toString() method for debugging Change-Id: Icf9c6e15521849ffc51911c1e256c9815c1960f4 --- .../com/android/inputmethod/keyboard/internal/KeySpecParser.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'java') diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java b/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java index 53261205d..099e56182 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java @@ -84,6 +84,15 @@ public class KeySpecParser { } mIconId = getIconId(moreKeySpec); } + + @Override + public String toString() { + final String label = (mIconId == KeyboardIconsSet.ICON_UNDEFINED ? mLabel + : PREFIX_ICON + KeyboardIconsSet.getIconName(mIconId)); + final String output = (mCode == Keyboard.CODE_OUTPUT_TEXT ? mOutputText + : String.format("0x%04x", mCode)); + return label + "/" + output; + } } private KeySpecParser() { -- cgit v1.2.3-83-g751a From 4731b67629e72d6c7cb391e3d188df78ceaff1e7 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 30 Jul 2012 13:35:06 +0900 Subject: Add device form factor to KeyboardId This is a groundword for optimizing keyboard parsing. Bug: 6860259 Change-Id: Ie65aa502b18c920e25cf2998b79120b3cc835952 --- java/res/values-sw600dp/config.xml | 2 ++ java/res/values-sw768dp/config.xml | 2 ++ java/res/values/config.xml | 2 ++ .../android/inputmethod/keyboard/KeyboardId.java | 29 +++++++++++++++++----- .../inputmethod/keyboard/KeyboardLayoutSet.java | 16 +++++++----- .../inputmethod/keyboard/KeyboardSwitcher.java | 5 ++-- 6 files changed, 42 insertions(+), 14 deletions(-) (limited to 'java') diff --git a/java/res/values-sw600dp/config.xml b/java/res/values-sw600dp/config.xml index 619169c52..e296623b2 100644 --- a/java/res/values-sw600dp/config.xml +++ b/java/res/values-sw600dp/config.xml @@ -19,6 +19,8 @@ --> + + 1 false false false diff --git a/java/res/values-sw768dp/config.xml b/java/res/values-sw768dp/config.xml index 27cb9ac21..346fa9979 100644 --- a/java/res/values-sw768dp/config.xml +++ b/java/res/values-sw768dp/config.xml @@ -19,6 +19,8 @@ --> + + 2 false false false diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 50f46c3f5..e5575e7ae 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -19,6 +19,8 @@ --> + + 0 false true true diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index b54c72687..1e5277345 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -55,10 +55,15 @@ public class KeyboardId { public static final int ELEMENT_PHONE_SYMBOLS = 8; public static final int ELEMENT_NUMBER = 9; + public static final int FORM_FACTOR_PHONE = 0; + public static final int FORM_FACTOR_TABLET7 = 1; + public static final int FORM_FACTOR_TABLET10 = 2; + private static final int IME_ACTION_CUSTOM_LABEL = EditorInfo.IME_MASK_ACTION + 1; public final InputMethodSubtype mSubtype; public final Locale mLocale; + public final int mDeviceFormFactor; public final int mOrientation; public final int mWidth; public final int mMode; @@ -72,11 +77,12 @@ public class KeyboardId { private final int mHashCode; - public KeyboardId(int elementId, InputMethodSubtype subtype, int orientation, int width, - int mode, EditorInfo editorInfo, boolean clobberSettingsKey, boolean shortcutKeyEnabled, - boolean hasShortcutKey, boolean languageSwitchKeyEnabled) { + public KeyboardId(int elementId, InputMethodSubtype subtype, int deviceFormFactor, + int orientation, int width, int mode, EditorInfo editorInfo, boolean clobberSettingsKey, + boolean shortcutKeyEnabled, boolean hasShortcutKey, boolean languageSwitchKeyEnabled) { mSubtype = subtype; mLocale = SubtypeLocale.getSubtypeLocale(subtype); + mDeviceFormFactor = deviceFormFactor; mOrientation = orientation; mWidth = width; mMode = mode; @@ -94,6 +100,7 @@ public class KeyboardId { private static int computeHashCode(KeyboardId id) { return Arrays.hashCode(new Object[] { + id.mDeviceFormFactor, id.mOrientation, id.mElementId, id.mMode, @@ -115,7 +122,8 @@ public class KeyboardId { private boolean equals(KeyboardId other) { if (other == this) return true; - return other.mOrientation == mOrientation + return other.mDeviceFormFactor == mDeviceFormFactor + && other.mOrientation == mOrientation && other.mElementId == mElementId && other.mMode == mMode && other.mWidth == mWidth @@ -184,11 +192,11 @@ public class KeyboardId { @Override public String toString() { - return String.format("[%s %s:%s %s%d %s %s %s%s%s%s%s%s%s%s]", + return String.format("[%s %s:%s %s-%s:%d %s %s %s%s%s%s%s%s%s%s]", elementIdToName(mElementId), mLocale, mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET), - (mOrientation == 1 ? "port" : "land"), mWidth, + deviceFormFactor(mDeviceFormFactor), (mOrientation == 1 ? "port" : "land"), mWidth, modeName(mMode), imeAction(), (navigateNext() ? "navigateNext" : ""), @@ -226,6 +234,15 @@ public class KeyboardId { } } + public static String deviceFormFactor(int devoceFormFactor) { + switch (devoceFormFactor) { + case FORM_FACTOR_PHONE: return "phone"; + case FORM_FACTOR_TABLET7: return "tablet7"; + case FORM_FACTOR_TABLET10: return "tablet10"; + default: return null; + } + } + public static String modeName(int mode) { switch (mode) { case MODE_TEXT: return "text"; diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java index aab89a3e5..64b3f0952 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java @@ -115,6 +115,7 @@ public class KeyboardLayoutSet { boolean mNoSettingsKey; boolean mLanguageSwitchKeyEnabled; InputMethodSubtype mSubtype; + int mDeviceFormFactor; int mOrientation; int mWidth; // Sparse array of KeyboardLayoutSet element parameters indexed by element's id. @@ -211,9 +212,10 @@ public class KeyboardLayoutSet { final boolean noLanguage = SubtypeLocale.isNoLanguage(params.mSubtype); final boolean voiceKeyEnabled = params.mVoiceKeyEnabled && !noLanguage; final boolean hasShortcutKey = voiceKeyEnabled && (isSymbols != params.mVoiceKeyOnMain); - return new KeyboardId(keyboardLayoutSetElementId, params.mSubtype, params.mOrientation, - params.mWidth, params.mMode, params.mEditorInfo, params.mNoSettingsKey, - voiceKeyEnabled, hasShortcutKey, params.mLanguageSwitchKeyEnabled); + return new KeyboardId(keyboardLayoutSetElementId, params.mSubtype, params.mDeviceFormFactor, + params.mOrientation, params.mWidth, params.mMode, params.mEditorInfo, + params.mNoSettingsKey, voiceKeyEnabled, hasShortcutKey, + params.mLanguageSwitchKeyEnabled); } public static class Builder { @@ -239,9 +241,11 @@ public class KeyboardLayoutSet { mPackageName, NO_SETTINGS_KEY, mEditorInfo); } - public Builder setScreenGeometry(int orientation, int widthPixels) { - mParams.mOrientation = orientation; - mParams.mWidth = widthPixels; + public Builder setScreenGeometry(int deviceFormFactor, int orientation, int widthPixels) { + final Params params = mParams; + params.mDeviceFormFactor = deviceFormFactor; + params.mOrientation = orientation; + params.mWidth = widthPixels; return this; } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index f27d79382..4d952098c 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -137,8 +137,9 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions { public void loadKeyboard(EditorInfo editorInfo, SettingsValues settingsValues) { final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder( mThemeContext, editorInfo); - builder.setScreenGeometry(mThemeContext.getResources().getConfiguration().orientation, - mThemeContext.getResources().getDisplayMetrics().widthPixels); + final Resources res = mThemeContext.getResources(); + builder.setScreenGeometry(res.getInteger(R.integer.config_device_form_factor), + res.getConfiguration().orientation, res.getDisplayMetrics().widthPixels); builder.setSubtype(mSubtypeSwitcher.getCurrentSubtype()); builder.setOptions( settingsValues.isVoiceKeyEnabled(editorInfo), -- cgit v1.2.3-83-g751a From 75fb3ce1be3c879bb614097a2534f791c833dd7c Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 30 Jul 2012 15:51:41 +0900 Subject: More readable Key.toString() and MoreKeySpec.toString() Change-Id: Iee3c33dedd0c00ba259aa55e8b0c1c57b84eccdd --- java/src/com/android/inputmethod/keyboard/Key.java | 10 ++++++++-- .../android/inputmethod/keyboard/internal/KeySpecParser.java | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index e1e1ca9cf..178c9ff05 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -414,8 +414,14 @@ public class Key { @Override public String toString() { - return String.format("%s/%s %d,%d %dx%d %s/%s/%s", - Keyboard.printableCode(mCode), mLabel, mX, mY, mWidth, mHeight, mHintLabel, + final String label; + if (StringUtils.codePointCount(mLabel) == 1 && mLabel.codePointAt(0) == mCode) { + label = ""; + } else { + label = "/" + mLabel; + } + return String.format("%s%s %d,%d %dx%d %s/%s/%s", + Keyboard.printableCode(mCode), label, mX, mY, mWidth, mHeight, mHintLabel, KeyboardIconsSet.getIconName(mIconId), backgroundName(mBackgroundType)); } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java b/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java index 099e56182..94a7b826f 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java @@ -90,8 +90,12 @@ public class KeySpecParser { final String label = (mIconId == KeyboardIconsSet.ICON_UNDEFINED ? mLabel : PREFIX_ICON + KeyboardIconsSet.getIconName(mIconId)); final String output = (mCode == Keyboard.CODE_OUTPUT_TEXT ? mOutputText - : String.format("0x%04x", mCode)); - return label + "/" + output; + : Keyboard.printableCode(mCode)); + if (StringUtils.codePointCount(label) == 1 && label.codePointAt(0) == mCode) { + return output; + } else { + return label + "|" + output; + } } } -- cgit v1.2.3-83-g751a From 47e2bf329882ea45294ea6e6dd80b4d4eb3789e6 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 27 Jul 2012 15:32:29 +0900 Subject: Add advanced options to turn on/off the gesture trail and text preview Bug: 6883053 Change-Id: I601718afb37289108b45ef68626c7c315edca35d --- java/res/values/strings.xml | 8 ++- java/res/xml/prefs.xml | 23 ++++++-- .../android/inputmethod/keyboard/KeyboardView.java | 8 +-- .../inputmethod/keyboard/MainKeyboardView.java | 6 +- .../keyboard/internal/PreviewPlacerView.java | 19 ++++-- .../com/android/inputmethod/latin/LatinIME.java | 4 +- .../com/android/inputmethod/latin/Settings.java | 67 ++++++++++++++-------- .../android/inputmethod/latin/SettingsValues.java | 5 ++ 8 files changed, 98 insertions(+), 42 deletions(-) (limited to 'java') diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 25d982793..07b3f31c7 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -111,10 +111,16 @@ Based on previous word - + Gesture input Input a word by tracing the letters of a word + + Show gesture trail + + Show gesture word + + Show floating preview word with gesture %s : Saved diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 4f11cb7e5..ef6be3eed 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -101,6 +101,12 @@ android:key="pref_advanced_settings" android:title="@string/advanced_settings" android:summary="@string/advanced_settings_summary"> + - + + diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 9c6543b61..e70c7a19e 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -432,8 +432,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { return mShowKeyPreviewPopup; } - public void setGestureHandlingMode(boolean shouldHandleGesture) { + public void setGestureHandlingMode(boolean shouldHandleGesture, + boolean drawsGesturePreviewTrail, boolean drawsGestureFloatingPreviewText) { mShouldHandleGesture = shouldHandleGesture; + mPreviewPlacerView.setGesturePreviewMode( + drawsGesturePreviewTrail, drawsGestureFloatingPreviewText); } @Override @@ -896,15 +899,12 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } public void showGesturePreviewText(String gesturePreviewText) { - // TDOD: Add user settings option to control drawing gesture trail. locatePreviewPlacerView(); mPreviewPlacerView.setGesturePreviewText(gesturePreviewText); - mPreviewPlacerView.invalidate(); } @Override public void showGestureTrail(PointerTracker tracker) { - // TDOD: Add user settings option to control drawing gesture trail. locatePreviewPlacerView(); mPreviewPlacerView.invalidatePointer(tracker); } diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 9c28419cf..7ad552151 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -481,8 +481,10 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key } @Override - public void setGestureHandlingMode(final boolean shouldHandleGesture) { - super.setGestureHandlingMode(shouldHandleGesture); + public void setGestureHandlingMode(final boolean shouldHandleGesture, + boolean drawsGesturePreviewTrail, boolean drawsGestureFloatingPreviewText) { + super.setGestureHandlingMode(shouldHandleGesture, drawsGesturePreviewTrail, + drawsGestureFloatingPreviewText); PointerTracker.setKeyDetector(mKeyDetector, shouldHandleGesture); } diff --git a/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java b/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java index 2a53c59bb..a400fda15 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java +++ b/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java @@ -51,6 +51,8 @@ public class PreviewPlacerView extends RelativeLayout { private final SparseArray mPointers = new SparseArray(); private String mGesturePreviewText; + private boolean mDrawsGesturePreviewTrail; + private boolean mDrawsGestureFloatingPreviewText; public PreviewPlacerView(Context context) { super(context); @@ -89,6 +91,12 @@ public class PreviewPlacerView extends RelativeLayout { mYOrigin = y; } + public void setGesturePreviewMode(boolean drawsGesturePreviewTrail, + boolean drawsGestureFloatingPreviewText) { + mDrawsGesturePreviewTrail = drawsGesturePreviewTrail; + mDrawsGestureFloatingPreviewText = drawsGestureFloatingPreviewText; + } + public void invalidatePointer(PointerTracker tracker) { synchronized (mPointers) { mPointers.put(tracker.mPointerId, tracker); @@ -100,18 +108,19 @@ public class PreviewPlacerView extends RelativeLayout { @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; + boolean hasDrawnFloatingPreviewText = false; for (int index = 0; index < trackerCount; index++) { final PointerTracker tracker = mPointers.valueAt(index); - tracker.drawGestureTrail(canvas, mGesturePaint); + if (mDrawsGesturePreviewTrail) { + tracker.drawGestureTrail(canvas, mGesturePaint); + } // TODO: Figure out more cleaner way to draw gesture preview text. - if (!floatingPreviewHasDrawn) { + if (mDrawsGestureFloatingPreviewText && !hasDrawnFloatingPreviewText) { drawGesturePreviewText(canvas, tracker, mGesturePreviewText); - floatingPreviewHasDrawn = true; + hasDrawnFloatingPreviewText = true; } } canvas.translate(-mXOrigin, -mYOrigin); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 1aac734ba..22213be5e 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -2095,7 +2095,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (keyboardView != null) { final boolean shouldHandleGesture = mCurrentSettings.mGestureInputEnabled && mIsMainDictionaryAvailable; - keyboardView.setGestureHandlingMode(shouldHandleGesture); + keyboardView.setGestureHandlingMode(shouldHandleGesture, + mCurrentSettings.mGesturePreviewTrailEnabled, + mCurrentSettings.mGestureFloatingPreviewTextEnabled); } } diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index 45608f439..6251c9acd 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -62,6 +62,7 @@ public class Settings extends InputMethodSettingsFragment public static final String PREF_LAST_USER_DICTIONARY_WRITE_TIME = "last_user_dictionary_write_time"; public static final String PREF_ADVANCED_SETTINGS = "pref_advanced_settings"; + public static final String PREF_KEY_USE_CONTACTS_DICT = "pref_key_use_contacts_dict"; public static final String PREF_SUPPRESS_LANGUAGE_SWITCH_KEY = "pref_suppress_language_switch_key"; public static final String PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST = @@ -69,13 +70,15 @@ public class Settings extends InputMethodSettingsFragment public static final String PREF_CUSTOM_INPUT_STYLES = "custom_input_styles"; public static final String PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY = "pref_key_preview_popup_dismiss_delay"; - public static final String PREF_KEY_USE_CONTACTS_DICT = "pref_key_use_contacts_dict"; public static final String PREF_BIGRAM_PREDICTIONS = "next_word_prediction"; public static final String PREF_GESTURE_INPUT = "gesture_input"; public static final String PREF_VIBRATION_DURATION_SETTINGS = "pref_vibration_duration_settings"; public static final String PREF_KEYPRESS_SOUND_VOLUME = "pref_keypress_sound_volume"; + public static final String PREF_GESTURE_PREVIEW_TRAIL = "pref_gesture_preview_trail"; + public static final String PREF_GESTURE_FLOATING_PREVIEW_TEXT = + "pref_gesture_floating_preview_text"; public static final String PREF_INPUT_LANGUAGE = "input_language"; public static final String PREF_SELECTED_LANGUAGES = "selected_languages"; @@ -94,13 +97,17 @@ public class Settings extends InputMethodSettingsFragment private TextView mKeypressVibrationDurationSettingsTextView; private TextView mKeypressSoundVolumeSettingsTextView; + private static void setPreferenceEnabled(Preference preference, boolean enabled) { + if (preference != null) { + preference.setEnabled(enabled); + } + } + private void ensureConsistencyOfAutoCorrectionSettings() { final String autoCorrectionOff = getResources().getString( R.string.auto_correction_threshold_mode_index_off); final String currentSetting = mAutoCorrectionThresholdPreference.getValue(); - if (null != mBigramPrediction) { - mBigramPrediction.setEnabled(!currentSetting.equals(autoCorrectionOff)); - } + setPreferenceEnabled(mBigramPrediction, !currentSetting.equals(autoCorrectionOff)); } @Override @@ -180,13 +187,11 @@ public class Settings extends InputMethodSettingsFragment if (null == mKeyPreviewPopupDismissDelay.getValue()) { mKeyPreviewPopupDismissDelay.setValue(popupDismissDelayDefaultValue); } - mKeyPreviewPopupDismissDelay.setEnabled( + setPreferenceEnabled(mKeyPreviewPopupDismissDelay, SettingsValues.isKeyPreviewPopupEnabled(prefs, res)); } - final CheckBoxPreference includeOtherImesInLanguageSwitchList = - (CheckBoxPreference)findPreference(PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST); - includeOtherImesInLanguageSwitchList.setEnabled( + setPreferenceEnabled(findPreference(PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST), !SettingsValues.isLanguageSwitchKeySupressed(prefs)); final PreferenceScreen dictionaryLink = @@ -200,10 +205,19 @@ public class Settings extends InputMethodSettingsFragment final boolean gestureInputEnabledByBuildConfig = res.getBoolean( R.bool.config_gesture_input_enabled_by_build_config); + final Preference gesturePreviewTrail = findPreference(PREF_GESTURE_PREVIEW_TRAIL); + final Preference gestureFloatingPreviewText = findPreference( + PREF_GESTURE_FLOATING_PREVIEW_TEXT); if (!gestureInputEnabledByBuildConfig) { - final Preference gestureInputPref = findPreference(PREF_GESTURE_INPUT); - miscSettings.removePreference(gestureInputPref); + miscSettings.removePreference(findPreference(PREF_GESTURE_INPUT)); + miscSettings.removePreference(gesturePreviewTrail); + miscSettings.removePreference(gestureFloatingPreviewText); + } else { + final boolean gestureInputEnabledByUser = prefs.getBoolean(PREF_GESTURE_INPUT, true); + setPreferenceEnabled(gesturePreviewTrail, gestureInputEnabledByUser); + setPreferenceEnabled(gestureFloatingPreviewText, gestureInputEnabledByUser); } + final boolean showUsabilityStudyModeOption = res.getBoolean(R.bool.config_enable_usability_study_mode_option) || ProductionFlag.IS_EXPERIMENTAL || ENABLE_EXPERIMENTAL_SETTINGS; @@ -277,17 +291,22 @@ public class Settings extends InputMethodSettingsFragment public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { (new BackupManager(getActivity())).dataChanged(); if (key.equals(PREF_POPUP_ON)) { - final ListPreference popupDismissDelay = - (ListPreference)findPreference(PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY); - if (null != popupDismissDelay) { - popupDismissDelay.setEnabled(prefs.getBoolean(PREF_POPUP_ON, true)); - } + setPreferenceEnabled(findPreference(PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY), + prefs.getBoolean(PREF_POPUP_ON, true)); } else if (key.equals(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY)) { - final CheckBoxPreference includeOtherImesInLanguageSwicthList = - (CheckBoxPreference)findPreference( - PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST); - includeOtherImesInLanguageSwicthList.setEnabled( + setPreferenceEnabled(findPreference(PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST), !SettingsValues.isLanguageSwitchKeySupressed(prefs)); + } else if (key.equals(PREF_GESTURE_INPUT)) { + final boolean gestureInputEnabledByConfig = getResources().getBoolean( + R.bool.config_gesture_input_enabled_by_build_config); + if (gestureInputEnabledByConfig) { + final boolean gestureInputEnabledByUser = prefs.getBoolean( + PREF_GESTURE_INPUT, true); + setPreferenceEnabled(findPreference(PREF_GESTURE_PREVIEW_TRAIL), + gestureInputEnabledByUser); + setPreferenceEnabled(findPreference(PREF_GESTURE_FLOATING_PREVIEW_TEXT), + gestureInputEnabledByUser); + } } ensureConsistencyOfAutoCorrectionSettings(); updateVoiceModeSummary(); @@ -335,16 +354,18 @@ public class Settings extends InputMethodSettingsFragment private void refreshEnablingsOfKeypressSoundAndVibrationSettings( SharedPreferences sp, Resources res) { if (mKeypressVibrationDurationSettingsPref != null) { - final boolean hasVibrator = VibratorUtils.getInstance(getActivity()).hasVibrator(); - final boolean vibrateOn = hasVibrator && sp.getBoolean(Settings.PREF_VIBRATE_ON, + final boolean hasVibratorHardware = VibratorUtils.getInstance(getActivity()) + .hasVibrator(); + final boolean vibrateOnByUser = sp.getBoolean(Settings.PREF_VIBRATE_ON, res.getBoolean(R.bool.config_default_vibration_enabled)); - mKeypressVibrationDurationSettingsPref.setEnabled(vibrateOn); + setPreferenceEnabled(mKeypressVibrationDurationSettingsPref, + hasVibratorHardware && vibrateOnByUser); } if (mKeypressSoundVolumeSettingsPref != null) { final boolean soundOn = sp.getBoolean(Settings.PREF_SOUND_ON, res.getBoolean(R.bool.config_default_sound_enabled)); - mKeypressSoundVolumeSettingsPref.setEnabled(soundOn); + setPreferenceEnabled(mKeypressSoundVolumeSettingsPref, soundOn); } } diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java index 3ed981375..0843bdbbc 100644 --- a/java/src/com/android/inputmethod/latin/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/SettingsValues.java @@ -84,6 +84,8 @@ public class SettingsValues { private final float mKeypressSoundVolumeRawValue; private final InputMethodSubtype[] mAdditionalSubtypes; public final boolean mGestureInputEnabled; + public final boolean mGesturePreviewTrailEnabled; + public final boolean mGestureFloatingPreviewTextEnabled; // From the input box private final InputAttributes mInputAttributes; @@ -174,6 +176,9 @@ public class SettingsValues { R.bool.config_gesture_input_enabled_by_build_config); mGestureInputEnabled = gestureInputEnabledByBuildConfig && prefs.getBoolean(Settings.PREF_GESTURE_INPUT, true); + mGesturePreviewTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true); + mGestureFloatingPreviewTextEnabled = prefs.getBoolean( + Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true); mCorrectionEnabled = mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect; mSuggestionVisibility = createSuggestionVisibility(res); } -- cgit v1.2.3-83-g751a From edf7990e84bd05adefd1d9585dc1b3baf223cdd6 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 30 Jul 2012 16:50:03 +0900 Subject: Small fix to KeyboardView Change-Id: Ifb7500ec2e55b50bb7951aa847fd4fbf49e32f4e --- .../com/android/inputmethod/keyboard/KeyboardView.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'java') diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 9c6543b61..51cd37544 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -255,10 +255,12 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } public void updateKeyHeight(int keyHeight) { - if (mKeyLetterRatio >= 0.0f) + if (mKeyLetterRatio >= 0.0f) { mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio); - if (mKeyLabelRatio >= 0.0f) + } + if (mKeyLabelRatio >= 0.0f) { mKeyLabelSize = (int)(keyHeight * mKeyLabelRatio); + } mKeyLargeLabelSize = (int)(keyHeight * mKeyLargeLabelRatio); mKeyLargeLetterSize = (int)(keyHeight * mKeyLargeLetterRatio); mKeyHintLetterSize = (int)(keyHeight * mKeyHintLetterRatio); @@ -340,13 +342,16 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } public void updateKeyHeight(int keyHeight) { - mPreviewTextSize = (int)(keyHeight * mPreviewTextRatio); - mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio); + if (mPreviewTextRatio >= 0.0f) { + mPreviewTextSize = (int)(keyHeight * mPreviewTextRatio); + } + if (mKeyLetterRatio >= 0.0f) { + mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio); + } } private static void setAlpha(Drawable drawable, int alpha) { - if (drawable == null) - return; + if (drawable == null) return; drawable.setAlpha(alpha); } } -- cgit v1.2.3-83-g751a From ca57f5ba40b587a7a7f8a023aca65e1b2127b2a6 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 30 Jul 2012 16:06:19 +0900 Subject: Move gesture preview parameters to KeyboardView attributes Change-Id: Iff9d6b485e202656fc869f3ff4d94575ad2c186f --- java/res/values/attrs.xml | 12 +++ java/res/values/dimens.xml | 10 +- java/res/values/styles.xml | 14 ++- .../android/inputmethod/keyboard/KeyboardView.java | 7 +- .../keyboard/internal/PreviewPlacerView.java | 104 +++++++++++---------- .../com/android/inputmethod/latin/LatinIME.java | 7 +- 6 files changed, 91 insertions(+), 63 deletions(-) (limited to 'java') diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 1d52e46bb..02e8eeb3b 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -118,6 +118,18 @@ + + + + + + + + + + + + diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index b47897f3c..c59bad302 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -96,9 +96,9 @@ 2.5dp - 35dp - 75dp - 17.5dp - 7.5dp - 1.0dp + 35dp + 75dp + 17.5dp + 7.5dp + 1.0dp diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index 8797fd7aa..955a27631 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -14,7 +14,7 @@ limitations under the License. --> - +