mirror of
https://github.com/owenlejeune/TVTime.git
synced 2025-11-09 13:22:44 -05:00
fix padding of trending tabs on home screen
This commit is contained in:
@@ -7,6 +7,7 @@ import androidx.compose.foundation.clickable
|
|||||||
import androidx.compose.foundation.focusable
|
import androidx.compose.foundation.focusable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.lazy.grid.GridCells
|
import androidx.compose.foundation.lazy.grid.GridCells
|
||||||
|
import androidx.compose.foundation.lazy.grid.LazyGridItemScope
|
||||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
@@ -57,6 +58,7 @@ private val POSTER_HEIGHT = 180.dp
|
|||||||
fun PagingPosterGrid(
|
fun PagingPosterGrid(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
lazyPagingItems: LazyPagingItems<TmdbItem>?,
|
lazyPagingItems: LazyPagingItems<TmdbItem>?,
|
||||||
|
header: @Composable (LazyGridItemScope.() -> Unit)? = null,
|
||||||
onClick: (id: Int) -> Unit = {}
|
onClick: (id: Int) -> Unit = {}
|
||||||
) {
|
) {
|
||||||
lazyPagingItems?.let {
|
lazyPagingItems?.let {
|
||||||
@@ -66,6 +68,9 @@ fun PagingPosterGrid(
|
|||||||
contentPadding = PaddingValues(8.dp),
|
contentPadding = PaddingValues(8.dp),
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
) {
|
) {
|
||||||
|
header?.let {
|
||||||
|
header(header)
|
||||||
|
}
|
||||||
lazyPagingItems(
|
lazyPagingItems(
|
||||||
lazyPagingItems = lazyPagingItems,
|
lazyPagingItems = lazyPagingItems,
|
||||||
key = { i -> it[i]!!.id }
|
key = { i -> it[i]!!.id }
|
||||||
|
|||||||
@@ -99,33 +99,35 @@ fun MediaTabTrendingContent(
|
|||||||
|
|
||||||
val mediaListItems = flow.value.collectAsLazyPagingItems()
|
val mediaListItems = flow.value.collectAsLazyPagingItems()
|
||||||
|
|
||||||
Column {
|
PagingPosterGrid(
|
||||||
Row(
|
lazyPagingItems = mediaListItems,
|
||||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
header = {
|
||||||
modifier = Modifier.padding(all = 12.dp)
|
Row(
|
||||||
) {
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
SelectableTextChip(
|
modifier = Modifier
|
||||||
selected = timeWindow.value == TimeWindow.DAY,
|
.padding(horizontal = 4.dp)
|
||||||
onSelected = { timeWindow.value = TimeWindow.DAY },
|
.padding(bottom = 4.dp)
|
||||||
text = stringResource(id = R.string.time_window_day),
|
) {
|
||||||
modifier = Modifier.weight(1f)
|
SelectableTextChip(
|
||||||
)
|
selected = timeWindow.value == TimeWindow.DAY,
|
||||||
SelectableTextChip(
|
onSelected = { timeWindow.value = TimeWindow.DAY },
|
||||||
selected = timeWindow.value == TimeWindow.WEEK,
|
text = stringResource(id = R.string.time_window_day),
|
||||||
onSelected = { timeWindow.value = TimeWindow.WEEK },
|
modifier = Modifier.weight(1f)
|
||||||
text = stringResource(id = R.string.time_window_week),
|
)
|
||||||
modifier = Modifier.weight(1f)
|
SelectableTextChip(
|
||||||
)
|
selected = timeWindow.value == TimeWindow.WEEK,
|
||||||
}
|
onSelected = { timeWindow.value = TimeWindow.WEEK },
|
||||||
PagingPosterGrid(
|
text = stringResource(id = R.string.time_window_week),
|
||||||
lazyPagingItems = mediaListItems,
|
modifier = Modifier.weight(1f)
|
||||||
onClick = { id ->
|
|
||||||
appNavController.navigate(
|
|
||||||
AppNavItem.DetailView.withArgs(mediaType, id)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
}
|
onClick = { id ->
|
||||||
|
appNavController.navigate(
|
||||||
|
AppNavItem.DetailView.withArgs(mediaType, id)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalPagerApi::class)
|
@OptIn(ExperimentalPagerApi::class)
|
||||||
|
|||||||
Reference in New Issue
Block a user