Add new value "spacebar" to Key.backgroundType attribute

Bug: 17318036
Change-Id: Ie84438a6aa3adc14a9db603d0cd4d5e37a55d612
main
Tadashi G. Takaoka 2014-09-03 10:52:56 +09:00
parent 5a9c9649db
commit 1c2cf71921
8 changed files with 32 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -123,4 +123,24 @@
latin:keyLabelFlags="alignIconToBottom"
latin:keyActionFlags="enableLongPress"
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>

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_ON = 4;
public static final int BACKGROUND_TYPE_ACTION = 5;
public static final int BACKGROUND_TYPE_SPACEBAR = 6;
private final int mActionFlags;
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_ON: return "stickyOn";
case BACKGROUND_TYPE_ACTION: return "action";
case BACKGROUND_TYPE_SPACEBAR: return "spacebar";
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),
// 5: BACKGROUND_TYPE_ACTION
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;
if (mBackgroundType == BACKGROUND_TYPE_FUNCTIONAL) {
background = functionalKeyBackground;
} else if (getCode() == Constants.CODE_SPACE) {
} else if (mBackgroundType == BACKGROUND_TYPE_SPACEBAR) {
background = spacebarBackground;
} else {
background = keyBackground;