From 82b62b8d9d5aea2b86ecaf71d447790eae1ccf7a Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Sat, 3 Oct 2026 01:49:18 +0000 Subject: [PATCH] fix the home tab text colour against the dark theme --- .../com/subtracks/ui/home/HomeScreen.kt | 148 ++++++++++-------- .../subtracks/ui/home/HomeScreenshotTest.kt | 15 +- 2 files changed, 90 insertions(+), 73 deletions(-) diff --git a/app/src/main/kotlin/com/subtracks/ui/home/HomeScreen.kt b/app/src/main/kotlin/com/subtracks/ui/home/HomeScreen.kt index c5adca50..acd01b8d 100644 --- a/app/src/main/kotlin/com/subtracks/ui/home/HomeScreen.kt +++ b/app/src/main/kotlin/com/subtracks/ui/home/HomeScreen.kt @@ -19,10 +19,12 @@ import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.AssistChip +import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -127,74 +129,84 @@ fun HomeScreen( onSync: () -> Unit = {}, modifier: Modifier = Modifier, ) { - if (feed.loading) { - LoadingState(modifier) - return - } - if (feed.isEmpty()) { - EmptyState( - text = "Nothing to show yet.\nSync with your server to fill your library.", - modifier = modifier, - actionLabel = "Sync", - onAction = onSync, - ) - return - } - LazyColumn( - modifier = modifier.fillMaxSize(), - contentPadding = PaddingValues(top = topInset + 8.dp, bottom = bottomInset + 24.dp), - ) { - albumRow( - HomeSection.RecentlyPlayedAlbums, - feed.recentlyPlayedAlbums, - coverArt, - onAlbumClick, - onLongClick, - onMore, - ) - artistRow( - HomeSection.RecentlyPlayedArtists, - feed.recentlyPlayedArtists, - coverArt, - onArtistClick, - onLongClick, - onMore, - ) - albumRow( - HomeSection.MostPlayedAlbums, - feed.mostPlayedAlbums, - coverArt, - onAlbumClick, - onLongClick, - onMore, - ) - artistRow( - HomeSection.MostPlayedArtists, - feed.mostPlayedArtists, - coverArt, - onArtistClick, - onLongClick, - onMore, - ) - genreBlock(HomeSection.Genres, feed.genres, onGenreClick, onMore) - decadeRow(HomeSection.Decades, feed.decades, onDecadeClick, onMore) - starredSongs(HomeSection.RecentlyStarredSongs, feed.recentlyStarredSongs, coverArt, playingSongId, onSongClick, onLongClick, onMore) - albumRow( - HomeSection.RecentlyAddedAlbums, - feed.recentlyAddedAlbums, - coverArt, - onAlbumClick, - onLongClick, - onMore, - ) - albumRow( - HomeSection.Rediscover, - feed.rediscoverAlbums, - coverArt, - onAlbumClick, - onLongClick, - onMore, - ) + CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onBackground) { + if (feed.loading) { + LoadingState(modifier) + return@CompositionLocalProvider + } + if (feed.isEmpty()) { + EmptyState( + text = "Nothing to show yet.\nSync with your server to fill your library.", + modifier = modifier, + actionLabel = "Sync", + onAction = onSync, + ) + return@CompositionLocalProvider + } + LazyColumn( + modifier = modifier.fillMaxSize(), + contentPadding = PaddingValues(top = topInset + 8.dp, bottom = bottomInset + 24.dp), + ) { + albumRow( + HomeSection.RecentlyPlayedAlbums, + feed.recentlyPlayedAlbums, + coverArt, + onAlbumClick, + onLongClick, + onMore, + ) + artistRow( + HomeSection.RecentlyPlayedArtists, + feed.recentlyPlayedArtists, + coverArt, + onArtistClick, + onLongClick, + onMore, + ) + albumRow( + HomeSection.MostPlayedAlbums, + feed.mostPlayedAlbums, + coverArt, + onAlbumClick, + onLongClick, + onMore, + ) + artistRow( + HomeSection.MostPlayedArtists, + feed.mostPlayedArtists, + coverArt, + onArtistClick, + onLongClick, + onMore, + ) + genreBlock(HomeSection.Genres, feed.genres, onGenreClick, onMore) + decadeRow(HomeSection.Decades, feed.decades, onDecadeClick, onMore) + starredSongs( + HomeSection.RecentlyStarredSongs, + feed.recentlyStarredSongs, + coverArt, + playingSongId, + onSongClick, + onLongClick, + onMore, + ) + albumRow( + HomeSection.RecentlyAddedAlbums, + feed.recentlyAddedAlbums, + coverArt, + onAlbumClick, + onLongClick, + onMore, + ) + albumRow( + HomeSection.Rediscover, + feed.rediscoverAlbums, + coverArt, + onAlbumClick, + onLongClick, + onMore, + ) + } } } diff --git a/app/src/test/kotlin/com/subtracks/ui/home/HomeScreenshotTest.kt b/app/src/test/kotlin/com/subtracks/ui/home/HomeScreenshotTest.kt index b3e4c34c..01fdcda2 100644 --- a/app/src/test/kotlin/com/subtracks/ui/home/HomeScreenshotTest.kt +++ b/app/src/test/kotlin/com/subtracks/ui/home/HomeScreenshotTest.kt @@ -1,6 +1,9 @@ package com.subtracks.ui.home import androidx.activity.ComponentActivity +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.Surface +import androidx.compose.ui.Modifier import androidx.compose.ui.test.junit4.v2.createAndroidComposeRule import androidx.compose.ui.test.onAllNodesWithText import androidx.compose.ui.test.onRoot @@ -30,11 +33,13 @@ class HomeScreenshotTest { fun home() { composeRule.setContent { SubtracksTheme { - HomeScreen( - feed = feed(), - coverArt = { _, _ -> null }, - playingSongId = null, - ) + Surface(modifier = Modifier.fillMaxSize()) { + HomeScreen( + feed = feed(), + coverArt = { _, _ -> null }, + playingSongId = null, + ) + } } } composeRule.waitUntil(timeoutMillis = 5_000) {