mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
Fix Card size slider for users with legacy stored heightDp
HomeRowViewOptions is serialized to the user's Jellyfin server. Existing users have rows with heightDp == 172 (the pre-PR default) persisted upstream. Without this guard, resolvedCardHeight() would treat 172 as a per-row override and the Card size slider would do nothing on the home page until the user explicitly reset their rows. Treat the legacy 172 value as "no override" so users coming from older builds see the slider take effect immediately on home rows. HEIGHT_2X3_DP is now the base value the global multiplier scales from; no preset sets heightDp to exactly 172. HEIGHT_EPISODE (128) and other preset values remain valid per-row overrides because they are not equal to 172.
This commit is contained in:
parent
66b58adaca
commit
d8c9a8e3f6
1 changed files with 3 additions and 1 deletions
|
|
@ -5,11 +5,13 @@ import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.github.damontecres.wholphin.data.model.HomeRowViewOptions
|
import com.github.damontecres.wholphin.data.model.HomeRowViewOptions
|
||||||
import com.github.damontecres.wholphin.preferences.AppSliderPreference
|
import com.github.damontecres.wholphin.preferences.AppSliderPreference
|
||||||
|
import com.github.damontecres.wholphin.ui.Cards
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun HomeRowViewOptions.resolvedCardHeight(): Dp {
|
internal fun HomeRowViewOptions.resolvedCardHeight(): Dp {
|
||||||
val global = LocalInterfaceCustomization.current.cardHeightDp
|
val global = LocalInterfaceCustomization.current.cardHeightDp
|
||||||
return (if (heightDp > 0) heightDp else global).dp
|
val isOverride = heightDp > 0 && heightDp != Cards.HEIGHT_2X3_DP
|
||||||
|
return (if (isOverride) heightDp else global).dp
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Int.withinBoundsOrDefault(preference: AppSliderPreference<*>): Int {
|
internal fun Int.withinBoundsOrDefault(preference: AppSliderPreference<*>): Int {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue