loading: one loading card on the grids, not a full fake grid (#31)
My videos, Subscriptions, History and the channel pages painted two whole rows of placeholder cards on first open, and Channels painted two stub rows. Show a single loading card instead, matching the Home rows.
This commit is contained in:
parent
9f69cabf79
commit
0ca17cfd00
2 changed files with 16 additions and 26 deletions
|
|
@ -317,10 +317,8 @@ fun ChannelsScreen(
|
|||
|
||||
when {
|
||||
viewModel.loading && viewModel.userRows.isEmpty() ->
|
||||
// Placeholder rows while the channels load (issue #19): header stub
|
||||
// + a row of shimmer card-shaped placeholders, twice.
|
||||
// One row header stub + a single loading card, not a fake grid (#31).
|
||||
androidx.compose.foundation.layout.Column {
|
||||
repeat(2) {
|
||||
Box(Modifier.padding(start = 16.dp, top = 12.dp, bottom = 4.dp)) {
|
||||
Box(
|
||||
Modifier
|
||||
|
|
@ -330,8 +328,7 @@ fun ChannelsScreen(
|
|||
.background(Color(0xFF232323)),
|
||||
)
|
||||
}
|
||||
ShimmerRow()
|
||||
}
|
||||
ShimmerRow(size = 1)
|
||||
}
|
||||
viewModel.error != null && viewModel.userRows.isEmpty() ->
|
||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
|
|
|
|||
|
|
@ -211,21 +211,14 @@ fun VideoListScreen(
|
|||
// VideoListScreen (My videos, Search, Subscriptions, History, channel pages).
|
||||
item(key = "initial-placeholders", span = { androidx.compose.foundation.lazy.grid.GridItemSpan(maxLineSpan) }) {
|
||||
LaunchedEffect(source) { viewModel.loadMore(force = true) }
|
||||
androidx.compose.foundation.layout.Column {
|
||||
repeat(2) {
|
||||
androidx.compose.foundation.layout.Row {
|
||||
repeat(cardsPerRow) {
|
||||
// A single loading card, not a full fake grid (issue #31).
|
||||
ShimmerCard(
|
||||
modifier = Modifier
|
||||
.padding(6.dp)
|
||||
.width(rowCardWidth()),
|
||||
.width(rowCardWidth() - 12.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemsIndexed(items, key = { _, item -> itemStableKey(item) }) { index, item ->
|
||||
val video: VideoDto = when (item) {
|
||||
is VideoListItem.HistoryEntry -> item.history.video
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue