From 8b0e4ea58672e432b3d730570b135607533e7184 Mon Sep 17 00:00:00 2001 From: mattcarter11 <38189440+mattcarter11@users.noreply.github.com> Date: Mon, 6 Jan 2025 11:27:07 +0100 Subject: [PATCH] home: remove duplicate sections --- .../dd3boh/outertune/ui/screens/HomeScreen.kt | 147 +----------------- 1 file changed, 1 insertion(+), 146 deletions(-) diff --git a/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt b/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt index 6ad08a38e..d09136ca0 100644 --- a/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt +++ b/app/src/main/java/com/dd3boh/outertune/ui/screens/HomeScreen.kt @@ -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) - } - } - } } } @@ -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,