Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ fun LibraryAlbumsTab(
onAlbumLongPress: (Album) -> Unit = {},
onAlbumSelectionToggle: (Album) -> Unit = {},
getSelectionIndex: (Long) -> Int? = { null },
storageFilter: StorageFilter = StorageFilter.ALL
storageFilter: StorageFilter = StorageFilter.ALL,
listState: androidx.compose.foundation.lazy.LazyListState = androidx.compose.foundation.lazy.rememberLazyListState(),
gridState: androidx.compose.foundation.lazy.grid.LazyGridState = androidx.compose.foundation.lazy.grid.rememberLazyGridState()
) {
val hasCurrentSong by remember(playerViewModel) {
playerViewModel.stablePlayerState
.map { it.currentSong != null && it.currentSong != Song.emptySong() }
.distinctUntilChanged()
}.collectAsStateWithLifecycle(initialValue = false)

val gridState = rememberLazyGridState()
val listState = rememberLazyListState()
val dummyListState = rememberLazyListState()
val dummyGridState = rememberLazyGridState()
val dummyListState = androidx.compose.foundation.lazy.rememberLazyListState()
val dummyGridState = androidx.compose.foundation.lazy.grid.rememberLazyGridState()
val context = LocalContext.current
val imageLoader = context.imageLoader

Expand Down Expand Up @@ -481,16 +481,16 @@ fun LibraryArtistsTab(
onArtistClick: (Long) -> Unit,
isRefreshing: Boolean,
onRefresh: () -> Unit,
storageFilter: StorageFilter = StorageFilter.ALL
storageFilter: StorageFilter = StorageFilter.ALL,
listState: androidx.compose.foundation.lazy.LazyListState = androidx.compose.foundation.lazy.rememberLazyListState()
) {
val hasCurrentSong by remember(playerViewModel) {
playerViewModel.stablePlayerState
.map { it.currentSong != null && it.currentSong != Song.emptySong() }
.distinctUntilChanged()
}.collectAsStateWithLifecycle(initialValue = false)

val listState = rememberLazyListState()
val dummyListState = rememberLazyListState()
val dummyListState = androidx.compose.foundation.lazy.rememberLazyListState()
val artistFastScrollLabelProvider = remember(artists, currentArtistSortOption) {
{ index: Int ->
artistFastScrollLabel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ fun LibraryScreen(
songInfoBottomSheetViewModel: SongInfoBottomSheetViewModel = hiltViewModel()
) {
// La recolección de estados de alto nivel se mantiene mínima.
val albumsListState = androidx.compose.foundation.lazy.rememberLazyListState()
val albumsGridState = androidx.compose.foundation.lazy.grid.rememberLazyGridState()
val songsListState = androidx.compose.foundation.lazy.rememberLazyListState()
val artistsListState = androidx.compose.foundation.lazy.rememberLazyListState()
val context = LocalContext.current // Added context
val haptic = LocalHapticFeedback.current
val lastTabIndex by playerViewModel.lastLibraryTabIndexFlow.collectAsStateWithLifecycle()
Expand Down Expand Up @@ -1533,7 +1537,8 @@ fun LibraryScreen(
onRegisterLocateCurrentSongAction = { songsLocateAction = it },
sortOption = playerUiState.currentSongSortOption,
storageFilter = playerUiState.currentStorageFilter,
hasCurrentSong = hasCurrentSong
hasCurrentSong = hasCurrentSong,
listState = songsListState
)
}
LibraryTabId.ALBUMS -> {
Expand Down Expand Up @@ -1563,7 +1568,9 @@ fun LibraryScreen(
onAlbumLongPress = onAlbumLongPress,
onAlbumSelectionToggle = onAlbumSelectionToggle,
getSelectionIndex = getAlbumSelectionIndex,
storageFilter = playerUiState.currentStorageFilter
storageFilter = playerUiState.currentStorageFilter,
listState = albumsListState,
gridState = albumsGridState
)
}

Expand All @@ -1585,7 +1592,8 @@ fun LibraryScreen(
},
isRefreshing = isRefreshing,
onRefresh = onRefresh,
storageFilter = playerUiState.currentStorageFilter
storageFilter = playerUiState.currentStorageFilter,
listState = artistsListState
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ fun LibrarySongsTab(
onLocateCurrentSongVisibilityChanged: (Boolean) -> Unit = {},
onRegisterLocateCurrentSongAction: ((() -> Unit)?) -> Unit = {},
storageFilter: StorageFilter = StorageFilter.ALL,
hasCurrentSong: Boolean = false
hasCurrentSong: Boolean = false,
listState: androidx.compose.foundation.lazy.LazyListState = androidx.compose.foundation.lazy.rememberLazyListState()
) {
val listState = rememberLazyListState()
val dummyListState = rememberLazyListState()
val dummyListState = androidx.compose.foundation.lazy.rememberLazyListState()
val pullToRefreshState = rememberPullToRefreshState()
val coroutineScope = rememberCoroutineScope()
val visibilityCallback by rememberUpdatedState(onLocateCurrentSongVisibilityChanged)
Expand Down