mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
feat(YouTube Music - Hide layout components): Add Hide search button
setting https://github.com/inotia00/ReVanced_Extended/issues/2850
This commit is contained in:
@ -5,6 +5,7 @@ import app.revanced.patches.music.utils.resourceid.historyMenuItem
|
||||
import app.revanced.patches.music.utils.resourceid.musicTasteBuilderShelf
|
||||
import app.revanced.patches.music.utils.resourceid.offlineSettingsMenuItem
|
||||
import app.revanced.patches.music.utils.resourceid.playerOverlayChip
|
||||
import app.revanced.patches.music.utils.resourceid.searchButton
|
||||
import app.revanced.patches.music.utils.resourceid.toolTipContentView
|
||||
import app.revanced.patches.music.utils.resourceid.topBarMenuItemImageView
|
||||
import app.revanced.util.fingerprint.legacyFingerprint
|
||||
@ -118,6 +119,17 @@ internal val preferenceScreenFingerprint = legacyFingerprint(
|
||||
}
|
||||
)
|
||||
|
||||
internal val searchActionViewFingerprint = legacyFingerprint(
|
||||
name = "searchActionViewFingerprint",
|
||||
returnType = "Landroid/view/View;",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
||||
literals = listOf(searchButton),
|
||||
customFingerprint = { _, classDef ->
|
||||
classDef.type.endsWith("/SearchActionProvider;")
|
||||
}
|
||||
)
|
||||
|
||||
internal val searchBarFingerprint = legacyFingerprint(
|
||||
name = "searchBarFingerprint",
|
||||
returnType = "V",
|
||||
|
@ -20,6 +20,7 @@ import app.revanced.patches.music.utils.playservice.is_8_05_or_greater
|
||||
import app.revanced.patches.music.utils.playservice.versionCheckPatch
|
||||
import app.revanced.patches.music.utils.resourceid.musicTasteBuilderShelf
|
||||
import app.revanced.patches.music.utils.resourceid.playerOverlayChip
|
||||
import app.revanced.patches.music.utils.resourceid.searchButton
|
||||
import app.revanced.patches.music.utils.resourceid.sharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.topBarMenuItemImageView
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
@ -198,6 +199,23 @@ val layoutComponentsPatch = bytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for hide search button
|
||||
|
||||
searchActionViewFingerprint.methodOrThrow().apply {
|
||||
val constIndex =
|
||||
indexOfFirstLiteralInstructionOrThrow(searchButton)
|
||||
val targetIndex =
|
||||
indexOfFirstInstructionOrThrow(constIndex, Opcode.MOVE_RESULT_OBJECT)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $GENERAL_CLASS_DESCRIPTOR->hideSearchButton(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for hide sound search button
|
||||
|
||||
if (is_6_48_or_greater) {
|
||||
@ -353,6 +371,11 @@ val layoutComponentsPatch = bytecodePatch(
|
||||
"revanced_hide_samples_shelf",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_search_button",
|
||||
"false"
|
||||
)
|
||||
if (is_6_48_or_greater) {
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
|
@ -83,6 +83,8 @@ var qualityAuto = -1L
|
||||
private set
|
||||
var remixGenericButtonSize = -1L
|
||||
private set
|
||||
var searchButton = -1L
|
||||
private set
|
||||
var slidingDialogAnimation = -1L
|
||||
private set
|
||||
var tapBloomView = -1L
|
||||
@ -264,6 +266,10 @@ internal val sharedResourceIdPatch = resourcePatch(
|
||||
DIMEN,
|
||||
"remix_generic_button_size"
|
||||
]
|
||||
searchButton = resourceMappings[
|
||||
LAYOUT,
|
||||
"search_button"
|
||||
]
|
||||
slidingDialogAnimation = resourceMappings[
|
||||
STYLE,
|
||||
"SlidingDialogAnimation"
|
||||
|
Reference in New Issue
Block a user