feat(YouTube/Overlay buttons): add patch option Change top buttons (#66)

* Add files via upload

* Add files via upload

* Add files via upload

* make mute/unmute button edges round like other overlay buttons

* add sharper, less-spread shadow for better visibility against light backgrounds

* feat: apply code review suggestions

---------

Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com>
This commit is contained in:
MondayNitro
2024-07-26 15:52:29 +05:30
committed by GitHub
parent 87d0eecb83
commit 19a64be093
86 changed files with 32 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.player.overlaybuttons
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.booleanPatchOption
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.fix.bottomui.CfBottomUIPatch
@ -67,6 +68,15 @@ object OverlayButtonsPatch : BaseResourcePatch(
required = true
)
// Option to change top buttons
private val ChangeTopButtons by booleanPatchOption(
key = "ChangeTopButtons",
default = false,
title = "Change top buttons",
description = "Change the icons at the top of the player.",
required = true
)
/**
* Main execution method for applying the patch.
*
@ -209,6 +219,28 @@ object OverlayButtonsPatch : BaseResourcePatch(
}
}
if (ChangeTopButtons == true) {
// Apply the selected icon type to the top buttons.
arrayOf(
"xxxhdpi",
"xxhdpi",
"xhdpi",
"hdpi",
"mdpi"
).forEach { dpi ->
context.copyResources(
"youtube/overlaybuttons/$iconType",
ResourceGroup(
"drawable-$dpi",
"yt_outline_gear_white_24.png",
"quantum_ic_closed_caption_off_grey600_24.png",
"quantum_ic_closed_caption_off_white_24.png",
"quantum_ic_closed_caption_white_24.png"
)
)
}
}
/**
* Add settings for the overlay buttons.
*/