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:
@@ -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.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user