mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-02 04:42:28 +00:00
don't suggest unsuported emojis
and invert isSupported to isUnsupported to avoid confusion what happens when asking about non-emojis
This commit is contained in:
parent
35df3e7bae
commit
a0f77c1392
3 changed files with 6 additions and 5 deletions
|
@ -22,5 +22,5 @@ object SupportedEmojis {
|
|||
Log.i("test", "have ${unsupportedEmojis.size}, longest emoji: ${unsupportedEmojis.maxOfOrNull { it.length }}")
|
||||
}
|
||||
|
||||
fun isSupported(emoji: String) = emoji !in unsupportedEmojis
|
||||
fun isUnsupported(emoji: String) = emoji in unsupportedEmojis
|
||||
}
|
||||
|
|
|
@ -78,13 +78,13 @@ class EmojiParser(private val params: KeyboardParams, private val context: Conte
|
|||
private fun parseEmojiKeyNew(line: String): KeyParams? {
|
||||
if (!line.contains(" ") || params.mId.mElementId == KeyboardId.ELEMENT_EMOJI_CATEGORY10) {
|
||||
// single emoji without popups, or emoticons (there is one that contains space...)
|
||||
return if (!SupportedEmojis.isSupported(line)) null
|
||||
return if (SupportedEmojis.isUnsupported(line)) null
|
||||
else KeyParams(line, line.getCode(), null, null, Key.LABEL_FLAGS_FONT_NORMAL, params)
|
||||
}
|
||||
val split = line.split(" ")
|
||||
val label = split.first()
|
||||
if (!SupportedEmojis.isSupported(label)) return null
|
||||
val popupKeysSpec = split.drop(1).filter { SupportedEmojis.isSupported(it) }
|
||||
if (SupportedEmojis.isUnsupported(label)) return null
|
||||
val popupKeysSpec = split.drop(1).filterNot { SupportedEmojis.isUnsupported(it) }
|
||||
.takeIf { it.isNotEmpty() }?.joinToString(",")
|
||||
return KeyParams(
|
||||
label,
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import helium314.keyboard.keyboard.Keyboard;
|
||||
import helium314.keyboard.keyboard.emoji.SupportedEmojis;
|
||||
import helium314.keyboard.latin.NgramContext.WordInfo;
|
||||
import helium314.keyboard.latin.SuggestedWords.SuggestedWordInfo;
|
||||
import helium314.keyboard.latin.common.ComposedData;
|
||||
|
@ -885,7 +886,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
|||
final boolean checkForGarbage = composedData.mIsBatchMode && (dictType.equals(Dictionary.TYPE_USER_HISTORY) || dictType.equals(Dictionary.TYPE_MAIN));
|
||||
for (SuggestedWordInfo info : dictionarySuggestions) {
|
||||
final String word = info.getWord();
|
||||
if (!isBlacklisted(word)) { // don't add blacklisted words
|
||||
if (!isBlacklisted(word) && !SupportedEmojis.INSTANCE.isUnsupported(word)) { // don't add blacklisted words and unsupported emojis
|
||||
if (checkForGarbage
|
||||
// only check history and "main main dictionary"
|
||||
// consider the user might use custom main dictionary containing shortcuts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue