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

Commit

Permalink
fix: Hide suggestion shelf layout components everywhere except the li…
Browse files Browse the repository at this point in the history
…brary tab and the player recommendations
  • Loading branch information
LisoUseInAIKyrios committed Apr 5, 2024
1 parent 73a2b30 commit 6c07b10
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class SuggestionsShelfFilter extends Filter {
public SuggestionsShelfFilter() {
addPathCallbacks(
new StringFilterGroup(
null, // Setting is based on navigation state.
Settings.HIDE_SUGGESTIONS_SHELF,
"horizontal_video_shelf.eml",
"horizontal_shelf.eml"
)
Expand All @@ -22,17 +22,17 @@ public SuggestionsShelfFilter() {
@Override
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
if (shouldHideSuggestionsShelf() && contentIndex == 0)
if (contentIndex == 0 && shouldHideSuggestionsShelf()) {
return super.isFiltered(path, identifier, protobufBufferArray, matchedGroup, contentType, contentIndex);
}

return false;
}

private static boolean shouldHideSuggestionsShelf() {
return Settings.HIDE_SUGGESTIONS_SHELF.get()
&& NavigationBar.NavigationButton.HOME.isSelected() // Home tab is selected.
&& !PlayerType.getCurrent().isMaximizedOrFullscreen() // The player is not opened.
&& !NavigationBar.isSearchBarActive(); // Search is not active.

return !PlayerType.getCurrent().isMaximizedOrFullscreen() // The player is not opened.
// Library tab is not selected.
// This check is important as the suggestion shelf layout is used for the library tab playlists.
&& !NavigationBar.NavigationButton.libraryOrYouTabIsSelected();
}
}

0 comments on commit 6c07b10

Please sign in to comment.