Only show view more card if row has more items (#1493)
## Description Only show the view more card at the end of row if there are actually more items (or at the limit). Also reduces the size of the arrow a bit ### Related issues Related to #1392 ### Testing Emulator with different max items setting ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
68836bb834
commit
6c64470c28
6 changed files with 38 additions and 11 deletions
|
|
@ -95,12 +95,15 @@ fun ViewMoreCard(
|
|||
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp),
|
||||
),
|
||||
) {
|
||||
Box {
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.ArrowForward,
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
contentDescription = "View more",
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
modifier = Modifier.fillMaxSize(.66f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,10 +120,12 @@ class RecommendedViewModel
|
|||
viewModelScope.launchIO {
|
||||
val result =
|
||||
try {
|
||||
val items = execute(row, limit)
|
||||
HomeRowLoadingState.Success(
|
||||
title,
|
||||
execute(row, limit),
|
||||
items,
|
||||
viewOptions,
|
||||
showViewMore = items.size >= limit,
|
||||
)
|
||||
} catch (ex: Exception) {
|
||||
Timber.e(ex, "Exception fetching %s", title)
|
||||
|
|
@ -172,6 +174,10 @@ class RecommendedViewModel
|
|||
|
||||
private fun fetchSuggestions() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val limit =
|
||||
userPreferencesService
|
||||
.getCurrent()
|
||||
.appPreferences.homePagePreferences.maxItemsPerRow
|
||||
val title = ResStringProvider(R.string.suggestions)
|
||||
try {
|
||||
suggestionService
|
||||
|
|
@ -188,6 +194,7 @@ class RecommendedViewModel
|
|||
title,
|
||||
resource.items,
|
||||
viewOptions,
|
||||
showViewMore = resource.items.size >= limit,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -196,6 +203,7 @@ class RecommendedViewModel
|
|||
title,
|
||||
emptyList(),
|
||||
viewOptions,
|
||||
showViewMore = false,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,7 +214,11 @@ class CollectionViewModel
|
|||
val result =
|
||||
try {
|
||||
val pager = fetchItems(sort, filter, listOf(type))
|
||||
HomeRowLoadingState.Success(title, pager)
|
||||
HomeRowLoadingState.Success(
|
||||
title,
|
||||
pager,
|
||||
showViewMore = false,
|
||||
)
|
||||
} catch (ex: Exception) {
|
||||
Timber.e(
|
||||
ex,
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ fun HomePageContent(
|
|||
.onKeyEvent { onKey(it) },
|
||||
)
|
||||
},
|
||||
showViewMore = showViewMore,
|
||||
showViewMore = showViewMore && row.showViewMore,
|
||||
viewMoreCardContent = { mod ->
|
||||
HomePageViewMoreCard(
|
||||
isEpisode = row.items.last()?.type == BaseItemKind.EPISODE,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue