Fix crash with fast scroller

Fix an issue where the app would crash if the fast scroller is scrolled above the indicators. This change will be backported to 1.3.3.
This commit is contained in:
OxygenCobalt 2021-03-23 20:20:22 -06:00
parent ec78684c25
commit 54efad3fdf
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
3 changed files with 8 additions and 4 deletions

View file

@ -208,7 +208,7 @@ class PlaybackService : Service(), Player.EventListener, PlaybackStateManager.Ca
}
// We use the wakelock to ensure that the CPU is active while music is being loaded
holdWakelock()
acquireWakeLock()
}
override fun onPlayerError(error: ExoPlaybackException) {
@ -439,8 +439,10 @@ class PlaybackService : Service(), Player.EventListener, PlaybackStateManager.Ca
/**
* Hold the wakelock for the default amount of time [25 Seconds]
*/
private fun holdWakelock() {
private fun acquireWakeLock() {
wakeLock.acquire(WAKELOCK_TIME)
logD("Wakelock is held.")
}
/**
@ -449,6 +451,8 @@ class PlaybackService : Service(), Player.EventListener, PlaybackStateManager.Ca
private fun releaseWakelock() {
if (wakeLock.isHeld) {
wakeLock.release()
logD("Wakelock is released.")
}
}

View file

@ -218,6 +218,6 @@ class FastScrollView @JvmOverloads constructor(
* Returns if the pointer is currently in the view
*/
private fun View.isBeingPressed(x: Int, y: Int): Boolean {
return (x in (left until right) && y in (top until bottom)) || isPressed
return y in (top until bottom)
}
}

View file

@ -1,2 +1,2 @@
- Fixed crash that would prevent the playback state from being saved
- Integrated fast-scroller completely in codebase
- Completely integrated fast-scroller into codebase