This repository has been archived by the owner on Oct 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YouTube - Playback speed): Add option to show speed dialog butto…
…n in video player (#636) Co-authored-by: oSumAtrIX <[email protected]>
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...rc/main/java/app/revanced/integrations/youtube/videoplayer/PlaybackSpeedDialogButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |