Logging issues

- Swap user's input and auto suggested words if they are same
- Set user's input blank if punctuation is selected
- Not count when user's input has one or more digit

Change-Id: I8bbe1cb43287c06f8e284ada0712b1b9ec714dc3
main
satok 2010-05-31 20:20:48 +09:00
parent 352f8bc9a3
commit c03c7cb268
2 changed files with 12 additions and 3 deletions

View File

@ -1551,9 +1551,9 @@ public class LatinIME extends InputMethodService
// If this is a punctuation, apply it through the normal key press
if (suggestion.length() == 1 && isWordSeparator(suggestion.charAt(0))) {
// Word separators are suggested before the user inputs something.
// So, LatinImeLogger logs suggestion.charAt(0) as a user's input.
// So, LatinImeLogger logs "" as a user's input.
LatinImeLogger.logOnClickSuggestion(
suggestion.toString(), suggestion.toString(), index);
"", suggestion.toString(), index);
onKey(suggestion.charAt(0), null);
if (ic != null) {
ic.endBatchEdit();

View File

@ -135,7 +135,12 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
if (sDBG) {
Log.d(TAG, "Check String safety: " + s);
}
return !TextUtils.isDigitsOnly(s);
for (int i = 0; i < s.length(); ++i) {
if (Character.isDigit(s.charAt(i))) {
return false;
}
}
return true;
}
private void addCountEntry(long time) {
@ -344,6 +349,10 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
public static void logOnAutoSuggestion(String before, String after) {
if (sLogEnabled) {
if (before.equals(after)) {
before = "";
after = "";
}
String[] strings = new String[] {before, after};
synchronized (LatinImeLogger.class) {
sLastAutoSuggestBefore = before;