aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java21
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java18
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboard.java2
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java6
4 files changed, 18 insertions, 29 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index b3b20ca21..c9756de87 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -112,7 +112,8 @@ public class Keyboard {
public final KeyboardIconsSet mIconsSet;
private final Map<Integer, Key> mKeyCache = new HashMap<Integer, Key>();
- private final KeyboardShiftState mShiftState = new KeyboardShiftState();
+ // TODO: Move this state to KeyboardSwitcher
+ /* package for debug */ final KeyboardShiftState mShiftState = new KeyboardShiftState();
private final ProximityInfo mProximityInfo;
@@ -211,27 +212,15 @@ public class Keyboard {
}
public boolean isAutomaticTemporaryUpperCase() {
- return isAlphaKeyboard() && mShiftState.isAutomaticTemporaryUpperCase();
+ return mId.isAlphabetKeyboard() && mShiftState.isAutomaticTemporaryUpperCase();
}
public boolean isManualTemporaryUpperCase() {
- return isAlphaKeyboard() && mShiftState.isManualTemporaryUpperCase();
+ return mId.isAlphabetKeyboard() && mShiftState.isManualTemporaryUpperCase();
}
public boolean isManualTemporaryUpperCaseFromAuto() {
- return isAlphaKeyboard() && mShiftState.isManualTemporaryUpperCaseFromAuto();
- }
-
- public KeyboardShiftState getKeyboardShiftState() {
- return mShiftState;
- }
-
- public boolean isAlphaKeyboard() {
- return mId.isAlphabetKeyboard();
- }
-
- public boolean isPhoneKeyboard() {
- return mId.isPhoneKeyboard();
+ return mId.isAlphabetKeyboard() && mShiftState.isManualTemporaryUpperCaseFromAuto();
}
public CharSequence adjustLabelCase(CharSequence label) {
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index eff9b4229..bf1e22095 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -450,7 +450,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mInputMethodService.mHandler.cancelUpdateShiftState();
if (DEBUG_STATE) {
Log.d(TAG, "toggleShift:"
- + " keyboard=" + getLatinKeyboard().getKeyboardShiftState()
+ + " keyboard=" + getLatinKeyboard().mShiftState
+ " state=" + mState);
}
if (isAlphabetMode()) {
@@ -464,7 +464,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mInputMethodService.mHandler.cancelUpdateShiftState();
if (DEBUG_STATE) {
Log.d(TAG, "toggleCapsLock:"
- + " keyboard=" + getLatinKeyboard().getKeyboardShiftState()
+ + " keyboard=" + getLatinKeyboard().mShiftState
+ " state=" + mState);
}
if (isAlphabetMode()) {
@@ -482,7 +482,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
public void changeKeyboardMode() {
if (DEBUG_STATE) {
Log.d(TAG, "changeKeyboardMode:"
- + " keyboard=" + getLatinKeyboard().getKeyboardShiftState()
+ + " keyboard=" + getLatinKeyboard().mShiftState
+ " state=" + mState);
}
toggleKeyboardMode();
@@ -507,7 +507,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
if (DEBUG_STATE) {
Log.d(TAG, "updateShiftState:"
+ " autoCaps=" + mInputMethodService.getCurrentAutoCapsState()
- + " keyboard=" + getLatinKeyboard().getKeyboardShiftState()
+ + " keyboard=" + getLatinKeyboard().mShiftState
+ " isAlphabetMode=" + isAlphabetMode
+ " isShiftLocked=" + isShiftLocked
+ " state=" + mState);
@@ -530,7 +530,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
return;
if (DEBUG_STATE) {
Log.d(TAG, "onPressShift:"
- + " keyboard=" + getLatinKeyboard().getKeyboardShiftState()
+ + " keyboard=" + getLatinKeyboard().mShiftState
+ " state=" + mState + " sliding=" + withSliding);
}
final boolean isAlphabetMode = isAlphabetMode();
@@ -567,7 +567,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
return;
if (DEBUG_STATE) {
Log.d(TAG, "onReleaseShift:"
- + " keyboard=" + getLatinKeyboard().getKeyboardShiftState()
+ + " keyboard=" + getLatinKeyboard().mShiftState
+ " state=" + mState + " sliding=" + withSliding);
}
final boolean isAlphabetMode = isAlphabetMode();
@@ -612,7 +612,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
public void onPressSymbol() {
if (DEBUG_STATE) {
Log.d(TAG, "onPressSymbol:"
- + " keyboard=" + getLatinKeyboard().getKeyboardShiftState()
+ + " keyboard=" + getLatinKeyboard().mShiftState
+ " state=" + mState);
}
changeKeyboardMode();
@@ -623,7 +623,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
public void onReleaseSymbol() {
if (DEBUG_STATE) {
Log.d(TAG, "onReleaseSymbol:"
- + " keyboard=" + getLatinKeyboard().getKeyboardShiftState()
+ + " keyboard=" + getLatinKeyboard().mShiftState
+ " state=" + mState);
}
// Snap back to the previous keyboard mode if the user chords the mode change key and
@@ -637,7 +637,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
public void onOtherKeyPressed() {
if (DEBUG_STATE) {
Log.d(TAG, "onOtherKeyPressed:"
- + " keyboard=" + getLatinKeyboard().getKeyboardShiftState()
+ + " keyboard=" + getLatinKeyboard().mShiftState
+ " state=" + mState);
}
mState.onOtherKeyPressed();
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
index 762039625..a9fcd9ac4 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
@@ -176,7 +176,7 @@ public class LatinKeyboard extends Keyboard {
@Override
public CharSequence adjustLabelCase(CharSequence label) {
- if (isAlphaKeyboard() && isShiftedOrShiftLocked() && !TextUtils.isEmpty(label)
+ if (mId.isAlphabetKeyboard() && isShiftedOrShiftLocked() && !TextUtils.isEmpty(label)
&& label.length() < 3 && Character.isLowerCase(label.charAt(0))) {
return label.toString().toUpperCase(mId.mLocale);
}
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index 9ddf40119..af5f808fd 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -177,7 +177,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
public boolean onDoubleTap(MotionEvent firstDown) {
final Keyboard keyboard = getKeyboard();
if (ENABLE_CAPSLOCK_BY_DOUBLETAP && keyboard instanceof LatinKeyboard
- && ((LatinKeyboard) keyboard).isAlphaKeyboard()) {
+ && ((LatinKeyboard) keyboard).mId.isAlphabetKeyboard()) {
final int pointerIndex = firstDown.getActionIndex();
final int id = firstDown.getPointerId(pointerIndex);
final PointerTracker tracker = getPointerTracker(id);
@@ -396,14 +396,14 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
final Keyboard keyboard = getKeyboard();
if (keyboard instanceof LatinKeyboard) {
final LatinKeyboard latinKeyboard = (LatinKeyboard) keyboard;
- if (primaryCode == Keyboard.CODE_DIGIT0 && latinKeyboard.isPhoneKeyboard()) {
+ if (primaryCode == Keyboard.CODE_DIGIT0 && latinKeyboard.mId.isPhoneKeyboard()) {
tracker.onLongPressed();
// Long pressing on 0 in phone number keypad gives you a '+'.
invokeCodeInput(Keyboard.CODE_PLUS);
invokeReleaseKey(primaryCode);
return true;
}
- if (primaryCode == Keyboard.CODE_SHIFT && latinKeyboard.isAlphaKeyboard()) {
+ if (primaryCode == Keyboard.CODE_SHIFT && latinKeyboard.mId.isAlphabetKeyboard()) {
tracker.onLongPressed();
invokeCodeInput(Keyboard.CODE_CAPSLOCK);
invokeReleaseKey(primaryCode);