mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Merge "ResearchLogger switch word segmentation"
This commit is contained in:
commit
fdfa03c9f1
@ -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();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user