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())
|
||||
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.playbackPositionBtn.setOnClickListener {
|
||||
preferences.invertedDurationTxt().set(false)
|
||||
preferences.invertedPlaybackTxt().set(!preferences.invertedPlaybackTxt().get())
|
||||
if (activity.player.timePos != null) {
|
||||
if (activity.player.timePos != null && activity.player.duration != null) {
|
||||
preferences.invertedDurationTxt().set(false)
|
||||
preferences.invertedPlaybackTxt().set(!preferences.invertedPlaybackTxt().get())
|
||||
updatePlaybackPos(activity.player.timePos!!)
|
||||
updatePlaybackDuration(activity.player.duration!!)
|
||||
}
|
||||
}
|
||||
|
||||
binding.playbackDurationBtn.setOnClickListener {
|
||||
preferences.invertedPlaybackTxt().set(false)
|
||||
preferences.invertedDurationTxt().set(!preferences.invertedDurationTxt().get())
|
||||
if (preferences.invertedDurationTxt().get() && activity.player.timePos != null) {
|
||||
updatePlaybackPos(activity.player.timePos!!)
|
||||
updatePlaybackDuration(activity.player.timePos!!)
|
||||
} else updatePlaybackDuration(activity.player.duration!!)
|
||||
if (activity.player.timePos != null && activity.player.duration != null) {
|
||||
preferences.invertedPlaybackTxt().set(false)
|
||||
preferences.invertedDurationTxt().set(!preferences.invertedDurationTxt().get())
|
||||
if (preferences.invertedDurationTxt().get()) {
|
||||
updatePlaybackPos(activity.player.timePos!!)
|
||||
updatePlaybackDuration(activity.player.timePos!!)
|
||||
} else updatePlaybackDuration(activity.player.duration!!)
|
||||
}
|
||||
}
|
||||
|
||||
binding.toggleAutoplay.setOnCheckedChangeListener { _, isChecked ->
|
||||
|
|
Loading…
Reference in a new issue