fix(YouTube): Merge multiple layout patches into Hide Layout Components (#721)

This commit is contained in:
LisoUseInAIKyrios 2024-10-22 18:29:17 -04:00 committed by GitHub
parent 5f49e92579
commit c76d8b166e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 45 additions and 66 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 HideAlbumCardsPatch {
public static void hideAlbumCard(View view) {
if (!Settings.HIDE_ALBUM_CARDS.get()) return;
Utils.hideViewByLayoutParams(view);
}
}

View File

@ -1,15 +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 HideCrowdfundingBoxPatch {
//Used by app.revanced.patches.youtube.layout.hidecrowdfundingbox.patch.HideCrowdfundingBoxPatch
public static void hideCrowdfundingBox(View view) {
if (!Settings.HIDE_CROWDFUNDING_BOX.get()) return;
Utils.hideViewByLayoutParams(view);
}
}

View File

@ -1,27 +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 final class HideFilterBarPatch {
public static int hideInFeed(final int height) {
if (Settings.HIDE_FILTER_BAR_FEED_IN_FEED.get()) return 0;
return height;
}
public static void hideInRelatedVideos(final View chipView) {
if (!Settings.HIDE_FILTER_BAR_FEED_IN_RELATED_VIDEOS.get()) return;
Utils.hideViewByLayoutParams(chipView);
}
public static int hideInSearch(final int height) {
if (Settings.HIDE_FILTER_BAR_FEED_IN_SEARCH.get()) return 0;
return height;
}
}

View File

@ -1,10 +0,0 @@
package app.revanced.integrations.youtube.patches;
import app.revanced.integrations.youtube.settings.Settings;
@SuppressWarnings("unused")
public final class HideFloatingMicrophoneButtonPatch {
public static boolean hideFloatingMicrophoneButton(final boolean original) {
return Settings.HIDE_FLOATING_MICROPHONE_BUTTON.get() || original;
}
}

View File

@ -383,6 +383,51 @@ public final class LayoutComponentsFilter extends Filter {
return !Settings.HIDE_VIDEO_CHANNEL_WATERMARK.get();
}
/**
* Injection point.
*/
public static void hideAlbumCard(View view) {
Utils.hideViewBy0dpUnderCondition(Settings.HIDE_ALBUM_CARDS, view);
}
/**
* Injection point.
*/
public static void hideCrowdfundingBox(View view) {
Utils.hideViewBy0dpUnderCondition(Settings.HIDE_CROWDFUNDING_BOX, view);
}
/**
* Injection point.
*/
public static boolean hideFloatingMicrophoneButton(final boolean original) {
return original || Settings.HIDE_FLOATING_MICROPHONE_BUTTON.get();
}
/**
* Injection point.
*/
public static int hideInFeed(final int height) {
return Settings.HIDE_FILTER_BAR_FEED_IN_FEED.get()
? 0
: height;
}
/**
* Injection point.
*/
public static int hideInSearch(int height) {
return Settings.HIDE_FILTER_BAR_FEED_IN_SEARCH.get()
? 0
: height;
}
/**
* Injection point.
*/
public static void hideInRelatedVideos(View chipView) {
Utils.hideViewBy0dpUnderCondition(Settings.HIDE_FILTER_BAR_FEED_IN_RELATED_VIDEOS, chipView);
}
private static final boolean HIDE_DOODLES_ENABLED = Settings.HIDE_DOODLES.get();