From 4c938bf596142ba05d510d8e4c108e983b17f02c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Muller?= Date: Thu, 16 Nov 2023 15:34:40 +0100 Subject: [PATCH] Extract width definition in a variable --- .../demo/shared/ui/integrationLayer/ContentListViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/ui/integrationLayer/ContentListViewModel.kt b/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/ui/integrationLayer/ContentListViewModel.kt index 3d0a034c3..f2cdebcf0 100644 --- a/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/ui/integrationLayer/ContentListViewModel.kt +++ b/pillarbox-demo-shared/src/main/java/ch/srgssr/pillarbox/demo/shared/ui/integrationLayer/ContentListViewModel.kt @@ -15,6 +15,7 @@ import ch.srg.dataProvider.integrationlayer.data.IlImage import ch.srgssr.pillarbox.core.business.images.DefaultImageScalingService import ch.srgssr.pillarbox.core.business.images.ImageScalingService import ch.srgssr.pillarbox.core.business.images.ImageScalingService.ImageFormat +import ch.srgssr.pillarbox.core.business.images.ImageScalingService.ImageWidth import ch.srgssr.pillarbox.demo.shared.ui.integrationLayer.data.Content import ch.srgssr.pillarbox.demo.shared.ui.integrationLayer.data.ILRepository import kotlinx.coroutines.flow.Flow @@ -98,10 +99,11 @@ class ContentListViewModel( format: ImageFormat = ImageFormat.WEBP ): String { val size = IlImage.Size.getClosest(containerWidth) + val width = enumValueOf(size.name) return imageScalingService.getScaledImageUrl( imageUrl = imageUrl, - width = enumValueOf(size.name), + width = width, format = format ) }