feat(youtube): import / export of revanced settings (#2077)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
LisoUseInAIKyrios 2023-05-15 11:51:43 +04:00 committed by GitHub
parent 78803f8ea8
commit b59cb3ed60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
79 changed files with 437 additions and 572 deletions

View File

@ -9,23 +9,26 @@ import org.w3c.dom.Element
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param tag The tag of the preference.
* @param summary The summary of the preference.
*/
internal abstract class BasePreference(
override val key: String,
override val title: StringResource,
) : IPreference {
val key: String?,
val title: StringResource,
val summary: StringResource? = null,
val tag: String
) {
/**
* Serialize preference element to XML.
* Overriding methods should invoke super and operate on its return value.
* @param ownerDocument Target document to create elements from.
* @param resourceCallback Called when a resource has been processed.
* @return The serialized element.
*/
open fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)? = null): Element {
return ownerDocument.createElement(tag).apply {
if(key.isNotEmpty())
setAttribute("android:key", key)
setAttribute("android:title", "@string/${title.also { resourceCallback?.invoke(it) }.name}")
open fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element =
ownerDocument.createElement(tag).apply {
if (key != null) setAttribute("android:key", key)
setAttribute("android:title", "@string/${title.also { resourceCallback.invoke(it) }.name}")
addSummary(summary?.also { resourceCallback.invoke(it) })
}
}
}

View File

@ -7,18 +7,19 @@ import org.w3c.dom.Element
* Base resource class for all resources.
*
* @param name The name of the resource.
* @param tag The tag of the resource.
*/
internal abstract class BaseResource(
override val name: String
) : IResource {
val name: String,
val tag: String
) {
/**
* Serialize resource element to XML.
* Overriding methods should invoke super and operate on its return value.
* @param ownerDocument Target document to create elements from.
* @param resourceCallback Called when a resource has been processed.
*/
open fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)? = null): Element {
open fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit = { }): Element {
return ownerDocument.createElement(tag).apply {
setAttribute("name", name)
}

View File

@ -10,7 +10,7 @@ import org.w3c.dom.Node
* @param resource The resource to add.
* @param resourceCallback Called when a resource has been processed.
*/
internal fun Node.addResource(resource: BaseResource, resourceCallback: ((IResource) -> Unit)? = null) {
internal fun Node.addResource(resource: BaseResource, resourceCallback: (BaseResource) -> Unit = { }) {
appendChild(resource.serialize(ownerDocument, resourceCallback))
}
@ -20,7 +20,7 @@ internal fun Node.addResource(resource: BaseResource, resourceCallback: ((IResou
* @param preference The preference to add.
* @param resourceCallback Called when a resource has been processed.
*/
internal fun Node.addPreference(preference: BasePreference, resourceCallback: ((IResource) -> Unit)? = null) {
internal fun Node.addPreference(preference: BasePreference, resourceCallback: ((BaseResource) -> Unit) = { }) {
appendChild(preference.serialize(ownerDocument, resourceCallback))
}
@ -30,10 +30,11 @@ internal fun Element.addSummary(summaryResource: StringResource?, summaryType: S
}
internal fun <T> Element.addDefault(default: T) {
if (default is Boolean && !(default as Boolean)) return // No need to include the default, as no value already means 'false'
default?.let {
setAttribute(
"android:defaultValue", when (it) {
is Boolean -> if (it) "true" else "false"
is Boolean -> it.toString()
is String -> it
else -> throw IllegalArgumentException("Unsupported default value type: ${it::class.java.name}")
}

View File

@ -0,0 +1,32 @@
package app.revanced.patches.shared.settings.preference
import app.revanced.patches.shared.settings.preference.impl.StringResource
import org.w3c.dom.Document
/**
* Base preference class that also has a default value.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param tag The tag of the preference.
* @param summary The summary of the preference.
* @param default The default value of the preference.
*/
internal abstract class DefaultBasePreference<T>(
key: String?,
title: StringResource,
summary: StringResource? = null,
tag: String,
val default: T? = null,
) : BasePreference(key, title, summary, tag) {
/**
* Serialize preference element to XML.
* Overriding methods should invoke super and operate on its return value.
* @param ownerDocument Target document to create elements from.
* @param resourceCallback Called when a resource has been processed.
* @return The serialized element.
*/
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply { addDefault(default) }
}

View File

@ -1,23 +0,0 @@
package app.revanced.patches.shared.settings.preference
import app.revanced.patches.shared.settings.preference.impl.StringResource
/**
* Preference
*/
internal interface IPreference {
/**
* Key of the preference.
*/
val key: String
/**
* Title of the preference.
*/
val title: StringResource
/**
* Tag name of the preference.
*/
val tag: String
}

View File

@ -1,16 +0,0 @@
package app.revanced.patches.shared.settings.preference
/**
* Resource
*/
internal interface IResource {
/**
* Name of the resource.
*/
val name: String
/**
* Tag name of the resource.
*/
val tag: String
}

View File

@ -1,34 +1,29 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.IResource
import org.w3c.dom.Document
import org.w3c.dom.Element
// TODO: allow specifying an array resource file instead of using a list of StringResources
/**
* Represents an array resource.
* An array resource.
*
* @param name The name of the array resource.
* @param items The items of the array resource.
*/
// TODO: allow specifying an array resource file instead of using a list of StringResources
internal data class ArrayResource(
override val name: String,
internal class ArrayResource(
name: String,
val items: List<StringResource>
) : BaseResource(name) {
override val tag = "string-array"
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
) : BaseResource(name, "string-array") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("name", name)
items.forEach { item ->
resourceCallback?.invoke(item)
resourceCallback.invoke(item)
this.appendChild(ownerDocument.createElement("item").also { itemNode ->
itemNode.textContent = "@string/${item.name}"
})
}
}
}
}

View File

@ -1,7 +1,7 @@
package app.revanced.patches.shared.settings.preference.impl
enum class InputType(val type: String) {
STRING("text"), // TODO: rename to "TEXT"
TEXT("text"),
TEXT_CAP_CHARACTERS("textCapCharacters"),
TEXT_MULTI_LINE("textMultiLine"),
NUMBER("number"),

View File

@ -1,11 +1,9 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.addDefault
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.DefaultBasePreference
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* List preference.
@ -14,25 +12,21 @@ import org.w3c.dom.Element
* @param title The title of the list preference.
* @param entries The human-readable entries of the list preference.
* @param entryValues The entry values of the list preference.
* @param default The default entry value of the list preference.
* @param summary The summary of the list preference.
* @param default The default entry value of the list preference.
*/
internal class ListPreference(
key: String,
title: StringResource,
val entries: ArrayResource,
val entryValues: ArrayResource,
val default: String? = null,
val summary: StringResource? = null
) : BasePreference(key, title) {
override val tag: String = "ListPreference"
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:entries", "@array/${entries.also { resourceCallback?.invoke(it) }.name}")
setAttribute("android:entryValues", "@array/${entryValues.also { resourceCallback?.invoke(it) }.name}")
addDefault(default)
summary: StringResource? = null,
default: String? = null,
) : DefaultBasePreference<String>(key, title, summary, "ListPreference", default) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:entries", "@array/${entries.also { resourceCallback.invoke(it) }.name}")
setAttribute("android:entryValues", "@array/${entryValues.also { resourceCallback.invoke(it) }.name}")
addSummary(summary)
}
}
}

View File

@ -1,24 +1,27 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* A simple static title and summary that is not backed by any preference key/value,
* and cannot be changed by or interacted with by the user,
* A non interactive preference.
*
* Not backed by any preference key/value,
* and cannot be changed by or interacted with by the user.
*
* @param title The title of the preference.
* @param summary The summary of the text preference.
*/
internal class NonInteractivePreference(
title: StringResource,
val summary: StringResource,
) : BasePreference("", title) {
override val tag: String = "Preference"
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
summary: StringResource,
) : BasePreference(null, title, summary, "Preference") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summary.also { resourceCallback?.invoke(it)
addSummary(summary?.also { resourceCallback.invoke(it)
setAttribute("android:selectable", false.toString())
})
}

View File

@ -1,44 +1,41 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.addSummary
import app.revanced.patches.shared.settings.preference.BaseResource
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* A Preference object.
* A preference object.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param intent The intent of the preference.
* @param summary The summary of the text preference.
* @param intent The intent of the preference.
*/
internal class Preference(
key: String,
title: StringResource,
val intent: Intent,
val summary: StringResource? = null
) : BasePreference(key, title) {
override val tag: String = "Preference"
/* Key-less constructor */
summary: StringResource,
val intent: Intent
) : BasePreference(key, title, summary, "Preference") {
constructor(
title: StringResource,
intent: Intent,
summary: StringResource? = null
) : this("", title, intent, summary)
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summary?.also { resourceCallback?.invoke(it) })
summary: StringResource,
intent: Intent
) : this("", title, summary, intent)
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
this.appendChild(ownerDocument.createElement("intent").also { intentNode ->
intentNode.setAttribute("android:targetPackage", intent.targetPackage)
intentNode.setAttribute("android:data", intent.data)
intentNode.setAttribute("android:targetClass", intent.targetClass)
})
}
}
data class Intent(val targetPackage: String, val data: String, val targetClass: String)
internal class Intent(
internal val targetPackage: String,
internal val data: String,
internal val targetClass: String
)
}

View File

@ -1,12 +1,11 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.BaseResource
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Preference category.
* A preference category.
*
* @param key The key of the preference.
* @param title The title of the preference.
@ -15,15 +14,13 @@ import org.w3c.dom.Element
internal open class PreferenceCategory(
key: String,
title: StringResource,
var preferences: List<BasePreference>
) : BasePreference(key, title) {
override val tag: String = "PreferenceCategory"
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
var preferences: List<BasePreference>,
tag: String = "PreferenceCategory"
) : BasePreference(key, title, null, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
for (childPreference in preferences) {
this.appendChild(childPreference.serialize(ownerDocument, resourceCallback))
}
}
}
}

View File

@ -1,13 +1,12 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Preference screen.
* A preference screen.
*
* @param key The key of the preference.
* @param title The title of the preference.
@ -18,17 +17,13 @@ internal open class PreferenceScreen(
key: String,
title: StringResource,
var preferences: List<BasePreference>,
val summary: StringResource? = null
) : BasePreference(key, title) {
override val tag: String = "PreferenceScreen"
summary: StringResource? = null
) : BasePreference(key, title, summary, "PreferenceScreen") {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summary?.also { resourceCallback.invoke(it) })
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
addSummary(summary?.also { resourceCallback?.invoke(it) })
for (childPreference in preferences) {
for (childPreference in preferences)
this.appendChild(childPreference.serialize(ownerDocument, resourceCallback))
}
}
}
}

View File

@ -1,31 +1,27 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.IResource
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Represents a string value in the strings.xml file
* A string value.
* Represets a string in the strings.xml file.
*
* @param name The name of the string
* @param value The value of the string
* @param formatted If the string is formatted. If false, the attribute will be set
* @param name The name of the string.
* @param value The value of the string.
* @param formatted If the string is formatted. If false, the attribute will be set.
*/
internal data class StringResource(
override val name: String,
internal class StringResource(
name: String,
val value: String,
val formatted: Boolean = true
) : BaseResource(name) {
override val tag = "string"
) : BaseResource(name, "string") {
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
// if the string is un-formatted, explicitly add the formatted attribute
if (!formatted)
setAttribute("formatted", "false")
if (!formatted) setAttribute("formatted", "false")
textContent = value
}
}
}

View File

@ -1,37 +1,36 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.*
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.DefaultBasePreference
import app.revanced.patches.shared.settings.preference.SummaryType
import app.revanced.patches.shared.settings.preference.addSummary
import app.revanced.patches.shared.settings.resource.patch.AbstractSettingsResourcePatch.Companion.include
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Switch preference.
* A switch preference.
*
* @param key The key of the switch.
* @param title The title of the switch.
* @param default The default value of the switch.
* @param summaryOn The summary to show when the preference is enabled.
* @param summaryOff The summary to show when the preference is disabled.
* @param userDialogMessage The message to show in a dialog when the user toggles the preference.
* @param default The default value of the switch.
*/
internal class SwitchPreference(
key: String, title: StringResource,
val default: Boolean = false,
val summaryOn: StringResource? = null,
val summaryOff: StringResource? = null,
val userDialogMessage: StringResource? = null
) : BasePreference(key, title) {
override val tag: String = "SwitchPreference"
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
// dialog message is stored as a regular string and later referenced by SettingsEnum
val summaryOn: StringResource,
val summaryOff: StringResource,
val userDialogMessage: StringResource? = null,
default: Boolean = false,
) : DefaultBasePreference<Boolean>( key, title, null, "SwitchPreference", default) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element {
userDialogMessage?.include()
return super.serialize(ownerDocument, resourceCallback).apply {
addDefault(default)
addSummary(summaryOn?.also { resourceCallback?.invoke(it) }, SummaryType.ON)
addSummary(summaryOff?.also { resourceCallback?.invoke(it) }, SummaryType.OFF)
addSummary(summaryOn.also { resourceCallback.invoke(it) }, SummaryType.ON)
addSummary(summaryOff.also { resourceCallback.invoke(it) }, SummaryType.OFF)
}
}
}

View File

@ -1,35 +1,29 @@
package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.addDefault
import app.revanced.patches.shared.settings.preference.addSummary
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.DefaultBasePreference
import org.w3c.dom.Document
import org.w3c.dom.Element
/**
* Text preference.
* A text preference.
*
* @param key The key of the text preference.
* @param title The title of the text preference.
* @param inputType The input type of the text preference.
* @param default The default value of the text preference.
* @param summary The summary of the text preference.
* @param default The default value of the text preference.
*/
internal class TextPreference(
key: String,
key: String?,
title: StringResource,
var inputType: InputType = InputType.STRING,
val default: String? = null,
val summary: StringResource? = null
) : BasePreference(key, title) {
override val tag: String = "app.revanced.integrations.settingsmenu.ResettableEditTextPreference"
summary: StringResource?,
val inputType: InputType = InputType.TEXT,
default: String? = null,
tag: String = "app.revanced.integrations.settingsmenu.ResettableEditTextPreference"
) : DefaultBasePreference<String>(key, title, summary, tag, default) {
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:inputType", inputType.type)
addDefault(default)
addSummary(summary?.also { resourceCallback?.invoke(it) })
}
}
}

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.IResource
import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.addPreference
import app.revanced.patches.shared.settings.preference.addResource
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
@ -108,7 +108,7 @@ abstract class AbstractSettingsResourcePatch(
*
* @throws IllegalArgumentException if the resource already exists.
*/
internal fun IResource.include() {
internal fun BaseResource.include() {
when (this) {
is StringResource -> {
if (strings.any { it.name == name }) return

View File

@ -50,7 +50,6 @@ class AudioAdsPatch : BytecodePatch(
"revanced_block_audio_ads",
"Block audio ads"
),
true,
StringResource(
"revanced_block_audio_ads_on",
"Audio ads are blocked"
@ -59,6 +58,7 @@ class AudioAdsPatch : BytecodePatch(
"revanced_block_audio_ads_off",
"Audio ads are unblocked"
),
default = true,
)
)

View File

@ -66,7 +66,7 @@ class EmbeddedAdsPatch : BytecodePatch(
StringResource("key_revanced_proxy_purpleadblock", "purpleadblock")
)
),
"ttv-lol"
default = "ttv-lol"
)
)

View File

@ -132,7 +132,6 @@ class VideoAdsPatch : AbstractAdPatch(
"revanced_block_video_ads",
"Block video ads"
),
true,
StringResource(
"revanced_block_video_ads_on",
"Video ads are blocked"
@ -141,6 +140,7 @@ class VideoAdsPatch : AbstractAdPatch(
"revanced_block_video_ads_off",
"Video ads are unblocked"
),
default = true
)
)

View File

@ -98,7 +98,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
StringResource("key_revanced_deleted_messages_cross_out", "cross-out")
)
),
"cross-out"
default = "cross-out"
)
)

View File

@ -36,7 +36,6 @@ class AutoClaimChannelPointPatch : BytecodePatch(
"revanced_auto_claim_channel_points",
"Automatically claim Channel Points"
),
true,
StringResource(
"revanced_auto_claim_channel_points_on",
"Channel Points are claimed automatically"
@ -45,6 +44,7 @@ class AutoClaimChannelPointPatch : BytecodePatch(
"revanced_auto_claim_channel_points_off",
"Channel Points are not claimed automatically"
),
default = true
)
)

View File

@ -59,7 +59,6 @@ class DebugModePatch : BytecodePatch(
"revanced_debug_mode_enable",
"Enable debug mode"
),
false,
StringResource(
"revanced_debug_mode_on",
"Debug mode is enabled (not recommended)"
@ -68,6 +67,7 @@ class DebugModePatch : BytecodePatch(
"revanced_debug_mode_off",
"Debug mode is disabled"
),
default = false,
)
)

View File

@ -20,7 +20,6 @@ import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.twitch.misc.settings.annotations.SettingsCompatibility
import app.revanced.patches.twitch.misc.settings.components.CustomPreferenceCategory
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsOnClickFingerprint
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsUpdatedFingerprint
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsActivityOnCreateFingerprint
@ -183,10 +182,11 @@ class SettingsPatch : BytecodePatch(
internal inner class CustomCategory(key: String, title: String) : Screen.Category(key, title) {
/* For Twitch, we need to load our CustomPreferenceCategory class instead of the default one. */
override fun transform(): PreferenceCategory {
return CustomPreferenceCategory(
return PreferenceCategory(
key,
StringResource("${key}_title", title),
preferences.sortedBy { it.title.value }
preferences.sortedBy { it.title.value },
"app.revanced.twitch.settingsmenu.preference.CustomPreferenceCategory"
)
}
}

View File

@ -1,20 +0,0 @@
package app.revanced.patches.twitch.misc.settings.components
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.impl.PreferenceCategory
import app.revanced.patches.shared.settings.preference.impl.StringResource
/**
* Customized preference category for Twitch.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param preferences Child preferences of this category.
*/
internal open class CustomPreferenceCategory(
key: String,
title: StringResource,
preferences: List<BasePreference>
) : PreferenceCategory(key, title, preferences) {
override val tag: String = "app.revanced.twitch.settingsmenu.preference.CustomPreferenceCategory"
}

View File

@ -31,192 +31,170 @@ class GeneralAdsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_adremover_separator",
StringResource("revanced_adremover_separator_title", "Hide gray separator"),
true,
StringResource("revanced_adremover_separator_summary_on", "Gray separators are hidden"),
StringResource("revanced_adremover_separator_summary_off", "Gray separators are shown")
"revanced_hide_gray_separator",
StringResource("revanced_hide_gray_separator_title", "Hide gray separator"),
StringResource("revanced_hide_gray_separator_summary_on", "Gray separators are hidden"),
StringResource("revanced_hide_gray_separator_summary_off", "Gray separators are shown")
),
SwitchPreference(
"revanced_adremover_hide_channel_guidelines",
StringResource("revanced_adremover_hide_channel_guidelines_enabled_title", "Hide channel guidelines"),
true,
"revanced_hide_channel_guidelines",
StringResource("revanced_hide_channel_guidelines_title", "Hide channel guidelines"),
StringResource(
"revanced_adremover_hide_channel_guidelines_enabled_summary_on",
"revanced_hide_channel_guidelines_summary_on",
"Channel guidelines are hidden"
),
StringResource(
"revanced_adremover_hide_channel_guidelines_enabled_summary_off",
"revanced_hide_channel_guidelines_summary_off",
"Channel guidelines are shown"
)
),
SwitchPreference(
"revanced_adremover_chapter_teaser",
"revanced_hide_chapter_teaser",
StringResource(
"revanced_adremover_chapter_teaser_enabled_title",
"revanced_hide_chapter_teaser_title",
"Hide chapter teaser under videos"
),
true,
StringResource(
"revanced_adremover_chapter_teaser_enabled_summary_on",
"revanced_hide_chapter_teaser_summary_on",
"Chapter teasers are hidden"
),
StringResource(
"revanced_adremover_chapter_teaser_enabled_summary_off",
"revanced_hide_chapter_teaser_summary_off",
"Chapter teasers are shown"
)
),
SwitchPreference(
"revanced_adremover_merchandise",
StringResource("revanced_adremover_merchandise_enabled_title", "Hide merchandise banners"),
true,
StringResource("revanced_adremover_merchandise_enabled_summary_on", "Merchandise banners are hidden"),
StringResource("revanced_adremover_merchandise_enabled_summary_off", "Merchandise banners are shown")
"revanced_hide_merchandise_banners",
StringResource("revanced_hide_merchandise_banners_title", "Hide merchandise banners"),
StringResource("revanced_hide_merchandise_banners_summary_on", "Merchandise banners are hidden"),
StringResource("revanced_hide_merchandise_banners_summary_off", "Merchandise banners are shown")
),
SwitchPreference(
"revanced_adremover_community_posts_removal",
StringResource("revanced_adremover_community_posts_enabled_title", "Hide community posts"),
false,
StringResource("revanced_adremover_community_posts_enabled_summary_on", "Community posts are hidden"),
StringResource("revanced_adremover_community_posts_enabled_summary_off", "Community posts are shown")
"revanced_hide_community_posts",
StringResource("revanced_hide_community_posts_title", "Hide community posts"),
StringResource("revanced_hide_community_posts_summary_on", "Community posts are hidden"),
StringResource("revanced_hide_community_posts_summary_off", "Community posts are shown")
),
SwitchPreference(
"revanced_adremover_compact_banner_removal",
StringResource("revanced_adremover_compact_banner_enabled_title", "Hide compact banners"),
true,
StringResource("revanced_adremover_compact_banner_enabled_summary_on", "Compact banners are hidden"),
StringResource("revanced_adremover_compact_banner_enabled_summary_off", "Compact banners are shown")
"revanced_hide_compact_banner",
StringResource("revanced_hide_compact_banner_title", "Hide compact banners"),
StringResource("revanced_hide_compact_banner_summary_on", "Compact banners are hidden"),
StringResource("revanced_hide_compact_banner_summary_off", "Compact banners are shown")
),
SwitchPreference(
"revanced_adremover_view_products",
StringResource("revanced_adremover_view_products_title", "Hide banner to view products"),
true,
StringResource("revanced_adremover_view_products_summary_on", "Banner is hidden"),
StringResource("revanced_adremover_view_products_summary_off", "Banner is shown")
"revanced_hide_products_banner",
StringResource("revanced_hide_products_banner_title", "Hide banner to view products"),
StringResource("revanced_hide_products_banner_summary_on", "Banner is hidden"),
StringResource("revanced_hide_products_banner_summary_off", "Banner is shown")
),
SwitchPreference(
"revanced_adremover_web_search_result",
StringResource("revanced_adremover_web_search_result_panel_title", "Hide web search results"),
true,
StringResource("revanced_adremover_web_search_result_summary_on", "Web search results are hidden"),
StringResource("revanced_adremover_web_search_result_summary_off", "Web search results are shown")
"revanced_hide_web_search_results",
StringResource("revanced_hide_web_search_results_title", "Hide web search results"),
StringResource("revanced_hide_web_search_results_summary_on", "Web search results are hidden"),
StringResource("revanced_hide_web_search_results_summary_off", "Web search results are shown")
),
SwitchPreference(
"revanced_adremover_movie",
StringResource("revanced_adremover_movie_enabled_title", "Hide movies section"),
true,
StringResource("revanced_adremover_movie_enabled_summary_on", "Movies section is hidden"),
StringResource("revanced_adremover_movie_enabled_summary_off", "Movies section is shown")
"revanced_hide_movies_section",
StringResource("revanced_hide_movies_section_title", "Hide movies section"),
StringResource("revanced_hide_movies_section_summary_on", "Movies section is hidden"),
StringResource("revanced_hide_movies_section_summary_off", "Movies section is shown")
),
SwitchPreference(
"revanced_adremover_feed_survey",
StringResource("revanced_adremover_feed_survey_enabled_title", "Hide feed surveys"),
true,
StringResource("revanced_adremover_feed_survey_enabled_summary_on", "Feed surveys are hidden"),
StringResource("revanced_adremover_feed_survey_enabled_summary_off", "Feed surveys are shown")
"revanced_hide_feed_survey",
StringResource("revanced_hide_feed_survey_title", "Hide feed surveys"),
StringResource("revanced_hide_feed_survey_summary_on", "Feed surveys are hidden"),
StringResource("revanced_hide_feed_survey_summary_off", "Feed surveys are shown")
),
SwitchPreference(
"revanced_adremover_shorts",
StringResource("revanced_adremover_shorts_enabled_title", "Hide shorts"),
true,
StringResource("revanced_adremover_shorts_enabled_summary_on", "Shorts are hidden"),
StringResource("revanced_adremover_shorts_enabled_summary_off", "Shorts are shown")
"revanced_hide_shorts",
StringResource("revanced_hide_shorts_title", "Hide shorts"),
StringResource("revanced_hide_shorts_summary_on", "Shorts are hidden"),
StringResource("revanced_hide_shorts_summary_off", "Shorts are shown")
),
SwitchPreference(
"revanced_adremover_community_guidelines",
StringResource("revanced_adremover_community_guidelines_enabled_title", "Hide community guidelines"),
true,
"revanced_hide_community_guidelines",
StringResource("revanced_hide_community_guidelines_title", "Hide community guidelines"),
StringResource(
"revanced_adremover_community_guidelines_enabled_summary_on",
"revanced_hide_community_guidelines_summary_on",
"Community guidelines are hidden"
),
StringResource(
"revanced_adremover_community_guidelines_enabled_summary_off",
"revanced_hide_community_guidelines_summary_off",
"Community guidelines are shown"
)
),
SwitchPreference(
"revanced_adremover_subscribers_community_guidelines_removal",
"revanced_hide_subscribers_community_guidelines",
StringResource(
"revanced_adremover_subscribers_community_guidelines_enabled_title",
"revanced_hide_subscribers_community_guidelines_title",
"Hide subscribers community guidelines"
),
true,
StringResource(
"revanced_adremover_subscribers_community_guidelines_enabled_summary_on",
"revanced_hide_subscribers_community_guidelines_summary_on",
"Subscribers community guidelines are hidden"
),
StringResource(
"revanced_adremover_subscribers_community_guidelines_enabled_summary_off",
"revanced_hide_subscribers_community_guidelines_summary_off",
"Subscribers community guidelines are shown"
)
),
SwitchPreference(
"revanced_adremover_channel_member_shelf_removal",
StringResource("revanced_adremover_channel_member_shelf_enabled_title", "Hide channel member shelf"),
true,
"revanced_hide_channel_member_shelf",
StringResource("revanced_hide_channel_member_shelf_title", "Hide channel member shelf"),
StringResource(
"revanced_adremover_channel_member_shelf_enabled_summary_on",
"revanced_hide_channel_member_shelf_summary_on",
"Channel member shelf is hidden"
),
StringResource(
"revanced_adremover_channel_member_shelf_enabled_summary_off",
"revanced_hide_channel_member_shelf_summary_off",
"Channel member shelf is shown"
)
),
SwitchPreference(
"revanced_adremover_emergency_box_removal",
StringResource("revanced_adremover_emergency_box_enabled_title", "Hide emergency boxes"),
true,
StringResource("revanced_adremover_emergency_box_enabled_summary_on", "Emergency boxes are hidden"),
StringResource("revanced_adremover_emergency_box_enabled_summary_off", "Emergency boxes are shown")
"revanced_hide_emergency_box",
StringResource("revanced_hide_emergency_box_title", "Hide emergency boxes"),
StringResource("revanced_hide_emergency_box_summary_on", "Emergency boxes are hidden"),
StringResource("revanced_hide_emergency_box_summary_off", "Emergency boxes are shown")
),
SwitchPreference(
"revanced_adremover_info_panel",
StringResource("revanced_adremover_info_panel_enabled_title", "Hide info panels"),
true,
StringResource("revanced_adremover_info_panel_enabled_summary_on", "Info panels are hidden"),
StringResource("revanced_adremover_info_panel_enabled_summary_off", "Info panels are shown")
"revanced_hide_info_panels",
StringResource("revanced_hide_info_panels_title", "Hide info panels"),
StringResource("revanced_hide_info_panels_summary_on", "Info panels are hidden"),
StringResource("revanced_hide_info_panels_summary_off", "Info panels are shown")
),
SwitchPreference(
"revanced_adremover_medical_panel",
StringResource("revanced_adremover_medical_panel_enabled_title", "Hide medical panels"),
true,
StringResource("revanced_adremover_medical_panel_enabled_summary_on", "Medical panels are hidden"),
StringResource("revanced_adremover_medical_panel_enabled_summary_off", "Medical panels are shown")
"revanced_hide_medical_panels",
StringResource("revanced_hide_medical_panels_title", "Hide medical panels"),
StringResource("revanced_hide_medical_panels_summary_on", "Medical panels are hidden"),
StringResource("revanced_hide_medical_panels_summary_off", "Medical panels are shown")
),
SwitchPreference(
"revanced_hide_channel_bar",
StringResource("revanced_hide_channel_bar_title", "Hide channel bar"),
false,
StringResource("revanced_hide_channel_bar_summary_on", "Channel bar is hidden"),
StringResource("revanced_hide_channel_bar_summary_off", "Channel bar is shown")
),
SwitchPreference(
"revanced_hide_quick_actions",
StringResource("revanced_hide_quick_actions_title", "Hide quick actions in fullscreen"),
false,
StringResource("revanced_hide_quick_actions_summary_on", "Quick actions are hidden"),
StringResource("revanced_hide_quick_actions_summary_off", "Quick actions are shown")
),
SwitchPreference(
"revanced_hide_related_videos",
StringResource("revanced_hide_related_videos_title", "Hide related videos in quick actions"),
false,
StringResource("revanced_hide_related_videos_summary_on", "Related videos are hidden"),
StringResource("revanced_hide_related_videos_summary_off", "Related videos are shown")
),
SwitchPreference(
"revanced_hide_image_shelf",
StringResource("revanced_hide_image_shelf", "Hide image shelf in search results"),
true,
StringResource("revanced_hide_image_shelf_summary_on", "Image shelf is hidden"),
StringResource("revanced_hide_image_shelf_summary_off", "Image shelf is shown")
),
SwitchPreference(
"revanced_hide_audio_track_button",
StringResource("revanced_hide_audio_track_button_title", "Hide audio track button"),
false,
StringResource("revanced_hide_audio_track_button_on", "Audio track button is hidden"),
StringResource("revanced_hide_audio_track_button_off", "Audio track button is shown")
)
@ -224,68 +202,60 @@ class GeneralAdsResourcePatch : ResourcePatch {
PreferenceScreen.ADS.addPreferences(
SwitchPreference(
"revanced_adremover_ad_removal",
StringResource("revanced_adremover_ad_removal_enabled_title", "Hide general ads"),
true,
StringResource("revanced_adremover_ad_removal_enabled_summary_on", "General ads are hidden"),
StringResource("revanced_adremover_ad_removal_enabled_summary_off", "General ads are shown")
"revanced_hide_general_ads",
StringResource("revanced_hide_general_ads_title", "Hide general ads"),
StringResource("revanced_hide_general_ads_summary_on", "General ads are hidden"),
StringResource("revanced_hide_general_ads_summary_off", "General ads are shown")
),
SwitchPreference(
"revanced_adremover_buttoned",
StringResource("revanced_adremover_buttoned_enabled_title", "Hide buttoned ad"),
true,
StringResource("revanced_adremover_buttoned_enabled_summary_on", "Buttoned ads are hidden"),
StringResource("revanced_adremover_buttoned_enabled_summary_off", "Buttoned ads are shown")
"revanced_hide_buttoned_ads",
StringResource("revanced_hide_buttoned_ads_title", "Hide buttoned ad"),
StringResource("revanced_hide_buttoned_ads_summary_on", "Buttoned ads are hidden"),
StringResource("revanced_hide_buttoned_ads_summary_off", "Buttoned ads are shown")
),
SwitchPreference(
"revanced_adremover_paid_content",
StringResource("revanced_adremover_paid_content_enabled_title", "Hide paid content"),
true,
StringResource("revanced_adremover_paid_content_enabled_summary_on", "Paid content is hidden"),
StringResource("revanced_adremover_paid_content_enabled_summary_off", "Paid content is shown")
"revanced_hide_paid_content_ads",
StringResource("revanced_hide_paid_content_ads_title", "Hide paid content"),
StringResource("revanced_hide_paid_content_ads_summary_on", "Paid content is hidden"),
StringResource("revanced_hide_paid_content_ads_summary_off", "Paid content is shown")
),
SwitchPreference(
"revanced_adremover_hide_latest_posts",
StringResource("revanced_adremover_hide_latest_posts_enabled_title", "Hide latest posts"),
true,
StringResource("revanced_adremover_hide_latest_posts_enabled_summary_on", "Latest posts are hidden"),
StringResource("revanced_adremover_hide_latest_posts_enabled_summary_off", "Latest posts are shown")
"revanced_hide_latest_posts_ads",
StringResource("revanced_hide_latest_posts_ads_title", "Hide latest posts"),
StringResource("revanced_hide_latest_posts_ads_summary_on", "Latest posts are hidden"),
StringResource("revanced_hide_latest_posts_ads_summary_off", "Latest posts are shown")
),
SwitchPreference(
"revanced_adremover_self_sponsor",
StringResource("revanced_adremover_self_sponsor_enabled_title", "Hide self sponsored cards"),
true,
StringResource("revanced_adremover_self_sponsor_enabled_summary_on", "Self sponsored cards are hidden"),
StringResource("revanced_adremover_self_sponsor_enabled_summary_off", "Self sponsored cards are shown")
"revanced_hide_self_sponsor_ads",
StringResource("revanced_hide_self_sponsor_ads_title", "Hide self sponsored cards"),
StringResource("revanced_hide_self_sponsor_ads_summary_on", "Self sponsored cards are hidden"),
StringResource("revanced_hide_self_sponsor_ads_summary_off", "Self sponsored cards are shown")
),
PreferenceScreen(
"revanced_adremover_custom",
StringResource("revanced_adremover_custom_title", "Custom filter"),
"revanced_custom_filter_preference_screen",
StringResource("revanced_custom_filter_preference_screen_title", "Custom filter"),
listOf(
SwitchPreference(
"revanced_adremover_custom_enabled",
"revanced_custom_filter",
StringResource(
"revanced_adremover_custom_enabled_title",
"revanced_custom_filter_title",
"Enable custom filter"
),
false,
StringResource(
"revanced_adremover_custom_enabled_summary_on",
"revanced_custom_filter_summary_on",
"Custom filter is enabled"
),
StringResource(
"revanced_adremover_custom_enabled_summary_off",
"revanced_custom_filter_summary_off",
"Custom filter is disabled"
)
),
// TODO: This should be a dynamic ListPreference, which does not exist yet
TextPreference(
"revanced_adremover_custom_strings",
StringResource("revanced_adremover_custom_strings_title", "Custom filter"),
InputType.STRING,
"",
"revanced_custom_filter_strings",
StringResource("revanced_custom_filter_strings_title", "Custom filter"),
StringResource(
"revanced_adremover_custom_strings_summary",
"revanced_custom_filter_strings_summary",
"Filter components by their name separated by a comma"
)
)

View File

@ -33,11 +33,10 @@ class VideoAdsPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.ADS.addPreferences(
SwitchPreference(
"revanced_video_ads_removal",
StringResource("revanced_video_ads_removal_title", "Hide video ads"),
true,
StringResource("revanced_video_ads_removal_summary_on", "Video ads are hidden"),
StringResource("revanced_video_ads_removal_summary_off", "Video ads are shown")
"revanced_hide_video_ads",
StringResource("revanced_hide_video_ads_title", "Hide video ads"),
StringResource("revanced_hide_video_ads_summary_on", "Video ads are hidden"),
StringResource("revanced_hide_video_ads_summary_off", "Video ads are shown")
)
)

View File

@ -26,25 +26,23 @@ class CopyVideoUrlResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_copy_video_url",
StringResource("revanced_copy_video_url_title", "Copy video URL settings"),
"revanced_copy_video_url_preference_screen",
StringResource("revanced_copy_video_url_preference_screen_title", "Copy video URL settings"),
listOf(
SwitchPreference(
"revanced_copy_video_url_enabled",
StringResource("revanced_copy_video_url_enabled_title", "Show copy video URL button"),
true,
StringResource("revanced_copy_video_url_enabled_summary_on", "Button is shown, click to copy video URL without timestamp"),
StringResource("revanced_copy_video_url_enabled_summary_off", "Button is not shown")
"revanced_copy_video_url",
StringResource("revanced_copy_video_url_title", "Show copy video URL button"),
StringResource("revanced_copy_video_url_summary_on", "Button is shown, click to copy video URL without timestamp"),
StringResource("revanced_copy_video_url_summary_off", "Button is not shown")
),
SwitchPreference(
"revanced_copy_video_url_timestamp_enabled",
StringResource("revanced_copy_video_url_timestamp_enabled_title", "Show copy timestamp URL button"),
true,
StringResource("revanced_copy_video_url_timestamp_enabled_summary_on", "Button is shown, click to copy video URL with timestamp"),
StringResource("revanced_copy_video_url_timestamp_enabled_summary_off", "Button is not shown")
"revanced_copy_video_url_timestamp",
StringResource("revanced_copy_video_url_timestamp_title", "Show copy timestamp URL button"),
StringResource("revanced_copy_video_url_timestamp_summary_on", "Button is shown, click to copy video URL with timestamp"),
StringResource("revanced_copy_video_url_timestamp_summary_off", "Button is not shown")
)
),
StringResource("revanced_copy_video_url_summary", "Settings related to copy URL buttons in video player")
StringResource("revanced_copy_video_url_preference_screen_summary", "Settings related to copy URL buttons in video player")
)
)

View File

@ -25,25 +25,23 @@ class DownloadsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_downloads",
StringResource("revanced_downloads_title", "Download settings"),
"revanced_external_downloader_preference_screen",
StringResource("revanced_external_downloader_preference_screen_title", "Download settings"),
listOf(
SwitchPreference(
"revanced_downloads_enabled",
StringResource("revanced_downloads_enabled_title", "Show download button"),
true,
StringResource("revanced_downloads_enabled_summary_on", "Download button is shown"),
StringResource("revanced_downloads_enabled_summary_off", "Download button is not shown")
"revanced_external_downloader",
StringResource("revanced_external_downloader_title", "Show download button"),
StringResource("revanced_external_downloader_summary_on", "Download button is shown"),
StringResource("revanced_external_downloader_summary_off", "Download button is not shown")
),
TextPreference(
"revanced_downloads_package_name",
StringResource("revanced_downloads_package_name_title", "Downloader package name"),
InputType.STRING,
"org.schabi.newpipe" /* NewPipe */,
StringResource("revanced_downloads_package_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s")
"revanced_external_downloader_name",
StringResource("revanced_external_downloader_name_title", "Downloader package name"),
StringResource("revanced_external_downloader_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s"),
InputType.TEXT
)
),
StringResource("revanced_downloads_summary", "Settings related to downloads")
StringResource("revanced_external_downloader_preference_screen_summary", "Settings related to downloads")
)
)

View File

@ -38,11 +38,10 @@ class EnableSeekbarTappingPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference(
"revanced_enable_tap_seeking",
StringResource("revanced_seekbar_tapping_enabled_title", "Enable seekbar tapping"),
true,
StringResource("revanced_seekbar_tapping_summary_on", "Seekbar tapping is enabled"),
StringResource("revanced_seekbar_tapping_summary_off", "Seekbar tapping is disabled")
"revanced_tap_seeking",
StringResource("revanced_tap_seeking_title", "Enable seekbar tapping"),
StringResource("revanced_tap_seeking_summary_on", "Seekbar tapping is enabled"),
StringResource("revanced_tap_seeking_summary_off", "Seekbar tapping is disabled")
)
)

View File

@ -25,74 +25,68 @@ class SwipeControlsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_swipe_controls", StringResource("revanced_swipe_controls_title", "Swipe controls"), listOf(
"revanced_swipe_controls_preference_screen",
StringResource("revanced_swipe_controls_preference_screen_title", "Swipe controls"),
listOf(
SwitchPreference(
"revanced_enable_swipe_brightness",
StringResource("revanced_swipe_brightness_enabled_title", "Enable brightness gesture"),
true,
"revanced_swipe_brightness",
StringResource("revanced_swipe_brightness_title", "Enable brightness gesture"),
StringResource("revanced_swipe_brightness_summary_on", "Brightness swipe is enabled"),
StringResource("revanced_swipe_brightness_summary_off", "Brightness swipe is disabled")
),
SwitchPreference(
"revanced_enable_swipe_volume",
StringResource("revanced_swipe_volume_enabled_title", "Enable volume gesture"),
true,
"revanced_swipe_volume",
StringResource("revanced_swipe_volume_title", "Enable volume gesture"),
StringResource("revanced_swipe_volume_summary_on", "Volume swipe is enabled"),
StringResource("revanced_swipe_volume_summary_off", "Volume swipe is disabled")
),
SwitchPreference(
"revanced_enable_press_to_swipe",
StringResource("revanced_press_to_swipe_enabled_title", "Enable press-to-swipe gesture"),
false,
StringResource("revanced_press_to_swipe_summary_on", "Press-to-swipe is enabled"),
StringResource("revanced_press_to_swipe_summary_off", "Press-to-swipe is disabled")
"revanced_swipe_press_to_engage",
StringResource("revanced_swipe_press_to_engage_title", "Enable press-to-swipe gesture"),
StringResource("revanced_swipe_press_to_engage_summary_on", "Press-to-swipe is enabled"),
StringResource("revanced_swipe_press_to_engage_summary_off", "Press-to-swipe is disabled")
),
SwitchPreference(
"revanced_enable_swipe_haptic_feedback",
StringResource("revanced_swipe_haptic_feedback_enabled_title", "Enable haptic feedback"),
true,
"revanced_swipe_haptic_feedback",
StringResource("revanced_swipe_haptic_feedback_title", "Enable haptic feedback"),
StringResource("revanced_swipe_haptic_feedback_summary_on", "Haptic feedback is enabled"),
StringResource("revanced_swipe_haptic_feedback_summary_off", "Haptic feedback is disabled")
),
TextPreference(
"revanced_swipe_overlay_timeout",
StringResource("revanced_swipe_overlay_timeout_title", "Swipe overlay timeout"),
InputType.NUMBER,
"500",
StringResource(
"revanced_swipe_overlay_timeout_summary",
"The amount of milliseconds the overlay is visible"
)
),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_overlay_text_size",
StringResource("revanced_swipe_overlay_text_size_title", "Swipe overlay text size"),
InputType.NUMBER,
"22",
StringResource("revanced_swipe_overlay_text_size_summary", "The text size for swipe overlay")
"revanced_swipe_text_overlay_size",
StringResource("revanced_swipe_text_overlay_size_title", "Swipe overlay text size"),
StringResource("revanced_swipe_text_overlay_size_summary", "The text size for swipe overlay"),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_overlay_background_alpha",
StringResource("revanced_swipe_overlay_background_alpha_title", "Swipe background visibility"),
InputType.NUMBER,
"127",
StringResource(
"revanced_swipe_overlay_background_alpha_summary",
"The visibility of swipe overlay background"
)
),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_magnitude_threshold",
StringResource("revanced_swipe_magnitude_threshold_title", "Swipe magnitude threshold"),
InputType.NUMBER,
"30",
"revanced_swipe_threshold",
StringResource("revanced_swipe_threshold_title", "Swipe magnitude threshold"),
StringResource(
"revanced_swipe_magnitude_threshold_summary",
"revanced_swipe_threshold_summary",
"The amount of threshold for swipe to occur"
)
),
InputType.NUMBER
)
),
StringResource("revanced_swipe_controls_summary","Control volume and brightness")
StringResource("revanced_swipe_controls_preference_screen_summary","Control volume and brightness")
)
)

View File

@ -33,11 +33,10 @@ class AutoCaptionsPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_autocaptions_enabled",
StringResource("revanced_autocaptions_enabled_title", "Disable auto captions"),
false,
StringResource("revanced_autocaptions_summary_on", "Auto captions are disabled"),
StringResource("revanced_autocaptions_summary_off", "Auto captions are enabled")
"revanced_auto_captions",
StringResource("revanced_auto_captions_title", "Disable auto captions"),
StringResource("revanced_auto_captions_summary_on", "Auto captions are disabled"),
StringResource("revanced_auto_captions_summary_off", "Auto captions are enabled")
)
)

View File

@ -27,34 +27,30 @@ class HideButtonsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen(
"revanced_hide_buttons",
StringResource("revanced_hide_buttons_title", "Hide action buttons"),
"revanced_hide_buttons_preference_screen",
StringResource("revanced_hide_buttons_preference_screen_title", "Hide action buttons"),
listOf(
SwitchPreference(
"revanced_hide_like_dislike_button",
StringResource("revanced_hide_like_dislike_button_title", "Hide like and dislike buttons"),
false,
StringResource("revanced_hide_like_dislike_button_summary_on", "Like and dislike buttons are hidden"),
StringResource("revanced_hide_like_dislike_button_summary_off", "Like and dislike buttons are shown")
),
SwitchPreference(
"revanced_hide_download_button",
StringResource("revanced_hide_download_button_title", "Hide download button"),
false,
StringResource("revanced_hide_download_button_summary_on", "Download button is hidden"),
StringResource("revanced_hide_download_button_summary_off", "Download button is shown")
),
SwitchPreference(
"revanced_hide_playlist_button",
StringResource("revanced_hide_playlist_button_title", "Hide playlist button"),
false,
StringResource("revanced_hide_playlist_button_summary_on", "Playlist button is hidden"),
StringResource("revanced_hide_playlist_button_summary_off", "Playlist button is shown")
),
SwitchPreference(
"revanced_hide_clip_button",
StringResource("revanced_hide_clip_button_title", "Hide clip button"),
false,
StringResource("revanced_hide_clip_button_summary_on", "Clip button is hidden"),
StringResource("revanced_hide_clip_button_summary_off", "Clip button is shown"),
StringResource("revanced_hide_clip_button_user_dialog_message",
@ -63,12 +59,11 @@ class HideButtonsPatch : ResourcePatch {
SwitchPreference(
"revanced_hide_action_buttons",
StringResource("revanced_hide_action_buttons_title", "Hide all other action buttons"),
false,
StringResource("revanced_hide_action_buttons_summary_on", "Share, remix, thanks, shop, live chat buttons are hidden"),
StringResource("revanced_hide_action_buttons_summary_off", "Share, remix, thanks, shop, live chat buttons are shown")
)
),
StringResource("revanced_hide_buttons_summary", "Hide or show buttons under videos")
StringResource("revanced_hide_buttons_preference_screen_summary", "Hide or show buttons under videos")
)
)
return PatchResultSuccess()

View File

@ -40,7 +40,6 @@ class HideAutoplayButtonPatch : BytecodePatch(
SwitchPreference(
"revanced_hide_autoplay_button",
StringResource("revanced_hide_autoplay_button_title", "Hide autoplay button"),
true,
StringResource("revanced_hide_autoplay_button_summary_on", "Autoplay button is hidden"),
StringResource("revanced_hide_autoplay_button_summary_off", "Autoplay button is shown")
),

View File

@ -32,7 +32,6 @@ class HideCaptionsButtonPatch : BytecodePatch(listOf(
SwitchPreference(
"revanced_hide_captions_button",
StringResource("revanced_hide_captions_button_title", "Hide captions button"),
false,
StringResource("revanced_hide_captions_button_summary_on", "Captions button is hidden"),
StringResource("revanced_hide_captions_button_summary_off", "Captions button is shown")
)

View File

@ -29,7 +29,6 @@ class HideCastButtonPatch : BytecodePatch() {
SwitchPreference(
"revanced_hide_cast_button",
StringResource("revanced_hide_cast_button_title", "Hide cast button"),
true,
StringResource("revanced_hide_cast_button_summary_on", "Cast button is hidden"),
StringResource("revanced_hide_cast_button_summary_off", "Cast button is shown")
)

View File

@ -41,27 +41,24 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen(
"revanced_navigation_buttons",
StringResource("revanced_navigation_buttons", "Navigation button settings"),
"revanced_navigation_buttons_preference_screen",
StringResource("revanced_navigation_buttons_preference_screen_title", "Navigation button settings"),
listOf(
SwitchPreference(
"revanced_hide_home_button",
StringResource("revanced_hide_home_button_title", "Hide home button"),
false,
StringResource("revanced_hide_home_button_summary_on", "Home button is hidden"),
StringResource("revanced_hide_home_button_summary_off", "Home button is shown")
),
SwitchPreference(
"revanced_hide_shorts_button",
StringResource("revanced_hide_shorts_button_title", "Hide shorts button"),
true,
StringResource("revanced_hide_shorts_button_summary_on", "Shorts button is hidden"),
StringResource("revanced_hide_shorts_button_summary_off", "Shorts button is shown")
),
SwitchPreference(
"revanced_hide_subscriptions_button",
StringResource("revanced_hide_subscriptions_button_title", "Hide subscriptions button"),
false,
StringResource(
"revanced_hide_subscriptions_button_summary_on",
"Home subscriptions is hidden"
@ -71,7 +68,6 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
SwitchPreference(
"revanced_hide_create_button",
StringResource("revanced_hide_create_button_title", "Hide create button"),
true,
StringResource("revanced_hide_create_button_summary_on", "Create button is hidden"),
StringResource("revanced_hide_create_button_summary_off", "Create button is shown")
),
@ -81,7 +77,6 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
"revanced_switch_create_with_notifications_button_title",
"Switch create with notifications button"
),
true,
StringResource(
"revanced_switch_create_with_notifications_button_summary_on",
"Create button is switched with notifications"

View File

@ -41,7 +41,6 @@ class HidePlayerButtonsPatch : BytecodePatch(
"revanced_hide_player_buttons_title",
"Hide previous & next video buttons"
),
false,
StringResource(
"revanced_hide_player_buttons_summary_on",
"Buttons are hidden"

View File

@ -27,7 +27,6 @@ class AlbumCardsResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_album_cards",
StringResource("revanced_hide_album_cards_title", "Hide album cards"),
false,
StringResource("revanced_hide_album_cards_summary_on", "Album cards are hidden"),
StringResource("revanced_hide_album_cards_summary_off", "Album cards are shown")
)

View File

@ -28,7 +28,6 @@ class HideArtistCardsPatch : ResourcePatch {
SwitchPreference(
"revanced_hide_artist_cards",
StringResource("revanced_hide_artist_cards_title", "Hide artist cards"),
false,
StringResource("revanced_hide_artist_cards_on", "Artist cards is hidden"),
StringResource("revanced_hide_artist_cards_off", "Artist cards is shown")
),

View File

@ -25,7 +25,6 @@ class BreakingNewsResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_breaking_news",
StringResource("revanced_hide_breaking_news_title", "Hide breaking news"),
true,
StringResource("revanced_hide_breaking_news_summary_on", "Breaking news are hidden"),
StringResource("revanced_hide_breaking_news_summary_off", "Breaking news are shown")
)

View File

@ -26,32 +26,29 @@ class CommentsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen(
"revanced_comments",
StringResource("revanced_comments_title", "Comments"),
"revanced_comments_preference_screen",
StringResource("revanced_comments_preference_screen_title", "Comments"),
listOf(
SwitchPreference(
"revanced_hide_comments_section",
StringResource("revanced_hide_comments_section_title", "Hide comments section"),
false,
StringResource("revanced_hide_comments_section_summary_on", "Comment section is hidden"),
StringResource("revanced_hide_comments_section_summary_off", "Comment section is shown")
),
SwitchPreference(
"revanced_hide_preview_comment",
StringResource("revanced_hide_preview_comment_title", "Hide preview comment"),
false,
StringResource("revanced_hide_preview_comment_on", "Preview comment is hidden"),
StringResource("revanced_hide_preview_comment_off", "Preview comment is shown")
),
SwitchPreference(
"revanced_hide_shorts_comments_button",
StringResource("revanced_hide_shorts_comments_button_title", "Hide shorts comments button"),
false,
StringResource("revanced_hide_shorts_comments_button_on", "Shorts comments button is hidden"),
StringResource("revanced_hide_shorts_comments_button_off", "Shorts comments button is shown")
),
),
StringResource("revanced_comments_summary", "Manage the visibility of comments section components")
StringResource("revanced_comments_preference_screen_summary", "Manage the visibility of comments section components")
)
)

View File

@ -27,7 +27,6 @@ class CrowdfundingBoxResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_crowdfunding_box",
StringResource("revanced_hide_crowdfunding_box_title", "Hide crowdfunding box"),
false,
StringResource("revanced_hide_crowdfunding_box_summary_on", "Crowdfunding box is hidden"),
StringResource("revanced_hide_crowdfunding_box_summary_off", "Crowdfunding box is shown")
)

View File

@ -29,7 +29,6 @@ class HideEndscreenCardsResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_endscreen_cards",
StringResource("revanced_hide_endscreen_cards_title", "Hide end screen cards"),
true,
StringResource("revanced_hide_endscreen_cards_summary_on", "End screen cards are hidden"),
StringResource("revanced_hide_endscreen_cards_summary_off", "End screen cards are shown")
),

View File

@ -30,7 +30,6 @@ class HideFilterBarResourcePatch : ResourcePatch {
"revanced_hide_filter_bar_feed_in_feed_title",
"Hide in feed"
),
false,
StringResource(
"revanced_hide_filter_bar_feed_in_feed_summary_on",
"Hidden in feed"
@ -46,7 +45,6 @@ class HideFilterBarResourcePatch : ResourcePatch {
"revanced_hide_filter_bar_feed_in_search_title",
"Hide in search"
),
false,
StringResource(
"revanced_hide_filter_bar_feed_in_search_summary_on",
"Hidden in search"
@ -62,7 +60,6 @@ class HideFilterBarResourcePatch : ResourcePatch {
"revanced_hide_filter_bar_feed_in_related_videos_title",
"Hide in related videos"
),
false,
StringResource(
"revanced_hide_filter_bar_feed_in_related_videos_summary_on",
"Hidden in related videos"

View File

@ -25,7 +25,6 @@ class HideFloatingMicrophoneButtonResourcePatch : ResourcePatch {
"revanced_hide_floating_microphone_button_enabled_title",
"Hide floating microphone button"
),
true,
StringResource("revanced_hide_floating_microphone_button_summary_on", "Microphone button hidden"),
StringResource("revanced_hide_floating_microphone_button_summary_off", "Microphone button shown")
)

View File

@ -36,7 +36,6 @@ class HideGetPremiumPatch : BytecodePatch(
SwitchPreference(
"revanced_hide_get_premium",
StringResource("revanced_hide_get_premium_title", "Hide YouTube Premium advertisement"),
true,
StringResource("revanced_hide_get_premium_summary_on", "YouTube Premium advertisement are hidden"),
StringResource("revanced_hide_get_premium_summary_off", "YouTube Premium advertisement are shown")
)

View File

@ -25,7 +25,6 @@ class HideInfocardsResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_infocards",
StringResource("revanced_hide_infocards_title", "Hide info cards"),
true,
StringResource("revanced_hide_infocards_summary_on", "Info cards are hidden"),
StringResource("revanced_hide_infocards_summary_off", "Info cards are shown")
)

View File

@ -21,7 +21,6 @@ class HideLoadMoreButtonResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_load_more_button",
StringResource("revanced_hide_load_more_button_title", "Hide Load More button"),
true,
StringResource("revanced_hide_load_more_button_summary_on", "Load More button is hidden"),
StringResource("revanced_hide_load_more_button_summary_off", "Load More button is shown")
)

View File

@ -27,7 +27,6 @@ class HideEmailAddressResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_email_address",
StringResource("revanced_hide_email_address_title", "Hide email in account switcher"),
false,
StringResource("revanced_hide_email_address_summary_on", "Email address is hidden"),
StringResource("revanced_hide_email_address_summary_off", "Email address is shown")
)

View File

@ -21,7 +21,6 @@ class HidePlayerOverlayResourcePatch : ResourcePatch {
SwitchPreference(
"revanced_hide_player_overlay",
StringResource("revanced_hide_player_overlay_title", "Hide background overlay in player"),
false,
StringResource("revanced_hide_player_overlay_summary_on", "Background overlay is hidden"),
StringResource("revanced_hide_player_overlay_summary_off", "Background overlay is shown")
)

View File

@ -38,7 +38,6 @@ class HideSeekbarPatch : BytecodePatch(
SwitchPreference(
"revanced_hide_seekbar",
StringResource("revanced_hide_seekbar_title", "Hide seekbar"),
false,
StringResource("revanced_hide_seekbar_summary_on", "Seekbar is hidden"),
StringResource("revanced_hide_seekbar_summary_off", "Seekbar is shown")
)

View File

@ -33,7 +33,6 @@ class HideTimestampPatch : BytecodePatch(
SwitchPreference(
"revanced_hide_timestamp",
StringResource("revanced_hide_timestamp_title", "Hide video timestamp"),
false,
StringResource("revanced_hide_timestamp_summary_on", "Timestamp is hidden"),
StringResource("revanced_hide_timestamp_summary_off", "Timestamp is shown")
)

View File

@ -33,7 +33,6 @@ class WatchInVRPatch : BytecodePatch(
SwitchPreference(
"revanced_hide_watch_in_vr",
StringResource("revanced_hide_watch_in_vr_title", "Hide VR setting"),
false,
StringResource("revanced_hide_watch_in_vr_summary_on", "VR setting is hidden"),
StringResource("revanced_hide_watch_in_vr_summary_off", "VR setting is shown")
)

View File

@ -37,7 +37,6 @@ class HideWatermarkPatch : BytecodePatch(
SwitchPreference(
"revanced_hide_video_watermark",
StringResource("revanced_hide_video_watermark_title", "Hide creator watermark on videos"),
true,
StringResource("revanced_hide_video_watermark_summary_on", "Watermark is hidden"),
StringResource("revanced_hide_video_watermark_summary_off", "Watermark is shown")
)

View File

@ -37,7 +37,6 @@ class FullscreenPanelsRemoverPatch : BytecodePatch(
SwitchPreference(
"revanced_hide_fullscreen_panels",
StringResource("revanced_hide_fullscreen_panels_title", "Hide fullscreen panels"),
true,
StringResource("revanced_hide_fullscreen_panels_summary_on", "Fullscreen panels are hidden"),
StringResource("revanced_hide_fullscreen_panels_summary_off", "Fullscreen panels are shown")
)

View File

@ -32,11 +32,10 @@ class PlayerPopupPanelsPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_player_popup_panels_enabled",
StringResource("revanced_player_popup_panels_title", "Disable player popup panels"),
false,
StringResource("revanced_player_popup_panels_summary_on", "Player popup panels are disabled"),
StringResource("revanced_player_popup_panels_summary_off", "Player popup panels are enabled")
"revanced_hide_player_popup_panels",
StringResource("revanced_hide_player_popup_panels_title", "Hide player popup panels"),
StringResource("revanced_hide_player_popup_panels_summary_on", "Player popup panels are hidden"),
StringResource("revanced_hide_player_popup_panels_summary_off", "Player popup panels are shown")
)
)

View File

@ -30,12 +30,12 @@ class ReturnYouTubeDislikeResourcePatch : ResourcePatch {
SettingsPatch.addPreference(
Preference(
StringResource("revanced_ryd_settings_title", "Return YouTube Dislike"),
StringResource("revanced_ryd_settings_summary", "Settings for Return YouTube Dislike"),
Preference.Intent(
youtubePackage,
"ryd_settings",
"com.google.android.libraries.social.licenses.LicenseActivity"
),
StringResource("revanced_ryd_settings_summary", "Settings for Return YouTube Dislike"),
)
)
)
// merge strings

View File

@ -38,7 +38,6 @@ class WideSearchbarPatch : BytecodePatch(
SwitchPreference(
"revanced_wide_searchbar",
StringResource("revanced_wide_searchbar_enabled_title", "Enable wide search bar"),
false,
StringResource("revanced_wide_searchbar_summary_on", "Wide search bar is enabled"),
StringResource("revanced_wide_searchbar_summary_off", "Wide search bar is disabled")
)

View File

@ -28,12 +28,12 @@ class SponsorBlockResourcePatch : ResourcePatch {
SettingsPatch.addPreference(
Preference(
StringResource("sb_settings", "SponsorBlock"),
StringResource("revanced_sponsorblock_settings_summary", "SponsorBlock related settings"),
Preference.Intent(
youtubePackage,
"sponsorblock_settings",
"com.google.android.libraries.social.licenses.LicenseActivity"
),
StringResource("revanced_sponsorblock_settings_summary", "SponsorBlock related settings"),
)
)
)
val classLoader = this.javaClass.classLoader

View File

@ -37,12 +37,12 @@ class SpoofAppVersionPatch : BytecodePatch(
SwitchPreference(
"revanced_spoof_app_version",
StringResource("revanced_spoof_app_version_title", "Spoof app version"),
false,
StringResource("revanced_spoof_app_version_summary_on", "Version spoofed"),
StringResource("revanced_spoof_app_version_summary_off", "Version not spoofed"),
StringResource("revanced_spoof_app_version_user_dialog_message",
"App version will be spoofed to an older version of YouTube. This will change the appearance of the app, but unknown side effects may occur."
+ " If later turned off, the old UI may remain until you log out or clear the app data.")
"App version will be spoofed to an older version of YouTube."
+ "\\n\\nThis will change the appearance and features of the app, but unknown side effects may occur."
+ "\\n\\nIf later turned off, the old UI may remain until you log out or clear the app data.")
),
ListPreference(
"revanced_spoof_app_version_target",

View File

@ -31,11 +31,10 @@ class DisableShortsOnStartupPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_startup_shorts_player_enabled",
StringResource("revanced_startup_shorts_player_title", "Disable shorts player at app startup"),
false,
StringResource("revanced_startup_shorts_player_summary_on", "Shorts player is disabled at app startup"),
StringResource("revanced_startup_shorts_player_summary_off", "Shorts player is enabled at app startup")
"revanced_disable_resuming_shorts_player",
StringResource("revanced_disable_resuming_shorts_player_title", "Disable shorts player at app startup"),
StringResource("revanced_disable_resuming_shorts_player_summary_on", "Shorts player is disabled at app startup"),
StringResource("revanced_disable_resuming_shorts_player_summary_off", "Shorts player is enabled at app startup")
)
)

View File

@ -42,7 +42,6 @@ class TabletMiniPlayerPatch : BytecodePatch(
SwitchPreference(
"revanced_tablet_miniplayer",
StringResource("revanced_tablet_miniplayer_title", "Enable tablet mini player"),
false,
StringResource("revanced_tablet_miniplayer_summary_on", "Mini player is enabled"),
StringResource("revanced_tablet_miniplayer_summary_off", "Mini player is disabled")
)

View File

@ -8,8 +8,6 @@ import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.youtube.layout.seekbar.bytecode.patch.SeekbarColorBytecodePatch
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.SetSeekbarClickedColorFingerprint
import app.revanced.patches.youtube.layout.theme.resource.ThemeResourcePatch
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
@ -19,9 +17,7 @@ import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
@DependsOn([LithoColorHookPatch::class, SeekbarColorBytecodePatch::class, ThemeResourcePatch::class])
@ThemeCompatibility
@Version("0.0.1")
class ThemeBytecodePatch : BytecodePatch(
listOf(CreateDarkThemeSeekbarFingerprint, SetSeekbarClickedColorFingerprint)
) {
class ThemeBytecodePatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult {
LithoColorHookPatch.lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getValue")

View File

@ -21,12 +21,11 @@ class ThemeResourcePatch : ResourcePatch {
TextPreference(
"revanced_seekbar_color",
StringResource("revanced_seekbar_color_title", "Seekbar color"),
InputType.STRING,
"#FF0000",
StringResource(
"revanced_seekbar_color_summary",
"The color of the seekbar"
)
),
InputType.TEXT_CAP_CHARACTERS
),
)

View File

@ -35,9 +35,8 @@ class AutoRepeatPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference(
"revanced_pref_auto_repeat",
StringResource("revanced_auto_repeat_enabled_title", "Enable auto-repeat"),
false,
"revanced_auto_repeat",
StringResource("revanced_auto_repeat_title", "Enable auto-repeat"),
StringResource("revanced_auto_repeat_summary_on", "Auto-repeat is enabled"),
StringResource("revanced_auto_repeat_summary_off", "Auto-repeat is disabled")
)

View File

@ -26,43 +26,40 @@ class DebuggingPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
app.revanced.patches.shared.settings.preference.impl.PreferenceScreen(
"revanced_debug",
StringResource("revanced_debug_title", "Debugging"),
"revanced_debug_preference_screen",
StringResource("revanced_debug_preference_screen_title", "Debugging"),
listOf(
SwitchPreference(
"revanced_debug_enabled",
StringResource("revanced_debug_enabled_title", "Debug logging"),
false,
"revanced_debug",
StringResource("revanced_debug_title", "Debug logging"),
StringResource("revanced_debug_summary_on", "Debug logs are enabled"),
StringResource("revanced_debug_summary_off", "Debug logs are disabled")
),
SwitchPreference(
"revanced_debug_stacktrace_enabled",
"revanced_debug_stacktrace",
StringResource(
"revanced_debug_stacktrace_enabled_title",
"revanced_debug_stacktrace_title",
"Log stack traces"
),
false,
StringResource("revanced_debug_stacktrace_summary_on", "Debug logs include stack trace"),
StringResource("revanced_debug_stacktrace_summary_off", "Debug logs do not include stack trace")
),
SwitchPreference(
"revanced_debug_toast_on_error_enabled",
"revanced_debug_toast_on_error",
StringResource(
"revanced_debug_toast_on_error_enabled_title",
"revanced_debug_toast_on_error_title",
"Show toast on ReVanced error"
),
true,
StringResource("revanced_debug_toast_on_error_summary_on", "Toast shown if error occurs"),
StringResource("revanced_debug_toast_on_error_summary_off", "Toast not shown if error occurs"),
StringResource("revanced_debug_toast_on_error_user_dialog_message",
"Turning off error toasts hides all ReVanced error notifications." +
" This includes hiding normal network connection timeouts, " +
"but also hides notification of any unexpected and more serious errors."
"Turning off error toasts hides all ReVanced error notifications."
+ "\\n\\nThis includes hiding normal network connection timeouts, "
+ "but also hides notification of any unexpected and more serious errors."
)
),
),
StringResource("revanced_debug_summary", "Enable or disable debugging options")
StringResource("revanced_debug_preference_screen_summary", "Enable or disable debugging options")
)
)

View File

@ -45,7 +45,6 @@ class SpoofSignatureVerificationPatch : BytecodePatch(
SwitchPreference(
"revanced_spoof_signature_verification",
StringResource("revanced_spoof_signature_verification_title", "Spoof app signature"),
true,
StringResource("revanced_spoof_signature_verification_summary_on",
"App signature spoofed\\n\\n"
+ "Side effects include:\\n"

View File

@ -34,11 +34,10 @@ class OpenLinksExternallyPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference(
"revanced_enable_external_browser",
StringResource("revanced_enable_external_browser_title", "Open links in browser"),
true,
StringResource("revanced_enable_external_browser_summary_on", "Opening links externally"),
StringResource("revanced_enable_external_browser_summary_off", "Opening links in app")
"revanced_external_browser",
StringResource("revanced_external_browser_title", "Open links in browser"),
StringResource("revanced_external_browser_summary_on", "Opening links externally"),
StringResource("revanced_external_browser_summary_off", "Opening links in app")
)
)

View File

@ -32,8 +32,8 @@ class MicroGResourcePatch : ResourcePatch {
SettingsPatch.addPreference(
Preference(
StringResource("microg_settings", "MicroG Settings"),
Preference.Intent("$MICROG_VENDOR.android.gms", "", "org.microg.gms.ui.SettingsActivity"),
StringResource("microg_settings_summary", "Settings for MicroG"),
Preference.Intent("$MICROG_VENDOR.android.gms", "", "org.microg.gms.ui.SettingsActivity")
)
)
SettingsPatch.renameIntentsTargetPackage(REVANCED_PACKAGE_NAME)

View File

@ -10,10 +10,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.addPreference
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
import app.revanced.patches.shared.settings.preference.impl.Preference
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.*
import app.revanced.patches.shared.settings.resource.patch.AbstractSettingsResourcePatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.util.resources.ResourceUtils
@ -71,10 +68,20 @@ class SettingsResourcePatch : AbstractSettingsResourcePatch(
SettingsPatch.addPreference(
Preference(
StringResource("revanced_settings", "ReVanced"),
StringResource("revanced_settings_summary", "ReVanced specific settings"),
Preference.Intent(
youtubePackage, "revanced_settings", "com.google.android.libraries.social.licenses.LicenseActivity"
),
StringResource("revanced_settings_summary", "ReVanced specific settings"),
)
)
)
SettingsPatch.PreferenceScreen.MISC.addPreferences(
TextPreference(
key = null,
title = StringResource("revanced_pref_import_export_title", "Import / Export"),
summary = StringResource("revanced_pref_import_export_summary", "Import / Export ReVanced settings"),
inputType = InputType.TEXT_MULTI_LINE,
tag = "app.revanced.integrations.settingsmenu.ImportExportPreference"
)
)

View File

@ -32,7 +32,6 @@ class ZoomHapticsPatch : BytecodePatch(
SwitchPreference(
"revanced_disable_zoom_haptics",
StringResource("revanced_disable_zoom_haptics_title", "Disable zoom haptics"),
true,
StringResource("revanced_disable_zoom_haptics_summary_on", "Haptics are disabled"),
StringResource("revanced_disable_zoom_haptics_summary_off", "Haptics are enabled")
)

View File

@ -32,11 +32,10 @@ class HDRBrightnessPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
SwitchPreference(
"revanced_pref_hdr_autobrightness",
StringResource("revanced_hdr_autobrightness_enabled_title", "Enable auto HDR brightness"),
true,
StringResource("revanced_hdr_autobrightness_summary_on", "Auto HDR brightness is enabled"),
StringResource("revanced_hdr_autobrightness_summary_off", "Auto HDR brightness is disabled")
"revanced_hdr_auto_brightness",
StringResource("revanced_hdr_auto_brightness_title", "Enable auto HDR brightness"),
StringResource("revanced_hdr_auto_brightness_summary_on", "Auto HDR brightness is enabled"),
StringResource("revanced_hdr_auto_brightness_summary_off", "Auto HDR brightness is disabled")
)
)

View File

@ -32,11 +32,10 @@ class OldQualityLayoutPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
SwitchPreference(
"revanced_use_old_style_quality_settings",
StringResource("revanced_old_style_quality_settings_enabled_title", "Use old video quality player menu"),
true,
StringResource("revanced_old_style_quality_settings_summary_on", "Old video quality menu is used"),
StringResource("revanced_old_style_quality_settings_summary_off", "Old video quality menu is not used")
"revanced_show_old_video_menu",
StringResource("revanced_show_old_video_menu_title", "Use old video quality player menu"),
StringResource("revanced_show_old_video_menu_summary_on", "Old video quality menu is used"),
StringResource("revanced_show_old_video_menu_summary_off", "Old video quality menu is not used")
)
)

View File

@ -44,26 +44,26 @@ class RememberVideoQualityPatch : BytecodePatch(
// This is bloated as each value has it's own String key/value
// ideally the entries would be raw values (and not a key to a String resource)
val entries = listOf(
StringResource("revanced_default_quality_entry_1", "Automatic quality"),
StringResource("revanced_default_quality_entry_2", "2160p"),
StringResource("revanced_default_quality_entry_3", "1440p"),
StringResource("revanced_default_quality_entry_4", "1080p"),
StringResource("revanced_default_quality_entry_5", "720p"),
StringResource("revanced_default_quality_entry_6", "480p"),
StringResource("revanced_default_quality_entry_7", "360p"),
StringResource("revanced_default_quality_entry_8", "280p"),
StringResource("revanced_default_quality_entry_9", "144p"),
StringResource("revanced_video_quality_default_entry_1", "Automatic quality"),
StringResource("revanced_video_quality_default_entry_2", "2160p"),
StringResource("revanced_video_quality_default_entry_3", "1440p"),
StringResource("revanced_video_quality_default_entry_4", "1080p"),
StringResource("revanced_video_quality_default_entry_5", "720p"),
StringResource("revanced_video_quality_default_entry_6", "480p"),
StringResource("revanced_video_quality_default_entry_7", "360p"),
StringResource("revanced_video_quality_default_entry_8", "280p"),
StringResource("revanced_video_quality_default_entry_9", "144p"),
)
val entryValues = listOf(
StringResource("revanced_default_quality_entry_value_1", "-2"),
StringResource("revanced_default_quality_entry_value_2", "2160"),
StringResource("revanced_default_quality_entry_value_3", "1440"),
StringResource("revanced_default_quality_entry_value_4", "1080"),
StringResource("revanced_default_quality_entry_value_5", "720"),
StringResource("revanced_default_quality_entry_value_6", "480"),
StringResource("revanced_default_quality_entry_value_7", "360"),
StringResource("revanced_default_quality_entry_value_8", "280"),
StringResource("revanced_default_quality_entry_value_9", "144"),
StringResource("revanced_video_quality_default_entry_value_1", "-2"),
StringResource("revanced_video_quality_default_entry_value_2", "2160"),
StringResource("revanced_video_quality_default_entry_value_3", "1440"),
StringResource("revanced_video_quality_default_entry_value_4", "1080"),
StringResource("revanced_video_quality_default_entry_value_5", "720"),
StringResource("revanced_video_quality_default_entry_value_6", "480"),
StringResource("revanced_video_quality_default_entry_value_7", "360"),
StringResource("revanced_video_quality_default_entry_value_8", "280"),
StringResource("revanced_video_quality_default_entry_value_9", "144"),
)
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
@ -73,7 +73,6 @@ class RememberVideoQualityPatch : BytecodePatch(
"revanced_remember_video_quality_last_selected_title",
"Remember video quality changes"
),
false,
StringResource(
"revanced_remember_video_quality_last_selected_summary_on",
"Quality changes apply to all videos"
@ -84,23 +83,23 @@ class RememberVideoQualityPatch : BytecodePatch(
)
),
ListPreference(
"revanced_default_video_quality_wifi",
"revanced_video_quality_default_wifi",
StringResource(
"revanced_default_video_quality_wifi_title",
"revanced_video_quality_default_wifi_title",
"Default video quality on Wi-Fi network"
),
ArrayResource("revanced_video_quality_wifi_entry", entries),
ArrayResource("revanced_video_quality_wifi_entry_values", entryValues)
ArrayResource("revanced_video_quality_default_wifi_entry", entries),
ArrayResource("revanced_video_quality_default_wifi_entry_values", entryValues)
// default value and summary are set by integrations after loading
),
ListPreference(
"revanced_default_video_quality_mobile",
"revanced_video_quality_default_mobile",
StringResource(
"revanced_default_video_quality_mobile_title",
"revanced_video_quality_default_mobile_title",
"Default video quality on mobile network"
),
ArrayResource("revanced_video_quality_mobile_entries", entries),
ArrayResource("revanced_video_quality_mobile_entry_values", entryValues)
ArrayResource("revanced_video_quality_default_mobile_entries", entries),
ArrayResource("revanced_video_quality_default_mobile_values", entryValues)
)
)

View File

@ -34,17 +34,16 @@ class CustomVideoSpeedPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
TextPreference(
key = "revanced_custom_video_speeds",
key = "revanced_custom_playback_speeds",
title = StringResource(
"revanced_custom_video_speeds_title",
"revanced_custom_playback_speeds_title",
"Custom playback speeds"
),
inputType = InputType.TEXT_MULTI_LINE,
summary = StringResource(
"revanced_custom_video_speeds_summary",
"revanced_custom_playback_speeds_summary",
"Add or change the video speeds available"
),
default = "0.25\n0.5\n0.75\n0.9\n0.95\n1.0\n1.05\n1.1\n1.25\n1.5\n1.75\n2.0\n3.0\n4.0\n5.0"
)
)
)

View File

@ -40,7 +40,6 @@ class RememberPlaybackSpeedPatch : BytecodePatch(
"revanced_remember_playback_speed_last_selected_title",
"Remember playback speed changes"
),
true,
StringResource(
"revanced_remember_playback_speed_last_selected_summary_on",
"Playback speed changes apply to all videos"
@ -51,21 +50,21 @@ class RememberPlaybackSpeedPatch : BytecodePatch(
)
),
ListPreference(
"revanced_default_playback_speed",
"revanced_playback_speed_default",
StringResource(
"revanced_default_playback_speed_title",
"revanced_playback_speed_default_title",
"Default playback speed"
),
// Dummy data:
// Entries and values are set by Integrations code based on the actual speeds available,
// and the values set here are ignored and do nothing.
ArrayResource(
"revanced_default_playback_speed_entries",
listOf(StringResource("revanced_default_playback_speed_entry", "1.0x"))
"revanced_playback_speed_default_entries",
listOf(StringResource("revanced_playback_speed_default_entries", "1.0x"))
),
ArrayResource(
"revanced_default_playback_speed_entry_values",
listOf(StringResource("revanced_default_playback_speed_entry_value", "1.0"))
"revanced_playback_speed_default_entry_values",
listOf(StringResource("revanced_playback_speed_default_entry_value", "1.0"))
)
)
)

View File

@ -2,4 +2,10 @@
<resources>
<string name="revanced_settings_confirm_user_dialog_title">Do you wish to proceed?</string>
<string name="revanced_settings_reset">Reset</string>
<string name="revanced_settings_import">Import</string>
<string name="revanced_settings_import_copy">Copy</string>
<string name="revanced_settings_import_reset">ReVanced settings reset to default</string>
<string name="revanced_settings_import_success">Imported %d settings</string>
<string name="revanced_settings_import_failure_parse">Import failed: %s</string>
</resources>

View File

@ -42,17 +42,21 @@
<string name="sb_general_min_duration_sum">Segments shorter than this value (in seconds) will not be shown or skipped</string>
<string name="sb_general_uuid">Your private user id</string>
<string name="sb_general_uuid_sum">This should be kept private. This is like a password and should not be shared with anyone. If someone has this, they can impersonate you</string>
<string name="sb_general_uuid_invalid">User id cannot be blank</string>
<string name="sb_general_uuid_invalid">Private user id must be at least 30 characters long</string>
<string name="sb_general_api_url">Change API URL</string>
<string name="sb_general_api_url_sum">The address SponsorBlock uses to make calls to the server. Do not change this unless you know what you\'re doing</string>
<string name="sb_api_url_reset">API URL reset</string>
<string name="sb_api_url_invalid">API URL is invalid</string>
<string name="sb_api_url_changed">API URL changed</string>
<string name="sb_settings_ie">Import/Export settings</string>
<string name="sb_settings_copy">Copy</string>
<string name="sb_settings_ie_sum">Your SponsorBlock JSON configuration that can be imported/exported to ReVanced and other SponsorBlock platforms. This includes your private user id. Be sure to share this wisely</string>
<string name="sb_settings_import_successful">Settings imported successfully</string>
<string name="sb_settings_import_failed">Failed to import: %s</string>
<string name="sb_settings_export_failed">Failed to export settings (try clearing app data)</string>
<string name="sb_settings_export_failed">Failed to export: %s</string>
<string name="sb_settings_revanced_export_user_id_warning">Your settings contain a private SponsorBlock user id.\n\nYour user id is like a password and it should never be shared.\n</string>
<string name="sb_settings_revanced_export_user_id_warning_dismiss">Do not show again</string>
<string name="sb_diff_segments">Change segment behavior</string>
<string name="sb_segments_sponsor">Sponsor</string>