generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Failed attempt to replace the imageview with a custom class. Works bu…
…t does not fix any issues.
- Loading branch information
1 parent
6f8a621
commit 1717a64
Showing
4 changed files
with
110 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...outube/src/main/java/app/revanced/extension/youtube/videoplayer/HookedTouchImageView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package app.revanced.extension.youtube.videoplayer; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
import com.google.android.libraries.youtube.common.ui.TouchImageView; | ||
|
||
import app.revanced.extension.shared.Logger; | ||
|
||
public class HookedTouchImageView extends TouchImageView { | ||
public interface HookedTouchImageViewListener { | ||
void onVisibilityChanged(HookedTouchImageView view, int visibility); | ||
} | ||
|
||
@Nullable | ||
private HookedTouchImageViewListener listener; | ||
|
||
private int lastVisibility = View.VISIBLE; | ||
|
||
public HookedTouchImageView(Context context) { | ||
super(context); | ||
} | ||
|
||
public HookedTouchImageView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public HookedTouchImageView(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
|
||
public HookedTouchImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | ||
super(context, attrs, defStyleAttr, defStyleRes); | ||
} | ||
|
||
public void setVisibilityChangeListener(@NonNull HookedTouchImageViewListener listener) { | ||
this.listener = listener; | ||
} | ||
|
||
@Override | ||
protected void onVisibilityChanged(@NonNull View changedView, int visibility) { | ||
super.onVisibilityChanged(changedView, visibility); | ||
|
||
try { | ||
if (listener != null && lastVisibility != visibility) { | ||
lastVisibility = visibility; | ||
listener.onVisibilityChanged(this, visibility); | ||
} | ||
} catch (Exception ex) { | ||
Logger.printDebug(() -> "onVisibilityChanged failure", ex); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...ube/stub/src/main/java/com/google/android/libraries/youtube/common/ui/TouchImageView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.google.android.libraries.youtube.common.ui; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.widget.ImageView; | ||
|
||
public class TouchImageView extends ImageView { | ||
|
||
public TouchImageView(Context context) { | ||
super(context); | ||
} | ||
|
||
public TouchImageView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public TouchImageView(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
|
||
public TouchImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | ||
super(context, attrs, defStyleAttr, defStyleRes); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters