feat(YouTube - Playback speed): Allows disabling tap and hold speed

Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com>
This commit is contained in:
oSumAtrIX 2026-03-19 18:57:49 +01:00
parent 5c7fc97059
commit b71e4f95ff
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
3 changed files with 34 additions and 2 deletions

View file

@ -60,6 +60,11 @@ public class CustomPlaybackSpeedPatch {
*/
private static final float PROGRESS_BAR_VALUE_SCALE = 100;
/**
* Disable tap and hold speed, true when TAP_AND_HOLD_SPEED is 0.
*/
private static final boolean DISABLE_TAP_AND_HOLD_SPEED;
/**
* Tap and hold speed.
*/
@ -96,7 +101,12 @@ public class CustomPlaybackSpeedPatch {
speedFormatter.setMaximumFractionDigits(2);
final float holdSpeed = Settings.SPEED_TAP_AND_HOLD.get();
if (holdSpeed > 0 && holdSpeed <= PLAYBACK_SPEED_MAXIMUM) {
DISABLE_TAP_AND_HOLD_SPEED = holdSpeed == 0;
if (DISABLE_TAP_AND_HOLD_SPEED) {
// A value for handling exceptions, but this is not used.
TAP_AND_HOLD_SPEED = Settings.SPEED_TAP_AND_HOLD.defaultValue;
} else if (holdSpeed > 0 && holdSpeed <= PLAYBACK_SPEED_MAXIMUM) {
TAP_AND_HOLD_SPEED = holdSpeed;
} else {
showInvalidCustomSpeedToast();
@ -108,6 +118,14 @@ public class CustomPlaybackSpeedPatch {
customPlaybackSpeedsMax = customPlaybackSpeeds[customPlaybackSpeeds.length - 1];
}
/**
* Injection point.
* Called before {@link #getTapAndHoldSpeed()}
*/
public static boolean disableTapAndHoldSpeed(boolean original) {
return !DISABLE_TAP_AND_HOLD_SPEED && original;
}
/**
* Injection point.
*/