aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-12-06 19:48:53 +0900
committerTadashi G. Takaoka <takaoka@google.com>2011-12-06 19:52:25 +0900
commite466583ddc68278ad708094f8ac521be504bf342 (patch)
tree74e7d983ba4a4277eaecf9296e2b1eef839f9ad1 /java/src
parent8a70e70c849cc2c5553c6fd79891c22893fd761b (diff)
downloadlatinime-e466583ddc68278ad708094f8ac521be504bf342.tar.gz
latinime-e466583ddc68278ad708094f8ac521be504bf342.tar.xz
latinime-e466583ddc68278ad708094f8ac521be504bf342.zip
Fix caps lock key behavior
Fix the issue introduced by Idfe69978. Bug: 5708602 Change-Id: I4265822b7d33417b87b3e7e3f49250ac5d2ecdda
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java31
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardShiftState.java2
2 files changed, 11 insertions, 22 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 11a446c15..2bc140ed5 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -21,6 +21,7 @@ import android.text.TextUtils;
import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.internal.KeyboardParams;
+import com.android.inputmethod.keyboard.internal.KeyboardShiftState;
import java.util.Collections;
import java.util.HashMap;
@@ -114,13 +115,8 @@ public class Keyboard {
private final ProximityInfo mProximityInfo;
- // TODO: Remove these variables.
- private static final int UNSHIFT = 0;
- private static final int MANUAL_SHIFT = 1;
- private static final int AUTOMATIC_SHIFT = 2;
- private int mShiftMode;
- private boolean mShifted;
- private boolean mShiftLocked;
+ // TODO: Remove this variable.
+ private final KeyboardShiftState mShiftState = new KeyboardShiftState();
public Keyboard(KeyboardParams params) {
mId = params.mId;
@@ -181,44 +177,37 @@ public class Keyboard {
key.setHighlightOn(newShiftLockState);
key.setIcon(newShiftLockState ? mShiftedIcons.get(key) : mUnshiftedIcons.get(key));
}
- mShiftLocked = newShiftLockState;
+ mShiftState.setShiftLocked(newShiftLockState);
}
// TODO: Move this method to KeyboardId.
public boolean isShiftLocked() {
- return mShiftLocked;
+ return mShiftState.isShiftLocked();
}
// TODO: Remove this method.
public void setShifted(boolean newShiftState) {
- mShiftMode = (newShiftState ? MANUAL_SHIFT : UNSHIFT);
- setShiftedInternal(newShiftState);
- }
-
- // TODO: Remove this method
- private void setShiftedInternal(boolean newShiftState) {
- if (!mShiftLocked) {
+ if (!mShiftState.isShiftLocked()) {
for (final Key key : mShiftKeys) {
key.setIcon(newShiftState ? mShiftedIcons.get(key) : mUnshiftedIcons.get(key));
}
}
- mShifted = newShiftState;
+ mShiftState.setShifted(newShiftState);
}
// TODO: Move this method to KeyboardId.
public boolean isShiftedOrShiftLocked() {
- return mShifted || mShiftLocked;
+ return mShiftState.isShiftedOrShiftLocked();
}
// TODO: Remove this method
public void setAutomaticTemporaryUpperCase() {
- mShiftMode = AUTOMATIC_SHIFT;
- setShiftedInternal(true);
+ mShiftState.setAutomaticTemporaryUpperCase();
}
// TODO: Move this method to KeyboardId.
public boolean isManualTemporaryUpperCase() {
- return mShiftMode == MANUAL_SHIFT;
+ return mShiftState.isManualTemporaryUpperCase();
}
// TODO: Remove this method.
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardShiftState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardShiftState.java
index 7b3c5d704..4a77e0735 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardShiftState.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardShiftState.java
@@ -20,7 +20,7 @@ import android.util.Log;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
-/* package */ class KeyboardShiftState {
+public class KeyboardShiftState {
private static final String TAG = KeyboardShiftState.class.getSimpleName();
private static final boolean DEBUG = KeyboardSwitcher.DEBUG_STATE;