fix(YouTube - Spoof video streams): Make it work on 21.x (#6705)
Co-authored-by: wowitsjack <no@email> Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
f045923cef
commit
fdfed3c9dd
8 changed files with 24 additions and 22 deletions
|
|
@ -1,6 +1,6 @@
|
|||
package app.revanced.extension.youtube.patches;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import android.view.View;
|
||||
|
||||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.Utils;
|
||||
|
|
@ -46,7 +46,7 @@ public class ExitFullscreenPatch {
|
|||
// To fix this, push the perform click to the back fo the main thread,
|
||||
// and by then the overlay controls will be visible since the video is now finished.
|
||||
Utils.runOnMainThreadDelayed(() -> {
|
||||
ImageView button = PlayerControlsPatch.fullscreenButtonRef.get();
|
||||
View button = PlayerControlsPatch.fullscreenButtonRef.get();
|
||||
if (button == null) {
|
||||
Logger.printDebug(() -> "Fullscreen button is null, cannot click");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -109,13 +109,13 @@ public final class HidePlayerOverlayButtonsPatch {
|
|||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
public static ImageView hideFullscreenButton(ImageView imageView) {
|
||||
public static View hideFullscreenButton(View view) {
|
||||
if (!Settings.HIDE_FULLSCREEN_BUTTON.get()) {
|
||||
return imageView;
|
||||
return view;
|
||||
}
|
||||
|
||||
if (imageView != null) {
|
||||
imageView.setVisibility(View.GONE);
|
||||
if (view != null) {
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package app.revanced.extension.youtube.patches;
|
|||
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
|
|
@ -11,7 +10,7 @@ import app.revanced.extension.shared.Logger;
|
|||
@SuppressWarnings("unused")
|
||||
public class PlayerControlsPatch {
|
||||
|
||||
public static WeakReference<ImageView> fullscreenButtonRef = new WeakReference<>(null);
|
||||
public static WeakReference<View> fullscreenButtonRef = new WeakReference<>(null);
|
||||
|
||||
private static boolean fullscreenButtonVisibilityCallbacksExist() {
|
||||
return false; // Modified during patching if needed.
|
||||
|
|
@ -20,8 +19,8 @@ public class PlayerControlsPatch {
|
|||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
public static void setFullscreenCloseButton(ImageView imageButton) {
|
||||
fullscreenButtonRef = new WeakReference<>(imageButton);
|
||||
public static void setFullscreenCloseButton(View button) {
|
||||
fullscreenButtonRef = new WeakReference<>(button);
|
||||
Logger.printDebug(() -> "Fullscreen button set");
|
||||
|
||||
if (!fullscreenButtonVisibilityCallbacksExist()) {
|
||||
|
|
@ -30,13 +29,13 @@ public class PlayerControlsPatch {
|
|||
|
||||
// Add a global listener, since the protected method
|
||||
// View#onVisibilityChanged() does not have any call backs.
|
||||
imageButton.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
button.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
int lastVisibility = View.VISIBLE;
|
||||
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
try {
|
||||
final int visibility = imageButton.getVisibility();
|
||||
final int visibility = button.getVisibility();
|
||||
if (lastVisibility != visibility) {
|
||||
lastVisibility = visibility;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue