From 29fee793d665092da6d1525e71d8b0f1653c1945 Mon Sep 17 00:00:00 2001 From: IDS-YN <121981944+IDS-YN@users.noreply.github.com> Date: Sat, 14 Feb 2026 02:44:49 +0100 Subject: [PATCH] Part 1/2 fixing sleeptimer change First file of two to be edited sleepTimerChanged wasn't used so I added it in the showSleepTimer under the condition that it is called if the value of sleeptimer is above 0. Also in sleepTimerChanged I put the two binding under a if condition checking if the value of the sleeptimer it above 0,, otherwise if it is 0 it is left to finish but could be uneccessary because the function shouldn't be called if the timer is already at 0. Sorry for making the fix in two pull request I'm still new to this, next request if final and only affect the file: SleepTimer.kt --- .../org/fossify/musicplayer/activities/MainActivity.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/org/fossify/musicplayer/activities/MainActivity.kt b/app/src/main/kotlin/org/fossify/musicplayer/activities/MainActivity.kt index 9865320b..9597be9f 100644 --- a/app/src/main/kotlin/org/fossify/musicplayer/activities/MainActivity.kt +++ b/app/src/main/kotlin/org/fossify/musicplayer/activities/MainActivity.kt @@ -468,6 +468,8 @@ class MainActivity : SimpleMusicActivity() { } } else if (it > 0) { pickedSleepTimer(it) + } else if (config.lastSleepTimerSeconds > 0) { + sleepTimerChanged(Events.SleepTimerChanged(seconds = it)) } } } @@ -500,10 +502,10 @@ class MainActivity : SimpleMusicActivity() { @Subscribe(threadMode = ThreadMode.MAIN) fun sleepTimerChanged(event: Events.SleepTimerChanged) { - binding.sleepTimerValue.text = event.seconds.getFormattedDuration() - binding.sleepTimerHolder.beVisible() - - if (event.seconds == 0) { + if (event.seconds > 0) { + binding.sleepTimerValue.text = event.seconds.getFormattedDuration() + binding.sleepTimerHolder.beVisible() + } else { finish() } }