mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-02 15:44:37 +02:00
refactor(music/settings): improve UI
This commit is contained in:
parent
02b54cab2c
commit
0553584d5c
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.compactdialog.fingerprints
|
||||
package app.revanced.patches.music.flyoutpanel.compactdialog.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.compactdialog.patch
|
||||
package app.revanced.patches.music.flyoutpanel.compactdialog.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -9,12 +9,12 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.layout.compactdialog.fingerprints.DialogSolidFingerprint
|
||||
import app.revanced.patches.music.flyoutpanel.compactdialog.fingerprints.DialogSolidFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
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_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||
|
||||
@Patch
|
||||
@Name("Enable compact dialog")
|
||||
@ -39,7 +39,7 @@ class CompactDialogPatch : BytecodePatch(
|
||||
) {
|
||||
addInstructions(
|
||||
2, """
|
||||
invoke-static {p0}, $MUSIC_LAYOUT->enableCompactDialog(I)I
|
||||
invoke-static {p0}, $MUSIC_FLYOUT->enableCompactDialog(I)I
|
||||
move-result p0
|
||||
"""
|
||||
)
|
||||
@ -47,7 +47,7 @@ class CompactDialogPatch : BytecodePatch(
|
||||
} ?: throw DialogSolidFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.FLYOUT,
|
||||
"revanced_enable_compact_dialog",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.sleeptimer.fingerprints
|
||||
package app.revanced.patches.music.flyoutpanel.sleeptimer.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.sleeptimer.patch
|
||||
package app.revanced.patches.music.flyoutpanel.sleeptimer.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -9,11 +9,11 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
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.layout.sleeptimer.fingerprints.SleepTimerFingerprint
|
||||
import app.revanced.patches.music.flyoutpanel.sleeptimer.fingerprints.SleepTimerFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@ -33,7 +33,7 @@ class SleepTimerPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->enableSleepTimer()Z
|
||||
invoke-static {}, $MUSIC_FLYOUT->enableSleepTimer()Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
@ -41,7 +41,7 @@ class SleepTimerPatch : BytecodePatch(
|
||||
} ?: throw SleepTimerFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.FLYOUT,
|
||||
"revanced_enable_sleep_timer",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.amoled.patch
|
||||
package app.revanced.patches.music.general.amoled.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.autocaptions.patch
|
||||
package app.revanced.patches.music.general.autocaptions.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -13,7 +13,7 @@ import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.shared.fingerprints.captions.SubtitleTrackFingerprint
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@ -33,7 +33,7 @@ class DisableAutoCaptionsPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
index, """
|
||||
invoke-static {v$register}, $MUSIC_LAYOUT->disableAutoCaptions(Z)Z
|
||||
invoke-static {v$register}, $MUSIC_GENERAL->disableAutoCaptions(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
@ -41,7 +41,7 @@ class DisableAutoCaptionsPatch : BytecodePatch(
|
||||
} ?: throw SubtitleTrackFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_disable_auto_captions",
|
||||
"false"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.branding.icon.patch
|
||||
package app.revanced.patches.music.general.branding.icon.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.branding.icon.patch
|
||||
package app.revanced.patches.music.general.branding.icon.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.branding.icon.patch
|
||||
package app.revanced.patches.music.general.branding.icon.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.buttonshelf.patch
|
||||
package app.revanced.patches.music.general.buttonshelf.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -26,7 +26,7 @@ class HideButtonShelfPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_button_shelf",
|
||||
"false"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.carouselshelf.patch
|
||||
package app.revanced.patches.music.general.carouselshelf.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -26,7 +26,7 @@ class HideCarouselShelfPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_carousel_shelf",
|
||||
"false"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.castbutton.fingerprints
|
||||
package app.revanced.patches.music.general.castbutton.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.castbutton.fingerprints
|
||||
package app.revanced.patches.music.general.castbutton.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.castbutton.patch
|
||||
package app.revanced.patches.music.general.castbutton.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -9,12 +9,12 @@ 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.layout.castbutton.fingerprints.HideCastButtonFingerprint
|
||||
import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonParentFingerprint
|
||||
import app.revanced.patches.music.general.castbutton.fingerprints.HideCastButtonFingerprint
|
||||
import app.revanced.patches.music.general.castbutton.fingerprints.HideCastButtonParentFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
|
||||
@Patch
|
||||
@Name("Hide cast button")
|
||||
@ -34,14 +34,14 @@ class HideCastButtonPatch : BytecodePatch(
|
||||
)
|
||||
}.result?.mutableMethod?.addInstructions(
|
||||
0, """
|
||||
invoke-static {p1}, $MUSIC_LAYOUT->hideCastButton(I)I
|
||||
invoke-static {p1}, $MUSIC_GENERAL->hideCastButton(I)I
|
||||
move-result p1
|
||||
"""
|
||||
) ?: throw HideCastButtonFingerprint.exception
|
||||
} ?: throw HideCastButtonParentFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_cast_button",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.categorybar.fingerprints
|
||||
package app.revanced.patches.music.general.categorybar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.ChipCloud
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.categorybar.patch
|
||||
package app.revanced.patches.music.general.categorybar.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -9,12 +9,12 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
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.layout.categorybar.fingerprints.ChipCloudFingerprint
|
||||
import app.revanced.patches.music.general.categorybar.fingerprints.ChipCloudFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
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_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@ -38,13 +38,13 @@ class CategoryBarPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static { v$targetRegister }, $MUSIC_LAYOUT->hideCategoryBar(Landroid/view/View;)V"
|
||||
"invoke-static { v$targetRegister }, $MUSIC_GENERAL->hideCategoryBar(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw ChipCloudFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_category_bar",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.carouselshelf.patch
|
||||
package app.revanced.patches.music.general.channelguidelines.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -26,7 +26,7 @@ class HideChannelGuidelinesPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_channel_guidelines",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.customfilter.patch
|
||||
package app.revanced.patches.music.general.customfilter.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -26,12 +26,12 @@ class CustomFilterPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_custom_filter",
|
||||
"false"
|
||||
)
|
||||
SettingsPatch.addMusicPreferenceWithIntent(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_custom_filter_strings",
|
||||
"revanced_custom_filter"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.floatingbutton.fingerprints
|
||||
package app.revanced.patches.music.general.floatingbutton.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.floatingbutton.fingerprints
|
||||
package app.revanced.patches.music.general.floatingbutton.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.floatingbutton.patch
|
||||
package app.revanced.patches.music.general.floatingbutton.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -11,13 +11,13 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.layout.floatingbutton.fingerprints.FloatingButtonFingerprint
|
||||
import app.revanced.patches.music.layout.floatingbutton.fingerprints.FloatingButtonParentFingerprint
|
||||
import app.revanced.patches.music.general.floatingbutton.fingerprints.FloatingButtonFingerprint
|
||||
import app.revanced.patches.music.general.floatingbutton.fingerprints.FloatingButtonParentFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
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_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
|
||||
@Patch
|
||||
@Name("Hide new playlist button")
|
||||
@ -44,7 +44,7 @@ class NewPlaylistButtonPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
1, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->hideNewPlaylistButton()Z
|
||||
invoke-static {}, $MUSIC_GENERAL->hideNewPlaylistButton()Z
|
||||
move-result v0
|
||||
if-eqz v0, :show
|
||||
return-void
|
||||
@ -55,7 +55,7 @@ class NewPlaylistButtonPatch : BytecodePatch(
|
||||
} ?: throw FloatingButtonParentFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_new_playlist_button",
|
||||
"false"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.landscapemode.fingerprints
|
||||
package app.revanced.patches.music.general.landscapemode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.landscapemode.patch
|
||||
package app.revanced.patches.music.general.landscapemode.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -8,12 +8,12 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
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.layout.landscapemode.fingerprints.TabletIdentifierFingerprint
|
||||
import app.revanced.patches.music.general.landscapemode.fingerprints.TabletIdentifierFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
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_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
|
||||
@Patch
|
||||
@Name("Enable landscape mode")
|
||||
@ -32,14 +32,14 @@ class LandScapeModePatch : BytecodePatch(
|
||||
TabletIdentifierFingerprint.result?.let {
|
||||
it.mutableMethod.addInstructions(
|
||||
it.scanResult.patternScanResult!!.endIndex + 1, """
|
||||
invoke-static {p0}, $MUSIC_LAYOUT->enableLandScapeMode(Z)Z
|
||||
invoke-static {p0}, $MUSIC_GENERAL->enableLandScapeMode(Z)Z
|
||||
move-result p0
|
||||
"""
|
||||
)
|
||||
} ?: throw TabletIdentifierFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_enable_landscape_mode",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.playlistcard.patch
|
||||
package app.revanced.patches.music.general.playlistcard.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -26,7 +26,7 @@ class HidePlaylistCardPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_playlist_card",
|
||||
"false"
|
||||
)
|
@ -1,21 +0,0 @@
|
||||
package app.revanced.patches.music.layout.navigationlabel.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.Text1
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object TabLayoutTextFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.CONST,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(Text1) }
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.blacknavbar.fingerprints
|
||||
package app.revanced.patches.music.navigation.black.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.blacknavigationbar.patch
|
||||
package app.revanced.patches.music.navigation.black.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -9,12 +9,12 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
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.layout.blacknavbar.fingerprints.TabLayoutFingerprint
|
||||
import app.revanced.patches.music.navigation.black.fingerprints.TabLayoutFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
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_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_NAVIGATION
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@ -39,7 +39,7 @@ class BlackNavigationBarPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->enableBlackNavigationBar()I
|
||||
invoke-static {}, $MUSIC_NAVIGATION->enableBlackNavigationBar()I
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
@ -47,7 +47,7 @@ class BlackNavigationBarPatch : BytecodePatch(
|
||||
} ?: throw TabLayoutFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.NAVIGATION,
|
||||
"revanced_enable_black_navigation_bar",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.navigationlabel.patch
|
||||
package app.revanced.patches.music.navigation.label.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -10,15 +10,15 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.navigationlabel.fingerprints.TabLayoutTextFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.fingerprints.TabLayoutTextFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.Text1
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch.Companion.contexts
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_NAVIGATION
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
|
||||
@ -47,7 +47,7 @@ class NavigationLabelPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $MUSIC_LAYOUT->hideNavigationLabel(Landroid/widget/TextView;)V"
|
||||
"invoke-static {v$targetRegister}, $MUSIC_NAVIGATION->hideNavigationLabel(Landroid/widget/TextView;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw TabLayoutTextFingerprint.exception
|
||||
@ -65,7 +65,7 @@ class NavigationLabelPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.NAVIGATION,
|
||||
"revanced_hide_navigation_label",
|
||||
"false"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.colormatchplayer.fingerprints
|
||||
package app.revanced.patches.music.player.colormatchplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.colormatchplayer.patch
|
||||
package app.revanced.patches.music.player.colormatchplayer.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -13,12 +13,12 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.layout.colormatchplayer.fingerprints.ColorMatchPlayerFingerprint
|
||||
import app.revanced.patches.music.player.colormatchplayer.fingerprints.ColorMatchPlayerFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.fingerprints.ColorMatchPlayerParentFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
|
||||
@ -49,7 +49,7 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->enableColorMatchPlayer()Z
|
||||
invoke-static {}, $MUSIC_PLAYER->enableColorMatchPlayer()Z
|
||||
move-result v2
|
||||
if-eqz v2, :off
|
||||
iget v0, p0, ${descriptor(4)}
|
||||
@ -74,7 +74,7 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
||||
} ?: throw ColorMatchPlayerParentFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_color_match_player",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.minimizedplayer.fingerprints
|
||||
package app.revanced.patches.music.player.minimizedplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.minimizedplayer.patch
|
||||
package app.revanced.patches.music.player.minimizedplayer.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -8,11 +8,11 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
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.layout.minimizedplayer.fingerprints.MinimizedPlayerFingerprint
|
||||
import app.revanced.patches.music.player.minimizedplayer.fingerprints.MinimizedPlayerFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@ -33,7 +33,7 @@ class MinimizedPlayerPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
index, """
|
||||
invoke-static {v$register}, $MUSIC_LAYOUT->enableForceMinimizedPlayer(Z)Z
|
||||
invoke-static {v$register}, $MUSIC_PLAYER->enableForceMinimizedPlayer(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
@ -41,7 +41,7 @@ class MinimizedPlayerPatch : BytecodePatch(
|
||||
} ?: throw MinimizedPlayerFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_force_minimized_player",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.newlayout.fingerprints
|
||||
package app.revanced.patches.music.player.newlayout.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.newlayout.patch
|
||||
package app.revanced.patches.music.player.newlayout.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -9,11 +9,11 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
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.layout.newlayout.fingerprints.NewLayoutFingerprint
|
||||
import app.revanced.patches.music.player.newlayout.fingerprints.NewLayoutFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@ -33,7 +33,7 @@ class NewLayoutPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->enableNewLayout()Z
|
||||
invoke-static {}, $MUSIC_PLAYER->enableNewLayout()Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
@ -41,7 +41,7 @@ class NewLayoutPatch : BytecodePatch(
|
||||
} ?: throw NewLayoutFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_new_layout",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.oldstyleminiplayer.fingerprints
|
||||
package app.revanced.patches.music.player.oldstyleminiplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.oldstyleminiplayer.fingerprints
|
||||
package app.revanced.patches.music.player.oldstyleminiplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.oldstyleminiplayer.patch
|
||||
package app.revanced.patches.music.player.oldstyleminiplayer.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.layout.oldstyleminiplayer.fingerprints.NextButtonVisibilityFingerprint
|
||||
import app.revanced.patches.music.layout.oldstyleminiplayer.fingerprints.SwipeToCloseFingerprint
|
||||
import app.revanced.patches.music.player.oldstyleminiplayer.fingerprints.NextButtonVisibilityFingerprint
|
||||
import app.revanced.patches.music.player.oldstyleminiplayer.fingerprints.SwipeToCloseFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.fingerprints.ColorMatchPlayerParentFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("Enable old style miniplayer")
|
||||
@Description("Return the miniplayers to old style. (for YT Music v5.55.53+)")
|
||||
@Description("Return the miniplayers to old style.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
@ -46,7 +46,7 @@ class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_LAYOUT->enableOldStyleMiniPlayer(Z)Z
|
||||
invoke-static {v$targetRegister}, $MUSIC_PLAYER->enableOldStyleMiniPlayer(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
@ -61,7 +61,7 @@ class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_LAYOUT->enableOldStyleMiniPlayer(Z)Z
|
||||
invoke-static {v$targetRegister}, $MUSIC_PLAYER->enableOldStyleMiniPlayer(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
@ -69,9 +69,9 @@ class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
} ?: throw SwipeToCloseFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_old_style_mini_player",
|
||||
"false"
|
||||
"true"
|
||||
)
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.misc.shuffle.fingerprints
|
||||
package app.revanced.patches.music.player.shuffle.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.misc.shuffle.fingerprints
|
||||
package app.revanced.patches.music.player.shuffle.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.misc.shuffle.fingerprints
|
||||
package app.revanced.patches.music.player.shuffle.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.misc.shuffle.patch
|
||||
package app.revanced.patches.music.player.shuffle.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.extensions.transformFields
|
||||
@ -16,9 +16,9 @@ import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patcher.util.smali.toInstructions
|
||||
import app.revanced.patches.music.misc.shuffle.fingerprints.MusicPlaybackControlsFingerprint
|
||||
import app.revanced.patches.music.misc.shuffle.fingerprints.ShuffleClassFingerprint
|
||||
import app.revanced.patches.music.misc.shuffle.fingerprints.ShuffleClassReferenceFingerprint
|
||||
import app.revanced.patches.music.player.shuffle.fingerprints.MusicPlaybackControlsFingerprint
|
||||
import app.revanced.patches.music.player.shuffle.fingerprints.ShuffleClassFingerprint
|
||||
import app.revanced.patches.music.player.shuffle.fingerprints.ShuffleClassReferenceFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
@ -162,7 +162,7 @@ class EnforceShufflePatch : BytecodePatch(
|
||||
} ?: throw MusicPlaybackControlsFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.MISC,
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_force_shuffle",
|
||||
"true"
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.zenmode.fingerprints
|
||||
package app.revanced.patches.music.player.zenmode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.zenmode.patch
|
||||
package app.revanced.patches.music.player.zenmode.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -11,12 +11,12 @@ 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.layout.zenmode.fingerprints.ZenModeFingerprint
|
||||
import app.revanced.patches.music.player.zenmode.fingerprints.ZenModeFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.fingerprints.ColorMatchPlayerParentFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
|
||||
@ -48,7 +48,7 @@ class ZenModePatch : BytecodePatch(
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->enableZenMode()Z
|
||||
invoke-static {}, $MUSIC_PLAYER->enableZenMode()Z
|
||||
move-result v$dummyRegister
|
||||
if-eqz v$dummyRegister, :off
|
||||
const v$dummyRegister, -0xfcfcfd
|
||||
@ -65,7 +65,7 @@ class ZenModePatch : BytecodePatch(
|
||||
} ?: throw ColorMatchPlayerParentFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_zen_mode",
|
||||
"false"
|
||||
)
|
@ -54,4 +54,4 @@ class LithoFilterPatch : BytecodePatch(
|
||||
|
||||
private var filterCount = 0
|
||||
}
|
||||
}
|
||||
}
|
@ -12,14 +12,17 @@ import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.resources.IconHelper
|
||||
import app.revanced.util.resources.IconHelper.copyFiles
|
||||
import app.revanced.util.resources.IconHelper.makeDirectoryAndCopyFiles
|
||||
import app.revanced.util.resources.MusicResourceHelper.YOUTUBE_MUSIC_SETTINGS_KEY
|
||||
import app.revanced.util.resources.MusicResourceHelper.addMusicPreference
|
||||
import app.revanced.util.resources.MusicResourceHelper.addMusicPreferenceCategory
|
||||
import app.revanced.util.resources.MusicResourceHelper.addMusicPreferenceWithIntent
|
||||
import app.revanced.util.resources.MusicResourceHelper.addMusicPreferenceWithoutSummary
|
||||
import app.revanced.util.resources.MusicResourceHelper.addReVancedMusicPreference
|
||||
import app.revanced.util.resources.MusicResourceHelper.sortMusicPreferenceCategory
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import org.w3c.dom.Element
|
||||
import java.io.Closeable
|
||||
import java.io.File
|
||||
import java.nio.file.Paths
|
||||
|
||||
@ -32,9 +35,8 @@ class SettingsPatch : AbstractSettingsResourcePatch(
|
||||
"music/settings",
|
||||
"music/settings/host",
|
||||
false
|
||||
) {
|
||||
), Closeable {
|
||||
override fun execute(context: ResourceContext) {
|
||||
super.execute(context)
|
||||
contexts = context
|
||||
|
||||
/**
|
||||
@ -68,7 +70,7 @@ class SettingsPatch : AbstractSettingsResourcePatch(
|
||||
}
|
||||
}
|
||||
|
||||
context.addReVancedMusicPreference()
|
||||
context.addReVancedMusicPreference(YOUTUBE_MUSIC_SETTINGS_KEY)
|
||||
|
||||
/**
|
||||
* If a custom branding icon path exists, merge it
|
||||
@ -100,6 +102,8 @@ class SettingsPatch : AbstractSettingsResourcePatch(
|
||||
.let(::copyResources)
|
||||
}
|
||||
|
||||
super.execute(context)
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
@ -113,19 +117,32 @@ class SettingsPatch : AbstractSettingsResourcePatch(
|
||||
val categoryValue = category.value
|
||||
contexts.addMusicPreferenceCategory(categoryValue)
|
||||
contexts.addMusicPreference(categoryValue, key, defaultValue)
|
||||
contexts.sortMusicPreferenceCategory(categoryValue)
|
||||
}
|
||||
|
||||
internal fun addMusicPreferenceWithoutSummary(
|
||||
category: CategoryType,
|
||||
key: String,
|
||||
defaultValue: String
|
||||
) {
|
||||
val categoryValue = category.value
|
||||
contexts.addMusicPreferenceCategory(categoryValue)
|
||||
contexts.addMusicPreferenceWithoutSummary(categoryValue, key, defaultValue)
|
||||
}
|
||||
|
||||
internal fun addMusicPreferenceWithIntent(
|
||||
category: CategoryType,
|
||||
key: String,
|
||||
dependencyKey: String
|
||||
|
||||
) {
|
||||
val categoryValue = category.value
|
||||
contexts.addMusicPreferenceCategory(categoryValue)
|
||||
contexts.addMusicPreferenceWithIntent(categoryValue, key, dependencyKey)
|
||||
contexts.sortMusicPreferenceCategory(categoryValue)
|
||||
}
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
CategoryType.entries.sorted().forEach {
|
||||
contexts.sortMusicPreferenceCategory(it.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,11 @@
|
||||
package app.revanced.util.enum
|
||||
|
||||
internal enum class CategoryType(val value: String) {
|
||||
ADS("ads"),
|
||||
LAYOUT("layout"),
|
||||
MISC("misc")
|
||||
internal enum class CategoryType(val value: String, var added: Boolean) {
|
||||
ADS("ads", false),
|
||||
BUTTON_CONTAINER("button_container", false),
|
||||
FLYOUT("flyout", false),
|
||||
GENERAL("general", false),
|
||||
MISC("misc", false),
|
||||
NAVIGATION("navigation", false),
|
||||
PLAYER("player", false)
|
||||
}
|
@ -6,7 +6,6 @@ internal object Constants {
|
||||
|
||||
const val ADS_PATH = "$PATCHES_PATH/ads"
|
||||
const val SWIPE_PATH = "$PATCHES_PATH/swipe"
|
||||
const val BOTTOM_PLAYER = "$PATCHES_PATH/layout/BottomPlayerPatch;"
|
||||
const val FLYOUT_PANEL = "$PATCHES_PATH/layout/FlyoutPanelPatch;"
|
||||
const val FULLSCREEN = "$PATCHES_PATH/layout/FullscreenPatch;"
|
||||
const val GENERAL = "$PATCHES_PATH/layout/GeneralPatch;"
|
||||
@ -23,7 +22,11 @@ internal object Constants {
|
||||
private const val MUSIC_PATCHES_PATH = "$MUSIC_INTEGRATIONS_PATH/patches"
|
||||
|
||||
const val MUSIC_ADS_PATH = "$MUSIC_PATCHES_PATH/ads"
|
||||
const val MUSIC_LAYOUT = "$MUSIC_PATCHES_PATH/layout/LayoutPatch;"
|
||||
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"
|
||||
const val MUSIC_NAVIGATION = "$MUSIC_PATCHES_PATH/navigation/NavigationPatch;"
|
||||
const val MUSIC_PLAYER = "$MUSIC_PATCHES_PATH/player/PlayerPatch;"
|
||||
const val MUSIC_UTILS_PATH = "$MUSIC_PATCHES_PATH/utils"
|
||||
}
|
@ -2,6 +2,7 @@ package app.revanced.util.resources
|
||||
|
||||
import app.revanced.extensions.doRecursively
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import org.w3c.dom.Element
|
||||
import org.w3c.dom.Node
|
||||
|
||||
@ -26,12 +27,12 @@ private fun Node.insertNode(tagName: String, targetNode: Node, block: Element.()
|
||||
|
||||
internal object MusicResourceHelper {
|
||||
|
||||
private const val YOUTUBE_MUSIC_SETTINGS_PATH = "res/xml/settings_headers.xml"
|
||||
internal const val YOUTUBE_MUSIC_SETTINGS_PATH = "res/xml/settings_headers.xml"
|
||||
|
||||
private const val YOUTUBE_MUSIC_SETTINGS_KEY = "revanced_extended_settings"
|
||||
internal const val YOUTUBE_MUSIC_SETTINGS_KEY = "revanced_extended_settings"
|
||||
|
||||
private const val YOUTUBE_MUSIC_CATEGORY_TAG_NAME =
|
||||
"com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat"
|
||||
private const val YOUTUBE_MUSIC_PREFERENCE_SCREEN_TAG_NAME =
|
||||
"PreferenceScreen"
|
||||
|
||||
private const val YOUTUBE_MUSIC_PREFERENCE_TAG_NAME =
|
||||
"com.google.android.apps.youtube.music.ui.preference.SwitchCompatPreference"
|
||||
@ -39,8 +40,6 @@ internal object MusicResourceHelper {
|
||||
private const val YOUTUBE_MUSIC_PREFERENCE_TARGET_CLASS =
|
||||
"com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity"
|
||||
|
||||
private var currentMusicPreferenceCategory = emptyArray<String>()
|
||||
|
||||
private var targetPackage = "com.google.android.apps.youtube.music"
|
||||
|
||||
internal fun ResourceContext.setMicroG(newPackage: String) {
|
||||
@ -49,7 +48,18 @@ internal object MusicResourceHelper {
|
||||
}
|
||||
|
||||
private fun setMusicPreferenceCategory(newCategory: String) {
|
||||
currentMusicPreferenceCategory += listOf(newCategory)
|
||||
CategoryType.entries.forEach { preference ->
|
||||
if (newCategory == preference.value)
|
||||
preference.added = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun included(category: String): Boolean {
|
||||
CategoryType.entries.forEach { preference ->
|
||||
if (category == preference.value)
|
||||
return preference.added
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
internal fun ResourceContext.addMusicPreferenceCategory(
|
||||
@ -60,8 +70,8 @@ internal object MusicResourceHelper {
|
||||
List(tags.length) { tags.item(it) as Element }
|
||||
.filter { it.getAttribute("android:key").contains(YOUTUBE_MUSIC_SETTINGS_KEY) }
|
||||
.forEach {
|
||||
if (!currentMusicPreferenceCategory.contains(category)) {
|
||||
it.adoptChild(YOUTUBE_MUSIC_CATEGORY_TAG_NAME) {
|
||||
if (!included(category)) {
|
||||
it.adoptChild(YOUTUBE_MUSIC_PREFERENCE_SCREEN_TAG_NAME) {
|
||||
setAttribute("android:title", "@string/revanced_category_$category")
|
||||
setAttribute("android:key", "revanced_settings_$category")
|
||||
}
|
||||
@ -101,7 +111,7 @@ internal object MusicResourceHelper {
|
||||
defaultValue: String
|
||||
) {
|
||||
this.xmlEditor[YOUTUBE_MUSIC_SETTINGS_PATH].use { editor ->
|
||||
val tags = editor.file.getElementsByTagName(YOUTUBE_MUSIC_CATEGORY_TAG_NAME)
|
||||
val tags = editor.file.getElementsByTagName(YOUTUBE_MUSIC_PREFERENCE_SCREEN_TAG_NAME)
|
||||
List(tags.length) { tags.item(it) as Element }
|
||||
.filter { it.getAttribute("android:key").contains("revanced_settings_$category") }
|
||||
.forEach {
|
||||
@ -121,7 +131,7 @@ internal object MusicResourceHelper {
|
||||
dependencyKey: String
|
||||
) {
|
||||
this.xmlEditor[YOUTUBE_MUSIC_SETTINGS_PATH].use { editor ->
|
||||
val tags = editor.file.getElementsByTagName(YOUTUBE_MUSIC_CATEGORY_TAG_NAME)
|
||||
val tags = editor.file.getElementsByTagName(YOUTUBE_MUSIC_PREFERENCE_SCREEN_TAG_NAME)
|
||||
List(tags.length) { tags.item(it) as Element }
|
||||
.filter { it.getAttribute("android:key").contains("revanced_settings_$category") }
|
||||
.forEach {
|
||||
@ -143,7 +153,28 @@ internal object MusicResourceHelper {
|
||||
}
|
||||
}
|
||||
|
||||
internal fun ResourceContext.addReVancedMusicPreference() {
|
||||
internal fun ResourceContext.addMusicPreferenceWithoutSummary(
|
||||
category: String,
|
||||
key: String,
|
||||
defaultValue: String
|
||||
) {
|
||||
this.xmlEditor[YOUTUBE_MUSIC_SETTINGS_PATH].use { editor ->
|
||||
val tags = editor.file.getElementsByTagName(YOUTUBE_MUSIC_PREFERENCE_SCREEN_TAG_NAME)
|
||||
List(tags.length) { tags.item(it) as Element }
|
||||
.filter { it.getAttribute("android:key").contains("revanced_settings_$category") }
|
||||
.forEach {
|
||||
it.adoptChild(YOUTUBE_MUSIC_PREFERENCE_TAG_NAME) {
|
||||
setAttribute("android:title", "@string/$key" + "_title")
|
||||
setAttribute("android:key", key)
|
||||
setAttribute("android:defaultValue", defaultValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun ResourceContext.addReVancedMusicPreference(
|
||||
key: String
|
||||
) {
|
||||
this.xmlEditor[YOUTUBE_MUSIC_SETTINGS_PATH].use { editor ->
|
||||
with(editor.file) {
|
||||
doRecursively loop@{
|
||||
@ -156,9 +187,11 @@ internal object MusicResourceHelper {
|
||||
it.insertNode("PreferenceScreen", it) {
|
||||
setAttribute(
|
||||
"android:title",
|
||||
"@string/" + YOUTUBE_MUSIC_SETTINGS_KEY + "_title"
|
||||
"@string/" + key + "_title"
|
||||
)
|
||||
setAttribute("android:key", YOUTUBE_MUSIC_SETTINGS_KEY)
|
||||
setAttribute("android:key", key)
|
||||
setAttribute("app:allowDividerAbove", "false")
|
||||
setAttribute("app:allowDividerAbove", "false")
|
||||
}
|
||||
it.getAttributeNode("app:allowDividerBelow").textContent = "true"
|
||||
return@loop
|
||||
|
@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="revanced_category_ads">Ads</string>
|
||||
<string name="revanced_category_layout">Layout</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>
|
||||
<string name="revanced_category_navigation">Navigation</string>
|
||||
<string name="revanced_category_player">Player</string>
|
||||
<string name="revanced_custom_filter_strings_summary">Filter components by their name separated by a comma</string>
|
||||
<string name="revanced_custom_filter_strings_title">Edit custom filter</string>
|
||||
<string name="revanced_custom_filter_summary">Enables custom filters</string>
|
||||
@ -47,7 +51,7 @@
|
||||
<string name="revanced_hide_cast_button_title">Hide cast button</string>
|
||||
<string name="revanced_hide_category_bar_summary">Hides the music category bar at the top of the homepage.</string>
|
||||
<string name="revanced_hide_category_bar_title">Hide category bar</string>
|
||||
<string name="revanced_hide_channel_guidelines_summary">Hides channel guidelines at the top of comments</string>
|
||||
<string name="revanced_hide_channel_guidelines_summary">Hides channel guidelines at the top of comments.</string>
|
||||
<string name="revanced_hide_channel_guidelines_title">Hide channel guidelines</string>
|
||||
<string name="revanced_hide_music_ads_summary">Hides ads before playing a music.</string>
|
||||
<string name="revanced_hide_music_ads_title">Hide music ads</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user