Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
feat(YouTube - Hide layout components): Hide player shopping shelf (#723
Browse files Browse the repository at this point in the history
)
  • Loading branch information
LisoUseInAIKyrios authored Oct 23, 2024
1 parent 4d48f00 commit fbaf288
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static void hideViewBy0dpUnderCondition(BooleanSetting condition, View vi
}

/**
* Hide a view by setting its layout height and width to 1dp.
* Hide a view by setting its layout height and width to 0dp.
*
* @param condition The setting to check for hiding the view.
* @param view The view to hide.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public LayoutComponentsFilter() {
);

horizontalShelves = new StringFilterGroup(
Settings.HIDE_HORIZONTAL_SHELVES,
null, // Multiple settings use this filter.
"horizontal_video_shelf.eml",
"horizontal_shelf.eml",
"horizontal_shelf_inline.eml",
Expand Down Expand Up @@ -458,11 +458,18 @@ public static void hideShowMoreButton(View view) {
}

private static boolean hideShelves() {
// If the player is opened while library is selected,
// then filter any recommendations below the player.
if (PlayerType.getCurrent().isMaximizedOrFullscreen()
// Or if the search is active while library is selected, then also filter.
|| NavigationBar.isSearchBarActive()) {
// Video player can show a horizontal shopping shelf below the video.
// It appears this is the only shelf that can appear in the player,
// and no shelves are shown in the recommendations under the video.
if (PlayerType.getCurrent().isMaximizedOrFullscreen()) {
return Settings.HIDE_PLAYER_STORE_SHELF.get();
}

if (!Settings.HIDE_HORIZONTAL_SHELVES.get()) {
return false;
}

if (NavigationBar.isSearchBarActive()) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_MERCHANDISE_BANNERS = new BooleanSetting("revanced_hide_merchandise_banners", TRUE);
public static final BooleanSetting HIDE_PAID_PROMOTION_LABEL = new BooleanSetting("revanced_hide_paid_promotion_label", TRUE);
public static final BooleanSetting HIDE_PRODUCTS_BANNER = new BooleanSetting("revanced_hide_products_banner", TRUE);
public static final BooleanSetting HIDE_PLAYER_STORE_SHELF = new BooleanSetting("revanced_hide_player_store_shelf", TRUE);
public static final BooleanSetting HIDE_SHOPPING_LINKS = new BooleanSetting("revanced_hide_shopping_links", TRUE);
public static final BooleanSetting HIDE_SELF_SPONSOR = new BooleanSetting("revanced_hide_self_sponsor_ads", TRUE);
public static final BooleanSetting HIDE_VIDEO_ADS = new BooleanSetting("revanced_hide_video_ads", TRUE, true);
Expand Down

0 comments on commit fbaf288

Please sign in to comment.