mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
feat(Reddit - Hide navigation buttons): Add support for latest versions
This commit is contained in:
@ -3,7 +3,9 @@ package app.revanced.extension.reddit.patches;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import app.revanced.extension.reddit.settings.Settings;
|
||||
import app.revanced.extension.shared.utils.Logger;
|
||||
@ -24,6 +26,22 @@ public final class NavigationButtonsPatch {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Object[] hideNavigationButtons(Object[] array) {
|
||||
try {
|
||||
for (NavigationButton button : NavigationButton.values()) {
|
||||
if (button.enabled && array.length > button.index) {
|
||||
Object buttonObject = array[button.index];
|
||||
array = Arrays.stream(array)
|
||||
.filter(item -> !Objects.equals(item, buttonObject))
|
||||
.toArray(Object[]::new);
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
Logger.printException(() -> "Failed to remove button array", exception);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public static void hideNavigationButtons(ViewGroup viewGroup) {
|
||||
try {
|
||||
if (viewGroup == null) return;
|
||||
|
Reference in New Issue
Block a user