From eaaa6fbd20630f15bfec7c57713ec353f4072ac2 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 16 Jan 2024 21:58:07 +0100 Subject: [PATCH] feat(YouTube): Support versions `18.48.39`, `18.49.37`, `19.01.34` (#547) Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> --- .../youtube/patches/FixBackToExitGesturePatch.java | 6 ++++-- .../youtube/patches/ReturnYouTubeDislikePatch.java | 6 ++++++ .../app/revanced/integrations/youtube/shared/PlayerType.kt | 2 +- .../youtube/swipecontrols/SwipeControlsHostActivity.kt | 2 +- .../apps/youtube/app/watchwhile/WatchWhileActivity.java | 7 ------- 5 files changed, 12 insertions(+), 11 deletions(-) delete mode 100644 dummy/src/main/java/com/google/android/apps/youtube/app/watchwhile/WatchWhileActivity.java diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/FixBackToExitGesturePatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/FixBackToExitGesturePatch.java index e8b4ab50..d3408a62 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/FixBackToExitGesturePatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/FixBackToExitGesturePatch.java @@ -1,8 +1,10 @@ package app.revanced.integrations.youtube.patches; -import com.google.android.apps.youtube.app.watchwhile.WatchWhileActivity; +import android.app.Activity; + import app.revanced.integrations.shared.Logger; +@SuppressWarnings("unused") public class FixBackToExitGesturePatch { /** * State whether the scroll position reaches the top. @@ -14,7 +16,7 @@ public class FixBackToExitGesturePatch { * * @param activity The activity, the app is launched with to finish. */ - public static void onBackPressed(WatchWhileActivity activity) { + public static void onBackPressed(Activity activity) { if (!isTopView) return; Logger.printDebug(() -> "Activity is closed"); diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch.java index 0f1e0f86..5133283f 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/ReturnYouTubeDislikePatch.java @@ -348,6 +348,11 @@ public class ReturnYouTubeDislikePatch { } else { view.setCompoundDrawables(separator, null, null, null); } + // Liking/disliking can cause the span to grow in size, + // which is ok and is laid out correctly, + // but if the user then undoes their action the layout will not remove the extra padding. + // Use a center alignment to take up any extra space. + view.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); // Single line mode does not clip words if the span is larger than the view bounds. // The styled span applied to the view should always have the same bounds, // but use this feature just in case the measurements are somehow off by a few pixels. @@ -364,6 +369,7 @@ public class ReturnYouTubeDislikePatch { Logger.printDebug(() -> "Removing rolling number TextView changes"); view.setCompoundDrawablePadding(0); view.setCompoundDrawables(null, null, null, null); + view.setTextAlignment(View.TEXT_ALIGNMENT_GRAVITY); // Default alignment view.setSingleLine(false); } } diff --git a/app/src/main/java/app/revanced/integrations/youtube/shared/PlayerType.kt b/app/src/main/java/app/revanced/integrations/youtube/shared/PlayerType.kt index 2aa85786..64634ceb 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/shared/PlayerType.kt +++ b/app/src/main/java/app/revanced/integrations/youtube/shared/PlayerType.kt @@ -5,7 +5,7 @@ import app.revanced.integrations.youtube.Event import app.revanced.integrations.shared.Logger /** - * WatchWhile player type. + * Main player type. */ enum class PlayerType { /** diff --git a/app/src/main/java/app/revanced/integrations/youtube/swipecontrols/SwipeControlsHostActivity.kt b/app/src/main/java/app/revanced/integrations/youtube/swipecontrols/SwipeControlsHostActivity.kt index 7346b2b5..838f6ecb 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/swipecontrols/SwipeControlsHostActivity.kt +++ b/app/src/main/java/app/revanced/integrations/youtube/swipecontrols/SwipeControlsHostActivity.kt @@ -22,7 +22,7 @@ import java.lang.ref.WeakReference /** * The main controller for volume and brightness swipe controls. - * note that the superclass is overwritten to the superclass of the WatchWhileActivity at patch time + * note that the superclass is overwritten to the superclass of the MainActivity at patch time * * @smali Lapp/revanced/integrations/swipecontrols/SwipeControlsHostActivity; */ diff --git a/dummy/src/main/java/com/google/android/apps/youtube/app/watchwhile/WatchWhileActivity.java b/dummy/src/main/java/com/google/android/apps/youtube/app/watchwhile/WatchWhileActivity.java deleted file mode 100644 index d86113d0..00000000 --- a/dummy/src/main/java/com/google/android/apps/youtube/app/watchwhile/WatchWhileActivity.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.google.android.apps.youtube.app.watchwhile; - -import android.app.Activity; - -// Dummy class -public final class WatchWhileActivity extends Activity { } -