Skip to content

Commit

Permalink
home: remove duplicate sections
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcarter11 authored and reocat committed Jan 6, 2025
1 parent cb3aa9a commit 8b0e4ea
Showing 1 changed file with 1 addition and 146 deletions.
147 changes: 1 addition & 146 deletions app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -501,150 +501,6 @@ fun HomeScreen(
)
}
}
forgottenFavorites?.takeIf { it.isNotEmpty() }?.let { forgottenFavorites ->
NavigationTitle(
title = stringResource(R.string.forgotten_favorites)
)
LazyHorizontalGrid(
state = forgottenFavoritesLazyGridState,
rows = GridCells.Fixed(4),
flingBehavior = rememberSnapFlingBehavior(forgottenFavoritesSnapLayoutInfoProvider),
contentPadding = WindowInsets.systemBars
.only(WindowInsetsSides.Horizontal)
.asPaddingValues(),
modifier = Modifier
.fillMaxWidth()
.height(ListItemHeight * 4)
) {
items(
items = forgottenFavorites,
key = { it.id }
) { originalSong ->
val song by database.song(originalSong.id).collectAsState(initial = originalSong)
SongListItem(
song = song!!,
showInLibraryIcon = true,
isActive = song!!.id == mediaMetadata?.id,
isPlaying = isPlaying,
modifier = Modifier
.width(horizontalLazyGridItemWidth)
.combinedClickable(
onClick = {
if (song!!.song.isAvailableOffline() || isNetworkConnected){
if (song!!.id == mediaMetadata?.id) {
playerConnection.player.togglePlayPause()
} else {
playerConnection.playQueue(
YouTubeQueue(
WatchEndpoint(videoId = song!!.id),
song!!.toMediaMetadata()
)
)
}
}
},
onLongClick = {
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
menuState.show {
SongMenu(
originalSong = song!!,
navController = navController,
onDismiss = menuState::dismiss
)
}
}
)
)
}
}
}
keepListening?.takeIf { it.isNotEmpty() }?.let { keepListening ->
NavigationTitle(
title = stringResource(R.string.keep_listening),
)
val rows = if (keepListening.size > 6) 2 else 1
LazyHorizontalGrid(
state = rememberLazyGridState(),
rows = GridCells.Fixed(rows),
modifier = Modifier
.fillMaxWidth()
.height((GridThumbnailHeight + 72.dp) * rows),
) {
items(keepListening) {
localGridItem(it)
}
}
}
similarRecommendations?.forEach {
NavigationTitle(
label = stringResource(R.string.similar_to),
title = it.title.title,
thumbnail = it.title.thumbnailUrl?.let { thumbnailUrl ->
{
val shape = if (it.title is Artist) CircleShape else RoundedCornerShape(
ThumbnailCornerRadius
)
AsyncImage(
model = thumbnailUrl,
contentDescription = null,
modifier = Modifier
.size(ListThumbnailSize)
.clip(shape)
)
}
},
onClick = {
when (it.title) {
is Song -> navController.navigate("album/${it.title.song.albumId!!}")
is Album -> navController.navigate("album/${it.title.id}")
is Artist -> navController.navigate("artist/${it.title.id}")
is Playlist -> {}
}
}
)
val rows = if (it.items.size > 6) 2 else 1
LazyHorizontalGrid(
state = rememberLazyGridState(),
rows = GridCells.Fixed(rows),
modifier = Modifier
.fillMaxWidth()
.height((GridThumbnailHeight + 72.dp) * rows),
) {
items(it.items) { item ->
ytGridItem(item)
}
}
}
homePage?.sections?.forEach {
NavigationTitle(
title = it.title,
label = it.label,
thumbnail = it.thumbnail?.let { thumbnailUrl ->
{
val shape =
if (it.endpoint?.isArtistEndpoint == true) CircleShape else RoundedCornerShape(
ThumbnailCornerRadius
)
AsyncImage(
model = thumbnailUrl,
contentDescription = null,
modifier = Modifier
.size(ListThumbnailSize)
.clip(shape)
)
}
}
)
LazyRow(
contentPadding = WindowInsets.systemBars
.only(WindowInsetsSides.Horizontal)
.asPaddingValues(),
) {
items(it.items) { item ->
ytGridItem(item)
}
}
}
}
}

Expand Down Expand Up @@ -772,8 +628,7 @@ fun HomeScreen(
title = it.title.title,
thumbnail = it.title.thumbnailUrl?.let { thumbnailUrl ->
{
val shape =
if (it.title is Artist) CircleShape else RoundedCornerShape(ThumbnailCornerRadius)
val shape = if (it.title is Artist) CircleShape else RoundedCornerShape(ThumbnailCornerRadius)
AsyncImage(
model = thumbnailUrl,
contentDescription = null,
Expand Down

0 comments on commit 8b0e4ea

Please sign in to comment.