feat: Update YouTube & YouTube Music patches (#6571)
This commit is a squash of multiple commits, authored by the individuals referenced below. To see the exact commits by each author, see the unsquashed tree at https://github.com/ReVanced/revanced-patches/pull/6571 or with commit 03940665d27a42ed08992757dfe4534bd8243356. Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de> Co-authored-by: hoodles <207470673+hoo-dles@users.noreply.github.com> Co-authored-by: ILoveOpenSourceApplications <117499019+iloveopensourceapplications@users.noreply.github.com> Co-authored-by: LisoUseInAIKyrios <118716522+lisouseinaikyrios@users.noreply.github.com> Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com> Co-authored-by: OxrxL <108184954+oxrxl@users.noreply.github.com>
This commit is contained in:
co-authored by
hoodles
ILoveOpenSourceApplications
LisoUseInAIKyrios
inotia00
OxrxL
parent
db5e0fe587
commit
88d33b847d
+23
-11
@@ -5,14 +5,15 @@ import static app.revanced.extension.shared.Utils.hideViewUnderCondition;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import app.revanced.extension.music.settings.Settings;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class NavigationBarPatch {
|
||||
@NonNull
|
||||
private static String lastYTNavigationEnumName = "";
|
||||
|
||||
public static void setLastAppNavigationEnum(@Nullable Enum<?> ytNavigationEnumName) {
|
||||
@@ -25,7 +26,7 @@ public class NavigationBarPatch {
|
||||
hideViewUnderCondition(Settings.HIDE_NAVIGATION_BAR_LABEL.get(), textview);
|
||||
}
|
||||
|
||||
public static void hideNavigationButton(@NonNull View view) {
|
||||
public static void hideNavigationButton(View view) {
|
||||
// Hide entire navigation bar.
|
||||
if (Settings.HIDE_NAVIGATION_BAR.get() && view.getParent() != null) {
|
||||
hideViewUnderCondition(true, (View) view.getParent());
|
||||
@@ -34,7 +35,7 @@ public class NavigationBarPatch {
|
||||
|
||||
// Hide navigation buttons based on their type.
|
||||
for (NavigationButton button : NavigationButton.values()) {
|
||||
if (button.ytEnumNames.equals(lastYTNavigationEnumName)) {
|
||||
if (button.ytEnumNames.contains(lastYTNavigationEnumName)) {
|
||||
hideViewUnderCondition(button.hidden, view);
|
||||
break;
|
||||
}
|
||||
@@ -43,30 +44,41 @@ public class NavigationBarPatch {
|
||||
|
||||
private enum NavigationButton {
|
||||
HOME(
|
||||
"TAB_HOME",
|
||||
Arrays.asList(
|
||||
"TAB_HOME"
|
||||
),
|
||||
Settings.HIDE_NAVIGATION_BAR_HOME_BUTTON.get()
|
||||
),
|
||||
SAMPLES(
|
||||
"TAB_SAMPLES",
|
||||
Arrays.asList(
|
||||
"TAB_SAMPLES"
|
||||
),
|
||||
Settings.HIDE_NAVIGATION_BAR_SAMPLES_BUTTON.get()
|
||||
),
|
||||
EXPLORE(
|
||||
"TAB_EXPLORE",
|
||||
Arrays.asList(
|
||||
"TAB_EXPLORE"
|
||||
),
|
||||
Settings.HIDE_NAVIGATION_BAR_EXPLORE_BUTTON.get()
|
||||
),
|
||||
LIBRARY(
|
||||
"LIBRARY_MUSIC",
|
||||
Arrays.asList(
|
||||
"LIBRARY_MUSIC",
|
||||
"TAB_BOOKMARK" // YouTube Music 8.24+
|
||||
),
|
||||
Settings.HIDE_NAVIGATION_BAR_LIBRARY_BUTTON.get()
|
||||
),
|
||||
UPGRADE(
|
||||
"TAB_MUSIC_PREMIUM",
|
||||
Arrays.asList(
|
||||
"TAB_MUSIC_PREMIUM"
|
||||
),
|
||||
Settings.HIDE_NAVIGATION_BAR_UPGRADE_BUTTON.get()
|
||||
);
|
||||
|
||||
private final String ytEnumNames;
|
||||
private final List<String> ytEnumNames;
|
||||
private final boolean hidden;
|
||||
|
||||
NavigationButton(@NonNull String ytEnumNames, boolean hidden) {
|
||||
NavigationButton(List<String> ytEnumNames, boolean hidden) {
|
||||
this.ytEnumNames = ytEnumNames;
|
||||
this.hidden = hidden;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user