From 55ec5d169648b7257658e5999e20c50f5bb9da50 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Tue, 15 Oct 2024 01:54:01 -0400 Subject: [PATCH] Miniplayer: Add rounded corners setting if patching 19.36+ --- .../youtube/patches/MiniplayerPatch.java | 13 ++++++++----- .../integrations/youtube/settings/Settings.java | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/MiniplayerPatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/MiniplayerPatch.java index 938358f8d9..a446a18230 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/MiniplayerPatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/MiniplayerPatch.java @@ -123,6 +123,9 @@ public boolean isModern() { private static final boolean HIDE_REWIND_FORWARD_ENABLED = CURRENT_TYPE == MODERN_1 && Settings.MINIPLAYER_HIDE_REWIND_FORWARD.get(); + private static final boolean MINIPLAYER_ROUNDED_CORNERS_ENABLED = + CURRENT_TYPE.isModern() && Settings.MINIPLAYER_ROUNDED_CORNERS.get(); + /** * Remove a broken and always present subtitle text that is only * present with {@link MiniplayerType#MODERN_2}. Bug was fixed in 19.21. @@ -247,8 +250,8 @@ public static int setMiniplayerDefaultSize(int original) { * Injection point. */ public static float setMovementBoundFactor(float original) { - // Not clear if this is useful to customize or not. - // So for now just log this and keep whatever is the original value. + // Not clear if customizing this is useful or not. + // So for now just log this and use the original value. if (original != 1.0) Logger.printDebug(() -> "setMovementBoundFactor original: " + original); return original; @@ -266,10 +269,10 @@ public static boolean setDropShadow(boolean original) { /** * Injection point. */ - public static boolean setUseBackgroundViewOutlineProvider(boolean original) { - if (original) Logger.printDebug(() -> "setUseBackgroundViewOutlineProvider original: " + true); + public static boolean setRoundedCorners(boolean original) { + if (original) Logger.printDebug(() -> "setRoundedCorners original: " + true); - return original; + return MINIPLAYER_ROUNDED_CORNERS_ENABLED; } /** diff --git a/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java b/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java index 84761ca33a..c82acce6af 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java @@ -144,6 +144,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting MINIPLAYER_HIDE_EXPAND_CLOSE = new BooleanSetting("revanced_miniplayer_hide_expand_close", FALSE, true, new MiniplayerHideExpandCloseAvailability()); public static final BooleanSetting MINIPLAYER_HIDE_SUBTEXT = new BooleanSetting("revanced_miniplayer_hide_subtext", FALSE, true, MINIPLAYER_TYPE.availability(MODERN_1, MODERN_3)); public static final BooleanSetting MINIPLAYER_HIDE_REWIND_FORWARD = new BooleanSetting("revanced_miniplayer_hide_rewind_forward", FALSE, true, MINIPLAYER_TYPE.availability(MODERN_1)); + public static final BooleanSetting MINIPLAYER_ROUNDED_CORNERS = new BooleanSetting("revanced_miniplayer_rounded_corners", TRUE, true, MINIPLAYER_ANY_MODERN); public static final IntegerSetting MINIPLAYER_WIDTH_DIP = new IntegerSetting("revanced_miniplayer_width_dip", 192, true, MINIPLAYER_ANY_MODERN); public static final IntegerSetting MINIPLAYER_OPACITY = new IntegerSetting("revanced_miniplayer_opacity", 100, true, MINIPLAYER_TYPE.availability(MODERN_1));