aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/raw/main_de.dictbin1605703 -> 1605732 bytes
-rw-r--r--java/res/raw/main_en.dictbin1069006 -> 1068787 bytes
-rw-r--r--java/res/raw/main_fr.dictbin1328012 -> 1328007 bytes
-rw-r--r--java/res/raw/main_it.dictbin1143320 -> 1143310 bytes
-rw-r--r--java/res/values-en/whitelist.xml113
-rw-r--r--java/res/xml-sw600dp/key_apostrophe.xml10
-rw-r--r--java/res/xml-sw600dp/key_dash.xml1
-rw-r--r--java/res/xml-sw600dp/rowkeys_farsi2.xml21
-rw-r--r--java/res/xml-sw600dp/rowkeys_farsi3.xml17
-rw-r--r--java/res/xml-sw600dp/rowkeys_symbols2.xml36
-rw-r--r--java/res/xml-sw600dp/rows_farsi.xml2
-rw-r--r--java/res/xml-sw768dp/rows_farsi.xml2
-rw-r--r--java/res/xml/keys_less_greater.xml34
-rw-r--r--java/res/xml/rowkeys_farsi1.xml40
-rw-r--r--java/res/xml/rowkeys_farsi2.xml19
-rw-r--r--java/res/xml/rowkeys_farsi3.xml5
-rw-r--r--java/res/xml/rowkeys_symbols2.xml26
-rw-r--r--java/res/xml/rowkeys_symbols3.xml30
-rw-r--r--java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java11
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java16
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java27
-rw-r--r--java/src/com/android/inputmethod/latin/SettingsValues.java29
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java28
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java17
24 files changed, 330 insertions, 154 deletions
diff --git a/java/res/raw/main_de.dict b/java/res/raw/main_de.dict
index 1a7b305d6..6122cd3f0 100644
--- a/java/res/raw/main_de.dict
+++ b/java/res/raw/main_de.dict
Binary files differ
diff --git a/java/res/raw/main_en.dict b/java/res/raw/main_en.dict
index 516e7d51c..c96276e04 100644
--- a/java/res/raw/main_en.dict
+++ b/java/res/raw/main_en.dict
Binary files differ
diff --git a/java/res/raw/main_fr.dict b/java/res/raw/main_fr.dict
index 17920f0b2..717078c93 100644
--- a/java/res/raw/main_fr.dict
+++ b/java/res/raw/main_fr.dict
Binary files differ
diff --git a/java/res/raw/main_it.dict b/java/res/raw/main_it.dict
index 00bbdbe90..82579078c 100644
--- a/java/res/raw/main_it.dict
+++ b/java/res/raw/main_it.dict
Binary files differ
diff --git a/java/res/values-en/whitelist.xml b/java/res/values-en/whitelist.xml
index 9612aac5d..262017916 100644
--- a/java/res/values-en/whitelist.xml
+++ b/java/res/values-en/whitelist.xml
@@ -30,7 +30,6 @@
<item>ill</item>
<item>I\'ll</item>
- <!-- Following entries came from AutoText the Android keyboard no longer uses. -->
<!-- TODO: Trim down more entries by removing ones that get auto-corrected by the
Android keyboard's own typing error correction algorithms. -->
@@ -63,22 +62,62 @@
<item>been</item>
<item>255</item>
+ <item>bot</item>
+ <item>not</item>
+
+ <item>255</item>
<item>bur</item>
<item>but</item>
<item>255</item>
+ <item>cam</item>
+ <item>can</item>
+
+ <item>255</item>
<item>cant</item>
<item>can\'t</item>
<item>255</item>
+ <item>dame</item>
+ <item>same</item>
+
+ <item>255</item>
<item>didint</item>
<item>didn\'t</item>
<item>255</item>
+ <item>dormer</item>
+ <item>former</item>
+
+ <item>255</item>
+ <item>dud</item>
+ <item>did</item>
+
+ <item>255</item>
+ <item>fay</item>
+ <item>day</item>
+
+ <item>255</item>
+ <item>fife</item>
+ <item>five</item>
+
+ <item>255</item>
+ <item>foo</item>
+ <item>for</item>
+
+ <item>255</item>
<item>fora</item>
<item>for a</item>
<item>255</item>
+ <item>galled</item>
+ <item>called</item>
+
+ <item>255</item>
+ <item>goo</item>
+ <item>too</item>
+
+ <item>255</item>
<item>hed</item>
<item>he\'d</item>
@@ -91,6 +130,10 @@
<item>here\'s</item>
<item>255</item>
+ <item>hew</item>
+ <item>new</item>
+
+ <item>255</item>
<item>hoe</item>
<item>how</item>
@@ -115,10 +158,18 @@
<item>how\'ve</item>
<item>255</item>
+ <item>hum</item>
+ <item>him</item>
+
+ <item>255</item>
<item>i</item>
<item>I</item>
<item>255</item>
+ <item>ifs</item>
+ <item>its</item>
+
+ <item>255</item>
<item>il</item>
<item>I\'ll</item>
@@ -139,10 +190,6 @@
<item>it\'s a</item>
<item>255</item>
- <item>jot</item>
- <item>not</item>
-
- <item>255</item>
<item>lets</item>
<item>let\'s</item>
@@ -151,6 +198,18 @@
<item>ma\'am</item>
<item>255</item>
+ <item>manu</item>
+ <item>many</item>
+
+ <item>255</item>
+ <item>mare</item>
+ <item>made</item>
+
+ <item>255</item>
+ <item>mew</item>
+ <item>new</item>
+
+ <item>255</item>
<item>mire</item>
<item>more</item>
@@ -171,14 +230,46 @@
<item>notes</item>
<item>255</item>
+ <item>mow</item>
+ <item>now</item>
+
+ <item>255</item>
+ <item>namer</item>
+ <item>named</item>
+
+ <item>255</item>
+ <item>nave</item>
+ <item>have</item>
+
+ <item>255</item>
+ <item>nee</item>
+ <item>new</item>
+
+ <item>255</item>
+ <item>nigh</item>
+ <item>high</item>
+
+ <item>255</item>
<item>nit</item>
<item>not</item>
<item>255</item>
+ <item>oft</item>
+ <item>off</item>
+
+ <item>255</item>
<item>os</item>
<item>is</item>
<item>255</item>
+ <item>pater</item>
+ <item>later</item>
+
+ <item>255</item>
+ <item>rook</item>
+ <item>took</item>
+
+ <item>255</item>
<item>shel</item>
<item>she\'ll</item>
@@ -187,6 +278,14 @@
<item>shouldn\'t</item>
<item>255</item>
+ <item>sill</item>
+ <item>will</item>
+
+ <item>255</item>
+ <item>sown</item>
+ <item>down</item>
+
+ <item>255</item>
<item>thatd</item>
<item>that\'d</item>
@@ -305,10 +404,6 @@
<item>y\'all</item>
<item>255</item>
- <item>yo</item>
- <item>to</item>
-
- <item>255</item>
<item>youd</item>
<item>you\'d</item>
diff --git a/java/res/xml-sw600dp/key_apostrophe.xml b/java/res/xml-sw600dp/key_apostrophe.xml
index 0c838db56..2aec34729 100644
--- a/java/res/xml-sw600dp/key_apostrophe.xml
+++ b/java/res/xml-sw600dp/key_apostrophe.xml
@@ -28,6 +28,16 @@
<Key
latin:keyLabel="-" />
</case>
+ <case
+ latin:languageCode="fa"
+ >
+ <Key
+ latin:keyLabel="!text/keylabel_for_apostrophe"
+ latin:keyHintLabel="!text/keyhintlabel_for_apostrophe"
+ latin:keyLabelFlags="hasPopupHint"
+ latin:moreKeys="!text/more_keys_for_apostrophe"
+ 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 118b67f27..b139c29c8 100644
--- a/java/res/xml-sw600dp/key_dash.xml
+++ b/java/res/xml-sw600dp/key_dash.xml
@@ -34,6 +34,7 @@
<Key
latin:keyLabel="."
latin:keyHintLabel="!text/keyhintlabel_for_arabic_diacritics"
+ latin:keyLabelFlags="hasPopupHint"
latin:moreKeys="!text/more_keys_for_arabic_diacritics"
latin:keyStyle="hasShiftedLetterHintStyle" />
</case>
diff --git a/java/res/xml-sw600dp/rowkeys_farsi2.xml b/java/res/xml-sw600dp/rowkeys_farsi2.xml
index 98e0f2186..234f98430 100644
--- a/java/res/xml-sw600dp/rowkeys_farsi2.xml
+++ b/java/res/xml-sw600dp/rowkeys_farsi2.xml
@@ -29,10 +29,12 @@
latin:keyLabel="&#x0633;" />
<!-- U+06CC: "ی" ARABIC LETTER FARSI YEH
U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE
- U+064A: "ي" ARABIC LETTER YEH -->
+ U+064A: "ي" ARABIC LETTER YEH
+ U+FBE8: "ﯨ" ARABIC LETTER UIGHUR KAZAKH KIRGHIZ ALEF MAKSURA INITIAL FORM
+ U+0649: "ى" ARABIC LETTER ALEF MAKSURA -->
<Key
latin:keyLabel="&#x06CC;"
- latin:moreKeys="&#x0626;,&#x064A;" />
+ latin:moreKeys="&#x0626;,&#x064A;,&#xFBE8;|&#x0649;" />
<!-- U+0628: "ب" ARABIC LETTER BEH -->
<Key
latin:keyLabel="&#x0628;" />
@@ -42,17 +44,18 @@
<!-- U+0627: "ا" ARABIC LETTER ALEF
U+0621: "ء" ARABIC LETTER HAMZA
U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE
- U+0672: "ٲ" ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE
+ U+0623: "أ" ARABIC LETTER ALEF WITH HAMZA ABOVE
U+0671: "ٱ" ARABIC LETTER ALEF WASLA
- U+0673: "ٳ" ARABIC LETTER ALEF WITH WAVY HAMZA BELOW-->
- <!-- TODO: DroidSansArabic lacks the glyph of U+0672 ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE -->
- <!-- TODO: DroidSansArabic lacks the glyph of U+0673 ARABIC LETTER ALEF WITH WAVY HAMZA BELOW -->
+ U+0625: "إ" ARABIC LETTER ALEF WITH HAMZA BELOW -->
<Key
latin:keyLabel="&#x0627;"
- latin:moreKeys="&#x0621;,&#x0622;,&#x0672;,&#x0671;,&#x0673;" />
- <!-- U+062A: "ت" ARABIC LETTER TEH -->
+ latin:moreKeys="&#x0621;,&#x0622;,&#x0623;,&#x0671;,&#x0625;" />
+ <!-- U+062A: "ت" ARABIC LETTER TEH
+ U+062B: "ﺙ" ARABIC LETTER THEH
+ U+0629: "ة": ARABIC LETTER TEH MARBUTA -->
<Key
- latin:keyLabel="&#x062A;" />
+ latin:keyLabel="&#x062A;"
+ latin:moreKeys="&#x062B;,&#x0629;" />
<!-- U+0646: "ن" ARABIC LETTER NOON -->
<Key
latin:keyLabel="&#x0646;" />
diff --git a/java/res/xml-sw600dp/rowkeys_farsi3.xml b/java/res/xml-sw600dp/rowkeys_farsi3.xml
index c80c14a55..998ba72d6 100644
--- a/java/res/xml-sw600dp/rowkeys_farsi3.xml
+++ b/java/res/xml-sw600dp/rowkeys_farsi3.xml
@@ -27,11 +27,12 @@
<!-- U+0637: "ط" ARABIC LETTER TAH -->
<Key
latin:keyLabel="&#x0637;" />
- <!-- U+0632: "ز" ARABIC LETTER ZAIN
- U+0698: "ژ" ARABIC LETTER JEH -->
+ <!-- U+0698: "ژ" ARABIC LETTER JEH -->
<Key
- latin:keyLabel="&#x0632;"
- latin:moreKeys="&#x0698;" />
+ latin:keyLabel="&#x0698;" />
+ <!-- U+0632: "ز" ARABIC LETTER ZAIN -->
+ <Key
+ latin:keyLabel="&#x0632;" />
<!-- U+0631: "ر" ARABIC LETTER REH -->
<Key
latin:keyLabel="&#x0631;" />
@@ -45,9 +46,11 @@
<Key
latin:keyLabel="&#x067E;" />
<!-- U+0648: "و" ARABIC LETTER WAW
- U+0676: "ٶ" ARABIC LETTER HIGH HAMZA WAW -->
- <!-- TODO: DroidSansArabic lacks the glyph of U+0676 ARABIC LETTER HIGH HAMZA WAW -->
+ U+0624: "ؤ" ARABIC LETTER WAW WITH HAMZA ABOVE -->
<Key
latin:keyLabel="&#x0648;"
- latin:moreKeys="&#x0676;" />
+ latin:moreKeys="&#x0624;" />
+ <!-- U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE -->
+ <Key
+ latin:keyLabel="&#x0622;" />
</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_symbols2.xml b/java/res/xml-sw600dp/rowkeys_symbols2.xml
index 6fe86240c..d7067e0cf 100644
--- a/java/res/xml-sw600dp/rowkeys_symbols2.xml
+++ b/java/res/xml-sw600dp/rowkeys_symbols2.xml
@@ -21,15 +21,43 @@
<merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
>
- <Key
- latin:keyLabel="#" />
+ <switch>
+ <case
+ latin:languageCode="fa"
+ >
+ <!-- U+066C: "٬" ARABIC THOUSANDS SEPARATOR -->
+ <Key
+ latin:keyLabel="&#x066C;"
+ latin:keyHintLabel="&amp;"
+ latin:keyLabelFlags="hasPopupHint|hasShiftedLetterHint"
+ latin:moreKeys="&amp;" />
+ </case>
+ <default>
+ <Key
+ latin:keyLabel="#" />
+ </default>
+ </switch>
<Key
latin:keyStyle="currencyKeyStyle" />
<Key
latin:keyLabel="!text/keylabel_for_symbols_percent"
latin:moreKeys="!text/more_keys_for_symbols_percent" />
- <Key
- latin:keyLabel="&amp;" />
+ <switch>
+ <case
+ latin:languageCode="fa"
+ >
+ <!-- U+066B: "٫" ARABIC DECIMAL SEPARATOR -->
+ <Key
+ latin:keyLabel="&#x066B;"
+ latin:keyHintLabel="#"
+ latin:keyLabelFlags="hasPopupHint|hasShiftedLetterHint"
+ latin:moreKeys="#" />
+ </case>
+ <default>
+ <Key
+ latin:keyLabel="&amp;" />
+ </default>
+ </switch>
<Key
latin:keyLabel="*"
latin:moreKeys="!text/more_keys_for_star" />
diff --git a/java/res/xml-sw600dp/rows_farsi.xml b/java/res/xml-sw600dp/rows_farsi.xml
index 1ce658648..52c2d9329 100644
--- a/java/res/xml-sw600dp/rows_farsi.xml
+++ b/java/res/xml-sw600dp/rows_farsi.xml
@@ -44,8 +44,6 @@
<include
latin:keyboardLayout="@xml/rowkeys_farsi3"
latin:keyXPos="4.091%p" />
- <include
- latin:keyboardLayout="@xml/keys_comma_period" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
diff --git a/java/res/xml-sw768dp/rows_farsi.xml b/java/res/xml-sw768dp/rows_farsi.xml
index 28031bb82..4b4c970fd 100644
--- a/java/res/xml-sw768dp/rows_farsi.xml
+++ b/java/res/xml-sw768dp/rows_farsi.xml
@@ -52,8 +52,6 @@
<include
latin:keyboardLayout="@xml/rowkeys_farsi3"
latin:keyXPos="13.829%p" />
- <include
- latin:keyboardLayout="@xml/keys_comma_period" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
diff --git a/java/res/xml/keys_less_greater.xml b/java/res/xml/keys_less_greater.xml
index 4584e5c96..bc9ecdf2f 100644
--- a/java/res/xml/keys_less_greater.xml
+++ b/java/res/xml/keys_less_greater.xml
@@ -21,12 +21,30 @@
<merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
>
- <Key
- latin:keyLabel="&lt;"
- latin:code="!code/key_less_than"
- latin:moreKeys="!text/more_keys_for_less_than" />
- <Key
- latin:keyLabel="&gt;"
- latin:code="!code/key_greater_than"
- latin:moreKeys="!text/more_keys_for_greater_than" />
+ <switch>
+ <case
+ latin:languageCode="fa"
+ >
+ <!-- U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -->
+ <Key
+ latin:keyLabel="&#x00AB;"
+ latin:code="0x00BB"
+ latin:moreKeys="!text/more_keys_for_less_than" />
+ <Key
+ latin:keyLabel="&#x00BB;"
+ latin:code="0x00AB"
+ latin:moreKeys="!text/more_keys_for_greater_than" />
+ </case>
+ <default>
+ <Key
+ latin:keyLabel="&lt;"
+ latin:code="!code/key_less_than"
+ latin:moreKeys="!text/more_keys_for_less_than" />
+ <Key
+ latin:keyLabel="&gt;"
+ latin:code="!code/key_greater_than"
+ latin:moreKeys="!text/more_keys_for_greater_than" />
+ </default>
+ </switch>
</merge>
diff --git a/java/res/xml/rowkeys_farsi1.xml b/java/res/xml/rowkeys_farsi1.xml
index 81618af77..840b048f7 100644
--- a/java/res/xml/rowkeys_farsi1.xml
+++ b/java/res/xml/rowkeys_farsi1.xml
@@ -27,32 +27,32 @@
<Key
latin:keyLabel="&#x0635;"
latin:moreKeys="&#x0636;,%"
- latin:keyHintLabel="1"
- latin:additionalMoreKeys="1,&#x06F1;" />
+ latin:keyHintLabel="&#x06F1;"
+ latin:additionalMoreKeys="&#x06F1;,1" />
<!-- U+0642: "ق" ARABIC LETTER QAF
U+06F2: "۲" EXTENDED ARABIC-INDIC DIGIT TWO -->
<Key
latin:keyLabel="&#x0642;"
- latin:keyHintLabel="2"
- latin:additionalMoreKeys="2,&#x06F2;" />
+ latin:keyHintLabel="&#x06F2;"
+ latin:additionalMoreKeys="&#x06F2;,2" />
<!-- U+0641: "ف" ARABIC LETTER FEH
U+06F3: "۳" EXTENDED ARABIC-INDIC DIGIT THREE -->
<Key
latin:keyLabel="&#x0641;"
- latin:keyHintLabel="3"
- latin:additionalMoreKeys="3,&#x06F3;" />
+ latin:keyHintLabel="&#x06F3;"
+ latin:additionalMoreKeys="&#x06F3;,3" />
<!-- U+063A: "غ" ARABIC LETTER GHAIN
U+06F4: "۴" EXTENDED ARABIC-INDIC DIGIT FOUR -->
<Key
latin:keyLabel="&#x063A;"
- latin:keyHintLabel="4"
- latin:additionalMoreKeys="4,&#x06F4;" />
+ latin:keyHintLabel="&#x06F4;"
+ latin:additionalMoreKeys="&#x06F4;,4" />
<!-- U+0639: "ع" ARABIC LETTER AIN
U+06F5: "۵" EXTENDED ARABIC-INDIC DIGIT FIVE -->
<Key
latin:keyLabel="&#x0639;"
- latin:keyHintLabel="5"
- latin:additionalMoreKeys="5,&#x06F5;" />
+ latin:keyHintLabel="&#x06F5;"
+ latin:additionalMoreKeys="&#x06F5;,5" />
<!-- U+0647: "ه" ARABIC LETTER HEH
U+FEEB: "ﻫ" ARABIC LETTER HEH INITIAL FORM
U+0647/U+200D: ARABIC LETTER HEH + ZERO WIDTH JOINER
@@ -62,30 +62,30 @@
<Key
latin:keyLabel="&#x0647;"
latin:moreKeys="&#xFEEB;|&#x0647;&#x200D;,&#x0647;&#x0654;,&#x0629;,%"
- latin:keyHintLabel="6"
- latin:additionalMoreKeys="6,&#x06F6;" />
+ latin:keyHintLabel="&#x06F6;"
+ latin:additionalMoreKeys="&#x06F6;,6" />
<!-- U+062E: "خ" ARABIC LETTER KHAH
U+06F7: "۷" EXTENDED ARABIC-INDIC DIGIT SEVEN -->
<Key
latin:keyLabel="&#x062E;"
- latin:keyHintLabel="7"
- latin:additionalMoreKeys="7,&#x06F7;" />
+ latin:keyHintLabel="&#x06F7;"
+ latin:additionalMoreKeys="&#x06F7;,7" />
<!-- U+062D: "ح" ARABIC LETTER HAH
U+06F8: "۸" EXTENDED ARABIC-INDIC DIGIT EIGHT -->
<Key
latin:keyLabel="&#x062D;"
- latin:keyHintLabel="8"
- latin:additionalMoreKeys="8,&#x06F8;" />
+ latin:keyHintLabel="&#x06F8;"
+ latin:additionalMoreKeys="&#x06F8;,8" />
<!-- U+062C: "ج" ARABIC LETTER JEEM
U+06F9: "۹" EXTENDED ARABIC-INDIC DIGIT NINE -->
<Key
latin:keyLabel="&#x062C;"
- latin:keyHintLabel="9"
- latin:additionalMoreKeys="9,&#x06F9;" />
+ latin:keyHintLabel="&#x06F9;"
+ latin:additionalMoreKeys="&#x06F9;,9" />
<!-- U+0686: "چ" ARABIC LETTER TCHEH
U+06F0: "۰" EXTENDED ARABIC-INDIC DIGIT ZERO -->
<Key
latin:keyLabel="&#x0686;"
- latin:keyHintLabel="0"
- latin:additionalMoreKeys="0,&#x06F0;" />
+ latin:keyHintLabel="&#x06F0;"
+ latin:additionalMoreKeys="&#x06F0;,0" />
</merge>
diff --git a/java/res/xml/rowkeys_farsi2.xml b/java/res/xml/rowkeys_farsi2.xml
index 77279c60f..21548936e 100644
--- a/java/res/xml/rowkeys_farsi2.xml
+++ b/java/res/xml/rowkeys_farsi2.xml
@@ -31,10 +31,12 @@
latin:moreKeys="&#x0636;" />
<!-- U+06CC: "ی" ARABIC LETTER FARSI YEH
U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE
- U+064A: "ي" ARABIC LETTER YEH -->
+ U+064A: "ي" ARABIC LETTER YEH
+ U+FBE8: "ﯨ" ARABIC LETTER UIGHUR KAZAKH KIRGHIZ ALEF MAKSURA INITIAL FORM
+ U+0649: "ى" ARABIC LETTER ALEF MAKSURA -->
<Key
latin:keyLabel="&#x06CC;"
- latin:moreKeys="&#x0626;,&#x064A;" />
+ latin:moreKeys="&#x0626;,&#x064A;,&#xFBE8;|&#x0649;" />
<!-- U+0628: "ب" ARABIC LETTER BEH -->
<Key
latin:keyLabel="&#x0628;" />
@@ -44,19 +46,18 @@
<!-- U+0627: "ا" ARABIC LETTER ALEF
U+0621: "ء" ARABIC LETTER HAMZA
U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE
- U+0672: "ٲ" ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE
+ U+0623: "أ" ARABIC LETTER ALEF WITH HAMZA ABOVE
U+0671: "ٱ" ARABIC LETTER ALEF WASLA
- U+0673: "ٳ" ARABIC LETTER ALEF WITH WAVY HAMZA BELOW-->
- <!-- TODO: DroidSansArabic lacks the glyph of U+0672 ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE -->
- <!-- TODO: DroidSansArabic lacks the glyph of U+0673 ARABIC LETTER ALEF WITH WAVY HAMZA BELOW -->
+ U+0625: "إ" ARABIC LETTER ALEF WITH HAMZA BELOW -->
<Key
latin:keyLabel="&#x0627;"
- latin:moreKeys="&#x0621;,&#x0622;,&#x0672;,&#x0671;,&#x0673;" />
+ latin:moreKeys="&#x0621;,&#x0622;,&#x0623;,&#x0671;,&#x0625;" />
<!-- U+062A: "ت" ARABIC LETTER TEH
- U+062B: "ﺙ" ARABIC LETTER THEH -->
+ U+062B: "ﺙ" ARABIC LETTER THEH
+ U+0629: "ة": ARABIC LETTER TEH MARBUTA -->
<Key
latin:keyLabel="&#x062A;"
- latin:moreKeys="&#x062B;" />
+ latin:moreKeys="&#x062B;,&#x0629;" />
<!-- U+0646: "ن" ARABIC LETTER NOON -->
<Key
latin:keyLabel="&#x0646;" />
diff --git a/java/res/xml/rowkeys_farsi3.xml b/java/res/xml/rowkeys_farsi3.xml
index 44710e06a..29c35134c 100644
--- a/java/res/xml/rowkeys_farsi3.xml
+++ b/java/res/xml/rowkeys_farsi3.xml
@@ -44,11 +44,10 @@
<Key
latin:keyLabel="&#x067E;" />
<!-- U+0648: "و" ARABIC LETTER WAW
- U+0676: "ٶ" ARABIC LETTER HIGH HAMZA WAW -->
- <!-- TODO: DroidSansArabic lacks the glyph of U+0676 ARABIC LETTER HIGH HAMZA WAW -->
+ U+0624: "ؤ" ARABIC LETTER WAW WITH HAMZA ABOVE -->
<Key
latin:keyLabel="&#x0648;"
- latin:moreKeys="&#x0676;" />
+ latin:moreKeys="&#x0624;" />
<!-- U+06AF: "گ" ARABIC LETTER GAF -->
<Key
latin:keyLabel="&#x06AF;" />
diff --git a/java/res/xml/rowkeys_symbols2.xml b/java/res/xml/rowkeys_symbols2.xml
index 34b9aa2ee..425e20470 100644
--- a/java/res/xml/rowkeys_symbols2.xml
+++ b/java/res/xml/rowkeys_symbols2.xml
@@ -21,10 +21,28 @@
<merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
>
- <Key
- latin:keyLabel="\@" />
- <Key
- latin:keyLabel="\#" />
+ <switch>
+ <case
+ latin:languageCode="fa"
+ >
+ <!-- U+066C: "٬" ARABIC THOUSANDS SEPARATOR
+ U+066B: "٫" ARABIC DECIMAL SEPARATOR -->
+ <Key
+ latin:keyLabel="&#x066C;"
+ latin:keyHintLabel="\@"
+ latin:moreKeys="\@" />
+ <Key
+ latin:keyLabel="&#x066B;"
+ latin:keyHintLabel="#"
+ latin:moreKeys="#" />
+ </case>
+ <default>
+ <Key
+ latin:keyLabel="\@" />
+ <Key
+ latin:keyLabel="#" />
+ </default>
+ </switch>
<Key
latin:keyStyle="currencyKeyStyle" />
<Key
diff --git a/java/res/xml/rowkeys_symbols3.xml b/java/res/xml/rowkeys_symbols3.xml
index 2b2d9a4ea..c89716bc7 100644
--- a/java/res/xml/rowkeys_symbols3.xml
+++ b/java/res/xml/rowkeys_symbols3.xml
@@ -24,12 +24,30 @@
<Key
latin:keyLabel="!text/keylabel_for_symbols_exclamation"
latin:moreKeys="!text/more_keys_for_symbols_exclamation" />
- <Key
- latin:keyLabel="&quot;"
- latin:moreKeys="!text/more_keys_for_double_quote" />
- <Key
- latin:keyLabel="\'"
- latin:moreKeys="!text/more_keys_for_single_quote" />
+ <switch>
+ <case
+ latin:languageCode="fa"
+ >
+ <!-- U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -->
+ <Key
+ latin:keyLabel="&#x00AB;"
+ latin:code="0x00BB"
+ latin:moreKeys="!text/more_keys_for_double_quote" />
+ <Key
+ latin:keyLabel="&#x00BB;"
+ latin:code="0x00AB"
+ latin:moreKeys="!text/more_keys_for_single_quote" />
+ </case>
+ <default>
+ <Key
+ latin:keyLabel="&quot;"
+ latin:moreKeys="!text/more_keys_for_double_quote" />
+ <Key
+ latin:keyLabel="\'"
+ latin:moreKeys="!text/more_keys_for_single_quote" />
+ </default>
+ </switch>
<Key
latin:keyLabel=":" />
<Key
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java
index ba08c593c..70e38fdb0 100644
--- a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java
+++ b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java
@@ -275,17 +275,6 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat
return false;
}
- @Override
- public AccessibilityNodeInfoCompat findAccessibilityFocus(int virtualViewId) {
- return createAccessibilityNodeInfo(mAccessibilityFocusedView);
- }
-
- @Override
- public AccessibilityNodeInfoCompat accessibilityFocusSearch(int direction, int virtualViewId) {
- // Focus search is not currently supported for IMEs.
- return null;
- }
-
/**
* Sends an accessibility event for the given {@link Key}.
*
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
index 917e233a8..8c218c6d3 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
@@ -993,7 +993,7 @@ public final class KeyboardTextsSet {
/* ~41 */
// TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK
// <string name="more_keys_for_double_quote">&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;|&#x00BB;,&#x00BB;|&#x00AB;</string>
- /* 42 */ "!fixedColumnOrder!4,\u201C,\u201D,\u00AB|\u00BB,\u00BB|\u00AB",
+ /* 42 */ "!fixedColumnOrder!4,\u201C,\u201D,\",\'",
// TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK
// <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!6,&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;|&#x00BB;,&#x00BB|&#x00AB;;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</string>
/* 43 */ "!fixedColumnOrder!4,\u201C,\u201D,\u00AB|\u00BB,\u00BB|\u00AB,\u2018,\u2019,\u201A,\u201B",
@@ -1031,8 +1031,8 @@ public final class KeyboardTextsSet {
// U+201D: "”" RIGHT DOUBLE QUOTATION MARK
// U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
// U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK
- /* 54 */ "!fixedColumnOrder!3,\u2039|\u203A,\u2264|\u2265,\u00AB|\u00BB",
- /* 55 */ "!fixedColumnOrder!3,\u203A|\u2039,\u2265|\u2264,\u00BB|\u00AB",
+ /* 54 */ "!fixedColumnOrder!3,\u2039|\u203A,\u2264|\u2265,<|>",
+ /* 55 */ "!fixedColumnOrder!3,\u203A|\u2039,\u2265|\u2264,>|<",
// U+0655: "ٕ" ARABIC HAMZA BELOW
// U+0652: "ْ" ARABIC SUKUN
// U+0651: "ّ" ARABIC SHADDA
@@ -1049,7 +1049,7 @@ public final class KeyboardTextsSet {
// U+0640: "ـ" ARABIC TATWEEL
// In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label.
/* 56 */ "!fixedColumnOrder!7,\u0655,\u0652,\u0651,\u064C,\u064D,\u064B,\u0654,\u0656,\u0670,\u0653,\u064F,\u0650,\u064E,\u0640\u0640\u0640|\u0640",
- /* 57 */ "\u0653",
+ /* 57 */ "\u064B",
// U+06F1: "۱" EXTENDED ARABIC-INDIC DIGIT ONE
/* 58 */ "\u06F1",
// U+06F2: "۲" EXTENDED ARABIC-INDIC DIGIT TWO
@@ -1101,14 +1101,16 @@ public final class KeyboardTextsSet {
// U+060C: "،" ARABIC COMMA
// U+061B: "؛" ARABIC SEMICOLON
// U+061F: "؟" ARABIC QUESTION MARK
+ // U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ // U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
/* 98 */ "\u060C",
/* 99 */ "!",
/* 100 */ "!,\\,",
/* 101 */ "\u061F",
/* 102 */ "\u061F,?",
- /* 103 */ null,
- /* 104 */ null,
- /* 105 */ "\u061F,\u061B,!,:,-,/,\',\"",
+ /* 103 */ "\u060C",
+ /* 104 */ "\u061F",
+ /* 105 */ "!fixedColumnOrder!4,:,!,\u061F,\u061B,-,/,\u00AB|\u00BB,\u00BB|\u00AB",
};
/* Language fi: Finnish */
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 559f5ec26..a0744e574 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -828,7 +828,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
*/
@Override
public void onExtractedTextClicked() {
- if (isSuggestionsRequested()) return;
+ if (mCurrentSettings.isSuggestionsRequested(mDisplayOrientation)) return;
super.onExtractedTextClicked();
}
@@ -844,7 +844,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
*/
@Override
public void onExtractedCursorMovement(int dx, int dy) {
- if (isSuggestionsRequested()) return;
+ if (mCurrentSettings.isSuggestionsRequested(mDisplayOrientation)) return;
super.onExtractedCursorMovement(dx, dy);
}
@@ -1449,7 +1449,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
}
- if (isSuggestionsRequested()) {
+ if (mCurrentSettings.isSuggestionsRequested(mDisplayOrientation)) {
restartSuggestionsOnWordBeforeCursorIfAtEndOfWord();
}
}
@@ -1494,7 +1494,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// thread here.
if (!isComposingWord && (isAlphabet(primaryCode)
|| mCurrentSettings.isSymbolExcludedFromWordSeparators(primaryCode))
- && isSuggestionsRequested() &&
+ && mCurrentSettings.isSuggestionsRequested(mDisplayOrientation) &&
!mConnection.isCursorTouchingWord(mCurrentSettings)) {
// Reset entirely the composing state anyway, then start composing a new word unless
// the character is a single quote. The idea here is, single quote is not a
@@ -1576,7 +1576,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
sendKeyCodePoint(primaryCode);
if (Keyboard.CODE_SPACE == primaryCode) {
- if (isSuggestionsRequested()) {
+ if (mCurrentSettings.isSuggestionsRequested(mDisplayOrientation)) {
if (maybeDoubleSpace()) {
mSpaceState = SPACE_STATE_DOUBLE;
} else if (!isShowingPunctuationList()) {
@@ -1627,13 +1627,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
inputView.closing();
}
- public boolean isSuggestionsRequested() {
- // TODO: move this method to mCurrentSettings
- return mCurrentSettings.isSuggestionStripRequestedByTextField()
- && (mCurrentSettings.isCorrectionOn()
- || mCurrentSettings.isSuggestionStripVisibleInOrientation(mDisplayOrientation));
- }
-
public boolean isShowingPunctuationList() {
if (mSuggestionsView == null) return false;
return mCurrentSettings.mSuggestPuncList == mSuggestionsView.getSuggestions();
@@ -1648,7 +1641,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return false;
if (mCurrentSettings.isApplicationSpecifiedCompletionsOn())
return true;
- return isSuggestionsRequested();
+ return mCurrentSettings.isSuggestionsRequested(mDisplayOrientation);
}
public void switchToKeyboardView() {
@@ -1697,7 +1690,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void updateSuggestions() {
// Check if we have a suggestion engine attached.
- if ((mSuggest == null || !isSuggestionsRequested())) {
+ if ((mSuggest == null || !mCurrentSettings.isSuggestionsRequested(mDisplayOrientation))) {
if (mWordComposer.isComposingWord()) {
Log.w(TAG, "Called updateSuggestions but suggestions were not requested!");
mWordComposer.setAutoCorrection(mWordComposer.getTypedWord());
@@ -1926,7 +1919,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
public void updateBigramPredictions() {
- if (mSuggest == null || !isSuggestionsRequested())
+ if (mSuggest == null || !mCurrentSettings.isSuggestionsRequested(mDisplayOrientation))
return;
if (!mCurrentSettings.mBigramPredictionEnabled) {
@@ -2225,8 +2218,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
final int keyboardMode = keyboard != null ? keyboard.mId.mMode : -1;
p.println(" Keyboard mode = " + keyboardMode);
- p.println(" mIsSuggestionsStripRequestedByTextField = "
- + mCurrentSettings.isSuggestionStripRequestedByTextField());
+ p.println(" mIsSuggestionsSuggestionsRequested = "
+ + mCurrentSettings.isSuggestionsRequested(mDisplayOrientation));
p.println(" mCorrectionMode=" + mCurrentSettings.mCorrectionMode);
p.println(" isComposingWord=" + mWordComposer.isComposingWord());
p.println(" isCorrectionOn=" + mCurrentSettings.isCorrectionOn());
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index 5d33923df..30fee576f 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -76,9 +76,7 @@ public class SettingsValues {
@SuppressWarnings("unused") // TODO: Use this
private final String mKeyPreviewPopupDismissDelayRawValue;
public final boolean mUseContactsDict;
- // Suggestion: use bigrams to adjust scores of suggestions obtained from unigram dictionary
- public final boolean mBigramSuggestionEnabled;
- // Prediction: use bigrams to predict the next word when there is no input for it yet
+ // Use bigrams to predict the next word when there is no input for it yet
public final boolean mBigramPredictionEnabled;
public final boolean mEnableSuggestionSpanInsertion;
@SuppressWarnings("unused") // TODO: Use this
@@ -157,10 +155,7 @@ public class SettingsValues {
Integer.toString(res.getInteger(R.integer.config_key_preview_linger_timeout)));
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
mAutoCorrectEnabled = isAutoCorrectEnabled(res, mAutoCorrectionThresholdRawValue);
- mBigramSuggestionEnabled = mAutoCorrectEnabled
- && isBigramSuggestionEnabled(prefs, res, mAutoCorrectEnabled);
- mBigramPredictionEnabled = mBigramSuggestionEnabled
- && isBigramPredictionEnabled(prefs, res);
+ mBigramPredictionEnabled = isBigramPredictionEnabled(prefs, res);
// TODO: remove mEnableSuggestionSpanInsertion. It's always true.
mEnableSuggestionSpanInsertion = true;
mVibrationDurationSettingsRawValue =
@@ -183,12 +178,11 @@ public class SettingsValues {
// Helper functions to create member values.
private static SuggestedWords createSuggestPuncList(final String[] puncs) {
- final ArrayList<SuggestedWords.SuggestedWordInfo> puncList =
- new ArrayList<SuggestedWords.SuggestedWordInfo>();
+ final ArrayList<SuggestedWordInfo> puncList = new ArrayList<SuggestedWordInfo>();
if (puncs != null) {
for (final String puncSpec : puncs) {
- puncList.add(new SuggestedWords.SuggestedWordInfo(
- KeySpecParser.getLabel(puncSpec), SuggestedWordInfo.MAX_SCORE));
+ puncList.add(new SuggestedWordInfo(KeySpecParser.getLabel(puncSpec),
+ SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_HARDCODED));
}
}
return new SuggestedWords(puncList,
@@ -215,7 +209,7 @@ public class SettingsValues {
private int createCorrectionMode() {
final boolean shouldAutoCorrect = mAutoCorrectEnabled
&& !mInputAttributes.mInputTypeNoAutoCorrect;
- if (mBigramSuggestionEnabled && shouldAutoCorrect) return Suggest.CORRECTION_FULL_BIGRAM;
+ if (shouldAutoCorrect) return Suggest.CORRECTION_FULL_BIGRAM;
return shouldAutoCorrect ? Suggest.CORRECTION_FULL : Suggest.CORRECTION_NONE;
}
@@ -244,8 +238,9 @@ public class SettingsValues {
return mInputAttributes.mEditorAction == EditorInfo.IME_ACTION_NEXT;
}
- public boolean isSuggestionStripRequestedByTextField() {
- return mInputAttributes.mIsSettingsSuggestionStripOn;
+ public boolean isSuggestionsRequested(final int displayOrientation) {
+ return mInputAttributes.mIsSettingsSuggestionStripOn
+ && (isCorrectionOn() || isSuggestionStripVisibleInOrientation(displayOrientation));
}
public boolean isCorrectionOn() {
@@ -308,12 +303,6 @@ public class SettingsValues {
R.integer.config_key_preview_linger_timeout))));
}
- private static boolean isBigramSuggestionEnabled(final SharedPreferences sp,
- final Resources resources, final boolean autoCorrectEnabled) {
- // TODO: remove this method. Bigram suggestion is always true.
- return true;
- }
-
private static boolean isBigramPredictionEnabled(final SharedPreferences sp,
final Resources resources) {
return sp.getBoolean(Settings.PREF_BIGRAM_PREDICTIONS, resources.getBoolean(
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 7398c82fa..938247f00 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -73,7 +73,7 @@ public class Suggest implements Dictionary.WordCallback {
private final ConcurrentHashMap<String, Dictionary> mBigramDictionaries =
new ConcurrentHashMap<String, Dictionary>();
- private int mPrefMaxSuggestions = 18;
+ public static final int MAX_SUGGESTIONS = 18;
private static final int PREF_MAX_BIGRAMS = 60;
@@ -221,7 +221,7 @@ public class Suggest implements Dictionary.WordCallback {
mIsFirstCharCapitalized = false;
mIsAllUpperCase = false;
mTrailingSingleQuotesCount = 0;
- mSuggestions = new ArrayList<SuggestedWordInfo>(mPrefMaxSuggestions);
+ mSuggestions = new ArrayList<SuggestedWordInfo>(MAX_SUGGESTIONS);
// Treating USER_TYPED as UNIGRAM suggestion for logging now.
LatinImeLogger.onAddSuggestedWord("", Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM);
@@ -232,7 +232,7 @@ public class Suggest implements Dictionary.WordCallback {
getAllBigrams(prevWordForBigram, sEmptyWordComposer);
// Nothing entered: return all bigrams for the previous word
- int insertCount = Math.min(mBigramSuggestions.size(), mPrefMaxSuggestions);
+ int insertCount = Math.min(mBigramSuggestions.size(), MAX_SUGGESTIONS);
for (int i = 0; i < insertCount; ++i) {
addBigramToSuggestions(mBigramSuggestions.get(i));
}
@@ -256,7 +256,7 @@ public class Suggest implements Dictionary.WordCallback {
mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized();
mIsAllUpperCase = wordComposer.isAllUpperCase();
mTrailingSingleQuotesCount = wordComposer.trailingSingleQuotesCount();
- mSuggestions = new ArrayList<SuggestedWordInfo>(mPrefMaxSuggestions);
+ mSuggestions = new ArrayList<SuggestedWordInfo>(MAX_SUGGESTIONS);
final String typedWord = wordComposer.getTypedWord();
final String consideredWord = mTrailingSingleQuotesCount > 0
@@ -274,7 +274,7 @@ public class Suggest implements Dictionary.WordCallback {
getAllBigrams(prevWordForBigram, wordComposer);
if (TextUtils.isEmpty(consideredWord)) {
// Nothing entered: return all bigrams for the previous word
- int insertCount = Math.min(mBigramSuggestions.size(), mPrefMaxSuggestions);
+ int insertCount = Math.min(mBigramSuggestions.size(), MAX_SUGGESTIONS);
for (int i = 0; i < insertCount; ++i) {
addBigramToSuggestions(mBigramSuggestions.get(i));
}
@@ -293,7 +293,7 @@ public class Suggest implements Dictionary.WordCallback {
if (bigramSuggestionFirstChar == currentChar
|| bigramSuggestionFirstChar == currentCharUpper) {
addBigramToSuggestions(bigramSuggestion);
- if (++count > mPrefMaxSuggestions) break;
+ if (++count > MAX_SUGGESTIONS) break;
}
}
}
@@ -339,15 +339,16 @@ public class Suggest implements Dictionary.WordCallback {
for (int i = mTrailingSingleQuotesCount - 1; i >= 0; --i) {
sb.appendCodePoint(Keyboard.CODE_SINGLE_QUOTE);
}
- mSuggestions.add(0, new SuggestedWordInfo(
- sb.toString(), SuggestedWordInfo.MAX_SCORE));
+ mSuggestions.add(0, new SuggestedWordInfo(sb.toString(),
+ SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST));
} else {
- mSuggestions.add(0, new SuggestedWordInfo(
- whitelistedWord, SuggestedWordInfo.MAX_SCORE));
+ mSuggestions.add(0, new SuggestedWordInfo(whitelistedWord,
+ SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST));
}
}
- mSuggestions.add(0, new SuggestedWordInfo(typedWord, SuggestedWordInfo.MAX_SCORE));
+ mSuggestions.add(0, new SuggestedWordInfo(typedWord, SuggestedWordInfo.MAX_SCORE,
+ SuggestedWordInfo.KIND_TYPED));
SuggestedWordInfo.removeDups(mSuggestions);
final ArrayList<SuggestedWordInfo> suggestionsList;
@@ -447,7 +448,7 @@ public class Suggest implements Dictionary.WordCallback {
prefMaxSuggestions = PREF_MAX_BIGRAMS;
} else {
suggestions = mSuggestions;
- prefMaxSuggestions = mPrefMaxSuggestions;
+ prefMaxSuggestions = MAX_SUGGESTIONS;
}
int pos = 0;
@@ -499,7 +500,8 @@ public class Suggest implements Dictionary.WordCallback {
for (int i = mTrailingSingleQuotesCount - 1; i >= 0; --i) {
sb.appendCodePoint(Keyboard.CODE_SINGLE_QUOTE);
}
- suggestions.add(pos, new SuggestedWordInfo(sb, score));
+ // TODO: figure out what type of suggestion this is
+ suggestions.add(pos, new SuggestedWordInfo(sb, score, SuggestedWordInfo.KIND_CORRECTION));
if (suggestions.size() > prefMaxSuggestions) {
suggestions.remove(prefMaxSuggestions);
} else {
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index 497fd3bfa..1ed91fe71 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -91,7 +91,8 @@ public class SuggestedWords {
final ArrayList<SuggestedWordInfo> result = new ArrayList<SuggestedWordInfo>();
for (CompletionInfo info : infos) {
if (null != info && info.getText() != null) {
- result.add(new SuggestedWordInfo(info.getText(), SuggestedWordInfo.MAX_SCORE));
+ result.add(new SuggestedWordInfo(info.getText(), SuggestedWordInfo.MAX_SCORE,
+ SuggestedWordInfo.KIND_APP_DEFINED));
}
}
return result;
@@ -103,7 +104,8 @@ public class SuggestedWords {
final CharSequence typedWord, final SuggestedWords previousSuggestions) {
final ArrayList<SuggestedWordInfo> suggestionsList = new ArrayList<SuggestedWordInfo>();
final HashSet<String> alreadySeen = new HashSet<String>();
- suggestionsList.add(new SuggestedWordInfo(typedWord, SuggestedWordInfo.MAX_SCORE));
+ suggestionsList.add(new SuggestedWordInfo(typedWord, SuggestedWordInfo.MAX_SCORE,
+ SuggestedWordInfo.KIND_TYPED));
alreadySeen.add(typedWord.toString());
final int previousSize = previousSuggestions.size();
for (int pos = 1; pos < previousSize; pos++) {
@@ -120,16 +122,25 @@ public class SuggestedWords {
public static class SuggestedWordInfo {
public static final int MAX_SCORE = Integer.MAX_VALUE;
+ public static final int KIND_TYPED = 0; // What user typed
+ public static final int KIND_CORRECTION = 1; // Simple correction/suggestion
+ public static final int KIND_COMPLETION = 2; // Completion (suggestion with appended chars)
+ public static final int KIND_WHITELIST = 3; // Whitelisted word
+ public static final int KIND_BLACKLIST = 4; // Blacklisted word
+ public static final int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation
+ public static final int KIND_APP_DEFINED = 6; // Suggested by the application
private final String mWordStr;
public final CharSequence mWord;
public final int mScore;
+ public final int mKind;
public final int mCodePointCount;
private String mDebugString = "";
- public SuggestedWordInfo(final CharSequence word, final int score) {
+ public SuggestedWordInfo(final CharSequence word, final int score, final int kind) {
mWordStr = word.toString();
mWord = word;
mScore = score;
+ mKind = kind;
mCodePointCount = mWordStr.codePointCount(0, mWordStr.length());
}