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:
Damontecres 2026-05-30 17:41:44 -04:00 • committed by GitHub
parent 68836bb834
commit 6c64470c28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 38 additions and 11 deletions

View file

@ -592,6 +592,7 @@ class HomeSettingsService
items = resume, items = resume,
viewOptions = row.viewOptions, viewOptions = row.viewOptions,
rowType = row, rowType = row,
showViewMore = resume.size >= limit,
) )
} }
@ -611,6 +612,7 @@ class HomeSettingsService
items = nextUp, items = nextUp,
viewOptions = row.viewOptions, viewOptions = row.viewOptions,
rowType = row, rowType = row,
showViewMore = nextUp.size >= limit,
) )
} }
@ -631,17 +633,14 @@ class HomeSettingsService
prefs.maxDaysNextUp, prefs.maxDaysNextUp,
row.viewOptions.useSeries, row.viewOptions.useSeries,
) )
val combined = latestNextUpService.buildCombined(resume, nextUp)
Success( Success(
title = ResStringProvider(R.string.continue_watching), title = ResStringProvider(R.string.continue_watching),
items = items = combined.take(limit),
latestNextUpService
.buildCombined(
resume,
nextUp,
).take(limit),
viewOptions = row.viewOptions, viewOptions = row.viewOptions,
rowType = row, rowType = row,
showViewMore = combined.size >= limit,
) )
} }
@ -705,6 +704,7 @@ class HomeSettingsService
genres, genres,
viewOptions = row.viewOptions, viewOptions = row.viewOptions,
rowType = row, rowType = row,
showViewMore = genres.size >= limit,
) )
} }
@ -756,6 +756,7 @@ class HomeSettingsService
title, title,
studios, studios,
viewOptions = row.viewOptions, viewOptions = row.viewOptions,
showViewMore = studios.size >= limit,
) )
} }
@ -784,6 +785,7 @@ class HomeSettingsService
it, it,
row.viewOptions, row.viewOptions,
rowType = row, rowType = row,
showViewMore = it.size >= limit,
) )
} }
latest latest
@ -838,6 +840,7 @@ class HomeSettingsService
it, it,
row.viewOptions, row.viewOptions,
rowType = row, rowType = row,
showViewMore = it.size >= limit,
) )
} }
} }
@ -891,6 +894,7 @@ class HomeSettingsService
it, it,
row.viewOptions, row.viewOptions,
rowType = row, rowType = row,
showViewMore = it.size >= limit,
) )
} }
} }
@ -928,6 +932,7 @@ class HomeSettingsService
it, it,
row.viewOptions, row.viewOptions,
rowType = row, rowType = row,
showViewMore = it.size >= limit,
) )
} }
} }
@ -957,6 +962,7 @@ class HomeSettingsService
title, title,
it, it,
row.viewOptions, row.viewOptions,
showViewMore = it.size >= limit,
) )
} }
} else { } else {
@ -988,6 +994,7 @@ class HomeSettingsService
it, it,
row.viewOptions, row.viewOptions,
rowType = row, rowType = row,
showViewMore = it.size >= limit,
) )
} }
} }
@ -1023,6 +1030,7 @@ class HomeSettingsService
it, it,
row.viewOptions, row.viewOptions,
rowType = row, rowType = row,
showViewMore = it.size >= limit,
) )
} }
} }
@ -1049,6 +1057,7 @@ class HomeSettingsService
it, it,
row.viewOptions, row.viewOptions,
rowType = row, rowType = row,
showViewMore = it.size >= limit,
) )
} }
} }
@ -1079,6 +1088,7 @@ class HomeSettingsService
it, it,
row.viewOptions, row.viewOptions,
rowType = row, rowType = row,
showViewMore = it.size >= limit,
) )
} }
} }
@ -1111,6 +1121,7 @@ class HomeSettingsService
suggestions.items, suggestions.items,
row.viewOptions, row.viewOptions,
rowType = row, rowType = row,
showViewMore = suggestions.items.size >= limit,
) )
} }

View file

@ -95,12 +95,15 @@ fun ViewMoreCard(
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp), containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp),
), ),
) { ) {
Box { Box(
contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxSize(),
) {
Icon( Icon(
imageVector = Icons.Default.ArrowForward, imageVector = Icons.Default.ArrowForward,
tint = MaterialTheme.colorScheme.onSurface, tint = MaterialTheme.colorScheme.onSurface,
contentDescription = "View more", contentDescription = "View more",
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(.66f),
) )
} }
} }

View file

@ -120,10 +120,12 @@ class RecommendedViewModel
viewModelScope.launchIO { viewModelScope.launchIO {
val result = val result =
try { try {
val items = execute(row, limit)
HomeRowLoadingState.Success( HomeRowLoadingState.Success(
title, title,
execute(row, limit), items,
viewOptions, viewOptions,
showViewMore = items.size >= limit,
) )
} catch (ex: Exception) { } catch (ex: Exception) {
Timber.e(ex, "Exception fetching %s", title) Timber.e(ex, "Exception fetching %s", title)
@ -172,6 +174,10 @@ class RecommendedViewModel
private fun fetchSuggestions() { private fun fetchSuggestions() {
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
val limit =
userPreferencesService
.getCurrent()
.appPreferences.homePagePreferences.maxItemsPerRow
val title = ResStringProvider(R.string.suggestions) val title = ResStringProvider(R.string.suggestions)
try { try {
suggestionService suggestionService
@ -188,6 +194,7 @@ class RecommendedViewModel
title, title,
resource.items, resource.items,
viewOptions, viewOptions,
showViewMore = resource.items.size >= limit,
) )
} }
@ -196,6 +203,7 @@ class RecommendedViewModel
title, title,
emptyList(), emptyList(),
viewOptions, viewOptions,
showViewMore = false,
) )
} }
} }

View file

@ -214,7 +214,11 @@ class CollectionViewModel
val result = val result =
try { try {
val pager = fetchItems(sort, filter, listOf(type)) val pager = fetchItems(sort, filter, listOf(type))
HomeRowLoadingState.Success(title, pager) HomeRowLoadingState.Success(
title,
pager,
showViewMore = false,
)
} catch (ex: Exception) { } catch (ex: Exception) {
Timber.e( Timber.e(
ex, ex,

View file

@ -472,7 +472,7 @@ fun HomePageContent(
.onKeyEvent { onKey(it) }, .onKeyEvent { onKey(it) },
) )
}, },
showViewMore = showViewMore, showViewMore = showViewMore && row.showViewMore,
viewMoreCardContent = { mod -> viewMoreCardContent = { mod ->
HomePageViewMoreCard( HomePageViewMoreCard(
isEpisode = row.items.last()?.type == BaseItemKind.EPISODE, isEpisode = row.items.last()?.type == BaseItemKind.EPISODE,

View file

@ -67,6 +67,7 @@ sealed interface HomeRowLoadingState {
val items: List<BaseItem?>, val items: List<BaseItem?>,
val viewOptions: HomeRowViewOptions = HomeRowViewOptions(), val viewOptions: HomeRowViewOptions = HomeRowViewOptions(),
val rowType: HomeRowConfig? = null, val rowType: HomeRowConfig? = null,
val showViewMore: Boolean = true,
) : HomeRowLoadingState ) : HomeRowLoadingState
data class Error( data class Error(