feat(YouTube Music - Navigation bar components): Add Enable custom navigation bar color setting, Remove Set navigation bar to black setting

This commit is contained in:
inotia00
2025-01-18 20:13:37 +09:00
parent 109e23d426
commit 0fb493410e
5 changed files with 38 additions and 14 deletions

View File

@ -14,6 +14,7 @@ import app.revanced.patches.music.utils.resourceid.sharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.text1
import app.revanced.patches.music.utils.settings.CategoryType
import app.revanced.patches.music.utils.settings.ResourceUtils.updatePatchStatus
import app.revanced.patches.music.utils.settings.addPreferenceWithIntent
import app.revanced.patches.music.utils.settings.addSwitchPreference
import app.revanced.patches.music.utils.settings.settingsPatch
import app.revanced.util.fingerprint.matchOrThrow
@ -62,7 +63,7 @@ val navigationBarComponentsPatch = bytecodePatch(
execute {
/**
* Enable black navigation bar
* Enable custom navigation bar color
*/
tabLayoutFingerprint.methodOrThrow().apply {
val constIndex = indexOfFirstLiteralInstructionOrThrow(colorGrey)
@ -74,7 +75,7 @@ val navigationBarComponentsPatch = bytecodePatch(
addInstructions(
insertIndex, """
invoke-static {}, $NAVIGATION_CLASS_DESCRIPTOR->enableBlackNavigationBar()I
invoke-static {}, $NAVIGATION_CLASS_DESCRIPTOR->enableCustomNavigationBarColor()I
move-result v$insertRegister
"""
)
@ -127,6 +128,16 @@ val navigationBarComponentsPatch = bytecodePatch(
}
}
addSwitchPreference(
CategoryType.NAVIGATION,
"revanced_enable_custom_navigation_bar_color",
"false"
)
addPreferenceWithIntent(
CategoryType.NAVIGATION,
"revanced_custom_navigation_bar_color_value",
"revanced_enable_custom_navigation_bar_color"
)
addSwitchPreference(
CategoryType.NAVIGATION,
"revanced_hide_navigation_home_button",
@ -162,11 +173,6 @@ val navigationBarComponentsPatch = bytecodePatch(
"revanced_hide_navigation_label",
"false"
)
addSwitchPreference(
CategoryType.NAVIGATION,
"revanced_enable_black_navigation_bar",
"true"
)
updatePatchStatus(NAVIGATION_BAR_COMPONENTS)