From 471bf7ca3bfe9ca43811f478156b2ebe20c14abc Mon Sep 17 00:00:00 2001 From: Kavish Devar Date: Sun, 2 Feb 2025 13:13:32 +0530 Subject: [PATCH] send only after user completed sliding --- .../aln/composables/ToneVolumeSlider.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/android/app/src/main/java/me/kavishdevar/aln/composables/ToneVolumeSlider.kt b/android/app/src/main/java/me/kavishdevar/aln/composables/ToneVolumeSlider.kt index a305712..f3fd318 100644 --- a/android/app/src/main/java/me/kavishdevar/aln/composables/ToneVolumeSlider.kt +++ b/android/app/src/main/java/me/kavishdevar/aln/composables/ToneVolumeSlider.kt @@ -1,17 +1,17 @@ /* * AirPods like Normal (ALN) - Bringing Apple-only features to Linux and Android for seamless AirPods functionality! - * + * * Copyright (C) 2024 Kavish Devar - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. - * + * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ @@ -50,8 +50,8 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import me.kavishdevar.aln.services.AirPodsService import me.kavishdevar.aln.R +import me.kavishdevar.aln.services.AirPodsService import kotlin.math.roundToInt @OptIn(ExperimentalMaterial3Api::class) @@ -95,11 +95,11 @@ fun ToneVolumeSlider(service: AirPodsService, sharedPreferences: SharedPreferenc value = sliderValue.floatValue, onValueChange = { sliderValue.floatValue = it - service.setToneVolume(volume = it.toInt()) }, valueRange = 0f..100f, onValueChangeFinished = { sliderValue.floatValue = sliderValue.floatValue.roundToInt().toFloat() + service.setToneVolume(volume = sliderValue.floatValue.toInt()) }, modifier = Modifier .weight(1f) @@ -157,4 +157,4 @@ fun ToneVolumeSlider(service: AirPodsService, sharedPreferences: SharedPreferenc @Composable fun ToneVolumeSliderPreview() { ToneVolumeSlider(AirPodsService(), sharedPreferences = LocalContext.current.getSharedPreferences("preview", 0)) -} \ No newline at end of file +}