mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-28 11:49:56 +00:00
add missing file
This commit is contained in:
parent
fb4bfd7ed2
commit
b765336821
1 changed files with 26 additions and 0 deletions
|
@ -0,0 +1,26 @@
|
||||||
|
package helium314.keyboard.keyboard.emoji
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import helium314.keyboard.latin.settings.Defaults
|
||||||
|
import helium314.keyboard.latin.settings.Settings
|
||||||
|
import helium314.keyboard.latin.utils.Log
|
||||||
|
import helium314.keyboard.latin.utils.prefs
|
||||||
|
|
||||||
|
object SupportedEmojis {
|
||||||
|
private val unsupportedEmojis = hashSetOf<String>()
|
||||||
|
|
||||||
|
fun load(context: Context) {
|
||||||
|
val maxSdk = context.prefs().getInt(Settings.PREF_EMOJI_MAX_SDK, Defaults.PREF_EMOJI_MAX_SDK)
|
||||||
|
Log.i("test", "max $maxSdk")
|
||||||
|
unsupportedEmojis.clear()
|
||||||
|
context.assets.open("emoji/minApi.txt").reader().readLines().forEach {
|
||||||
|
val s = it.split(" ")
|
||||||
|
val minApi = s.first().toInt()
|
||||||
|
if (minApi > maxSdk)
|
||||||
|
unsupportedEmojis.addAll(s.drop(1))
|
||||||
|
}
|
||||||
|
Log.i("test", "have ${unsupportedEmojis.size}, longest emoji: ${unsupportedEmojis.maxOfOrNull { it.length }}")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isSupported(emoji: String) = emoji !in unsupportedEmojis
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue