mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
feat(music/settings): change category name Bottom Player
→ Action Bar
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.buttoncontainer.downloadbuttonhook.patch
|
||||
package app.revanced.patches.music.actionbar.downloadbuttonhook.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -6,8 +6,8 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.actionbarhook.patch.ActionBarHookPatch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.buttoncontainerhook.patch.ButtonContainerHookPatch
|
||||
import app.revanced.patches.music.utils.intenthook.patch.IntentHookPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.music.video.information.patch.VideoInformationPatch
|
||||
@ -18,7 +18,7 @@ import app.revanced.util.enum.CategoryType
|
||||
@Description("Replaces the offline download button in the button container with an external download button.")
|
||||
@DependsOn(
|
||||
[
|
||||
ButtonContainerHookPatch::class,
|
||||
ActionBarHookPatch::class,
|
||||
IntentHookPatch::class,
|
||||
SettingsPatch::class,
|
||||
VideoInformationPatch::class
|
||||
@ -29,14 +29,14 @@ class DownloadButtonHookPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.BUTTON_CONTAINER,
|
||||
"revanced_hook_button_container_download",
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_hook_action_bar_download",
|
||||
"false"
|
||||
)
|
||||
SettingsPatch.addMusicPreferenceWithIntent(
|
||||
CategoryType.BUTTON_CONTAINER,
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_external_downloader_package_name",
|
||||
"revanced_hook_button_container_download"
|
||||
"revanced_hook_action_bar_download"
|
||||
)
|
||||
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package app.revanced.patches.music.buttoncontainer.label.fingerprints
|
||||
package app.revanced.patches.music.actionbar.label.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object ButtonContainerLabelFingerprint : MethodFingerprint(
|
||||
object ActionBarLabelFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L", "L"),
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.buttoncontainer.label.patch
|
||||
package app.revanced.patches.music.actionbar.label.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -10,18 +10,18 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.buttoncontainer.label.fingerprints.ButtonContainerLabelFingerprint
|
||||
import app.revanced.patches.music.actionbar.label.fingerprints.ActionBarLabelFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.fingerprints.ActionsContainerParentFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.ActionsBarParentFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_BUTTON_CONTAINER
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ACTIONBAR
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("Hide button container labels")
|
||||
@Description("Hide labels in button container.")
|
||||
@Name("Hide action bar label")
|
||||
@Description("Hide labels in action bar.")
|
||||
@DependsOn(
|
||||
[
|
||||
SettingsPatch::class,
|
||||
@ -29,12 +29,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
class ButtonContainerLabelPatch : BytecodePatch(
|
||||
listOf(ActionsContainerParentFingerprint)
|
||||
class ActionBarLabelPatch : BytecodePatch(
|
||||
listOf(ActionsBarParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ActionsContainerParentFingerprint.result?.let { parentResult ->
|
||||
ButtonContainerLabelFingerprint.also {
|
||||
ActionsBarParentFingerprint.result?.let { parentResult ->
|
||||
ActionBarLabelFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
@ -47,17 +47,17 @@ class ButtonContainerLabelPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_BUTTON_CONTAINER->hideButtonContainerLabel(Z)Z
|
||||
invoke-static {v$targetRegister}, $MUSIC_ACTIONBAR->hideActionBarLabel(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: throw ButtonContainerLabelFingerprint.exception
|
||||
} ?: throw ActionsContainerParentFingerprint.exception
|
||||
} ?: throw ActionBarLabelFingerprint.exception
|
||||
} ?: throw ActionsBarParentFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.BUTTON_CONTAINER,
|
||||
"revanced_hide_button_container_label",
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_hide_action_bar_label",
|
||||
"false"
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.buttoncontainer.radio.patch
|
||||
package app.revanced.patches.music.actionbar.radio.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -6,8 +6,8 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.actionbarhook.patch.ActionBarHookPatch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.buttoncontainerhook.patch.ButtonContainerHookPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
|
||||
@ -16,7 +16,7 @@ import app.revanced.util.enum.CategoryType
|
||||
@Description("Hides start radio button.")
|
||||
@DependsOn(
|
||||
[
|
||||
ButtonContainerHookPatch::class,
|
||||
ActionBarHookPatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@ -25,8 +25,8 @@ class HideRadioButtonPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.BUTTON_CONTAINER,
|
||||
"revanced_hide_button_container_radio",
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_hide_action_bar_radio",
|
||||
"false"
|
||||
)
|
||||
|
@ -1,11 +1,11 @@
|
||||
package app.revanced.patches.music.utils.buttoncontainerhook.fingerprints
|
||||
package app.revanced.patches.music.utils.actionbarhook.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object ButtonContainerHookFingerprint : MethodFingerprint(
|
||||
object ActionBarHookFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.utils.buttoncontainerhook.patch
|
||||
package app.revanced.patches.music.utils.actionbarhook.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
@ -7,20 +7,20 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.music.utils.buttoncontainerhook.fingerprints.ButtonContainerHookFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.ActionsContainerParentFingerprint
|
||||
import app.revanced.patches.music.utils.actionbarhook.fingerprints.ActionBarHookFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.ActionsBarParentFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.util.integrations.Constants.MUSIC_BUTTON_CONTAINER
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ACTIONBAR
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@DependsOn([SharedResourceIdPatch::class])
|
||||
class ButtonContainerHookPatch : BytecodePatch(
|
||||
listOf(ActionsContainerParentFingerprint)
|
||||
class ActionBarHookPatch : BytecodePatch(
|
||||
listOf(ActionsBarParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ActionsContainerParentFingerprint.result?.let { parentResult ->
|
||||
ButtonContainerHookFingerprint.also {
|
||||
ActionsBarParentFingerprint.result?.let { parentResult ->
|
||||
ActionBarHookFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
@ -33,11 +33,11 @@ class ButtonContainerHookPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $MUSIC_BUTTON_CONTAINER->hookButtonContainer(Landroid/view/ViewGroup;)V"
|
||||
"invoke-static {v$targetRegister}, $MUSIC_ACTIONBAR->hookActionBar(Landroid/view/ViewGroup;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw ButtonContainerHookFingerprint.exception
|
||||
} ?: throw ActionsContainerParentFingerprint.exception
|
||||
} ?: throw ActionBarHookFingerprint.exception
|
||||
} ?: throw ActionsBarParentFingerprint.exception
|
||||
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.C
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object ActionsContainerParentFingerprint : MethodFingerprint(
|
||||
object ActionsBarParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ActionsContainer) }
|
@ -3,5 +3,9 @@ package app.revanced.patches.music.utils.intenthook.fingerprints
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object FullStackTraceActivityFingerprint : MethodFingerprint(
|
||||
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/FullStackTraceActivity;") && methodDef.name == "onCreate" }
|
||||
returnType = "V",
|
||||
parameters = listOf("Landroid/os/Bundle;"),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("/FullStackTraceActivity;") && methodDef.name == "onCreate"
|
||||
}
|
||||
)
|
||||
|
@ -16,6 +16,7 @@ class IntentHookPatch : BytecodePatch(
|
||||
listOf(FullStackTraceActivityFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
FullStackTraceActivityFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
|
@ -1,8 +1,8 @@
|
||||
package app.revanced.util.enum
|
||||
|
||||
internal enum class CategoryType(val value: String, var added: Boolean) {
|
||||
ACTION_BAR("action_bar", false),
|
||||
ADS("ads", false),
|
||||
BUTTON_CONTAINER("button_container", false),
|
||||
FLYOUT("flyout", false),
|
||||
GENERAL("general", false),
|
||||
MISC("misc", false),
|
||||
|
@ -21,8 +21,8 @@ internal object Constants {
|
||||
const val MUSIC_INTEGRATIONS_PATH = "Lapp/revanced/music"
|
||||
private const val MUSIC_PATCHES_PATH = "$MUSIC_INTEGRATIONS_PATH/patches"
|
||||
|
||||
const val MUSIC_ACTIONBAR = "$MUSIC_PATCHES_PATH/actionbar/ActionBarPatch;"
|
||||
const val MUSIC_ADS_PATH = "$MUSIC_PATCHES_PATH/ads"
|
||||
const val MUSIC_BUTTON_CONTAINER = "$MUSIC_PATCHES_PATH/buttoncontainer/ButtonContainerPatch;"
|
||||
const val MUSIC_FLYOUT = "$MUSIC_PATCHES_PATH/flyout/FlyoutPatch;"
|
||||
const val MUSIC_GENERAL = "$MUSIC_PATCHES_PATH/general/GeneralPatch;"
|
||||
const val MUSIC_MISC_PATH = "$MUSIC_PATCHES_PATH/misc"
|
||||
|
Reference in New Issue
Block a user