diff options
author | 2013-04-23 12:19:31 +0900 | |
---|---|---|
committer | 2013-04-25 20:29:14 +0900 | |
commit | bb61293675234f6e5e1312db70618be985b37a83 (patch) | |
tree | 373a4f831a86df0f81ce1bddd1c28082d62c30e2 /java/src/com/android/inputmethod/latin/BinaryDictionary.java | |
parent | 99e998286d71cf698d0a809a29b15d1a231ebbb1 (diff) | |
download | latinime-bb61293675234f6e5e1312db70618be985b37a83.tar.gz latinime-bb61293675234f6e5e1312db70618be985b37a83.tar.xz latinime-bb61293675234f6e5e1312db70618be985b37a83.zip |
[ZF2] Read settings for profanity filtering.
Bug: 7226877
Change-Id: Ie0c713e1eba1529c0b288a1e5011023a79bedd6b
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionary.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 03f7d1c10..c8c7bb456 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -139,6 +139,8 @@ public final class BinaryDictionary extends Dictionary { inputSize, 0 /* commitPoint */, isGesture, prevWordCodePointArray, mUseFullEditDistance, mOutputCodePoints, mOutputScores, mSpaceIndices, mOutputTypes); + final boolean blockPotentiallyOffensive = + Settings.getInstance().getBlockPotentiallyOffensive(); final ArrayList<SuggestedWordInfo> suggestions = CollectionUtils.newArrayList(); for (int j = 0; j < count; ++j) { final int start = j * MAX_WORD_LENGTH; @@ -148,10 +150,11 @@ public final class BinaryDictionary extends Dictionary { } if (len > 0) { final int flags = mOutputTypes[j] & SuggestedWordInfo.KIND_MASK_FLAGS; - if (0 != (flags & SuggestedWordInfo.KIND_FLAG_POSSIBLY_OFFENSIVE) + if (blockPotentiallyOffensive + && 0 != (flags & SuggestedWordInfo.KIND_FLAG_POSSIBLY_OFFENSIVE) && 0 == (flags & SuggestedWordInfo.KIND_FLAG_EXACT_MATCH)) { - // If the word is possibly offensive, we don't output it unless it's also - // an exact match. + // If we block potentially offensive words, and if the word is possibly + // offensive, then we don't output it unless it's also an exact match. continue; } final int kind = mOutputTypes[j] & SuggestedWordInfo.KIND_MASK_KIND; |