mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-12-01 00:02:55 +01:00
feat(YouTube - Hide layout components): Hide search result shelf header
This commit is contained in:
parent
d156951460
commit
93a30453d9
@ -152,6 +152,11 @@ public final class LayoutComponentsFilter extends Filter {
|
||||
"timed_reaction"
|
||||
);
|
||||
|
||||
final var searchResultShelfHeader = new StartsWithStringFilterGroup(
|
||||
SettingsEnum.HIDE_SEARCH_RESULT_SHELF_HEADER,
|
||||
"shelf_header.eml"
|
||||
);
|
||||
|
||||
final var notifyMe = new StringFilterGroup(
|
||||
SettingsEnum.HIDE_NOTIFY_ME_BUTTON,
|
||||
"set_reminder_button"
|
||||
@ -183,12 +188,13 @@ public final class LayoutComponentsFilter extends Filter {
|
||||
medicalPanel,
|
||||
notifyMe,
|
||||
infoPanel,
|
||||
subscribersCommunityGuidelines,
|
||||
channelGuidelines,
|
||||
audioTrackButton,
|
||||
artistCard,
|
||||
timedReactions,
|
||||
imageShelf,
|
||||
subscribersCommunityGuidelines,
|
||||
searchResultShelfHeader,
|
||||
channelMemberShelf,
|
||||
custom
|
||||
);
|
||||
|
@ -85,6 +85,18 @@ class StringFilterGroup extends FilterGroup<String> {
|
||||
}
|
||||
}
|
||||
|
||||
class StartsWithStringFilterGroup extends StringFilterGroup {
|
||||
|
||||
public StartsWithStringFilterGroup(final SettingsEnum setting, final String... filters) {
|
||||
super(setting, filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilterGroupResult check(final String string) {
|
||||
return new FilterGroupResult(setting, isEnabled() && ReVancedUtils.startsWithAny(string, filters));
|
||||
}
|
||||
}
|
||||
|
||||
final class CustomFilterGroup extends StringFilterGroup {
|
||||
|
||||
public CustomFilterGroup(final SettingsEnum setting, final SettingsEnum filter) {
|
||||
|
@ -66,6 +66,7 @@ public enum SettingsEnum {
|
||||
HIDE_FEED_SURVEY("revanced_hide_feed_survey", BOOLEAN, TRUE),
|
||||
HIDE_GRAY_SEPARATOR("revanced_hide_gray_separator", BOOLEAN, TRUE),
|
||||
HIDE_TIMED_REACTIONS("revanced_hide_timed_reactions", BOOLEAN, TRUE),
|
||||
HIDE_SEARCH_RESULT_SHELF_HEADER("revanced_hide_search_result_shelf_header", BOOLEAN, TRUE),
|
||||
HIDE_NOTIFY_ME_BUTTON("revanced_hide_notify_me_button", BOOLEAN, TRUE),
|
||||
HIDE_JOIN_MEMBERSHIP_BUTTON("revanced_hide_join_membership_button", BOOLEAN, TRUE),
|
||||
HIDE_HIDE_CHANNEL_GUIDELINES("revanced_hide_channel_guidelines", BOOLEAN, TRUE),
|
||||
|
@ -10,25 +10,15 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
import android.widget.Toolbar;
|
||||
|
||||
import android.widget.*;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
import java.text.Bidi;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class ReVancedUtils {
|
||||
|
||||
@ -98,6 +88,12 @@ public class ReVancedUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean startsWithAny(@NonNull String value, @NonNull String... targets) {
|
||||
for (String string : targets)
|
||||
if (!string.isEmpty() && value.startsWith(string)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return zero, if the resource is not found
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user