mirror of
https://github.com/revanced/revanced-integrations
synced 2024-11-24 20:07:14 +01:00
feat(YouTube - Playback speed): Add option to show speed dialog button in video player (#636)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
571ce75c84
commit
59220d6e25
@ -159,7 +159,7 @@ public class CustomPlaybackSpeedPatch {
|
||||
});
|
||||
}
|
||||
|
||||
private 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();
|
||||
|
@ -127,6 +127,7 @@ public class Settings extends BaseSettings {
|
||||
public static final BooleanSetting HIDE_PLAYER_BUTTONS = new BooleanSetting("revanced_hide_player_buttons", FALSE);
|
||||
public static final BooleanSetting COPY_VIDEO_URL = new BooleanSetting("revanced_copy_video_url", FALSE);
|
||||
public static final BooleanSetting COPY_VIDEO_URL_TIMESTAMP = new BooleanSetting("revanced_copy_video_url_timestamp", TRUE);
|
||||
public static final BooleanSetting PLAYBACK_SPEED_DIALOG_BUTTON = new BooleanSetting("revanced_playback_speed_dialog_button", FALSE);
|
||||
|
||||
// External downloader
|
||||
public static final BooleanSetting EXTERNAL_DOWNLOADER = new BooleanSetting("revanced_external_downloader", FALSE);
|
||||
|
@ -0,0 +1,43 @@
|
||||
package app.revanced.integrations.youtube.videoplayer;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import app.revanced.integrations.youtube.patches.playback.speed.CustomPlaybackSpeedPatch;
|
||||
import app.revanced.integrations.youtube.settings.Settings;
|
||||
import app.revanced.integrations.shared.Logger;
|
||||
|
||||
public class PlaybackSpeedDialogButton extends BottomControlButton {
|
||||
@Nullable
|
||||
private static PlaybackSpeedDialogButton instance;
|
||||
|
||||
public PlaybackSpeedDialogButton(ViewGroup viewGroup) {
|
||||
super(
|
||||
viewGroup,
|
||||
"revanced_playback_speed_dialog_button",
|
||||
Settings.PLAYBACK_SPEED_DIALOG_BUTTON,
|
||||
view -> CustomPlaybackSpeedPatch.showOldPlaybackSpeedMenu(),
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
public static void initializeButton(View view) {
|
||||
try {
|
||||
instance = new PlaybackSpeedDialogButton((ViewGroup) view);
|
||||
} catch (Exception ex) {
|
||||
Logger.printException(() -> "initializeButton failure", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
public static void changeVisibility(boolean showing) {
|
||||
if (instance != null) instance.setVisibility(showing);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user