From 325cc179001bb79366f4ed6a5f84f717fbff66b6 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:49:55 -0400 Subject: [PATCH 1/8] fix(YouTube): Show video chapter titles without clipping when overlay buttons are enabled (#699) --- .../youtube/patches/PlayerControlsPatch.java | 44 +++++++ .../components/LayoutComponentsFilter.java | 2 - .../ui/CreateSegmentButtonController.java | 42 ++++--- .../ui/VotingButtonController.java | 41 +++--- .../videoplayer/BottomControlButton.java | 83 ------------- .../videoplayer/CopyVideoUrlButton.java | 16 ++- .../CopyVideoUrlTimestampButton.java | 15 ++- .../videoplayer/ExternalDownloadButton.java | 15 ++- .../PlaybackSpeedDialogButton.java | 16 ++- .../videoplayer/PlayerControlButton.java | 117 ++++++++++++++++++ 10 files changed, 254 insertions(+), 137 deletions(-) create mode 100644 app/src/main/java/app/revanced/integrations/youtube/patches/PlayerControlsPatch.java delete mode 100644 app/src/main/java/app/revanced/integrations/youtube/videoplayer/BottomControlButton.java create mode 100644 app/src/main/java/app/revanced/integrations/youtube/videoplayer/PlayerControlButton.java diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/PlayerControlsPatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/PlayerControlsPatch.java new file mode 100644 index 00000000..51dcc022 --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/PlayerControlsPatch.java @@ -0,0 +1,44 @@ +package app.revanced.integrations.youtube.patches; + +import android.view.View; +import android.view.ViewTreeObserver; +import android.widget.ImageView; + +import app.revanced.integrations.shared.Logger; + +@SuppressWarnings("unused") +public class PlayerControlsPatch { + /** + * Injection point. + */ + public static void setFullscreenCloseButton(ImageView imageButton) { + // Add a global listener, since the protected method + // View#onVisibilityChanged() does not have any call backs. + imageButton.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + int lastVisibility = View.VISIBLE; + + @Override + public void onGlobalLayout() { + try { + final int visibility = imageButton.getVisibility(); + if (lastVisibility != visibility) { + lastVisibility = visibility; + + Logger.printDebug(() -> "fullscreen button visibility: " + + (visibility == View.VISIBLE ? "VISIBLE" : + visibility == View.GONE ? "GONE" : "INVISIBLE")); + + fullscreenButtonVisibilityChanged(visibility == View.VISIBLE); + } + } catch (Exception ex) { + Logger.printDebug(() -> "OnGlobalLayoutListener failure", ex); + } + } + }); + } + + // noinspection EmptyMethod + public static void fullscreenButtonVisibilityChanged(boolean isVisible) { + // Code added during patching. + } +} diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java index 050e6ce6..073505c8 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/LayoutComponentsFilter.java @@ -145,10 +145,8 @@ public final class LayoutComponentsFilter extends Filter { ); // The player audio track button does the exact same function as the audio track flyout menu option. - // But if the copy url button is shown, these button clashes and the the audio button does not work. // Previously this was a setting to show/hide the player button. // But it was decided it's simpler to always hide this button because: - // - it doesn't work with copy video url feature // - the button is rare // - always hiding makes the ReVanced settings simpler and easier to understand // - nobody is going to notice the redundant button is always hidden diff --git a/app/src/main/java/app/revanced/integrations/youtube/sponsorblock/ui/CreateSegmentButtonController.java b/app/src/main/java/app/revanced/integrations/youtube/sponsorblock/ui/CreateSegmentButtonController.java index dffdf9ff..9b5c7376 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/sponsorblock/ui/CreateSegmentButtonController.java +++ b/app/src/main/java/app/revanced/integrations/youtube/sponsorblock/ui/CreateSegmentButtonController.java @@ -12,8 +12,9 @@ import app.revanced.integrations.youtube.patches.VideoInformation; import app.revanced.integrations.youtube.settings.Settings; import app.revanced.integrations.shared.Logger; import app.revanced.integrations.shared.Utils; -import app.revanced.integrations.youtube.videoplayer.BottomControlButton; +import app.revanced.integrations.youtube.videoplayer.PlayerControlButton; +// Edit: This should be a subclass of PlayerControlButton public class CreateSegmentButtonController { private static WeakReference buttonReference = new WeakReference<>(null); private static boolean isShowing; @@ -27,9 +28,7 @@ public class CreateSegmentButtonController { ImageView imageView = Objects.requireNonNull(youtubeControlsLayout.findViewById( getResourceIdentifier("revanced_sb_create_segment_button", "id"))); imageView.setVisibility(View.GONE); - imageView.setOnClickListener(v -> { - SponsorBlockViewController.toggleNewSegmentLayoutVisibility(); - }); + imageView.setOnClickListener(v -> SponsorBlockViewController.toggleNewSegmentLayoutVisibility()); buttonReference = new WeakReference<>(imageView); } catch (Exception ex) { @@ -37,25 +36,30 @@ public class CreateSegmentButtonController { } } + /** + * injection point + */ public static void changeVisibilityImmediate(boolean visible) { - changeVisibility(visible, true); + if (visible) { + // Fix button flickering, by pushing this call to the back of + // the main thread and letting other layout code run first. + Utils.runOnMainThread(() -> setVisibility(true, false)); + } else { + setVisibility(false, false); + } } /** * injection point */ - public static void changeVisibilityNegatedImmediate(boolean visible) { - changeVisibility(!visible, true); + public static void changeVisibility(boolean visible, boolean animated) { + // Ignore this call, otherwise with full screen thumbnails the buttons are visible while seeking. + if (visible && !animated) return; + + setVisibility(visible, animated); } - /** - * injection point - */ - public static void changeVisibility(boolean visible) { - changeVisibility(visible, false); - } - - public static void changeVisibility(boolean visible, boolean immediate) { + private static void setVisibility(boolean visible, boolean animated) { try { if (isShowing == visible) return; isShowing = visible; @@ -68,8 +72,8 @@ public class CreateSegmentButtonController { if (!shouldBeShown()) { return; } - if (!immediate) { - iView.startAnimation(BottomControlButton.getButtonFadeIn()); + if (animated) { + iView.startAnimation(PlayerControlButton.getButtonFadeIn()); } iView.setVisibility(View.VISIBLE); return; @@ -77,8 +81,8 @@ public class CreateSegmentButtonController { if (iView.getVisibility() == View.VISIBLE) { iView.clearAnimation(); - if (!immediate) { - iView.startAnimation(BottomControlButton.getButtonFadeOut()); + if (animated) { + iView.startAnimation(PlayerControlButton.getButtonFadeOut()); } iView.setVisibility(View.GONE); } diff --git a/app/src/main/java/app/revanced/integrations/youtube/sponsorblock/ui/VotingButtonController.java b/app/src/main/java/app/revanced/integrations/youtube/sponsorblock/ui/VotingButtonController.java index 581ba1ad..52a4660d 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/sponsorblock/ui/VotingButtonController.java +++ b/app/src/main/java/app/revanced/integrations/youtube/sponsorblock/ui/VotingButtonController.java @@ -14,8 +14,9 @@ import app.revanced.integrations.youtube.sponsorblock.SegmentPlaybackController; import app.revanced.integrations.youtube.sponsorblock.SponsorBlockUtils; import app.revanced.integrations.shared.Logger; import app.revanced.integrations.shared.Utils; -import app.revanced.integrations.youtube.videoplayer.BottomControlButton; +import app.revanced.integrations.youtube.videoplayer.PlayerControlButton; +// Edit: This should be a subclass of PlayerControlButton public class VotingButtonController { private static WeakReference buttonReference = new WeakReference<>(null); private static boolean isShowing; @@ -29,35 +30,41 @@ public class VotingButtonController { ImageView imageView = Objects.requireNonNull(youtubeControlsLayout.findViewById( getResourceIdentifier("revanced_sb_voting_button", "id"))); imageView.setVisibility(View.GONE); - imageView.setOnClickListener(v -> { - SponsorBlockUtils.onVotingClicked(v.getContext()); - }); + imageView.setOnClickListener(v -> SponsorBlockUtils.onVotingClicked(v.getContext())); buttonReference = new WeakReference<>(imageView); } catch (Exception ex) { - Logger.printException(() -> "Unable to set RelativeLayout", ex); + Logger.printException(() -> "initialize failure", ex); } } + /** + * injection point + */ public static void changeVisibilityImmediate(boolean visible) { - changeVisibility(visible, true); + if (visible) { + // Fix button flickering, by pushing this call to the back of + // the main thread and letting other layout code run first. + Utils.runOnMainThread(() -> setVisibility(true, false)); + } else { + setVisibility(false, false); + } } /** * injection point */ - public static void changeVisibilityNegatedImmediate(boolean visible) { - changeVisibility(!visible, true); + public static void changeVisibility(boolean visible, boolean animated) { + // Ignore this call, otherwise with full screen thumbnails the buttons are visible while seeking. + if (visible && !animated) return; + + setVisibility(visible, animated); } /** * injection point */ - public static void changeVisibility(boolean visible) { - changeVisibility(visible, false); - } - - public static void changeVisibility(boolean visible, boolean immediate) { + private static void setVisibility(boolean visible, boolean animated) { try { if (isShowing == visible) return; isShowing = visible; @@ -70,8 +77,8 @@ public class VotingButtonController { if (!shouldBeShown()) { return; } - if (!immediate) { - iView.startAnimation(BottomControlButton.getButtonFadeIn()); + if (animated) { + iView.startAnimation(PlayerControlButton.getButtonFadeIn()); } iView.setVisibility(View.VISIBLE); return; @@ -79,8 +86,8 @@ public class VotingButtonController { if (iView.getVisibility() == View.VISIBLE) { iView.clearAnimation(); - if (!immediate) { - iView.startAnimation(BottomControlButton.getButtonFadeOut()); + if (animated) { + iView.startAnimation(PlayerControlButton.getButtonFadeOut()); } iView.setVisibility(View.GONE); } diff --git a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/BottomControlButton.java b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/BottomControlButton.java deleted file mode 100644 index aacd9367..00000000 --- a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/BottomControlButton.java +++ /dev/null @@ -1,83 +0,0 @@ -package app.revanced.integrations.youtube.videoplayer; - -import android.view.View; -import android.view.ViewGroup; -import android.view.animation.Animation; -import android.widget.ImageView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import java.lang.ref.WeakReference; -import java.util.Objects; - -import app.revanced.integrations.shared.Logger; -import app.revanced.integrations.shared.Utils; -import app.revanced.integrations.shared.settings.BooleanSetting; - -public abstract class BottomControlButton { - private static final Animation fadeIn; - private static final Animation fadeOut; - - private final WeakReference buttonRef; - private final BooleanSetting setting; - protected boolean isVisible; - - static { - // TODO: check if these durations are correct. - fadeIn = Utils.getResourceAnimation("fade_in"); - fadeIn.setDuration(Utils.getResourceInteger("fade_duration_fast")); - - fadeOut = Utils.getResourceAnimation("fade_out"); - fadeOut.setDuration(Utils.getResourceInteger("fade_duration_scheduled")); - } - - @NonNull - public static Animation getButtonFadeIn() { - return fadeIn; - } - - @NonNull - public static Animation getButtonFadeOut() { - return fadeOut; - } - - public BottomControlButton(@NonNull ViewGroup bottomControlsViewGroup, @NonNull String imageViewButtonId, - @NonNull BooleanSetting booleanSetting, @NonNull View.OnClickListener onClickListener, - @Nullable View.OnLongClickListener longClickListener) { - Logger.printDebug(() -> "Initializing button: " + imageViewButtonId); - - setting = booleanSetting; - - // Create the button. - ImageView imageView = Objects.requireNonNull(bottomControlsViewGroup.findViewById( - Utils.getResourceIdentifier(imageViewButtonId, "id") - )); - imageView.setOnClickListener(onClickListener); - if (longClickListener != null) { - imageView.setOnLongClickListener(longClickListener); - } - imageView.setVisibility(View.GONE); - - buttonRef = new WeakReference<>(imageView); - } - - public void setVisibility(boolean visible) { - if (isVisible == visible) return; - isVisible = visible; - - ImageView imageView = buttonRef.get(); - if (imageView == null) { - return; - } - - imageView.clearAnimation(); - if (visible && setting.get()) { - imageView.startAnimation(fadeIn); - imageView.setVisibility(View.VISIBLE); - } else if (imageView.getVisibility() == View.VISIBLE) { - imageView.startAnimation(fadeOut); - imageView.setVisibility(View.GONE); - } - } -} diff --git a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/CopyVideoUrlButton.java b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/CopyVideoUrlButton.java index 5995da96..e77fd908 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/CopyVideoUrlButton.java +++ b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/CopyVideoUrlButton.java @@ -9,7 +9,8 @@ import app.revanced.integrations.youtube.patches.CopyVideoUrlPatch; import app.revanced.integrations.youtube.settings.Settings; import app.revanced.integrations.shared.Logger; -public class CopyVideoUrlButton extends BottomControlButton { +@SuppressWarnings("unused") +public class CopyVideoUrlButton extends PlayerControlButton { @Nullable private static CopyVideoUrlButton instance; @@ -38,9 +39,16 @@ public class CopyVideoUrlButton extends BottomControlButton { } /** - * Injection point. + * injection point */ - public static void changeVisibility(boolean showing) { - if (instance != null) instance.setVisibility(showing); + public static void changeVisibilityImmediate(boolean visible) { + if (instance != null) instance.setVisibilityImmediate(visible); + } + + /** + * injection point + */ + public static void changeVisibility(boolean visible, boolean animated) { + if (instance != null) instance.setVisibility(visible, animated); } } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/CopyVideoUrlTimestampButton.java b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/CopyVideoUrlTimestampButton.java index 41af50ac..3e80d1f2 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/CopyVideoUrlTimestampButton.java +++ b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/CopyVideoUrlTimestampButton.java @@ -9,7 +9,8 @@ import app.revanced.integrations.youtube.patches.CopyVideoUrlPatch; import app.revanced.integrations.youtube.settings.Settings; import app.revanced.integrations.shared.Logger; -public class CopyVideoUrlTimestampButton extends BottomControlButton { +@SuppressWarnings("unused") +public class CopyVideoUrlTimestampButton extends PlayerControlButton { @Nullable private static CopyVideoUrlTimestampButton instance; @@ -38,10 +39,16 @@ public class CopyVideoUrlTimestampButton extends BottomControlButton { } /** - * Injection point. + * injection point */ - public static void changeVisibility(boolean showing) { - if (instance != null) instance.setVisibility(showing); + public static void changeVisibilityImmediate(boolean visible) { + if (instance != null) instance.setVisibilityImmediate(visible); } + /** + * injection point + */ + public static void changeVisibility(boolean visible, boolean animated) { + if (instance != null) instance.setVisibility(visible, animated); + } } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/ExternalDownloadButton.java b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/ExternalDownloadButton.java index 2a902b02..1be84234 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/ExternalDownloadButton.java +++ b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/ExternalDownloadButton.java @@ -11,7 +11,7 @@ import app.revanced.integrations.youtube.patches.VideoInformation; import app.revanced.integrations.youtube.settings.Settings; @SuppressWarnings("unused") -public class ExternalDownloadButton extends BottomControlButton { +public class ExternalDownloadButton extends PlayerControlButton { @Nullable private static ExternalDownloadButton instance; @@ -37,10 +37,17 @@ public class ExternalDownloadButton extends BottomControlButton { } /** - * Injection point. + * injection point */ - public static void changeVisibility(boolean showing) { - if (instance != null) instance.setVisibility(showing); + public static void changeVisibilityImmediate(boolean visible) { + if (instance != null) instance.setVisibilityImmediate(visible); + } + + /** + * injection point + */ + public static void changeVisibility(boolean visible, boolean animated) { + if (instance != null) instance.setVisibility(visible, animated); } private static void onDownloadClick(View view) { diff --git a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/PlaybackSpeedDialogButton.java b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/PlaybackSpeedDialogButton.java index 0acf184a..eca69e92 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/PlaybackSpeedDialogButton.java +++ b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/PlaybackSpeedDialogButton.java @@ -9,7 +9,8 @@ import app.revanced.integrations.youtube.patches.playback.speed.CustomPlaybackSp import app.revanced.integrations.youtube.settings.Settings; import app.revanced.integrations.shared.Logger; -public class PlaybackSpeedDialogButton extends BottomControlButton { +@SuppressWarnings("unused") +public class PlaybackSpeedDialogButton extends PlayerControlButton { @Nullable private static PlaybackSpeedDialogButton instance; @@ -35,9 +36,16 @@ public class PlaybackSpeedDialogButton extends BottomControlButton { } /** - * Injection point. + * injection point */ - public static void changeVisibility(boolean showing) { - if (instance != null) instance.setVisibility(showing); + public static void changeVisibilityImmediate(boolean visible) { + if (instance != null) instance.setVisibilityImmediate(visible); + } + + /** + * injection point + */ + public static void changeVisibility(boolean visible, boolean animated) { + if (instance != null) instance.setVisibility(visible, animated); } } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/youtube/videoplayer/PlayerControlButton.java b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/PlayerControlButton.java new file mode 100644 index 00000000..09684bcc --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/youtube/videoplayer/PlayerControlButton.java @@ -0,0 +1,117 @@ +package app.revanced.integrations.youtube.videoplayer; + +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.Animation; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import java.lang.ref.WeakReference; +import java.util.Objects; + +import app.revanced.integrations.shared.Logger; +import app.revanced.integrations.shared.Utils; +import app.revanced.integrations.shared.settings.BooleanSetting; + +public abstract class PlayerControlButton { + private static final Animation fadeIn; + private static final Animation fadeOut; + private static final Animation fadeOutImmediate; + + private final WeakReference buttonRef; + protected final BooleanSetting setting; + protected boolean isVisible; + + static { + // TODO: check if these durations are correct. + fadeIn = Utils.getResourceAnimation("fade_in"); + fadeIn.setDuration(Utils.getResourceInteger("fade_duration_fast")); + + fadeOut = Utils.getResourceAnimation("fade_out"); + fadeOut.setDuration(Utils.getResourceInteger("fade_duration_scheduled")); + + fadeOutImmediate = Utils.getResourceAnimation("abc_fade_out"); + fadeOutImmediate.setDuration(Utils.getResourceInteger("fade_duration_fast")); + } + + @NonNull + public static Animation getButtonFadeIn() { + return fadeIn; + } + + @NonNull + public static Animation getButtonFadeOut() { + return fadeOut; + } + + @NonNull + public static Animation getButtonFadeOutImmediately() { + return fadeOutImmediate; + } + + public PlayerControlButton(@NonNull ViewGroup bottomControlsViewGroup, @NonNull String imageViewButtonId, + @NonNull BooleanSetting booleanSetting, @NonNull View.OnClickListener onClickListener, + @Nullable View.OnLongClickListener longClickListener) { + Logger.printDebug(() -> "Initializing button: " + imageViewButtonId); + + ImageView imageView = Objects.requireNonNull(bottomControlsViewGroup.findViewById( + Utils.getResourceIdentifier(imageViewButtonId, "id") + )); + imageView.setVisibility(View.GONE); + + imageView.setOnClickListener(onClickListener); + if (longClickListener != null) { + imageView.setOnLongClickListener(longClickListener); + } + + setting = booleanSetting; + buttonRef = new WeakReference<>(imageView); + } + + public void setVisibilityImmediate(boolean visible) { + if (visible) { + // Fix button flickering, by pushing this call to the back of + // the main thread and letting other layout code run first. + Utils.runOnMainThread(() -> private_setVisibility(true, false)); + } else { + private_setVisibility(false, false); + } + } + + public void setVisibility(boolean visible, boolean animated) { + // Ignore this call, otherwise with full screen thumbnails the buttons are visible while seeking. + if (visible && !animated) return; + + private_setVisibility(visible, animated); + } + + private void private_setVisibility(boolean visible, boolean animated) { + try { + if (isVisible == visible) return; + isVisible = visible; + + ImageView iView = buttonRef.get(); + if (iView == null) { + return; + } + + if (visible && setting.get()) { + iView.clearAnimation(); + if (animated) { + iView.startAnimation(PlayerControlButton.getButtonFadeIn()); + } + iView.setVisibility(View.VISIBLE); + } else if (iView.getVisibility() == View.VISIBLE) { + iView.clearAnimation(); + if (animated) { + iView.startAnimation(PlayerControlButton.getButtonFadeOut()); + } + iView.setVisibility(View.GONE); + } + } catch (Exception ex) { + Logger.printException(() -> "setVisibility failure", ex); + } + } +} From 87749ee879a849757bddd3dc02a17e7a79e6d396 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 23 Sep 2024 22:53:07 +0000 Subject: [PATCH 2/8] chore(release): 1.14.3-dev.1 [skip ci] ## [1.14.3-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.14.2...v1.14.3-dev.1) (2024-09-23) ### Bug Fixes * **YouTube:** Show video chapter titles without clipping when overlay buttons are enabled ([#699](https://github.com/ReVanced/revanced-integrations/issues/699)) ([325cc17](https://github.com/ReVanced/revanced-integrations/commit/325cc179001bb79366f4ed6a5f84f717fbff66b6)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f254d81a..cf71a2b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.14.3-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.14.2...v1.14.3-dev.1) (2024-09-23) + + +### Bug Fixes + +* **YouTube:** Show video chapter titles without clipping when overlay buttons are enabled ([#699](https://github.com/ReVanced/revanced-integrations/issues/699)) ([325cc17](https://github.com/ReVanced/revanced-integrations/commit/325cc179001bb79366f4ed6a5f84f717fbff66b6)) + ## [1.14.2](https://github.com/ReVanced/revanced-integrations/compare/v1.14.1...v1.14.2) (2024-09-23) diff --git a/gradle.properties b/gradle.properties index 3fe9a4bc..d28a18ea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.14.2 +version = 1.14.3-dev.1 From 80482df3fae05cd5bd9e3b430022f07cf118565c Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Thu, 26 Sep 2024 07:51:34 -0400 Subject: [PATCH 3/8] fix(YouTube - Check watch history domain name resolution): Do not show warning if network connection is flaky (#702) --- .../java/app/revanced/integrations/shared/Utils.java | 4 ++-- .../CheckWatchHistoryDomainNameResolutionPatch.java | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/shared/Utils.java b/app/src/main/java/app/revanced/integrations/shared/Utils.java index 22ed1e06..0192c571 100644 --- a/app/src/main/java/app/revanced/integrations/shared/Utils.java +++ b/app/src/main/java/app/revanced/integrations/shared/Utils.java @@ -386,10 +386,10 @@ public class Utils { } /** - * Ignore this class. It must be public to satisfy Android requirement. + * Ignore this class. It must be public to satisfy Android requirements. */ @SuppressWarnings("deprecation") - public static class DialogFragmentWrapper extends DialogFragment { + public static final class DialogFragmentWrapper extends DialogFragment { private Dialog dialog; @Nullable diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/CheckWatchHistoryDomainNameResolutionPatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/CheckWatchHistoryDomainNameResolutionPatch.java index da294d72..4fab3928 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/CheckWatchHistoryDomainNameResolutionPatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/CheckWatchHistoryDomainNameResolutionPatch.java @@ -20,7 +20,6 @@ public class CheckWatchHistoryDomainNameResolutionPatch { private static final String SINKHOLE_IPV4 = "0.0.0.0"; private static final String SINKHOLE_IPV6 = "::"; - /** @noinspection SameParameterValue */ private static boolean domainResolvesToValidIP(String host) { try { InetAddress address = InetAddress.getByName(host); @@ -50,7 +49,16 @@ public class CheckWatchHistoryDomainNameResolutionPatch { Utils.runOnBackgroundThread(() -> { try { - if (domainResolvesToValidIP(HISTORY_TRACKING_ENDPOINT)) { + // If the user has a flaky DNS server, or they just lost internet connectivity + // and the isNetworkConnected() check has not detected it yet (it can take a few + // seconds after losing connection), then the history tracking endpoint will + // show a resolving error but it's actually an internet connection problem. + // + // Prevent this false positive by verify youtube.com resolves. + // If youtube.com does not resolve, then it's not a watch history domain resolving error + // because the entire app will not work since no domains are resolving. + if (domainResolvesToValidIP(HISTORY_TRACKING_ENDPOINT) + || !domainResolvesToValidIP("youtube.com")) { return; } From ce9e9867551413d20cc03a562465c27d706d2a9d Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 26 Sep 2024 11:59:24 +0000 Subject: [PATCH 4/8] chore(release): 1.14.3-dev.2 [skip ci] ## [1.14.3-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.14.3-dev.1...v1.14.3-dev.2) (2024-09-26) ### Bug Fixes * **YouTube - Check watch history domain name resolution:** Do not show warning if network connection is flaky ([#702](https://github.com/ReVanced/revanced-integrations/issues/702)) ([80482df](https://github.com/ReVanced/revanced-integrations/commit/80482df3fae05cd5bd9e3b430022f07cf118565c)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf71a2b3..28055eef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.14.3-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.14.3-dev.1...v1.14.3-dev.2) (2024-09-26) + + +### Bug Fixes + +* **YouTube - Check watch history domain name resolution:** Do not show warning if network connection is flaky ([#702](https://github.com/ReVanced/revanced-integrations/issues/702)) ([80482df](https://github.com/ReVanced/revanced-integrations/commit/80482df3fae05cd5bd9e3b430022f07cf118565c)) + ## [1.14.3-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.14.2...v1.14.3-dev.1) (2024-09-23) diff --git a/gradle.properties b/gradle.properties index d28a18ea..7f6f5f5b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.14.3-dev.1 +version = 1.14.3-dev.2 From 0b9afd022dbf622478bb931124ac41a969610c64 Mon Sep 17 00:00:00 2001 From: Zain Date: Sun, 29 Sep 2024 07:32:24 +0700 Subject: [PATCH 5/8] feat(YouTube - Disable precise seeking gesture): Hide "pull up" label that shows up when swiping (#696) --- .../patches/DisablePreciseSeekingGesturePatch.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/DisablePreciseSeekingGesturePatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/DisablePreciseSeekingGesturePatch.java index 5e3eca57..2afa79fd 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/DisablePreciseSeekingGesturePatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/DisablePreciseSeekingGesturePatch.java @@ -1,20 +1,10 @@ package app.revanced.integrations.youtube.patches; -import android.view.MotionEvent; -import android.view.VelocityTracker; - import app.revanced.integrations.youtube.settings.Settings; @SuppressWarnings("unused") public final class DisablePreciseSeekingGesturePatch { - /** - * Disables the gesture that is used to seek precisely. - * @param tracker The velocity tracker that is used to determine the gesture. - * @param event The motion event that is used to determine the gesture. - */ - public static void disableGesture(VelocityTracker tracker, MotionEvent event) { - if (Settings.DISABLE_PRECISE_SEEKING_GESTURE.get()) return; - - tracker.addMovement(event); + public static boolean isGestureDisabled() { + return Settings.DISABLE_PRECISE_SEEKING_GESTURE.get(); } } From a85bb5a4bb0780dc9344e577414d401379b3b8fa Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 29 Sep 2024 00:35:35 +0000 Subject: [PATCH 6/8] chore(release): 1.15.0-dev.1 [skip ci] # [1.15.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.14.3-dev.2...v1.15.0-dev.1) (2024-09-29) ### Features * **YouTube - Disable precise seeking gesture:** Hide "pull up" label that shows up when swiping ([#696](https://github.com/ReVanced/revanced-integrations/issues/696)) ([0b9afd0](https://github.com/ReVanced/revanced-integrations/commit/0b9afd022dbf622478bb931124ac41a969610c64)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28055eef..1e1c171a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.15.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.14.3-dev.2...v1.15.0-dev.1) (2024-09-29) + + +### Features + +* **YouTube - Disable precise seeking gesture:** Hide "pull up" label that shows up when swiping ([#696](https://github.com/ReVanced/revanced-integrations/issues/696)) ([0b9afd0](https://github.com/ReVanced/revanced-integrations/commit/0b9afd022dbf622478bb931124ac41a969610c64)) + ## [1.14.3-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.14.3-dev.1...v1.14.3-dev.2) (2024-09-26) diff --git a/gradle.properties b/gradle.properties index 7f6f5f5b..51b5404c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.14.3-dev.2 +version = 1.15.0-dev.1 From a87456e49995e2ed5f4788e71db8f2387bc241f9 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 28 Sep 2024 21:03:13 -0400 Subject: [PATCH 7/8] feat(YouTube - Hide Shorts components): Add `Hide save music`, `Hide stickers` (#703) --- .../patches/components/ShortsFilter.java | 19 +++++++++++++------ .../youtube/settings/Settings.java | 5 ++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java index a7935f71..8fcc2152 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/components/ShortsFilter.java @@ -112,6 +112,11 @@ public final class ShortsFilter extends Filter { "shorts_info_panel_overview" ); + StringFilterGroup stickers = new StringFilterGroup( + Settings.HIDE_SHORTS_STICKERS, + "stickers_layer.eml" + ); + joinButton = new StringFilterGroup( Settings.HIDE_SHORTS_JOIN_BUTTON, "sponsor_button" @@ -140,7 +145,7 @@ public final class ShortsFilter extends Filter { addPathCallbacks( shortsCompactFeedVideoPath, suggestedAction, actionBar, joinButton, subscribeButton, paidPromotionButton, pausedOverlayButtons, channelBar, fullVideoLinkLabel, videoTitle, - reelSoundMetadata, soundButton, infoPanel + reelSoundMetadata, soundButton, infoPanel, stickers ); // @@ -193,7 +198,13 @@ public final class ShortsFilter extends Filter { ), new ByteArrayFilterGroup( Settings.HIDE_SHORTS_SAVE_SOUND_BUTTON, - "yt_outline_list_add_" + "yt_outline_bookmark_", + // 'Save sound' button. It seems this has been removed and only 'Save music' is used. + // Still hide this in case it's still present. + "yt_outline_list_add_", + // 'Use this sound' button. It seems this has been removed and only 'Save music' is used. + // Still hide this in case it's still present. + "yt_outline_camera_" ), new ByteArrayFilterGroup( Settings.HIDE_SHORTS_SEARCH_SUGGESTIONS, @@ -202,10 +213,6 @@ public final class ShortsFilter extends Filter { new ByteArrayFilterGroup( Settings.HIDE_SHORTS_SUPER_THANKS_BUTTON, "yt_outline_dollar_sign_heart_" - ), - new ByteArrayFilterGroup( - Settings.HIDE_SHORTS_USE_THIS_SOUND_BUTTON, - "yt_outline_camera_" ) ); } 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 b95ed7f7..3d7b8934 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 @@ -219,10 +219,9 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_SHORTS_SHOP_BUTTON = new BooleanSetting("revanced_hide_shorts_shop_button", TRUE); public static final BooleanSetting HIDE_SHORTS_TAGGED_PRODUCTS = new BooleanSetting("revanced_hide_shorts_tagged_products", TRUE); public static final BooleanSetting HIDE_SHORTS_LOCATION_LABEL = new BooleanSetting("revanced_hide_shorts_location_label", FALSE); - // Save sound to playlist and Search suggestions may have been A/B tests that were abandoned by YT, and it's not clear if these are still used. - public static final BooleanSetting HIDE_SHORTS_SAVE_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_save_sound_button", FALSE); - public static final BooleanSetting HIDE_SHORTS_USE_THIS_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_use_this_sound_button", TRUE); + public static final BooleanSetting HIDE_SHORTS_SAVE_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_save_sound_button", TRUE); public static final BooleanSetting HIDE_SHORTS_SEARCH_SUGGESTIONS = new BooleanSetting("revanced_hide_shorts_search_suggestions", FALSE); + public static final BooleanSetting HIDE_SHORTS_STICKERS = new BooleanSetting("revanced_hide_shorts_stickers", TRUE); public static final BooleanSetting HIDE_SHORTS_SUPER_THANKS_BUTTON = new BooleanSetting("revanced_hide_shorts_super_thanks_button", TRUE); public static final BooleanSetting HIDE_SHORTS_LIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_like_button", FALSE); public static final BooleanSetting HIDE_SHORTS_DISLIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_dislike_button", FALSE); From a55269dfc06f9ab6f1b856c532773ad1190d0b67 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 29 Sep 2024 01:06:26 +0000 Subject: [PATCH 8/8] chore(release): 1.15.0-dev.2 [skip ci] # [1.15.0-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.15.0-dev.1...v1.15.0-dev.2) (2024-09-29) ### Features * **YouTube - Hide Shorts components:** Add `Hide save music`, `Hide stickers` ([#703](https://github.com/ReVanced/revanced-integrations/issues/703)) ([a87456e](https://github.com/ReVanced/revanced-integrations/commit/a87456e49995e2ed5f4788e71db8f2387bc241f9)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e1c171a..0e808d18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.15.0-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.15.0-dev.1...v1.15.0-dev.2) (2024-09-29) + + +### Features + +* **YouTube - Hide Shorts components:** Add `Hide save music`, `Hide stickers` ([#703](https://github.com/ReVanced/revanced-integrations/issues/703)) ([a87456e](https://github.com/ReVanced/revanced-integrations/commit/a87456e49995e2ed5f4788e71db8f2387bc241f9)) + # [1.15.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.14.3-dev.2...v1.15.0-dev.1) (2024-09-29) diff --git a/gradle.properties b/gradle.properties index 51b5404c..7543e2dd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.15.0-dev.1 +version = 1.15.0-dev.2