1
mirror of https://github.com/revanced/revanced-integrations synced 2024-11-22 05:02:19 +01:00

fix(YouTube - Hide load more button): Include patch with Hide layout components, and hide button only in search feed (#600)

This commit is contained in:
nullptr 2024-04-05 00:09:42 +03:00 committed by GitHub
parent 33da670984
commit c420891e3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 15 deletions

View File

@ -1,14 +0,0 @@
package app.revanced.integrations.youtube.patches;
import android.view.View;
import app.revanced.integrations.youtube.settings.Settings;
import app.revanced.integrations.shared.Utils;
@SuppressWarnings("unused")
public class HideLoadMoreButtonPatch {
public static void hideLoadMoreButton(View view){
if(!Settings.HIDE_LOAD_MORE_BUTTON.get()) return;
Utils.hideViewByLayoutParams(view);
}
}

View File

@ -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 {
@ -322,7 +326,24 @@ public final class LayoutComponentsFilter extends Filter {
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);
}
}
}

View File

@ -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);
@ -384,6 +385,8 @@ public class Settings extends BaseSettings {
HIDE_SHORTS_SEARCH.save(true);
}
migrateOldSettingToNew(HIDE_LOAD_MORE_BUTTON, HIDE_SHOW_MORE_BUTTON);
// endregion
}
}