diff --git a/api/core/src/commonMain/kotlin/cz/lastaapps/api/core/domain/model/dish/Dish.kt b/api/core/src/commonMain/kotlin/cz/lastaapps/api/core/domain/model/dish/Dish.kt index 940e8148..8484e88c 100644 --- a/api/core/src/commonMain/kotlin/cz/lastaapps/api/core/domain/model/dish/Dish.kt +++ b/api/core/src/commonMain/kotlin/cz/lastaapps/api/core/domain/model/dish/Dish.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2025, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -218,6 +218,25 @@ data class Dish( ingredients = persistentListOf(), isActive = true, ) + val dishMisterious = + Dish( + menza = MenzaType.Testing.Kocourkov, + id = DishID.testing(), + language = Czech, + amount = "??? g", + name = "Záludnost", + priceDiscounted = 42.0f, + priceNormal = 69.0f, + allergens = persistentListOf(1, 2, 3), + photoLink = "https://blbost.kravina.haha", + pictogram = persistentListOf(), + servingPlaces = + persistentListOf( + ServingPlace("Magistrát", "J"), + ), + ingredients = persistentListOf(), + isActive = true, + ) val desertKrtkuvDort = Dish( menza = MenzaType.Testing.Kocourkov, diff --git a/api/core/src/commonMain/kotlin/cz/lastaapps/api/core/domain/model/dish/DishCategory.kt b/api/core/src/commonMain/kotlin/cz/lastaapps/api/core/domain/model/dish/DishCategory.kt index 893b180d..908120d9 100644 --- a/api/core/src/commonMain/kotlin/cz/lastaapps/api/core/domain/model/dish/DishCategory.kt +++ b/api/core/src/commonMain/kotlin/cz/lastaapps/api/core/domain/model/dish/DishCategory.kt @@ -63,6 +63,7 @@ data class DishCategory( Dish.Mock.dishTux, Dish.Mock.dishKunda, Dish.Mock.dishMaxipes, + Dish.Mock.dishMisterious, ), ) val dezerty = diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/today/ui/widget/DishImage.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/today/ui/widget/DishImage.kt index 5d4c3b21..d55961a2 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/today/ui/widget/DishImage.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/today/ui/widget/DishImage.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2025, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -51,7 +51,6 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import coil3.Extras import coil3.compose.SubcomposeAsyncImage import coil3.request.CachePolicy import coil3.request.ImageRequest.Builder @@ -125,7 +124,7 @@ internal fun DishImage( with(Builder(LocalContext.current)) { diskCacheKey(photoLink) memoryCacheKey(photoLink) - extras[Extras.Key("retry_hash")] = retryHash + memoryCacheKeyExtra("retry_hash", retryHash.toString()) // if user is not on a metered network, images are going to be loaded from cache if (!canDownload) { @@ -235,9 +234,9 @@ private fun DishImageSupplementPreview() = remember { Random.nextInt() }, color = it, modifier = - Modifier - .padding(12.dp) - .aspectRatio(DishImageTokens.ASPECT_RATIO), + Modifier + .padding(12.dp) + .aspectRatio(DishImageTokens.ASPECT_RATIO), ) } } diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/today/ui/widget/TodayDishCarousel.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/today/ui/widget/TodayDishCarousel.kt index 1ef856a0..f21a463b 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/today/ui/widget/TodayDishCarousel.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/today/ui/widget/TodayDishCarousel.kt @@ -236,15 +236,12 @@ private fun DishContent( HorizontalMultiBrowseCarousel( state = carouselState, preferredItemWidth = preferredItemSize, - // TODO revert -// minSmallItemWidth = 64.dp, -// maxSmallItemWidth = 128.dp, - minSmallItemWidth = 20.dp, - maxSmallItemWidth = 40.dp, + minSmallItemWidth = 64.dp, + maxSmallItemWidth = 128.dp, itemSpacing = Padding.MidSmall, modifier = - Modifier - .fillMaxWidth(), + Modifier + .fillMaxWidth(), // .animateItem(), ) { index -> val dish = category.dishList[index] @@ -346,49 +343,48 @@ private fun DishItem( val shape = MaterialTheme.shapes.extraLarge Box( modifier = - modifier - .clickable { onDish(dish) } - .also { - // this is ignored for now - it - .sharedContainer( - scopes, - dishContainerKey(dish.id), - // resizeMode = ResizeMode.RemeasureToBounds, - resizeMode = - ResizeMode.ScaleToBounds( - contentScale = ContentScale.Crop, - alignment = Alignment.CenterStart, - ), - clipInOverlayDuringTransition = - object : OverlayClip { - override fun getClipPath( - sharedContentState: SharedContentState, - bounds: Rect, - layoutDirection: LayoutDirection, - density: Density, - ): Path? { - val newRect = - size?.let { - bounds.copy( - left = bounds.center.x - size() / 2f, - right = bounds.center.x + size() / 2f, - ) - bounds.copy( - right = bounds.left + size(), - ) - } ?: bounds - return OverlayParentClip(shape) - .getClipPath( - sharedContentState, - newRect, - layoutDirection, + modifier + .clickable { onDish(dish) } + .also { + // this is ignored for now + it + .sharedContainer( + scopes, + dishContainerKey(dish.id), + // resizeMode = ResizeMode.RemeasureToBounds, + resizeMode = + ResizeMode.ScaleToBounds( + contentScale = ContentScale.Crop, + alignment = Alignment.CenterStart, + ), + clipInOverlayDuringTransition = + object : OverlayClip { + override fun getClipPath( + sharedContentState: SharedContentState, + bounds: Rect, + layoutDirection: LayoutDirection, + density: Density, + ): Path? { + val newRect = + size?.let { + bounds.copy( + left = bounds.center.x - size() / 2f, + right = bounds.center.x + size() / 2f, + ) + bounds.copy( + right = bounds.left + size(), + ) + } ?: bounds + return OverlayParentClip(shape) + .getClipPath( + sharedContentState, + newRect, + layoutDirection, density, ) } }, - ) - .sharedElement(scopes, key = dishImageKey(dish.id)) + ).sharedElement(scopes, key = dishImageKey(dish.id)) }, ) { DishImageOrSupplement(