Skip to content

Commit

Permalink
feat: library details routes
Browse files Browse the repository at this point in the history
  • Loading branch information
kelsos committed Feb 29, 2024
1 parent d46b755 commit 9e45e06
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ fun LibrarySyncIndicator(syncProgress: LibrarySyncProgress) = Surface(
modifier = Modifier.weight(1f, true),
color = MaterialTheme.colors.onSurface.copy(alpha = 0.7f)
)
val currentProgress = syncProgress.current.toFloat().div(syncProgress.total)
val currentProgress = syncProgress.float()
val animatedProgress = animateFloatAsState(
targetValue = currentProgress,
animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ fun NavGraphBuilder.albumTrackGraph() {
}
)
) {
TODO()
AlbumTrackRoute()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.kelsos.mbrc.features.library.details

import androidx.compose.runtime.Composable
import androidx.paging.compose.collectAsLazyPagingItems
import com.kelsos.mbrc.features.library.TracksScreen
import org.koin.androidx.compose.getViewModel

@Composable
fun AlbumTrackRoute() {
val vm = getViewModel<AlbumTrackViewModel>()
TracksScreen(tracks = vm.tracks.collectAsLazyPagingItems(), sync = { /*TODO*/ }, action = { _, _ -> } )
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ fun NavGraphBuilder.artistsAlbumGraph() {
}
)
) {
TODO()
ArtistAlbumRoute()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.kelsos.mbrc.features.library.details

import androidx.compose.runtime.Composable
import androidx.paging.compose.collectAsLazyPagingItems
import com.kelsos.mbrc.features.library.AlbumsScreen
import org.koin.androidx.compose.getViewModel

@Composable
fun ArtistAlbumRoute() {
val vm = getViewModel<ArtistAlbumViewModel>()
AlbumsScreen(albums = vm.albums.collectAsLazyPagingItems(), sync = { /*TODO*/ }, action = { _, _ -> })
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ fun GenreArtistRoute() {
action = { _, _ -> }
)
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ data class LibrarySyncProgress(
val category: Int,
val running: Boolean
) {

fun float(): Float {
if (total == 0) {
return 0.0f
}
return current.toFloat().div(total)
}
companion object {
fun empty(): LibrarySyncProgress = LibrarySyncProgress(0, 0, 0, false)
}
Expand Down

0 comments on commit 9e45e06

Please sign in to comment.