mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-07-27 06:52:18 +00:00
refactor: enhance padding customization in NuvioScreen and related components
This commit is contained in:
parent
61ee16b409
commit
2f2ac96cc4
5 changed files with 23 additions and 8 deletions
|
|
@ -41,11 +41,13 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun NuvioScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
horizontalPadding: Dp = 16.dp,
|
||||
content: LazyListScope.() -> Unit,
|
||||
) {
|
||||
val statusBarTop = WindowInsets.statusBars.asPaddingValues().calculateTopPadding()
|
||||
|
|
@ -54,9 +56,9 @@ fun NuvioScreen(
|
|||
.fillMaxSize()
|
||||
.background(MaterialTheme.colorScheme.background),
|
||||
contentPadding = PaddingValues(
|
||||
start = 16.dp,
|
||||
start = horizontalPadding,
|
||||
top = 10.dp + statusBarTop + nuvioPlatformExtraTopPadding,
|
||||
end = 16.dp,
|
||||
end = horizontalPadding,
|
||||
bottom = 18.dp + nuvioPlatformExtraBottomPadding,
|
||||
),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import androidx.compose.foundation.clickable
|
|||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
|
|
@ -24,6 +25,7 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
|
@ -40,6 +42,8 @@ fun <T> NuvioShelfSection(
|
|||
title: String,
|
||||
entries: List<T>,
|
||||
modifier: Modifier = Modifier,
|
||||
headerHorizontalPadding: Dp = 0.dp,
|
||||
rowContentPadding: PaddingValues = PaddingValues(0.dp),
|
||||
onViewAllClick: (() -> Unit)? = null,
|
||||
key: ((T) -> Any)? = null,
|
||||
itemContent: @Composable (T) -> Unit,
|
||||
|
|
@ -50,9 +54,11 @@ fun <T> NuvioShelfSection(
|
|||
) {
|
||||
NuvioShelfSectionHeader(
|
||||
title = title,
|
||||
modifier = Modifier.padding(horizontal = headerHorizontalPadding),
|
||||
onViewAllClick = onViewAllClick,
|
||||
)
|
||||
LazyRow(
|
||||
contentPadding = rowContentPadding,
|
||||
horizontalArrangement = Arrangement.spacedBy(10.dp),
|
||||
) {
|
||||
if (key != null) {
|
||||
|
|
@ -205,4 +211,4 @@ private val NuvioPosterShape.aspectRatio: Float
|
|||
NuvioPosterShape.Poster -> 0.675f
|
||||
NuvioPosterShape.Square -> 1f
|
||||
NuvioPosterShape.Landscape -> 1.77f
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.nuvio.app.features.home
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.Refresh
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
|
|
@ -45,11 +43,15 @@ fun HomeScreen(
|
|||
HomeRepository.refresh(addonsUiState.addons)
|
||||
}
|
||||
|
||||
NuvioScreen(modifier = modifier) {
|
||||
NuvioScreen(
|
||||
modifier = modifier,
|
||||
horizontalPadding = 0.dp,
|
||||
) {
|
||||
when {
|
||||
addonsUiState.addons.none { it.manifest != null } -> {
|
||||
item {
|
||||
HomeEmptyStateCard(
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
title = "No active addons",
|
||||
message = "Install and validate at least one addon before loading catalog rows on Home.",
|
||||
)
|
||||
|
|
@ -58,13 +60,14 @@ fun HomeScreen(
|
|||
|
||||
homeUiState.isLoading && homeUiState.sections.isEmpty() -> {
|
||||
items(3) {
|
||||
HomeSkeletonRow()
|
||||
HomeSkeletonRow(modifier = Modifier.padding(horizontal = 16.dp))
|
||||
}
|
||||
}
|
||||
|
||||
homeUiState.sections.isEmpty() -> {
|
||||
item {
|
||||
HomeEmptyStateCard(
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
title = "No home rows available",
|
||||
message = homeUiState.errorMessage
|
||||
?: "Installed addons do not currently expose board-compatible catalogs without required extras.",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nuvio.app.features.home.components
|
|||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.nuvio.app.core.ui.NuvioShelfSection
|
||||
import com.nuvio.app.features.home.HomeCatalogSection
|
||||
import com.nuvio.app.features.home.MetaPreview
|
||||
|
|
@ -17,6 +18,8 @@ fun HomeCatalogRowSection(
|
|||
title = section.title,
|
||||
entries = section.items,
|
||||
modifier = modifier,
|
||||
headerHorizontalPadding = 16.dp,
|
||||
rowContentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 16.dp),
|
||||
onViewAllClick = onViewAllClick,
|
||||
key = { item -> item.id },
|
||||
) { item ->
|
||||
|
|
|
|||
|
|
@ -14,10 +14,11 @@ import com.nuvio.app.core.ui.NuvioSurfaceCard
|
|||
fun HomeEmptyStateCard(
|
||||
title: String,
|
||||
message: String,
|
||||
modifier: Modifier = Modifier,
|
||||
actionLabel: String? = null,
|
||||
onActionClick: (() -> Unit)? = null,
|
||||
) {
|
||||
NuvioSurfaceCard {
|
||||
NuvioSurfaceCard(modifier = modifier) {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
|
|
|
|||
Loading…
Reference in a new issue