diff options
Diffstat (limited to 'java')
62 files changed, 817 insertions, 595 deletions
diff --git a/java/res/values-af/strings.xml b/java/res/values-af/strings.xml index b9c26f89a..7431fced8 100644 --- a/java/res/values-af/strings.xml +++ b/java/res/values-af/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Steminvoering"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Glimlag-gesiggie"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Enter"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Soek"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Punt"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift geaktiveer"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Kasslot geaktiveer"</string> diff --git a/java/res/values-be/strings.xml b/java/res/values-be/strings.xml index 803dcbdc8..4d14565b9 100644 --- a/java/res/values-be/strings.xml +++ b/java/res/values-be/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Галасавы ўвод"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Смайлік"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Увод"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Пошук"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Кропка"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift уключаны"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Caps Lock уключаны"</string> diff --git a/java/res/values-bg/strings.xml b/java/res/values-bg/strings.xml index b235e2ece..106a91806 100644 --- a/java/res/values-bg/strings.xml +++ b/java/res/values-bg/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Гласово въвеждане"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Усмивка"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Return"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Търсене"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Точка"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"„Shift“ е активиран"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"„Caps Lock“ е активиран"</string> diff --git a/java/res/values-ca/strings.xml b/java/res/values-ca/strings.xml index 23874499d..e3adbcff4 100644 --- a/java/res/values-ca/strings.xml +++ b/java/res/values-ca/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Entrada de veu"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Cara somrient"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Retorn"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Cerca"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Punt"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Maj activat"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Bloq Maj activat"</string> diff --git a/java/res/values-cs/strings.xml b/java/res/values-cs/strings.xml index 530f475fe..b3e2ca788 100644 --- a/java/res/values-cs/strings.xml +++ b/java/res/values-cs/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Hlasový vstup"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Smajlík"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Enter"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"vyhledávací tlačítko"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Tečka"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Klávesa Shift je aktivní"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Klávesa Caps Lock je aktivní"</string> diff --git a/java/res/values-es/strings.xml b/java/res/values-es/strings.xml index bcc327f68..3c60aa6e2 100644 --- a/java/res/values-es/strings.xml +++ b/java/res/values-es/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Entrada de voz"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Emoticono"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Tecla Intro"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Buscar"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Punto"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Mayúsculas habilitadas"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Bloqueo de mayúsculas habilitado"</string> diff --git a/java/res/values-et/strings.xml b/java/res/values-et/strings.xml index 25fee556d..4a592c36b 100644 --- a/java/res/values-et/strings.xml +++ b/java/res/values-et/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Kõnesisend"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Naerunägu"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Tagasi"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Otsing"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Punkt"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Tõstuklahv on lubatud"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Suurtähelukk on lubatud"</string> diff --git a/java/res/values-fa/strings.xml b/java/res/values-fa/strings.xml index ed5d357b1..bc0e85b77 100644 --- a/java/res/values-fa/strings.xml +++ b/java/res/values-fa/strings.xml @@ -97,8 +97,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"ورودی صدا"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"صورت متبسم"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Return"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"جستجو"</string> <string name="spoken_description_dot" msgid="40711082435231673">"نقطه"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift فعال است"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Caps lock فعال شد"</string> diff --git a/java/res/values-fi/strings.xml b/java/res/values-fi/strings.xml index b8b401be1..97002edfe 100644 --- a/java/res/values-fi/strings.xml +++ b/java/res/values-fi/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Puheohjaus"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Hymiö"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Enter"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Haku"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Piste"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Vaihto päällä"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Caps lock päällä"</string> diff --git a/java/res/values-hr/strings.xml b/java/res/values-hr/strings.xml index a639073f1..a59d4698f 100644 --- a/java/res/values-hr/strings.xml +++ b/java/res/values-hr/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Glasovni unos"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Smješko"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Enter"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Pretraživanje"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Točka"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Omogućena tipka Shift"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Omogućeno pisanje velikih slova"</string> diff --git a/java/res/values-ja/strings.xml b/java/res/values-ja/strings.xml index 891beef7b..3a865166f 100644 --- a/java/res/values-ja/strings.xml +++ b/java/res/values-ja/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"音声入力"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"顔文字"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Enter"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"検索"</string> <string name="spoken_description_dot" msgid="40711082435231673">"中点"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift有効"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Caps lock有効"</string> diff --git a/java/res/values-lt/strings.xml b/java/res/values-lt/strings.xml index b093e8629..d8c982d28 100644 --- a/java/res/values-lt/strings.xml +++ b/java/res/values-lt/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Įvestis balsu"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Šypsenėlė"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Grįžti"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Ieškoti"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Taškas"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Įgalintas antrasis lygis"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Įgalintos didžiosios raidės"</string> diff --git a/java/res/values-ms/strings.xml b/java/res/values-ms/strings.xml index f584f6668..a07c44f2c 100644 --- a/java/res/values-ms/strings.xml +++ b/java/res/values-ms/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Input suara"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Muka senyum"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Return"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Carian"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Titik"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Kunci anjak didayakan"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Kunci huruf besar didayakan"</string> diff --git a/java/res/values-nb/strings.xml b/java/res/values-nb/strings.xml index 158b067bb..8ed23763a 100644 --- a/java/res/values-nb/strings.xml +++ b/java/res/values-nb/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Taleinndata"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Smilefjes"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Return"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Søk"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Prikk"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift er aktivert"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Caps Lock er aktivert"</string> diff --git a/java/res/values-pl/strings.xml b/java/res/values-pl/strings.xml index c2c7820f6..bf27782b6 100644 --- a/java/res/values-pl/strings.xml +++ b/java/res/values-pl/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Wprowadzanie głosowe"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Uśmiechnięta buźka"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Enter"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Szukaj"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Punkt"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift włączony"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Caps lock włączony"</string> diff --git a/java/res/values-pt/strings.xml b/java/res/values-pt/strings.xml index d468712e4..7d64759d8 100644 --- a/java/res/values-pt/strings.xml +++ b/java/res/values-pt/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Entrada de voz"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Carinha sorridente"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Voltar"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Pesquisar"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Ponto"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift ativado"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Caps lock ativado"</string> diff --git a/java/res/values-ru/strings.xml b/java/res/values-ru/strings.xml index 3bde1464d..a9bd6ace1 100644 --- a/java/res/values-ru/strings.xml +++ b/java/res/values-ru/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Голосовой ввод"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Смайлик"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Клавиша \"Ввод\""</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Поиск"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Точка"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Верхний регистр включен"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Caps Lock включен"</string> diff --git a/java/res/values-sk/strings.xml b/java/res/values-sk/strings.xml index b11142cf8..5b4224d8a 100644 --- a/java/res/values-sk/strings.xml +++ b/java/res/values-sk/strings.xml @@ -60,7 +60,7 @@ <string name="auto_correction_threshold_mode_off" msgid="8470882665417944026">"Vypnuté"</string> <string name="auto_correction_threshold_mode_modest" msgid="8788366690620799097">"Mierne"</string> <string name="auto_correction_threshold_mode_aggeressive" msgid="3524029103734923819">"Agresívne"</string> - <string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Veľmi agresívna"</string> + <string name="auto_correction_threshold_mode_very_aggeressive" msgid="3386782235540547678">"Veľmi agresívne"</string> <string name="bigram_suggestion" msgid="8169311444438922902">"Návrhy ďalšieho slova"</string> <string name="bigram_suggestion_summary" msgid="6635527607242625713">"Na zlepšenie návrhov použiť predchádzajúce slovo"</string> <string name="bigram_prediction" msgid="3216364899483135294">"Odhad ďalšieho slova"</string> @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Hlasový vstup"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Usmiata tvár"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Enter"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"vyhľadávacie tlačidlo"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Bodka"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Kláves Shift je povolený"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Kláves Caps Lock je povolený"</string> diff --git a/java/res/values-sl/strings.xml b/java/res/values-sl/strings.xml index ed8c77f61..ce7dc70bb 100644 --- a/java/res/values-sl/strings.xml +++ b/java/res/values-sl/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Glasovni vnos"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Smeško"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Vračalka"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Iskanje"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Pika"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Način »Shift« je omogočen"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Način »Caps Lock« je omogočen"</string> diff --git a/java/res/values-sr/strings.xml b/java/res/values-sr/strings.xml index 950baad47..6d2899b47 100644 --- a/java/res/values-sr/strings.xml +++ b/java/res/values-sr/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Гласовни унос"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Смајли"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Return"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Претражи"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Тачка"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift је омогућен"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Caps lock је омогућен"</string> diff --git a/java/res/values-tl/strings.xml b/java/res/values-tl/strings.xml index 75e56ec4f..7d365b2dc 100644 --- a/java/res/values-tl/strings.xml +++ b/java/res/values-tl/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Input ng boses"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Smiley na mukha"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Bumalik"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Paghahanap"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Tuldok"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Pinagana ang shift"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Pinagana ang caps lock"</string> diff --git a/java/res/values-tr/strings.xml b/java/res/values-tr/strings.xml index 49c861fb3..39737f55e 100644 --- a/java/res/values-tr/strings.xml +++ b/java/res/values-tr/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Ses girişi"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Gülen yüz"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Enter"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Ara"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Nokta"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Üst karakter etkin"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Büyük harf kilidi etkin"</string> diff --git a/java/res/values-uk/strings.xml b/java/res/values-uk/strings.xml index 9d5063458..49889fc50 100644 --- a/java/res/values-uk/strings.xml +++ b/java/res/values-uk/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Голосовий ввід"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Смайлик"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Клавіша Return"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Пошук"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Крапка"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift увімкнено"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Caps Lock увімкнено"</string> diff --git a/java/res/values-vi/strings.xml b/java/res/values-vi/strings.xml index 80844c177..753af1840 100644 --- a/java/res/values-vi/strings.xml +++ b/java/res/values-vi/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"Nhập dữ liệu bằng giọng nói"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"Mặt cười"</string> <string name="spoken_description_return" msgid="8178083177238315647">"Quay lại"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"Tìm kiếm"</string> <string name="spoken_description_dot" msgid="40711082435231673">"Dấu chấm"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Đã bật Shift"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"Đã bật Caps lock"</string> diff --git a/java/res/values-zh-rCN/strings.xml b/java/res/values-zh-rCN/strings.xml index 7ff03643f..efde54103 100644 --- a/java/res/values-zh-rCN/strings.xml +++ b/java/res/values-zh-rCN/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"语音输入"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"笑脸"</string> <string name="spoken_description_return" msgid="8178083177238315647">"返回"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"搜索"</string> <string name="spoken_description_dot" msgid="40711082435231673">"点"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift 模式已启用"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"大写锁定已启用"</string> diff --git a/java/res/values-zh-rTW/strings.xml b/java/res/values-zh-rTW/strings.xml index 9c5d88bef..51df022aa 100644 --- a/java/res/values-zh-rTW/strings.xml +++ b/java/res/values-zh-rTW/strings.xml @@ -93,8 +93,7 @@ <string name="spoken_description_mic" msgid="615536748882611950">"語音輸入"</string> <string name="spoken_description_smiley" msgid="2256309826200113918">"笑臉"</string> <string name="spoken_description_return" msgid="8178083177238315647">"返回"</string> - <!-- no translation found for spoken_description_search (1247236163755920808) --> - <skip /> + <string name="spoken_description_search" msgid="1247236163755920808">"搜尋"</string> <string name="spoken_description_dot" msgid="40711082435231673">"點"</string> <string name="spoken_description_shiftmode_on" msgid="5700440798609574589">"Shift 鍵已啟用"</string> <string name="spoken_description_shiftmode_locked" msgid="593175803181701830">"大寫鎖定已啟用"</string> diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index d51d3789a..d663b008d 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -26,6 +26,8 @@ <string name="english_ime_settings">Android keyboard settings</string> <!-- Title for Latin keyboard input options dialog [CHAR LIMIT=25] --> <string name="english_ime_input_options">Input options</string> + <!-- Title for Latin keyboard research log dialog, which contains special commands for users that contribute data for research. [CHAR LIMIT=25] --> + <string name="english_ime_research_log">Research Log Commands</string> <!-- Name of Android spell checker service --> <string name="spell_checker_service_name">Android spell checker</string> @@ -233,6 +235,20 @@ <!-- Title for input language selection screen --> <string name="language_selection_title">Input languages</string> + <!-- Title for dialog option that lets user mark a particular time in the log for later review by experts [CHAR LIMIT=25] --> + <string name="note_timestamp_for_researchlog">Note timestamp in log</string> + <!-- Toast notification message that the time has been marked for later review. [CHAR LIMIT=25] --> + <string name="notify_recorded_timestamp">Recorded timestamp</string> + + <!-- Title for dialog option to let users cancel logging and delete log for this session [CHAR LIMIT=25] --> + <string name="do_not_log_this_session">Do not log this session</string> + <!-- Toast notification that the system is processing the request to delete the log for this session [CHAR LIMIT=25] --> + <string name="notify_session_log_deleting">Deleting session log</string> + <!-- Toast notification that the system has successfully deleted the log for this session [CHAR LIMIT=25] --> + <string name="notify_session_log_deleted">Session log deleted</string> + <!-- Toast notification that the system has failed to delete the log for this session [CHAR LIMIT=25] --> + <string name="notify_session_log_not_deleted">Session log NOT deleted</string> + <!-- Preference for input language selection --> <string name="select_language">Input languages</string> diff --git a/java/res/xml-sw600dp/key_apostrophe.xml b/java/res/xml-sw600dp/key_apostrophe.xml index 7da4b6223..0c838db56 100644 --- a/java/res/xml-sw600dp/key_apostrophe.xml +++ b/java/res/xml-sw600dp/key_apostrophe.xml @@ -23,20 +23,11 @@ > <switch> <case - latin:mode="email" + latin:mode="email|url" > <Key latin:keyLabel="-" /> </case> - <case - latin:mode="url" - > - <Key - latin:keyLabel="/" - latin:keyHintLabel=":" - latin:moreKeys=":" - latin:keyStyle="hasShiftedLetterHintStyle" /> - </case> <default> <Key latin:keyLabel="!text/keylabel_for_apostrophe" diff --git a/java/res/xml-sw600dp/key_dash.xml b/java/res/xml-sw600dp/key_dash.xml index f7e0b3436..8f91effd0 100644 --- a/java/res/xml-sw600dp/key_dash.xml +++ b/java/res/xml-sw600dp/key_dash.xml @@ -23,7 +23,7 @@ > <switch> <case - latin:mode="email" + latin:mode="email|url" > <Key latin:keyLabel="_" /> diff --git a/java/res/xml-sw600dp/key_f1.xml b/java/res/xml-sw600dp/key_f1.xml new file mode 100644 index 000000000..77afe4e64 --- /dev/null +++ b/java/res/xml-sw600dp/key_f1.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2012, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<merge + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" +> + <switch> + <case + latin:keyboardLayoutSetElement="symbols" + latin:mode="url" + > + <Key + latin:keyLabel=":" /> + </case> + <case + latin:keyboardLayoutSetElement="symbols" + > + <Key + latin:keyLabel="\@" /> + </case> + <!-- keyboardLayoutSetElement != "symbols" --> + <case + latin:mode="email" + > + <Key + latin:keyLabel="\@" /> + </case> + <case + latin:mode="url" + > + <Key + latin:keyLabel="/" + latin:keyHintLabel=":" + latin:moreKeys=":" + latin:keyStyle="hasShiftedLetterHintStyle" /> + </case> + <default> + <Key + latin:keyLabel="/" + latin:keyHintLabel="\@" + latin:moreKeys="\@" + latin:keyStyle="hasShiftedLetterHintStyle" /> + </default> + </switch> +</merge> diff --git a/java/res/xml-sw600dp/key_f2.xml b/java/res/xml-sw600dp/key_f2.xml new file mode 100644 index 000000000..ca3b30b54 --- /dev/null +++ b/java/res/xml-sw600dp/key_f2.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2012, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<merge + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" +> + <switch> + <case + latin:mode="email|url" + > + <Key + latin:keyStyle="comKeyStyle" /> + </case> + <case + latin:imeAction="actionSearch" + > + <Key + latin:keyLabel=":" + latin:keyHintLabel="+" + latin:moreKeys="+" + latin:keyStyle="hasShiftedLetterHintStyle" /> + </case> + <default> + <Key + latin:keyStyle="smileyKeyStyle" /> + </default> + </switch> +</merge> diff --git a/java/res/xml-sw600dp/key_question_exclamation.xml b/java/res/xml-sw600dp/key_question_exclamation.xml index f1495de49..860a0be77 100644 --- a/java/res/xml-sw600dp/key_question_exclamation.xml +++ b/java/res/xml-sw600dp/key_question_exclamation.xml @@ -23,20 +23,11 @@ > <switch> <case - latin:mode="email" + latin:mode="email|url" > <Key latin:keyLabel="-" /> </case> - <case - latin:mode="url" - > - <Key - latin:keyLabel="/" - latin:keyHintLabel=":" - latin:moreKeys=":" - latin:keyStyle="hasShiftedLetterHintStyle" /> - </case> <default> <Key latin:keyLabel="\?" diff --git a/java/res/xml-sw600dp/keys_f1f2.xml b/java/res/xml-sw600dp/keys_f1f2.xml deleted file mode 100644 index 721bfc722..000000000 --- a/java/res/xml-sw600dp/keys_f1f2.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" -> - <switch> - <case - latin:mode="url" - > - <Key - latin:keyStyle="comKeyStyle" - latin:keyWidth="18.0%p" /> - </case> - <default> - <switch> - <case - latin:mode="email" - > - <Key - latin:keyStyle="comKeyStyle" /> - </case> - <case - latin:imeAction="actionSearch" - > - <Key - latin:keyLabel=":" - latin:keyHintLabel="+" - latin:moreKeys="+" - latin:keyStyle="hasShiftedLetterHintStyle" /> - </case> - <default> - <Key - latin:keyStyle="smileyKeyStyle" /> - </default> - </switch> - <switch> - <case - latin:mode="email" - > - <Key - latin:keyLabel="\@" /> - </case> - <default> - <Key - latin:keyLabel="/" - latin:keyHintLabel="\@" - latin:moreKeys="\@" - latin:keyStyle="hasShiftedLetterHintStyle" /> - </default> - </switch> - </default> - </switch> -</merge> diff --git a/java/res/xml-sw600dp/row_dvorak4.xml b/java/res/xml-sw600dp/row_dvorak4.xml index ffc3427c5..47cee4585 100644 --- a/java/res/xml-sw600dp/row_dvorak4.xml +++ b/java/res/xml-sw600dp/row_dvorak4.xml @@ -23,22 +23,24 @@ > <Row latin:keyWidth="9.0%p" + backgroundType="functional" > <Key latin:keyStyle="toSymbolKeyStyle" latin:keyWidth="10.0%p" /> <include - latin:keyboardLayout="@xml/keys_f1f2" /> + latin:keyboardLayout="@xml/key_shortcut" /> + <include + latin:keyboardLayout="@xml/key_f1" /> <include latin:keyXPos="28.0%p" - latin:keyboardLayout="@xml/key_space" /> + latin:keyboardLayout="@xml/key_space" + latin:backgroundType="normal" /> <include latin:keyboardLayout="@xml/key_question_exclamation" /> <include latin:keyboardLayout="@xml/key_dash" /> <include - latin:keyXPos="-9.0%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_f2" /> </Row> </merge> diff --git a/java/res/xml-sw600dp/row_hebrew4.xml b/java/res/xml-sw600dp/row_hebrew4.xml index 114a5cc16..f429f97fb 100644 --- a/java/res/xml-sw600dp/row_hebrew4.xml +++ b/java/res/xml-sw600dp/row_hebrew4.xml @@ -23,20 +23,22 @@ > <Row latin:keyWidth="9.0%p" + latin:backgroundType="functional" > <Key latin:keyStyle="toSymbolKeyStyle" latin:keyWidth="10.0%p" /> <include - latin:keyboardLayout="@xml/keys_f1f2" /> + latin:keyboardLayout="@xml/key_shortcut" /> + <include + latin:keyboardLayout="@xml/key_f1" /> <include latin:keyXPos="28.0%p" - latin:keyboardLayout="@xml/key_space" /> + latin:keyboardLayout="@xml/key_space" + latin:backgroundType="normal" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <include - latin:keyXPos="-9.0%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_f2" /> </Row> </merge> diff --git a/java/res/xml-sw600dp/row_qwerty4.xml b/java/res/xml-sw600dp/row_qwerty4.xml index a4ba8a4c3..fa433635e 100644 --- a/java/res/xml-sw600dp/row_qwerty4.xml +++ b/java/res/xml-sw600dp/row_qwerty4.xml @@ -23,22 +23,24 @@ > <Row latin:keyWidth="9.0%p" + latin:backgroundType="functional" > <Key latin:keyStyle="toSymbolKeyStyle" latin:keyWidth="10.0%p" /> <include - latin:keyboardLayout="@xml/keys_f1f2" /> + latin:keyboardLayout="@xml/key_shortcut" /> + <include + latin:keyboardLayout="@xml/key_f1" /> <include latin:keyXPos="28.0%p" - latin:keyboardLayout="@xml/key_space" /> + latin:keyboardLayout="@xml/key_space" + latin:backgroundType="normal" /> <include latin:keyboardLayout="@xml/key_apostrophe" /> <include latin:keyboardLayout="@xml/key_dash" /> <include - latin:keyXPos="-9.0%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_f2" /> </Row> </merge> diff --git a/java/res/xml-sw600dp/row_symbols4.xml b/java/res/xml-sw600dp/row_symbols4.xml index 20d1a7dff..73a5b1703 100644 --- a/java/res/xml-sw600dp/row_symbols4.xml +++ b/java/res/xml-sw600dp/row_symbols4.xml @@ -23,25 +23,24 @@ > <Row latin:keyWidth="9.0%p" + latin:backgroundType="functional" > <Key latin:keyStyle="toAlphaKeyStyle" latin:keyWidth="10.0%p" /> <Key latin:keyLabel="/" /> - <Key - latin:keyLabel="\@" /> + <include + latin:keyboardLayout="@xml/key_f1" /> <include latin:keyXPos="28.0%p" - latin:keyboardLayout="@xml/key_space" /> + latin:keyboardLayout="@xml/key_space" + latin:backgroundType="normal" /> <Key latin:keyLabel=""" latin:moreKeys="!text/more_keys_for_tablet_double_quote" /> <Key latin:keyLabel="_" /> - <include - latin:keyXPos="-9.0%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> + <!-- Here is empty space. --> </Row> </merge> diff --git a/java/res/xml-sw600dp/row_symbols_shift4.xml b/java/res/xml-sw600dp/row_symbols_shift4.xml index fd7b37032..6f3aac7c6 100644 --- a/java/res/xml-sw600dp/row_symbols_shift4.xml +++ b/java/res/xml-sw600dp/row_symbols_shift4.xml @@ -23,16 +23,16 @@ > <Row latin:keyWidth="9.0%p" + latin:backgroundType="functional" > <Key latin:keyStyle="toAlphaKeyStyle" latin:keyWidth="10.0%p" /> + <!-- Here is empty space. --> <include latin:keyXPos="28.0%p" - latin:keyboardLayout="@xml/key_space" /> - <include - latin:keyXPos="-9.0%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_space" + latin:backgroundType="normal" /> + <!-- Here is empty space. --> </Row> </merge> diff --git a/java/res/xml-sw600dp/rows_number_normal.xml b/java/res/xml-sw600dp/rows_number_normal.xml index 3954b000e..48b304089 100644 --- a/java/res/xml-sw600dp/rows_number_normal.xml +++ b/java/res/xml-sw600dp/rows_number_normal.xml @@ -25,15 +25,18 @@ <Key latin:keyLabel="-" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="+" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="." latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="1" latin:keyStyle="numKeyStyle" @@ -52,11 +55,13 @@ <Row> <Key latin:keyStyle="numStarKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="/" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <switch> <case latin:mode="time|datetime" @@ -66,13 +71,15 @@ latin:keyLabelFlags="hasPopupHint" latin:moreKeys="!text/more_keys_for_am_pm" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> </case> <default> <Key latin:keyLabel="," latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> </default> </switch> <Key @@ -94,11 +101,13 @@ <Key latin:keyLabel="(" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyLabel=")" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <switch> <case latin:mode="time|datetime" @@ -106,13 +115,15 @@ <Key latin:keyLabel=":" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> </case> <default> <Key latin:keyLabel="=" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> </default> </switch> <Key @@ -131,7 +142,8 @@ <Row> <Key latin:keyStyle="spaceKeyStyle" - latin:keyWidth="30%p" /> + latin:keyWidth="30%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="numStarKeyStyle" latin:keyXPos="31%p" /> @@ -141,9 +153,5 @@ <Key latin:keyLabel="#" latin:keyStyle="numKeyStyle" /> - <include - latin:keyXPos="-10%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> </Row> </merge> diff --git a/java/res/xml-sw600dp/rows_phone.xml b/java/res/xml-sw600dp/rows_phone.xml index 113ce1fa6..dcc4fde7d 100644 --- a/java/res/xml-sw600dp/rows_phone.xml +++ b/java/res/xml-sw600dp/rows_phone.xml @@ -29,14 +29,17 @@ <Key latin:keyLabel="-" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="+" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="numPauseKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="num1KeyStyle" latin:keyXPos="31%p" /> @@ -53,14 +56,17 @@ <Key latin:keyLabel="," latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="." latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="numWaitKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="num4KeyStyle" latin:keyXPos="31%p" /> @@ -77,15 +83,18 @@ <Key latin:keyLabel="(" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyLabel=")" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="N" latin:keyStyle="numKeyStyle" - latin:keyWidth="10%p" /> + latin:keyWidth="10%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="num7KeyStyle" latin:keyXPos="31%p" /> @@ -99,7 +108,8 @@ <Row> <Key latin:keyStyle="spaceKeyStyle" - latin:keyWidth="30%p" /> + latin:keyWidth="30%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="numStarKeyStyle" latin:keyXPos="31%p" /> @@ -108,9 +118,5 @@ <Key latin:keyLabel="#" latin:keyStyle="numKeyStyle" /> - <include - latin:keyXPos="-10%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> </Row> </merge> diff --git a/java/res/xml-sw768dp/key_settings.xml b/java/res/xml-sw768dp/key_settings.xml index 0359a99c5..0d3bb59a4 100644 --- a/java/res/xml-sw768dp/key_settings.xml +++ b/java/res/xml-sw768dp/key_settings.xml @@ -32,4 +32,4 @@ <Spacer /> </default> </switch> - </merge> +</merge> diff --git a/java/res/xml-sw768dp/key_shortcut.xml b/java/res/xml-sw768dp/key_shortcut.xml index 905270599..2d09ebbfc 100644 --- a/java/res/xml-sw768dp/key_shortcut.xml +++ b/java/res/xml-sw768dp/key_shortcut.xml @@ -28,5 +28,9 @@ <Key latin:keyStyle="shortcutKeyStyle" /> </case> + <default> + <!-- The empty space instead of shortcut key. --> + <Spacer /> + </default> </switch> </merge> diff --git a/java/res/xml-sw768dp/key_styles_common.xml b/java/res/xml-sw768dp/key_styles_common.xml index f2fb90bbc..40082ac35 100644 --- a/java/res/xml-sw768dp/key_styles_common.xml +++ b/java/res/xml-sw768dp/key_styles_common.xml @@ -74,12 +74,6 @@ <include latin:keyboardLayout="@xml/key_styles_enter" /> <key-style - latin:styleName="defaultActionKeyStyle" - latin:code="!code/key_action_enter" - latin:keyIcon="!icon/undefined" - latin:backgroundType="functional" - latin:parentStyle="defaultEnterKeyStyle" /> - <key-style latin:styleName="spaceKeyStyle" latin:code="!code/key_space" latin:keyActionFlags="noKeyPreview" /> diff --git a/java/res/xml-sw768dp/keys_f1f2.xml b/java/res/xml-sw768dp/keys_f1f2.xml deleted file mode 100644 index 569703572..000000000 --- a/java/res/xml-sw768dp/keys_f1f2.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" -> - <switch> - <case - latin:mode="url" - > - <Key - latin:keyStyle="comKeyStyle" - latin:keyWidth="16.084%p" /> - </case> - <default> - <switch> - <case - latin:mode="email" - > - <Key - latin:keyStyle="comKeyStyle" /> - </case> - <case - latin:imeAction="actionSearch" - > - <Key - latin:keyLabel=":" - latin:keyHintLabel="+" - latin:moreKeys="+" - latin:keyStyle="hasShiftedLetterHintStyle" /> - </case> - <default> - <Key - latin:keyStyle="smileyKeyStyle" /> - </default> - </switch> - <switch> - <case - latin:mode="email" - > - <Key - latin:keyLabel="\@" /> - </case> - <default> - <Key - latin:keyLabel="/" - latin:keyHintLabel="\@" - latin:moreKeys="\@" - latin:keyStyle="hasShiftedLetterHintStyle" /> - </default> - </switch> - </default> - </switch> -</merge> diff --git a/java/res/xml-sw768dp/row_dvorak4.xml b/java/res/xml-sw768dp/row_dvorak4.xml index ebe517dce..0827815c9 100644 --- a/java/res/xml-sw768dp/row_dvorak4.xml +++ b/java/res/xml-sw768dp/row_dvorak4.xml @@ -23,22 +23,24 @@ > <Row latin:keyWidth="8.047%p" + latin:backgroundType="functional" > <include + latin:keyXPos="5.782%p" latin:keyboardLayout="@xml/key_settings" /> <include - latin:keyXPos="13.829%p" - latin:keyboardLayout="@xml/keys_f1f2" /> + latin:keyboardLayout="@xml/key_shortcut" /> + <include + latin:keyboardLayout="@xml/key_f1" /> <include latin:keyXPos="29.923%p" - latin:keyboardLayout="@xml/key_space" /> + latin:keyboardLayout="@xml/key_space" + latin:backgroundType="normal" /> <include latin:keyboardLayout="@xml/key_question_exclamation" /> <include latin:keyboardLayout="@xml/key_dash" /> <include - latin:keyXPos="-8.047%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_f2" /> </Row> </merge> diff --git a/java/res/xml-sw768dp/row_hebrew4.xml b/java/res/xml-sw768dp/row_hebrew4.xml index 477fd0d9a..180c5641d 100644 --- a/java/res/xml-sw768dp/row_hebrew4.xml +++ b/java/res/xml-sw768dp/row_hebrew4.xml @@ -23,20 +23,22 @@ > <Row latin:keyWidth="8.047%p" + latin:backgroundType="functional" > <include + latin:keyXPos="5.782%p" latin:keyboardLayout="@xml/key_settings" /> <include - latin:keyXPos="13.829%p" - latin:keyboardLayout="@xml/keys_f1f2" /> + latin:keyboardLayout="@xml/key_shortcut" /> + <include + latin:keyboardLayout="@xml/key_f1" /> <include latin:keyXPos="29.923%p" - latin:keyboardLayout="@xml/key_space" /> + latin:keyboardLayout="@xml/key_space" + latin:backgroundType="normal" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <include - latin:keyXPos="-8.047%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_f2" /> </Row> </merge> diff --git a/java/res/xml-sw768dp/row_qwerty4.xml b/java/res/xml-sw768dp/row_qwerty4.xml index 32a6476c5..92411f54e 100644 --- a/java/res/xml-sw768dp/row_qwerty4.xml +++ b/java/res/xml-sw768dp/row_qwerty4.xml @@ -23,22 +23,24 @@ > <Row latin:keyWidth="8.047%p" + latin:backgroundType="functional" > <include + latin:keyXPos="5.782%p" latin:keyboardLayout="@xml/key_settings" /> <include - latin:keyXPos="13.829%p" - latin:keyboardLayout="@xml/keys_f1f2" /> + latin:keyboardLayout="@xml/key_shortcut" /> + <include + latin:keyboardLayout="@xml/key_f1" /> <include latin:keyXPos="29.923%p" - latin:keyboardLayout="@xml/key_space" /> + latin:keyboardLayout="@xml/key_space" + latin:backgroundType="normal" /> <include latin:keyboardLayout="@xml/key_apostrophe" /> <include latin:keyboardLayout="@xml/key_dash" /> <include - latin:keyXPos="-8.047%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_f2" /> </Row> </merge> diff --git a/java/res/xml-sw768dp/row_symbols4.xml b/java/res/xml-sw768dp/row_symbols4.xml index bd85b4041..4e1c11994 100644 --- a/java/res/xml-sw768dp/row_symbols4.xml +++ b/java/res/xml-sw768dp/row_symbols4.xml @@ -23,25 +23,22 @@ > <Row latin:keyWidth="8.047%p" + latin:backgroundType="functional" > - <include - latin:keyboardLayout="@xml/key_settings" /> - <Key - latin:keyLabel="/" - latin:keyXPos="13.829%p" /> <Key - latin:keyLabel="\@" /> + latin:keyXPos="13.829%p" + latin:keyLabel="/" /> + <include + latin:keyboardLayout="@xml/key_f1" /> <include latin:keyXPos="29.923%p" - latin:keyboardLayout="@xml/key_space" /> + latin:keyboardLayout="@xml/key_space" + latin:backgroundType="normal" /> <Key latin:keyLabel=""" latin:moreKeys="!text/more_keys_for_tablet_double_quote" /> <Key latin:keyLabel="_" /> - <include - latin:keyXPos="-8.047%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> + <!-- Here is empty space. --> </Row> </merge> diff --git a/java/res/xml-sw768dp/row_symbols_shift4.xml b/java/res/xml-sw768dp/row_symbols_shift4.xml index 82c1d17ca..561351cab 100644 --- a/java/res/xml-sw768dp/row_symbols_shift4.xml +++ b/java/res/xml-sw768dp/row_symbols_shift4.xml @@ -23,15 +23,13 @@ > <Row latin:keyWidth="8.047%p" + latin:backgroundType="functional" > - <include - latin:keyboardLayout="@xml/key_settings" /> + <!-- Here is empty space. --> <include latin:keyXPos="29.923%p" - latin:keyboardLayout="@xml/key_space" /> - <include - latin:keyXPos="-8.047%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_space" + latin:backgroundType="normal" /> + <!-- Here is empty space. --> </Row> </merge> diff --git a/java/res/xml-sw768dp/rows_number_normal.xml b/java/res/xml-sw768dp/rows_number_normal.xml index 42697cec1..84910a88f 100644 --- a/java/res/xml-sw768dp/rows_number_normal.xml +++ b/java/res/xml-sw768dp/rows_number_normal.xml @@ -30,15 +30,18 @@ latin:keyLabel="-" latin:keyStyle="numKeyStyle" latin:keyXPos="13.829%p" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="+" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="." latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="1" latin:keyStyle="numKeyStyle" @@ -60,11 +63,13 @@ latin:keyWidth="13.829%p" /> <Key latin:keyStyle="numStarKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="/" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <switch> <case latin:mode="time|datetime" @@ -74,13 +79,15 @@ latin:keyLabelFlags="hasPopupHint" latin:moreKeys="!text/more_keys_for_am_pm" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> </case> <default> <Key latin:keyLabel="," latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> </default> </switch> <Key @@ -105,11 +112,13 @@ <Key latin:keyLabel="(" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyLabel=")" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <switch> <case latin:mode="time|datetime" @@ -117,13 +126,15 @@ <Key latin:keyLabel=":" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> </case> <default> <Key latin:keyLabel="=" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> </default> </switch> <Key @@ -146,7 +157,8 @@ <Key latin:keyStyle="spaceKeyStyle" latin:keyXPos="13.829%p" - latin:keyWidth="24.140%p" /> + latin:keyWidth="24.140%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="numStarKeyStyle" latin:keyXPos="43.125%p" /> @@ -156,9 +168,5 @@ <Key latin:keyLabel="#" latin:keyStyle="numKeyStyle" /> - <include - latin:keyXPos="-8.047%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> </Row> </merge> diff --git a/java/res/xml-sw768dp/rows_phone.xml b/java/res/xml-sw768dp/rows_phone.xml index b3b3521a9..2f718db62 100644 --- a/java/res/xml-sw768dp/rows_phone.xml +++ b/java/res/xml-sw768dp/rows_phone.xml @@ -34,14 +34,17 @@ latin:keyLabel="-" latin:keyStyle="numKeyStyle" latin:keyXPos="13.829%p" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="+" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="numPauseKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="num1KeyStyle" latin:keyXPos="43.125%p" /> @@ -62,14 +65,17 @@ latin:keyLabel="," latin:keyStyle="numKeyStyle" latin:keyXPos="13.829%p" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="." latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="numWaitKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="num4KeyStyle" latin:keyXPos="43.125%p" /> @@ -89,15 +95,18 @@ <Key latin:keyLabel="(" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyLabel=")" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyLabel="N" latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + latin:keyWidth="8.047%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="num7KeyStyle" latin:keyXPos="43.125%p" /> @@ -115,7 +124,8 @@ <Key latin:keyStyle="spaceKeyStyle" latin:keyXPos="13.829%p" - latin:keyWidth="24.140%p" /> + latin:keyWidth="24.140%p" + latin:backgroundType="functional" /> <Key latin:keyStyle="numStarKeyStyle" latin:keyXPos="43.125%p" /> @@ -124,9 +134,5 @@ <Key latin:keyLabel="#" latin:keyStyle="numKeyStyle" /> - <include - latin:keyXPos="-8.047%p" - latin:keyWidth="fillRight" - latin:keyboardLayout="@xml/key_shortcut" /> - </Row> + </Row> </merge> diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml index 819cdc6a9..162119dab 100644 --- a/java/res/xml/key_styles_common.xml +++ b/java/res/xml/key_styles_common.xml @@ -22,23 +22,8 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <!-- Base key style for the key which may have settings or tab key as popup key. --> - <switch> - <case - latin:clobberSettingsKey="true" - > - <key-style - latin:styleName="f1MoreKeysStyle" - latin:backgroundType="functional" /> - </case> - <!-- clobberSettingsKey="false" --> - <default> - <key-style - latin:styleName="f1MoreKeysStyle" - latin:keyLabelFlags="hasPopupHint" - latin:moreKeys="!text/settings_as_more_key" - latin:backgroundType="functional" /> - </default> - </switch> + <include + latin:keyboardLayout="@xml/key_styles_f1" /> <!-- Functional key styles --> <switch> <case @@ -105,8 +90,7 @@ <key-style latin:styleName="spaceKeyStyle" latin:code="!code/key_space" - latin:keyActionFlags="noKeyPreview|enableLongPress" - latin:backgroundType="functional" /> + latin:keyActionFlags="noKeyPreview|enableLongPress" /> <!-- U+200C: ZERO WIDTH NON-JOINER U+200D: ZERO WIDTH JOINER --> <key-style @@ -115,8 +99,7 @@ latin:keyIcon="!icon/zwnj_key" latin:moreKeys="!icon/zwj_key|‍" latin:keyLabelFlags="hasPopupHint" - latin:keyActionFlags="noKeyPreview" - latin:backgroundType="functional" /> + latin:keyActionFlags="noKeyPreview" /> <key-style latin:styleName="shortcutKeyStyle" latin:code="!code/key_shortcut" @@ -137,8 +120,7 @@ latin:code="!code/key_language_switch" latin:keyIcon="!icon/language_switch_key" latin:keyActionFlags="noKeyPreview|altCodeWhileTyping|enableLongPress" - latin:altCode="!code/key_space" - latin:backgroundType="functional" /> + latin:altCode="!code/key_space" /> <key-style latin:styleName="tabKeyStyle" latin:code="!code/key_tab" diff --git a/java/res/xml/key_styles_f1.xml b/java/res/xml/key_styles_f1.xml new file mode 100644 index 000000000..8dfc3cb84 --- /dev/null +++ b/java/res/xml/key_styles_f1.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2012, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<merge + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" +> + <!-- Base key style for the key which may have settings or tab key as popup key. --> + <!-- Kept as a separate file for cleaner overriding by an overlay. --> + <switch> + <case + latin:clobberSettingsKey="true" + > + <key-style + latin:styleName="f1MoreKeysStyle" + latin:backgroundType="functional" /> + </case> + <!-- clobberSettingsKey="false" --> + <default> + <key-style + latin:styleName="f1MoreKeysStyle" + latin:keyLabelFlags="hasPopupHint" + latin:moreKeys="!text/settings_as_more_key" + latin:backgroundType="functional" /> + </default> + </switch> +</merge> diff --git a/java/res/xml/row_qwerty4.xml b/java/res/xml/row_qwerty4.xml index ecb95e7a5..43385d291 100644 --- a/java/res/xml/row_qwerty4.xml +++ b/java/res/xml/row_qwerty4.xml @@ -38,15 +38,14 @@ > <!-- U+064B: "ً" ARABIC FATHATAN --> <Key - latin:keyLabel="." latin:keyHintLabel="ً" latin:keyLabelFlags="hasPopupHint|hasShiftedLetterHint" latin:moreKeys="!text/more_keys_for_arabic_diacritics" - latin:backgroundType="functional" /> + latin:keyStyle="punctuationKeyStyle" /> </case> <default> <Key - latin:keyStyle="punctuationKeyStyle" /> + latin:keyStyle="punctuationKeyStyle" /> </default> </switch> <Key diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index ed873a70d..e1e1ca9cf 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -227,7 +227,7 @@ public class Key { row.setXPos(keyXPos + keyWidth); mBackgroundType = style.getInt(keyAttr, - R.styleable.Keyboard_Key_backgroundType, BACKGROUND_TYPE_NORMAL); + R.styleable.Keyboard_Key_backgroundType, row.getDefaultBackgroundType()); mVisualInsetsLeft = Math.round(Keyboard.Builder.getDimensionOrFraction(keyAttr, R.styleable.Keyboard_Key_visualInsetsLeft, params.mBaseWidth, 0)); diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 0be4cf3a7..6fc630d05 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -89,7 +89,8 @@ public class Keyboard { private static final int MINIMUM_LETTER_CODE = CODE_TAB; /** Special keys code. Must be negative. - * These should be aligned with values/keycodes.xml + * These should be aligned with KeyboardCodesSet.ID_TO_NAME[], + * KeyboardCodesSet.DEFAULT[] and KeyboardCodesSet.RTL[] */ public static final int CODE_SHIFT = -1; public static final int CODE_SWITCH_ALPHA_SYMBOL = -2; @@ -101,8 +102,9 @@ public class Keyboard { public static final int CODE_ACTION_NEXT = -8; public static final int CODE_ACTION_PREVIOUS = -9; public static final int CODE_LANGUAGE_SWITCH = -10; + public static final int CODE_RESEARCH = -11; // Code value representing the code is not specified. - public static final int CODE_UNSPECIFIED = -11; + public static final int CODE_UNSPECIFIED = -12; public final KeyboardId mId; public final int mThemeId; @@ -422,67 +424,67 @@ public class Keyboard { * This class parses Keyboard XML file and eventually build a Keyboard. * The Keyboard XML file looks like: * <pre> - * >!-- xml/keyboard.xml --< - * >Keyboard keyboard_attributes*< - * >!-- Keyboard Content --< - * >Row row_attributes*< - * >!-- Row Content --< - * >Key key_attributes* /< - * >Spacer horizontalGap="32.0dp" /< - * >include keyboardLayout="@xml/other_keys"< + * <!-- xml/keyboard.xml --> + * <Keyboard keyboard_attributes*> + * <!-- Keyboard Content --> + * <Row row_attributes*> + * <!-- Row Content --> + * <Key key_attributes* /> + * <Spacer horizontalGap="32.0dp" /> + * <include keyboardLayout="@xml/other_keys"> * ... - * >/Row< - * >include keyboardLayout="@xml/other_rows"< + * </Row> + * <include keyboardLayout="@xml/other_rows"> * ... - * >/Keyboard< + * </Keyboard> * </pre> - * The XML file which is included in other file must have >merge< as root element, + * The XML file which is included in other file must have <merge> as root element, * such as: * <pre> - * >!-- xml/other_keys.xml --< - * >merge< - * >Key key_attributes* /< + * <!-- xml/other_keys.xml --> + * <merge> + * <Key key_attributes* /> * ... - * >/merge< + * </merge> * </pre> * and * <pre> - * >!-- xml/other_rows.xml --< - * >merge< - * >Row row_attributes*< - * >Key key_attributes* /< - * >/Row< + * <!-- xml/other_rows.xml --> + * <merge> + * <Row row_attributes*> + * <Key key_attributes* /> + * </Row> * ... - * >/merge< + * </merge> * </pre> * You can also use switch-case-default tags to select Rows and Keys. * <pre> - * >switch< - * >case case_attribute*< - * >!-- Any valid tags at switch position --< - * >/case< + * <switch> + * <case case_attribute*> + * <!-- Any valid tags at switch position --> + * </case> * ... - * >default< - * >!-- Any valid tags at switch position --< - * >/default< - * >/switch< + * <default> + * <!-- Any valid tags at switch position --> + * </default> + * </switch> * </pre> * You can declare Key style and specify styles within Key tags. * <pre> - * >switch< - * >case mode="email"< - * >key-style styleName="f1-key" parentStyle="modifier-key" + * <switch> + * <case mode="email"> + * <key-style styleName="f1-key" parentStyle="modifier-key" * keyLabel=".com" - * /< - * >/case< - * >case mode="url"< - * >key-style styleName="f1-key" parentStyle="modifier-key" + * /> + * </case> + * <case mode="url"> + * <key-style styleName="f1-key" parentStyle="modifier-key" * keyLabel="http://" - * /< - * >/case< - * >/switch< + * /> + * </case> + * </switch> * ... - * >Key keyStyle="shift-key" ... /< + * <Key keyStyle="shift-key" ... /> * </pre> */ @@ -533,6 +535,8 @@ public class Keyboard { public final int mRowHeight; /** Default keyLabelFlags in this row. */ private int mDefaultKeyLabelFlags; + /** Default backgroundType for this row */ + private int mDefaultBackgroundType; private final int mCurrentY; // Will be updated by {@link Key}'s constructor. @@ -551,8 +555,11 @@ public class Keyboard { mDefaultKeyWidth = Builder.getDimensionOrFraction(keyAttr, R.styleable.Keyboard_Key_keyWidth, params.mBaseWidth, params.mDefaultKeyWidth); + mDefaultBackgroundType = keyAttr.getInt(R.styleable.Keyboard_Key_backgroundType, + Key.BACKGROUND_TYPE_NORMAL); keyAttr.recycle(); + // TODO: Initialize this with <Row> attribute as backgroundType is done. mDefaultKeyLabelFlags = 0; mCurrentY = y; mCurrentX = 0.0f; @@ -574,6 +581,14 @@ public class Keyboard { mDefaultKeyLabelFlags = keyLabelFlags; } + public int getDefaultBackgroundType() { + return mDefaultBackgroundType; + } + + public void setDefaultBackgroundType(int backgroundType) { + mDefaultBackgroundType = backgroundType; + } + public void setXPos(float keyXPos) { mCurrentX = keyXPos; } @@ -952,6 +967,7 @@ public class Keyboard { int keyboardLayout = 0; float savedDefaultKeyWidth = 0; int savedDefaultKeyLabelFlags = 0; + int savedDefaultBackgroundType = Key.BACKGROUND_TYPE_NORMAL; try { XmlParseUtils.checkAttributeExists(keyboardAttr, R.styleable.Keyboard_Include_keyboardLayout, "keyboardLayout", @@ -959,22 +975,26 @@ public class Keyboard { keyboardLayout = keyboardAttr.getResourceId( R.styleable.Keyboard_Include_keyboardLayout, 0); if (row != null) { - savedDefaultKeyWidth = row.getDefaultKeyWidth(); - savedDefaultKeyLabelFlags = row.getDefaultKeyLabelFlags(); if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyXPos)) { // Override current x coordinate. row.setXPos(row.getKeyX(keyAttr)); } + // TODO: Remove this if-clause and do the same as backgroundType below. + savedDefaultKeyWidth = row.getDefaultKeyWidth(); if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyWidth)) { // Override default key width. row.setDefaultKeyWidth(row.getKeyWidth(keyAttr)); } - if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyLabelFlags)) { - // Override default key label flags. - row.setDefaultKeyLabelFlags( - keyAttr.getInt(R.styleable.Keyboard_Key_keyLabelFlags, 0) - | savedDefaultKeyLabelFlags); - } + savedDefaultKeyLabelFlags = row.getDefaultKeyLabelFlags(); + // Bitwise-or default keyLabelFlag if exists. + row.setDefaultKeyLabelFlags(keyAttr.getInt( + R.styleable.Keyboard_Key_keyLabelFlags, 0) + | savedDefaultKeyLabelFlags); + savedDefaultBackgroundType = row.getDefaultBackgroundType(); + // Override default backgroundType if exists. + row.setDefaultBackgroundType(keyAttr.getInt( + R.styleable.Keyboard_Key_backgroundType, + savedDefaultBackgroundType)); } } finally { keyboardAttr.recycle(); @@ -991,9 +1011,10 @@ public class Keyboard { parseMerge(parserForInclude, row, skip); } finally { if (row != null) { - // Restore default key width and key label flags. + // Restore default keyWidth, keyLabelFlags, and backgroundType. row.setDefaultKeyWidth(savedDefaultKeyWidth); row.setDefaultKeyLabelFlags(savedDefaultKeyLabelFlags); + row.setDefaultBackgroundType(savedDefaultBackgroundType); } parserForInclude.close(); } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java index 67cb74f4d..f7981a320 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardCodesSet.java @@ -52,6 +52,7 @@ public class KeyboardCodesSet { "key_action_next", "key_action_previous", "key_language_switch", + "key_research", "key_unspecified", "key_left_parenthesis", "key_right_parenthesis", @@ -86,6 +87,7 @@ public class KeyboardCodesSet { Keyboard.CODE_ACTION_NEXT, Keyboard.CODE_ACTION_PREVIOUS, Keyboard.CODE_LANGUAGE_SWITCH, + Keyboard.CODE_RESEARCH, Keyboard.CODE_UNSPECIFIED, CODE_LEFT_PARENTHESIS, CODE_RIGHT_PARENTHESIS, @@ -112,6 +114,7 @@ public class KeyboardCodesSet { DEFAULT[11], DEFAULT[12], DEFAULT[13], + DEFAULT[14], CODE_RIGHT_PARENTHESIS, CODE_LEFT_PARENTHESIS, CODE_GREATER_THAN_SIGN, diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 77acf941d..8e50af8a5 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -497,7 +497,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // Note that the calling sequence of onCreate() and onCurrentInputMethodSubtypeChanged() // is not guaranteed. It may even be called at the same time on a different thread. if (null == mPrefs) mPrefs = PreferenceManager.getDefaultSharedPreferences(this); - mUserHistoryDictionary = new UserHistoryDictionary( + mUserHistoryDictionary = UserHistoryDictionary.getInstance( this, localeStr, Suggest.DIC_USER_HISTORY, mPrefs); mSuggest.setUserHistoryDictionary(mUserHistoryDictionary); } @@ -1345,6 +1345,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen case Keyboard.CODE_LANGUAGE_SWITCH: handleLanguageSwitchKey(); break; + case Keyboard.CODE_RESEARCH: + if (ProductionFlag.IS_EXPERIMENTAL) { + ResearchLogger.getInstance().presentResearchDialog(this); + } + break; default: if (primaryCode == Keyboard.CODE_TAB && mInputAttributes.mEditorAction == EditorInfo.IME_ACTION_NEXT) { @@ -2459,10 +2464,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen final AlertDialog.Builder builder = new AlertDialog.Builder(this) .setItems(items, listener) .setTitle(title); - showOptionDialogInternal(builder.create()); + showOptionDialog(builder.create()); } - private void showOptionDialogInternal(AlertDialog dialog) { + /* package */ void showOptionDialog(AlertDialog dialog) { final IBinder windowToken = mKeyboardSwitcher.getKeyboardView().getWindowToken(); if (windowToken == null) return; diff --git a/java/src/com/android/inputmethod/latin/ResearchLogger.java b/java/src/com/android/inputmethod/latin/ResearchLogger.java index 16285091b..bb003f766 100644 --- a/java/src/com/android/inputmethod/latin/ResearchLogger.java +++ b/java/src/com/android/inputmethod/latin/ResearchLogger.java @@ -18,6 +18,8 @@ package com.android.inputmethod.latin; import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.KEYBOARD_LAYOUT_SET; +import android.app.AlertDialog; +import android.content.DialogInterface; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.inputmethodservice.InputMethodService; @@ -33,9 +35,9 @@ import android.view.MotionEvent; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; +import android.widget.Toast; import com.android.inputmethod.keyboard.Key; -import com.android.inputmethod.keyboard.KeyDetector; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.KeyboardId; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; @@ -134,12 +136,16 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } if (prefs != null) { sIsLogging = prefs.getBoolean(PREF_USABILITY_STUDY_MODE, false); - prefs.registerOnSharedPreferenceChangeListener(sInstance); + prefs.registerOnSharedPreferenceChangeListener(this); } } public synchronized void start() { Log.d(TAG, "start called"); + if (!sIsLogging) { + // Log.w(TAG, "not in usability mode; not logging"); + return; + } if (mFilesDir == null || !mFilesDir.exists()) { Log.w(TAG, "IME storage directory does not exist. Cannot start logging."); } else { @@ -192,16 +198,17 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); - } - mJsonWriter = NULL_JSON_WRITER; - mFile = null; - mLoggingState = LOGGING_STATE_OFF; - if (DEBUG) { - Log.d(TAG, "logfile closed"); - } - Log.d(TAG, "finished stop(), notifying"); - synchronized (ResearchLogger.this) { - ResearchLogger.this.notify(); + } finally { + mJsonWriter = NULL_JSON_WRITER; + mFile = null; + mLoggingState = LOGGING_STATE_OFF; + if (DEBUG) { + Log.d(TAG, "logfile closed"); + } + Log.d(TAG, "finished stop(), notifying"); + synchronized (ResearchLogger.this) { + ResearchLogger.this.notify(); + } } } }); @@ -213,6 +220,38 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang } } + public synchronized boolean abort() { + Log.d(TAG, "abort called"); + boolean isLogFileDeleted = false; + if (mLoggingHandler != null && mLoggingState == LOGGING_STATE_ON) { + mLoggingState = LOGGING_STATE_STOPPING; + try { + Log.d(TAG, "closing jsonwriter"); + mJsonWriter.endArray(); + mJsonWriter.close(); + } catch (IllegalStateException e1) { + // assume that this is just the json not being terminated properly. + // ignore + e1.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + mJsonWriter = NULL_JSON_WRITER; + // delete file + final boolean isDeleted = mFile.delete(); + if (isDeleted) { + isLogFileDeleted = true; + } + mFile = null; + mLoggingState = LOGGING_STATE_OFF; + if (DEBUG) { + Log.d(TAG, "logfile closed"); + } + } + } + return isLogFileDeleted; + } + /* package */ synchronized void flush() { try { mJsonWriter.flush(); @@ -227,6 +266,50 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang return; } sIsLogging = prefs.getBoolean(PREF_USABILITY_STUDY_MODE, false); + if (sIsLogging == false) { + abort(); + } + } + + /* package */ void presentResearchDialog(final LatinIME latinIME) { + final CharSequence title = latinIME.getString(R.string.english_ime_research_log); + final CharSequence[] items = new CharSequence[] { + latinIME.getString(R.string.note_timestamp_for_researchlog), + latinIME.getString(R.string.do_not_log_this_session), + }; + final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface di, int position) { + di.dismiss(); + switch (position) { + case 0: + ResearchLogger.getInstance().userTimestamp(); + Toast.makeText(latinIME, R.string.notify_recorded_timestamp, + Toast.LENGTH_LONG).show(); + break; + case 1: + Toast toast = Toast.makeText(latinIME, + R.string.notify_session_log_deleting, Toast.LENGTH_LONG); + toast.show(); + final ResearchLogger logger = ResearchLogger.getInstance(); + boolean isLogDeleted = logger.abort(); + toast.cancel(); + if (isLogDeleted) { + Toast.makeText(latinIME, R.string.notify_session_log_deleted, + Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(latinIME, + R.string.notify_session_log_not_deleted, Toast.LENGTH_LONG) + .show(); + } + break; + } + } + }; + final AlertDialog.Builder builder = new AlertDialog.Builder(latinIME) + .setItems(items, listener) + .setTitle(title); + latinIME.showOptionDialog(builder.create()); } private static final String CURRENT_TIME_KEY = "_ct"; @@ -756,4 +839,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang getInstance().writeEvent(EVENTKEYS_SUGGESTIONSVIEW_SETSUGGESTIONS, values); } } + + private static final String[] EVENTKEYS_USER_TIMESTAMP = { + "UserTimestamp" + }; + public void userTimestamp() { + getInstance().writeEvent(EVENTKEYS_USER_TIMESTAMP, EVENTKEYS_NULLVALUES); + } } diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java index a6ff8953d..a73e71bb2 100644 --- a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java @@ -29,7 +29,9 @@ import android.util.Log; import com.android.inputmethod.latin.UserHistoryForgettingCurveUtils.ForgettingCurveParams; +import java.lang.ref.SoftReference; import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; /** * Locally gathers stats about the words user types and various other signals like auto-correction @@ -38,6 +40,7 @@ import java.util.HashMap; public class UserHistoryDictionary extends ExpandableDictionary { private static final String TAG = "UserHistoryDictionary"; public static final boolean DBG_SAVE_RESTORE = false; + public static final boolean PROFILE_SAVE_RESTORE = LatinImeLogger.sDBG; /** Any pair being typed or picked */ private static final int FREQUENCY_FOR_TYPED = 2; @@ -77,13 +80,14 @@ public class UserHistoryDictionary extends ExpandableDictionary { /** Locale for which this user history dictionary is storing words */ private final String mLocale; - private UserHistoryDictionaryBigramList mBigramList = + private final UserHistoryDictionaryBigramList mBigramList = new UserHistoryDictionaryBigramList(); - private final Object mPendingWritesLock = new Object(); private static volatile boolean sUpdatingDB = false; private final SharedPreferences mPrefs; private final static HashMap<String, String> sDictProjectionMap; + private final static ConcurrentHashMap<String, SoftReference<UserHistoryDictionary>> + sLangDictCache = new ConcurrentHashMap<String, SoftReference<UserHistoryDictionary>>(); static { sDictProjectionMap = new HashMap<String, String>(); @@ -107,7 +111,26 @@ public class UserHistoryDictionary extends ExpandableDictionary { sDeleteHistoryBigrams = deleteHistoryBigram; } - public UserHistoryDictionary(final Context context, final String locale, final int dicTypeId, + public synchronized static UserHistoryDictionary getInstance( + final Context context, final String locale, + final int dictTypeId, final SharedPreferences sp) { + if (sLangDictCache.containsKey(locale)) { + final SoftReference<UserHistoryDictionary> ref = sLangDictCache.get(locale); + final UserHistoryDictionary dict = ref == null ? null : ref.get(); + if (dict != null) { + if (PROFILE_SAVE_RESTORE) { + Log.w(TAG, "Use cached UserHistoryDictionary for " + locale); + } + return dict; + } + } + final UserHistoryDictionary dict = + new UserHistoryDictionary(context, locale, dictTypeId, sp); + sLangDictCache.put(locale, new SoftReference<UserHistoryDictionary>(dict)); + return dict; + } + + private UserHistoryDictionary(final Context context, final String locale, final int dicTypeId, SharedPreferences sp) { super(context, dicTypeId); mLocale = locale; @@ -123,12 +146,13 @@ public class UserHistoryDictionary extends ExpandableDictionary { @Override public void close() { flushPendingWrites(); - SettingsValues.setLastUserHistoryWriteTime(mPrefs, mLocale); // Don't close the database as locale changes will require it to be reopened anyway // Also, the database is written to somewhat frequently, so it needs to be kept alive // throughout the life of the process. // mOpenHelper.close(); - super.close(); + // Ignore close because we cache UserHistoryDictionary for each language. See getInstance() + // above. + // super.close(); } /** @@ -160,7 +184,7 @@ public class UserHistoryDictionary extends ExpandableDictionary { } else { freq = super.setBigramAndGetFrequency(word1, word2, new ForgettingCurveParams(isValid)); } - synchronized (mPendingWritesLock) { + synchronized (mBigramList) { mBigramList.addBigram(word1, word2); } @@ -168,7 +192,7 @@ public class UserHistoryDictionary extends ExpandableDictionary { } public boolean cancelAddingUserHistory(String word1, String word2) { - synchronized (mPendingWritesLock) { + synchronized (mBigramList) { if (mBigramList.removeBigram(word1, word2)) { return super.removeBigram(word1, word2); } @@ -180,19 +204,17 @@ public class UserHistoryDictionary extends ExpandableDictionary { * Schedules a background thread to write any pending words to the database. */ private void flushPendingWrites() { - synchronized (mPendingWritesLock) { + synchronized (mBigramList) { // Nothing pending? Return if (mBigramList.isEmpty()) return; // Create a background thread to write the pending entries - new UpdateDbTask(sOpenHelper, mBigramList, mLocale, this).execute(); - // Create a new map for writing new entries into while the old one is written to db - mBigramList = new UserHistoryDictionaryBigramList(); + new UpdateDbTask(sOpenHelper, mBigramList, mLocale, this, mPrefs).execute(); } } /** Used for testing purpose **/ void waitUntilUpdateDBDone() { - synchronized (mPendingWritesLock) { + synchronized (mBigramList) { while (sUpdatingDB) { try { Thread.sleep(100); @@ -205,41 +227,46 @@ public class UserHistoryDictionary extends ExpandableDictionary { @Override public void loadDictionaryAsync() { - final long last = SettingsValues.getLastUserHistoryWriteTime(mPrefs, mLocale); - final long now = System.currentTimeMillis(); - // Load the words that correspond to the current input locale - final Cursor cursor = query(MAIN_COLUMN_LOCALE + "=?", new String[] { mLocale }); - if (null == cursor) return; - try { - if (cursor.moveToFirst()) { - final int word1Index = cursor.getColumnIndex(MAIN_COLUMN_WORD1); - final int word2Index = cursor.getColumnIndex(MAIN_COLUMN_WORD2); - final int fcIndex = cursor.getColumnIndex(COLUMN_FORGETTING_CURVE_VALUE); - while (!cursor.isAfterLast()) { - final String word1 = cursor.getString(word1Index); - final String word2 = cursor.getString(word2Index); - final int fc = cursor.getInt(fcIndex); - if (DBG_SAVE_RESTORE) { - Log.d(TAG, "--- Load user history: " + word1 + ", " + word2 + "," - + mLocale + "," + this); - } - // Safeguard against adding really long words. Stack may overflow due - // to recursive lookup - if (null == word1) { - super.addWord(word2, null /* shortcut */, fc); - } else if (word1.length() < BinaryDictionary.MAX_WORD_LENGTH - && word2.length() < BinaryDictionary.MAX_WORD_LENGTH) { - super.setBigramAndGetFrequency( - word1, word2, new ForgettingCurveParams(fc, now, last)); - } - synchronized(mPendingWritesLock) { + synchronized(mBigramList) { + final long last = SettingsValues.getLastUserHistoryWriteTime(mPrefs, mLocale); + final long now = System.currentTimeMillis(); + // Load the words that correspond to the current input locale + final Cursor cursor = query(MAIN_COLUMN_LOCALE + "=?", new String[] { mLocale }); + if (null == cursor) return; + try { + if (cursor.moveToFirst()) { + final int word1Index = cursor.getColumnIndex(MAIN_COLUMN_WORD1); + final int word2Index = cursor.getColumnIndex(MAIN_COLUMN_WORD2); + final int fcIndex = cursor.getColumnIndex(COLUMN_FORGETTING_CURVE_VALUE); + while (!cursor.isAfterLast()) { + final String word1 = cursor.getString(word1Index); + final String word2 = cursor.getString(word2Index); + final int fc = cursor.getInt(fcIndex); + if (DBG_SAVE_RESTORE) { + Log.d(TAG, "--- Load user history: " + word1 + ", " + word2 + "," + + mLocale + "," + this); + } + // Safeguard against adding really long words. Stack may overflow due + // to recursive lookup + if (null == word1) { + super.addWord(word2, null /* shortcut */, fc); + } else if (word1.length() < BinaryDictionary.MAX_WORD_LENGTH + && word2.length() < BinaryDictionary.MAX_WORD_LENGTH) { + super.setBigramAndGetFrequency( + word1, word2, new ForgettingCurveParams(fc, now, last)); + } mBigramList.addBigram(word1, word2, (byte)fc); + cursor.moveToNext(); } - cursor.moveToNext(); + } + } finally { + cursor.close(); + if (PROFILE_SAVE_RESTORE) { + final long diff = System.currentTimeMillis() - now; + Log.w(TAG, "PROF: Load User HistoryDictionary: " + + mLocale + ", " + diff + "ms."); } } - } finally { - cursor.close(); } } @@ -317,14 +344,16 @@ public class UserHistoryDictionary extends ExpandableDictionary { private final DatabaseHelper mDbHelper; private final String mLocale; private final UserHistoryDictionary mUserHistoryDictionary; + private final SharedPreferences mPrefs; public UpdateDbTask( DatabaseHelper openHelper, UserHistoryDictionaryBigramList pendingWrites, - String locale, UserHistoryDictionary dict) { + String locale, UserHistoryDictionary dict, SharedPreferences prefs) { mBigramList = pendingWrites; mLocale = locale; mDbHelper = openHelper; mUserHistoryDictionary = dict; + mPrefs = prefs; } /** Prune any old data if the database is getting too big. */ @@ -363,37 +392,39 @@ public class UserHistoryDictionary extends ExpandableDictionary { @Override protected Void doInBackground(Void... v) { - SQLiteDatabase db = null; - try { - db = mDbHelper.getWritableDatabase(); - } catch (android.database.sqlite.SQLiteCantOpenDatabaseException e) { - // If we can't open the db, don't do anything. Exit through the next test - // for non-nullity of the db variable. - } - if (null == db) { - // Not much we can do. Just exit. - sUpdatingDB = false; - return null; - } - db.execSQL("PRAGMA foreign_keys = ON;"); - final boolean addLevel0Bigram = mBigramList.size() <= sMaxHistoryBigrams; - - // Write all the entries to the db - for (String word1 : mBigramList.keySet()) { - final HashMap<String, Byte> word1Bigrams = mBigramList.getBigrams(word1); - for (String word2 : word1Bigrams.keySet()) { - // Get new frequency. Do not insert shortcuts/bigrams which freq is "-1". - final int freq; // -1, or 0~255 - if (word1 == null) { - freq = FREQUENCY_FOR_TYPED; - } else { - final NextWord nw = mUserHistoryDictionary.getBigramWord(word1, word2); - if (nw != null) { - final ForgettingCurveParams fcp = nw.getFcParams(); + synchronized(mBigramList) { + final long now = PROFILE_SAVE_RESTORE ? System.currentTimeMillis() : 0; + int profTotal = 0; + int profInsert = 0; + int profDelete = 0; + SQLiteDatabase db = null; + try { + db = mDbHelper.getWritableDatabase(); + } catch (android.database.sqlite.SQLiteCantOpenDatabaseException e) { + // If we can't open the db, don't do anything. Exit through the next test + // for non-nullity of the db variable. + } + if (null == db) { + // Not much we can do. Just exit. + sUpdatingDB = false; + return null; + } + db.execSQL("PRAGMA foreign_keys = ON;"); + final boolean addLevel0Bigram = mBigramList.size() <= sMaxHistoryBigrams; + + // Write all the entries to the db + for (String word1 : mBigramList.keySet()) { + final HashMap<String, Byte> word1Bigrams = mBigramList.getBigrams(word1); + for (String word2 : word1Bigrams.keySet()) { + if (PROFILE_SAVE_RESTORE) { + ++profTotal; + } + // Get new frequency. Do not insert unigrams/bigrams which freq is "-1". + final int freq; // -1, or 0~255 + if (word1 == null) { // unigram + freq = FREQUENCY_FOR_TYPED; final byte prevFc = word1Bigrams.get(word2); - final byte fc = (byte)fcp.getFc(); - final boolean isValid = fcp.isValid(); - if (prevFc > 0 && prevFc == fc) { + if (prevFc == FREQUENCY_FOR_TYPED) { // No need to update since we found no changes for this entry. // Just skip to the next entry. if (DBG_SAVE_RESTORE) { @@ -401,67 +432,100 @@ public class UserHistoryDictionary extends ExpandableDictionary { + "," + prevFc); } continue; - } else if (UserHistoryForgettingCurveUtils. - needsToSave(fc, isValid, addLevel0Bigram)) { - freq = fc; + } + } else { // bigram + final NextWord nw = mUserHistoryDictionary.getBigramWord(word1, word2); + if (nw != null) { + final ForgettingCurveParams fcp = nw.getFcParams(); + final byte prevFc = word1Bigrams.get(word2); + final byte fc = (byte)fcp.getFc(); + final boolean isValid = fcp.isValid(); + if (prevFc > 0 && prevFc == fc) { + // No need to update since we found no changes for this entry. + // Just skip to the next entry. + if (DBG_SAVE_RESTORE) { + Log.d(TAG, "Skip update user history: " + word1 + "," + + word2 + "," + prevFc); + } + continue; + } else if (UserHistoryForgettingCurveUtils. + needsToSave(fc, isValid, addLevel0Bigram)) { + freq = fc; + } else { + freq = -1; + } } else { freq = -1; } - } else { - freq = -1; - } - } - // TODO: this process of making a text search for each pair each time - // is terribly inefficient. Optimize this. - // Find pair id - Cursor c = null; - try { - if (null != word1) { - c = db.query(MAIN_TABLE_NAME, new String[] { MAIN_COLUMN_ID }, - MAIN_COLUMN_WORD1 + "=? AND " + MAIN_COLUMN_WORD2 + "=? AND " - + MAIN_COLUMN_LOCALE + "=?", - new String[] { word1, word2, mLocale }, null, null, - null); - } else { - c = db.query(MAIN_TABLE_NAME, new String[] { MAIN_COLUMN_ID }, - MAIN_COLUMN_WORD1 + " IS NULL AND " + MAIN_COLUMN_WORD2 - + "=? AND " + MAIN_COLUMN_LOCALE + "=?", - new String[] { word2, mLocale }, null, null, null); } + // TODO: this process of making a text search for each pair each time + // is terribly inefficient. Optimize this. + // Find pair id + Cursor c = null; + try { + if (null != word1) { + c = db.query(MAIN_TABLE_NAME, new String[] { MAIN_COLUMN_ID }, + MAIN_COLUMN_WORD1 + "=? AND " + MAIN_COLUMN_WORD2 + "=? AND " + + MAIN_COLUMN_LOCALE + "=?", + new String[] { word1, word2, mLocale }, null, null, + null); + } else { + c = db.query(MAIN_TABLE_NAME, new String[] { MAIN_COLUMN_ID }, + MAIN_COLUMN_WORD1 + " IS NULL AND " + MAIN_COLUMN_WORD2 + + "=? AND " + MAIN_COLUMN_LOCALE + "=?", + new String[] { word2, mLocale }, null, null, null); + } - final int pairId; - if (c.moveToFirst()) { - // Delete existing pair - pairId = c.getInt(c.getColumnIndex(MAIN_COLUMN_ID)); - db.delete(FREQ_TABLE_NAME, FREQ_COLUMN_PAIR_ID + "=?", - new String[] { Integer.toString(pairId) }); - } else { - // Create new pair - Long pairIdLong = db.insert(MAIN_TABLE_NAME, null, - getContentValues(word1, word2, mLocale)); - pairId = pairIdLong.intValue(); - } - if (freq > 0) { - if (DBG_SAVE_RESTORE) { - Log.d(TAG, "--- Save user history: " + word1 + ", " + word2 - + mLocale + "," + this); + final int pairId; + if (c.moveToFirst()) { + if (PROFILE_SAVE_RESTORE) { + ++profDelete; + } + // Delete existing pair + pairId = c.getInt(c.getColumnIndex(MAIN_COLUMN_ID)); + db.delete(FREQ_TABLE_NAME, FREQ_COLUMN_PAIR_ID + "=?", + new String[] { Integer.toString(pairId) }); + } else { + // Create new pair + Long pairIdLong = db.insert(MAIN_TABLE_NAME, null, + getContentValues(word1, word2, mLocale)); + pairId = pairIdLong.intValue(); + } + if (freq > 0) { + if (PROFILE_SAVE_RESTORE) { + ++profInsert; + } + if (DBG_SAVE_RESTORE) { + Log.d(TAG, "--- Save user history: " + word1 + ", " + word2 + + mLocale + "," + this); + } + // Insert new frequency + db.insert(FREQ_TABLE_NAME, null, + getFrequencyContentValues(pairId, freq)); + // Update an existing bigram entry in mBigramList too in order to + // synchronize the SQL DB and mBigramList. + mBigramList.updateBigram(word1, word2, (byte)freq); + } + } finally { + if (c != null) { + c.close(); } - // Insert new frequency - db.insert(FREQ_TABLE_NAME, null, - getFrequencyContentValues(pairId, freq)); - } - } finally { - if (c != null) { - c.close(); } } } - } - checkPruneData(db); - sUpdatingDB = false; - - return null; + checkPruneData(db); + // Save the timestamp after we finish writing the SQL DB. + SettingsValues.setLastUserHistoryWriteTime(mPrefs, mLocale); + sUpdatingDB = false; + if (PROFILE_SAVE_RESTORE) { + final long diff = System.currentTimeMillis() - now; + Log.w(TAG, "PROF: Write User HistoryDictionary: " + mLocale + ", "+ diff + + "ms. Total: " + profTotal + ". Insert: " + profInsert + ". Delete: " + + profDelete); + } + return null; + } // synchronized } private static ContentValues getContentValues(String word1, String word2, String locale) { diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictionaryBigramList.java b/java/src/com/android/inputmethod/latin/UserHistoryDictionaryBigramList.java index 96400dd48..28847745e 100644 --- a/java/src/com/android/inputmethod/latin/UserHistoryDictionaryBigramList.java +++ b/java/src/com/android/inputmethod/latin/UserHistoryDictionaryBigramList.java @@ -39,13 +39,19 @@ public class UserHistoryDictionaryBigramList { mBigramMap.clear(); } + /** + * Called when the user typed a word. + */ public void addBigram(String word1, String word2) { addBigram(word1, word2, FORGETTING_CURVE_INITIAL_VALUE); } + /** + * Called when loaded from the SQL DB. + */ public void addBigram(String word1, String word2, byte fcValue) { if (UserHistoryDictionary.DBG_SAVE_RESTORE) { - Log.d(TAG, "--- add bigram: " + word1 + ", " + word2); + Log.d(TAG, "--- add bigram: " + word1 + ", " + word2 + ", " + fcValue); } final HashMap<String, Byte> map; if (mBigramMap.containsKey(word1)) { @@ -60,6 +66,25 @@ public class UserHistoryDictionaryBigramList { } } + /** + * Called when inserted to the SQL DB. + */ + public void updateBigram(String word1, String word2, byte fcValue) { + if (UserHistoryDictionary.DBG_SAVE_RESTORE) { + Log.d(TAG, "--- update bigram: " + word1 + ", " + word2 + ", " + fcValue); + } + final HashMap<String, Byte> map; + if (mBigramMap.containsKey(word1)) { + map = mBigramMap.get(word1); + } else { + return; + } + if (!map.containsKey(word2)) { + return; + } + map.put(word2, fcValue); + } + public int size() { return mSize; } diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java index 8128779a4..d34cad205 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java @@ -372,27 +372,32 @@ public class AndroidSpellCheckerService extends SpellCheckerService mUserDictionaries = Collections.synchronizedMap(new TreeMap<String, Dictionary>()); final Map<String, Dictionary> oldWhitelistDictionaries = mWhitelistDictionaries; mWhitelistDictionaries = Collections.synchronizedMap(new TreeMap<String, Dictionary>()); - for (DictionaryPool pool : oldPools.values()) { - pool.close(); - } - for (Dictionary dict : oldUserDictionaries.values()) { - dict.close(); - } - for (Dictionary dict : oldWhitelistDictionaries.values()) { - dict.close(); - } - synchronized (mUseContactsLock) { - if (null != mContactsDictionary) { - // The synchronously loaded contacts dictionary should have been in one - // or several pools, but it is shielded against multiple closing and it's - // safe to call it several times. - final Dictionary dictToClose = mContactsDictionary; - // TODO: revert to the concrete type when USE_BINARY_CONTACTS_DICTIONARY is no - // longer needed - mContactsDictionary = null; - dictToClose.close(); + new Thread("spellchecker_close_dicts") { + @Override + public void run() { + for (DictionaryPool pool : oldPools.values()) { + pool.close(); + } + for (Dictionary dict : oldUserDictionaries.values()) { + dict.close(); + } + for (Dictionary dict : oldWhitelistDictionaries.values()) { + dict.close(); + } + synchronized (mUseContactsLock) { + if (null != mContactsDictionary) { + // The synchronously loaded contacts dictionary should have been in one + // or several pools, but it is shielded against multiple closing and it's + // safe to call it several times. + final Dictionary dictToClose = mContactsDictionary; + // TODO: revert to the concrete type when USE_BINARY_CONTACTS_DICTIONARY + // is no longer needed + mContactsDictionary = null; + dictToClose.close(); + } + } } - } + }.start(); } private DictionaryPool getDictionaryPool(final String locale) { @@ -496,20 +501,32 @@ public class AndroidSpellCheckerService extends SpellCheckerService } private static class SuggestionsCache { + private static final char CHAR_DELIMITER = '\uFFFC'; private static final int MAX_CACHE_SIZE = 50; - // TODO: support bigram private final LruCache<String, SuggestionsParams> mUnigramSuggestionsInfoCache = new LruCache<String, SuggestionsParams>(MAX_CACHE_SIZE); - public SuggestionsParams getSuggestionsFromCache(String query) { - return mUnigramSuggestionsInfoCache.get(query); + // TODO: Support n-gram input + private static String generateKey(String query, String prevWord) { + if (TextUtils.isEmpty(query) || TextUtils.isEmpty(prevWord)) { + return query; + } + return query + CHAR_DELIMITER + prevWord; + } + + // TODO: Support n-gram input + public SuggestionsParams getSuggestionsFromCache(String query, String prevWord) { + return mUnigramSuggestionsInfoCache.get(generateKey(query, prevWord)); } - public void putSuggestionsToCache(String query, String[] suggestions, int flags) { + // TODO: Support n-gram input + public void putSuggestionsToCache( + String query, String prevWord, String[] suggestions, int flags) { if (suggestions == null || TextUtils.isEmpty(query)) { return; } - mUnigramSuggestionsInfoCache.put(query, new SuggestionsParams(suggestions, flags)); + mUnigramSuggestionsInfoCache.put( + generateKey(query, prevWord), new SuggestionsParams(suggestions, flags)); } } @@ -604,6 +621,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService final ArrayList<Integer> additionalLengths = new ArrayList<Integer>(); final ArrayList<SuggestionsInfo> additionalSuggestionsInfos = new ArrayList<SuggestionsInfo>(); + String currentWord = null; for (int i = 0; i < N; ++i) { final SuggestionsInfo si = ssi.getSuggestionsInfoAt(i); final int flags = si.getSuggestionsAttributes(); @@ -613,6 +631,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService final int offset = ssi.getOffsetAt(i); final int length = ssi.getLengthAt(i); final String subText = typedText.substring(offset, offset + length); + final String prevWord = currentWord; + currentWord = subText; if (!subText.contains(SINGLE_QUOTE)) { continue; } @@ -626,7 +646,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService if (TextUtils.isEmpty(splitText)) { continue; } - if (mSuggestionsCache.getSuggestionsFromCache(splitText) == null) { + if (mSuggestionsCache.getSuggestionsFromCache( + splitText, prevWord) == null) { continue; } final int newLength = splitText.length(); @@ -722,7 +743,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService try { final String inText = textInfo.getText(); final SuggestionsParams cachedSuggestionsParams = - mSuggestionsCache.getSuggestionsFromCache(inText); + mSuggestionsCache.getSuggestionsFromCache(inText, prevWord); if (cachedSuggestionsParams != null) { if (DBG) { Log.d(TAG, "Cache hit: " + inText + ", " + cachedSuggestionsParams.mFlags); @@ -814,7 +835,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService .getValueOf_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS() : 0); final SuggestionsInfo retval = new SuggestionsInfo(flags, result.mSuggestions); - mSuggestionsCache.putSuggestionsToCache(text, result.mSuggestions, flags); + mSuggestionsCache.putSuggestionsToCache(text, prevWord, result.mSuggestions, flags); return retval; } catch (RuntimeException e) { // Don't kill the keyboard if there is a bug in the spell checker |