feat(music/settings): change category name Bottom PlayerAction Bar

This commit is contained in:
inotia00 2023-09-18 18:29:32 +09:00
parent da1cfa7ad9
commit f6938a2665
12 changed files with 60 additions and 55 deletions

View File

@ -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"
)
}

View File

@ -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"),

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"),

View File

@ -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
}
}

View File

@ -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) }

View File

@ -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"
}
)

View File

@ -16,6 +16,7 @@ class IntentHookPatch : BytecodePatch(
listOf(FullStackTraceActivityFingerprint)
) {
override fun execute(context: BytecodeContext) {
FullStackTraceActivityFingerprint.result?.let {
it.mutableMethod.apply {
addInstructionsWithLabels(

View File

@ -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),

View File

@ -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"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="revanced_category_action_bar">Action Bar</string>
<string name="revanced_category_ads">Ads</string>
<string name="revanced_category_button_container">Button Container</string>
<string name="revanced_category_flyout">Flyout</string>
<string name="revanced_category_general">General</string>
<string name="revanced_category_misc">Miscellaneous</string>
@ -13,9 +13,9 @@
<string name="revanced_custom_filter_summary">Enables custom filter to hide layout components.</string>
<string name="revanced_custom_filter_title">Enable custom filter</string>
<string name="revanced_custom_playback_speeds_invalid">Invalid custom playback speeds! Reset to default values.</string>
<string name="revanced_custom_playback_speeds_warning" formatted="false">Custom speeds must be less than %sx</string>
<string name="revanced_custom_playback_speeds_summary">Add or change the playback speeds available</string>
<string name="revanced_custom_playback_speeds_title">Edit custom playback speeds</string>
<string name="revanced_custom_playback_speeds_warning" formatted="false">Custom speeds must be less than %sx</string>
<string name="revanced_disable_auto_captions_summary">Disables forced auto captions.</string>
<string name="revanced_disable_auto_captions_title">Disable forced auto captions</string>
<string name="revanced_downloader_not_installed" formatted="false">%s is not installed. Please install it.</string>
@ -55,10 +55,10 @@
<string name="revanced_external_downloader_package_name_summary">Package name of your installed external downloader app, such as NewPipe or Seal.</string>
<string name="revanced_external_downloader_package_name_title">External downloader package name</string>
<string name="revanced_flyout_panel_watch_on_youtube">Watch on YouTube</string>
<string name="revanced_hide_button_container_label_summary">Hide labels in button container.</string>
<string name="revanced_hide_button_container_label_title">Hide button container labels</string>
<string name="revanced_hide_button_container_radio_summary">Hides start radio button.</string>
<string name="revanced_hide_button_container_radio_title">Hide radio button</string>
<string name="revanced_hide_action_bar_label_summary">Hide labels in action bar.</string>
<string name="revanced_hide_action_bar_label_title">Hide action bar labels</string>
<string name="revanced_hide_action_bar_radio_summary">Hides start radio button.</string>
<string name="revanced_hide_action_bar_radio_title">Hide radio button</string>
<string name="revanced_hide_button_shelf_summary">Hides the button shelf from homepage and explorer.</string>
<string name="revanced_hide_button_shelf_title">Hide button shelf</string>
<string name="revanced_hide_carousel_shelf_summary">Hides the carousel shelf from homepage and explorer.</string>
@ -95,15 +95,15 @@
<string name="revanced_hide_playlist_card_title">Hide playlist card</string>
<string name="revanced_hide_sample_button_summary">Hides the sample button in navigation bar.</string>
<string name="revanced_hide_sample_button_title">Hide sample button</string>
<string name="revanced_hook_button_container_download_summary">Replaces the offline download button in the button container with an external download button.</string>
<string name="revanced_hook_button_container_download_title">Hook download button</string>
<string name="revanced_hook_action_bar_download_summary">Replaces the offline download button with an external download button.</string>
<string name="revanced_hook_action_bar_download_title">Hook download button</string>
<string name="revanced_reboot_first_run">Restart to load the layout normally</string>
<string name="revanced_reboot_message">Refresh and restart</string>
<string name="revanced_reset">Reset</string>
<string name="revanced_replace_flyout_panel_dismiss_queue_continue_watch_summary">When watching on YouTube, continue watching from the current time.</string>
<string name="revanced_replace_flyout_panel_dismiss_queue_continue_watch_title">Continue watching</string>
<string name="revanced_replace_flyout_panel_dismiss_queue_summary">Replaces dismiss queue menu to watch on YouTube.</string>
<string name="revanced_replace_flyout_panel_dismiss_queue_title">Replace dismiss queue</string>
<string name="revanced_reset">Reset</string>
<string name="revanced_ryd_about">About</string>
<string name="revanced_ryd_attribution_summary">Data is provided by the Return YouTube Dislike API. Tap here to learn more.</string>
<string name="revanced_ryd_compact_layout_summary">Hides the separator of the like button.</string>