aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/inputmethod/latin/LatinIME.java13
-rw-r--r--src/com/android/inputmethod/latin/WordComposer.java16
2 files changed, 25 insertions, 4 deletions
diff --git a/src/com/android/inputmethod/latin/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java
index eec78a167..3dfdc5f1f 100644
--- a/src/com/android/inputmethod/latin/LatinIME.java
+++ b/src/com/android/inputmethod/latin/LatinIME.java
@@ -71,6 +71,7 @@ public class LatinIME extends InputMethodService
private static final int MSG_UPDATE_SUGGESTIONS = 0;
private static final int MSG_START_TUTORIAL = 1;
+ private static final int MSG_UPDATE_SHIFT_STATE = 2;
// How many continuous deletes at which to start deleting at a higher speed.
private static final int DELETE_ACCELERATE_AT = 20;
@@ -153,6 +154,9 @@ public class LatinIME extends InputMethodService
}
}
break;
+ case MSG_UPDATE_SHIFT_STATE:
+ updateShiftKeyState(getCurrentInputEditorInfo());
+ break;
}
}
};
@@ -321,7 +325,7 @@ public class LatinIME extends InputMethodService
}
mPredictionOn = mPredictionOn && mCorrectionMode > 0;
checkTutorial(attribute.privateImeOptions);
- if (TRACE) Debug.startMethodTracing("latinime");
+ if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
}
@Override
@@ -622,7 +626,8 @@ public class LatinIME extends InputMethodService
} else {
deleteChar = true;
}
- updateShiftKeyState(getCurrentInputEditorInfo());
+ mHandler.removeMessages(MSG_UPDATE_SHIFT_STATE);
+ mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_SHIFT_STATE), 300);
TextEntryState.backspace();
if (TextEntryState.getState() == TextEntryState.STATE_UNDO_COMMIT) {
revertLastWord(deleteChar);
@@ -772,7 +777,9 @@ public class LatinIME extends InputMethodService
if (mCorrectionMode == Suggest.CORRECTION_FULL) {
correctionAvailable |= typedWordValid;
}
-
+ // Don't auto-correct words with multiple capital letter
+ correctionAvailable &= !mWord.isMostlyCaps();
+
mCandidateView.setSuggestions(stringList, false, typedWordValid, correctionAvailable);
if (stringList.size() > 0) {
if (correctionAvailable && !typedWordValid && stringList.size() > 1) {
diff --git a/src/com/android/inputmethod/latin/WordComposer.java b/src/com/android/inputmethod/latin/WordComposer.java
index c950a7f18..6679fca76 100644
--- a/src/com/android/inputmethod/latin/WordComposer.java
+++ b/src/com/android/inputmethod/latin/WordComposer.java
@@ -34,6 +34,8 @@ public class WordComposer {
private String mPreferredWord;
private StringBuilder mTypedWord;
+
+ private int mCapsCount;
/**
* Whether the user chose to capitalize the word.
@@ -53,6 +55,7 @@ public class WordComposer {
mIsCapitalized = false;
mPreferredWord = null;
mTypedWord.setLength(0);
+ mCapsCount = 0;
}
/**
@@ -80,6 +83,7 @@ public class WordComposer {
public void add(int primaryCode, int[] codes) {
mTypedWord.append((char) primaryCode);
mCodes.add(codes);
+ if (Character.isUpperCase((char) primaryCode)) mCapsCount++;
}
/**
@@ -87,7 +91,10 @@ public class WordComposer {
*/
public void deleteLast() {
mCodes.remove(mCodes.size() - 1);
- mTypedWord.deleteCharAt(mTypedWord.length() - 1);
+ final int lastPos = mTypedWord.length() - 1;
+ char last = mTypedWord.charAt(lastPos);
+ mTypedWord.deleteCharAt(lastPos);
+ if (Character.isUpperCase(last)) mCapsCount--;
}
/**
@@ -138,4 +145,11 @@ public class WordComposer {
public CharSequence getPreferredWord() {
return mPreferredWord != null ? mPreferredWord : getTypedWord();
}
+
+ /**
+ * Returns true if more than one character is upper case, otherwise returns false.
+ */
+ public boolean isMostlyCaps() {
+ return mCapsCount > 1;
+ }
}