diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/KeyboardSwitcher.java | 2 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinKeyboard.java | 37 |
2 files changed, 34 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index 223198b0b..9c0a5a3aa 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -45,7 +45,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha public static final int KEYBOARDMODE_WEB = R.id.mode_webentry; public static final String DEFAULT_LAYOUT_ID = "4"; - public static final String PREF_KEYBOARD_LAYOUT = "keyboard_layout"; + public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20100902"; private static final int[] THEMES = new int [] { R.layout.input_basic, R.layout.input_basic_highcontrast, R.layout.input_stone_normal, R.layout.input_stone_bold, R.layout.input_gingerbread}; diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 15e22f318..33519e4be 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -628,9 +628,20 @@ public class LatinKeyboard extends Keyboard { } class LatinKey extends Keyboard.Key { - + + // functional normal state (with properties) + private final int[] KEY_STATE_FUNCTIONAL_NORMAL = { + android.R.attr.state_single + }; + + // functional pressed state (with properties) + private final int[] KEY_STATE_FUNCTIONAL_PRESSED = { + android.R.attr.state_single, + android.R.attr.state_pressed + }; + private boolean mShiftLockEnabled; - + public LatinKey(Resources res, Keyboard.Row parent, int x, int y, XmlResourceParser parser) { super(res, parent, x, y, parser); @@ -639,11 +650,17 @@ public class LatinKeyboard extends Keyboard { popupResId = 0; } } - - void enableShiftLock() { + + private void enableShiftLock() { mShiftLockEnabled = true; } + // sticky is used for shift key. If a key is not sticky and is modifier, + // the key will be treated as functional. + private boolean isFunctionalKey() { + return !sticky && modifier; + } + @Override public void onReleased(boolean inside) { if (!mShiftLockEnabled) { @@ -665,6 +682,18 @@ public class LatinKeyboard extends Keyboard { boolean isInsideSuper(int x, int y) { return super.isInside(x, y); } + + @Override + public int[] getCurrentDrawableState() { + if (isFunctionalKey()) { + if (pressed) { + return KEY_STATE_FUNCTIONAL_PRESSED; + } else { + return KEY_STATE_FUNCTIONAL_NORMAL; + } + } + return super.getCurrentDrawableState(); + } } /** |