mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
fix the home tab text colour against the dark theme
This commit is contained in:
@@ -19,10 +19,12 @@ import androidx.compose.foundation.lazy.items
|
|||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.AssistChip
|
import androidx.compose.material3.AssistChip
|
||||||
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@@ -127,74 +129,84 @@ fun HomeScreen(
|
|||||||
onSync: () -> Unit = {},
|
onSync: () -> Unit = {},
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
if (feed.loading) {
|
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onBackground) {
|
||||||
LoadingState(modifier)
|
if (feed.loading) {
|
||||||
return
|
LoadingState(modifier)
|
||||||
}
|
return@CompositionLocalProvider
|
||||||
if (feed.isEmpty()) {
|
}
|
||||||
EmptyState(
|
if (feed.isEmpty()) {
|
||||||
text = "Nothing to show yet.\nSync with your server to fill your library.",
|
EmptyState(
|
||||||
modifier = modifier,
|
text = "Nothing to show yet.\nSync with your server to fill your library.",
|
||||||
actionLabel = "Sync",
|
modifier = modifier,
|
||||||
onAction = onSync,
|
actionLabel = "Sync",
|
||||||
)
|
onAction = onSync,
|
||||||
return
|
)
|
||||||
}
|
return@CompositionLocalProvider
|
||||||
LazyColumn(
|
}
|
||||||
modifier = modifier.fillMaxSize(),
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(top = topInset + 8.dp, bottom = bottomInset + 24.dp),
|
modifier = modifier.fillMaxSize(),
|
||||||
) {
|
contentPadding = PaddingValues(top = topInset + 8.dp, bottom = bottomInset + 24.dp),
|
||||||
albumRow(
|
) {
|
||||||
HomeSection.RecentlyPlayedAlbums,
|
albumRow(
|
||||||
feed.recentlyPlayedAlbums,
|
HomeSection.RecentlyPlayedAlbums,
|
||||||
coverArt,
|
feed.recentlyPlayedAlbums,
|
||||||
onAlbumClick,
|
coverArt,
|
||||||
onLongClick,
|
onAlbumClick,
|
||||||
onMore,
|
onLongClick,
|
||||||
)
|
onMore,
|
||||||
artistRow(
|
)
|
||||||
HomeSection.RecentlyPlayedArtists,
|
artistRow(
|
||||||
feed.recentlyPlayedArtists,
|
HomeSection.RecentlyPlayedArtists,
|
||||||
coverArt,
|
feed.recentlyPlayedArtists,
|
||||||
onArtistClick,
|
coverArt,
|
||||||
onLongClick,
|
onArtistClick,
|
||||||
onMore,
|
onLongClick,
|
||||||
)
|
onMore,
|
||||||
albumRow(
|
)
|
||||||
HomeSection.MostPlayedAlbums,
|
albumRow(
|
||||||
feed.mostPlayedAlbums,
|
HomeSection.MostPlayedAlbums,
|
||||||
coverArt,
|
feed.mostPlayedAlbums,
|
||||||
onAlbumClick,
|
coverArt,
|
||||||
onLongClick,
|
onAlbumClick,
|
||||||
onMore,
|
onLongClick,
|
||||||
)
|
onMore,
|
||||||
artistRow(
|
)
|
||||||
HomeSection.MostPlayedArtists,
|
artistRow(
|
||||||
feed.mostPlayedArtists,
|
HomeSection.MostPlayedArtists,
|
||||||
coverArt,
|
feed.mostPlayedArtists,
|
||||||
onArtistClick,
|
coverArt,
|
||||||
onLongClick,
|
onArtistClick,
|
||||||
onMore,
|
onLongClick,
|
||||||
)
|
onMore,
|
||||||
genreBlock(HomeSection.Genres, feed.genres, onGenreClick, onMore)
|
)
|
||||||
decadeRow(HomeSection.Decades, feed.decades, onDecadeClick, onMore)
|
genreBlock(HomeSection.Genres, feed.genres, onGenreClick, onMore)
|
||||||
starredSongs(HomeSection.RecentlyStarredSongs, feed.recentlyStarredSongs, coverArt, playingSongId, onSongClick, onLongClick, onMore)
|
decadeRow(HomeSection.Decades, feed.decades, onDecadeClick, onMore)
|
||||||
albumRow(
|
starredSongs(
|
||||||
HomeSection.RecentlyAddedAlbums,
|
HomeSection.RecentlyStarredSongs,
|
||||||
feed.recentlyAddedAlbums,
|
feed.recentlyStarredSongs,
|
||||||
coverArt,
|
coverArt,
|
||||||
onAlbumClick,
|
playingSongId,
|
||||||
onLongClick,
|
onSongClick,
|
||||||
onMore,
|
onLongClick,
|
||||||
)
|
onMore,
|
||||||
albumRow(
|
)
|
||||||
HomeSection.Rediscover,
|
albumRow(
|
||||||
feed.rediscoverAlbums,
|
HomeSection.RecentlyAddedAlbums,
|
||||||
coverArt,
|
feed.recentlyAddedAlbums,
|
||||||
onAlbumClick,
|
coverArt,
|
||||||
onLongClick,
|
onAlbumClick,
|
||||||
onMore,
|
onLongClick,
|
||||||
)
|
onMore,
|
||||||
|
)
|
||||||
|
albumRow(
|
||||||
|
HomeSection.Rediscover,
|
||||||
|
feed.rediscoverAlbums,
|
||||||
|
coverArt,
|
||||||
|
onAlbumClick,
|
||||||
|
onLongClick,
|
||||||
|
onMore,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.subtracks.ui.home
|
package com.subtracks.ui.home
|
||||||
|
|
||||||
import androidx.activity.ComponentActivity
|
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.junit4.v2.createAndroidComposeRule
|
||||||
import androidx.compose.ui.test.onAllNodesWithText
|
import androidx.compose.ui.test.onAllNodesWithText
|
||||||
import androidx.compose.ui.test.onRoot
|
import androidx.compose.ui.test.onRoot
|
||||||
@@ -30,11 +33,13 @@ class HomeScreenshotTest {
|
|||||||
fun home() {
|
fun home() {
|
||||||
composeRule.setContent {
|
composeRule.setContent {
|
||||||
SubtracksTheme {
|
SubtracksTheme {
|
||||||
HomeScreen(
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
feed = feed(),
|
HomeScreen(
|
||||||
coverArt = { _, _ -> null },
|
feed = feed(),
|
||||||
playingSongId = null,
|
coverArt = { _, _ -> null },
|
||||||
)
|
playingSongId = null,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
composeRule.waitUntil(timeoutMillis = 5_000) {
|
composeRule.waitUntil(timeoutMillis = 5_000) {
|
||||||
|
|||||||
Reference in New Issue
Block a user