Merge "ResearchLogger switch word segmentation"

main
Kurt Partridge 2012-11-30 11:52:08 -08:00 committed by Android (Google) Code Review
commit fdfa03c9f1
1 changed files with 5 additions and 5 deletions

View File

@ -733,20 +733,20 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
researchLog.publish(closingLogUnit, true /* isIncludingPrivateData */); researchLog.publish(closingLogUnit, true /* isIncludingPrivateData */);
} }
private boolean hasOnlyLetters(final String word) { private boolean hasLetters(final String word) {
final int length = word.length(); final int length = word.length();
for (int i = 0; i < length; i = word.offsetByCodePoints(i, 1)) { for (int i = 0; i < length; i = word.offsetByCodePoints(i, 1)) {
final int codePoint = word.codePointAt(i); final int codePoint = word.codePointAt(i);
if (!Character.isLetter(codePoint)) { if (Character.isLetter(codePoint)) {
return false; return true;
} }
} }
return true; return false;
} }
private void onWordComplete(final String word) { private void onWordComplete(final String word) {
Log.d(TAG, "onWordComplete: " + word); Log.d(TAG, "onWordComplete: " + word);
if (word != null && word.length() > 0 && hasOnlyLetters(word)) { if (word != null && word.length() > 0 && hasLetters(word)) {
mCurrentLogUnit.setWord(word); mCurrentLogUnit.setWord(word);
mStatistics.recordWordEntered(); mStatistics.recordWordEntered();
} }