generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...otlin/app/revanced/patches/youtube/layout/buttons/annotations/HideButtonsCompatibility.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.youtube.layout.buttons.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[Package( | ||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37") | ||
)] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class HideButtonsCompatibility |
81 changes: 81 additions & 0 deletions
81
src/main/kotlin/app/revanced/patches/youtube/layout/buttons/patch/HideButtonsPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package app.revanced.patches.youtube.layout.buttons.patch | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.impl.ResourceData | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.annotations.DependsOn | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patcher.patch.impl.ResourcePatch | ||
import app.revanced.patches.youtube.ad.general.bytecode.patch.GeneralBytecodeAdsPatch | ||
import app.revanced.patches.youtube.layout.buttons.annotations.HideButtonsCompatibility | ||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch | ||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch | ||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen | ||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource | ||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference | ||
|
||
@Patch | ||
@DependsOn([ResourceMappingResourcePatch::class, GeneralBytecodeAdsPatch::class]) | ||
@Name("hide-video-buttons") | ||
@Description("Adds options to hide action buttons under a video.") | ||
@HideButtonsCompatibility | ||
@Version("0.0.1") | ||
class HideButtonsPatch : ResourcePatch() { | ||
override fun execute(data: ResourceData): PatchResult { | ||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( | ||
PreferenceScreen( | ||
"revanced_hide_buttons", | ||
StringResource("revanced_hide_buttons_title", "Hide action buttons"), | ||
listOf( | ||
SwitchPreference( | ||
"revanced_like_button", | ||
StringResource("revanced_like_button_title", "Hide like button"), | ||
false, | ||
StringResource("revanced_like_button_on", "Like button is hidden"), | ||
StringResource("revanced_like_button_off", "Like button is shown") | ||
), | ||
SwitchPreference( | ||
"revanced_dislike_button", | ||
StringResource("revanced_dislike_button_title", "Hide dislike button"), | ||
false, | ||
StringResource("revanced_dislike_button_on", "Dislike button is hidden"), | ||
StringResource("revanced_dislike_button_off", "Dislike button is shown") | ||
), | ||
SwitchPreference( | ||
"revanced_download_button", | ||
StringResource("revanced_download_button_title", "Hide download button"), | ||
false, | ||
StringResource("revanced_download_button_on", "Download button is hidden"), | ||
StringResource("revanced_download_button_off", "Download button is shown") | ||
), | ||
SwitchPreference( | ||
"revanced_playlist_button", | ||
StringResource("revanced_playlist_button_title", "Hide playlist button"), | ||
false, | ||
StringResource("revanced_playlist_button_on", "Playlist button is hidden"), | ||
StringResource("revanced_playlist_button_off", "Playlist button is shown") | ||
), | ||
SwitchPreference( | ||
"revanced_action_button", | ||
StringResource("revanced_action_button_title", "Hide create, clip and thanks buttons"), | ||
true, | ||
StringResource("revanced_action_button_on", "Buttons are hidden"), | ||
StringResource("revanced_action_button_off", "Buttons are shown") | ||
), | ||
SwitchPreference( | ||
"revanced_share_button", | ||
StringResource("revanced_share_button_title", "Hide share button"), | ||
false, | ||
StringResource("revanced_share_button_on", "Share button is hidden"), | ||
StringResource("revanced_share_button_off", "Share button is shown") | ||
), | ||
), | ||
StringResource("revanced_hide_buttons_summary", "Hide or show buttons under videos") | ||
) | ||
) | ||
return PatchResultSuccess() | ||
} | ||
} |