From 1dd84a37851359143140d1d1df664c3eab680fa7 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 11 Feb 2023 01:25:48 +0100 Subject: [PATCH] fix(youtube/minimized-playback): disable when playing shorts Signed-off-by: oSumAtrIX --- .../integrations/patches/MinimizedPlaybackPatch.java | 5 +++++ .../java/app/revanced/integrations/shared/PlayerType.kt | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/app/src/main/java/app/revanced/integrations/patches/MinimizedPlaybackPatch.java b/app/src/main/java/app/revanced/integrations/patches/MinimizedPlaybackPatch.java index 51303966..b4ec200f 100644 --- a/app/src/main/java/app/revanced/integrations/patches/MinimizedPlaybackPatch.java +++ b/app/src/main/java/app/revanced/integrations/patches/MinimizedPlaybackPatch.java @@ -1,9 +1,14 @@ package app.revanced.integrations.patches; import app.revanced.integrations.settings.SettingsEnum; +import app.revanced.integrations.shared.PlayerType; public class MinimizedPlaybackPatch { + public static boolean isNotPlayingShorts(boolean isPipEnabled) { + return !PlayerType.getCurrent().isNoneOrHidden() && isPipEnabled; + } + public static boolean isMinimizedPlaybackEnabled() { return SettingsEnum.ENABLE_MINIMIZED_PLAYBACK.getBoolean(); } diff --git a/app/src/main/java/app/revanced/integrations/shared/PlayerType.kt b/app/src/main/java/app/revanced/integrations/shared/PlayerType.kt index 561b3840..490f14d1 100644 --- a/app/src/main/java/app/revanced/integrations/shared/PlayerType.kt +++ b/app/src/main/java/app/revanced/integrations/shared/PlayerType.kt @@ -49,4 +49,11 @@ enum class PlayerType { */ val onChange = Event() } + + /** + * Weather Shorts are being played. + */ + fun isNoneOrHidden(): Boolean { + return this == NONE || this == HIDDEN + } } \ No newline at end of file