From 0e63f49e1307d7a5dddf3c98b67622d07fb7cc77 Mon Sep 17 00:00:00 2001
From: ILoveOpenSourceApplications
<117499019+ILoveOpenSourceApplications@users.noreply.github.com>
Date: Tue, 24 Jun 2025 16:40:23 +0530
Subject: [PATCH] feat(YouTube - Hide video action buttons): Add `Hide Stop
ads` (#5245)
---
.../youtube/patches/components/ButtonsFilter.java | 6 +++++-
.../extension/youtube/settings/Settings.java | 5 +++--
.../layout/buttons/action/HideButtonsPatch.kt | 15 ++++++++-------
.../resources/addresources/values/strings.xml | 10 +++++++---
4 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/ButtonsFilter.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/ButtonsFilter.java
index 3ad2070ed..5773baa28 100644
--- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/ButtonsFilter.java
+++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/ButtonsFilter.java
@@ -46,7 +46,7 @@ final class ButtonsFilter extends Filter {
"|download_button.eml"
),
new StringFilterGroup(
- Settings.HIDE_PLAYLIST_BUTTON,
+ Settings.HIDE_SAVE_BUTTON,
"|save_to_playlist_button"
),
new StringFilterGroup(
@@ -76,6 +76,10 @@ final class ButtonsFilter extends Filter {
Settings.HIDE_ASK_BUTTON,
"yt_fill_spark"
),
+ new ByteArrayFilterGroup(
+ Settings.HIDE_STOP_ADS_BUTTON,
+ "yt_outline_slash_circle_left"
+ ),
// Check for clip button both here and using a path filter,
// as there's a chance the path is a generic action button and won't contain 'clip_button'
new ByteArrayFilterGroup(
diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java
index 83fc2a032..b71d7ebd4 100644
--- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java
+++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java
@@ -200,15 +200,16 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_TRANSCRIPT_SECTION = new BooleanSetting("revanced_hide_transcript_section", TRUE);
// Action buttons
public static final BooleanSetting DISABLE_LIKE_SUBSCRIBE_GLOW = new BooleanSetting("revanced_disable_like_subscribe_glow", FALSE);
+ public static final BooleanSetting HIDE_ASK_BUTTON = new BooleanSetting("revanced_hide_ask_button", FALSE);
public static final BooleanSetting HIDE_CLIP_BUTTON = new BooleanSetting("revanced_hide_clip_button", TRUE);
public static final BooleanSetting HIDE_DOWNLOAD_BUTTON = new BooleanSetting("revanced_hide_download_button", FALSE);
public static final BooleanSetting HIDE_LIKE_DISLIKE_BUTTON = new BooleanSetting("revanced_hide_like_dislike_button", FALSE);
- public static final BooleanSetting HIDE_PLAYLIST_BUTTON = new BooleanSetting("revanced_hide_playlist_button", FALSE);
public static final BooleanSetting HIDE_REMIX_BUTTON = new BooleanSetting("revanced_hide_remix_button", TRUE);
public static final BooleanSetting HIDE_REPORT_BUTTON = new BooleanSetting("revanced_hide_report_button", FALSE);
+ public static final BooleanSetting HIDE_SAVE_BUTTON = new BooleanSetting("revanced_hide_save_button", FALSE);
public static final BooleanSetting HIDE_SHARE_BUTTON = new BooleanSetting("revanced_hide_share_button", FALSE);
+ public static final BooleanSetting HIDE_STOP_ADS_BUTTON = new BooleanSetting("revanced_hide_stop_ads_button", TRUE);
public static final BooleanSetting HIDE_THANKS_BUTTON = new BooleanSetting("revanced_hide_thanks_button", TRUE);
- public static final BooleanSetting HIDE_ASK_BUTTON = new BooleanSetting("revanced_hide_ask_button", FALSE);
// Player flyout menu items
public static final BooleanSetting HIDE_PLAYER_FLYOUT_ADDITIONAL_SETTINGS = new BooleanSetting("revanced_hide_player_flyout_additional_settings", FALSE);
public static final BooleanSetting HIDE_PLAYER_FLYOUT_AMBIENT_MODE = new BooleanSetting("revanced_hide_player_flyout_ambient_mode", FALSE);
diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt
index 5db824a81..fb6a2fbc1 100644
--- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt
+++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt
@@ -38,15 +38,16 @@ val hideButtonsPatch = resourcePatch(
"revanced_hide_buttons_screen",
preferences = setOf(
SwitchPreference("revanced_disable_like_subscribe_glow"),
- SwitchPreference("revanced_hide_like_dislike_button"),
- SwitchPreference("revanced_hide_share_button"),
- SwitchPreference("revanced_hide_report_button"),
- SwitchPreference("revanced_hide_remix_button"),
- SwitchPreference("revanced_hide_download_button"),
- SwitchPreference("revanced_hide_thanks_button"),
SwitchPreference("revanced_hide_ask_button"),
SwitchPreference("revanced_hide_clip_button"),
- SwitchPreference("revanced_hide_playlist_button"),
+ SwitchPreference("revanced_hide_download_button"),
+ SwitchPreference("revanced_hide_like_dislike_button"),
+ SwitchPreference("revanced_hide_remix_button"),
+ SwitchPreference("revanced_hide_report_button"),
+ SwitchPreference("revanced_hide_save_button"),
+ SwitchPreference("revanced_hide_share_button"),
+ SwitchPreference("revanced_hide_stop_ads_button"),
+ SwitchPreference("revanced_hide_thanks_button"),
)
)
)
diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml
index 07daa21c5..8877f1696 100644
--- a/patches/src/main/resources/addresources/values/strings.xml
+++ b/patches/src/main/resources/addresources/values/strings.xml
@@ -595,6 +595,10 @@ Adjust volume by swiping vertically on the right side of the screen"
Hide Share
Share button is hidden
Share button is shown
+
+ Hide Stop ads
+ Stop ads button is hidden
+ Stop ads button is shown
Hide Report
@@ -622,9 +626,9 @@ Adjust volume by swiping vertically on the right side of the screen"
Clip button is hidden
Clip button is shown
- Hide Save to playlist
- Save to playlist button is hidden
- Save to playlist button is shown
+ Hide Save
+ Save button is hidden
+ Save button is shown
Navigation buttons