Skip to content

Commit

Permalink
Check if we are still attached upon seekbar change.
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulWoitaschek committed Jan 5, 2019
1 parent 1c41152 commit 14cf2e5
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ class BookPlayController(
private fun setupSeekBar() {
seekBar.setOnSeekBarChangeListener(
object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(view: SeekBar?, progress: Int, p2: Boolean) {
override fun onProgressChanged(view: SeekBar?, progress: Int, fromUser: Boolean) {
if (!isAttached) return
// sets text to adjust while using seekBar
playedTime.text = formatTime(progress.toLong(), seekBar.max.toLong())
}
Expand All @@ -181,6 +182,7 @@ class BookPlayController(
}

override fun onStopTrackingTouch(view: SeekBar?) {
if (!isAttached) return
currentChapter?.let {
val progress = seekBar.progress
presenter.seekTo(it.start + progress, it.file)
Expand Down

0 comments on commit 14cf2e5

Please sign in to comment.