feat(YouTube/Overlay buttons): Add Mute Video button (#63)

* feat(YouTube/Overlay buttons): Add `Mute Video` button

* feat: apply code review suggestions

* feat: apply code review suggestions

---------

Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com>
This commit is contained in:
Francesco Marastoni 2024-07-13 08:14:33 +00:00 committed by GitHub
parent d88df4b750
commit c2d72dad94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 39 additions and 2 deletions

View File

@ -250,6 +250,7 @@ object VisualPreferencesIconsPatch : BaseResourcePatch(
"revanced_overlay_button_always_repeat",
"revanced_overlay_button_copy_video_url",
"revanced_overlay_button_copy_video_url_timestamp",
"revanced_overlay_button_mute_volume",
"revanced_overlay_button_external_downloader",
"revanced_overlay_button_speed_dialog",
"revanced_overlay_button_time_ordered_playlist",

View File

@ -86,6 +86,7 @@ object OverlayButtonsPatch : BaseResourcePatch(
"AlwaysRepeat;",
"CopyVideoUrl;",
"CopyVideoUrlTimestamp;",
"MuteVolume;",
"ExternalDownload;",
"SpeedDialog;",
"TimeOrderedPlaylist;",
@ -101,7 +102,8 @@ object OverlayButtonsPatch : BaseResourcePatch(
"drawable",
"playlist_repeat_button.xml",
"playlist_shuffle_button.xml",
"revanced_repeat_button.xml"
"revanced_repeat_button.xml",
"revanced_mute_volume_button.xml",
)
)
@ -126,6 +128,8 @@ object OverlayButtonsPatch : BaseResourcePatch(
"revanced_copy_button.png",
"revanced_copy_timestamp_button.png",
"revanced_download_button.png",
"revanced_volume_muted_button.png",
"revanced_volume_unmuted_button.png",
"revanced_speed_button.png",
"revanced_whitelist_button.png",
"yt_fill_arrow_repeat_white_24.png",

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector android:constantSize="true"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true">
<bitmap android:src="@drawable/revanced_volume_unmuted" android:tint="@color/yt_white1"/>
</item>
<item android:state_activated="false">
<bitmap android:src="@drawable/revanced_volume_muted" android:tint="@color/yt_white1"/>
</item>
</selector>

View File

@ -2,7 +2,8 @@
<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">
<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:src="@drawable/revanced_speed_button" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/copy_video_url_button" style="@style/YouTubePlayerButton"/>
<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:src="@drawable/revanced_copy_button" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/copy_video_url_timestamp_button" style="@style/YouTubePlayerButton"/>
<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:src="@drawable/revanced_copy_timestamp_button" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/whitelist_button" style="@style/YouTubePlayerButton"/>
<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:src="@drawable/revanced_copy_timestamp_button" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/mute_volume_button" style="@style/YouTubePlayerButton"/>
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/mute_volume_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:src="@drawable/revanced_mute_volume_button" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/whitelist_button" style="@style/YouTubePlayerButton"/>
<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:src="@drawable/revanced_whitelist_button" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/time_ordered_playlist_button" style="@style/YouTubePlayerButton"/>
<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:src="@drawable/revanced_time_ordered_playlist_button" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/always_repeat_button" style="@style/YouTubePlayerButton"/>
<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:src="@drawable/revanced_repeat_button" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/external_download_button" style="@style/YouTubePlayerButton"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -863,6 +863,8 @@ Tap and hold to copy video URL with timestamp."</string>
<string name="revanced_overlay_button_copy_video_url_timestamp_title">Show copy timestamp URL button</string>
<string name="revanced_overlay_button_copy_video_url_timestamp_summary">"Tap to copy video URL with timestamp.
Tap and hold to copy video timestamp."</string>
<string name="revanced_overlay_button_mute_volume_title">Show mute volume button</string>
<string name="revanced_overlay_button_mute_volume_summary">Tap to mute volume of the current video. Tap again to unmute.</string>
<string name="revanced_overlay_button_external_downloader_title">Show external download button</string>
<string name="revanced_overlay_button_external_downloader_summary">Tap to launch external downloader.</string>
<string name="revanced_overlay_button_speed_dialog_title">Show speed dialog button</string>

View File

@ -370,6 +370,7 @@
<SwitchPreference android:title="@string/revanced_overlay_button_always_repeat_title" android:key="revanced_overlay_button_always_repeat" android:summary="@string/revanced_overlay_button_always_repeat_summary" />
<SwitchPreference android:title="@string/revanced_overlay_button_copy_video_url_title" android:key="revanced_overlay_button_copy_video_url" android:summary="@string/revanced_overlay_button_copy_video_url_summary" />
<SwitchPreference android:title="@string/revanced_overlay_button_copy_video_url_timestamp_title" android:key="revanced_overlay_button_copy_video_url_timestamp" android:summary="@string/revanced_overlay_button_copy_video_url_timestamp_summary" />
<SwitchPreference android:title="@string/revanced_overlay_button_mute_volume_title" android:key="revanced_overlay_button_mute_volume" android:summary="@string/revanced_overlay_button_mute_volume_summary" />
<SwitchPreference android:title="@string/revanced_overlay_button_external_downloader_title" android:key="revanced_overlay_button_external_downloader" android:summary="@string/revanced_overlay_button_external_downloader_summary" />
<SwitchPreference android:title="@string/revanced_overlay_button_speed_dialog_title" android:key="revanced_overlay_button_speed_dialog" android:summary="@string/revanced_overlay_button_speed_dialog_summary" />
<SwitchPreference android:title="@string/revanced_overlay_button_time_ordered_playlist_title" android:key="revanced_overlay_button_time_ordered_playlist" android:summary="@string/revanced_overlay_button_time_ordered_playlist_summary" />

View File

@ -0,0 +1,18 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="48dp"
android:height="48dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group
android:scaleX="0.5"
android:scaleY="0.5"
android:pivotX="480"
android:pivotY="480">
<path
android:name="path"
android:pathData="M 563.077 779.77 L 563.077 747 Q 650.077 716.692 703.5 643.346 Q 756.923 570 756.923 479 Q 756.923 388 703.615 314.154 Q 650.308 240.308 563.077 211 L 563.077 178.23 Q 662.462 210.077 725.077 292.577 Q 787.693 375.077 787.693 479 Q 787.693 582.923 725.077 665.423 Q 662.462 747.923 563.077 779.77 Z M 172.307 560 L 172.307 400 L 309.231 400 L 452.308 256.922 L 452.308 703.078 L 309.231 560 L 172.307 560 Z M 553.846 615.693 L 553.846 342.538 Q 591.923 361.846 612.115 399.231 Q 632.308 436.615 632.308 480 Q 632.308 523.154 611.615 559.769 Q 590.923 596.385 553.846 615.693 Z M 421.538 334.308 L 323.154 430.769 L 203.077 430.769 L 203.077 529.231 L 323.154 529.231 L 421.538 625.923 L 421.538 334.308 Z M 324.462 480 Z"
android:fillColor="?ytTextPrimary" />
</group>
</vector>