Removing crossfades that might reduce the loading speed

This commit is contained in:
Vitor Pamplona
2023-05-06 20:59:09 -04:00
parent 25a34dd2e8
commit dc0fe75b3d
4 changed files with 15 additions and 14 deletions
@@ -59,7 +59,6 @@ object BlurHashRequester {
.Builder(context) .Builder(context)
.data("bluehash:$encodedMessage") .data("bluehash:$encodedMessage")
.fetcherFactory(BlurHashFetcher.Factory) .fetcherFactory(BlurHashFetcher.Factory)
.crossfade(100)
.build() .build()
} }
} }
@@ -92,7 +92,6 @@ object Robohash {
.data("robohash:$message") .data("robohash:$message")
.fetcherFactory(HashImageFetcher.Factory) .fetcherFactory(HashImageFetcher.Factory)
.size(robotSize) .size(robotSize)
.crossfade(100)
.build() .build()
} }
} }
@@ -337,9 +337,10 @@ private fun aspectRatio(dim: String?): Float? {
@Composable @Composable
private fun DisplayUrlWithLoadingSymbol(content: ZoomableContent) { private fun DisplayUrlWithLoadingSymbol(content: ZoomableContent) {
var cnt by remember { mutableStateOf<ZoomableContent?>(null) } var cnt by remember { mutableStateOf<ZoomableContent?>(null) }
val scope = rememberCoroutineScope()
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
withContext(Dispatchers.IO) { scope.launch(Dispatchers.IO) {
delay(200) delay(200)
cnt = content cnt = content
} }
@@ -92,18 +92,20 @@ private fun OptionNote(
var optionTally by remember { mutableStateOf(Pair(BigDecimal.ZERO, defaultColor)) } var optionTally by remember { mutableStateOf(Pair(BigDecimal.ZERO, defaultColor)) }
LaunchedEffect(key1 = optionNumber, key2 = pollViewModel) { LaunchedEffect(key1 = optionNumber, key2 = pollViewModel) {
val myTally = pollViewModel.optionVoteTally(optionNumber) withContext(Dispatchers.IO) {
val color = if ( val myTally = pollViewModel.optionVoteTally(optionNumber)
pollViewModel.consensusThreshold != null && val color = if (
myTally >= pollViewModel.consensusThreshold!! pollViewModel.consensusThreshold != null &&
) { myTally >= pollViewModel.consensusThreshold!!
Color.Green.copy(alpha = 0.32f) ) {
} else { Color.Green.copy(alpha = 0.32f)
defaultColor } else {
} defaultColor
}
if (myTally > optionTally.first || color != optionTally.second) { if (myTally > optionTally.first || color != optionTally.second) {
optionTally = Pair(myTally, color) optionTally = Pair(myTally, color)
}
} }
} }