mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-25 14:19:27 +03:00
Fix inverted playback time crash (#661)
Fixes the bug where player will crash while trying to invert time while video is not loaded Co-authored-by: jmir1 <jhmiramon@gmail.com>
This commit is contained in:
parent
a6ce2d17f4
commit
aa8f3c8dd4
2 changed files with 12 additions and 10 deletions
|
@ -1456,7 +1456,7 @@ class PlayerActivity :
|
||||||
playerControls.updatePlaybackPos(value.toInt())
|
playerControls.updatePlaybackPos(value.toInt())
|
||||||
if (preferences.invertedDurationTxt().get()) playerControls.updatePlaybackDuration(value.toInt())
|
if (preferences.invertedDurationTxt().get()) playerControls.updatePlaybackDuration(value.toInt())
|
||||||
}
|
}
|
||||||
"duration" -> playerControls.updatePlaybackDuration(value.toInt())
|
"duration" -> if (!preferences.invertedDurationTxt().get()) playerControls.updatePlaybackDuration(value.toInt())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,21 +161,23 @@ class PlayerControlsView @JvmOverloads constructor(context: Context, attrs: Attr
|
||||||
binding.controlsSkipIntroBtn.setOnLongClickListener { skipIntroLengthDialog(); true }
|
binding.controlsSkipIntroBtn.setOnLongClickListener { skipIntroLengthDialog(); true }
|
||||||
|
|
||||||
binding.playbackPositionBtn.setOnClickListener {
|
binding.playbackPositionBtn.setOnClickListener {
|
||||||
preferences.invertedDurationTxt().set(false)
|
if (activity.player.timePos != null && activity.player.duration != null) {
|
||||||
preferences.invertedPlaybackTxt().set(!preferences.invertedPlaybackTxt().get())
|
preferences.invertedDurationTxt().set(false)
|
||||||
if (activity.player.timePos != null) {
|
preferences.invertedPlaybackTxt().set(!preferences.invertedPlaybackTxt().get())
|
||||||
updatePlaybackPos(activity.player.timePos!!)
|
updatePlaybackPos(activity.player.timePos!!)
|
||||||
updatePlaybackDuration(activity.player.duration!!)
|
updatePlaybackDuration(activity.player.duration!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.playbackDurationBtn.setOnClickListener {
|
binding.playbackDurationBtn.setOnClickListener {
|
||||||
preferences.invertedPlaybackTxt().set(false)
|
if (activity.player.timePos != null && activity.player.duration != null) {
|
||||||
preferences.invertedDurationTxt().set(!preferences.invertedDurationTxt().get())
|
preferences.invertedPlaybackTxt().set(false)
|
||||||
if (preferences.invertedDurationTxt().get() && activity.player.timePos != null) {
|
preferences.invertedDurationTxt().set(!preferences.invertedDurationTxt().get())
|
||||||
updatePlaybackPos(activity.player.timePos!!)
|
if (preferences.invertedDurationTxt().get()) {
|
||||||
updatePlaybackDuration(activity.player.timePos!!)
|
updatePlaybackPos(activity.player.timePos!!)
|
||||||
} else updatePlaybackDuration(activity.player.duration!!)
|
updatePlaybackDuration(activity.player.timePos!!)
|
||||||
|
} else updatePlaybackDuration(activity.player.duration!!)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.toggleAutoplay.setOnCheckedChangeListener { _, isChecked ->
|
binding.toggleAutoplay.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
|
Loading…
Reference in a new issue