mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-06 10:17:10 +01:00
fix(youtube/downloads): rename patch to external-downloads
(#2274)
This commit is contained in:
parent
e0b1b35fb3
commit
4480911e0b
@ -5,5 +5,5 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class DownloadsCompatibility
|
internal annotation class ExternalDownloadsCompatibility
|
||||||
|
|
@ -9,20 +9,20 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
|
import app.revanced.patches.youtube.interaction.downloads.annotation.ExternalDownloadsCompatibility
|
||||||
import app.revanced.patches.youtube.interaction.downloads.resource.patch.DownloadsResourcePatch
|
import app.revanced.patches.youtube.interaction.downloads.resource.patch.ExternalDownloadsResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||||
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("downloads")
|
@Name("external-downloads")
|
||||||
@DependsOn([DownloadsResourcePatch::class, PlayerControlsBytecodePatch::class, VideoInformationPatch::class])
|
@DependsOn([ExternalDownloadsResourcePatch::class, PlayerControlsBytecodePatch::class, VideoInformationPatch::class])
|
||||||
@Description("Adds a download button to the YouTube video player.")
|
@Description("Adds support to download and save YouTube videos using an external app.")
|
||||||
@DownloadsCompatibility
|
@ExternalDownloadsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class DownloadsBytecodePatch : BytecodePatch() {
|
class ExternalDownloadsBytecodePatch : BytecodePatch() {
|
||||||
private companion object {
|
private companion object {
|
||||||
const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/videoplayer/DownloadButton;"
|
const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/videoplayer/ExternalDownloadButton;"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
@ -14,50 +14,42 @@ import app.revanced.util.resources.ResourceUtils
|
|||||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||||
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||||
|
|
||||||
@Name("downloads-resource-patch")
|
@Name("external-downloads-resource-patch")
|
||||||
@DependsOn([BottomControlsResourcePatch::class, SettingsPatch::class])
|
@DependsOn([BottomControlsResourcePatch::class, SettingsPatch::class])
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class DownloadsResourcePatch : ResourcePatch {
|
class ExternalDownloadsResourcePatch : ResourcePatch {
|
||||||
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
|
||||||
PreferenceScreen(
|
PreferenceScreen(
|
||||||
"revanced_external_downloader_preference_screen",
|
"revanced_external_downloader_preference_screen",
|
||||||
StringResource("revanced_external_downloader_preference_screen_title", "Download settings"),
|
StringResource("revanced_external_downloader_preference_screen_title", "External download settings"),
|
||||||
listOf(
|
listOf(
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_external_downloader",
|
"revanced_external_downloader",
|
||||||
StringResource("revanced_external_downloader_title", "Show download button"),
|
StringResource("revanced_external_downloader_title", "Show external download button"),
|
||||||
StringResource("revanced_external_downloader_summary_on", "Download button is shown"),
|
StringResource("revanced_external_downloader_summary_on", "Download button shown in player"),
|
||||||
StringResource("revanced_external_downloader_summary_off", "Download button is not shown")
|
StringResource("revanced_external_downloader_summary_off", "Download button not shown in player")
|
||||||
),
|
),
|
||||||
TextPreference(
|
TextPreference(
|
||||||
"revanced_external_downloader_name",
|
"revanced_external_downloader_name",
|
||||||
StringResource("revanced_external_downloader_name_title", "Downloader package name"),
|
StringResource("revanced_external_downloader_name_title", "Downloader package name"),
|
||||||
StringResource("revanced_external_downloader_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s"),
|
StringResource("revanced_external_downloader_name_summary", "Package name of your installed external downloader app, such as NewPipe or PowerTube"),
|
||||||
InputType.TEXT
|
InputType.TEXT
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
StringResource("revanced_external_downloader_preference_screen_summary", "Settings related to downloads")
|
StringResource("revanced_external_downloader_preference_screen_summary", "Settings for using an external downloader")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
/*
|
// Copy strings
|
||||||
* Copy strings
|
|
||||||
*/
|
|
||||||
|
|
||||||
context.mergeStrings("downloads/host/values/strings.xml")
|
context.mergeStrings("downloads/host/values/strings.xml")
|
||||||
|
|
||||||
/*
|
// Copy resources
|
||||||
* Copy resources
|
|
||||||
*/
|
|
||||||
|
|
||||||
context.copyResources("downloads", ResourceUtils.ResourceGroup("drawable", "revanced_yt_download_button.xml"))
|
context.copyResources("downloads", ResourceUtils.ResourceGroup("drawable", "revanced_yt_download_button.xml"))
|
||||||
|
|
||||||
/*
|
// Add download button node
|
||||||
* Add download button node
|
|
||||||
*/
|
|
||||||
|
|
||||||
BottomControlsResourcePatch.addControls("downloads/host/layout/${BottomControlsResourcePatch.TARGET_RESOURCE_NAME}")
|
BottomControlsResourcePatch.addControls("downloads/host/layout/${BottomControlsResourcePatch.TARGET_RESOURCE_NAME}")
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-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">
|
<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/download_button" android:paddingLeft="12dp" android:paddingTop="22dp" android:paddingRight="12dp" android:paddingBottom="16dp" android:longClickable="false" android:layout_width="60dp" android:layout_height="60dp" android:src="@drawable/revanced_yt_download_button" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" style="@style/YouTubePlayerButton"/>
|
<com.google.android.libraries.youtube.common.ui.TouchImageView android:id="@+id/external_download_button" android:paddingLeft="12dp" android:paddingTop="22dp" android:paddingRight="12dp" android:paddingBottom="16dp" android:longClickable="false" android:layout_width="60dp" android:layout_height="60dp" android:src="@drawable/revanced_yt_download_button" android:scaleType="center" yt:layout_constraintBottom_toTopOf="@+id/quick_actions_container" yt:layout_constraintRight_toLeftOf="@+id/fullscreen_button" style="@style/YouTubePlayerButton"/>
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="downloader_not_installed_warning">is not installed. Please install it.</string>
|
<string name="external_downloader_not_installed_warning">is not installed. Please install it.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user