fix(YouTube): Do not hide player controls when using double tap to skip forward (#4487)

Co-authored-by: MarcaDian <tolan.sheremeev@gmail.com>
This commit is contained in:
LisoUseInAIKyrios
2025-02-22 17:44:53 +02:00
committed by GitHub
parent 3d1dd06177
commit 63fe870d48
19 changed files with 372 additions and 398 deletions

View File

@ -82,9 +82,9 @@ private val sponsorBlockResourcePatch = resourcePatch {
private const val EXTENSION_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/sponsorblock/SegmentPlaybackController;"
private const val EXTENSION_CREATE_SEGMENT_BUTTON_CONTROLLER_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/sponsorblock/ui/CreateSegmentButtonController;"
"Lapp/revanced/extension/youtube/sponsorblock/ui/CreateSegmentButton;"
private const val EXTENSION_VOTING_BUTTON_CONTROLLER_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/sponsorblock/ui/VotingButtonController;"
"Lapp/revanced/extension/youtube/sponsorblock/ui/VotingButton;"
private const val EXTENSION_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/sponsorblock/ui/SponsorBlockViewController;"

View File

@ -77,12 +77,9 @@ val playerControlsResourcePatch = resourcePatch {
).item(0)
val bottomTargetDocumentChildNodes = bottomTargetDocument.childNodes
var bottomInsertBeforeNode: Node = bottomTargetDocumentChildNodes.findElementByAttributeValue(
var bottomInsertBeforeNode: Node = bottomTargetDocumentChildNodes.findElementByAttributeValueOrThrow(
"android:inflatedId",
bottomLastLeftOf,
) ?: bottomTargetDocumentChildNodes.findElementByAttributeValueOrThrow(
"android:id", // Older targets use non-inflated id.
bottomLastLeftOf,
)
addTopControl = { resourceDirectoryName ->
@ -123,7 +120,7 @@ val playerControlsResourcePatch = resourcePatch {
).item(0).childNodes
// Copy the patch layout xml into the target layout file.
for (index in 1 until sourceElements.length) {
for (index in sourceElements.length - 1 downTo 1) {
val element = sourceElements.item(index).cloneNode(true)
// If the element has no attributes there's no point adding it to the destination.
@ -189,7 +186,7 @@ fun initializeBottomControl(descriptor: String) {
fun injectVisibilityCheckCall(descriptor: String) {
visibilityMethod.addInstruction(
visibilityInsertIndex++,
"invoke-static { p1 , p2 }, $descriptor->changeVisibility(ZZ)V",
"invoke-static { p1 , p2 }, $descriptor->setVisibility(ZZ)V",
)
if (!visibilityImmediateCallbacksExistModified) {
@ -199,7 +196,7 @@ fun injectVisibilityCheckCall(descriptor: String) {
visibilityImmediateMethod.addInstruction(
visibilityImmediateInsertIndex++,
"invoke-static { p0 }, $descriptor->changeVisibilityImmediate(Z)V",
"invoke-static { p0 }, $descriptor->setVisibilityImmediate(Z)V",
)
}

View File

@ -448,10 +448,10 @@ This feature is only available for older devices"</string>
<string name="revanced_share_copy_url_success">URL copied to clipboard</string>
<string name="revanced_share_copy_url_timestamp_success">URL with timestamp copied</string>
<string name="revanced_copy_video_url_title">Show copy video URL button</string>
<string name="revanced_copy_video_url_summary_on">Button is shown. Tap to copy video URL. Tap and hold to copy video URL with timestamp</string>
<string name="revanced_copy_video_url_summary_on">Button is shown. Tap to copy video URL. Tap and hold to copy with timestamp</string>
<string name="revanced_copy_video_url_summary_off">Button is not shown</string>
<string name="revanced_copy_video_url_timestamp_title">Show copy timestamp URL button</string>
<string name="revanced_copy_video_url_timestamp_summary_on">Button is shown. Tap to copy video URL with timestamp. Tap and hold to copy video without timestamp</string>
<string name="revanced_copy_video_url_timestamp_summary_on">Button is shown. Tap to copy video URL with timestamp. Tap and hold to copy without timestamp</string>
<string name="revanced_copy_video_url_timestamp_summary_off">Button is not shown</string>
</patch>
<patch id="interaction.dialog.removeViewerDiscretionDialogPatch">

View File

@ -13,12 +13,19 @@
android:layout_height="60.0dip"
android:paddingTop="6.0dp"
android:paddingBottom="0dp"
android:longClickable="false"
android:scaleType="center"
android:src="@drawable/revanced_yt_copy_timestamp"
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" />
<View
android:id="@+id/revanced_copy_video_url_timestamp_button_placeholder"
android:layout_width="48.0dip"
android:layout_height="60.0dip"
android:visibility="gone"
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" />
<com.google.android.libraries.youtube.common.ui.TouchImageView
android:id="@+id/revanced_copy_video_url_button"
style="@style/YouTubePlayerButton"
@ -26,9 +33,16 @@
android:layout_height="60.0dip"
android:paddingTop="6.0dp"
android:paddingBottom="0dp"
android:longClickable="false"
android:scaleType="center"
android:src="@drawable/revanced_yt_copy"
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" />
<View
android:id="@+id/revanced_copy_video_url_button_placeholder"
android:layout_width="48.0dip"
android:layout_height="60.0dip"
android:visibility="gone"
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" />
</android.support.constraint.ConstraintLayout>

View File

@ -18,4 +18,12 @@
android:src="@drawable/revanced_yt_download_button"
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" />
<View
android:id="@+id/revanced_external_download_button_placeholder"
android:layout_width="48.0dip"
android:layout_height="60.0dip"
android:visibility="gone"
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" />
</android.support.constraint.ConstraintLayout>

View File

@ -18,4 +18,12 @@
android:src="@drawable/revanced_playback_speed_dialog_button"
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" />
<View
android:id="@+id/revanced_playback_speed_dialog_button_placeholder"
android:layout_width="48.0dip"
android:layout_height="60.0dip"
android:visibility="gone"
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" />
</android.support.constraint.ConstraintLayout>