From 8f28653b288597fd75f83b09a71de97b6805da20 Mon Sep 17 00:00:00 2001 From: Kelvin Date: Sat, 7 Jun 2025 16:44:20 +0200 Subject: [PATCH] Fix edgecases for new playback speed control --- .../fragment/mainactivity/main/VideoDetailView.kt | 4 ++-- .../java/com/futo/platformplayer/views/fields/ToggleField.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt index 8e514ce0..45ccf042 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt @@ -2166,9 +2166,9 @@ class VideoDetailView : ConstraintLayout { var playbackSpeedString = v; val stepSpeed = Settings.instance.playback.getPlaybackSpeedStep(); if(v == "+") - playbackSpeedString = String.format("%.2f", (currentPlaybackSpeed?.toDouble() ?: 1.0) + stepSpeed).toString(); + playbackSpeedString = String.format("%.2f", Math.min((currentPlaybackSpeed?.toDouble() ?: 1.0) + stepSpeed, 5.0)).toString(); else if(v == "-") - playbackSpeedString = String.format("%.2f", (currentPlaybackSpeed?.toDouble() ?: 1.0) - stepSpeed).toString(); + playbackSpeedString = String.format("%.2f", Math.max(0.1, (currentPlaybackSpeed?.toDouble() ?: 1.0) - stepSpeed)).toString(); val newPlaybackSpeed = playbackSpeedString.toDouble(); if (_isCasting) { val ad = StateCasting.instance.activeDevice ?: return@subscribe diff --git a/app/src/main/java/com/futo/platformplayer/views/fields/ToggleField.kt b/app/src/main/java/com/futo/platformplayer/views/fields/ToggleField.kt index c419092c..f9b483b3 100644 --- a/app/src/main/java/com/futo/platformplayer/views/fields/ToggleField.kt +++ b/app/src/main/java/com/futo/platformplayer/views/fields/ToggleField.kt @@ -90,7 +90,7 @@ class ToggleField : TableRow, IField { val advancedFieldAttr = field.getAnnotation(AdvancedField::class.java) if(advancedFieldAttr != null || advanced) { - Logger.w("ToggleField", "Found advanced field: " + field.name); + Logger.w("ToggleField", "Found cccadvanced field: " + field.name); isAdvanced = true; }