fix(YouTube - Playback speed): Fix playback speed menu opening from the feed flyout menu when Restore old playback speed menu is off
Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com>
This commit is contained in:
parent
0371f7164f
commit
467a62f4ac
1 changed files with 12 additions and 11 deletions
|
|
@ -81,9 +81,9 @@ public class CustomPlaybackSpeedPatch {
|
||||||
private static final float customPlaybackSpeedsMin, customPlaybackSpeedsMax;
|
private static final float customPlaybackSpeedsMin, customPlaybackSpeedsMax;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The last time the old playback menu was forcefully called.
|
* The last time the playback menu was forcefully called.
|
||||||
*/
|
*/
|
||||||
private static volatile long lastTimeOldPlaybackMenuInvoked;
|
private static volatile long lastTimePlaybackMenuInvoked;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats speeds to UI strings.
|
* Formats speeds to UI strings.
|
||||||
|
|
@ -238,6 +238,15 @@ public class CustomPlaybackSpeedPatch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method is sometimes used multiple times.
|
||||||
|
// To prevent this, ignore method reuse within 1 second.
|
||||||
|
final long now = System.currentTimeMillis();
|
||||||
|
if (now - lastTimePlaybackMenuInvoked < 1000) {
|
||||||
|
Logger.printDebug(() -> "Ignoring call to hideLithoMenuAndShowSpeedMenu");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
lastTimePlaybackMenuInvoked = now;
|
||||||
|
|
||||||
// Dismiss View [R.id.touch_outside] is the 1st ChildView of the 4th ParentView.
|
// Dismiss View [R.id.touch_outside] is the 1st ChildView of the 4th ParentView.
|
||||||
// This only shows in phone layout.
|
// This only shows in phone layout.
|
||||||
var touchInsidedView = parentView4th.getChildAt(0);
|
var touchInsidedView = parentView4th.getChildAt(0);
|
||||||
|
|
@ -261,16 +270,8 @@ public class CustomPlaybackSpeedPatch {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showOldPlaybackSpeedMenu() {
|
public static void showOldPlaybackSpeedMenu() {
|
||||||
// This method is sometimes used multiple times.
|
|
||||||
// To prevent this, ignore method reuse within 1 second.
|
|
||||||
final long now = System.currentTimeMillis();
|
|
||||||
if (now - lastTimeOldPlaybackMenuInvoked < 1000) {
|
|
||||||
Logger.printDebug(() -> "Ignoring call to showOldPlaybackSpeedMenu");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
lastTimeOldPlaybackMenuInvoked = now;
|
|
||||||
|
|
||||||
// Rest of the implementation added by patch.
|
// Rest of the implementation added by patch.
|
||||||
|
Logger.printDebug(() -> "showOldPlaybackSpeedMenu");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue