am 1c2cf719: Add new value "spacebar" to Key.backgroundType attribute

* commit '1c2cf71921f0f09e39c1df86c1e57d4c607aad34':
  Add new value "spacebar" to Key.backgroundType attribute
main
Tadashi G. Takaoka 2014-09-03 16:29:02 +00:00 committed by Android Git Automerger
commit c297197b15
8 changed files with 32 additions and 8 deletions

View File

@ -284,6 +284,7 @@
<enum name="stickyOff" value="3" /> <enum name="stickyOff" value="3" />
<enum name="stickyOn" value="4" /> <enum name="stickyOn" value="4" />
<enum name="action" value="5" /> <enum name="action" value="5" />
<enum name="spacebar" value="6" />
</attr> </attr>
<!-- The key action flags. --> <!-- The key action flags. -->
<attr name="keyActionFlags" format="integer"> <attr name="keyActionFlags" format="integer">

View File

@ -86,6 +86,7 @@
<key-style <key-style
latin:styleName="spaceKeyStyle" latin:styleName="spaceKeyStyle"
latin:keySpec="!icon/space_key|!code/key_space" latin:keySpec="!icon/space_key|!code/key_space"
latin:backgroundType="spacebar"
latin:keyActionFlags="noKeyPreview|enableLongPress" /> latin:keyActionFlags="noKeyPreview|enableLongPress" />
<!-- U+200C: ZERO WIDTH NON-JOINER <!-- U+200C: ZERO WIDTH NON-JOINER
U+200D: ZERO WIDTH JOINER --> U+200D: ZERO WIDTH JOINER -->

View File

@ -141,9 +141,8 @@
</Row> </Row>
<Row> <Row>
<Key <Key
latin:keyStyle="spaceKeyStyle" latin:keyStyle="tabletNumSpaceKeyStyle"
latin:keyWidth="30%p" latin:keyWidth="30%p" />
latin:backgroundType="functional" />
<Key <Key
latin:keyStyle="numStarKeyStyle" latin:keyStyle="numStarKeyStyle"
latin:keyXPos="31%p" /> latin:keyXPos="31%p" />

View File

@ -107,9 +107,8 @@
</Row> </Row>
<Row> <Row>
<Key <Key
latin:keyStyle="spaceKeyStyle" latin:keyStyle="tabletNumSpaceKeyStyle"
latin:keyWidth="30%p" latin:keyWidth="30%p" />
latin:backgroundType="functional" />
<Key <Key
latin:keyStyle="numStarKeyStyle" latin:keyStyle="numStarKeyStyle"
latin:keyXPos="31%p" /> latin:keyXPos="31%p" />

View File

@ -22,7 +22,6 @@
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
> >
<Key <Key
latin:backgroundType="normal"
latin:keyStyle="spaceKeyStyle" latin:keyStyle="spaceKeyStyle"
latin:keyWidth="30%p" /> latin:keyWidth="30%p" />
</merge> </merge>

View File

@ -91,6 +91,7 @@
<key-style <key-style
latin:styleName="spaceKeyStyle" latin:styleName="spaceKeyStyle"
latin:keySpec="!icon/space_key|!code/key_space" latin:keySpec="!icon/space_key|!code/key_space"
latin:backgroundType="spacebar"
latin:keyActionFlags="noKeyPreview|enableLongPress" /> latin:keyActionFlags="noKeyPreview|enableLongPress" />
<!-- U+200C: ZERO WIDTH NON-JOINER <!-- U+200C: ZERO WIDTH NON-JOINER
U+200D: ZERO WIDTH JOINER --> U+200D: ZERO WIDTH JOINER -->

View File

@ -123,4 +123,24 @@
latin:keyLabelFlags="alignIconToBottom" latin:keyLabelFlags="alignIconToBottom"
latin:keyActionFlags="enableLongPress" latin:keyActionFlags="enableLongPress"
latin:parentStyle="numKeyBaseStyle" /> latin:parentStyle="numKeyBaseStyle" />
<!-- TODO: Consolidate these space key styles with numSpaceKeyStyle above by introducing <case>
predicator that checks device form-factor. -->
<switch>
<case latin:keyboardTheme="ICS|KLP">
<key-style
latin:styleName="tabletNumSpaceKeyStyle"
latin:keySpec="!icon/space_key|!code/key_space"
latin:backgroundType="functional"
latin:keyActionFlags="enableLongPress"
latin:parentStyle="numKeyBaseStyle" />
</case>
<case latin:keyboardTheme="LXXLight|LXXDark">
<key-style
latin:styleName="tabletNumSpaceKeyStyle"
latin:keySpec="!icon/space_key|!code/key_space"
latin:backgroundType="spacebar"
latin:keyActionFlags="enableLongPress"
latin:parentStyle="numKeyBaseStyle" />
</case>
</switch>
</merge> </merge>

View File

@ -139,6 +139,7 @@ public class Key implements Comparable<Key> {
public static final int BACKGROUND_TYPE_STICKY_OFF = 3; public static final int BACKGROUND_TYPE_STICKY_OFF = 3;
public static final int BACKGROUND_TYPE_STICKY_ON = 4; public static final int BACKGROUND_TYPE_STICKY_ON = 4;
public static final int BACKGROUND_TYPE_ACTION = 5; public static final int BACKGROUND_TYPE_ACTION = 5;
public static final int BACKGROUND_TYPE_SPACEBAR = 6;
private final int mActionFlags; private final int mActionFlags;
private static final int ACTION_FLAGS_IS_REPEATABLE = 0x01; private static final int ACTION_FLAGS_IS_REPEATABLE = 0x01;
@ -505,6 +506,7 @@ public class Key implements Comparable<Key> {
case BACKGROUND_TYPE_STICKY_OFF: return "stickyOff"; case BACKGROUND_TYPE_STICKY_OFF: return "stickyOff";
case BACKGROUND_TYPE_STICKY_ON: return "stickyOn"; case BACKGROUND_TYPE_STICKY_ON: return "stickyOn";
case BACKGROUND_TYPE_ACTION: return "action"; case BACKGROUND_TYPE_ACTION: return "action";
case BACKGROUND_TYPE_SPACEBAR: return "spacebar";
default: return null; default: return null;
} }
} }
@ -871,6 +873,8 @@ public class Key implements Comparable<Key> {
new KeyBackgroundState(android.R.attr.state_checkable, android.R.attr.state_checked), new KeyBackgroundState(android.R.attr.state_checkable, android.R.attr.state_checked),
// 5: BACKGROUND_TYPE_ACTION // 5: BACKGROUND_TYPE_ACTION
new KeyBackgroundState(android.R.attr.state_active), new KeyBackgroundState(android.R.attr.state_active),
// 6: BACKGROUND_TYPE_SPACEBAR
new KeyBackgroundState(),
}; };
} }
@ -884,7 +888,7 @@ public class Key implements Comparable<Key> {
final Drawable background; final Drawable background;
if (mBackgroundType == BACKGROUND_TYPE_FUNCTIONAL) { if (mBackgroundType == BACKGROUND_TYPE_FUNCTIONAL) {
background = functionalKeyBackground; background = functionalKeyBackground;
} else if (getCode() == Constants.CODE_SPACE) { } else if (mBackgroundType == BACKGROUND_TYPE_SPACEBAR) {
background = spacebarBackground; background = spacebarBackground;
} else { } else {
background = keyBackground; background = keyBackground;