mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-06 18:15:51 +01:00
feat(youtube): navigation-buttons
patch
This commit is contained in:
parent
8255909b2f
commit
68f42fc980
@ -1,16 +0,0 @@
|
|||||||
package app.revanced.integrations.patches;
|
|
||||||
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import app.revanced.integrations.settings.SettingsEnum;
|
|
||||||
import app.revanced.integrations.utils.LogHelper;
|
|
||||||
|
|
||||||
public class HideCreateButtonPatch {
|
|
||||||
|
|
||||||
//Used by app.revanced.patches.youtube.layout.createbutton.patch.CreateButtonRemoverPatch
|
|
||||||
public static void hideCreateButton(View view) {
|
|
||||||
boolean hidden = SettingsEnum.HIDE_CREATE_BUTTON.getBoolean();
|
|
||||||
LogHelper.printDebug(() -> "Create button: " + (hidden ? "hidden" : "shown"));
|
|
||||||
view.setVisibility(hidden ? View.GONE : View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package app.revanced.integrations.patches;
|
|
||||||
|
|
||||||
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import app.revanced.integrations.settings.SettingsEnum;
|
|
||||||
import app.revanced.integrations.utils.LogHelper;
|
|
||||||
|
|
||||||
public class HideShortsButtonPatch {
|
|
||||||
|
|
||||||
// Used by app.revanced.patches.youtube.layout.shorts.button.patch.ShortsButtonRemoverPatch
|
|
||||||
public static void hideShortsButton(View view) {
|
|
||||||
if (lastPivotTab != null && lastPivotTab.name() == "TAB_SHORTS") {
|
|
||||||
boolean hide = SettingsEnum.HIDE_SHORTS_BUTTON.getBoolean();
|
|
||||||
LogHelper.printDebug(() -> hide ? "Shorts button: hidden" : "Shorts button: shown");
|
|
||||||
if (hide) {
|
|
||||||
view.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Needed for the ShortsButtonRemoverPatch
|
|
||||||
public static Enum lastPivotTab;
|
|
||||||
}
|
|
@ -0,0 +1,38 @@
|
|||||||
|
package app.revanced.integrations.patches;
|
||||||
|
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import app.revanced.integrations.settings.SettingsEnum;
|
||||||
|
|
||||||
|
public final class NavigationButtonsPatch {
|
||||||
|
public static Enum lastNavigationButton;
|
||||||
|
|
||||||
|
public static void hideCreateButton(final View view) {
|
||||||
|
view.setVisibility(SettingsEnum.HIDE_CREATE_BUTTON.getBoolean() ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean switchCreateWithNotificationButton() {
|
||||||
|
return SettingsEnum.SWITCH_CREATE_WITH_NOTIFICATIONS_BUTTON.getBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void hideButton(final View buttonView) {
|
||||||
|
if (lastNavigationButton == null) return;
|
||||||
|
|
||||||
|
for (NavigationButton button : NavigationButton.values())
|
||||||
|
if (button.name.equals(lastNavigationButton.name()))
|
||||||
|
if (button.enabled) buttonView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum NavigationButton {
|
||||||
|
HOME("PIVOT_HOME", SettingsEnum.HIDE_HOME_BUTTON.getBoolean()),
|
||||||
|
SHORTS("TAB_SHORTS", SettingsEnum.HIDE_SHORTS_BUTTON.getBoolean()),
|
||||||
|
SUBSCRIPTIONS("PIVOT_SUBSCRIPTIONS", SettingsEnum.HIDE_SUBSCRIPTIONS_BUTTON.getBoolean());
|
||||||
|
private final boolean enabled;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
NavigationButton(final String name, final boolean enabled) {
|
||||||
|
this.name = name;
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,11 +7,18 @@ import app.revanced.integrations.utils.ReVancedUtils;
|
|||||||
public final class ThemePatch {
|
public final class ThemePatch {
|
||||||
public static final int DEFAULT_SEEKBAR_COLOR = 0xffff0000;
|
public static final int DEFAULT_SEEKBAR_COLOR = 0xffff0000;
|
||||||
|
|
||||||
|
public static final int ORIGINAL_SEEKBAR_CLICKED_COLOR = -65536;
|
||||||
|
|
||||||
private static void resetSeekbarColor() {
|
private static void resetSeekbarColor() {
|
||||||
ReVancedUtils.showToastShort("Invalid seekbar color value. Using default value.");
|
ReVancedUtils.showToastShort("Invalid seekbar color value. Using default value.");
|
||||||
SettingsEnum.SEEKBAR_COLOR.saveValue("#" + Integer.toHexString(DEFAULT_SEEKBAR_COLOR));
|
SettingsEnum.SEEKBAR_COLOR.saveValue("#" + Integer.toHexString(DEFAULT_SEEKBAR_COLOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getSeekbarClickedColorValue(final int colorValue) {
|
||||||
|
// YouTube uses a specific color when the seekbar is clicked. Override in that case.
|
||||||
|
return colorValue == ORIGINAL_SEEKBAR_CLICKED_COLOR ? getSeekbarColorValue() : colorValue;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getSeekbarColorValue() {
|
public static int getSeekbarColorValue() {
|
||||||
try {
|
try {
|
||||||
return Color.parseColor(SettingsEnum.SEEKBAR_COLOR.getString());
|
return Color.parseColor(SettingsEnum.SEEKBAR_COLOR.getString());
|
||||||
|
@ -83,6 +83,7 @@ public enum SettingsEnum {
|
|||||||
HIDE_CAST_BUTTON("revanced_hide_cast_button", BOOLEAN, TRUE, true),
|
HIDE_CAST_BUTTON("revanced_hide_cast_button", BOOLEAN, TRUE, true),
|
||||||
HIDE_COMMENTS_SECTION("revanced_hide_comments_section", BOOLEAN, FALSE, true),
|
HIDE_COMMENTS_SECTION("revanced_hide_comments_section", BOOLEAN, FALSE, true),
|
||||||
HIDE_CREATE_BUTTON("revanced_hide_create_button", BOOLEAN, TRUE, true),
|
HIDE_CREATE_BUTTON("revanced_hide_create_button", BOOLEAN, TRUE, true),
|
||||||
|
SWITCH_CREATE_WITH_NOTIFICATIONS_BUTTON("revanced_switch_create_with_notifications_button", BOOLEAN, TRUE, true),
|
||||||
HIDE_CROWDFUNDING_BOX("revanced_hide_crowdfunding_box", BOOLEAN, FALSE, true),
|
HIDE_CROWDFUNDING_BOX("revanced_hide_crowdfunding_box", BOOLEAN, FALSE, true),
|
||||||
HIDE_EMAIL_ADDRESS("revanced_hide_email_address", BOOLEAN, FALSE),
|
HIDE_EMAIL_ADDRESS("revanced_hide_email_address", BOOLEAN, FALSE),
|
||||||
HIDE_ENDSCREEN_CARDS("revanced_hide_endscreen_cards", BOOLEAN, TRUE),
|
HIDE_ENDSCREEN_CARDS("revanced_hide_endscreen_cards", BOOLEAN, TRUE),
|
||||||
@ -93,7 +94,9 @@ public enum SettingsEnum {
|
|||||||
HIDE_PLAYER_BUTTONS("revanced_hide_player_buttons", BOOLEAN, FALSE),
|
HIDE_PLAYER_BUTTONS("revanced_hide_player_buttons", BOOLEAN, FALSE),
|
||||||
HIDE_PREVIEW_COMMENT("revanced_hide_preview_comment", BOOLEAN, FALSE, true),
|
HIDE_PREVIEW_COMMENT("revanced_hide_preview_comment", BOOLEAN, FALSE, true),
|
||||||
HIDE_SEEKBAR("revanced_hide_seekbar", BOOLEAN, FALSE),
|
HIDE_SEEKBAR("revanced_hide_seekbar", BOOLEAN, FALSE),
|
||||||
|
HIDE_HOME_BUTTON("revanced_hide_home_button", BOOLEAN, FALSE, true),
|
||||||
HIDE_SHORTS_BUTTON("revanced_hide_shorts_button", BOOLEAN, TRUE, true),
|
HIDE_SHORTS_BUTTON("revanced_hide_shorts_button", BOOLEAN, TRUE, true),
|
||||||
|
HIDE_SUBSCRIPTIONS_BUTTON("revanced_hide_subscriptions_button", BOOLEAN, FALSE, true),
|
||||||
HIDE_SHORTS_COMMENTS_BUTTON("revanced_hide_shorts_comments_button", BOOLEAN, FALSE),
|
HIDE_SHORTS_COMMENTS_BUTTON("revanced_hide_shorts_comments_button", BOOLEAN, FALSE),
|
||||||
HIDE_TIMESTAMP("revanced_hide_timestamp", BOOLEAN, FALSE),
|
HIDE_TIMESTAMP("revanced_hide_timestamp", BOOLEAN, FALSE),
|
||||||
HIDE_VIDEO_WATERMARK("revanced_hide_video_watermark", BOOLEAN, TRUE),
|
HIDE_VIDEO_WATERMARK("revanced_hide_video_watermark", BOOLEAN, TRUE),
|
||||||
|
Loading…
Reference in New Issue
Block a user