Use immutable collections in presentation-widget module

This commit is contained in:
arkon
2023-11-11 18:31:27 -05:00
parent 4a6571d310
commit 3c3b09209c
6 changed files with 13 additions and 5 deletions

View File

@ -30,6 +30,8 @@ import coil.size.Scale
import coil.transform.RoundedCornersTransformation
import eu.kanade.tachiyomi.core.security.SecurityPreferences
import eu.kanade.tachiyomi.util.system.dpToPx
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.flow.map
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.domain.manga.model.MangaCover
@ -106,7 +108,7 @@ abstract class BaseUpdatesGridGlanceWidget(
private suspend fun List<UpdatesWithRelations>.prepareData(
rowCount: Int,
columnCount: Int,
): List<Pair<Long, Bitmap?>> {
): ImmutableList<Pair<Long, Bitmap?>> {
// Resize to cover size
val widthPx = CoverWidth.value.toInt().dpToPx
val heightPx = CoverHeight.value.toInt().dpToPx
@ -140,6 +142,7 @@ abstract class BaseUpdatesGridGlanceWidget(
.build()
Pair(updatesView.mangaId, context.imageLoader.executeBlocking(request).drawable?.toBitmap())
}
.toImmutableList()
}
}