Skip to content
Draft
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 @@ -330,6 +330,8 @@ class Settings(private val symphony: Symphony) {
val caseSensitiveSorting = BooleanEntry("case_sensitive_sorting", false)
val lyricsKeepScreenAwake = BooleanEntry("lyrics_keep_screen_awake", true)

val albumMinSongCount = IntEntry("album_min_song_count", 1)

private fun getSharedPreferences() = symphony.applicationContext
.getSharedPreferences("settings", Context.MODE_PRIVATE)
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ fun AlbumGrid(

else -> ResponsiveGrid(gridColumns) {
itemsIndexed(
sortedAlbumIds,
sortedAlbumIds
.mapNotNull { context.symphony.groove.album.get(it) }
.filter { it.getSongIds(context.symphony).size > context.symphony.settings.albumMinSongCount.value },
key = { i, x -> "$i-$x" },
contentType = { _, _ -> Groove.Kind.ALBUM }
) { _, albumId ->
context.symphony.groove.album.get(albumId)?.let { album ->
AlbumTile(context, album)
}
) { _, album ->
AlbumTile(context, album)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Album
import androidx.compose.material.icons.filled.Colorize
import androidx.compose.material.icons.filled.Face
import androidx.compose.material.icons.filled.Language
Expand Down Expand Up @@ -35,13 +36,15 @@ import io.github.zyrouge.symphony.ui.components.settings.ConsiderContributingTil
import io.github.zyrouge.symphony.ui.components.settings.SettingsFloatInputTile
import io.github.zyrouge.symphony.ui.components.settings.SettingsOptionTile
import io.github.zyrouge.symphony.ui.components.settings.SettingsSideHeading
import io.github.zyrouge.symphony.ui.components.settings.SettingsSliderTile
import io.github.zyrouge.symphony.ui.components.settings.SettingsSwitchTile
import io.github.zyrouge.symphony.ui.helpers.ViewContext
import io.github.zyrouge.symphony.ui.theme.PrimaryThemeColor
import io.github.zyrouge.symphony.ui.theme.SymphonyTypography
import io.github.zyrouge.symphony.ui.theme.ThemeColors
import io.github.zyrouge.symphony.ui.theme.ThemeMode
import kotlinx.serialization.Serializable
import kotlin.math.roundToInt

private val scalingPresets = listOf(
0.25f, 0.5f, 0.75f, 0.9f, 1f,
Expand All @@ -63,6 +66,7 @@ fun AppearanceSettingsView(context: ViewContext) {
val primaryColor by context.symphony.settings.primaryColor.flow.collectAsState()
val fontScale by context.symphony.settings.fontScale.flow.collectAsState()
val contentScale by context.symphony.settings.contentScale.flow.collectAsState()
val albumMinSongCount by context.symphony.settings.albumMinSongCount.flow.collectAsState()

Scaffold(
modifier = Modifier.fillMaxSize(),
Expand Down Expand Up @@ -229,6 +233,32 @@ fun AppearanceSettingsView(context: ViewContext) {
context.symphony.settings.primaryColor.setValue(value.name)
}
)
HorizontalDivider()
SettingsSliderTile(
context,
icon = {
Icon(Icons.Filled.Album, null)
},
title = {
Text("Minimum Album Song Count") //TODO: i18n
},
label = { value ->
Text(value.toInt().toString())
},
range = 0f..5f,
initialValue = albumMinSongCount.toFloat(),
onValue = { value ->
value.roundToInt().toFloat()
},
onChange = { value ->
context.symphony.settings.albumMinSongCount.setValue(value.toInt())
},
onReset = {
context.symphony.settings.albumMinSongCount.setValue(
context.symphony.settings.albumMinSongCount.defaultValue,
)
},
)
}
}
}
Expand Down