https://kotlinlang.org logo
#compose
Title
# compose
m

MBegemot

05/12/2020, 3:21 PM
code
Copy code
```fun getLHeadlines(lhd:MutableList<OriginalTransLink>, statusApp: StatusApp){
    println("getLHeadLines")
    statusApp.currentStatus = AppStatus.Loading
    GlobalScope.launch(Dispatchers.Main) {
        val LA = getJSoupHeadlines()   //<-- suspend function runing on IO

        val sb=StringBuilder()
        LA.forEach{ sb.append(it.title) }
        val rt=translate(sb.toString(),statusApp.lang)    //<-- suspend function runing on IO
        val q=(rt as ResultTranslation.ResultList).Lorigtrans

        val JJ=LA.zip(q,{a,c->OriginalTransLink(a,c.translated)})
        lhd.clear()
        lhd.addAll(JJ)
        statusApp.currentStatus = AppStatus.Idle
    }
}```