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

Commit

Permalink
fix(YouTube - Hide load more button): Include patch with `Hide layout…
Browse files Browse the repository at this point in the history
… components`, and hide button only in search feed (#600)
  • Loading branch information
johnconner122 authored Apr 4, 2024
1 parent 33da670 commit c420891
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package app.revanced.integrations.youtube.patches.components;

import android.os.Build;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;

import app.revanced.integrations.shared.Utils;
import app.revanced.integrations.youtube.settings.Settings;
import app.revanced.integrations.shared.Logger;
import app.revanced.integrations.youtube.StringTrieSearch;
import app.revanced.integrations.youtube.shared.NavigationBar;
import app.revanced.integrations.youtube.shared.PlayerType;

@SuppressWarnings("unused")
public final class LayoutComponentsFilter extends Filter {
Expand Down Expand Up @@ -322,7 +326,24 @@ public static boolean filterMixPlaylists(final Object conversionContext, @Nullab
return true;
}

/**
* Injection point.
*/
public static boolean showWatermark() {
return !Settings.HIDE_VIDEO_CHANNEL_WATERMARK.get();
}

private static final boolean HIDE_SHOW_MORE_BUTTON_ENABLED = Settings.HIDE_SHOW_MORE_BUTTON.get();

/**
* Injection point.
*/
public static void hideShowMoreButton(View view) {
if (HIDE_SHOW_MORE_BUTTON_ENABLED
&& NavigationBar.isSearchBarActive()
// Search bar can be active but behind the player.
&& !PlayerType.getCurrent().isMaximizedOrFullscreen()) {
Utils.hideViewByLayoutParams(view);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_KEYWORD_CONTENT_SEARCH = new BooleanSetting("revanced_hide_keyword_content_search", FALSE);
public static final StringSetting HIDE_KEYWORD_CONTENT_PHRASES = new StringSetting("revanced_hide_keyword_content_phrases", "",
parentsAny(HIDE_KEYWORD_CONTENT_HOME, HIDE_KEYWORD_CONTENT_SUBSCRIPTIONS, HIDE_KEYWORD_CONTENT_SEARCH));
public static final BooleanSetting HIDE_LOAD_MORE_BUTTON = new BooleanSetting("revanced_hide_load_more_button", TRUE, true);
@Deprecated public static final BooleanSetting HIDE_LOAD_MORE_BUTTON = new BooleanSetting("revanced_hide_load_more_button", TRUE);
public static final BooleanSetting HIDE_SHOW_MORE_BUTTON = new BooleanSetting("revanced_hide_show_more_button", TRUE, true);
public static final BooleanSetting HIDE_MEDICAL_PANELS = new BooleanSetting("revanced_hide_medical_panels", TRUE);
public static final BooleanSetting HIDE_MIX_PLAYLISTS = new BooleanSetting("revanced_hide_mix_playlists", TRUE);
public static final BooleanSetting HIDE_MOVIES_SECTION = new BooleanSetting("revanced_hide_movies_section", TRUE);
Expand Down Expand Up @@ -384,6 +385,8 @@ public class Settings extends BaseSettings {
HIDE_SHORTS_SEARCH.save(true);
}

migrateOldSettingToNew(HIDE_LOAD_MORE_BUTTON, HIDE_SHOW_MORE_BUTTON);

// endregion
}
}

0 comments on commit c420891

Please sign in to comment.