feat: added parallel icons loading
This commit is contained in:
@@ -54,6 +54,7 @@ import io.ktor.client.engine.cio.CIO
|
|||||||
import io.ktor.client.request.get
|
import io.ktor.client.request.get
|
||||||
import io.ktor.client.statement.HttpResponse
|
import io.ktor.client.statement.HttpResponse
|
||||||
import io.ktor.client.statement.bodyAsText
|
import io.ktor.client.statement.bodyAsText
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import ru.omni_devel.cards.ui.theme.OmniCardsTheme
|
import ru.omni_devel.cards.ui.theme.OmniCardsTheme
|
||||||
|
|
||||||
class SelectIconActivity : ComponentActivity() {
|
class SelectIconActivity : ComponentActivity() {
|
||||||
@@ -94,6 +95,7 @@ fun SelectIconPage(innerPadding: PaddingValues) {
|
|||||||
|
|
||||||
for (iconData in loadedIconsData) {
|
for (iconData in loadedIconsData) {
|
||||||
if (iconData.iconId != null) {
|
if (iconData.iconId != null) {
|
||||||
|
launch {
|
||||||
val response = client.get("$REPO_BASE_URL/icons/${iconData.iconId}.png")
|
val response = client.get("$REPO_BASE_URL/icons/${iconData.iconId}.png")
|
||||||
val bytes: ByteArray = response.body()
|
val bytes: ByteArray = response.body()
|
||||||
|
|
||||||
@@ -102,6 +104,7 @@ fun SelectIconPage(innerPadding: PaddingValues) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
loadingError = e.toString()
|
loadingError = e.toString()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user