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,21 +317,18 @@ fun ChannelsScreen(
|
||||||
|
|
||||||
when {
|
when {
|
||||||
viewModel.loading && viewModel.userRows.isEmpty() ->
|
viewModel.loading && viewModel.userRows.isEmpty() ->
|
||||||
// Placeholder rows while the channels load (issue #19): header stub
|
// One row header stub + a single loading card, not a fake grid (#31).
|
||||||
// + a row of shimmer card-shaped placeholders, twice.
|
|
||||||
androidx.compose.foundation.layout.Column {
|
androidx.compose.foundation.layout.Column {
|
||||||
repeat(2) {
|
Box(Modifier.padding(start = 16.dp, top = 12.dp, bottom = 4.dp)) {
|
||||||
Box(Modifier.padding(start = 16.dp, top = 12.dp, bottom = 4.dp)) {
|
Box(
|
||||||
Box(
|
Modifier
|
||||||
Modifier
|
.width(180.dp)
|
||||||
.width(180.dp)
|
.height(22.dp)
|
||||||
.height(22.dp)
|
.clip(CircleShape)
|
||||||
.clip(CircleShape)
|
.background(Color(0xFF232323)),
|
||||||
.background(Color(0xFF232323)),
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
ShimmerRow()
|
|
||||||
}
|
}
|
||||||
|
ShimmerRow(size = 1)
|
||||||
}
|
}
|
||||||
viewModel.error != null && viewModel.userRows.isEmpty() ->
|
viewModel.error != null && viewModel.userRows.isEmpty() ->
|
||||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||||
|
|
|
||||||
|
|
@ -211,19 +211,12 @@ fun VideoListScreen(
|
||||||
// VideoListScreen (My videos, Search, Subscriptions, History, channel pages).
|
// VideoListScreen (My videos, Search, Subscriptions, History, channel pages).
|
||||||
item(key = "initial-placeholders", span = { androidx.compose.foundation.lazy.grid.GridItemSpan(maxLineSpan) }) {
|
item(key = "initial-placeholders", span = { androidx.compose.foundation.lazy.grid.GridItemSpan(maxLineSpan) }) {
|
||||||
LaunchedEffect(source) { viewModel.loadMore(force = true) }
|
LaunchedEffect(source) { viewModel.loadMore(force = true) }
|
||||||
androidx.compose.foundation.layout.Column {
|
// A single loading card, not a full fake grid (issue #31).
|
||||||
repeat(2) {
|
ShimmerCard(
|
||||||
androidx.compose.foundation.layout.Row {
|
modifier = Modifier
|
||||||
repeat(cardsPerRow) {
|
.padding(6.dp)
|
||||||
ShimmerCard(
|
.width(rowCardWidth() - 12.dp),
|
||||||
modifier = Modifier
|
)
|
||||||
.padding(6.dp)
|
|
||||||
.width(rowCardWidth()),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
itemsIndexed(items, key = { _, item -> itemStableKey(item) }) { index, item ->
|
itemsIndexed(items, key = { _, item -> itemStableKey(item) }) { index, item ->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue