From 1c2cf71921f0f09e39c1df86c1e57d4c607aad34 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 3 Sep 2014 10:52:56 +0900 Subject: [PATCH] Add new value "spacebar" to Key.backgroundType attribute Bug: 17318036 Change-Id: Ie84438a6aa3adc14a9db603d0cd4d5e37a55d612 --- java/res/values/attrs.xml | 1 + java/res/xml-sw600dp/key_styles_common.xml | 1 + java/res/xml-sw600dp/rows_number_normal.xml | 5 ++--- java/res/xml-sw600dp/rows_phone.xml | 5 ++--- java/res/xml/key_space_symbols.xml | 1 - java/res/xml/key_styles_common.xml | 1 + java/res/xml/key_styles_number.xml | 20 +++++++++++++++++++ .../com/android/inputmethod/keyboard/Key.java | 6 +++++- 8 files changed, 32 insertions(+), 8 deletions(-) diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 009df7932..57e73767c 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -284,6 +284,7 @@ + diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml index c750a9319..006cda370 100644 --- a/java/res/xml-sw600dp/key_styles_common.xml +++ b/java/res/xml-sw600dp/key_styles_common.xml @@ -86,6 +86,7 @@ diff --git a/java/res/xml-sw600dp/rows_number_normal.xml b/java/res/xml-sw600dp/rows_number_normal.xml index 757e77933..7a4700d5a 100644 --- a/java/res/xml-sw600dp/rows_number_normal.xml +++ b/java/res/xml-sw600dp/rows_number_normal.xml @@ -141,9 +141,8 @@ + latin:keyStyle="tabletNumSpaceKeyStyle" + latin:keyWidth="30%p" /> diff --git a/java/res/xml-sw600dp/rows_phone.xml b/java/res/xml-sw600dp/rows_phone.xml index 9022bc532..612397a90 100644 --- a/java/res/xml-sw600dp/rows_phone.xml +++ b/java/res/xml-sw600dp/rows_phone.xml @@ -107,9 +107,8 @@ + latin:keyStyle="tabletNumSpaceKeyStyle" + latin:keyWidth="30%p" /> diff --git a/java/res/xml/key_space_symbols.xml b/java/res/xml/key_space_symbols.xml index 0ce522889..047de9f24 100644 --- a/java/res/xml/key_space_symbols.xml +++ b/java/res/xml/key_space_symbols.xml @@ -22,7 +22,6 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml index 167e6f88d..43ee26b07 100644 --- a/java/res/xml/key_styles_common.xml +++ b/java/res/xml/key_styles_common.xml @@ -91,6 +91,7 @@ diff --git a/java/res/xml/key_styles_number.xml b/java/res/xml/key_styles_number.xml index 14b202874..97ae6c6c3 100644 --- a/java/res/xml/key_styles_number.xml +++ b/java/res/xml/key_styles_number.xml @@ -123,4 +123,24 @@ latin:keyLabelFlags="alignIconToBottom" latin:keyActionFlags="enableLongPress" latin:parentStyle="numKeyBaseStyle" /> + + + + + + + + + diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 5b090d924..f7e4d8b10 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -139,6 +139,7 @@ public class Key implements Comparable { 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 { 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 { 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 { 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;