feat(youtube/hide-shorts-components): hide navigation bar

This commit is contained in:
oSumAtrIX 2023-05-10 02:14:51 +02:00
parent 5ec90db28a
commit ac13d10305
3 changed files with 31 additions and 0 deletions

View File

@ -3,12 +3,18 @@ package app.revanced.integrations.patches.components;
import static app.revanced.integrations.utils.ReVancedUtils.hideViewBy1dpUnderCondition;
import static app.revanced.integrations.utils.ReVancedUtils.hideViewUnderCondition;
import android.annotation.SuppressLint;
import android.os.Build;
import android.view.View;
import com.google.android.libraries.youtube.rendering.ui.pivotbar.PivotBar;
import app.revanced.integrations.settings.SettingsEnum;
public final class ShortsFilter extends Filter {
public static PivotBar pivotBar;
@SuppressLint("StaticFieldLeak")
private final StringFilterGroup reelChannelBar = new StringFilterGroup(
null,
"reel_channel_bar"
@ -69,4 +75,18 @@ public final class ShortsFilter extends Filter {
public static void hideShortsShareButton(final View shareButtonView) {
hideViewUnderCondition(SettingsEnum.HIDE_SHORTS_SHARE_BUTTON, shareButtonView);
}
public static void hideNavigationBar() {
if (!SettingsEnum.HIDE_SHORTS_NAVIGATION_BAR.getBoolean()) return;
if (pivotBar == null) return;
pivotBar.setVisibility(View.GONE);
}
public static View hideNavigationBar(final View navigationBarView) {
if (SettingsEnum.HIDE_SHORTS_NAVIGATION_BAR.getBoolean())
return null; // Hides the navigation bar.
return navigationBarView;
}
}

View File

@ -138,6 +138,7 @@ public enum SettingsEnum {
HIDE_SHORTS_COMMENTS_BUTTON("revanced_hide_shorts_comments_button", BOOLEAN, FALSE),
HIDE_SHORTS_REMIX_BUTTON("revanced_hide_shorts_remix_button", BOOLEAN, FALSE),
HIDE_SHORTS_SHARE_BUTTON("revanced_hide_shorts_share_button", BOOLEAN, FALSE),
HIDE_SHORTS_NAVIGATION_BAR("revanced_hide_shorts_navigation_bar", BOOLEAN, TRUE, true),
HIDE_SHORTS("revanced_hide_shorts", BOOLEAN, FALSE, true),
// Misc

View File

@ -0,0 +1,10 @@
package com.google.android.libraries.youtube.rendering.ui.pivotbar;
import android.content.Context;
import android.widget.HorizontalScrollView;
public class PivotBar extends HorizontalScrollView {
public PivotBar(Context context) {
super(context);
}
}