Skip to content

Commit

Permalink
feat(YouTube - Player components): Add Hide zoom overlay setting
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperssmp authored and anddea committed Jul 29, 2024
1 parent b6fab54 commit 00640e6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import app.revanced.patches.youtube.player.components.fingerprints.QuickSeekOver
import app.revanced.patches.youtube.player.components.fingerprints.SeekEduContainerFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.SuggestedActionsFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.TouchAreaOnClickListenerFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.VideoZoomSnapIndicatorFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.WatermarkFingerprint
import app.revanced.patches.youtube.player.components.fingerprints.WatermarkParentFingerprint
import app.revanced.patches.youtube.player.speedoverlay.SpeedOverlayPatch
Expand Down Expand Up @@ -90,6 +91,7 @@ object PlayerComponentsPatch : BaseBytecodePatch(
StartVideoInformerFingerprint,
SuggestedActionsFingerprint,
TouchAreaOnClickListenerFingerprint,
VideoZoomSnapIndicatorFingerprint,
WatermarkParentFingerprint,
YouTubeControlsOverlayFingerprint,
)
Expand Down Expand Up @@ -394,6 +396,21 @@ object PlayerComponentsPatch : BaseBytecodePatch(

// endregion

// region patch for hide video zoom overlay

VideoZoomSnapIndicatorFingerprint.resultOrThrow().mutableMethod.apply {
addInstructionsWithLabels(
0, """
invoke-static {}, $PLAYER_CLASS_DESCRIPTOR->hideZoomOverlay()Z
move-result v0
if-eqz v0, :shown
return-void
""", ExternalLabel("shown", getInstruction(0))
)
}

// endregion

LithoFilterPatch.addFilter(PLAYER_COMPONENTS_FILTER_CLASS_DESCRIPTOR)

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package app.revanced.patches.youtube.player.components.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.VideoZoomSnapIndicator
import app.revanced.util.fingerprint.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.AccessFlags

internal object VideoZoomSnapIndicatorFingerprint : LiteralValueFingerprint(
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
literalSupplier = { VideoZoomSnapIndicator }
)
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ object SharedResourceIdPatch : ResourcePatch() {
var VideoQualityBottomSheet = -1L
var VarispeedUnavailableTitle = -1L
var VideoQualityUnavailableAnnouncement = -1L
var VideoZoomSnapIndicator = -1L
var VoiceSearch = -1L
var YouTubeControlsOverlaySubtitleButton = -1L
var YtOutlinePictureInPictureWhite = -1L
Expand Down Expand Up @@ -218,6 +219,7 @@ object SharedResourceIdPatch : ResourcePatch() {
VarispeedUnavailableTitle = getId(STRING, "varispeed_unavailable_title")
VideoQualityUnavailableAnnouncement =
getId(STRING, "video_quality_unavailable_announcement")
VideoZoomSnapIndicator = getId(ID, "video_zoom_snap_indicator")
VoiceSearch = getId(ID, "voice_search")
YouTubeControlsOverlaySubtitleButton =
getId(LAYOUT, "youtube_controls_overlay_subtitle_button")
Expand All @@ -228,4 +230,4 @@ object SharedResourceIdPatch : ResourcePatch() {
YtWordMarkHeader = getId(ATTR, "ytWordmarkHeader")

}
}
}
5 changes: 3 additions & 2 deletions src/main/resources/youtube/settings/xml/revanced_prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@
<SwitchPreference android:title="@string/revanced_hide_suggested_actions_title" android:key="revanced_hide_suggested_actions" android:summaryOn="@string/revanced_hide_suggested_actions_summary_on" android:summaryOff="@string/revanced_hide_suggested_actions_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_timed_reactions_title" android:key="revanced_hide_timed_reactions" android:summaryOn="@string/revanced_hide_timed_reactions_summary_on" android:summaryOff="@string/revanced_hide_timed_reactions_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_suggested_video_end_screen_title" android:key="revanced_hide_suggested_video_end_screen" android:summaryOn="@string/revanced_hide_suggested_video_end_screen_summary_on" android:summaryOff="@string/revanced_hide_suggested_video_end_screen_summary_off" />
<SwitchPreference android:title="@string/revanced_skip_autoplay_countdown_title" android:key="revanced_skip_autoplay_countdown" android:defaultValue="false" android:summaryOn="@string/revanced_skip_autoplay_countdown_summary_on" android:summaryOff="@string/revanced_skip_autoplay_countdown_summary_off" />SETTINGS: PLAYER_COMPONENTS -->
<SwitchPreference android:title="@string/revanced_skip_autoplay_countdown_title" android:key="revanced_skip_autoplay_countdown" android:summaryOn="@string/revanced_skip_autoplay_countdown_summary_on" android:summaryOff="@string/revanced_skip_autoplay_countdown_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_zoom_overlay_title" android:key="revanced_hide_zoom_overlay" android:summaryOn="@string/revanced_hide_zoom_overlay_summary_on" android:summaryOff="@string/revanced_hide_zoom_overlay_summary_off" />SETTINGS: PLAYER_COMPONENTS -->

<!-- PREFERENCE_SCREEN: PLAYER
</PreferenceScreen>PREFERENCE_SCREEN: PLAYER -->
Expand Down Expand Up @@ -738,4 +739,4 @@
</PreferenceScreen>
</PreferenceScreen>

</PreferenceScreen>
</PreferenceScreen>

0 comments on commit 00640e6

Please sign in to comment.