Move DeviceType and card size presets into the shared KMP module

DeviceType/LocalDeviceType/touchClickable and the four poster/
horizontal card size preset functions were pure Compose (no Android
imports beyond foundation.clickable, which is multiplatform) — same
straight move as FluxaColors/FluxaDimensions, same package name, zero
call-site changes across the 38 files that reference them.

This unblocks moving more of the mobile card layout math into :shared
later, since the device-aware sizing helpers no longer live only in
the Android-only app module.

Verified compiling for android, iosArm64, iosSimulatorArm64, and both
app product flavors still build.
This commit is contained in:
KhooLy 2026-07-13 03:02:30 +03:00
parent ddb556cb27
commit 89ee3eb95f
3 changed files with 32 additions and 33 deletions

View file

@ -123,34 +123,6 @@ fun posterCornerRadius(value: String): Dp = with(FluxaDimensions.CornerPresets)
}
}
fun posterCardWidth(value: String): Dp = with(FluxaDimensions.PosterPresets) {
when (value) {
"xsmall" -> xsmall
"small" -> small
"large" -> large
"xlarge" -> xlarge
else -> medium
}
}
fun posterCardHeight(value: String): Dp = posterCardWidth(value) * FluxaDimensions.PosterPresets.heightRatio
fun horizontalCardWidth(value: String, deviceType: DeviceType): Dp {
val base = if (deviceType == DeviceType.TV) FluxaDimensions.HorizontalCard.tvBase else FluxaDimensions.HorizontalCard.mobileBase
val delta = with(FluxaDimensions.HorizontalCard) {
when (value) {
"xsmall" -> deltaXsmall
"small" -> deltaSmall
"large" -> deltaLarge
"xlarge" -> deltaXlarge
else -> 0.dp
}
}
return base + delta
}
fun horizontalCardHeight(value: String, deviceType: DeviceType): Dp = horizontalCardWidth(value, deviceType) * FluxaDimensions.HorizontalCard.heightRatio
fun horizontalArtworkCandidates(meta: Meta, preferContinueWatchingArtwork: Boolean = false): List<String> {
val existingBackdrop = meta.background
?.takeIf { it.isNotBlank() }

View file

@ -0,0 +1,32 @@
package com.fluxa.app.ui.catalog
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
fun posterCardWidth(value: String): Dp = with(FluxaDimensions.PosterPresets) {
when (value) {
"xsmall" -> xsmall
"small" -> small
"large" -> large
"xlarge" -> xlarge
else -> medium
}
}
fun posterCardHeight(value: String): Dp = posterCardWidth(value) * FluxaDimensions.PosterPresets.heightRatio
fun horizontalCardWidth(value: String, deviceType: DeviceType): Dp {
val base = if (deviceType == DeviceType.TV) FluxaDimensions.HorizontalCard.tvBase else FluxaDimensions.HorizontalCard.mobileBase
val delta = with(FluxaDimensions.HorizontalCard) {
when (value) {
"xsmall" -> deltaXsmall
"small" -> deltaSmall
"large" -> deltaLarge
"xlarge" -> deltaXlarge
else -> 0.dp
}
}
return base + delta
}
fun horizontalCardHeight(value: String, deviceType: DeviceType): Dp = horizontalCardWidth(value, deviceType) * FluxaDimensions.HorizontalCard.heightRatio

View file

@ -1,10 +1,5 @@
package com.fluxa.app.ui.catalog
import com.fluxa.app.data.local.*
import com.fluxa.app.data.remote.*
import com.fluxa.app.data.repository.*
import com.fluxa.app.domain.discovery.*
import androidx.compose.foundation.clickable
import androidx.compose.runtime.Composable
import androidx.compose.runtime.compositionLocalOf