mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Trying to wait for emoji lib to have loaded before displaying account display name, in case it contains emoji(s)
This commit is contained in:
parent
f19fbb66e7
commit
719fa62752
3 changed files with 25 additions and 21 deletions
|
|
@ -608,26 +608,6 @@ class MainActivity : GenericActivity() {
|
|||
|
||||
private fun loadContacts() {
|
||||
coreContext.contactsManager.loadContacts(this)
|
||||
|
||||
/* TODO: Uncomment later, only fixes a small UI display issue for contacts with emoji in the name
|
||||
val emojiCompat = coreContext.emojiCompat
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
// Wait for emoji compat library to have been loaded
|
||||
Log.i("[Main Activity] Waiting for emoji compat library to have been loaded")
|
||||
while (emojiCompat.loadState == EmojiCompat.LOAD_STATE_DEFAULT || emojiCompat.loadState == EmojiCompat.LOAD_STATE_LOADING) {
|
||||
delay(100)
|
||||
}
|
||||
|
||||
Log.i(
|
||||
"[Main Activity] Emoji compat library loading status is ${emojiCompat.loadState}, re-loading contacts"
|
||||
)
|
||||
coreContext.postOnMainThread {
|
||||
// Contacts loading must be started from UI thread
|
||||
coreContext.contactsManager.loadContacts(this@MainActivity)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private fun showAuthenticationRequestedDialog(identity: String) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
package org.linphone.ui.main.fragment
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.annotation.IdRes
|
||||
import androidx.annotation.UiThread
|
||||
|
|
@ -51,6 +52,10 @@ abstract class AbstractTopBarFragment : GenericFragment() {
|
|||
|
||||
abstract fun onDefaultAccountChanged()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
fun initSlidingPane(slidingPane: SlidingPaneLayout) {
|
||||
val slidingPaneBackPressedCallback = SlidingPaneBackPressedCallback(slidingPane)
|
||||
requireActivity().onBackPressedDispatcher.addCallback(
|
||||
|
|
|
|||
|
|
@ -21,8 +21,14 @@ package org.linphone.ui.main.viewmodel
|
|||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.emoji2.text.EmojiCompat
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.core.Account
|
||||
|
|
@ -147,7 +153,20 @@ open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() {
|
|||
init {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
core.addListener(coreListener)
|
||||
configure()
|
||||
}
|
||||
|
||||
val emojiCompat = coreContext.emojiCompat
|
||||
viewModelScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
// Wait for emoji compat library to have been loaded
|
||||
Log.i("$TAG Waiting for emoji compat library to have been loaded")
|
||||
while (emojiCompat.loadState == EmojiCompat.LOAD_STATE_DEFAULT || emojiCompat.loadState == EmojiCompat.LOAD_STATE_LOADING) {
|
||||
delay(50)
|
||||
}
|
||||
coreContext.postOnCoreThread {
|
||||
configure()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
searchBarVisible.value = false
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue