Merge "Support fixed order more keys"

main
Tadashi G. Takaoka 2012-02-17 01:01:28 -08:00 committed by Android (Google) Code Review
commit fed72d6038
18 changed files with 4010 additions and 522 deletions

View File

@ -18,27 +18,25 @@
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- U+060C: "،" ARABIC COMMA
U+061B: "؛" ARABIC SEMICOLON
U+061F: "؟" ARABIC QUESTION MARK -->
<!-- U+061F: "؟" ARABIC QUESTION MARK
U+060C: "،" ARABIC COMMA
U+061B: "؛" ARABIC SEMICOLON -->
<!-- U+0650: "ِ" ARABIC KASRA
U+064E: "َ" ARABIC FATHA
U+064B: "ً" ARABIC FATHATAN
U+0640: "ـ" ARABIC TATWEEL
U+064D: "ٍ" ARABIC KASRATAN
U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF
U+064B: "ً" ARABIC FATHATAN
U+0656: "ٖ" ARABIC SUBSCRIPT ALEF
U+0654: "ٔ" ARABIC HAMZA ABOVE
U+0655: "ٕ" ARABIC HAMZA BELOW -->
<!-- U+0651: "ّ" ARABIC SHADDA
U+0652: "ْ" ARABIC SUKUN
U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF
U+0655: "ٕ" ARABIC HAMZA BELOW
U+0654: "ٔ" ARABIC HAMZA ABOVE -->
<!-- U+064F: "ُ" ARABIC DAMMA
U+064C: "ٌ" ARABIC DAMMATAN
U+0651: "ّ" ARABIC SHADDA
U+0652: "ْ" ARABIC SUKUN
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. -->
<!-- TODO: Will introduce "grouping marks" to the more characters specification. -->
<string name="more_keys_for_punctuation">"&#x060C;,&#x061B;,&#x061F;,!,:,-,/,\',\",&#x0640;&#x0640;&#x0640;|&#x0640;,&#x064E;,&#x0650;,&#x064B;,&#x064D;,&#x0670;,&#x0656;,&#x0655;,&#x0654;,&#x0653;,&#x0652;,&#x0651;,&#x064C;,&#x064F;"</string>
<integer name="more_keys_keyboard_column_for_punctuation">9</integer>
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',-,:,!,&#x061F;,&#x060C;,&#x061B;,&#x0650;,&#x064E;,&#x064D;,&#x064B;,&#x0656;,&#x0670;,&#x0655;,&#x0654;,&#x064F;,&#x064C;,&#x0651;,&#x0652;,&#x0653;,&#x0640;&#x0640;&#x0640;|&#x0640;,/"</string>
<string name="keyhintlabel_for_punctuation">&#x064B;</string>
<!-- U+0661: "١" ARABIC-INDIC DIGIT ONE -->
<string name="keylabel_for_symbols_1">&#x0661;</string>
@ -79,7 +77,8 @@
<!-- U+066A: "٪" ARABIC PERCENT SIGN -->
<string name="keylabel_for_symbols_percent">&#x066A;</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">&#x060C;</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_symbols_question">\?</string>
@ -125,8 +124,8 @@
U+FD3F: "﴿" ORNATE RIGHT PARENTHESIS -->
<!-- TODO: DroidSansArabic lacks the glyph of U+FD3E ORNATE LEFT PARENTHESIS -->
<!-- TODO: DroidSansArabic lacks the glyph of U+FD3F ORNATE RIGHT PARENTHESIS -->
<string name="more_keys_for_left_parenthesis">[|],{|},&lt;|&gt;,&#xFD3E;|&#xFD3F;</string>
<string name="more_keys_for_right_parenthesis">]|[,}|{,&gt;|&lt;,&#xFD3F;|&#xFD3E;</string>
<string name="more_keys_for_left_parenthesis">!fixedColumnOrder!4,&#xFD3E;|&#xFD3F;,&lt;|&gt;,{|},[|]</string>
<string name="more_keys_for_right_parenthesis">!fixedColumnOrder!4,&#xFD3F;|&#xFD3E;,&gt;|&lt;,}|{,]|[</string>
<!-- U+003E: ">" GREATER-THAN SIGN -->
<integer name="keycode_for_less_than">0x003E</integer>
<!-- U+003C: "<" LESS-THAN SIGN -->
@ -146,8 +145,8 @@
U+201D: "”" RIGHT DOUBLE QUOTATION MARK
U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
<string name="more_keys_for_less_than">&#x2264;|&#x2265;,&#x00AB;|&#x00BB;,&#x2039;|&#x203A;</string>
<string name="more_keys_for_greater_than">&#x2265;|&#x2264;,&#x00BB;|&#x00AB;,&#x203A;|&#x2039;</string>
<string name="more_keys_for_less_than">!fixedColumnOrder!3,&#x2039;|&#x203A;,&#x2264;|&#x2265;,&#x00AB;|&#x00BB;</string>
<string name="more_keys_for_greater_than">!fixedColumnOrder!3,&#x203A;|&#x2039;,&#x2265;|&#x2264;,&#x00BB;|&#x00AB;</string>
<!-- U+005D: "]" RIGHT SQUARE BRACKET -->
<integer name="keycode_for_left_square_bracket">0x005D</integer>
<!-- U+005B: "[" LEFT SQUARE BRACKET -->
@ -157,11 +156,9 @@
<!-- U+007B: "{" LEFT CURLY BRACKET -->
<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 -->
<!-- <string name="more_keys_for_double_quote">&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;,&#x00BB;</string> -->
<!-- The 4-more keys will be displayed in order of "3,1,2,4". -->
<string name="more_keys_for_double_quote">&#x201D;,&#x00AB;|&#x00BB;,&#x201C;,&#x00BB;|&#x00AB;</string>
<!-- <string name="more_keys_for_double_quote">&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;|&#x00BB;,&#x00BB;|&#x00AB;</string> -->
<string name="more_keys_for_double_quote">!fixedColumnOrder!4,&#x201C;,&#x201D;,&#x00AB;|&#x00BB;,&#x00BB;|&#x00AB;</string>
<!-- 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">&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;,&#x00BB;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</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">&#x201D;,&#x00AB;|&#x00BB;,&#x201C;,&#x00BB;|&#x00AB;,&#x2019;,&#x201A;,&#x2018;,&#x201B;</string>
<!-- <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!6,&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;|&#x00BB;,&#x00BB|&#x00AB;;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</string> -->
<string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!4,&#x201C;,&#x201D;,&#x00AB;|&#x00BB;,&#x00BB;|&#x00AB;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</string>
</resources>

View File

@ -67,7 +67,7 @@
U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
U+010D: "č" LATIN SMALL LETTER C WITH CARON -->
<string name="more_keys_for_c">&#x00E7;,&#x0107;,&#x010D;</string>
<!-- U+00BF: "¿" INVERTED QUESTION MARK
U+00A1: "¡" INVERTED EXCLAMATION MARK -->
<string name="more_keys_for_punctuation">"\\,,\?,!,&#x00BF;,&#x00A1;,:,-,\',\",),(,/,;,+,&amp;,\@"</string>
<!-- U+00A1: "¡" INVERTED EXCLAMATION MARK
U+00BF: "¿" INVERTED QUESTION MARK -->
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',-,&#x00A1;,!,&#x00BF;,\\,,\?,\@,&amp;,+,;,:,/,(,)"</string>
</resources>

View File

@ -29,8 +29,8 @@
<integer name="keycode_for_left_parenthesis">0x0029</integer>
<!-- U+0028: "(" LEFT PARENTHESIS -->
<integer name="keycode_for_right_parenthesis">0x0028</integer>
<string name="more_keys_for_left_parenthesis">[|],{|},&lt;|&gt;</string>
<string name="more_keys_for_right_parenthesis">]|[,}|{,&gt;|&lt;</string>
<string name="more_keys_for_left_parenthesis">!fixedColumnOrder!3,&lt;|&gt;,{|},[|]</string>
<string name="more_keys_for_right_parenthesis">!fixedColumnOrder!3,&gt;|&lt;,}|{,]|[</string>
<!-- U+003E: ">" GREATER-THAN SIGN -->
<integer name="keycode_for_less_than">0x003E</integer>
<!-- U+003C: "<" LESS-THAN SIGN -->
@ -50,8 +50,8 @@
U+201D: "”" RIGHT DOUBLE QUOTATION MARK
U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
<string name="more_keys_for_less_than">&#x2264;|&#x2265;,&#x00AB;|&#x00BB;,&#x2039;|&#x203A;</string>
<string name="more_keys_for_greater_than">&#x2265;|&#x2264;,&#x00BB;|&#x00AB;,&#x203A;|&#x2039;</string>
<string name="more_keys_for_less_than">!fixedColumnOrder!3,&#x2039;|&#x203A;,&#x2264;|&#x2265;,&#x00AB;|&#x00BB;</string>
<string name="more_keys_for_greater_than">!fixedColumnOrder!3,&#x203A;|&#x2039;,&#x2265;|&#x2264;,&#x00BB;|&#x00AB;</string>
<!-- U+005D: "]" RIGHT SQUARE BRACKET -->
<integer name="keycode_for_left_square_bracket">0x005D</integer>
<!-- U+005B: "[" LEFT SQUARE BRACKET -->
@ -60,12 +60,10 @@
<integer name="keycode_for_left_curly_bracket">0x007D</integer>
<!-- U+007B: "{" LEFT CURLY BRACKET -->
<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. -->
<!-- <string name="more_keys_for_double_quote">&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;,&#x00BB;</string> -->
<!-- The 4-more keys will be displayed in order of "3,1,2,4". -->
<string name="more_keys_for_double_quote">&#x201D;,&#x00AB;|&#x00BB;,&#x201C;,&#x00BB;|&#x00AB;</string>
<!-- 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">&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;,&#x00BB;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</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">&#x201D;,&#x00AB;|&#x00BB;,&#x201C;,&#x00BB;|&#x00AB;,&#x2019;,&#x201A;,&#x2018;,&#x201B;</string>
<!-- 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> -->
<string name="more_keys_for_double_quote">!fixedColumnOrder!4,&#x201C;,&#x201D;,&#x00AB;|&#x00BB;,&#x00BB;|&#x00AB;</string>
<!-- 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> -->
<string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!4,&#x201C;,&#x201D;,&#x00AB;|&#x00BB;,&#x00BB;|&#x00AB;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</string>
</resources>

View File

@ -64,9 +64,8 @@
<string name="more_keys_for_currency_euro">&#x00A2;,&#x00A3;,$,&#x00A5;,&#x20B1;</string>
<string name="more_keys_for_currency_pound">&#x00A2;,$,&#x20AC;,&#x00A5;,&#x20B1;</string>
<string name="more_keys_for_currency_general">&#x00A2;,$,&#x20AC;,&#x00A3;,&#x00A5;,&#x20B1;</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_punctuation">"\\,,\?,!,:,-,\',\",(,),/,;,+,&amp;,\@"</string>
<integer name="more_keys_keyboard_column_for_punctuation">7</integer>
<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">"!fixedColumnOrder!7,\",\',-,:,!,\\,,\?,\@,&amp;,+,;,/,(,)"</string>
<string name="keyhintlabel_for_punctuation"></string>
<string name="keylabel_for_popular_domain">".com"</string>
<!-- popular web domains for the locale - most popular, displayed on the keyboard -->
@ -154,18 +153,18 @@
<integer name="keycode_for_left_parenthesis">0x0028</integer>
<!-- U+0029: ")" RIGHT PARENTHESIS -->
<integer name="keycode_for_right_parenthesis">0x0029</integer>
<string name="more_keys_for_left_parenthesis">[,{,&lt;</string>
<string name="more_keys_for_right_parenthesis">],},&gt;</string>
<string name="more_keys_for_left_parenthesis">!fixedColumnOrder!3,&lt;,{,[</string>
<string name="more_keys_for_right_parenthesis">!fixedColumnOrder!3,&gt;,},]</string>
<!-- U+003C: "<" LESS-THAN SIGN -->
<integer name="keycode_for_less_than">0x003C</integer>
<!-- U+003E: ">" GREATER-THAN SIGN -->
<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+00AB: "«" LEFT-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.
U+2018: "" LEFT SINGLE QUOTATION MARK
U+2019: "" RIGHT SINGLE QUOTATION MARK
@ -175,8 +174,8 @@
U+201D: "”" RIGHT DOUBLE QUOTATION MARK
U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK -->
<string name="more_keys_for_less_than">&#x2264;,&#x00AB;,&#x2039;</string>
<string name="more_keys_for_greater_than">&#x2265;,&#x00BB;,&#x203A;</string>
<string name="more_keys_for_less_than">!fixedColumnOrder!3,&#x2039;,&#x2264;,&#x00AB;</string>
<string name="more_keys_for_greater_than">!fixedColumnOrder!3,&#x203A;,&#x2265;,&#x00BB;</string>
<!-- U+005B: "[" LEFT SQUARE BRACKET -->
<integer name="keycode_for_left_square_bracket">0x005B</integer>
<!-- U+005D: "]" RIGHT SQUARE BRACKET -->
@ -185,14 +184,11 @@
<integer name="keycode_for_left_curly_bracket">0x007B</integer>
<!-- U+007D: "}" RIGHT CURLY BRACKET -->
<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">&#x2019;,&#x201A;,&#x2018;,&#x201B;</string>
<string name="more_keys_for_single_quote">!fixedColumnOrder!4,&#x2018;,&#x2019;,&#x201A;,&#x201B;</string>
<!-- 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;</string> -->
<!-- The 4-more keys will be displayed in order of "3,1,2,4". -->
<string name="more_keys_for_double_quote">&#x201D;,&#x00AB;,&#x201C;,&#x00BB;</string>
<!-- <string name="more_keys_for_double_quote">!fixedColumnOrder!6,&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;,&#x00BB;</string> -->
<string name="more_keys_for_double_quote">!fixedColumnOrder!4,&#x201C;,&#x201D;,&#x00AB;,&#x00BB;</string>
<!-- 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">&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;,&#x00BB;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</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">&#x201D;,&#x00AB;,&#x201C;,&#x00BB;,&#x2019;,&#x201A;,&#x2018;,&#x201B;</string>
<!-- <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!6,&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;,&#x00BB;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</string> -->
<string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!4,&#x201C;,&#x201D;,&#x00AB;,&#x00BB;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</string>
</resources>

View File

@ -104,8 +104,7 @@
latin:keyLabel=":-)"
latin:keyOutputText=":-) "
latin:keyLabelFlags="hasPopupHint|preserveCase"
latin:moreKeys="@string/more_keys_for_smiley"
latin:maxMoreKeysColumn="5" />
latin:moreKeys="@string/more_keys_for_smiley" />
<key-style
latin:styleName="shortcutKeyStyle"
latin:code="@integer/key_shortcut"

View File

@ -160,8 +160,7 @@
latin:keyWidth="39.750%p" />
<Key
latin:keyLabel="&quot;"
latin:moreKeys="@string/more_keys_for_tablet_double_quote"
latin:maxMoreKeysColumn="4" />
latin:moreKeys="@string/more_keys_for_tablet_double_quote" />
<Key
latin:keyLabel="_" />
<Spacer

View File

@ -86,8 +86,7 @@
latin:keyLabel=":-)"
latin:keyOutputText=":-) "
latin:keyLabelFlags="hasPopupHint|preserveCase"
latin:moreKeys="@string/more_keys_for_smiley"
latin:maxMoreKeysColumn="5" />
latin:moreKeys="@string/more_keys_for_smiley" />
<key-style
latin:styleName="shortcutKeyStyle"
latin:code="@integer/key_shortcut"

View File

@ -175,8 +175,7 @@
latin:keyWidth="37.500%p" />
<Key
latin:keyLabel="&quot;"
latin:moreKeys="@string/more_keys_for_tablet_double_quote"
latin:maxMoreKeysColumn="4" />
latin:moreKeys="@string/more_keys_for_tablet_double_quote" />
<Key
latin:keyLabel="_" />
<switch>

View File

@ -188,6 +188,5 @@
latin:keyHintLabel="@string/keyhintlabel_for_punctuation"
latin:keyLabelFlags="hasPopupHint|preserveCase"
latin:moreKeys="@string/more_keys_for_punctuation"
latin:maxMoreKeysColumn="@integer/more_keys_keyboard_column_for_punctuation"
latin:backgroundType="functional" />
</merge>

View File

@ -55,7 +55,6 @@
latin:keyOutputText=":-) "
latin:keyLabelFlags="hasPopupHint"
latin:moreKeys="@string/more_keys_for_smiley"
latin:maxMoreKeysColumn="5"
latin:backgroundType="functional" />
</case>
<case

View File

@ -130,13 +130,9 @@
<Key
latin:keyLabel="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
latin:keyLabel="\'"
latin:moreKeys="&#x2018;,&#x2019;,&#x201B;,&#x201A;" />
latin:moreKeys="@string/more_keys_for_single_quote" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight"

View File

@ -109,8 +109,7 @@
latin:moreKeys="&#x00A1;" />
<Key
latin:keyLabel="&quot;"
latin:moreKeys="@string/more_keys_for_double_quote"
latin:maxMoreKeysColumn="4" />
latin:moreKeys="@string/more_keys_for_double_quote" />
<Key
latin:keyLabel="\'"
latin:moreKeys="@string/more_keys_for_single_quote" />

View File

@ -105,6 +105,9 @@ public class Key {
public final String[] mMoreKeys;
/** More keys maximum column number */
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. */
public final int mBackgroundType;
@ -232,10 +235,19 @@ public class Key {
mLabelFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags);
final boolean preserveCase = (mLabelFlags & LABEL_FLAGS_PRESERVE_CASE) != 0;
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(
keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
final String[] moreKeys = KeySpecParser.insertAddtionalMoreKeys(style.getStringArray(
keyAttr, R.styleable.Keyboard_Key_moreKeys), additionalMoreKeys);
moreKeys = KeySpecParser.insertAddtionalMoreKeys(moreKeys, additionalMoreKeys);
if (moreKeys != null) {
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
for (int i = 0; i < moreKeys.length; i++) {
@ -245,8 +257,6 @@ public class Key {
}
mActionFlags = actionFlags;
mMoreKeys = moreKeys;
mMaxMoreKeysColumn = style.getInt(keyAttr,
R.styleable.Keyboard_Key_maxMoreKeysColumn, params.mMaxMoreKeysKeyboardColumn);
if ((mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0) {
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,
KeyboardId id) {
if (!Keyboard.isLetterCode(code) || preserveCase) return code;

View File

@ -37,9 +37,11 @@ public class MoreKeysKeyboard extends Keyboard {
private final String[] mMoreKeys;
public static class MoreKeysKeyboardParams extends Keyboard.Params {
public boolean mIsFixedOrder;
/* package */int mTopRowAdjustment;
public int mNumRows;
public int mNumColumns;
public int mTopKeys;
public int mLeftKeys;
public int mRightKeys; // includes default key.
@ -58,14 +60,17 @@ public class MoreKeysKeyboard extends Keyboard {
* Set keyboard parameters of 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 rowHeight more keys keyboard row height in pixel, including vertical gap.
* @param coordXInParent coordinate x of the key preview in parent keyboard.
* @param parentKeyboardWidth parent keyboard width in pixel.
*/
public void setParameters(int numKeys, int maxColumns, int keyWidth, int rowHeight,
int coordXInParent, int parentKeyboardWidth) {
public void setParameters(int numKeys, int maxColumnsAndFlags, int keyWidth,
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) {
throw new IllegalArgumentException(
"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;
mNumRows = numRows;
final int numColumns = getOptimizedColumns(numKeys, maxColumns);
final int numColumns = mIsFixedOrder ? Math.min(numKeys, maxColumns)
: getOptimizedColumns(numKeys, maxColumns);
mNumColumns = numColumns;
final int topKeys = numKeys % numColumns;
mTopKeys = topKeys == 0 ? numColumns : topKeys;
final int numLeftKeys = (numColumns - 1) / 2;
final int numRightKeys = numColumns - numLeftKeys; // including default key.
@ -110,28 +118,68 @@ public class MoreKeysKeyboard extends Keyboard {
mLeftKeys = leftKeys;
mRightKeys = rightKeys;
// Centering of the top row.
if (numRows < 2 || getTopRowEmptySlots(numKeys, numColumns) % 2 == 0) {
mTopRowAdjustment = 0;
} else if (mLeftKeys < mRightKeys - 1) {
mTopRowAdjustment = 1;
} else {
mTopRowAdjustment = -1;
}
// Adjustment of the top row.
mTopRowAdjustment = mIsFixedOrder ? getFixedOrderTopRowAdjustment()
: getAutoOrderTopRowAdjustment();
mBaseWidth = mOccupiedWidth = mNumColumns * mDefaultKeyWidth;
// Need to subtract the bottom row's gutter only.
mBaseHeight = mOccupiedHeight = mNumRows * mDefaultRowHeight - mVerticalGap
+ 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).
/* package */int getColumnPos(int n) {
return mIsFixedOrder ? getFixedOrderColumnPos(n) : getAutomaticColumnPos(n);
}
private int getFixedOrderColumnPos(int n) {
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) {
// default position.
return 0;
}
int pos = 0;
int right = 1; // include default position key.
int left = 0;
@ -146,7 +194,7 @@ public class MoreKeysKeyboard extends Keyboard {
if (i >= col)
break;
// Assign left key if available.
if (left < mLeftKeys) {
if (left < leftKeys) {
left++;
pos = -left;
i++;
@ -158,12 +206,8 @@ public class MoreKeysKeyboard extends Keyboard {
}
private static int getTopRowEmptySlots(int numKeys, int numColumns) {
final int remainingKeys = numKeys % numColumns;
if (remainingKeys == 0) {
return 0;
} else {
return numColumns - remainingKeys;
}
final int remainings = numKeys % numColumns;
return remainings == 0 ? 0 : numColumns - remainings;
}
private int getOptimizedColumns(int numKeys, int maxColumns) {
@ -198,7 +242,7 @@ public class MoreKeysKeyboard extends Keyboard {
}
private boolean isTopRow(int rowCount) {
return rowCount == mNumRows - 1;
return mNumRows > 1 && rowCount == mNumRows - 1;
}
}

View File

@ -206,9 +206,51 @@ public class KeySpecParser {
return KeyboardIconsSet.ICON_UNDEFINED;
}
public static String[] insertAddtionalMoreKeys(String[] moreKeys, String[] additionalMoreKeys) {
final int moreKeysCount = (moreKeys != null) ? moreKeys.length : 0;
final int additionalCount = (additionalMoreKeys != null) ? additionalMoreKeys.length : 0;
private static <T> ArrayList<T> arrayAsList(T[] array, int start, int end) {
if (array == null) {
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;
int additionalIndex = 0;
for (int moreKeyIndex = 0; moreKeyIndex < moreKeysCount; moreKeyIndex++) {
@ -226,10 +268,7 @@ public class KeySpecParser {
} else {
// Filter out excessive '%' marker.
if (out == null) {
out = new ArrayList<String>(moreKeyIndex);
for (int i = 0; i < moreKeyIndex; i++) {
out.add(moreKeys[i]);
}
out = arrayAsList(moreKeys, 0, moreKeyIndex);
}
}
} else {
@ -246,10 +285,7 @@ public class KeySpecParser {
+ " moreKeys=" + Arrays.toString(moreKeys)
+ " additionalMoreKeys=" + Arrays.toString(additionalMoreKeys));
}
out = new ArrayList<String>(additionalCount + moreKeysCount);
for (int i = additionalIndex; i < additionalCount; i++) {
out.add(additionalMoreKeys[i]);
}
out = arrayAsList(additionalMoreKeys, additionalIndex, additionalCount);
for (int i = 0; i < moreKeysCount; i++) {
out.add(moreKeys[i]);
}
@ -261,18 +297,17 @@ public class KeySpecParser {
+ " moreKeys=" + Arrays.toString(moreKeys)
+ " additionalMoreKeys=" + Arrays.toString(additionalMoreKeys));
}
out = new ArrayList<String>(moreKeysCount);
for (int i = 0; i < moreKeysCount; i++) {
out.add(moreKeys[i]);
}
out = arrayAsList(moreKeys, 0, moreKeysCount);
for (int i = additionalIndex; i < additionalCount; i++) {
out.add(additionalMoreKeys[additionalIndex]);
}
}
if (out != null) {
return out.size() > 0 ? out.toArray(new String[out.size()]) : null;
} else {
if (out == null && moreKeysCount > 0) {
return moreKeys;
} else if (out != null && out.size() > 0) {
return out.toArray(new String[out.size()]);
} else {
return null;
}
}

View File

@ -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() {
// Escaped marker.
assertMoreKeys("escaped marker",
@ -289,11 +317,11 @@ public class KeySpecParserTests extends AndroidTestCase {
// 0 more key.
assertMoreKeys("null & null", null, null, null);
assertMoreKeys("null & 1 additional",
assertMoreKeys("null & 1 additon",
null,
new String[] { "1" },
new String[] { "1" });
assertMoreKeys("null & 2 additionals",
assertMoreKeys("null & 2 additons",
null,
new String[] { "1", "2" },
new String[] { "1", "2" });
@ -327,29 +355,29 @@ public class KeySpecParserTests extends AndroidTestCase {
new String[] { "1", "2", "A", "B" });
// 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[] { "1" },
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[] { "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[] { "1" },
new String[] { "A", "1", "B" });
// 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[] { "1", "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[] { "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[] { "1", "2" },
new String[] { "A", "1", "B", "2" });
@ -384,32 +412,32 @@ public class KeySpecParserTests extends AndroidTestCase {
new String[] { "1", "2" },
new String[] { "A", "1", "B", "2" });
// 2 markers & excess additional keys.
assertMoreKeys("0 more key & 2 addtional & 2 markers",
// 2 markers & excess additional more keys.
assertMoreKeys("0 more key & 2 additons & 2 markers",
new String[] { "%", "%" },
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[] { "1", "2", "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[] { "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[] { "1", "2", "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[] { "1", "2", "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[] { "1", "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[] { "1", "2", "3" },
new String[] { "A", "1", "B", "2", "3" });
@ -437,31 +465,31 @@ public class KeySpecParserTests extends AndroidTestCase {
new String[] { "A", "B" });
// Excess markers.
assertMoreKeys("0 more key & 1 addtional & excess marker",
assertMoreKeys("0 more key & 1 additon & excess marker",
new String[] { "%", "%" },
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[] { "1" },
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[] { "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[] { "1" },
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[] { "1" },
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[] { "1", "2" },
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[] { "1", "2", "3" },
new String[] { "1", "A", "2", "3", "B" });