feat(YouTube Music): Add Forcibly enable miniplayer patch
Co-Authored-By: ILoveOpenSourceApplications <117499019+iloveopensourceapplications@users.noreply.github.com>
This commit is contained in:
parent
7f52ec2cea
commit
e7196e54b0
6 changed files with 97 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
@file:Suppress("SpellCheckingInspection")
|
||||
|
||||
package app.revanced.patches.music.layout.miniplayercolor
|
||||
package app.revanced.patches.music.layout.miniplayer
|
||||
|
||||
import app.revanced.patcher.accessFlags
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package app.revanced.patches.music.layout.miniplayercolor
|
||||
package app.revanced.patches.music.layout.miniplayer
|
||||
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
|
|
@ -28,3 +28,10 @@ internal val ClassDef.switchToggleColorMethodMatch by ClassDefComposing.composin
|
|||
Opcode.IGET,
|
||||
)
|
||||
}
|
||||
|
||||
internal val BytecodePatchContext.minimizedPlayerMethod by gettingFirstMethodDeclaratively {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returnType("V")
|
||||
parameterTypes("L", "L")
|
||||
instructions("w_st"())
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
@file:Suppress("SpellCheckingInspection")
|
||||
|
||||
package app.revanced.patches.music.layout.miniplayer
|
||||
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.extensions.methodReference
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.all.misc.resources.addResources
|
||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.music.misc.settings.PreferenceScreen
|
||||
import app.revanced.patches.music.misc.settings.settingsPatch
|
||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/extension/music/patches/ForciblyEnableMiniplayerPatch;"
|
||||
|
||||
@Suppress("unused")
|
||||
val forciblyEnableMiniplayerPatch = bytecodePatch(
|
||||
name = "Forcibly enable miniplayer",
|
||||
description = "Adds an option to forcibly enable the miniplayer when switching between music videos, podcasts, or songs."
|
||||
) {
|
||||
dependsOn(
|
||||
sharedExtensionPatch,
|
||||
settingsPatch,
|
||||
addResourcesPatch,
|
||||
)
|
||||
|
||||
compatibleWith(
|
||||
"com.google.android.apps.youtube.music"(
|
||||
"7.29.52",
|
||||
"8.10.52",
|
||||
"8.37.56",
|
||||
"8.40.54",
|
||||
"8.44.54"
|
||||
),
|
||||
)
|
||||
|
||||
apply {
|
||||
addResources("music", "layout.miniplayer.forciblyEnableMiniplayer")
|
||||
|
||||
PreferenceScreen.PLAYER.addPreferences(
|
||||
SwitchPreference("revanced_music_forcibly_enable_miniplayer")
|
||||
)
|
||||
|
||||
minimizedPlayerMethod.apply {
|
||||
val invokeIndex = indexOfFirstInstructionOrThrow {
|
||||
opcode == Opcode.INVOKE_VIRTUAL && methodReference?.name == "booleanValue"
|
||||
}
|
||||
|
||||
val moveResultIndex = invokeIndex + 1
|
||||
val moveResultInstr = getInstruction<OneRegisterInstruction>(moveResultIndex)
|
||||
val targetRegister = moveResultInstr.registerA
|
||||
|
||||
addInstructions(
|
||||
moveResultIndex + 1,
|
||||
"""
|
||||
invoke-static { v$targetRegister }, $EXTENSION_CLASS_DESCRIPTOR->forciblyEnableMiniplayerPatch(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1862,11 +1862,16 @@ Video playback with AV1 may stutter or drop frames."</string>
|
|||
<string name="revanced_music_hide_category_bar_summary_on">Category bar is hidden</string>
|
||||
<string name="revanced_music_hide_category_bar_summary_off">Category bar is shown</string>
|
||||
</patch>
|
||||
<patch id="layout.miniplayercolor.changeMiniplayerColor">
|
||||
<patch id="layout.miniplayer.changeMiniplayerColor">
|
||||
<string name="revanced_music_change_miniplayer_color_title">Change miniplayer color</string>
|
||||
<string name="revanced_music_change_miniplayer_color_summary_on">Miniplayer color matches fullscreen player</string>
|
||||
<string name="revanced_music_change_miniplayer_color_summary_off">Miniplayer uses default color</string>
|
||||
</patch>
|
||||
<patch id="layout.miniplayer.forciblyEnableMiniplayer">
|
||||
<string name="revanced_music_forcibly_enable_miniplayer_title">Forcibly enable miniplayer</string>
|
||||
<string name="revanced_music_forcibly_enable_miniplayer_summary_on">Miniplayer stays minimized when playback changes</string>
|
||||
<string name="revanced_music_forcibly_enable_miniplayer_summary_off">Miniplayer expands to fullscreen when playback changes</string>
|
||||
</patch>
|
||||
<patch id="layout.navigationbar.navigationBarPatch">
|
||||
<string name="revanced_music_navigation_bar_screen_title">Navigation bar</string>
|
||||
<string name="revanced_music_navigation_bar_screen_summary">Hide or change navigation bar buttons</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue