mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
feat(YouTube Music): remove Enable playback speed
patch
This commit is contained in:
@ -1,78 +0,0 @@
|
||||
package app.revanced.patches.music.flyoutpanel.playbackspeed
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.flyoutpanel.playbackspeed.fingerprints.TouchOutsideFingerprint
|
||||
import app.revanced.patches.music.utils.flyoutbutton.FlyoutButtonContainerPatch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.FLYOUT
|
||||
import app.revanced.patches.music.utils.overridespeed.OverrideSpeedHookPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.music.video.information.VideoInformationPatch
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch(
|
||||
name = "Enable playback speed",
|
||||
description = "Adds an option to add a playback speed button to the flyout panel.",
|
||||
dependencies = [
|
||||
FlyoutButtonContainerPatch::class,
|
||||
OverrideSpeedHookPatch::class,
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class,
|
||||
VideoInformationPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.apps.youtube.music",
|
||||
[
|
||||
"6.21.52",
|
||||
"6.22.52",
|
||||
"6.23.56",
|
||||
"6.25.53",
|
||||
"6.26.51",
|
||||
"6.27.54",
|
||||
"6.28.53",
|
||||
"6.29.58",
|
||||
"6.31.55",
|
||||
"6.33.52"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object PlaybackSpeedPatch : BytecodePatch(
|
||||
setOf(TouchOutsideFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
TouchOutsideFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val setOnClickListenerIndex =
|
||||
implementation!!.instructions.indexOfFirst { instruction ->
|
||||
((instruction as? ReferenceInstruction)?.reference as? MethodReference)?.name == "setOnClickListener"
|
||||
}
|
||||
val setOnClickListenerRegister = getInstruction<FiveRegisterInstruction>(setOnClickListenerIndex).registerC
|
||||
|
||||
addInstruction(
|
||||
setOnClickListenerIndex + 1,
|
||||
"sput-object v$setOnClickListenerRegister, $FLYOUT->touchOutSideView:Landroid/view/View;"
|
||||
)
|
||||
}
|
||||
} ?: throw TouchOutsideFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.FLYOUT,
|
||||
"revanced_enable_flyout_panel_playback_speed",
|
||||
"false"
|
||||
)
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.flyoutpanel.playbackspeed.fingerprints
|
||||
package app.revanced.patches.music.flyoutpanel.replace.fingerprints
|
||||
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TouchOutside
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
@ -17,7 +17,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
dependencies = [
|
||||
FlyoutButtonContainerResourcePatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
|
@ -1,43 +0,0 @@
|
||||
package app.revanced.patches.music.utils.flyoutbutton
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.util.ResourceGroup
|
||||
import app.revanced.util.copyResources
|
||||
|
||||
object FlyoutButtonContainerResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
/**
|
||||
* create directory for flyout button container
|
||||
*/
|
||||
context["res/layout-v21"].mkdirs()
|
||||
|
||||
arrayOf(
|
||||
ResourceGroup(
|
||||
"layout-v21",
|
||||
"music_menu_like_buttons.xml"
|
||||
)
|
||||
).forEach { resourceGroup ->
|
||||
context.copyResources("music/flyout", resourceGroup)
|
||||
}
|
||||
|
||||
fun copyResources(resourceGroups: List<ResourceGroup>) {
|
||||
resourceGroups.forEach { context.copyResources("music/flyout", it) }
|
||||
}
|
||||
|
||||
val resourceFileNames = arrayOf(
|
||||
"yt_outline_play_arrow_half_circle_black_24"
|
||||
).map { "$it.png" }.toTypedArray()
|
||||
|
||||
fun createGroup(directory: String) = ResourceGroup(
|
||||
directory, *resourceFileNames
|
||||
)
|
||||
|
||||
arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi")
|
||||
.map { "drawable-$it" }
|
||||
.map(::createGroup)
|
||||
.let(::copyResources)
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user