Missing-file lifecycle end to end, UPnP stall recovery, Android browse parity, Flutter client removed #126
@@ -240,6 +240,11 @@ fun visibleGenres(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Integer division by this floors a year to its decade: 2007 -> 2000. Named
|
||||||
|
// because detekt counts it as magic, and because the arithmetic reads as
|
||||||
|
// arbitrary otherwise.
|
||||||
|
private const val YEARS_PER_DECADE = 10
|
||||||
|
|
||||||
/** A decade's worth of the year index, newest year first. */
|
/** A decade's worth of the year index, newest year first. */
|
||||||
data class DecadeGroup(
|
data class DecadeGroup(
|
||||||
val decade: Int,
|
val decade: Int,
|
||||||
@@ -255,7 +260,7 @@ data class DecadeGroup(
|
|||||||
* same reason as [visibleGenres].
|
* same reason as [visibleGenres].
|
||||||
*/
|
*/
|
||||||
fun groupByDecade(years: List<YearCount>): List<DecadeGroup> =
|
fun groupByDecade(years: List<YearCount>): List<DecadeGroup> =
|
||||||
years.groupBy { (it.year / 10) * 10 }
|
years.groupBy { (it.year / YEARS_PER_DECADE) * YEARS_PER_DECADE }
|
||||||
.map { (decade, entries) ->
|
.map { (decade, entries) ->
|
||||||
DecadeGroup(
|
DecadeGroup(
|
||||||
decade = decade,
|
decade = decade,
|
||||||
|
|||||||
@@ -117,6 +117,22 @@ fun LibraryScreen(
|
|||||||
state = pagerState,
|
state = pagerState,
|
||||||
modifier = Modifier.fillMaxSize().padding(inner),
|
modifier = Modifier.fillMaxSize().padding(inner),
|
||||||
) { page ->
|
) { page ->
|
||||||
|
LibraryTabPage(page = page, viewModel = viewModel, navController = navController)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pager's page bodies, split out of [LibraryScreen] so the screen stays
|
||||||
|
* the scaffold + tab bar and this stays the routing table. Adding a tab is
|
||||||
|
* then one line here and one label in [LIBRARY_TABS].
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
private fun LibraryTabPage(
|
||||||
|
page: Int,
|
||||||
|
viewModel: LibraryViewModel,
|
||||||
|
navController: NavHostController,
|
||||||
|
) {
|
||||||
when (page) {
|
when (page) {
|
||||||
TAB_ARTISTS -> ArtistsTab(viewModel = viewModel, navController = navController)
|
TAB_ARTISTS -> ArtistsTab(viewModel = viewModel, navController = navController)
|
||||||
TAB_ALBUMS -> AlbumsTab(viewModel = viewModel, navController = navController)
|
TAB_ALBUMS -> AlbumsTab(viewModel = viewModel, navController = navController)
|
||||||
@@ -134,8 +150,6 @@ fun LibraryScreen(
|
|||||||
TAB_HIDDEN -> HiddenTab()
|
TAB_HIDDEN -> HiddenTab()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private const val TAB_ARTISTS = 0
|
private const val TAB_ARTISTS = 0
|
||||||
private const val TAB_ALBUMS = 1
|
private const val TAB_ALBUMS = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user