2023-09-20 05:33:02 +02:00
|
|
|
package app.revanced.patches.youtube.layout.hide.filterbar
|
2023-05-13 01:03:48 +02:00
|
|
|
|
|
|
|
import app.revanced.patcher.data.ResourceContext
|
|
|
|
import app.revanced.patcher.patch.ResourcePatch
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patcher.patch.annotation.Patch
|
2024-01-27 02:34:01 +01:00
|
|
|
import app.revanced.patches.all.misc.resources.AddResourcesPatch
|
|
|
|
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
|
|
|
|
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen
|
|
|
|
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
|
|
|
|
2024-01-27 02:34:01 +01:00
|
|
|
@Patch(dependencies = [SettingsPatch::class, ResourceMappingPatch::class, AddResourcesPatch::class])
|
2023-12-02 22:35:13 +01:00
|
|
|
internal object HideFilterBarResourcePatch : ResourcePatch() {
|
2023-09-20 05:33:02 +02:00
|
|
|
internal var filterBarHeightId = -1L
|
|
|
|
internal var relatedChipCloudMarginId = -1L
|
|
|
|
internal var barContainerHeightId = -1L
|
2023-05-13 01:03:48 +02:00
|
|
|
|
2023-08-27 21:40:49 +02:00
|
|
|
override fun execute(context: ResourceContext) {
|
2024-01-27 02:34:01 +01:00
|
|
|
AddResourcesPatch(this::class)
|
|
|
|
|
2024-03-02 08:27:05 +01:00
|
|
|
SettingsPatch.PreferenceScreen.FEED.addPreferences(
|
2023-05-13 01:03:48 +02:00
|
|
|
PreferenceScreen(
|
2024-03-02 08:27:05 +01:00
|
|
|
key = "revanced_hide_filter_bar_screen",
|
2024-01-27 02:34:01 +01:00
|
|
|
preferences = setOf(
|
|
|
|
SwitchPreference("revanced_hide_filter_bar_feed_in_feed"),
|
|
|
|
SwitchPreference("revanced_hide_filter_bar_feed_in_search"),
|
|
|
|
SwitchPreference("revanced_hide_filter_bar_feed_in_related_videos"),
|
2023-05-16 05:33:03 +02:00
|
|
|
)
|
2023-05-13 01:03:48 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
relatedChipCloudMarginId = "related_chip_cloud_reduced_margins".layoutResourceId("layout")
|
|
|
|
filterBarHeightId = "filter_bar_height".layoutResourceId()
|
|
|
|
barContainerHeightId = "bar_container_height".layoutResourceId()
|
|
|
|
}
|
|
|
|
|
2024-01-27 02:34:01 +01:00
|
|
|
private fun String.layoutResourceId(type: String = "dimen") =
|
|
|
|
ResourceMappingPatch.resourceMappings.single { it.type == type && it.name == this }.id
|
2023-05-13 01:03:48 +02:00
|
|
|
}
|