diff options
Diffstat (limited to 'java/src')
9 files changed, 328 insertions, 295 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java index b4fa86dd5..be7644fb5 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java @@ -159,7 +159,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel @Override public boolean dismissMoreKeysPanel() { - if (mIsDismissing) return false; + if (mIsDismissing || mController == null) return false; mIsDismissing = true; final boolean dismissed = mController.dismissMoreKeysPanel(); mIsDismissing = false; diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java index f429a3e52..917e233a8 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java @@ -161,71 +161,72 @@ public final class KeyboardTextsSet { /* 53 */ "more_keys_for_right_parenthesis", /* 54 */ "more_keys_for_less_than", /* 55 */ "more_keys_for_greater_than", - /* 56 */ "keylabel_for_symbols_1", - /* 57 */ "keylabel_for_symbols_2", - /* 58 */ "keylabel_for_symbols_3", - /* 59 */ "keylabel_for_symbols_4", - /* 60 */ "keylabel_for_symbols_5", - /* 61 */ "keylabel_for_symbols_6", - /* 62 */ "keylabel_for_symbols_7", - /* 63 */ "keylabel_for_symbols_8", - /* 64 */ "keylabel_for_symbols_9", - /* 65 */ "keylabel_for_symbols_0", - /* 66 */ "additional_more_keys_for_symbols_1", - /* 67 */ "additional_more_keys_for_symbols_2", - /* 68 */ "additional_more_keys_for_symbols_3", - /* 69 */ "additional_more_keys_for_symbols_4", - /* 70 */ "additional_more_keys_for_symbols_5", - /* 71 */ "additional_more_keys_for_symbols_6", - /* 72 */ "additional_more_keys_for_symbols_7", - /* 73 */ "additional_more_keys_for_symbols_8", - /* 74 */ "additional_more_keys_for_symbols_9", - /* 75 */ "additional_more_keys_for_symbols_0", - /* 76 */ "more_keys_for_symbols_1", - /* 77 */ "more_keys_for_symbols_2", - /* 78 */ "more_keys_for_symbols_3", - /* 79 */ "more_keys_for_symbols_4", - /* 80 */ "more_keys_for_symbols_5", - /* 81 */ "more_keys_for_symbols_6", - /* 82 */ "more_keys_for_symbols_7", - /* 83 */ "more_keys_for_symbols_8", - /* 84 */ "more_keys_for_symbols_9", - /* 85 */ "more_keys_for_symbols_0", - /* 86 */ "keylabel_for_comma", - /* 87 */ "more_keys_for_comma", - /* 88 */ "keylabel_for_symbols_exclamation", - /* 89 */ "keylabel_for_symbols_question", - /* 90 */ "keylabel_for_symbols_semicolon", - /* 91 */ "keylabel_for_symbols_percent", - /* 92 */ "more_keys_for_symbols_exclamation", - /* 93 */ "more_keys_for_symbols_question", - /* 94 */ "more_keys_for_symbols_semicolon", - /* 95 */ "more_keys_for_symbols_percent", - /* 96 */ "keylabel_for_tablet_comma", - /* 97 */ "keyhintlabel_for_tablet_comma", - /* 98 */ "more_keys_for_tablet_comma", - /* 99 */ "keyhintlabel_for_tablet_period", - /* 100 */ "more_keys_for_tablet_period", - /* 101 */ "keylabel_for_apostrophe", - /* 102 */ "keyhintlabel_for_apostrophe", - /* 103 */ "more_keys_for_apostrophe", - /* 104 */ "more_keys_for_am_pm", - /* 105 */ "settings_as_more_key", - /* 106 */ "shortcut_as_more_key", - /* 107 */ "action_next_as_more_key", - /* 108 */ "action_previous_as_more_key", - /* 109 */ "label_to_more_symbol_key", - /* 110 */ "label_to_more_symbol_for_tablet_key", - /* 111 */ "label_tab_key", - /* 112 */ "label_to_phone_numeric_key", - /* 113 */ "label_to_phone_symbols_key", - /* 114 */ "label_time_am", - /* 115 */ "label_time_pm", - /* 116 */ "label_to_symbol_key_pcqwerty", - /* 117 */ "keylabel_for_popular_domain", - /* 118 */ "more_keys_for_popular_domain", - /* 119 */ "more_keys_for_smiley", - /* 120 */ "more_keys_for_arabic_diacritics", + /* 56 */ "more_keys_for_arabic_diacritics", + /* 57 */ "keyhintlabel_for_arabic_diacritics", + /* 58 */ "keylabel_for_symbols_1", + /* 59 */ "keylabel_for_symbols_2", + /* 60 */ "keylabel_for_symbols_3", + /* 61 */ "keylabel_for_symbols_4", + /* 62 */ "keylabel_for_symbols_5", + /* 63 */ "keylabel_for_symbols_6", + /* 64 */ "keylabel_for_symbols_7", + /* 65 */ "keylabel_for_symbols_8", + /* 66 */ "keylabel_for_symbols_9", + /* 67 */ "keylabel_for_symbols_0", + /* 68 */ "additional_more_keys_for_symbols_1", + /* 69 */ "additional_more_keys_for_symbols_2", + /* 70 */ "additional_more_keys_for_symbols_3", + /* 71 */ "additional_more_keys_for_symbols_4", + /* 72 */ "additional_more_keys_for_symbols_5", + /* 73 */ "additional_more_keys_for_symbols_6", + /* 74 */ "additional_more_keys_for_symbols_7", + /* 75 */ "additional_more_keys_for_symbols_8", + /* 76 */ "additional_more_keys_for_symbols_9", + /* 77 */ "additional_more_keys_for_symbols_0", + /* 78 */ "more_keys_for_symbols_1", + /* 79 */ "more_keys_for_symbols_2", + /* 80 */ "more_keys_for_symbols_3", + /* 81 */ "more_keys_for_symbols_4", + /* 82 */ "more_keys_for_symbols_5", + /* 83 */ "more_keys_for_symbols_6", + /* 84 */ "more_keys_for_symbols_7", + /* 85 */ "more_keys_for_symbols_8", + /* 86 */ "more_keys_for_symbols_9", + /* 87 */ "more_keys_for_symbols_0", + /* 88 */ "keylabel_for_comma", + /* 89 */ "more_keys_for_comma", + /* 90 */ "keylabel_for_symbols_exclamation", + /* 91 */ "keylabel_for_symbols_question", + /* 92 */ "keylabel_for_symbols_semicolon", + /* 93 */ "keylabel_for_symbols_percent", + /* 94 */ "more_keys_for_symbols_exclamation", + /* 95 */ "more_keys_for_symbols_question", + /* 96 */ "more_keys_for_symbols_semicolon", + /* 97 */ "more_keys_for_symbols_percent", + /* 98 */ "keylabel_for_tablet_comma", + /* 99 */ "keyhintlabel_for_tablet_comma", + /* 100 */ "more_keys_for_tablet_comma", + /* 101 */ "keyhintlabel_for_tablet_period", + /* 102 */ "more_keys_for_tablet_period", + /* 103 */ "keylabel_for_apostrophe", + /* 104 */ "keyhintlabel_for_apostrophe", + /* 105 */ "more_keys_for_apostrophe", + /* 106 */ "more_keys_for_am_pm", + /* 107 */ "settings_as_more_key", + /* 108 */ "shortcut_as_more_key", + /* 109 */ "action_next_as_more_key", + /* 110 */ "action_previous_as_more_key", + /* 111 */ "label_to_more_symbol_key", + /* 112 */ "label_to_more_symbol_for_tablet_key", + /* 113 */ "label_tab_key", + /* 114 */ "label_to_phone_numeric_key", + /* 115 */ "label_to_phone_symbols_key", + /* 116 */ "label_time_am", + /* 117 */ "label_time_pm", + /* 118 */ "label_to_symbol_key_pcqwerty", + /* 119 */ "keylabel_for_popular_domain", + /* 120 */ "more_keys_for_popular_domain", + /* 121 */ "more_keys_for_smiley", }; private static final String EMPTY = ""; @@ -288,108 +289,94 @@ public final class KeyboardTextsSet { // U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK /* 54 */ "!fixedColumnOrder!3,\u2039,\u2264,\u00AB", /* 55 */ "!fixedColumnOrder!3,\u203A,\u2265,\u00BB", - /* 56 */ "1", - /* 57 */ "2", - /* 58 */ "3", - /* 59 */ "4", - /* 60 */ "5", - /* 61 */ "6", - /* 62 */ "7", - /* 63 */ "8", - /* 64 */ "9", - /* 65 */ "0", - /* 66~ */ + /* 56 */ EMPTY, + /* 57 */ EMPTY, + /* 58 */ "1", + /* 59 */ "2", + /* 60 */ "3", + /* 61 */ "4", + /* 62 */ "5", + /* 63 */ "6", + /* 64 */ "7", + /* 65 */ "8", + /* 66 */ "9", + /* 67 */ "0", + /* 68~ */ EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, - /* ~75 */ + /* ~77 */ // U+00B9: "¹" SUPERSCRIPT ONE // U+00BD: "½" VULGAR FRACTION ONE HALF // U+2153: "⅓" VULGAR FRACTION ONE THIRD // U+00BC: "¼" VULGAR FRACTION ONE QUARTER // U+215B: "⅛" VULGAR FRACTION ONE EIGHTH - /* 76 */ "\u00B9,\u00BD,\u2153,\u00BC,\u215B", + /* 78 */ "\u00B9,\u00BD,\u2153,\u00BC,\u215B", // U+00B2: "²" SUPERSCRIPT TWO // U+2154: "⅔" VULGAR FRACTION TWO THIRDS - /* 77 */ "\u00B2,\u2154", + /* 79 */ "\u00B2,\u2154", // U+00B3: "³" SUPERSCRIPT THREE // U+00BE: "¾" VULGAR FRACTION THREE QUARTERS // U+215C: "⅜" VULGAR FRACTION THREE EIGHTHS - /* 78 */ "\u00B3,\u00BE,\u215C", + /* 80 */ "\u00B3,\u00BE,\u215C", // U+2074: "⁴" SUPERSCRIPT FOUR - /* 79 */ "\u2074", + /* 81 */ "\u2074", // U+215D: "⅝" VULGAR FRACTION FIVE EIGHTHS - /* 80 */ "\u215D", - /* 81 */ EMPTY, - // U+215E: "⅞" VULGAR FRACTION SEVEN EIGHTHS - /* 82 */ "\u215E", + /* 82 */ "\u215D", /* 83 */ EMPTY, - /* 84 */ EMPTY, + // U+215E: "⅞" VULGAR FRACTION SEVEN EIGHTHS + /* 84 */ "\u215E", + /* 85 */ EMPTY, + /* 86 */ EMPTY, // U+207F: "ⁿ" SUPERSCRIPT LATIN SMALL LETTER N // U+2205: "∅" EMPTY SET - /* 85 */ "\u207F,\u2205", - /* 86 */ ",", - /* 87 */ EMPTY, - /* 88 */ "!", - /* 89 */ "?", - /* 90 */ ";", - /* 91 */ "%", + /* 87 */ "\u207F,\u2205", + /* 88 */ ",", + /* 89 */ EMPTY, + /* 90 */ "!", + /* 91 */ "?", + /* 92 */ ";", + /* 93 */ "%", // U+00A1: "¡" INVERTED EXCLAMATION MARK - /* 92 */ "\u00A1", + /* 94 */ "\u00A1", // U+00BF: "¿" INVERTED QUESTION MARK - /* 93 */ "\u00BF", - /* 94 */ EMPTY, + /* 95 */ "\u00BF", + /* 96 */ EMPTY, // U+2030: "‰" PER MILLE SIGN - /* 95 */ "\u2030", - /* 96 */ ",", - /* 97 */ "!", - /* 98 */ "!", - /* 99 */ "?", - /* 100 */ "?", - /* 101 */ "\'", - /* 102 */ "\"", - /* 103 */ "\"", - /* 104 */ "!fixedColumnOrder!2,!hasLabels!,!text/label_time_am,!text/label_time_pm", - /* 105 */ "!icon/settings_key|!code/key_settings", - /* 106 */ "!icon/shortcut_key|!code/key_shortcut", - /* 107 */ "!hasLabels!,!text/label_next_key|!code/key_action_next", - /* 108 */ "!hasLabels!,!text/label_previous_key|!code/key_action_previous", + /* 97 */ "\u2030", + /* 98 */ ",", + /* 99 */ "!", + /* 100 */ "!", + /* 101 */ "?", + /* 102 */ "?", + /* 103 */ "\'", + /* 104 */ "\"", + /* 105 */ "\"", + /* 106 */ "!fixedColumnOrder!2,!hasLabels!,!text/label_time_am,!text/label_time_pm", + /* 107 */ "!icon/settings_key|!code/key_settings", + /* 108 */ "!icon/shortcut_key|!code/key_shortcut", + /* 109 */ "!hasLabels!,!text/label_next_key|!code/key_action_next", + /* 110 */ "!hasLabels!,!text/label_previous_key|!code/key_action_previous", // Label for "switch to more symbol" modifier key. Must be short to fit on key! - /* 109 */ "= \\ <", + /* 111 */ "= \\ <", // Label for "switch to more symbol" modifier key on tablets. Must be short to fit on key! - /* 110 */ "~ \\ {", + /* 112 */ "~ \\ {", // Label for "Tab" key. Must be short to fit on key! - /* 111 */ "Tab", + /* 113 */ "Tab", // Label for "switch to phone numeric" key. Must be short to fit on key! - /* 112 */ "123", + /* 114 */ "123", // Label for "switch to phone symbols" key. Must be short to fit on key! // U+FF0A: "*" FULLWIDTH ASTERISK // U+FF03: "#" FULLWIDTH NUMBER SIGN - /* 113 */ "\uFF0A\uFF03", + /* 115 */ "\uFF0A\uFF03", // Key label for "ante meridiem" - /* 114 */ "AM", + /* 116 */ "AM", // Key label for "post meridiem" - /* 115 */ "PM", + /* 117 */ "PM", // Label for "switch to symbols" key on PC QWERTY layout - /* 116 */ "Sym", - /* 117 */ ".com", + /* 118 */ "Sym", + /* 119 */ ".com", // popular web domains for the locale - most popular, displayed on the keyboard - /* 118 */ "!hasLabels!,.net,.org,.gov,.edu", - /* 119 */ "!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ ", - // U+064F: "ُ" ARABIC DAMMA - // U+064C: "ٌ" ARABIC DAMMATAN - // U+0651: "ّ" ARABIC SHADDA - // U+0652: "ْ" ARABIC SUKUN - // U+0653: "ٓ" ARABIC MADDAH ABOVE - // U+064D: "ٍ" ARABIC KASRATAN - // U+064B: "ً" ARABIC FATHATAN - // U+0650: "ِ" ARABIC KASRA - // U+064E: "َ" ARABIC FATHA - // U+0640: "ـ" ARABIC TATWEEL - // U+0656: "ٖ" ARABIC SUBSCRIPT ALEF - // U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF - // U+0655: "ٕ" ARABIC HAMZA BELOW - // U+0654: "ٔ" ARABIC HAMZA ABOVE - // In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label. - /* 120 */ "!fixedColumnOrder!5,\u064F,\u064C,\u0651,\u0652,\u0653,\u064D,\u064B,\u0650,\u064E,\u0640\u0640\u0640|\u0640,\u0656,\u0670,\u0655,\u0654", + /* 120 */ "!hasLabels!,.net,.org,.gov,.edu", + /* 121 */ "!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ ", }; /* Language ar: Arabic */ @@ -441,63 +428,80 @@ public final class KeyboardTextsSet { // 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", + // U+0655: "ٕ" ARABIC HAMZA BELOW + // U+0654: "ٔ" ARABIC HAMZA ABOVE + // U+0652: "ْ" ARABIC SUKUN + // U+064D: "ٍ" ARABIC KASRATAN + // U+064C: "ٌ" ARABIC DAMMATAN + // U+064B: "ً" ARABIC FATHATAN + // U+0651: "ّ" ARABIC SHADDA + // U+0656: "ٖ" ARABIC SUBSCRIPT ALEF + // U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF + // U+0653: "ٓ" ARABIC MADDAH ABOVE + // U+0650: "ِ" ARABIC KASRA + // U+064F: "ُ" ARABIC DAMMA + // U+064E: "َ" ARABIC FATHA + // 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,\u0654,\u0652,\u064D,\u064C,\u064B,\u0651,\u0656,\u0670,\u0653,\u0650,\u064F,\u064E,\u0640\u0640\u0640|\u0640", + /* 57 */ "\u0651", // U+0661: "١" ARABIC-INDIC DIGIT ONE - /* 56 */ "\u0661", + /* 58 */ "\u0661", // U+0662: "٢" ARABIC-INDIC DIGIT TWO - /* 57 */ "\u0662", + /* 59 */ "\u0662", // U+0663: "٣" ARABIC-INDIC DIGIT THREE - /* 58 */ "\u0663", + /* 60 */ "\u0663", // U+0664: "٤" ARABIC-INDIC DIGIT FOUR - /* 59 */ "\u0664", + /* 61 */ "\u0664", // U+0665: "٥" ARABIC-INDIC DIGIT FIVE - /* 60 */ "\u0665", + /* 62 */ "\u0665", // U+0666: "٦" ARABIC-INDIC DIGIT SIX - /* 61 */ "\u0666", + /* 63 */ "\u0666", // U+0667: "٧" ARABIC-INDIC DIGIT SEVEN - /* 62 */ "\u0667", + /* 64 */ "\u0667", // U+0668: "٨" ARABIC-INDIC DIGIT EIGHT - /* 63 */ "\u0668", + /* 65 */ "\u0668", // U+0669: "٩" ARABIC-INDIC DIGIT NINE - /* 64 */ "\u0669", + /* 66 */ "\u0669", // U+0660: "٠" ARABIC-INDIC DIGIT ZERO - /* 65 */ "\u0660", - /* 66 */ "1", - /* 67 */ "2", - /* 68 */ "3", - /* 69 */ "4", - /* 70 */ "5", - /* 71 */ "6", - /* 72 */ "7", - /* 73 */ "8", - /* 74 */ "9", + /* 67 */ "\u0660", + /* 68 */ "1", + /* 69 */ "2", + /* 70 */ "3", + /* 71 */ "4", + /* 72 */ "5", + /* 73 */ "6", + /* 74 */ "7", + /* 75 */ "8", + /* 76 */ "9", // U+066B: "٫" ARABIC DECIMAL SEPARATOR // U+066C: "٬" ARABIC THOUSANDS SEPARATOR - /* 75 */ "0,\u066B,\u066C", - /* 76~ */ + /* 77 */ "0,\u066B,\u066C", + /* 78~ */ null, null, null, null, null, null, null, null, null, null, - /* ~85 */ + /* ~87 */ // U+060C: "،" ARABIC COMMA - /* 86 */ "\u060C", - /* 87 */ "\\,", - /* 88 */ null, - /* 89 */ "\u061F", - /* 90 */ "\u061B", + /* 88 */ "\u060C", + /* 89 */ "\\,", + /* 90 */ null, + /* 91 */ "\u061F", + /* 92 */ "\u061B", // U+066A: "٪" ARABIC PERCENT SIGN - /* 91 */ "\u066A", - /* 92 */ null, - /* 93 */ "?", - /* 94 */ ";", + /* 93 */ "\u066A", + /* 94 */ null, + /* 95 */ "?", + /* 96 */ ";", // U+2030: "‰" PER MILLE SIGN - /* 95 */ "\\%,\u2030", - /* 96~ */ + /* 97 */ "\\%,\u2030", + /* 98~ */ null, null, null, null, null, - /* ~100 */ + /* ~102 */ // U+060C: "،" ARABIC COMMA // U+061B: "؛" ARABIC SEMICOLON // U+061F: "؟" ARABIC QUESTION MARK - /* 101 */ "\u060C", - /* 102 */ "\u061F", - /* 103 */ "\u061F,\u061B,!,:,-,/,\',\"", + /* 103 */ "\u060C", + /* 104 */ "\u061F", + /* 105 */ "\u061F,\u061B,!,:,-,/,\',\"", }; /* Language be: Belarusian */ @@ -861,23 +865,23 @@ public final class KeyboardTextsSet { /* 49~ */ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, - /* ~87 */ + null, null, null, null, null, null, null, null, null, null, null, + /* ~89 */ // U+00A1: "¡" INVERTED EXCLAMATION MARK - /* 88 */ "\u00A1", + /* 90 */ "\u00A1", // U+00BF: "¿" INVERTED QUESTION MARK - /* 89 */ "\u00BF", - /* 90 */ null, - /* 91 */ null, - /* 92 */ "!", - /* 93 */ "?", - /* 94~ */ + /* 91 */ "\u00BF", + /* 92 */ null, + /* 93 */ null, + /* 94 */ "!", + /* 95 */ "?", + /* 96~ */ null, null, null, - /* ~96 */ - /* 97 */ "\u00A1", - /* 98 */ "\u00A1,!", - /* 99 */ "\u00BF", - /* 100 */ "\u00BF,?", + /* ~98 */ + /* 99 */ "\u00A1", + /* 100 */ "\u00A1,!", + /* 101 */ "\u00BF", + /* 102 */ "\u00BF,?", }; /* Language et: Estonian */ @@ -1029,65 +1033,82 @@ public final class KeyboardTextsSet { // 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", + // U+0655: "ٕ" ARABIC HAMZA BELOW + // U+0652: "ْ" ARABIC SUKUN + // U+0651: "ّ" ARABIC SHADDA + // U+064C: "ٌ" ARABIC DAMMATAN + // U+064D: "ٍ" ARABIC KASRATAN + // U+064B: "ً" ARABIC FATHATAN + // U+0654: "ٔ" ARABIC HAMZA ABOVE + // U+0656: "ٖ" ARABIC SUBSCRIPT ALEF + // U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF + // U+0653: "ٓ" ARABIC MADDAH ABOVE + // U+064F: "ُ" ARABIC DAMMA + // U+0650: "ِ" ARABIC KASRA + // U+064E: "َ" ARABIC FATHA + // 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", // U+06F1: "۱" EXTENDED ARABIC-INDIC DIGIT ONE - /* 56 */ "\u06F1", + /* 58 */ "\u06F1", // U+06F2: "۲" EXTENDED ARABIC-INDIC DIGIT TWO - /* 57 */ "\u06F2", + /* 59 */ "\u06F2", // U+06F3: "۳" EXTENDED ARABIC-INDIC DIGIT THREE - /* 58 */ "\u06F3", + /* 60 */ "\u06F3", // U+06F4: "۴" EXTENDED ARABIC-INDIC DIGIT FOUR - /* 59 */ "\u06F4", + /* 61 */ "\u06F4", // U+06F5: "۵" EXTENDED ARABIC-INDIC DIGIT FIVE - /* 60 */ "\u06F5", + /* 62 */ "\u06F5", // U+06F6: "۶" EXTENDED ARABIC-INDIC DIGIT SIX - /* 61 */ "\u06F6", + /* 63 */ "\u06F6", // U+06F7: "۷" EXTENDED ARABIC-INDIC DIGIT SEVEN - /* 62 */ "\u06F7", + /* 64 */ "\u06F7", // U+06F8: "۸" EXTENDED ARABIC-INDIC DIGIT EIGHT - /* 63 */ "\u06F8", + /* 65 */ "\u06F8", // U+06F9: "۹" EXTENDED ARABIC-INDIC DIGIT NINE - /* 64 */ "\u06F9", + /* 66 */ "\u06F9", // U+06F0: "۰" EXTENDED ARABIC-INDIC DIGIT ZERO - /* 65 */ "\u06F0", - /* 66 */ "1", - /* 67 */ "2", - /* 68 */ "3", - /* 69 */ "4", - /* 70 */ "5", - /* 71 */ "6", - /* 72 */ "7", - /* 73 */ "8", - /* 74 */ "9", + /* 67 */ "\u06F0", + /* 68 */ "1", + /* 69 */ "2", + /* 70 */ "3", + /* 71 */ "4", + /* 72 */ "5", + /* 73 */ "6", + /* 74 */ "7", + /* 75 */ "8", + /* 76 */ "9", // U+066B: "٫" ARABIC DECIMAL SEPARATOR // U+066C: "٬" ARABIC THOUSANDS SEPARATOR - /* 75 */ "0,\u066B,\u066C", - /* 76~ */ + /* 77 */ "0,\u066B,\u066C", + /* 78~ */ null, null, null, null, null, null, null, null, null, null, - /* ~85 */ + /* ~87 */ // U+060C: "،" ARABIC COMMA - /* 86 */ "\u060C", - /* 87 */ "\\,", - /* 88 */ null, - /* 89 */ "\u061F", - /* 90 */ "\u061B", + /* 88 */ "\u060C", + /* 89 */ "\\,", + /* 90 */ null, + /* 91 */ "\u061F", + /* 92 */ "\u061B", // U+066A: "٪" ARABIC PERCENT SIGN - /* 91 */ "\u066A", - /* 92 */ null, - /* 93 */ "?", - /* 94 */ ";", + /* 93 */ "\u066A", + /* 94 */ null, + /* 95 */ "?", + /* 96 */ ";", // U+2030: "‰" PER MILLE SIGN - /* 95 */ "\\%,\u2030", + /* 97 */ "\\%,\u2030", // U+060C: "،" ARABIC COMMA // U+061B: "؛" ARABIC SEMICOLON // U+061F: "؟" ARABIC QUESTION MARK - /* 96 */ "\u060C", - /* 97 */ "!", - /* 98 */ "!,\\,", - /* 99 */ "\u061F", - /* 100 */ "\u061F,?", - /* 101 */ null, - /* 102 */ null, - /* 103 */ "\u061F,\u061B,!,:,-,/,\',\"", + /* 98 */ "\u060C", + /* 99 */ "!", + /* 100 */ "!,\\,", + /* 101 */ "\u061F", + /* 102 */ "\u061F,?", + /* 103 */ null, + /* 104 */ null, + /* 105 */ "\u061F,\u061B,!,:,-,/,\',\"", }; /* Language fi: Finnish */ @@ -1196,38 +1217,38 @@ public final class KeyboardTextsSet { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, - /* ~55 */ + null, null, null, null, null, null, null, null, null, null, null, null, null, + /* ~57 */ // U+0967: "१" DEVANAGARI DIGIT ONE - /* 56 */ "\u0967", + /* 58 */ "\u0967", // U+0968: "२" DEVANAGARI DIGIT TWO - /* 57 */ "\u0968", + /* 59 */ "\u0968", // U+0969: "३" DEVANAGARI DIGIT THREE - /* 58 */ "\u0969", + /* 60 */ "\u0969", // U+096A: "४" DEVANAGARI DIGIT FOUR - /* 59 */ "\u096A", + /* 61 */ "\u096A", // U+096B: "५" DEVANAGARI DIGIT FIVE - /* 60 */ "\u096B", + /* 62 */ "\u096B", // U+096C: "६" DEVANAGARI DIGIT SIX - /* 61 */ "\u096C", + /* 63 */ "\u096C", // U+096D: "७" DEVANAGARI DIGIT SEVEN - /* 62 */ "\u096D", + /* 64 */ "\u096D", // U+096E: "८" DEVANAGARI DIGIT EIGHT - /* 63 */ "\u096E", + /* 65 */ "\u096E", // U+096F: "९" DEVANAGARI DIGIT NINE - /* 64 */ "\u096F", + /* 66 */ "\u096F", // U+0966: "०" DEVANAGARI DIGIT ZERO - /* 65 */ "\u0966", - /* 66 */ "1", - /* 67 */ "2", - /* 68 */ "3", - /* 69 */ "4", - /* 70 */ "5", - /* 71 */ "6", - /* 72 */ "7", - /* 73 */ "8", - /* 74 */ "9", - /* 75 */ "0", + /* 67 */ "\u0966", + /* 68 */ "1", + /* 69 */ "2", + /* 70 */ "3", + /* 71 */ "4", + /* 72 */ "5", + /* 73 */ "6", + /* 74 */ "7", + /* 75 */ "8", + /* 76 */ "9", + /* 77 */ "0", }; /* Language hr: Croatian */ diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 5236591f6..77a0ccf70 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -872,7 +872,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (ProductionFlag.IS_EXPERIMENTAL) { ResearchLogger.latinIME_onDisplayCompletions(applicationSpecifiedCompletions); } - if (mInputAttributes.mApplicationSpecifiedCompletionOn) { + if (null != mInputAttributes && mInputAttributes.mApplicationSpecifiedCompletionOn) { mApplicationSpecifiedCompletions = applicationSpecifiedCompletions; if (applicationSpecifiedCompletions == null) { clearSuggestions(); @@ -1627,8 +1627,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } public boolean isSuggestionsRequested() { - // TODO: move this method to mSettingsValues - return mInputAttributes.mIsSettingsSuggestionStripOn + // TODO: move this method to mCurrentSettings + return (null != mInputAttributes && mInputAttributes.mIsSettingsSuggestionStripOn) && (mCurrentSettings.isCorrectionOn() || isShowingSuggestionsStrip()); } @@ -1648,7 +1648,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen return true; if (!isShowingSuggestionsStrip()) return false; - if (mInputAttributes.mApplicationSpecifiedCompletionOn) + if (null != mInputAttributes && mInputAttributes.mApplicationSpecifiedCompletionOn) return true; return isSuggestionsRequested(); } @@ -1804,14 +1804,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen @Override public void pickSuggestionManually(final int index, final CharSequence suggestion, - int x, int y) { - mConnection.beginBatchEdit(getCurrentInputConnection()); - pickSuggestionManuallyWhileInBatchEdit(index, suggestion, x, y); - mConnection.endBatchEdit(); - } - - public void pickSuggestionManuallyWhileInBatchEdit(final int index, - final CharSequence suggestion, final int x, final int y) { + final int x, final int y) { final SuggestedWords suggestedWords = mSuggestionsView.getSuggestions(); // If this is a punctuation picked from the suggestion strip, pass it to onCodeInput if (suggestion.length() == 1 && isShowingPunctuationList()) { @@ -1837,7 +1830,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } } - if (mInputAttributes.mApplicationSpecifiedCompletionOn + if ((null != mInputAttributes && mInputAttributes.mApplicationSpecifiedCompletionOn) && mApplicationSpecifiedCompletions != null && index >= 0 && index < mApplicationSpecifiedCompletions.length) { if (mSuggestionsView != null) { @@ -1846,7 +1839,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mKeyboardSwitcher.updateShiftState(); resetComposingState(true /* alsoResetLastComposedWord */); final CompletionInfo completionInfo = mApplicationSpecifiedCompletions[index]; + mConnection.beginBatchEdit(getCurrentInputConnection()); mConnection.commitCompletion(completionInfo); + mConnection.endBatchEdit(); if (ProductionFlag.IS_EXPERIMENTAL) { ResearchLogger.latinIME_pickApplicationSpecifiedCompletion(index, completionInfo.getText(), x, y); @@ -1958,12 +1953,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // showSuggestions will retrieve the word near the cursor, we don't want that here) showSuggestions(suggestedWords, ""); } else { - if (!isShowingPunctuationList()) setPunctuationSuggestions(); + clearSuggestions(); } } public void setPunctuationSuggestions() { - setSuggestions(mCurrentSettings.mSuggestPuncList, false); + if (mCurrentSettings.mBigramPredictionEnabled) { + clearSuggestions(); + } else { + setSuggestions(mCurrentSettings.mSuggestPuncList, false); + } setAutoCorrectionIndicator(false); setSuggestionStripShown(isSuggestionsStripVisible()); } @@ -1986,10 +1985,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } else { secondWord = suggestion.toString(); } - // We demote unrecognized word and words with 0-frequency (assuming they would be - // profanity etc.) by specifying them as "invalid". + // We demote unrecognized words (frequency < 0, below) by specifying them as "invalid". + // We don't add words with 0-frequency (assuming they would be profanity etc.). final int maxFreq = AutoCorrection.getMaxFrequency( mSuggest.getUnigramDictionaries(), suggestion); + if (maxFreq == 0) return null; mUserHistoryDictionary.addToUserHistory(null == prevWord ? null : prevWord.toString(), secondWord, maxFreq > 0); return prevWord; diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 227990acc..0c19bed05 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -65,66 +65,70 @@ public class RichInputConnection { if (--mNestLevel == 0 && null != mIC) mIC.endBatchEdit(); } + private void checkBatchEdit() { + if (mNestLevel != 1) { + // TODO: exception instead + Log.e(TAG, "Batch edit level incorrect : " + mNestLevel); + Log.e(TAG, Utils.getStackTrace(4)); + } + } + public void finishComposingText() { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead + checkBatchEdit(); if (null != mIC) mIC.finishComposingText(); } public void commitText(final CharSequence text, final int i) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead + checkBatchEdit(); if (null != mIC) mIC.commitText(text, i); } public int getCursorCapsMode(final int inputType) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead if (null == mIC) return Constants.TextUtils.CAP_MODE_OFF; return mIC.getCursorCapsMode(inputType); } public CharSequence getTextBeforeCursor(final int i, final int j) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead if (null != mIC) return mIC.getTextBeforeCursor(i, j); return null; } public CharSequence getTextAfterCursor(final int i, final int j) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead if (null != mIC) return mIC.getTextAfterCursor(i, j); return null; } public void deleteSurroundingText(final int i, final int j) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead + checkBatchEdit(); if (null != mIC) mIC.deleteSurroundingText(i, j); } public void performEditorAction(final int actionId) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead if (null != mIC) mIC.performEditorAction(actionId); } public void sendKeyEvent(final KeyEvent keyEvent) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead + checkBatchEdit(); if (null != mIC) mIC.sendKeyEvent(keyEvent); } public void setComposingText(final CharSequence text, final int i) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead + checkBatchEdit(); if (null != mIC) mIC.setComposingText(text, i); } public void setSelection(final int from, final int to) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead + checkBatchEdit(); if (null != mIC) mIC.setSelection(from, to); } public void commitCorrection(final CorrectionInfo correctionInfo) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead + checkBatchEdit(); if (null != mIC) mIC.commitCorrection(correctionInfo); } public void commitCompletion(final CompletionInfo completionInfo) { - if (mNestLevel <= 0) Log.e(TAG, "Batch edit not in progress!"); // TODO: exception instead + checkBatchEdit(); if (null != mIC) mIC.commitCompletion(completionInfo); } @@ -316,6 +320,7 @@ public class RichInputConnection { } public void removeTrailingSpace() { + checkBatchEdit(); final CharSequence lastOne = getTextBeforeCursor(1, 0); if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_SPACE) { @@ -372,6 +377,7 @@ public class RichInputConnection { } public boolean revertDoubleSpace() { + checkBatchEdit(); // Here we test whether we indeed have a period and a space before us. This should not // be needed, but it's there just in case something went wrong. final CharSequence textBeforeCursor = getTextBeforeCursor(2, 0); @@ -395,6 +401,7 @@ public class RichInputConnection { } public boolean revertSwapPunctuation() { + checkBatchEdit(); // Here we test whether we indeed have a space and something else before us. This should not // be needed, but it's there just in case something went wrong. final CharSequence textBeforeCursor = getTextBeforeCursor(2, 0); diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index c9ff0a5a8..152d66851 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -149,10 +149,13 @@ public class Settings extends InputMethodSettingsFragment generalSettings.removePreference(mVoicePreference); } + final PreferenceGroup advancedSettings = + (PreferenceGroup) findPreference(PREF_ADVANCED_SETTINGS); + // Remove those meaningless options for now. TODO: delete them for good + advancedSettings.removePreference(findPreference(PREF_BIGRAM_SUGGESTION)); + advancedSettings.removePreference(findPreference(PREF_KEY_ENABLE_SPAN_INSERT)); if (!VibratorUtils.getInstance(context).hasVibrator()) { generalSettings.removePreference(findPreference(PREF_VIBRATE_ON)); - final PreferenceGroup advancedSettings = - (PreferenceGroup) findPreference(PREF_ADVANCED_SETTINGS); if (null != advancedSettings) { // Theoretically advancedSettings cannot be null advancedSettings.removePreference(findPreference(PREF_VIBRATION_DURATION_SETTINGS)); } diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java index 6a79aa611..f8a0a4df6 100644 --- a/java/src/com/android/inputmethod/latin/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/SettingsValues.java @@ -151,8 +151,8 @@ public class SettingsValues { && isBigramSuggestionEnabled(prefs, res, mAutoCorrectEnabled); mBigramPredictionEnabled = mBigramSuggestionEnabled && isBigramPredictionEnabled(prefs, res); - mEnableSuggestionSpanInsertion = - prefs.getBoolean(Settings.PREF_KEY_ENABLE_SPAN_INSERT, true); + // TODO: remove mEnableSuggestionSpanInsertion. It's always true. + mEnableSuggestionSpanInsertion = true; mVibrationDurationSettingsRawValue = prefs.getInt(Settings.PREF_VIBRATION_DURATION_SETTINGS, -1); mKeypressSoundVolumeRawValue = prefs.getFloat(Settings.PREF_KEYPRESS_SOUND_VOLUME, -1.0f); @@ -288,13 +288,8 @@ public class SettingsValues { private static boolean isBigramSuggestionEnabled(final SharedPreferences sp, final Resources resources, final boolean autoCorrectEnabled) { - final boolean showBigramSuggestionsOption = resources.getBoolean( - R.bool.config_enable_next_word_suggestions_option); - if (!showBigramSuggestionsOption) { - return autoCorrectEnabled; - } - return sp.getBoolean(Settings.PREF_BIGRAM_SUGGESTION, resources.getBoolean( - R.bool.config_default_next_word_suggestions)); + // TODO: remove this method. Bigram suggestion is always true. + return true; } private static boolean isBigramPredictionEnabled(final SharedPreferences sp, diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index 903b5a357..f2d21ab9b 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -204,18 +204,24 @@ public class Utils { } // Get the current stack trace - public static String getStackTrace() { + public static String getStackTrace(final int limit) { StringBuilder sb = new StringBuilder(); try { throw new RuntimeException(); } catch (RuntimeException e) { StackTraceElement[] frames = e.getStackTrace(); // Start at 1 because the first frame is here and we don't care about it - for (int j = 1; j < frames.length; ++j) sb.append(frames[j].toString() + "\n"); + for (int j = 1; j < frames.length && j < limit + 1; ++j) { + sb.append(frames[j].toString() + "\n"); + } } return sb.toString(); } + public static String getStackTrace() { + return getStackTrace(Integer.MAX_VALUE); + } + public static class UsabilityStudyLogUtils { // TODO: remove code duplication with ResearchLog class private static final String USABILITY_TAG = UsabilityStudyLogUtils.class.getSimpleName(); diff --git a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java index 8a29dcc13..19287e3f3 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java @@ -167,7 +167,7 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel { @Override public boolean dismissMoreKeysPanel() { - if (mIsDismissing) return false; + if (mIsDismissing || mController == null) return false; mIsDismissing = true; final boolean dismissed = mController.dismissMoreKeysPanel(); mIsDismissing = false; diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java index 3d593aaa7..e86390b11 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java @@ -670,7 +670,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener, } public void setSuggestions(SuggestedWords suggestedWords) { - if (suggestedWords == null || suggestedWords.size() == 0) + if (suggestedWords == null) return; clear(); @@ -884,5 +884,6 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener, super.onDetachedFromWindow(); mHandler.cancelAllMessages(); hidePreview(); + dismissMoreSuggestions(); } } |