mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-12 04:24:36 +02:00
feat(music): add enable-custom-filter
patch
This commit is contained in:
parent
604165116a
commit
13b8670391
@ -0,0 +1,52 @@
|
||||
package app.revanced.patches.music.layout.customfilter.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.litho.patch.LithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
|
||||
@Patch
|
||||
@Name("enable-custom-filter")
|
||||
@Description("Enables custom filter to hide layout components.")
|
||||
@DependsOn(
|
||||
[
|
||||
LithoFilterPatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomFilterPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_custom_filter",
|
||||
"false"
|
||||
)
|
||||
SettingsPatch.addMusicPreferenceWithIntent(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_custom_filter_strings",
|
||||
"revanced_custom_filter"
|
||||
)
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_ADS_PATH/CustomFilter;"
|
||||
}
|
||||
}
|
@ -3,6 +3,10 @@
|
||||
<string name="revanced_category_ads">Ads</string>
|
||||
<string name="revanced_category_layout">Layout</string>
|
||||
<string name="revanced_category_misc">Miscellaneous</string>
|
||||
<string name="revanced_custom_filter_strings_summary">Filter components by their name separated by a comma</string>
|
||||
<string name="revanced_custom_filter_strings_title">Edit custom filter</string>
|
||||
<string name="revanced_custom_filter_summary">Enables custom filters</string>
|
||||
<string name="revanced_custom_filter_title">Enable custom filter</string>
|
||||
<string name="revanced_disable_auto_captions_summary">Disables forced auto captions.</string>
|
||||
<string name="revanced_disable_auto_captions_title">Disable forced auto captions</string>
|
||||
<string name="revanced_downloader_not_installed" formatted="false">%s is not installed. Please install it.</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user