mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 00:24:34 +02:00
feat(YouTube/Player components): add Skip autoplay countdown
settings
This commit is contained in:
parent
cba498dd41
commit
f90b9a2397
@ -24,6 +24,7 @@ import app.revanced.patches.youtube.player.components.fingerprints.RestoreSlideT
|
|||||||
import app.revanced.patches.youtube.player.components.fingerprints.SeekEduContainerFingerprint
|
import app.revanced.patches.youtube.player.components.fingerprints.SeekEduContainerFingerprint
|
||||||
import app.revanced.patches.youtube.player.components.fingerprints.SpeedOverlayFingerprint
|
import app.revanced.patches.youtube.player.components.fingerprints.SpeedOverlayFingerprint
|
||||||
import app.revanced.patches.youtube.player.components.fingerprints.SuggestedActionsFingerprint
|
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.WatermarkFingerprint
|
import app.revanced.patches.youtube.player.components.fingerprints.WatermarkFingerprint
|
||||||
import app.revanced.patches.youtube.player.components.fingerprints.WatermarkParentFingerprint
|
import app.revanced.patches.youtube.player.components.fingerprints.WatermarkParentFingerprint
|
||||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||||
@ -77,6 +78,7 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
|||||||
SeekEduContainerFingerprint,
|
SeekEduContainerFingerprint,
|
||||||
SpeedOverlayFingerprint,
|
SpeedOverlayFingerprint,
|
||||||
SuggestedActionsFingerprint,
|
SuggestedActionsFingerprint,
|
||||||
|
TouchAreaOnClickListenerFingerprint,
|
||||||
WatermarkParentFingerprint,
|
WatermarkParentFingerprint,
|
||||||
YouTubeControlsOverlayFingerprint,
|
YouTubeControlsOverlayFingerprint,
|
||||||
)
|
)
|
||||||
@ -323,6 +325,25 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
|||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
// region patch for skip autoplay countdown
|
||||||
|
|
||||||
|
// This patch works fine when the [SuggestedVideoEndScreenPatch] patch is included.
|
||||||
|
TouchAreaOnClickListenerFingerprint.resultOrThrow().let {
|
||||||
|
it.mutableClass.methods.find { method ->
|
||||||
|
method.parameters == listOf("Landroid/view/View${'$'}OnClickListener;")
|
||||||
|
}?.apply {
|
||||||
|
val setOnClickListenerIndex = getTargetIndexWithMethodReferenceName("setOnClickListener")
|
||||||
|
val setOnClickListenerRegister = getInstruction<FiveRegisterInstruction>(setOnClickListenerIndex).registerC
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
setOnClickListenerIndex + 1,
|
||||||
|
"invoke-static {v$setOnClickListenerRegister}, $PLAYER_CLASS_DESCRIPTOR->skipAutoPlayCountdown(Landroid/view/View;)V"
|
||||||
|
)
|
||||||
|
} ?: throw PatchException("Failed to find setOnClickListener method")
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
LithoFilterPatch.addFilter(PLAYER_COMPONENTS_FILTER_CLASS_DESCRIPTOR)
|
LithoFilterPatch.addFilter(PLAYER_COMPONENTS_FILTER_CLASS_DESCRIPTOR)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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.TouchArea
|
||||||
|
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
internal object TouchAreaOnClickListenerFingerprint : LiteralValueFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
literalSupplier = { TouchArea }
|
||||||
|
)
|
@ -91,6 +91,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
var TitleAnchor = -1L
|
var TitleAnchor = -1L
|
||||||
var ToolTipContentView = -1L
|
var ToolTipContentView = -1L
|
||||||
var TotalTime = -1L
|
var TotalTime = -1L
|
||||||
|
var TouchArea = -1L
|
||||||
var VideoQualityBottomSheet = -1L
|
var VideoQualityBottomSheet = -1L
|
||||||
var VoiceSearch = -1L
|
var VoiceSearch = -1L
|
||||||
var YouTubeControlsOverlaySubtitleButton = -1L
|
var YouTubeControlsOverlaySubtitleButton = -1L
|
||||||
@ -178,6 +179,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
TitleAnchor = getId(ID, "title_anchor")
|
TitleAnchor = getId(ID, "title_anchor")
|
||||||
ToolTipContentView = getId(LAYOUT, "tooltip_content_view")
|
ToolTipContentView = getId(LAYOUT, "tooltip_content_view")
|
||||||
TotalTime = getId(STRING, "total_time")
|
TotalTime = getId(STRING, "total_time")
|
||||||
|
TouchArea = getId(ID, "touch_area")
|
||||||
VideoQualityBottomSheet = getId(LAYOUT, "video_quality_bottom_sheet_list_fragment_title")
|
VideoQualityBottomSheet = getId(LAYOUT, "video_quality_bottom_sheet_list_fragment_title")
|
||||||
VoiceSearch = getId(ID, "voice_search")
|
VoiceSearch = getId(ID, "voice_search")
|
||||||
YouTubeControlsOverlaySubtitleButton = getId(LAYOUT, "youtube_controls_overlay_subtitle_button")
|
YouTubeControlsOverlaySubtitleButton = getId(LAYOUT, "youtube_controls_overlay_subtitle_button")
|
||||||
|
@ -487,6 +487,9 @@ Instead, use the 'Settings → Autoplay → Autoplay next video' setting."</stri
|
|||||||
<string name="revanced_hide_timed_reactions_title">Hide timed reactions</string>
|
<string name="revanced_hide_timed_reactions_title">Hide timed reactions</string>
|
||||||
<string name="revanced_hide_timed_reactions_summary_on">Timed reactions are hidden.</string>
|
<string name="revanced_hide_timed_reactions_summary_on">Timed reactions are hidden.</string>
|
||||||
<string name="revanced_hide_timed_reactions_summary_off">Timed reactions are shown.</string>
|
<string name="revanced_hide_timed_reactions_summary_off">Timed reactions are shown.</string>
|
||||||
|
<string name="revanced_skip_autoplay_countdown_title">Skip autoplay countdown</string>
|
||||||
|
<string name="revanced_skip_autoplay_countdown_summary_on">If autoplay is turned on, next video will play without a countdown.</string>
|
||||||
|
<string name="revanced_skip_autoplay_countdown_summary_off">If autoplay is turned on, next video will play after the countdown ends.</string>
|
||||||
|
|
||||||
<!-- PreferenceScreen: Player, PreferenceCategory: Player, PreferenceScreen: Action buttons -->
|
<!-- PreferenceScreen: Player, PreferenceCategory: Player, PreferenceScreen: Action buttons -->
|
||||||
<string name="revanced_preference_screen_action_buttons_title">Action buttons</string>
|
<string name="revanced_preference_screen_action_buttons_title">Action buttons</string>
|
||||||
|
@ -389,7 +389,8 @@
|
|||||||
<SwitchPreference android:title="@string/revanced_hide_seek_undo_message_title" android:key="revanced_hide_seek_undo_message" android:defaultValue="false" android:summaryOn="@string/revanced_hide_seek_undo_message_summary_on" android:summaryOff="@string/revanced_hide_seek_undo_message_summary_off" />
|
<SwitchPreference android:title="@string/revanced_hide_seek_undo_message_title" android:key="revanced_hide_seek_undo_message" android:defaultValue="false" android:summaryOn="@string/revanced_hide_seek_undo_message_summary_on" android:summaryOff="@string/revanced_hide_seek_undo_message_summary_off" />
|
||||||
<SwitchPreference android:title="@string/revanced_hide_suggested_actions_title" android:key="revanced_hide_suggested_actions" android:defaultValue="true" android:summaryOn="@string/revanced_hide_suggested_actions_summary_on" android:summaryOff="@string/revanced_hide_suggested_actions_summary_off" />
|
<SwitchPreference android:title="@string/revanced_hide_suggested_actions_title" android:key="revanced_hide_suggested_actions" android:defaultValue="true" android:summaryOn="@string/revanced_hide_suggested_actions_summary_on" android:summaryOff="@string/revanced_hide_suggested_actions_summary_off" />
|
||||||
<Preference android:title="@string/revanced_hide_suggested_video_end_screen_title" android:key="revanced_hide_suggested_video_end_screen" android:defaultValue="false" android:selectable="false" android:summary="@string/revanced_hide_suggested_video_end_screen_summary" />
|
<Preference android:title="@string/revanced_hide_suggested_video_end_screen_title" android:key="revanced_hide_suggested_video_end_screen" android:defaultValue="false" android:selectable="false" android:summary="@string/revanced_hide_suggested_video_end_screen_summary" />
|
||||||
<SwitchPreference android:title="@string/revanced_hide_timed_reactions_title" android:key="revanced_hide_timed_reactions" android:defaultValue="true" android:summaryOn="@string/revanced_hide_timed_reactions_summary_on" android:summaryOff="@string/revanced_hide_timed_reactions_summary_off" />SETTINGS: PLAYER_COMPONENTS -->
|
<SwitchPreference android:title="@string/revanced_hide_timed_reactions_title" android:key="revanced_hide_timed_reactions" android:defaultValue="true" android:summaryOn="@string/revanced_hide_timed_reactions_summary_on" android:summaryOff="@string/revanced_hide_timed_reactions_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 -->
|
||||||
|
|
||||||
<!-- PREFERENCE_SCREEN: PLAYER
|
<!-- PREFERENCE_SCREEN: PLAYER
|
||||||
</PreferenceScreen>PREFERENCE_SCREEN: PLAYER -->
|
</PreferenceScreen>PREFERENCE_SCREEN: PLAYER -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user