fix bug of ANR -> Async Html load text

This commit is contained in:
unknown
2020-04-09 17:37:47 +08:00
parent 4a83890a33
commit 8b9096a6be

View File

@@ -15,6 +15,10 @@ import com.mogo.module.authorize.voice.IVoiceCommandListener
import com.mogo.module.authorize.voice.IVoiceAuthorizeIntentListener
import com.mogo.module.authorize.voice.VoiceUtil
import com.mogo.utils.logger.Logger
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.withContext
class AuthorizeFragment : MvpFragment<AuthorizeContract.View, AuthorizePresenter>(), AuthorizeContract.View, View.OnClickListener, IVoiceCommandListener, IVoiceAuthorizeIntentListener {
@@ -105,7 +109,12 @@ class AuthorizeFragment : MvpFragment<AuthorizeContract.View, AuthorizePresenter
clLoadAuthorizeContainer?.visibility = View.GONE
clContainer?.visibility = View.VISIBLE
tvTitle?.text = Html.fromHtml(agreementTitle)
tvContent?.text = Html.fromHtml(agreementContent)
GlobalScope.async(Dispatchers.IO) {
val spannable = Html.fromHtml(agreementContent)
withContext(Dispatchers.Main){
tvContent?.text = spannable
}
}
tvButtonContent?.text = Html.fromHtml(agreementBottom)
tvLastContent?.text = Html.fromHtml(agreementLast)
}