Migrate to DataStore

This commit is contained in:
vfsfitvnm
2022-06-05 17:34:56 +02:00
parent 68edfe9b9f
commit c808b2a482
9 changed files with 23 additions and 29 deletions

View File

@@ -270,6 +270,8 @@ fun HomeScreen(intentVideoId: String?) {
}
}
if (!preferences.isReady) return@LazyColumn
item {
Row(
verticalAlignment = Alignment.CenterVertically,
@@ -302,9 +304,7 @@ fun HomeScreen(intentVideoId: String?) {
modifier = Modifier
.clickable {
val values = SongCollection.values()
preferences.homePageSongCollection =
values[(preferences.homePageSongCollection.ordinal + 1) % values.size]
preferences.onHomePageSongCollectionChange(values[(preferences.homePageSongCollection.ordinal + 1) % values.size])
}
.padding(horizontal = 8.dp, vertical = 8.dp)
.size(16.dp)

View File

@@ -51,7 +51,6 @@ fun LocalPlaylistScreen(
Database.playlistWithSongs(playlistId).map { it ?: PlaylistWithSongs.NotFound }
}.collectAsState(initial = PlaylistWithSongs.Empty, context = Dispatchers.IO)
val lazyListState = rememberLazyListState()
val albumRoute = rememberAlbumRoute()

View File

@@ -183,9 +183,7 @@ fun SearchResultScreen(
selectedTextStyle = typography.xs.medium.color(colorPalette.onPrimaryContainer),
unselectedTextStyle = typography.xs.medium,
shape = RoundedCornerShape(36.dp),
onValueChanged = { filter ->
preferences.searchFilter = filter
},
onValueChanged = preferences.onSearchFilterChange,
modifier = Modifier
.padding(vertical = 8.dp)
.padding(horizontal = 16.dp)

View File

@@ -112,17 +112,13 @@ fun SettingsScreen() {
EnumValueSelectorEntry(
title = "Theme mode",
selectedValue = preferences.colorPaletteMode,
onValueSelected = {
preferences.colorPaletteMode = it
}
onValueSelected = preferences.onColorPaletteModeChange
)
EnumValueSelectorEntry(
title = "Thumbnail roundness",
selectedValue = preferences.thumbnailRoundness,
onValueSelected = {
preferences.thumbnailRoundness = it
}
onValueSelected = preferences.onThumbnailRoundnessChange
)
}
}

View File

@@ -449,7 +449,8 @@ fun PlayerView(
.clickable {
player.mediaController.repeatMode =
(player.mediaController.repeatMode + 2) % 3
preferences.repeatMode = player.mediaController.repeatMode
preferences.onRepeatModeChange(player.mediaController.repeatMode)
}
.padding(horizontal = 16.dp)
.size(28.dp)