From 4847d898a610f7235a8b043445315831bbb383f0 Mon Sep 17 00:00:00 2001 From: Anil Kumar Beesetti Date: Sat, 19 Aug 2023 08:49:57 +0530 Subject: [PATCH] refactor: remove steps in sliders in compose --- .../screens/player/PlayerPreferencesScreen.kt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/feature/settings/src/main/java/dev/anilbeesetti/nextplayer/settings/screens/player/PlayerPreferencesScreen.kt b/feature/settings/src/main/java/dev/anilbeesetti/nextplayer/settings/screens/player/PlayerPreferencesScreen.kt index bbfa2f1a2..c8d72e2c1 100644 --- a/feature/settings/src/main/java/dev/anilbeesetti/nextplayer/settings/screens/player/PlayerPreferencesScreen.kt +++ b/feature/settings/src/main/java/dev/anilbeesetti/nextplayer/settings/screens/player/PlayerPreferencesScreen.kt @@ -42,7 +42,6 @@ import dev.anilbeesetti.nextplayer.core.ui.designsystem.NextIcons import dev.anilbeesetti.nextplayer.settings.composables.OptionsDialog import dev.anilbeesetti.nextplayer.settings.composables.PreferenceSubtitle import dev.anilbeesetti.nextplayer.settings.extensions.name -import java.lang.Exception import java.util.Locale @OptIn(ExperimentalMaterial3Api::class) @@ -260,11 +259,8 @@ fun PlayerPreferencesScreen( ) Slider( value = defaultPlaybackSpeed, - onValueChange = { - defaultPlaybackSpeed = it.round(2) - }, - valueRange = 0.2f..4.0f, - steps = 37 + onValueChange = { defaultPlaybackSpeed = it.round(1) }, + valueRange = 0.2f..4.0f ) } ) @@ -294,8 +290,7 @@ fun PlayerPreferencesScreen( Slider( value = controllerAutoHideSec.toFloat(), onValueChange = { controllerAutoHideSec = it.toInt() }, - valueRange = 1.0f..60.0f, - steps = 60 + valueRange = 1.0f..60.0f ) } ) @@ -325,8 +320,7 @@ fun PlayerPreferencesScreen( Slider( value = seekIncrement.toFloat(), onValueChange = { seekIncrement = it.toInt() }, - valueRange = 1.0f..60.0f, - steps = 60 + valueRange = 1.0f..60.0f ) } ) @@ -438,7 +432,9 @@ fun LazyListScope.autoplaySetting( isChecked = isChecked, onClick = onClick ) -} fun LazyListScope.rememberBrightnessSetting( +} + +fun LazyListScope.rememberBrightnessSetting( isChecked: Boolean, onClick: () -> Unit ) = item {