diff --git a/src/main/kotlin/app/revanced/patches/music/buttoncontainer/downloadbuttonhook/patch/DownloadButtonHookPatch.kt b/src/main/kotlin/app/revanced/patches/music/actionbar/downloadbuttonhook/patch/DownloadButtonHookPatch.kt similarity index 75% rename from src/main/kotlin/app/revanced/patches/music/buttoncontainer/downloadbuttonhook/patch/DownloadButtonHookPatch.kt rename to src/main/kotlin/app/revanced/patches/music/actionbar/downloadbuttonhook/patch/DownloadButtonHookPatch.kt index 14abb4242..95b98e1e9 100644 --- a/src/main/kotlin/app/revanced/patches/music/buttoncontainer/downloadbuttonhook/patch/DownloadButtonHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/actionbar/downloadbuttonhook/patch/DownloadButtonHookPatch.kt @@ -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" ) } diff --git a/src/main/kotlin/app/revanced/patches/music/buttoncontainer/label/fingerprints/ButtonContainerLabelFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/actionbar/label/fingerprints/ActionBarLabelFingerprint.kt similarity index 80% rename from src/main/kotlin/app/revanced/patches/music/buttoncontainer/label/fingerprints/ButtonContainerLabelFingerprint.kt rename to src/main/kotlin/app/revanced/patches/music/actionbar/label/fingerprints/ActionBarLabelFingerprint.kt index 71d23d152..c2a08a2f3 100644 --- a/src/main/kotlin/app/revanced/patches/music/buttoncontainer/label/fingerprints/ButtonContainerLabelFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/actionbar/label/fingerprints/ActionBarLabelFingerprint.kt @@ -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"), diff --git a/src/main/kotlin/app/revanced/patches/music/buttoncontainer/label/patch/ButtonContainerLabelPatch.kt b/src/main/kotlin/app/revanced/patches/music/actionbar/label/patch/ActionBarLabelPatch.kt similarity index 67% rename from src/main/kotlin/app/revanced/patches/music/buttoncontainer/label/patch/ButtonContainerLabelPatch.kt rename to src/main/kotlin/app/revanced/patches/music/actionbar/label/patch/ActionBarLabelPatch.kt index 98bac51a0..e4c6aaaa4 100644 --- a/src/main/kotlin/app/revanced/patches/music/buttoncontainer/label/patch/ButtonContainerLabelPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/actionbar/label/patch/ActionBarLabelPatch.kt @@ -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" ) diff --git a/src/main/kotlin/app/revanced/patches/music/buttoncontainer/radio/patch/HideRadioButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/actionbar/radio/patch/HideRadioButtonPatch.kt similarity index 74% rename from src/main/kotlin/app/revanced/patches/music/buttoncontainer/radio/patch/HideRadioButtonPatch.kt rename to src/main/kotlin/app/revanced/patches/music/actionbar/radio/patch/HideRadioButtonPatch.kt index 47c203184..e8c4b4435 100644 --- a/src/main/kotlin/app/revanced/patches/music/buttoncontainer/radio/patch/HideRadioButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/actionbar/radio/patch/HideRadioButtonPatch.kt @@ -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" ) diff --git a/src/main/kotlin/app/revanced/patches/music/utils/buttoncontainerhook/fingerprints/ButtonContainerHookFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/utils/actionbarhook/fingerprints/ActionBarHookFingerprint.kt similarity index 81% rename from src/main/kotlin/app/revanced/patches/music/utils/buttoncontainerhook/fingerprints/ButtonContainerHookFingerprint.kt rename to src/main/kotlin/app/revanced/patches/music/utils/actionbarhook/fingerprints/ActionBarHookFingerprint.kt index a967aa0b5..fc3bbf507 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/buttoncontainerhook/fingerprints/ButtonContainerHookFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/actionbarhook/fingerprints/ActionBarHookFingerprint.kt @@ -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"), diff --git a/src/main/kotlin/app/revanced/patches/music/utils/buttoncontainerhook/patch/ButtonContainerHookPatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/actionbarhook/patch/ActionBarHookPatch.kt similarity index 63% rename from src/main/kotlin/app/revanced/patches/music/utils/buttoncontainerhook/patch/ButtonContainerHookPatch.kt rename to src/main/kotlin/app/revanced/patches/music/utils/actionbarhook/patch/ActionBarHookPatch.kt index 2a15b4b43..a368e0f7b 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/buttoncontainerhook/patch/ButtonContainerHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/actionbarhook/patch/ActionBarHookPatch.kt @@ -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 } } \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/utils/fingerprints/ActionsContainerParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/utils/fingerprints/ActionsBarParentFingerprint.kt similarity index 90% rename from src/main/kotlin/app/revanced/patches/music/utils/fingerprints/ActionsContainerParentFingerprint.kt rename to src/main/kotlin/app/revanced/patches/music/utils/fingerprints/ActionsBarParentFingerprint.kt index 0f0d9230e..663d41279 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/fingerprints/ActionsContainerParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/fingerprints/ActionsBarParentFingerprint.kt @@ -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) } diff --git a/src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/FullStackTraceActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/FullStackTraceActivityFingerprint.kt index 7b4f369bf..b5bea66f9 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/FullStackTraceActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/FullStackTraceActivityFingerprint.kt @@ -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" + } ) diff --git a/src/main/kotlin/app/revanced/patches/music/utils/intenthook/patch/IntentHookPatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/intenthook/patch/IntentHookPatch.kt index a3bfc27da..3acc76cfd 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/intenthook/patch/IntentHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/intenthook/patch/IntentHookPatch.kt @@ -16,6 +16,7 @@ class IntentHookPatch : BytecodePatch( listOf(FullStackTraceActivityFingerprint) ) { override fun execute(context: BytecodeContext) { + FullStackTraceActivityFingerprint.result?.let { it.mutableMethod.apply { addInstructionsWithLabels( diff --git a/src/main/kotlin/app/revanced/util/enum/CategoryType.kt b/src/main/kotlin/app/revanced/util/enum/CategoryType.kt index 467dfc7e7..704fec86e 100644 --- a/src/main/kotlin/app/revanced/util/enum/CategoryType.kt +++ b/src/main/kotlin/app/revanced/util/enum/CategoryType.kt @@ -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), diff --git a/src/main/kotlin/app/revanced/util/integrations/Constants.kt b/src/main/kotlin/app/revanced/util/integrations/Constants.kt index daa3bc0da..efe572d8a 100644 --- a/src/main/kotlin/app/revanced/util/integrations/Constants.kt +++ b/src/main/kotlin/app/revanced/util/integrations/Constants.kt @@ -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" diff --git a/src/main/resources/music/settings/host/values/strings.xml b/src/main/resources/music/settings/host/values/strings.xml index c1a358e61..5b7ca9948 100644 --- a/src/main/resources/music/settings/host/values/strings.xml +++ b/src/main/resources/music/settings/host/values/strings.xml @@ -1,7 +1,7 @@ + Action Bar Ads - Button Container Flyout General Miscellaneous @@ -13,9 +13,9 @@ Enables custom filter to hide layout components. Enable custom filter Invalid custom playback speeds! Reset to default values. - Custom speeds must be less than %sx Add or change the playback speeds available Edit custom playback speeds + Custom speeds must be less than %sx Disables forced auto captions. Disable forced auto captions %s is not installed. Please install it. @@ -55,10 +55,10 @@ Package name of your installed external downloader app, such as NewPipe or Seal. External downloader package name Watch on YouTube - Hide labels in button container. - Hide button container labels - Hides start radio button. - Hide radio button + Hide labels in action bar. + Hide action bar labels + Hides start radio button. + Hide radio button Hides the button shelf from homepage and explorer. Hide button shelf Hides the carousel shelf from homepage and explorer. @@ -95,15 +95,15 @@ Hide playlist card Hides the sample button in navigation bar. Hide sample button - Replaces the offline download button in the button container with an external download button. - Hook download button + Replaces the offline download button with an external download button. + Hook download button Restart to load the layout normally Refresh and restart - Reset When watching on YouTube, continue watching from the current time. Continue watching Replaces dismiss queue menu to watch on YouTube. Replace dismiss queue + Reset About Data is provided by the Return YouTube Dislike API. Tap here to learn more. Hides the separator of the like button.