From 2bc970e6d6da7575b490d8467d4376490aa3c85f Mon Sep 17 00:00:00 2001
From: inotia00 <108592928+inotia00@users.noreply.github.com>
Date: Mon, 11 Mar 2024 14:32:01 +0900
Subject: [PATCH] fix(YouTube/SponsorBlock): modernize skip buttons
---
.../youtube/utils/sponsorblock/SponsorBlockPatch.kt | 8 ++++++--
.../youtube/sponsorblock/default/layout/new_segment.xml | 2 +-
.../youtube/sponsorblock/outline/drawable/ic_sb_logo.xml | 2 +-
.../sponsorblock/outline/drawable/ic_sb_voting.xml | 6 +++---
.../sponsorblock/{outline => shared}/drawable/ns_bg.xml | 4 ++--
.../youtube/sponsorblock/shared/drawable/sb_btn_bg.xml | 5 +++++
.../sponsorblock/shared/layout/inline_sponsor_overlay.xml | 3 +++
.../sponsorblock/shared/layout/skip_sponsor_button.xml | 8 +++++---
8 files changed, 26 insertions(+), 12 deletions(-)
rename src/main/resources/youtube/sponsorblock/{outline => shared}/drawable/ns_bg.xml (75%)
create mode 100644 src/main/resources/youtube/sponsorblock/shared/drawable/sb_btn_bg.xml
diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/SponsorBlockPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/SponsorBlockPatch.kt
index 77e153531..7e8e6094f 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/SponsorBlockPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/utils/sponsorblock/SponsorBlockPatch.kt
@@ -68,6 +68,11 @@ object SponsorBlockPatch : ResourcePatch() {
"layout",
"inline_sponsor_overlay.xml",
"skip_sponsor_button.xml"
+ ),
+ ResourceGroup(
+ "drawable",
+ "ns_bg.xml",
+ "sb_btn_bg.xml"
)
).forEach { resourceGroup ->
context.copyResources("youtube/sponsorblock/shared", resourceGroup)
@@ -88,8 +93,7 @@ object SponsorBlockPatch : ResourcePatch() {
"ic_sb_forward.xml",
"ic_sb_logo.xml",
"ic_sb_publish.xml",
- "ic_sb_voting.xml",
- "ns_bg.xml"
+ "ic_sb_voting.xml"
)
).forEach { resourceGroup ->
context.copyResources("youtube/sponsorblock/outline", resourceGroup)
diff --git a/src/main/resources/youtube/sponsorblock/default/layout/new_segment.xml b/src/main/resources/youtube/sponsorblock/default/layout/new_segment.xml
index be5020be2..d82460904 100644
--- a/src/main/resources/youtube/sponsorblock/default/layout/new_segment.xml
+++ b/src/main/resources/youtube/sponsorblock/default/layout/new_segment.xml
@@ -6,7 +6,7 @@
android:id="@+id/sb_new_segment_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:background="#66000000"
+ android:background="@drawable/ns_bg"
android:gravity="start|center"
android:orientation="vertical">
diff --git a/src/main/resources/youtube/sponsorblock/outline/drawable/ic_sb_logo.xml b/src/main/resources/youtube/sponsorblock/outline/drawable/ic_sb_logo.xml
index 3ef398d20..33dd948a2 100644
--- a/src/main/resources/youtube/sponsorblock/outline/drawable/ic_sb_logo.xml
+++ b/src/main/resources/youtube/sponsorblock/outline/drawable/ic_sb_logo.xml
@@ -6,5 +6,5 @@
android:viewportHeight="24">
+ android:pathData="M 12 2.32 L 4.08 5.84 V 10.24 C 4.08 15.96 7.6 20.8 12 21.68 C 16.4 20.8 19.92 15.96 19.92 10.24 L 19.92 5.84 Z M 19.04 10.24 C 19.04 16.4 15.52 19.48 12 20.8 C 8.48 19.48 4.96 16.4 4.96 10.24 L 4.96 6.456 L 12 3.464 L 19.04 6.456 L 19.04 10.24 Z" />
diff --git a/src/main/resources/youtube/sponsorblock/outline/drawable/ic_sb_voting.xml b/src/main/resources/youtube/sponsorblock/outline/drawable/ic_sb_voting.xml
index a99bf1a15..bf8810d54 100644
--- a/src/main/resources/youtube/sponsorblock/outline/drawable/ic_sb_voting.xml
+++ b/src/main/resources/youtube/sponsorblock/outline/drawable/ic_sb_voting.xml
@@ -2,10 +2,10 @@
android:alpha="0.95"
android:width="24dp"
android:height="24dp"
- android:viewportWidth="960"
- android:viewportHeight="960"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
android:tint="#ffffffff">
+ android:pathData="M 3.31 13.029 Q 2.7379 13.029 2.3453 12.641 Q 1.9528 12.253 1.9528 11.6722 L 1.9528 6.5093 Q 1.9528 6.3611 2.0139 6.2175 Q 2.075 6.0741 2.1985 5.9506 L 6.2073 1.9417 L 6.5501 2.2844 Q 6.6303 2.3667 6.6867 2.4734 Q 6.7432 2.5802 6.7432 2.6679 L 6.7432 2.7968 L 5.9767 6.1081 L 10.2861 6.1081 Q 10.8105 6.1081 11.1585 6.4592 Q 11.5067 6.8103 11.5067 7.3293 L 11.5067 7.6013 Q 11.5067 7.7382 11.4846 7.8396 Q 11.4626 7.941 11.4185 8.0486 L 9.4946 12.4998 Q 9.3805 12.7519 9.1707 12.8905 Q 8.9612 13.029 8.6929 13.029 L 3.31 13.029 Z M 8.728 12.2148 L 10.6923 7.6246 L 10.6923 7.465 Q 10.6923 7.2361 10.5398 7.0791 Q 10.387 6.9222 10.1497 6.9222 L 4.996 6.9222 L 5.7154 3.595 L 2.7672 6.5465 L 2.7672 11.6722 Q 2.7672 11.9095 2.9198 12.0622 Q 3.0724 12.2148 3.31 12.2148 L 8.728 12.2148 Z M 17.7151 21.9586 L 17.3693 21.6151 Q 17.2952 21.5396 17.2372 21.4329 Q 17.1791 21.3259 17.1791 21.232 L 17.1791 21.1037 L 17.9458 17.7922 L 13.6363 17.7922 Q 13.1119 17.7922 12.7639 17.4454 Q 12.4158 17.0985 12.4158 16.571 L 12.4158 16.3066 Q 12.4158 16.1707 12.4378 16.0707 Q 12.4599 15.9705 12.504 15.8516 L 14.4278 11.4006 Q 14.5395 11.158 14.7475 11.0147 Q 14.9552 10.8714 15.2282 10.8714 L 20.6124 10.8714 Q 21.1843 10.8714 21.5772 11.2639 Q 21.9697 11.6565 21.9697 12.2283 L 21.9697 17.3919 Q 21.9697 17.5515 21.9054 17.6952 Q 21.8415 17.839 21.7218 17.9518 L 17.7151 21.9586 Z M 15.1944 11.6856 L 13.23 16.2757 L 13.23 16.4355 Q 13.23 16.6726 13.3826 16.8255 Q 13.5355 16.9781 13.7728 16.9781 L 18.9265 16.9781 L 18.2071 20.314 L 21.1552 17.3622 L 21.1552 12.2283 Q 21.1552 11.9994 21.0026 11.8424 Q 20.85 11.6856 20.6124 11.6856 L 15.1944 11.6856 Z M 2.7672 11.6722 L 2.7672 6.5465 L 2.7672 6.5465 L 2.7672 6.9222 L 2.7672 6.9222 Q 2.7672 6.9222 2.7672 7.0791 Q 2.7672 7.2361 2.7672 7.465 L 2.7672 7.6246 L 2.7672 12.2148 L 2.7672 12.2148 Q 2.7672 12.2148 2.7672 12.0622 Q 2.7672 11.9095 2.7672 11.6722 Z M 21.1552 12.2283 L 21.1552 17.3622 L 21.1552 17.3622 L 21.1552 16.9781 L 21.1552 16.9781 Q 21.1552 16.9781 21.1552 16.8255 Q 21.1552 16.6726 21.1552 16.4355 L 21.1552 16.2757 L 21.1552 11.6856 L 21.1552 11.6856 Q 21.1552 11.6856 21.1552 11.8424 Q 21.1552 11.9994 21.1552 12.2283 Z"/>
diff --git a/src/main/resources/youtube/sponsorblock/outline/drawable/ns_bg.xml b/src/main/resources/youtube/sponsorblock/shared/drawable/ns_bg.xml
similarity index 75%
rename from src/main/resources/youtube/sponsorblock/outline/drawable/ns_bg.xml
rename to src/main/resources/youtube/sponsorblock/shared/drawable/ns_bg.xml
index 529f14143..370a8d633 100644
--- a/src/main/resources/youtube/sponsorblock/outline/drawable/ns_bg.xml
+++ b/src/main/resources/youtube/sponsorblock/shared/drawable/ns_bg.xml
@@ -1,5 +1,5 @@
-
+
-
+
\ No newline at end of file
diff --git a/src/main/resources/youtube/sponsorblock/shared/drawable/sb_btn_bg.xml b/src/main/resources/youtube/sponsorblock/shared/drawable/sb_btn_bg.xml
new file mode 100644
index 000000000..6c13412fa
--- /dev/null
+++ b/src/main/resources/youtube/sponsorblock/shared/drawable/sb_btn_bg.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/youtube/sponsorblock/shared/layout/inline_sponsor_overlay.xml b/src/main/resources/youtube/sponsorblock/shared/layout/inline_sponsor_overlay.xml
index 2e2270a3e..e0ecba392 100644
--- a/src/main/resources/youtube/sponsorblock/shared/layout/inline_sponsor_overlay.xml
+++ b/src/main/resources/youtube/sponsorblock/shared/layout/inline_sponsor_overlay.xml
@@ -9,6 +9,7 @@
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/inline_controls_bottom_bar_height"
+ android:layout_marginStart="@dimen/margin_start"
android:focusable="true"
android:visibility="gone" />
@@ -20,6 +21,7 @@
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/inline_controls_bottom_bar_height"
+ android:layout_marginEnd="@dimen/margin_end"
android:focusable="true"
android:visibility="gone" />
@@ -30,6 +32,7 @@
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/brand_interaction_default_bottom_margin"
+ android:layout_marginStart="@dimen/margin_start"
android:focusable="true"
android:visibility="gone" />
\ No newline at end of file
diff --git a/src/main/resources/youtube/sponsorblock/shared/layout/skip_sponsor_button.xml b/src/main/resources/youtube/sponsorblock/shared/layout/skip_sponsor_button.xml
index 185960ec9..1755b5c89 100644
--- a/src/main/resources/youtube/sponsorblock/shared/layout/skip_sponsor_button.xml
+++ b/src/main/resources/youtube/sponsorblock/shared/layout/skip_sponsor_button.xml
@@ -3,6 +3,7 @@
xmlns:yt="http://schemas.android.com/apk/res-auto">
\ No newline at end of file