Commit fbc7df8a authored by Lucio Maciel's avatar Lucio Maciel

Initialize typeface on init

parent 9567523e
......@@ -173,6 +173,7 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje
* but custom emojis vary according to the its url.
*/
fun loadEmojis() {
EmojiRepository.loadTypeface(this)
val currentServer = getCurrentServerInteractor.get()
currentServer?.let { server ->
launch {
......
......@@ -48,7 +48,11 @@ object EmojiRepository {
this@EmojiRepository.customEmojis = customEmojis
val allEmojis = mutableListOf<Emoji>()
db = EmojiDatabase.getInstance(context)
cachedTypeface = Typeface.createFromAsset(context.assets, "fonts/emojione-android.ttf")
if (!::cachedTypeface.isInitialized) {
cachedTypeface = Typeface.createFromAsset(context.assets, "fonts/emojione-android.ttf")
}
preferences = context.getSharedPreferences("emoji", Context.MODE_PRIVATE)
val stream = context.assets.open(path)
// Load emojis from emojione ttf file temporarily here. We still need to work on them.
......@@ -309,4 +313,10 @@ object EmojiRepository {
val s2: Int = ((scalar - 0x10000) % 0x400) + 0xDC00
return Pair(s1, s2)
}
fun loadTypeface(context: Context) {
launch {
cachedTypeface = Typeface.createFromAsset(context.assets, "fonts/emojione-android.ttf")
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment