Skip to content

Commit fb26c7a

Browse files
Francesco146anddea
andauthored
feat(YouTube - Overlay buttons): Add Mute Video button (#684)
* feat(YouTube - Overlay buttons): Add minimal MuteVolume button * feat(YouTube - Overlay buttons): Swap icons when audio is muted or not * feat(YouTube - Overlay buttons): Add all Mute Volume icons * chore: Update icons and button id --------- Co-authored-by: Aaron Veil <[email protected]>
1 parent 8bcb207 commit fb26c7a

File tree

36 files changed

+137
-10
lines changed

36 files changed

+137
-10
lines changed

src/main/kotlin/app/revanced/patches/youtube/player/overlaybuttons/OverlayButtonsPatch.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ object OverlayButtonsPatch : BaseResourcePatch(
8686
"AlwaysRepeat;",
8787
"CopyVideoUrl;",
8888
"CopyVideoUrlTimestamp;",
89+
"MuteVolume;",
8990
"ExternalDownload;",
9091
"SpeedDialog;",
9192
"TimeOrderedPlaylist;",
@@ -101,7 +102,8 @@ object OverlayButtonsPatch : BaseResourcePatch(
101102
"drawable",
102103
"playlist_repeat_button.xml",
103104
"playlist_shuffle_button.xml",
104-
"revanced_repeat_icon.xml"
105+
"revanced_repeat_icon.xml",
106+
"mute_volume_button.xml",
105107
)
106108
)
107109

@@ -126,6 +128,8 @@ object OverlayButtonsPatch : BaseResourcePatch(
126128
"revanced_time_ordered_playlist_icon.png",
127129
"revanced_copy_icon.png",
128130
"revanced_copy_icon_with_time.png",
131+
"revanced_overlay_button_mute_volume.png",
132+
"revanced_overlay_button_mute_volume_off.png",
129133
"revanced_download_icon.png",
130134
"revanced_speed_icon.png",
131135
"revanced_whitelist_icon.png",

src/main/kotlin/app/revanced/patches/youtube/utils/settings/VisualPreferencesIconsPatch.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ object VisualPreferencesIconsPatch : BaseResourcePatch(
144144
"revanced_overlay_button_always_repeat" to "M 475.231 586.462 L 475.231 402.846 L 429.231 402.846 L 429.231 372.308 L 505.769 372.308 L 505.769 586.462 L 475.231 586.462 Z M 292.308 840 L 160 707.692 L 292.308 575.385 L 314.308 597.846 L 219.846 692.308 L 701.538 692.308 L 701.538 532.308 L 732.308 532.308 L 732.308 723.077 L 219.846 723.077 L 314.308 817.539 L 292.308 840 Z M 227.692 427.692 L 227.692 236.923 L 740.154 236.923 L 645.692 142.461 L 667.692 120 L 800 252.308 L 667.692 384.615 L 645.692 362.154 L 740.154 267.692 L 258.462 267.692 L 258.462 427.692 L 227.692 427.692 Z",
145145
"revanced_overlay_button_copy_video_url" to "M 356.923 718.462 C 341.551 718.462 328.477 713.074 317.702 702.298 C 306.926 691.523 301.538 678.449 301.538 663.077 L 301.538 195.384 C 301.538 180.013 306.926 166.939 317.702 156.163 C 328.477 145.388 341.551 140 356.923 140 L 704.616 140 C 719.987 140 733.061 145.388 743.837 156.163 C 754.612 166.939 760 180.013 760 195.384 L 760 663.077 C 760 678.449 754.612 691.523 743.837 702.298 C 733.061 713.074 719.987 718.462 704.616 718.462 L 356.923 718.462 Z M 356.923 687.693 L 704.616 687.693 C 710.769 687.693 716.41 685.129 721.539 680 C 726.667 674.872 729.231 669.231 729.231 663.077 L 729.231 195.384 C 729.231 189.231 726.667 183.59 721.539 178.461 C 716.41 173.333 710.769 170.769 704.616 170.769 L 356.923 170.769 C 350.769 170.769 345.128 173.333 340 178.461 C 334.872 183.59 332.308 189.231 332.308 195.384 L 332.308 663.077 C 332.308 669.231 334.872 674.872 340 680 C 345.128 685.129 350.769 687.693 356.923 687.693 Z M 255.384 820 C 240.013 820 226.939 814.612 216.163 803.837 C 205.388 793.062 200 779.988 200 764.616 L 200 266.154 L 230.769 266.154 L 230.769 764.616 C 230.769 770.77 233.333 776.411 238.461 781.539 C 243.59 786.667 249.231 789.231 255.384 789.231 L 633.847 789.231 L 633.847 820 L 255.384 820 Z M 332.308 687.693 L 332.308 170.769 L 332.308 687.693 Z",
146146
"revanced_overlay_button_copy_video_url_timestamp" to "M 680.616 860 C 637.301 860 600.677 845.033 570.744 815.1 C 540.811 785.167 525.844 748.543 525.844 705.228 C 525.844 661.911 540.823 625.287 570.78 595.356 C 600.737 565.423 637.221 550.456 680.232 550.456 C 723.805 550.456 760.557 565.435 790.488 595.392 C 820.421 625.349 835.388 661.833 835.388 704.844 C 835.388 748.417 820.421 785.169 790.488 815.1 C 760.555 845.033 723.931 860 680.616 860 Z M 742.904 795.848 L 764.692 774 L 692 701.308 L 692 592.384 L 661.46 592.384 L 661.46 713 L 742.9 795.848 L 742.904 795.848 Z M 356.924 718.46 C 341.551 718.46 328.477 713.072 317.704 702.296 C 306.928 691.52 301.54 678.447 301.54 663.076 L 301.54 195.384 C 301.54 180.013 306.928 166.94 317.704 156.164 C 328.477 145.388 341.551 140 356.924 140 L 704.616 140 C 719.987 140 733.06 145.388 743.836 156.164 C 754.612 166.94 760 180.013 760 195.384 L 760 462.616 C 754.101 460.717 748.877 458.891 744.328 457.136 C 739.779 455.379 734.745 453.591 729.228 451.772 L 729.228 195.384 C 729.231 189.229 726.668 183.588 721.54 178.46 C 716.412 173.332 710.771 170.768 704.616 170.768 L 356.924 170.768 C 350.769 170.768 345.128 173.332 340 178.46 C 334.872 183.588 332.308 189.229 332.308 195.384 L 332.308 663.076 C 332.308 669.231 334.872 674.872 340 680 C 345.128 685.128 350.769 687.692 356.924 687.692 L 416.924 687.692 L 416.924 718.46 L 356.924 718.46 Z M 255.384 820 C 240.013 820 226.94 814.612 216.164 803.836 C 205.388 793.06 200 779.987 200 764.616 L 200 266.152 L 230.768 266.152 L 230.768 764.616 C 230.768 770.771 233.332 776.412 238.46 781.54 C 243.588 786.668 249.229 789.232 255.384 789.232 L 440 789.232 C 441.795 794.616 443.872 799.705 446.232 804.5 C 448.592 809.295 451.567 814.461 455.2 820 L 255.384 820 Z M 332.308 687.692 L 332.308 170.768 L 332.308 687.692 Z",
147+
"revanced_overlay_button_mute_volume" to "revanced_enable_swipe_volume",
147148
"revanced_overlay_button_external_downloader" to "M 480 626.231 L 341.615 487.846 L 363.846 466.384 L 464.615 566.384 L 464.615 200 L 495.385 200 L 495.385 566.384 L 596.154 466.384 L 618.385 487.846 L 480 626.231 Z M 255.384 760 Q 232.327 760 216.163 743.837 Q 200 727.673 200 704.616 L 200 597 L 230.769 597 L 230.769 704.616 Q 230.769 713.846 238.461 721.539 Q 246.154 729.231 255.384 729.231 L 704.616 729.231 Q 713.846 729.231 721.539 721.539 Q 729.231 713.846 729.231 704.616 L 729.231 597 L 760 597 L 760 704.616 Q 760 727.673 743.837 743.837 Q 727.673 760 704.616 760 L 255.384 760 Z",
148149
"revanced_overlay_button_speed_dialog" to "M 425.461 614.616 Q 443.077 632.616 475.038 630.346 Q 507 628.077 520.846 607.077 L 727.616 312.692 L 433.385 519.385 Q 411.846 534 409.846 565.308 Q 407.846 596.615 425.461 614.616 Z M 478.769 200.231 Q 533.462 200.231 582.385 214.884 Q 631.308 229.538 679.846 262.231 L 654 282.308 Q 613.615 256.154 568.269 243.577 Q 522.923 231 478.961 231 Q 342.121 231 246.445 327.639 Q 150.769 424.278 150.769 561.744 Q 150.769 605.154 162.5 648.462 Q 174.231 691.769 196.667 729.231 L 760.846 729.231 Q 783.615 692.462 795.462 647.923 Q 807.308 603.385 807.308 558.923 Q 807.308 520 795.962 473.423 Q 784.615 426.846 758 388.923 L 778.539 363.077 Q 811.923 416.769 824.385 462.884 Q 836.846 509 838.077 556.769 Q 838.539 609.077 826.846 654.385 Q 815.154 699.692 790.462 743.923 Q 784.616 753.846 777.654 756.923 Q 770.692 760 759.154 760 L 198.154 760 Q 189.511 760 181.14 754.962 Q 172.769 749.923 167.846 740.846 Q 148 705.154 134 661.423 Q 120 617.692 120 561.692 Q 120 487.923 147.978 422.218 Q 175.956 356.513 224.247 307.295 Q 272.538 258.077 338.295 229.154 Q 404.052 200.231 478.769 200.231 Z M 473.615 487.385 Z",
149150
"revanced_overlay_button_time_ordered_playlist" to "M 160 626.154 L 160 595.384 L 434.461 595.384 L 434.461 626.154 L 160 626.154 Z M 160 463.462 L 160 432.692 L 595.308 432.692 L 595.308 463.462 L 160 463.462 Z M 160 301.538 L 160 270.769 L 595.308 270.769 L 595.308 301.538 L 160 301.538 Z M 668.154 800 L 668.154 561.077 L 840.769 681.308 L 668.154 800 Z",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector android:constantSize="true"
3+
xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:state_activated="true">
5+
<bitmap android:src="@drawable/revanced_overlay_button_mute_volume" android:tint="?ytTextPrimary"/>
6+
</item>
7+
<item android:state_activated="false">
8+
<bitmap android:src="@drawable/revanced_overlay_button_mute_volume_off" android:tint="?ytTextPrimary"/>
9+
</item>
10+
</selector>
Lines changed: 117 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,119 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yt="http://schemas.android.com/apk/res-auto" android:id="@+id/youtube_controls_bottom_ui_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layoutDirection="ltr">
3-
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/speed_dialog_button" android:paddingLeft="0.0dip" android:paddingTop="22.0dip" android:paddingRight="0.0dip" android:paddingBottom="22.0dip" android:longClickable="false" android:layout_width="48.0dip" android:layout_height="48.0dip" android:contentDescription="@string/revanced_overlay_button_speed_dialog_title" android:src="@drawable/revanced_speed_icon" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/copy_video_url_button" style="@style/YouTubePlayerButton"/>
4-
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/copy_video_url_button" android:paddingLeft="0.0dip" android:paddingTop="22.0dip" android:paddingRight="0.0dip" android:paddingBottom="22.0dip" android:longClickable="false" android:layout_width="48.0dip" android:layout_height="48.0dip" android:contentDescription="@string/revanced_overlay_button_copy_video_url_title" android:src="@drawable/revanced_copy_icon" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/copy_video_url_timestamp_button" style="@style/YouTubePlayerButton"/>
5-
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/copy_video_url_timestamp_button" android:paddingLeft="0.0dip" android:paddingTop="22.0dip" android:paddingRight="0.0dip" android:paddingBottom="22.0dip" android:longClickable="false" android:layout_width="48.0dip" android:layout_height="48.0dip" android:contentDescription="@string/revanced_overlay_button_copy_video_url_timestamp_title" android:src="@drawable/revanced_copy_icon_with_time" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/whitelist_button" style="@style/YouTubePlayerButton"/>
6-
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/whitelist_button" android:paddingLeft="0.0dip" android:paddingTop="22.0dip" android:paddingRight="0.0dip" android:paddingBottom="22.0dip" android:longClickable="false" android:layout_width="48.0dip" android:layout_height="48.0dip" android:contentDescription="@string/revanced_overlay_button_whitelist_title" android:src="@drawable/revanced_whitelist_icon" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/time_ordered_playlist_button" style="@style/YouTubePlayerButton"/>
7-
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/time_ordered_playlist_button" android:paddingLeft="0.0dip" android:paddingTop="22.0dip" android:paddingRight="0.0dip" android:paddingBottom="22.0dip" android:longClickable="false" android:layout_width="48.0dip" android:layout_height="48.0dip" android:contentDescription="@string/revanced_overlay_button_time_ordered_playlist_title" android:src="@drawable/revanced_time_ordered_playlist_icon" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/always_repeat_button" style="@style/YouTubePlayerButton"/>
8-
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/always_repeat_button" android:paddingLeft="0.0dip" android:paddingTop="22.0dip" android:paddingRight="0.0dip" android:paddingBottom="22.0dip" android:longClickable="false" android:layout_width="48.0dip" android:layout_height="48.0dip" android:contentDescription="@string/revanced_overlay_button_always_repeat_title" android:src="@drawable/revanced_repeat_icon" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/external_download_button" style="@style/YouTubePlayerButton"/>
9-
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/external_download_button" android:paddingLeft="0.0dip" android:paddingTop="22.0dip" android:paddingRight="0.0dip" android:paddingBottom="22.0dip" android:longClickable="false" android:layout_width="48.0dip" android:layout_height="48.0dip" android:contentDescription="@string/revanced_overlay_button_external_downloader_title" android:src="@drawable/revanced_download_icon" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" style="@style/YouTubePlayerButton"/>
2+
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:yt="http://schemas.android.com/apk/res-auto"
4+
android:id="@+id/youtube_controls_bottom_ui_container"
5+
android:layout_width="match_parent" android:layout_height="wrap_content"
6+
android:layoutDirection="ltr">
7+
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/speed_dialog_button"
8+
android:paddingLeft="0.0dip"
9+
android:paddingTop="22.0dip"
10+
android:paddingRight="0.0dip"
11+
android:paddingBottom="22.0dip"
12+
android:longClickable="false"
13+
android:layout_width="48.0dip"
14+
android:layout_height="48.0dip"
15+
android:contentDescription="@string/revanced_overlay_button_speed_dialog_title"
16+
android:src="@drawable/revanced_speed_icon"
17+
android:scaleType="center"
18+
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
19+
yt:layout_constraintRight_toLeftOf="@+id/copy_video_url_button"
20+
style="@style/YouTubePlayerButton"/>
21+
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/copy_video_url_button"
22+
android:paddingLeft="0.0dip"
23+
android:paddingTop="22.0dip"
24+
android:paddingRight="0.0dip"
25+
android:paddingBottom="22.0dip"
26+
android:longClickable="false"
27+
android:layout_width="48.0dip"
28+
android:layout_height="48.0dip"
29+
android:contentDescription="@string/revanced_overlay_button_copy_video_url_title"
30+
android:src="@drawable/revanced_copy_icon"
31+
android:scaleType="center"
32+
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
33+
yt:layout_constraintRight_toLeftOf="@+id/copy_video_url_timestamp_button"
34+
style="@style/YouTubePlayerButton"/>
35+
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/copy_video_url_timestamp_button"
36+
android:paddingLeft="0.0dip"
37+
android:paddingTop="22.0dip"
38+
android:paddingRight="0.0dip"
39+
android:paddingBottom="22.0dip"
40+
android:longClickable="false"
41+
android:layout_width="48.0dip"
42+
android:layout_height="48.0dip"
43+
android:contentDescription="@string/revanced_overlay_button_copy_video_url_timestamp_title"
44+
android:src="@drawable/revanced_copy_icon_with_time"
45+
android:scaleType="center"
46+
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
47+
yt:layout_constraintRight_toLeftOf="@+id/mute_volume_button"
48+
style="@style/YouTubePlayerButton"/>
49+
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/mute_volume_button"
50+
android:paddingLeft="0.0dip"
51+
android:paddingTop="22.0dip"
52+
android:paddingRight="0.0dip"
53+
android:paddingBottom="22.0dip"
54+
android:longClickable="false"
55+
android:layout_width="48.0dip"
56+
android:layout_height="48.0dip"
57+
android:contentDescription="@string/revanced_overlay_button_mute_volume_title"
58+
android:src="@drawable/mute_volume_button"
59+
android:scaleType="center"
60+
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
61+
yt:layout_constraintRight_toLeftOf="@+id/whitelist_button"
62+
style="@style/YouTubePlayerButton"/>
63+
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/whitelist_button"
64+
android:paddingLeft="0.0dip"
65+
android:paddingTop="22.0dip"
66+
android:paddingRight="0.0dip"
67+
android:paddingBottom="22.0dip"
68+
android:longClickable="false"
69+
android:layout_width="48.0dip"
70+
android:layout_height="48.0dip"
71+
android:contentDescription="@string/revanced_overlay_button_whitelist_title"
72+
android:src="@drawable/revanced_whitelist_icon"
73+
android:scaleType="center"
74+
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
75+
yt:layout_constraintRight_toLeftOf="@+id/time_ordered_playlist_button"
76+
style="@style/YouTubePlayerButton"/>
77+
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/time_ordered_playlist_button"
78+
android:paddingLeft="0.0dip"
79+
android:paddingTop="22.0dip"
80+
android:paddingRight="0.0dip"
81+
android:paddingBottom="22.0dip"
82+
android:longClickable="false"
83+
android:layout_width="48.0dip"
84+
android:layout_height="48.0dip"
85+
android:contentDescription="@string/revanced_overlay_button_time_ordered_playlist_title"
86+
android:src="@drawable/revanced_time_ordered_playlist_icon"
87+
android:scaleType="center"
88+
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
89+
yt:layout_constraintRight_toLeftOf="@+id/always_repeat_button"
90+
style="@style/YouTubePlayerButton"/>
91+
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/always_repeat_button"
92+
android:paddingLeft="0.0dip"
93+
android:paddingTop="22.0dip"
94+
android:paddingRight="0.0dip"
95+
android:paddingBottom="22.0dip"
96+
android:longClickable="false"
97+
android:layout_width="48.0dip"
98+
android:layout_height="48.0dip"
99+
android:contentDescription="@string/revanced_overlay_button_always_repeat_title"
100+
android:src="@drawable/revanced_repeat_icon"
101+
android:scaleType="center"
102+
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
103+
yt:layout_constraintRight_toLeftOf="@+id/external_download_button"
104+
style="@style/YouTubePlayerButton"/>
105+
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/external_download_button"
106+
android:paddingLeft="0.0dip"
107+
android:paddingTop="22.0dip"
108+
android:paddingRight="0.0dip"
109+
android:paddingBottom="22.0dip"
110+
android:longClickable="false"
111+
android:layout_width="48.0dip"
112+
android:layout_height="48.0dip"
113+
android:contentDescription="@string/revanced_overlay_button_external_downloader_title"
114+
android:src="@drawable/revanced_download_icon"
115+
android:scaleType="center"
116+
yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container"
117+
yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button"
118+
style="@style/YouTubePlayerButton"/>
10119
</android.support.constraint.ConstraintLayout>

0 commit comments

Comments
 (0)