mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-26 05:14:09 +02:00
Fix: sleep timer gets stuck at 1 second
This commit is contained in:
@@ -264,7 +264,7 @@ constructor(private val playerNotificationService: PlayerNotificationService) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the chapter end time for use in End of Chapter timers. If less than 2 seconds remain in
|
* Gets the chapter end time for use in End of Chapter timers. If less than 10 seconds remain in
|
||||||
* the chapter, then use the next chapter.
|
* the chapter, then use the next chapter.
|
||||||
* @return Long? - the chapter end time in milliseconds, or null if there is no current session.
|
* @return Long? - the chapter end time in milliseconds, or null if there is no current session.
|
||||||
*/
|
*/
|
||||||
@@ -335,6 +335,14 @@ constructor(private val playerNotificationService: PlayerNotificationService) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If timer was cleared by going negative on time, clear the sleep timer length so pressing
|
||||||
|
// play allows playback to continue without the sleep timer continuously setting for 1 second.
|
||||||
|
if (sleepTimerLength == 1000L) {
|
||||||
|
Log.d(tag, "Sleep timer cleared by manually subtracting time, clearing sleep timer")
|
||||||
|
sleepTimerFinishedAt = 0L
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Automatically rewind in the book if settings are enabled
|
// Automatically rewind in the book if settings are enabled
|
||||||
tryRewindAutoSleepTimer()
|
tryRewindAutoSleepTimer()
|
||||||
|
|
||||||
@@ -466,7 +474,7 @@ constructor(private val playerNotificationService: PlayerNotificationService) {
|
|||||||
// Start an auto sleep timer
|
// Start an auto sleep timer
|
||||||
val currentHour = currentCalendar.get(Calendar.HOUR_OF_DAY)
|
val currentHour = currentCalendar.get(Calendar.HOUR_OF_DAY)
|
||||||
val currentMin = currentCalendar.get(Calendar.MINUTE)
|
val currentMin = currentCalendar.get(Calendar.MINUTE)
|
||||||
Log.i(tag, "Starting sleep timer at $currentHour:$currentMin")
|
Log.i(tag, "Starting auto sleep timer at $currentHour:$currentMin")
|
||||||
|
|
||||||
// Automatically rewind in the book if settings is enabled
|
// Automatically rewind in the book if settings is enabled
|
||||||
tryRewindAutoSleepTimer()
|
tryRewindAutoSleepTimer()
|
||||||
|
|||||||
Reference in New Issue
Block a user