feat(YouTube - Hide layout components): Hide search result shelf header

This commit is contained in:
oSumAtrIX 2023-10-02 01:12:59 +02:00
parent d156951460
commit 93a30453d9
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
4 changed files with 29 additions and 14 deletions

View File

@ -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
);

View File

@ -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) {

View File

@ -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),

View File

@ -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
*/