Merge "Support fixed order more keys"
commit
fed72d6038
|
@ -18,27 +18,25 @@
|
||||||
*/
|
*/
|
||||||
-->
|
-->
|
||||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
<!-- U+060C: "،" ARABIC COMMA
|
<!-- U+061F: "؟" ARABIC QUESTION MARK
|
||||||
U+061B: "؛" ARABIC SEMICOLON
|
U+060C: "،" ARABIC COMMA
|
||||||
U+061F: "؟" ARABIC QUESTION MARK -->
|
U+061B: "؛" ARABIC SEMICOLON -->
|
||||||
<!-- U+0650: "ِ" ARABIC KASRA
|
<!-- U+0650: "ِ" ARABIC KASRA
|
||||||
U+064E: "َ" ARABIC FATHA
|
U+064E: "َ" ARABIC FATHA
|
||||||
U+064B: "ً" ARABIC FATHATAN
|
|
||||||
U+0640: "ـ" ARABIC TATWEEL
|
|
||||||
U+064D: "ٍ" ARABIC KASRATAN
|
U+064D: "ٍ" ARABIC KASRATAN
|
||||||
U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF
|
U+064B: "ً" ARABIC FATHATAN
|
||||||
U+0656: "ٖ" ARABIC SUBSCRIPT ALEF
|
U+0656: "ٖ" ARABIC SUBSCRIPT ALEF
|
||||||
U+0654: "ٔ" ARABIC HAMZA ABOVE
|
U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF
|
||||||
U+0655: "ٕ" ARABIC HAMZA BELOW -->
|
U+0655: "ٕ" ARABIC HAMZA BELOW
|
||||||
<!-- U+0651: "ّ" ARABIC SHADDA
|
U+0654: "ٔ" ARABIC HAMZA ABOVE -->
|
||||||
U+0652: "ْ" ARABIC SUKUN
|
<!-- U+064F: "ُ" ARABIC DAMMA
|
||||||
U+064C: "ٌ" ARABIC DAMMATAN
|
U+064C: "ٌ" ARABIC DAMMATAN
|
||||||
|
U+0651: "ّ" ARABIC SHADDA
|
||||||
|
U+0652: "ْ" ARABIC SUKUN
|
||||||
U+0653: "ٓ" ARABIC MADDAH ABOVE
|
U+0653: "ٓ" ARABIC MADDAH ABOVE
|
||||||
U+064F: "ُ" ARABIC DAMMA -->
|
U+0640: "ـ" ARABIC TATWEEL -->
|
||||||
<!-- In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label. -->
|
<!-- In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label. -->
|
||||||
<!-- TODO: Will introduce "grouping marks" to the more characters specification. -->
|
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',-,:,!,؟,،,؛,ِ,َ,ٍ,ً,ٖ,ٰ,ٕ,ٔ,ُ,ٌ,ّ,ْ,ٓ,ـــ|ـ,/"</string>
|
||||||
<string name="more_keys_for_punctuation">"،,؛,؟,!,:,-,/,\',\",ـــ|ـ,َ,ِ,ً,ٍ,ٰ,ٖ,ٕ,ٔ,ٓ,ْ,ّ,ٌ,ُ"</string>
|
|
||||||
<integer name="more_keys_keyboard_column_for_punctuation">9</integer>
|
|
||||||
<string name="keyhintlabel_for_punctuation">ً</string>
|
<string name="keyhintlabel_for_punctuation">ً</string>
|
||||||
<!-- U+0661: "١" ARABIC-INDIC DIGIT ONE -->
|
<!-- U+0661: "١" ARABIC-INDIC DIGIT ONE -->
|
||||||
<string name="keylabel_for_symbols_1">١</string>
|
<string name="keylabel_for_symbols_1">١</string>
|
||||||
|
@ -79,7 +77,8 @@
|
||||||
<!-- U+066A: "٪" ARABIC PERCENT SIGN -->
|
<!-- U+066A: "٪" ARABIC PERCENT SIGN -->
|
||||||
<string name="keylabel_for_symbols_percent">٪</string>
|
<string name="keylabel_for_symbols_percent">٪</string>
|
||||||
<string name="more_keys_for_comma">,</string>
|
<string name="more_keys_for_comma">,</string>
|
||||||
<string name="more_keys_for_f1">,</string>
|
<!-- U+060C: "،" ARABIC COMMA -->
|
||||||
|
<string name="more_keys_for_f1">،</string>
|
||||||
<string name="more_keys_for_f1_settings">\\,,\@icon/settingsKey|\@integer/key_settings</string>
|
<string name="more_keys_for_f1_settings">\\,,\@icon/settingsKey|\@integer/key_settings</string>
|
||||||
<string name="more_keys_for_f1_navigate">\\,,\@icon/tabKey|\@integer/key_tab</string>
|
<string name="more_keys_for_f1_navigate">\\,,\@icon/tabKey|\@integer/key_tab</string>
|
||||||
<string name="more_keys_for_symbols_question">\?</string>
|
<string name="more_keys_for_symbols_question">\?</string>
|
||||||
|
@ -125,8 +124,8 @@
|
||||||
U+FD3F: "﴿" ORNATE RIGHT PARENTHESIS -->
|
U+FD3F: "﴿" ORNATE RIGHT PARENTHESIS -->
|
||||||
<!-- TODO: DroidSansArabic lacks the glyph of U+FD3E ORNATE LEFT PARENTHESIS -->
|
<!-- TODO: DroidSansArabic lacks the glyph of U+FD3E ORNATE LEFT PARENTHESIS -->
|
||||||
<!-- TODO: DroidSansArabic lacks the glyph of U+FD3F ORNATE RIGHT PARENTHESIS -->
|
<!-- TODO: DroidSansArabic lacks the glyph of U+FD3F ORNATE RIGHT PARENTHESIS -->
|
||||||
<string name="more_keys_for_left_parenthesis">[|],{|},<|>,﴾|﴿</string>
|
<string name="more_keys_for_left_parenthesis">!fixedColumnOrder!4,﴾|﴿,<|>,{|},[|]</string>
|
||||||
<string name="more_keys_for_right_parenthesis">]|[,}|{,>|<,﴿|﴾</string>
|
<string name="more_keys_for_right_parenthesis">!fixedColumnOrder!4,﴿|﴾,>|<,}|{,]|[</string>
|
||||||
<!-- U+003E: ">" GREATER-THAN SIGN -->
|
<!-- U+003E: ">" GREATER-THAN SIGN -->
|
||||||
<integer name="keycode_for_less_than">0x003E</integer>
|
<integer name="keycode_for_less_than">0x003E</integer>
|
||||||
<!-- U+003C: "<" LESS-THAN SIGN -->
|
<!-- U+003C: "<" LESS-THAN SIGN -->
|
||||||
|
@ -146,8 +145,8 @@
|
||||||
U+201D: "”" RIGHT DOUBLE QUOTATION MARK
|
U+201D: "”" RIGHT DOUBLE QUOTATION MARK
|
||||||
U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
|
U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
|
||||||
U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
||||||
<string name="more_keys_for_less_than">≤|≥,«|»,‹|›</string>
|
<string name="more_keys_for_less_than">!fixedColumnOrder!3,‹|›,≤|≥,«|»</string>
|
||||||
<string name="more_keys_for_greater_than">≥|≤,»|«,›|‹</string>
|
<string name="more_keys_for_greater_than">!fixedColumnOrder!3,›|‹,≥|≤,»|«</string>
|
||||||
<!-- U+005D: "]" RIGHT SQUARE BRACKET -->
|
<!-- U+005D: "]" RIGHT SQUARE BRACKET -->
|
||||||
<integer name="keycode_for_left_square_bracket">0x005D</integer>
|
<integer name="keycode_for_left_square_bracket">0x005D</integer>
|
||||||
<!-- U+005B: "[" LEFT SQUARE BRACKET -->
|
<!-- U+005B: "[" LEFT SQUARE BRACKET -->
|
||||||
|
@ -157,11 +156,9 @@
|
||||||
<!-- U+007B: "{" LEFT CURLY BRACKET -->
|
<!-- U+007B: "{" LEFT CURLY BRACKET -->
|
||||||
<integer name="keycode_for_right_curly_bracket">0x007B</integer>
|
<integer name="keycode_for_right_curly_bracket">0x007B</integer>
|
||||||
<!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
<!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
||||||
<!-- <string name="more_keys_for_double_quote">“,”,„,‟,«,»</string> -->
|
<!-- <string name="more_keys_for_double_quote">“,”,„,‟,«|»,»|«</string> -->
|
||||||
<!-- The 4-more keys will be displayed in order of "3,1,2,4". -->
|
<string name="more_keys_for_double_quote">!fixedColumnOrder!4,“,”,«|»,»|«</string>
|
||||||
<string name="more_keys_for_double_quote">”,«|»,“,»|«</string>
|
|
||||||
<!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
<!-- 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">“,”,„,‟,«,»,‘,’,‚,‛</string> -->
|
<!-- <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!6,“,”,„,‟,«|»,»|«;,‘,’,‚,‛</string> -->
|
||||||
<!-- The 8-more keys with maxMoreKeysColumn=4 will be displayed in order of "3,1,2,4|7,5,6,8". -->
|
<string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!4,“,”,«|»,»|«,‘,’,‚,‛</string>
|
||||||
<string name="more_keys_for_tablet_double_quote">”,«|»,“,»|«,’,‚,‘,‛</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
|
U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
|
||||||
U+010D: "č" LATIN SMALL LETTER C WITH CARON -->
|
U+010D: "č" LATIN SMALL LETTER C WITH CARON -->
|
||||||
<string name="more_keys_for_c">ç,ć,č</string>
|
<string name="more_keys_for_c">ç,ć,č</string>
|
||||||
<!-- U+00BF: "¿" INVERTED QUESTION MARK
|
<!-- U+00A1: "¡" INVERTED EXCLAMATION MARK
|
||||||
U+00A1: "¡" INVERTED EXCLAMATION MARK -->
|
U+00BF: "¿" INVERTED QUESTION MARK -->
|
||||||
<string name="more_keys_for_punctuation">"\\,,\?,!,¿,¡,:,-,\',\",),(,/,;,+,&,\@"</string>
|
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',-,¡,!,¿,\\,,\?,\@,&,+,;,:,/,(,)"</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
<integer name="keycode_for_left_parenthesis">0x0029</integer>
|
<integer name="keycode_for_left_parenthesis">0x0029</integer>
|
||||||
<!-- U+0028: "(" LEFT PARENTHESIS -->
|
<!-- U+0028: "(" LEFT PARENTHESIS -->
|
||||||
<integer name="keycode_for_right_parenthesis">0x0028</integer>
|
<integer name="keycode_for_right_parenthesis">0x0028</integer>
|
||||||
<string name="more_keys_for_left_parenthesis">[|],{|},<|></string>
|
<string name="more_keys_for_left_parenthesis">!fixedColumnOrder!3,<|>,{|},[|]</string>
|
||||||
<string name="more_keys_for_right_parenthesis">]|[,}|{,>|<</string>
|
<string name="more_keys_for_right_parenthesis">!fixedColumnOrder!3,>|<,}|{,]|[</string>
|
||||||
<!-- U+003E: ">" GREATER-THAN SIGN -->
|
<!-- U+003E: ">" GREATER-THAN SIGN -->
|
||||||
<integer name="keycode_for_less_than">0x003E</integer>
|
<integer name="keycode_for_less_than">0x003E</integer>
|
||||||
<!-- U+003C: "<" LESS-THAN SIGN -->
|
<!-- U+003C: "<" LESS-THAN SIGN -->
|
||||||
|
@ -50,8 +50,8 @@
|
||||||
U+201D: "”" RIGHT DOUBLE QUOTATION MARK
|
U+201D: "”" RIGHT DOUBLE QUOTATION MARK
|
||||||
U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
|
U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
|
||||||
U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
||||||
<string name="more_keys_for_less_than">≤|≥,«|»,‹|›</string>
|
<string name="more_keys_for_less_than">!fixedColumnOrder!3,‹|›,≤|≥,«|»</string>
|
||||||
<string name="more_keys_for_greater_than">≥|≤,»|«,›|‹</string>
|
<string name="more_keys_for_greater_than">!fixedColumnOrder!3,›|‹,≥|≤,»|«</string>
|
||||||
<!-- U+005D: "]" RIGHT SQUARE BRACKET -->
|
<!-- U+005D: "]" RIGHT SQUARE BRACKET -->
|
||||||
<integer name="keycode_for_left_square_bracket">0x005D</integer>
|
<integer name="keycode_for_left_square_bracket">0x005D</integer>
|
||||||
<!-- U+005B: "[" LEFT SQUARE BRACKET -->
|
<!-- U+005B: "[" LEFT SQUARE BRACKET -->
|
||||||
|
@ -60,12 +60,10 @@
|
||||||
<integer name="keycode_for_left_curly_bracket">0x007D</integer>
|
<integer name="keycode_for_left_curly_bracket">0x007D</integer>
|
||||||
<!-- U+007B: "{" LEFT CURLY BRACKET -->
|
<!-- U+007B: "{" LEFT CURLY BRACKET -->
|
||||||
<integer name="keycode_for_right_curly_bracket">0x007B</integer>
|
<integer name="keycode_for_right_curly_bracket">0x007B</integer>
|
||||||
<!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK. -->
|
<!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
||||||
<!-- <string name="more_keys_for_double_quote">“,”,„,‟,«,»</string> -->
|
<!-- <string name="more_keys_for_double_quote">“,”,„,‟,«|»,»|«</string> -->
|
||||||
<!-- The 4-more keys will be displayed in order of "3,1,2,4". -->
|
<string name="more_keys_for_double_quote">!fixedColumnOrder!4,“,”,«|»,»|«</string>
|
||||||
<string name="more_keys_for_double_quote">”,«|»,“,»|«</string>
|
<!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
||||||
<!-- 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,“,”,„,‟,«|»,»|«;,‘,’,‚,‛</string> -->
|
||||||
<!-- <string name="more_keys_for_tablet_double_quote">“,”,„,‟,«,»,‘,’,‚,‛</string> -->
|
<string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!4,“,”,«|»,»|«,‘,’,‚,‛</string>
|
||||||
<!-- The 8-more keys with maxMoreKeysColumn=4 will be displayed in order of "3,1,2,4|7,5,6,8". -->
|
|
||||||
<string name="more_keys_for_tablet_double_quote">”,«|»,“,»|«,’,‚,‘,‛</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -64,9 +64,8 @@
|
||||||
<string name="more_keys_for_currency_euro">¢,£,$,¥,₱</string>
|
<string name="more_keys_for_currency_euro">¢,£,$,¥,₱</string>
|
||||||
<string name="more_keys_for_currency_pound">¢,$,€,¥,₱</string>
|
<string name="more_keys_for_currency_pound">¢,$,€,¥,₱</string>
|
||||||
<string name="more_keys_for_currency_general">¢,$,€,£,¥,₱</string>
|
<string name="more_keys_for_currency_general">¢,$,€,£,¥,₱</string>
|
||||||
<string name="more_keys_for_smiley">":-)|:-) ,:-(|:-( ,;-)|;-) ,:-P|:-P ,=-O|=-O ,:-*|:-* ,:O|:O ,B-)|B-) ,:-$|:-$ ,:-!|:-! ,:-[|:-[ ,O:-)|O:-) ,:-\\\\|:-\\\\ ,:\'(|:\'( ,:-D|:-D "</string>
|
<string name="more_keys_for_smiley">"!fixedColumnOrder!5,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ "</string>
|
||||||
<string name="more_keys_for_punctuation">"\\,,\?,!,:,-,\',\",(,),/,;,+,&,\@"</string>
|
<string name="more_keys_for_punctuation">"!fixedColumnOrder!7,\",\',-,:,!,\\,,\?,\@,&,+,;,/,(,)"</string>
|
||||||
<integer name="more_keys_keyboard_column_for_punctuation">7</integer>
|
|
||||||
<string name="keyhintlabel_for_punctuation"></string>
|
<string name="keyhintlabel_for_punctuation"></string>
|
||||||
<string name="keylabel_for_popular_domain">".com"</string>
|
<string name="keylabel_for_popular_domain">".com"</string>
|
||||||
<!-- popular web domains for the locale - most popular, displayed on the keyboard -->
|
<!-- popular web domains for the locale - most popular, displayed on the keyboard -->
|
||||||
|
@ -154,18 +153,18 @@
|
||||||
<integer name="keycode_for_left_parenthesis">0x0028</integer>
|
<integer name="keycode_for_left_parenthesis">0x0028</integer>
|
||||||
<!-- U+0029: ")" RIGHT PARENTHESIS -->
|
<!-- U+0029: ")" RIGHT PARENTHESIS -->
|
||||||
<integer name="keycode_for_right_parenthesis">0x0029</integer>
|
<integer name="keycode_for_right_parenthesis">0x0029</integer>
|
||||||
<string name="more_keys_for_left_parenthesis">[,{,<</string>
|
<string name="more_keys_for_left_parenthesis">!fixedColumnOrder!3,<,{,[</string>
|
||||||
<string name="more_keys_for_right_parenthesis">],},></string>
|
<string name="more_keys_for_right_parenthesis">!fixedColumnOrder!3,>,},]</string>
|
||||||
<!-- U+003C: "<" LESS-THAN SIGN -->
|
<!-- U+003C: "<" LESS-THAN SIGN -->
|
||||||
<integer name="keycode_for_less_than">0x003C</integer>
|
<integer name="keycode_for_less_than">0x003C</integer>
|
||||||
<!-- U+003E: ">" GREATER-THAN SIGN -->
|
<!-- U+003E: ">" GREATER-THAN SIGN -->
|
||||||
<integer name="keycode_for_greater_than">0x003E</integer>
|
<integer name="keycode_for_greater_than">0x003E</integer>
|
||||||
<!-- U+2264: "≤" LESS-THAN OR EQUAL TO
|
<!-- U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||||
|
U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||||
|
U+2264: "≤" LESS-THAN OR EQUAL TO
|
||||||
U+2265: "≥" GREATER-THAN EQUAL TO
|
U+2265: "≥" GREATER-THAN EQUAL TO
|
||||||
U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||||
U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
||||||
U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
|
||||||
U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
|
||||||
The following characters don't need BIDI mirroring.
|
The following characters don't need BIDI mirroring.
|
||||||
U+2018: "‘" LEFT SINGLE QUOTATION MARK
|
U+2018: "‘" LEFT SINGLE QUOTATION MARK
|
||||||
U+2019: "’" RIGHT SINGLE QUOTATION MARK
|
U+2019: "’" RIGHT SINGLE QUOTATION MARK
|
||||||
|
@ -175,8 +174,8 @@
|
||||||
U+201D: "”" RIGHT DOUBLE QUOTATION MARK
|
U+201D: "”" RIGHT DOUBLE QUOTATION MARK
|
||||||
U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
|
U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
|
||||||
U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
|
||||||
<string name="more_keys_for_less_than">≤,«,‹</string>
|
<string name="more_keys_for_less_than">!fixedColumnOrder!3,‹,≤,«</string>
|
||||||
<string name="more_keys_for_greater_than">≥,»,›</string>
|
<string name="more_keys_for_greater_than">!fixedColumnOrder!3,›,≥,»</string>
|
||||||
<!-- U+005B: "[" LEFT SQUARE BRACKET -->
|
<!-- U+005B: "[" LEFT SQUARE BRACKET -->
|
||||||
<integer name="keycode_for_left_square_bracket">0x005B</integer>
|
<integer name="keycode_for_left_square_bracket">0x005B</integer>
|
||||||
<!-- U+005D: "]" RIGHT SQUARE BRACKET -->
|
<!-- U+005D: "]" RIGHT SQUARE BRACKET -->
|
||||||
|
@ -185,14 +184,11 @@
|
||||||
<integer name="keycode_for_left_curly_bracket">0x007B</integer>
|
<integer name="keycode_for_left_curly_bracket">0x007B</integer>
|
||||||
<!-- U+007D: "}" RIGHT CURLY BRACKET -->
|
<!-- U+007D: "}" RIGHT CURLY BRACKET -->
|
||||||
<integer name="keycode_for_right_curly_bracket">0x007D</integer>
|
<integer name="keycode_for_right_curly_bracket">0x007D</integer>
|
||||||
<!-- The 4-more keys will be displayed in order of "3,1,2,4". -->
|
<string name="more_keys_for_single_quote">!fixedColumnOrder!4,‘,’,‚,‛</string>
|
||||||
<string name="more_keys_for_single_quote">’,‚,‘,‛</string>
|
|
||||||
<!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK. -->
|
<!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK. -->
|
||||||
<!-- <string name="more_keys_for_double_quote">“,”,„,‟,«,»</string> -->
|
<!-- <string name="more_keys_for_double_quote">!fixedColumnOrder!6,“,”,„,‟,«,»</string> -->
|
||||||
<!-- The 4-more keys will be displayed in order of "3,1,2,4". -->
|
<string name="more_keys_for_double_quote">!fixedColumnOrder!4,“,”,«,»</string>
|
||||||
<string name="more_keys_for_double_quote">”,«,“,»</string>
|
|
||||||
<!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK. -->
|
<!-- 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">“,”,„,‟,«,»,‘,’,‚,‛</string> -->
|
<!-- <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!6,“,”,„,‟,«,»,‘,’,‚,‛</string> -->
|
||||||
<!-- The 8-more keys with maxMoreKeysColumn=4 will be displayed in order of "3,1,2,4|7,5,6,8". -->
|
<string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!4,“,”,«,»,‘,’,‚,‛</string>
|
||||||
<string name="more_keys_for_tablet_double_quote">”,«,“,»,’,‚,‘,‛</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -104,8 +104,7 @@
|
||||||
latin:keyLabel=":-)"
|
latin:keyLabel=":-)"
|
||||||
latin:keyOutputText=":-) "
|
latin:keyOutputText=":-) "
|
||||||
latin:keyLabelFlags="hasPopupHint|preserveCase"
|
latin:keyLabelFlags="hasPopupHint|preserveCase"
|
||||||
latin:moreKeys="@string/more_keys_for_smiley"
|
latin:moreKeys="@string/more_keys_for_smiley" />
|
||||||
latin:maxMoreKeysColumn="5" />
|
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="shortcutKeyStyle"
|
latin:styleName="shortcutKeyStyle"
|
||||||
latin:code="@integer/key_shortcut"
|
latin:code="@integer/key_shortcut"
|
||||||
|
|
|
@ -160,8 +160,7 @@
|
||||||
latin:keyWidth="39.750%p" />
|
latin:keyWidth="39.750%p" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="""
|
latin:keyLabel="""
|
||||||
latin:moreKeys="@string/more_keys_for_tablet_double_quote"
|
latin:moreKeys="@string/more_keys_for_tablet_double_quote" />
|
||||||
latin:maxMoreKeysColumn="4" />
|
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="_" />
|
latin:keyLabel="_" />
|
||||||
<Spacer
|
<Spacer
|
||||||
|
|
|
@ -86,8 +86,7 @@
|
||||||
latin:keyLabel=":-)"
|
latin:keyLabel=":-)"
|
||||||
latin:keyOutputText=":-) "
|
latin:keyOutputText=":-) "
|
||||||
latin:keyLabelFlags="hasPopupHint|preserveCase"
|
latin:keyLabelFlags="hasPopupHint|preserveCase"
|
||||||
latin:moreKeys="@string/more_keys_for_smiley"
|
latin:moreKeys="@string/more_keys_for_smiley" />
|
||||||
latin:maxMoreKeysColumn="5" />
|
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="shortcutKeyStyle"
|
latin:styleName="shortcutKeyStyle"
|
||||||
latin:code="@integer/key_shortcut"
|
latin:code="@integer/key_shortcut"
|
||||||
|
|
|
@ -175,8 +175,7 @@
|
||||||
latin:keyWidth="37.500%p" />
|
latin:keyWidth="37.500%p" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="""
|
latin:keyLabel="""
|
||||||
latin:moreKeys="@string/more_keys_for_tablet_double_quote"
|
latin:moreKeys="@string/more_keys_for_tablet_double_quote" />
|
||||||
latin:maxMoreKeysColumn="4" />
|
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="_" />
|
latin:keyLabel="_" />
|
||||||
<switch>
|
<switch>
|
||||||
|
|
|
@ -188,6 +188,5 @@
|
||||||
latin:keyHintLabel="@string/keyhintlabel_for_punctuation"
|
latin:keyHintLabel="@string/keyhintlabel_for_punctuation"
|
||||||
latin:keyLabelFlags="hasPopupHint|preserveCase"
|
latin:keyLabelFlags="hasPopupHint|preserveCase"
|
||||||
latin:moreKeys="@string/more_keys_for_punctuation"
|
latin:moreKeys="@string/more_keys_for_punctuation"
|
||||||
latin:maxMoreKeysColumn="@integer/more_keys_keyboard_column_for_punctuation"
|
|
||||||
latin:backgroundType="functional" />
|
latin:backgroundType="functional" />
|
||||||
</merge>
|
</merge>
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
latin:keyOutputText=":-) "
|
latin:keyOutputText=":-) "
|
||||||
latin:keyLabelFlags="hasPopupHint"
|
latin:keyLabelFlags="hasPopupHint"
|
||||||
latin:moreKeys="@string/more_keys_for_smiley"
|
latin:moreKeys="@string/more_keys_for_smiley"
|
||||||
latin:maxMoreKeysColumn="5"
|
|
||||||
latin:backgroundType="functional" />
|
latin:backgroundType="functional" />
|
||||||
</case>
|
</case>
|
||||||
<case
|
<case
|
||||||
|
|
|
@ -130,13 +130,9 @@
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="n"
|
latin:keyLabel="n"
|
||||||
latin:moreKeys="@string/more_keys_for_n" />
|
latin:moreKeys="@string/more_keys_for_n" />
|
||||||
<!-- TODO: Introduce a flag, such as strinctMoreKeysOrder, to control moreKeys display
|
|
||||||
order more precisely. -->
|
|
||||||
<!-- This key is close enough to right edge, so that the 4-more keys will be displayed in
|
|
||||||
order of "4,3,1,2". See @string/more_keys_for_single_quote -->
|
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="\'"
|
latin:keyLabel="\'"
|
||||||
latin:moreKeys="‘,’,‛,‚" />
|
latin:moreKeys="@string/more_keys_for_single_quote" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="deleteKeyStyle"
|
latin:keyStyle="deleteKeyStyle"
|
||||||
latin:keyWidth="fillRight"
|
latin:keyWidth="fillRight"
|
||||||
|
|
|
@ -109,8 +109,7 @@
|
||||||
latin:moreKeys="¡" />
|
latin:moreKeys="¡" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="""
|
latin:keyLabel="""
|
||||||
latin:moreKeys="@string/more_keys_for_double_quote"
|
latin:moreKeys="@string/more_keys_for_double_quote" />
|
||||||
latin:maxMoreKeysColumn="4" />
|
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="\'"
|
latin:keyLabel="\'"
|
||||||
latin:moreKeys="@string/more_keys_for_single_quote" />
|
latin:moreKeys="@string/more_keys_for_single_quote" />
|
||||||
|
|
|
@ -105,6 +105,9 @@ public class Key {
|
||||||
public final String[] mMoreKeys;
|
public final String[] mMoreKeys;
|
||||||
/** More keys maximum column number */
|
/** More keys maximum column number */
|
||||||
public final int mMaxMoreKeysColumn;
|
public final int mMaxMoreKeysColumn;
|
||||||
|
public static final int MORE_KEYS_FIXED_COLUMN_ORDER = 0x80000000;
|
||||||
|
private static final String AUTO_COLUMN_ORDER = "!autoColumnOrder!";
|
||||||
|
private static final String FIXED_COLUMN_ORDER = "!fixedColumnOrder!";
|
||||||
|
|
||||||
/** Background type that represents different key background visual than normal one. */
|
/** Background type that represents different key background visual than normal one. */
|
||||||
public final int mBackgroundType;
|
public final int mBackgroundType;
|
||||||
|
@ -232,10 +235,19 @@ public class Key {
|
||||||
mLabelFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags);
|
mLabelFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags);
|
||||||
final boolean preserveCase = (mLabelFlags & LABEL_FLAGS_PRESERVE_CASE) != 0;
|
final boolean preserveCase = (mLabelFlags & LABEL_FLAGS_PRESERVE_CASE) != 0;
|
||||||
int actionFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyActionFlags);
|
int actionFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyActionFlags);
|
||||||
|
String[] moreKeys = style.getStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys);
|
||||||
|
int column;
|
||||||
|
if ((column = parseMoreKeysColumnOrder(moreKeys, AUTO_COLUMN_ORDER)) > 0) {
|
||||||
|
mMaxMoreKeysColumn = column;
|
||||||
|
} else if ((column = parseMoreKeysColumnOrder(moreKeys, FIXED_COLUMN_ORDER)) > 0) {
|
||||||
|
mMaxMoreKeysColumn = column | MORE_KEYS_FIXED_COLUMN_ORDER;
|
||||||
|
} else {
|
||||||
|
mMaxMoreKeysColumn = style.getInt(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_maxMoreKeysColumn, params.mMaxMoreKeysKeyboardColumn);
|
||||||
|
}
|
||||||
final String[] additionalMoreKeys = style.getStringArray(
|
final String[] additionalMoreKeys = style.getStringArray(
|
||||||
keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
|
keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
|
||||||
final String[] moreKeys = KeySpecParser.insertAddtionalMoreKeys(style.getStringArray(
|
moreKeys = KeySpecParser.insertAddtionalMoreKeys(moreKeys, additionalMoreKeys);
|
||||||
keyAttr, R.styleable.Keyboard_Key_moreKeys), additionalMoreKeys);
|
|
||||||
if (moreKeys != null) {
|
if (moreKeys != null) {
|
||||||
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
|
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
|
||||||
for (int i = 0; i < moreKeys.length; i++) {
|
for (int i = 0; i < moreKeys.length; i++) {
|
||||||
|
@ -245,8 +257,6 @@ public class Key {
|
||||||
}
|
}
|
||||||
mActionFlags = actionFlags;
|
mActionFlags = actionFlags;
|
||||||
mMoreKeys = moreKeys;
|
mMoreKeys = moreKeys;
|
||||||
mMaxMoreKeysColumn = style.getInt(keyAttr,
|
|
||||||
R.styleable.Keyboard_Key_maxMoreKeysColumn, params.mMaxMoreKeysKeyboardColumn);
|
|
||||||
|
|
||||||
if ((mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0) {
|
if ((mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0) {
|
||||||
mLabel = params.mId.mCustomActionLabel;
|
mLabel = params.mId.mCustomActionLabel;
|
||||||
|
@ -301,6 +311,21 @@ public class Key {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int parseMoreKeysColumnOrder(String[] moreKeys, String key) {
|
||||||
|
if (moreKeys == null || moreKeys.length == 0 || moreKeys[0] == null
|
||||||
|
|| !moreKeys[0].startsWith(key)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
final int column = Integer.parseInt(moreKeys[0].substring(key.length()));
|
||||||
|
moreKeys[0] = null;
|
||||||
|
return column;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Log.w(TAG, "column number should follow after " + key);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static int adjustCaseOfCodeForKeyboardId(int code, boolean preserveCase,
|
private static int adjustCaseOfCodeForKeyboardId(int code, boolean preserveCase,
|
||||||
KeyboardId id) {
|
KeyboardId id) {
|
||||||
if (!Keyboard.isLetterCode(code) || preserveCase) return code;
|
if (!Keyboard.isLetterCode(code) || preserveCase) return code;
|
||||||
|
|
|
@ -37,9 +37,11 @@ public class MoreKeysKeyboard extends Keyboard {
|
||||||
private final String[] mMoreKeys;
|
private final String[] mMoreKeys;
|
||||||
|
|
||||||
public static class MoreKeysKeyboardParams extends Keyboard.Params {
|
public static class MoreKeysKeyboardParams extends Keyboard.Params {
|
||||||
|
public boolean mIsFixedOrder;
|
||||||
/* package */int mTopRowAdjustment;
|
/* package */int mTopRowAdjustment;
|
||||||
public int mNumRows;
|
public int mNumRows;
|
||||||
public int mNumColumns;
|
public int mNumColumns;
|
||||||
|
public int mTopKeys;
|
||||||
public int mLeftKeys;
|
public int mLeftKeys;
|
||||||
public int mRightKeys; // includes default key.
|
public int mRightKeys; // includes default key.
|
||||||
|
|
||||||
|
@ -58,14 +60,17 @@ public class MoreKeysKeyboard extends Keyboard {
|
||||||
* Set keyboard parameters of more keys keyboard.
|
* Set keyboard parameters of more keys keyboard.
|
||||||
*
|
*
|
||||||
* @param numKeys number of keys in this more keys keyboard.
|
* @param numKeys number of keys in this more keys keyboard.
|
||||||
* @param maxColumns number of maximum columns of this more keys keyboard.
|
* @param maxColumnsAndFlags number of maximum columns of this more keys keyboard.
|
||||||
|
* This might have {@link Key#MORE_KEYS_FIXED_COLUMN_ORDER} flag.
|
||||||
* @param keyWidth more keys keyboard key width in pixel, including horizontal gap.
|
* @param keyWidth more keys keyboard key width in pixel, including horizontal gap.
|
||||||
* @param rowHeight more keys keyboard row height in pixel, including vertical gap.
|
* @param rowHeight more keys keyboard row height in pixel, including vertical gap.
|
||||||
* @param coordXInParent coordinate x of the key preview in parent keyboard.
|
* @param coordXInParent coordinate x of the key preview in parent keyboard.
|
||||||
* @param parentKeyboardWidth parent keyboard width in pixel.
|
* @param parentKeyboardWidth parent keyboard width in pixel.
|
||||||
*/
|
*/
|
||||||
public void setParameters(int numKeys, int maxColumns, int keyWidth, int rowHeight,
|
public void setParameters(int numKeys, int maxColumnsAndFlags, int keyWidth,
|
||||||
int coordXInParent, int parentKeyboardWidth) {
|
int rowHeight, int coordXInParent, int parentKeyboardWidth) {
|
||||||
|
mIsFixedOrder = (maxColumnsAndFlags & Key.MORE_KEYS_FIXED_COLUMN_ORDER) != 0;
|
||||||
|
final int maxColumns = maxColumnsAndFlags & ~Key.MORE_KEYS_FIXED_COLUMN_ORDER;
|
||||||
if (parentKeyboardWidth / keyWidth < maxColumns) {
|
if (parentKeyboardWidth / keyWidth < maxColumns) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Keyboard is too small to hold more keys keyboard: "
|
"Keyboard is too small to hold more keys keyboard: "
|
||||||
|
@ -76,8 +81,11 @@ public class MoreKeysKeyboard extends Keyboard {
|
||||||
|
|
||||||
final int numRows = (numKeys + maxColumns - 1) / maxColumns;
|
final int numRows = (numKeys + maxColumns - 1) / maxColumns;
|
||||||
mNumRows = numRows;
|
mNumRows = numRows;
|
||||||
final int numColumns = getOptimizedColumns(numKeys, maxColumns);
|
final int numColumns = mIsFixedOrder ? Math.min(numKeys, maxColumns)
|
||||||
|
: getOptimizedColumns(numKeys, maxColumns);
|
||||||
mNumColumns = numColumns;
|
mNumColumns = numColumns;
|
||||||
|
final int topKeys = numKeys % numColumns;
|
||||||
|
mTopKeys = topKeys == 0 ? numColumns : topKeys;
|
||||||
|
|
||||||
final int numLeftKeys = (numColumns - 1) / 2;
|
final int numLeftKeys = (numColumns - 1) / 2;
|
||||||
final int numRightKeys = numColumns - numLeftKeys; // including default key.
|
final int numRightKeys = numColumns - numLeftKeys; // including default key.
|
||||||
|
@ -110,28 +118,68 @@ public class MoreKeysKeyboard extends Keyboard {
|
||||||
mLeftKeys = leftKeys;
|
mLeftKeys = leftKeys;
|
||||||
mRightKeys = rightKeys;
|
mRightKeys = rightKeys;
|
||||||
|
|
||||||
// Centering of the top row.
|
// Adjustment of the top row.
|
||||||
if (numRows < 2 || getTopRowEmptySlots(numKeys, numColumns) % 2 == 0) {
|
mTopRowAdjustment = mIsFixedOrder ? getFixedOrderTopRowAdjustment()
|
||||||
mTopRowAdjustment = 0;
|
: getAutoOrderTopRowAdjustment();
|
||||||
} else if (mLeftKeys < mRightKeys - 1) {
|
|
||||||
mTopRowAdjustment = 1;
|
|
||||||
} else {
|
|
||||||
mTopRowAdjustment = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
mBaseWidth = mOccupiedWidth = mNumColumns * mDefaultKeyWidth;
|
mBaseWidth = mOccupiedWidth = mNumColumns * mDefaultKeyWidth;
|
||||||
// Need to subtract the bottom row's gutter only.
|
// Need to subtract the bottom row's gutter only.
|
||||||
mBaseHeight = mOccupiedHeight = mNumRows * mDefaultRowHeight - mVerticalGap
|
mBaseHeight = mOccupiedHeight = mNumRows * mDefaultRowHeight - mVerticalGap
|
||||||
+ mTopPadding + mBottomPadding;
|
+ mTopPadding + mBottomPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getFixedOrderTopRowAdjustment() {
|
||||||
|
if (mNumRows == 1 || mTopKeys % 2 == 1 || mTopKeys == mNumColumns
|
||||||
|
|| mLeftKeys == 0 || mRightKeys == 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getAutoOrderTopRowAdjustment() {
|
||||||
|
if (mNumRows == 1 || mTopKeys == 1 || mNumColumns % 2 == mTopKeys % 2
|
||||||
|
|| mLeftKeys == 0 || mRightKeys == 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Return key position according to column count (0 is default).
|
// Return key position according to column count (0 is default).
|
||||||
/* package */int getColumnPos(int n) {
|
/* package */int getColumnPos(int n) {
|
||||||
|
return mIsFixedOrder ? getFixedOrderColumnPos(n) : getAutomaticColumnPos(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getFixedOrderColumnPos(int n) {
|
||||||
final int col = n % mNumColumns;
|
final int col = n % mNumColumns;
|
||||||
|
final int row = n / mNumColumns;
|
||||||
|
if (!isTopRow(row)) {
|
||||||
|
return col - mLeftKeys;
|
||||||
|
}
|
||||||
|
final int rightSideKeys = mTopKeys / 2;
|
||||||
|
final int leftSideKeys = mTopKeys - (rightSideKeys + 1);
|
||||||
|
final int pos = col - leftSideKeys;
|
||||||
|
final int numLeftKeys = mLeftKeys + mTopRowAdjustment;
|
||||||
|
final int numRightKeys = mRightKeys - 1;
|
||||||
|
if (numRightKeys >= rightSideKeys && numLeftKeys >= leftSideKeys) {
|
||||||
|
return pos;
|
||||||
|
} else if (numRightKeys < rightSideKeys) {
|
||||||
|
return pos - (rightSideKeys - numRightKeys);
|
||||||
|
} else { // numLeftKeys < leftSideKeys
|
||||||
|
return pos + (leftSideKeys - numLeftKeys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getAutomaticColumnPos(int n) {
|
||||||
|
final int col = n % mNumColumns;
|
||||||
|
final int row = n / mNumColumns;
|
||||||
|
int leftKeys = mLeftKeys;
|
||||||
|
if (isTopRow(row)) {
|
||||||
|
leftKeys += mTopRowAdjustment;
|
||||||
|
}
|
||||||
if (col == 0) {
|
if (col == 0) {
|
||||||
// default position.
|
// default position.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
int right = 1; // include default position key.
|
int right = 1; // include default position key.
|
||||||
int left = 0;
|
int left = 0;
|
||||||
|
@ -146,7 +194,7 @@ public class MoreKeysKeyboard extends Keyboard {
|
||||||
if (i >= col)
|
if (i >= col)
|
||||||
break;
|
break;
|
||||||
// Assign left key if available.
|
// Assign left key if available.
|
||||||
if (left < mLeftKeys) {
|
if (left < leftKeys) {
|
||||||
left++;
|
left++;
|
||||||
pos = -left;
|
pos = -left;
|
||||||
i++;
|
i++;
|
||||||
|
@ -158,12 +206,8 @@ public class MoreKeysKeyboard extends Keyboard {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getTopRowEmptySlots(int numKeys, int numColumns) {
|
private static int getTopRowEmptySlots(int numKeys, int numColumns) {
|
||||||
final int remainingKeys = numKeys % numColumns;
|
final int remainings = numKeys % numColumns;
|
||||||
if (remainingKeys == 0) {
|
return remainings == 0 ? 0 : numColumns - remainings;
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return numColumns - remainingKeys;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getOptimizedColumns(int numKeys, int maxColumns) {
|
private int getOptimizedColumns(int numKeys, int maxColumns) {
|
||||||
|
@ -198,7 +242,7 @@ public class MoreKeysKeyboard extends Keyboard {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isTopRow(int rowCount) {
|
private boolean isTopRow(int rowCount) {
|
||||||
return rowCount == mNumRows - 1;
|
return mNumRows > 1 && rowCount == mNumRows - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,9 +206,51 @@ public class KeySpecParser {
|
||||||
return KeyboardIconsSet.ICON_UNDEFINED;
|
return KeyboardIconsSet.ICON_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] insertAddtionalMoreKeys(String[] moreKeys, String[] additionalMoreKeys) {
|
private static <T> ArrayList<T> arrayAsList(T[] array, int start, int end) {
|
||||||
final int moreKeysCount = (moreKeys != null) ? moreKeys.length : 0;
|
if (array == null) {
|
||||||
final int additionalCount = (additionalMoreKeys != null) ? additionalMoreKeys.length : 0;
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
if (start < 0 || start > end || end > array.length) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
|
||||||
|
final ArrayList<T> list = new ArrayList<T>(end - start);
|
||||||
|
for (int i = start; i < end; i++) {
|
||||||
|
list.add(array[i]);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||||
|
|
||||||
|
private static String[] filterOutEmptyString(String[] array) {
|
||||||
|
if (array == null) {
|
||||||
|
return EMPTY_STRING_ARRAY;
|
||||||
|
}
|
||||||
|
ArrayList<String> out = null;
|
||||||
|
for (int i = 0; i < array.length; i++) {
|
||||||
|
final String entry = array[i];
|
||||||
|
if (TextUtils.isEmpty(entry)) {
|
||||||
|
if (out == null) {
|
||||||
|
out = arrayAsList(array, 0, i);
|
||||||
|
}
|
||||||
|
} else if (out != null) {
|
||||||
|
out.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (out == null) {
|
||||||
|
return array;
|
||||||
|
} else {
|
||||||
|
return out.toArray(new String[out.size()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String[] insertAddtionalMoreKeys(String[] moreKeySpecs,
|
||||||
|
String[] additionalMoreKeySpecs) {
|
||||||
|
final String[] moreKeys = filterOutEmptyString(moreKeySpecs);
|
||||||
|
final String[] additionalMoreKeys = filterOutEmptyString(additionalMoreKeySpecs);
|
||||||
|
final int moreKeysCount = moreKeys.length;
|
||||||
|
final int additionalCount = additionalMoreKeys.length;
|
||||||
ArrayList<String> out = null;
|
ArrayList<String> out = null;
|
||||||
int additionalIndex = 0;
|
int additionalIndex = 0;
|
||||||
for (int moreKeyIndex = 0; moreKeyIndex < moreKeysCount; moreKeyIndex++) {
|
for (int moreKeyIndex = 0; moreKeyIndex < moreKeysCount; moreKeyIndex++) {
|
||||||
|
@ -226,10 +268,7 @@ public class KeySpecParser {
|
||||||
} else {
|
} else {
|
||||||
// Filter out excessive '%' marker.
|
// Filter out excessive '%' marker.
|
||||||
if (out == null) {
|
if (out == null) {
|
||||||
out = new ArrayList<String>(moreKeyIndex);
|
out = arrayAsList(moreKeys, 0, moreKeyIndex);
|
||||||
for (int i = 0; i < moreKeyIndex; i++) {
|
|
||||||
out.add(moreKeys[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -246,10 +285,7 @@ public class KeySpecParser {
|
||||||
+ " moreKeys=" + Arrays.toString(moreKeys)
|
+ " moreKeys=" + Arrays.toString(moreKeys)
|
||||||
+ " additionalMoreKeys=" + Arrays.toString(additionalMoreKeys));
|
+ " additionalMoreKeys=" + Arrays.toString(additionalMoreKeys));
|
||||||
}
|
}
|
||||||
out = new ArrayList<String>(additionalCount + moreKeysCount);
|
out = arrayAsList(additionalMoreKeys, additionalIndex, additionalCount);
|
||||||
for (int i = additionalIndex; i < additionalCount; i++) {
|
|
||||||
out.add(additionalMoreKeys[i]);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < moreKeysCount; i++) {
|
for (int i = 0; i < moreKeysCount; i++) {
|
||||||
out.add(moreKeys[i]);
|
out.add(moreKeys[i]);
|
||||||
}
|
}
|
||||||
|
@ -261,18 +297,17 @@ public class KeySpecParser {
|
||||||
+ " moreKeys=" + Arrays.toString(moreKeys)
|
+ " moreKeys=" + Arrays.toString(moreKeys)
|
||||||
+ " additionalMoreKeys=" + Arrays.toString(additionalMoreKeys));
|
+ " additionalMoreKeys=" + Arrays.toString(additionalMoreKeys));
|
||||||
}
|
}
|
||||||
out = new ArrayList<String>(moreKeysCount);
|
out = arrayAsList(moreKeys, 0, moreKeysCount);
|
||||||
for (int i = 0; i < moreKeysCount; i++) {
|
|
||||||
out.add(moreKeys[i]);
|
|
||||||
}
|
|
||||||
for (int i = additionalIndex; i < additionalCount; i++) {
|
for (int i = additionalIndex; i < additionalCount; i++) {
|
||||||
out.add(additionalMoreKeys[additionalIndex]);
|
out.add(additionalMoreKeys[additionalIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (out != null) {
|
if (out == null && moreKeysCount > 0) {
|
||||||
return out.size() > 0 ? out.toArray(new String[out.size()]) : null;
|
|
||||||
} else {
|
|
||||||
return moreKeys;
|
return moreKeys;
|
||||||
|
} else if (out != null && out.size() > 0) {
|
||||||
|
return out.toArray(new String[out.size()]);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -280,6 +280,34 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testEmptyEntry() {
|
||||||
|
assertMoreKeys("null more keys and null additons",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
assertMoreKeys("null more keys and empty additons",
|
||||||
|
null,
|
||||||
|
new String[0],
|
||||||
|
null);
|
||||||
|
assertMoreKeys("empty more keys and null additons",
|
||||||
|
new String[0],
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
assertMoreKeys("empty more keys and empty additons",
|
||||||
|
new String[0],
|
||||||
|
new String[0],
|
||||||
|
null);
|
||||||
|
|
||||||
|
assertMoreKeys("filter out empty more keys",
|
||||||
|
new String[] { null, "a", "", "b", null },
|
||||||
|
null,
|
||||||
|
new String[] { "a", "b" });
|
||||||
|
assertMoreKeys("filter out empty additons",
|
||||||
|
new String[] { "a", "%", "b", "%", "c", "%", "d" },
|
||||||
|
new String[] { null, "A", "", "B", null },
|
||||||
|
new String[] { "a", "A", "b", "B", "c", "d" });
|
||||||
|
}
|
||||||
|
|
||||||
public void testInsertAdditionalMoreKeys() {
|
public void testInsertAdditionalMoreKeys() {
|
||||||
// Escaped marker.
|
// Escaped marker.
|
||||||
assertMoreKeys("escaped marker",
|
assertMoreKeys("escaped marker",
|
||||||
|
@ -289,11 +317,11 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
|
|
||||||
// 0 more key.
|
// 0 more key.
|
||||||
assertMoreKeys("null & null", null, null, null);
|
assertMoreKeys("null & null", null, null, null);
|
||||||
assertMoreKeys("null & 1 additional",
|
assertMoreKeys("null & 1 additon",
|
||||||
null,
|
null,
|
||||||
new String[] { "1" },
|
new String[] { "1" },
|
||||||
new String[] { "1" });
|
new String[] { "1" });
|
||||||
assertMoreKeys("null & 2 additionals",
|
assertMoreKeys("null & 2 additons",
|
||||||
null,
|
null,
|
||||||
new String[] { "1", "2" },
|
new String[] { "1", "2" },
|
||||||
new String[] { "1", "2" });
|
new String[] { "1", "2" });
|
||||||
|
@ -327,29 +355,29 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
new String[] { "1", "2", "A", "B" });
|
new String[] { "1", "2", "A", "B" });
|
||||||
|
|
||||||
// 1 marker.
|
// 1 marker.
|
||||||
assertMoreKeys("1 more key & 1 additional & marker at head",
|
assertMoreKeys("1 more key & 1 additon & marker at head",
|
||||||
new String[] { "%", "A" },
|
new String[] { "%", "A" },
|
||||||
new String[] { "1" },
|
new String[] { "1" },
|
||||||
new String[] { "1", "A" });
|
new String[] { "1", "A" });
|
||||||
assertMoreKeys("1 more key & 1 additional & marker at tail",
|
assertMoreKeys("1 more key & 1 additon & marker at tail",
|
||||||
new String[] { "A", "%" },
|
new String[] { "A", "%" },
|
||||||
new String[] { "1" },
|
new String[] { "1" },
|
||||||
new String[] { "A", "1" });
|
new String[] { "A", "1" });
|
||||||
assertMoreKeys("2 more keys & 1 additional & marker at middle",
|
assertMoreKeys("2 more keys & 1 additon & marker at middle",
|
||||||
new String[] { "A", "%", "B" },
|
new String[] { "A", "%", "B" },
|
||||||
new String[] { "1" },
|
new String[] { "1" },
|
||||||
new String[] { "A", "1", "B" });
|
new String[] { "A", "1", "B" });
|
||||||
|
|
||||||
// 1 marker & excess additional more keys.
|
// 1 marker & excess additional more keys.
|
||||||
assertMoreKeys("1 more key & 2 additionals & marker at head",
|
assertMoreKeys("1 more key & 2 additons & marker at head",
|
||||||
new String[] { "%", "A", "B" },
|
new String[] { "%", "A", "B" },
|
||||||
new String[] { "1", "2" },
|
new String[] { "1", "2" },
|
||||||
new String[] { "1", "A", "B", "2" });
|
new String[] { "1", "A", "B", "2" });
|
||||||
assertMoreKeys("1 more key & 2 additionals & marker at tail",
|
assertMoreKeys("1 more key & 2 additons & marker at tail",
|
||||||
new String[] { "A", "B", "%" },
|
new String[] { "A", "B", "%" },
|
||||||
new String[] { "1", "2" },
|
new String[] { "1", "2" },
|
||||||
new String[] { "A", "B", "1", "2" });
|
new String[] { "A", "B", "1", "2" });
|
||||||
assertMoreKeys("2 more keys & 2 additionals & marker at middle",
|
assertMoreKeys("2 more keys & 2 additons & marker at middle",
|
||||||
new String[] { "A", "%", "B" },
|
new String[] { "A", "%", "B" },
|
||||||
new String[] { "1", "2" },
|
new String[] { "1", "2" },
|
||||||
new String[] { "A", "1", "B", "2" });
|
new String[] { "A", "1", "B", "2" });
|
||||||
|
@ -384,32 +412,32 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
new String[] { "1", "2" },
|
new String[] { "1", "2" },
|
||||||
new String[] { "A", "1", "B", "2" });
|
new String[] { "A", "1", "B", "2" });
|
||||||
|
|
||||||
// 2 markers & excess additional keys.
|
// 2 markers & excess additional more keys.
|
||||||
assertMoreKeys("0 more key & 2 addtional & 2 markers",
|
assertMoreKeys("0 more key & 2 additons & 2 markers",
|
||||||
new String[] { "%", "%" },
|
new String[] { "%", "%" },
|
||||||
new String[] { "1", "2", "3" },
|
new String[] { "1", "2", "3" },
|
||||||
new String[] { "1", "2", "3" });
|
new String[] { "1", "2", "3" });
|
||||||
assertMoreKeys("1 more key & 2 addtional & 2 markers at head",
|
assertMoreKeys("1 more key & 2 additons & 2 markers at head",
|
||||||
new String[] { "%", "%", "A" },
|
new String[] { "%", "%", "A" },
|
||||||
new String[] { "1", "2", "3" },
|
new String[] { "1", "2", "3" },
|
||||||
new String[] { "1", "2", "A", "3" });
|
new String[] { "1", "2", "A", "3" });
|
||||||
assertMoreKeys("1 more key & 2 addtional & 2 markers at tail",
|
assertMoreKeys("1 more key & 2 additons & 2 markers at tail",
|
||||||
new String[] { "A", "%", "%" },
|
new String[] { "A", "%", "%" },
|
||||||
new String[] { "1", "2", "3" },
|
new String[] { "1", "2", "3" },
|
||||||
new String[] { "A", "1", "2", "3" });
|
new String[] { "A", "1", "2", "3" });
|
||||||
assertMoreKeys("2 more keys & 2 addtional & 2 markers at middle",
|
assertMoreKeys("2 more keys & 2 additons & 2 markers at middle",
|
||||||
new String[] { "A", "%", "%", "B" },
|
new String[] { "A", "%", "%", "B" },
|
||||||
new String[] { "1", "2", "3" },
|
new String[] { "1", "2", "3" },
|
||||||
new String[] { "A", "1", "2", "B", "3" });
|
new String[] { "A", "1", "2", "B", "3" });
|
||||||
assertMoreKeys("2 more keys & 2 addtional & 2 markers at head & middle",
|
assertMoreKeys("2 more keys & 2 additons & 2 markers at head & middle",
|
||||||
new String[] { "%", "A", "%", "B" },
|
new String[] { "%", "A", "%", "B" },
|
||||||
new String[] { "1", "2", "3" },
|
new String[] { "1", "2", "3" },
|
||||||
new String[] { "1", "A", "2", "B", "3" });
|
new String[] { "1", "A", "2", "B", "3" });
|
||||||
assertMoreKeys("2 more keys & 2 addtional & 2 markers at head & tail",
|
assertMoreKeys("2 more keys & 2 additons & 2 markers at head & tail",
|
||||||
new String[] { "%", "A", "B", "%" },
|
new String[] { "%", "A", "B", "%" },
|
||||||
new String[] { "1", "2", "3" },
|
new String[] { "1", "2", "3" },
|
||||||
new String[] { "1", "A", "B", "2", "3" });
|
new String[] { "1", "A", "B", "2", "3" });
|
||||||
assertMoreKeys("2 more keys & 2 addtional & 2 markers at middle & tail",
|
assertMoreKeys("2 more keys & 2 additons & 2 markers at middle & tail",
|
||||||
new String[] { "A", "%", "B", "%" },
|
new String[] { "A", "%", "B", "%" },
|
||||||
new String[] { "1", "2", "3" },
|
new String[] { "1", "2", "3" },
|
||||||
new String[] { "A", "1", "B", "2", "3" });
|
new String[] { "A", "1", "B", "2", "3" });
|
||||||
|
@ -437,31 +465,31 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
new String[] { "A", "B" });
|
new String[] { "A", "B" });
|
||||||
|
|
||||||
// Excess markers.
|
// Excess markers.
|
||||||
assertMoreKeys("0 more key & 1 addtional & excess marker",
|
assertMoreKeys("0 more key & 1 additon & excess marker",
|
||||||
new String[] { "%", "%" },
|
new String[] { "%", "%" },
|
||||||
new String[] { "1" },
|
new String[] { "1" },
|
||||||
new String[] { "1" });
|
new String[] { "1" });
|
||||||
assertMoreKeys("1 more key & 1 addtional & excess marker at head",
|
assertMoreKeys("1 more key & 1 additon & excess marker at head",
|
||||||
new String[] { "%", "%", "A" },
|
new String[] { "%", "%", "A" },
|
||||||
new String[] { "1" },
|
new String[] { "1" },
|
||||||
new String[] { "1", "A" });
|
new String[] { "1", "A" });
|
||||||
assertMoreKeys("1 more key & 1 addtional & excess marker at tail",
|
assertMoreKeys("1 more key & 1 additon & excess marker at tail",
|
||||||
new String[] { "A", "%", "%" },
|
new String[] { "A", "%", "%" },
|
||||||
new String[] { "1" },
|
new String[] { "1" },
|
||||||
new String[] { "A", "1" });
|
new String[] { "A", "1" });
|
||||||
assertMoreKeys("2 more keys & 1 addtional & excess marker at middle",
|
assertMoreKeys("2 more keys & 1 additon & excess marker at middle",
|
||||||
new String[] { "A", "%", "%", "B" },
|
new String[] { "A", "%", "%", "B" },
|
||||||
new String[] { "1" },
|
new String[] { "1" },
|
||||||
new String[] { "A", "1", "B" });
|
new String[] { "A", "1", "B" });
|
||||||
assertMoreKeys("2 more keys & 1 addtional & excess markers",
|
assertMoreKeys("2 more keys & 1 additon & excess markers",
|
||||||
new String[] { "%", "A", "%", "B", "%" },
|
new String[] { "%", "A", "%", "B", "%" },
|
||||||
new String[] { "1" },
|
new String[] { "1" },
|
||||||
new String[] { "1", "A", "B" });
|
new String[] { "1", "A", "B" });
|
||||||
assertMoreKeys("2 more keys & 2 addtionals & excess markers",
|
assertMoreKeys("2 more keys & 2 additons & excess markers",
|
||||||
new String[] { "%", "A", "%", "B", "%" },
|
new String[] { "%", "A", "%", "B", "%" },
|
||||||
new String[] { "1", "2" },
|
new String[] { "1", "2" },
|
||||||
new String[] { "1", "A", "2", "B" });
|
new String[] { "1", "A", "2", "B" });
|
||||||
assertMoreKeys("2 more keys & 3 addtionals & excess markers",
|
assertMoreKeys("2 more keys & 3 additons & excess markers",
|
||||||
new String[] { "%", "A", "%", "%", "B", "%" },
|
new String[] { "%", "A", "%", "%", "B", "%" },
|
||||||
new String[] { "1", "2", "3" },
|
new String[] { "1", "2", "3" },
|
||||||
new String[] { "1", "A", "2", "3", "B" });
|
new String[] { "1", "A", "2", "3", "B" });
|
||||||
|
|
Loading…
Reference in New Issue