feat(YouTube - Hide layout components): Hide player shopping shelf (#723)

This commit is contained in:
LisoUseInAIKyrios 2024-10-22 22:13:36 -04:00 committed by GitHub
parent 4d48f00d98
commit fbaf2883cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 7 deletions

View File

@ -106,7 +106,7 @@ public class Utils {
} }
/** /**
* 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 condition The setting to check for hiding the view.
* @param view The view to hide. * @param view The view to hide.

View File

@ -251,7 +251,7 @@ public final class LayoutComponentsFilter extends Filter {
); );
horizontalShelves = new StringFilterGroup( horizontalShelves = new StringFilterGroup(
Settings.HIDE_HORIZONTAL_SHELVES, null, // Multiple settings use this filter.
"horizontal_video_shelf.eml", "horizontal_video_shelf.eml",
"horizontal_shelf.eml", "horizontal_shelf.eml",
"horizontal_shelf_inline.eml", "horizontal_shelf_inline.eml",
@ -458,11 +458,18 @@ public final class LayoutComponentsFilter extends Filter {
} }
private static boolean hideShelves() { private static boolean hideShelves() {
// If the player is opened while library is selected, // Video player can show a horizontal shopping shelf below the video.
// then filter any recommendations below the player. // It appears this is the only shelf that can appear in the player,
if (PlayerType.getCurrent().isMaximizedOrFullscreen() // and no shelves are shown in the recommendations under the video.
// Or if the search is active while library is selected, then also filter. if (PlayerType.getCurrent().isMaximizedOrFullscreen()) {
|| NavigationBar.isSearchBarActive()) { return Settings.HIDE_PLAYER_STORE_SHELF.get();
}
if (!Settings.HIDE_HORIZONTAL_SHELVES.get()) {
return false;
}
if (NavigationBar.isSearchBarActive()) {
return true; return true;
} }

View File

@ -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_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_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_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_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_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); public static final BooleanSetting HIDE_VIDEO_ADS = new BooleanSetting("revanced_hide_video_ads", TRUE, true);