mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-24 10:52:10 +02:00
fix(YouTube/Hide trending searches): patch does not support new types of search icons
This commit is contained in:
parent
79897a163f
commit
867c08e1e8
@ -11,6 +11,7 @@ import app.revanced.patches.youtube.utils.integrations.Constants.GENERAL
|
|||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineArrowTimeBlack
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineArrowTimeBlack
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineFireBlack
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineFireBlack
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineNewSearchBlack
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineSearchBlack
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineSearchBlack
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
@ -66,20 +67,22 @@ object TrendingSearchesPatch : BytecodePatch(
|
|||||||
SearchBarEntryFingerprint.result?.let {
|
SearchBarEntryFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
SearchTerm.entries
|
SearchTerm.entries
|
||||||
.map { searchTerm -> getWideLiteralInstructionIndex(searchTerm.resourceId) to searchTerm.value }
|
.map { searchTerm -> getWideLiteralInstructionIndex(searchTerm.resourceId) to searchTerm.booleanValue }
|
||||||
.sortedBy { searchTerm -> searchTerm.first }
|
.sortedBy { searchTerm -> searchTerm.first }
|
||||||
.reversed()
|
.reversed()
|
||||||
.forEach { (index, value) ->
|
.forEach { (targetIndex, booleanValue) ->
|
||||||
val freeRegister = getInstruction<OneRegisterInstruction>(index).registerA
|
if (targetIndex > 1) {
|
||||||
val viewRegister =
|
val freeRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
getInstruction<TwoRegisterInstruction>(index - 1).registerA
|
val viewRegister =
|
||||||
|
getInstruction<TwoRegisterInstruction>(targetIndex - 1).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
index, """
|
targetIndex, """
|
||||||
const/4 v$freeRegister, $value
|
const/4 v$freeRegister, $booleanValue
|
||||||
invoke-static {v$viewRegister, v$freeRegister}, $GENERAL->hideTrendingSearches(Landroid/widget/ImageView;Z)V
|
invoke-static {v$viewRegister, v$freeRegister}, $GENERAL->hideTrendingSearches(Landroid/widget/ImageView;Z)V
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ?: throw SearchBarEntryFingerprint.exception
|
} ?: throw SearchBarEntryFingerprint.exception
|
||||||
@ -98,9 +101,10 @@ object TrendingSearchesPatch : BytecodePatch(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum class SearchTerm(val resourceId: Long, val value: Int) {
|
private enum class SearchTerm(val resourceId: Long, val booleanValue: Int) {
|
||||||
HISTORY(YtOutlineArrowTimeBlack, 0),
|
HISTORY(YtOutlineArrowTimeBlack, 0),
|
||||||
SEARCH(YtOutlineSearchBlack, 0),
|
SEARCH(YtOutlineSearchBlack, 0),
|
||||||
|
NEW_SEARCH(YtOutlineNewSearchBlack, 0),
|
||||||
TRENDING(YtOutlineFireBlack, 1)
|
TRENDING(YtOutlineFireBlack, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -86,6 +86,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
var YoutubeControlsOverlaySubtitleButton: Long = -1
|
var YoutubeControlsOverlaySubtitleButton: Long = -1
|
||||||
var YtOutlineArrowTimeBlack: Long = -1
|
var YtOutlineArrowTimeBlack: Long = -1
|
||||||
var YtOutlineFireBlack: Long = -1
|
var YtOutlineFireBlack: Long = -1
|
||||||
|
var YtOutlineNewSearchBlack: Long = -1
|
||||||
var YtOutlineSearchBlack: Long = -1
|
var YtOutlineSearchBlack: Long = -1
|
||||||
|
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
@ -169,6 +170,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
YoutubeControlsOverlaySubtitleButton = find(LAYOUT, "youtube_controls_overlay_subtitle_button")
|
YoutubeControlsOverlaySubtitleButton = find(LAYOUT, "youtube_controls_overlay_subtitle_button")
|
||||||
YtOutlineArrowTimeBlack = find(DRAWABLE, "yt_outline_arrow_time_black_24")
|
YtOutlineArrowTimeBlack = find(DRAWABLE, "yt_outline_arrow_time_black_24")
|
||||||
YtOutlineFireBlack = find(DRAWABLE, "yt_outline_fire_black_24")
|
YtOutlineFireBlack = find(DRAWABLE, "yt_outline_fire_black_24")
|
||||||
|
YtOutlineNewSearchBlack = find(DRAWABLE, "yt_outline_new_search_black_24")
|
||||||
YtOutlineSearchBlack = find(DRAWABLE, "yt_outline_search_black_24")
|
YtOutlineSearchBlack = find(DRAWABLE, "yt_outline_search_black_24")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user