feat(YouTube - Hide layout components): Add "Hide cell divider", "Hide featured links", and "Hide featured videos" options (#6335)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
ILoveOpenSourceApplications
2025-12-08 17:32:22 +05:30
committed by GitHub
parent a0ec4c07f7
commit a5d197b977
6 changed files with 57 additions and 18 deletions

View File

@@ -58,6 +58,23 @@ public abstract class Setting<T> {
};
}
/**
* Availability based on a single parent setting being disabled.
*/
public static Availability parentNot(BooleanSetting parent) {
return new Availability() {
@Override
public boolean isAvailable() {
return !parent.get();
}
@Override
public List<Setting<?>> getParentSettings() {
return Collections.singletonList(parent);
}
};
}
/**
* Availability based on all parents being enabled.
*/

View File

@@ -44,10 +44,14 @@ final class DescriptionComponentsFilter extends Filter {
"video_attributes_section"
);
final StringFilterGroup featuredSection = new StringFilterGroup(
Settings.HIDE_FEATURED_SECTION,
// "media_lockup", "structured_description_video_lockup"
"compact_infocard"
final StringFilterGroup featuredLinksSection = new StringFilterGroup(
Settings.HIDE_FEATURED_LINKS_SECTION,
"media_lockup"
);
final StringFilterGroup featuredVideosSection = new StringFilterGroup(
Settings.HIDE_FEATURED_VIDEOS_SECTION,
"structured_description_video_lockup"
);
final StringFilterGroup podcastSection = new StringFilterGroup(
@@ -76,7 +80,7 @@ final class DescriptionComponentsFilter extends Filter {
);
subscribeButton = new StringFilterGroup(
Settings.HIDE_DESCRIPTION_SUBSCRIBE_BUTTON,
Settings.HIDE_SUBSCRIBE_BUTTON,
"subscribe_button"
);
@@ -110,7 +114,8 @@ final class DescriptionComponentsFilter extends Filter {
aiGeneratedVideoSummarySection,
askSection,
attributesSection,
featuredSection,
featuredLinksSection,
featuredVideosSection,
horizontalShelf,
howThisWasMadeSection,
hypePoints,

View File

@@ -63,12 +63,18 @@ public final class LayoutComponentsFilter extends Filter {
// Identifiers.
final var cellDivider = new StringFilterGroup(
Settings.HIDE_CELL_DIVIDER,
"cell_divider"
);
final var chipsShelf = new StringFilterGroup(
Settings.HIDE_CHIPS_SHELF,
"chips_shelf"
);
addIdentifierCallbacks(
cellDivider,
chipsShelf
);

View File

@@ -3,6 +3,7 @@ package app.revanced.extension.youtube.settings;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import static app.revanced.extension.shared.settings.Setting.parent;
import static app.revanced.extension.shared.settings.Setting.parentNot;
import static app.revanced.extension.shared.settings.Setting.parentsAll;
import static app.revanced.extension.shared.settings.Setting.parentsAny;
import static app.revanced.extension.youtube.patches.ChangeFormFactorPatch.FormFactor;
@@ -92,6 +93,7 @@ public class Settings extends BaseSettings {
// Feed
public static final BooleanSetting HIDE_ALBUM_CARDS = new BooleanSetting("revanced_hide_album_cards", FALSE, true);
public static final BooleanSetting HIDE_ARTIST_CARDS = new BooleanSetting("revanced_hide_artist_cards", FALSE);
public static final BooleanSetting HIDE_CELL_DIVIDER = new BooleanSetting("revanced_hide_cell_divider", TRUE);
public static final BooleanSetting HIDE_CHIPS_SHELF = new BooleanSetting("revanced_hide_chips_shelf", TRUE);
public static final BooleanSetting HIDE_COMMUNITY_POSTS = new BooleanSetting("revanced_hide_community_posts", FALSE);
public static final BooleanSetting HIDE_COMPACT_BANNER = new BooleanSetting("revanced_hide_compact_banner", TRUE);
@@ -210,13 +212,14 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_ASK_SECTION = new BooleanSetting("revanced_hide_ask_section", FALSE);
public static final BooleanSetting HIDE_ATTRIBUTES_SECTION = new BooleanSetting("revanced_hide_attributes_section", FALSE);
public static final BooleanSetting HIDE_CHAPTERS_SECTION = new BooleanSetting("revanced_hide_chapters_section", TRUE);
public static final BooleanSetting HIDE_FEATURED_SECTION = new BooleanSetting("revanced_hide_featured_section", TRUE);
public static final BooleanSetting HIDE_HOW_THIS_WAS_MADE_SECTION = new BooleanSetting("revanced_hide_how_this_was_made_section", FALSE);
public static final BooleanSetting HIDE_HYPE_POINTS = new BooleanSetting("revanced_hide_hype_points", FALSE);
public static final BooleanSetting HIDE_INFO_CARDS_SECTION = new BooleanSetting("revanced_hide_info_cards_section", TRUE);
public static final BooleanSetting HIDE_FEATURED_LINKS_SECTION = new BooleanSetting("revanced_hide_featured_links_section", FALSE, parentNot(HIDE_INFO_CARDS_SECTION));
public static final BooleanSetting HIDE_FEATURED_VIDEOS_SECTION = new BooleanSetting("revanced_hide_featured_videos_section", FALSE, parentNot(HIDE_INFO_CARDS_SECTION));
public static final BooleanSetting HIDE_SUBSCRIBE_BUTTON = new BooleanSetting("revanced_hide_subscribe_button", FALSE, parentNot(HIDE_INFO_CARDS_SECTION));
public static final BooleanSetting HIDE_KEY_CONCEPTS_SECTION = new BooleanSetting("revanced_hide_key_concepts_section", FALSE);
public static final BooleanSetting HIDE_PODCAST_SECTION = new BooleanSetting("revanced_hide_podcast_section", TRUE);
public static final BooleanSetting HIDE_DESCRIPTION_SUBSCRIBE_BUTTON = new BooleanSetting("revanced_hide_description_subscribe_button", TRUE);
public static final BooleanSetting HIDE_TRANSCRIPT_SECTION = new BooleanSetting("revanced_hide_transcript_section", TRUE);
// Action buttons

View File

@@ -145,13 +145,14 @@ val hideLayoutComponentsPatch = bytecodePatch(
SwitchPreference("revanced_hide_ask_section"),
SwitchPreference("revanced_hide_attributes_section"),
SwitchPreference("revanced_hide_chapters_section"),
SwitchPreference("revanced_hide_featured_section"),
SwitchPreference("revanced_hide_featured_links_section"),
SwitchPreference("revanced_hide_featured_videos_section"),
SwitchPreference("revanced_hide_info_cards_section"),
SwitchPreference("revanced_hide_how_this_was_made_section"),
SwitchPreference("revanced_hide_hype_points"),
SwitchPreference("revanced_hide_key_concepts_section"),
SwitchPreference("revanced_hide_podcast_section"),
SwitchPreference("revanced_hide_description_subscribe_button"),
SwitchPreference("revanced_hide_subscribe_button"),
SwitchPreference("revanced_hide_transcript_section"),
),
),
@@ -223,10 +224,11 @@ val hideLayoutComponentsPatch = bytecodePatch(
),
SwitchPreference("revanced_hide_album_cards"),
SwitchPreference("revanced_hide_artist_cards"),
SwitchPreference("revanced_hide_cell_divider"),
SwitchPreference("revanced_hide_chips_shelf"),
SwitchPreference("revanced_hide_community_posts"),
SwitchPreference("revanced_hide_compact_banner"),
SwitchPreference("revanced_hide_crowdfunding_box"),
SwitchPreference("revanced_hide_chips_shelf"),
SwitchPreference("revanced_hide_expandable_card"),
SwitchPreference("revanced_hide_floating_microphone_button"),
SwitchPreference(
@@ -242,9 +244,9 @@ val hideLayoutComponentsPatch = bytecodePatch(
SwitchPreference("revanced_hide_show_more_button"),
SwitchPreference("revanced_hide_surveys"),
SwitchPreference("revanced_hide_ticket_shelf"),
SwitchPreference("revanced_hide_upload_time"),
SwitchPreference("revanced_hide_video_recommendation_labels"),
SwitchPreference("revanced_hide_view_count"),
SwitchPreference("revanced_hide_upload_time"),
SwitchPreference("revanced_hide_doodles"),
)

View File

@@ -223,6 +223,9 @@ However, enabling this will also log some user data such as your IP address."</s
<string name="revanced_hide_artist_cards_title">Hide artist cards</string>
<string name="revanced_hide_artist_cards_summary_on">Artist cards are hidden</string>
<string name="revanced_hide_artist_cards_summary_off">Artist cards are shown</string>
<string name="revanced_hide_cell_divider_title">Hide cell divider</string>
<string name="revanced_hide_cell_divider_summary_on">Cell divider (Visual space) is hidden</string>
<string name="revanced_hide_cell_divider_summary_off">Cell divider (Visual space) is shown</string>
<string name="revanced_hide_chips_shelf_title">Hide chips shelf</string>
<string name="revanced_hide_chips_shelf_summary_on">Chips shelf is hidden</string>
<string name="revanced_hide_chips_shelf_summary_off">Chips shelf is shown</string>
@@ -346,18 +349,21 @@ If a Doodle is currently showing in your region and this hide setting is on, the
<string name="revanced_hide_podcast_section_title">Hide \'Explore the podcast\'</string>
<string name="revanced_hide_podcast_section_summary_on">Explore the podcast section is hidden</string>
<string name="revanced_hide_podcast_section_summary_off">Explore the podcast section is shown</string>
<string name="revanced_hide_featured_section_title">Hide Featured content</string>
<string name="revanced_hide_featured_section_summary_on">Featured content section is hidden</string>
<string name="revanced_hide_featured_section_summary_off">Featured content section is shown</string>
<string name="revanced_hide_featured_links_section_title">Hide Featured links</string>
<string name="revanced_hide_featured_links_section_summary_on">Featured links section is hidden</string>
<string name="revanced_hide_featured_links_section_summary_off">Featured links section is shown</string>
<string name="revanced_hide_featured_videos_section_title">Hide Featured videos</string>
<string name="revanced_hide_featured_videos_section_summary_on">Featured videos section is hidden</string>
<string name="revanced_hide_featured_videos_section_summary_off">Featured videos section is shown</string>
<string name="revanced_hide_info_cards_section_title">Hide Info cards</string>
<string name="revanced_hide_info_cards_section_summary_on">Info cards section is hidden</string>
<string name="revanced_hide_info_cards_section_summary_off">Info cards section is shown</string>
<string name="revanced_hide_key_concepts_section_title">Hide \'Key concepts\'</string>
<string name="revanced_hide_key_concepts_section_summary_on">Key concepts section is hidden</string>
<string name="revanced_hide_key_concepts_section_summary_off">Key concepts section is shown</string>
<string name="revanced_hide_description_subscribe_button_title">Hide Subscribe button</string>
<string name="revanced_hide_description_subscribe_button_summary_on">Subscribe button is hidden</string>
<string name="revanced_hide_description_subscribe_button_summary_off">Subscribe button is shown</string>
<string name="revanced_hide_subscribe_button_title">Hide Subscribe button</string>
<string name="revanced_hide_subscribe_button_summary_on">Subscribe button is hidden</string>
<string name="revanced_hide_subscribe_button_summary_off">Subscribe button is shown</string>
<string name="revanced_hide_transcript_section_title">Hide Transcript</string>
<string name="revanced_hide_transcript_section_summary_on">Transcript section is hidden</string>
<string name="revanced_hide_transcript_section_summary_off">Transcript section is shown</string>