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

View File

@ -10,7 +10,7 @@ import org.w3c.dom.Node
* @param resource The resource to add. * @param resource The resource to add.
* @param resourceCallback Called when a resource has been processed. * @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)) appendChild(resource.serialize(ownerDocument, resourceCallback))
} }
@ -20,7 +20,7 @@ internal fun Node.addResource(resource: BaseResource, resourceCallback: ((IResou
* @param preference The preference to add. * @param preference The preference to add.
* @param resourceCallback Called when a resource has been processed. * @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)) appendChild(preference.serialize(ownerDocument, resourceCallback))
} }
@ -30,10 +30,11 @@ internal fun Element.addSummary(summaryResource: StringResource?, summaryType: S
} }
internal fun <T> Element.addDefault(default: T) { 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 { default?.let {
setAttribute( setAttribute(
"android:defaultValue", when (it) { "android:defaultValue", when (it) {
is Boolean -> if (it) "true" else "false" is Boolean -> it.toString()
is String -> it is String -> it
else -> throw IllegalArgumentException("Unsupported default value type: ${it::class.java.name}") 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 package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BaseResource 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.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 name The name of the array resource.
* @param items The items 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 class ArrayResource(
internal data class ArrayResource( name: String,
override val name: String,
val items: List<StringResource> val items: List<StringResource>
) : BaseResource(name) { ) : BaseResource(name, "string-array") {
override val tag = "string-array" override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element {
return super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("name", name) setAttribute("name", name)
items.forEach { item -> items.forEach { item ->
resourceCallback?.invoke(item) resourceCallback.invoke(item)
this.appendChild(ownerDocument.createElement("item").also { itemNode -> this.appendChild(ownerDocument.createElement("item").also { itemNode ->
itemNode.textContent = "@string/${item.name}" itemNode.textContent = "@string/${item.name}"
}) })
} }
} }
}
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,35 +1,29 @@
package app.revanced.patches.shared.settings.preference.impl package app.revanced.patches.shared.settings.preference.impl
import app.revanced.patches.shared.settings.preference.BasePreference import app.revanced.patches.shared.settings.preference.BaseResource
import app.revanced.patches.shared.settings.preference.IResource import app.revanced.patches.shared.settings.preference.DefaultBasePreference
import app.revanced.patches.shared.settings.preference.addDefault
import app.revanced.patches.shared.settings.preference.addSummary
import org.w3c.dom.Document import org.w3c.dom.Document
import org.w3c.dom.Element
/** /**
* Text preference. * A text preference.
* *
* @param key The key of the text preference. * @param key The key of the text preference.
* @param title The title of the text preference. * @param title The title of the text preference.
* @param inputType The input type 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 summary The summary of the text preference.
* @param default The default value of the text preference.
*/ */
internal class TextPreference( internal class TextPreference(
key: String, key: String?,
title: StringResource, title: StringResource,
var inputType: InputType = InputType.STRING, summary: StringResource?,
val default: String? = null, val inputType: InputType = InputType.TEXT,
val summary: StringResource? = null default: String? = null,
) : BasePreference(key, title) { tag: String = "app.revanced.integrations.settingsmenu.ResettableEditTextPreference"
override val tag: String = "app.revanced.integrations.settingsmenu.ResettableEditTextPreference" ) : DefaultBasePreference<String>(key, title, summary, tag, default) {
override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element { override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
return super.serialize(ownerDocument, resourceCallback).apply { super.serialize(ownerDocument, resourceCallback).apply {
setAttribute("android:inputType", inputType.type) 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.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patches.shared.settings.preference.BasePreference 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.addPreference
import app.revanced.patches.shared.settings.preference.addResource import app.revanced.patches.shared.settings.preference.addResource
import app.revanced.patches.shared.settings.preference.impl.ArrayResource import app.revanced.patches.shared.settings.preference.impl.ArrayResource
@ -108,7 +108,7 @@ abstract class AbstractSettingsResourcePatch(
* *
* @throws IllegalArgumentException if the resource already exists. * @throws IllegalArgumentException if the resource already exists.
*/ */
internal fun IResource.include() { internal fun BaseResource.include() {
when (this) { when (this) {
is StringResource -> { is StringResource -> {
if (strings.any { it.name == name }) return if (strings.any { it.name == name }) return

View File

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

View File

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

View File

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

View File

@ -98,7 +98,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
StringResource("key_revanced_deleted_messages_cross_out", "cross-out") 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", "revanced_auto_claim_channel_points",
"Automatically claim Channel Points" "Automatically claim Channel Points"
), ),
true,
StringResource( StringResource(
"revanced_auto_claim_channel_points_on", "revanced_auto_claim_channel_points_on",
"Channel Points are claimed automatically" "Channel Points are claimed automatically"
@ -45,6 +44,7 @@ class AutoClaimChannelPointPatch : BytecodePatch(
"revanced_auto_claim_channel_points_off", "revanced_auto_claim_channel_points_off",
"Channel Points are not claimed automatically" "Channel Points are not claimed automatically"
), ),
default = true
) )
) )

View File

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

View File

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

View File

@ -26,25 +26,23 @@ class CopyVideoUrlResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences( SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen( PreferenceScreen(
"revanced_copy_video_url", "revanced_copy_video_url_preference_screen",
StringResource("revanced_copy_video_url_title", "Copy video URL settings"), StringResource("revanced_copy_video_url_preference_screen_title", "Copy video URL settings"),
listOf( listOf(
SwitchPreference( SwitchPreference(
"revanced_copy_video_url_enabled", "revanced_copy_video_url",
StringResource("revanced_copy_video_url_enabled_title", "Show copy video URL button"), StringResource("revanced_copy_video_url_title", "Show copy video URL button"),
true, StringResource("revanced_copy_video_url_summary_on", "Button is shown, click to copy video URL without timestamp"),
StringResource("revanced_copy_video_url_enabled_summary_on", "Button is shown, click to copy video URL without timestamp"), StringResource("revanced_copy_video_url_summary_off", "Button is not shown")
StringResource("revanced_copy_video_url_enabled_summary_off", "Button is not shown")
), ),
SwitchPreference( SwitchPreference(
"revanced_copy_video_url_timestamp_enabled", "revanced_copy_video_url_timestamp",
StringResource("revanced_copy_video_url_timestamp_enabled_title", "Show copy timestamp URL button"), StringResource("revanced_copy_video_url_timestamp_title", "Show copy timestamp URL button"),
true, StringResource("revanced_copy_video_url_timestamp_summary_on", "Button is shown, click to copy video URL with timestamp"),
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_summary_off", "Button is not shown")
StringResource("revanced_copy_video_url_timestamp_enabled_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 { override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences( SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen( PreferenceScreen(
"revanced_downloads", "revanced_external_downloader_preference_screen",
StringResource("revanced_downloads_title", "Download settings"), StringResource("revanced_external_downloader_preference_screen_title", "Download settings"),
listOf( listOf(
SwitchPreference( SwitchPreference(
"revanced_downloads_enabled", "revanced_external_downloader",
StringResource("revanced_downloads_enabled_title", "Show download button"), StringResource("revanced_external_downloader_title", "Show download button"),
true, StringResource("revanced_external_downloader_summary_on", "Download button is shown"),
StringResource("revanced_downloads_enabled_summary_on", "Download button is shown"), StringResource("revanced_external_downloader_summary_off", "Download button is not shown")
StringResource("revanced_downloads_enabled_summary_off", "Download button is not shown")
), ),
TextPreference( TextPreference(
"revanced_downloads_package_name", "revanced_external_downloader_name",
StringResource("revanced_downloads_package_name_title", "Downloader package name"), StringResource("revanced_external_downloader_name_title", "Downloader package name"),
InputType.STRING, StringResource("revanced_external_downloader_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s"),
"org.schabi.newpipe" /* NewPipe */, InputType.TEXT
StringResource("revanced_downloads_package_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s")
) )
), ),
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 { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences( SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_enable_tap_seeking", "revanced_tap_seeking",
StringResource("revanced_seekbar_tapping_enabled_title", "Enable seekbar tapping"), StringResource("revanced_tap_seeking_title", "Enable seekbar tapping"),
true, StringResource("revanced_tap_seeking_summary_on", "Seekbar tapping is enabled"),
StringResource("revanced_seekbar_tapping_summary_on", "Seekbar tapping is enabled"), StringResource("revanced_tap_seeking_summary_off", "Seekbar tapping is disabled")
StringResource("revanced_seekbar_tapping_summary_off", "Seekbar tapping is disabled")
) )
) )

View File

@ -25,74 +25,68 @@ class SwipeControlsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences( SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen( 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( SwitchPreference(
"revanced_enable_swipe_brightness", "revanced_swipe_brightness",
StringResource("revanced_swipe_brightness_enabled_title", "Enable brightness gesture"), StringResource("revanced_swipe_brightness_title", "Enable brightness gesture"),
true,
StringResource("revanced_swipe_brightness_summary_on", "Brightness swipe is enabled"), StringResource("revanced_swipe_brightness_summary_on", "Brightness swipe is enabled"),
StringResource("revanced_swipe_brightness_summary_off", "Brightness swipe is disabled") StringResource("revanced_swipe_brightness_summary_off", "Brightness swipe is disabled")
), ),
SwitchPreference( SwitchPreference(
"revanced_enable_swipe_volume", "revanced_swipe_volume",
StringResource("revanced_swipe_volume_enabled_title", "Enable volume gesture"), StringResource("revanced_swipe_volume_title", "Enable volume gesture"),
true,
StringResource("revanced_swipe_volume_summary_on", "Volume swipe is enabled"), StringResource("revanced_swipe_volume_summary_on", "Volume swipe is enabled"),
StringResource("revanced_swipe_volume_summary_off", "Volume swipe is disabled") StringResource("revanced_swipe_volume_summary_off", "Volume swipe is disabled")
), ),
SwitchPreference( SwitchPreference(
"revanced_enable_press_to_swipe", "revanced_swipe_press_to_engage",
StringResource("revanced_press_to_swipe_enabled_title", "Enable press-to-swipe gesture"), StringResource("revanced_swipe_press_to_engage_title", "Enable press-to-swipe gesture"),
false, StringResource("revanced_swipe_press_to_engage_summary_on", "Press-to-swipe is enabled"),
StringResource("revanced_press_to_swipe_summary_on", "Press-to-swipe is enabled"), StringResource("revanced_swipe_press_to_engage_summary_off", "Press-to-swipe is disabled")
StringResource("revanced_press_to_swipe_summary_off", "Press-to-swipe is disabled")
), ),
SwitchPreference( SwitchPreference(
"revanced_enable_swipe_haptic_feedback", "revanced_swipe_haptic_feedback",
StringResource("revanced_swipe_haptic_feedback_enabled_title", "Enable haptic feedback"), StringResource("revanced_swipe_haptic_feedback_title", "Enable haptic feedback"),
true,
StringResource("revanced_swipe_haptic_feedback_summary_on", "Haptic feedback is enabled"), StringResource("revanced_swipe_haptic_feedback_summary_on", "Haptic feedback is enabled"),
StringResource("revanced_swipe_haptic_feedback_summary_off", "Haptic feedback is disabled") StringResource("revanced_swipe_haptic_feedback_summary_off", "Haptic feedback is disabled")
), ),
TextPreference( TextPreference(
"revanced_swipe_overlay_timeout", "revanced_swipe_overlay_timeout",
StringResource("revanced_swipe_overlay_timeout_title", "Swipe overlay timeout"), StringResource("revanced_swipe_overlay_timeout_title", "Swipe overlay timeout"),
InputType.NUMBER,
"500",
StringResource( StringResource(
"revanced_swipe_overlay_timeout_summary", "revanced_swipe_overlay_timeout_summary",
"The amount of milliseconds the overlay is visible" "The amount of milliseconds the overlay is visible"
) ),
InputType.NUMBER
), ),
TextPreference( TextPreference(
"revanced_swipe_overlay_text_size", "revanced_swipe_text_overlay_size",
StringResource("revanced_swipe_overlay_text_size_title", "Swipe overlay text size"), StringResource("revanced_swipe_text_overlay_size_title", "Swipe overlay text size"),
InputType.NUMBER, StringResource("revanced_swipe_text_overlay_size_summary", "The text size for swipe overlay"),
"22", InputType.NUMBER
StringResource("revanced_swipe_overlay_text_size_summary", "The text size for swipe overlay")
), ),
TextPreference( TextPreference(
"revanced_swipe_overlay_background_alpha", "revanced_swipe_overlay_background_alpha",
StringResource("revanced_swipe_overlay_background_alpha_title", "Swipe background visibility"), StringResource("revanced_swipe_overlay_background_alpha_title", "Swipe background visibility"),
InputType.NUMBER,
"127",
StringResource( StringResource(
"revanced_swipe_overlay_background_alpha_summary", "revanced_swipe_overlay_background_alpha_summary",
"The visibility of swipe overlay background" "The visibility of swipe overlay background"
) ),
InputType.NUMBER
), ),
TextPreference( TextPreference(
"revanced_swipe_magnitude_threshold", "revanced_swipe_threshold",
StringResource("revanced_swipe_magnitude_threshold_title", "Swipe magnitude threshold"), StringResource("revanced_swipe_threshold_title", "Swipe magnitude threshold"),
InputType.NUMBER,
"30",
StringResource( StringResource(
"revanced_swipe_magnitude_threshold_summary", "revanced_swipe_threshold_summary",
"The amount of threshold for swipe to occur" "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 { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_autocaptions_enabled", "revanced_auto_captions",
StringResource("revanced_autocaptions_enabled_title", "Disable auto captions"), StringResource("revanced_auto_captions_title", "Disable auto captions"),
false, StringResource("revanced_auto_captions_summary_on", "Auto captions are disabled"),
StringResource("revanced_autocaptions_summary_on", "Auto captions are disabled"), StringResource("revanced_auto_captions_summary_off", "Auto captions are enabled")
StringResource("revanced_autocaptions_summary_off", "Auto captions are enabled")
) )
) )

View File

@ -27,34 +27,30 @@ class HideButtonsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen( PreferenceScreen(
"revanced_hide_buttons", "revanced_hide_buttons_preference_screen",
StringResource("revanced_hide_buttons_title", "Hide action buttons"), StringResource("revanced_hide_buttons_preference_screen_title", "Hide action buttons"),
listOf( listOf(
SwitchPreference( SwitchPreference(
"revanced_hide_like_dislike_button", "revanced_hide_like_dislike_button",
StringResource("revanced_hide_like_dislike_button_title", "Hide like and dislike buttons"), 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_on", "Like and dislike buttons are hidden"),
StringResource("revanced_hide_like_dislike_button_summary_off", "Like and dislike buttons are shown") StringResource("revanced_hide_like_dislike_button_summary_off", "Like and dislike buttons are shown")
), ),
SwitchPreference( SwitchPreference(
"revanced_hide_download_button", "revanced_hide_download_button",
StringResource("revanced_hide_download_button_title", "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_on", "Download button is hidden"),
StringResource("revanced_hide_download_button_summary_off", "Download button is shown") StringResource("revanced_hide_download_button_summary_off", "Download button is shown")
), ),
SwitchPreference( SwitchPreference(
"revanced_hide_playlist_button", "revanced_hide_playlist_button",
StringResource("revanced_hide_playlist_button_title", "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_on", "Playlist button is hidden"),
StringResource("revanced_hide_playlist_button_summary_off", "Playlist button is shown") StringResource("revanced_hide_playlist_button_summary_off", "Playlist button is shown")
), ),
SwitchPreference( SwitchPreference(
"revanced_hide_clip_button", "revanced_hide_clip_button",
StringResource("revanced_hide_clip_button_title", "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_on", "Clip button is hidden"),
StringResource("revanced_hide_clip_button_summary_off", "Clip button is shown"), StringResource("revanced_hide_clip_button_summary_off", "Clip button is shown"),
StringResource("revanced_hide_clip_button_user_dialog_message", StringResource("revanced_hide_clip_button_user_dialog_message",
@ -63,12 +59,11 @@ class HideButtonsPatch : ResourcePatch {
SwitchPreference( SwitchPreference(
"revanced_hide_action_buttons", "revanced_hide_action_buttons",
StringResource("revanced_hide_action_buttons_title", "Hide all other 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_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_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() return PatchResultSuccess()

View File

@ -40,7 +40,6 @@ class HideAutoplayButtonPatch : BytecodePatch(
SwitchPreference( SwitchPreference(
"revanced_hide_autoplay_button", "revanced_hide_autoplay_button",
StringResource("revanced_hide_autoplay_button_title", "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_on", "Autoplay button is hidden"),
StringResource("revanced_hide_autoplay_button_summary_off", "Autoplay button is shown") StringResource("revanced_hide_autoplay_button_summary_off", "Autoplay button is shown")
), ),

View File

@ -32,7 +32,6 @@ class HideCaptionsButtonPatch : BytecodePatch(listOf(
SwitchPreference( SwitchPreference(
"revanced_hide_captions_button", "revanced_hide_captions_button",
StringResource("revanced_hide_captions_button_title", "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_on", "Captions button is hidden"),
StringResource("revanced_hide_captions_button_summary_off", "Captions button is shown") StringResource("revanced_hide_captions_button_summary_off", "Captions button is shown")
) )

View File

@ -29,7 +29,6 @@ class HideCastButtonPatch : BytecodePatch() {
SwitchPreference( SwitchPreference(
"revanced_hide_cast_button", "revanced_hide_cast_button",
StringResource("revanced_hide_cast_button_title", "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_on", "Cast button is hidden"),
StringResource("revanced_hide_cast_button_summary_off", "Cast button is shown") 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 { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen( PreferenceScreen(
"revanced_navigation_buttons", "revanced_navigation_buttons_preference_screen",
StringResource("revanced_navigation_buttons", "Navigation button settings"), StringResource("revanced_navigation_buttons_preference_screen_title", "Navigation button settings"),
listOf( listOf(
SwitchPreference( SwitchPreference(
"revanced_hide_home_button", "revanced_hide_home_button",
StringResource("revanced_hide_home_button_title", "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_on", "Home button is hidden"),
StringResource("revanced_hide_home_button_summary_off", "Home button is shown") StringResource("revanced_hide_home_button_summary_off", "Home button is shown")
), ),
SwitchPreference( SwitchPreference(
"revanced_hide_shorts_button", "revanced_hide_shorts_button",
StringResource("revanced_hide_shorts_button_title", "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_on", "Shorts button is hidden"),
StringResource("revanced_hide_shorts_button_summary_off", "Shorts button is shown") StringResource("revanced_hide_shorts_button_summary_off", "Shorts button is shown")
), ),
SwitchPreference( SwitchPreference(
"revanced_hide_subscriptions_button", "revanced_hide_subscriptions_button",
StringResource("revanced_hide_subscriptions_button_title", "Hide subscriptions button"), StringResource("revanced_hide_subscriptions_button_title", "Hide subscriptions button"),
false,
StringResource( StringResource(
"revanced_hide_subscriptions_button_summary_on", "revanced_hide_subscriptions_button_summary_on",
"Home subscriptions is hidden" "Home subscriptions is hidden"
@ -71,7 +68,6 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
SwitchPreference( SwitchPreference(
"revanced_hide_create_button", "revanced_hide_create_button",
StringResource("revanced_hide_create_button_title", "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_on", "Create button is hidden"),
StringResource("revanced_hide_create_button_summary_off", "Create button is shown") 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", "revanced_switch_create_with_notifications_button_title",
"Switch create with notifications button" "Switch create with notifications button"
), ),
true,
StringResource( StringResource(
"revanced_switch_create_with_notifications_button_summary_on", "revanced_switch_create_with_notifications_button_summary_on",
"Create button is switched with notifications" "Create button is switched with notifications"

View File

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

View File

@ -27,7 +27,6 @@ class AlbumCardsResourcePatch : ResourcePatch {
SwitchPreference( SwitchPreference(
"revanced_hide_album_cards", "revanced_hide_album_cards",
StringResource("revanced_hide_album_cards_title", "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_on", "Album cards are hidden"),
StringResource("revanced_hide_album_cards_summary_off", "Album cards are shown") StringResource("revanced_hide_album_cards_summary_off", "Album cards are shown")
) )

View File

@ -28,7 +28,6 @@ class HideArtistCardsPatch : ResourcePatch {
SwitchPreference( SwitchPreference(
"revanced_hide_artist_cards", "revanced_hide_artist_cards",
StringResource("revanced_hide_artist_cards_title", "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_on", "Artist cards is hidden"),
StringResource("revanced_hide_artist_cards_off", "Artist cards is shown") StringResource("revanced_hide_artist_cards_off", "Artist cards is shown")
), ),

View File

@ -25,7 +25,6 @@ class BreakingNewsResourcePatch : ResourcePatch {
SwitchPreference( SwitchPreference(
"revanced_hide_breaking_news", "revanced_hide_breaking_news",
StringResource("revanced_hide_breaking_news_title", "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_on", "Breaking news are hidden"),
StringResource("revanced_hide_breaking_news_summary_off", "Breaking news are shown") 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 { override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
PreferenceScreen( PreferenceScreen(
"revanced_comments", "revanced_comments_preference_screen",
StringResource("revanced_comments_title", "Comments"), StringResource("revanced_comments_preference_screen_title", "Comments"),
listOf( listOf(
SwitchPreference( SwitchPreference(
"revanced_hide_comments_section", "revanced_hide_comments_section",
StringResource("revanced_hide_comments_section_title", "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_on", "Comment section is hidden"),
StringResource("revanced_hide_comments_section_summary_off", "Comment section is shown") StringResource("revanced_hide_comments_section_summary_off", "Comment section is shown")
), ),
SwitchPreference( SwitchPreference(
"revanced_hide_preview_comment", "revanced_hide_preview_comment",
StringResource("revanced_hide_preview_comment_title", "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_on", "Preview comment is hidden"),
StringResource("revanced_hide_preview_comment_off", "Preview comment is shown") StringResource("revanced_hide_preview_comment_off", "Preview comment is shown")
), ),
SwitchPreference( SwitchPreference(
"revanced_hide_shorts_comments_button", "revanced_hide_shorts_comments_button",
StringResource("revanced_hide_shorts_comments_button_title", "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_on", "Shorts comments button is hidden"),
StringResource("revanced_hide_shorts_comments_button_off", "Shorts comments button is shown") 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( SwitchPreference(
"revanced_hide_crowdfunding_box", "revanced_hide_crowdfunding_box",
StringResource("revanced_hide_crowdfunding_box_title", "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_on", "Crowdfunding box is hidden"),
StringResource("revanced_hide_crowdfunding_box_summary_off", "Crowdfunding box is shown") StringResource("revanced_hide_crowdfunding_box_summary_off", "Crowdfunding box is shown")
) )

View File

@ -29,7 +29,6 @@ class HideEndscreenCardsResourcePatch : ResourcePatch {
SwitchPreference( SwitchPreference(
"revanced_hide_endscreen_cards", "revanced_hide_endscreen_cards",
StringResource("revanced_hide_endscreen_cards_title", "Hide end screen 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_on", "End screen cards are hidden"),
StringResource("revanced_hide_endscreen_cards_summary_off", "End screen cards are shown") 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", "revanced_hide_filter_bar_feed_in_feed_title",
"Hide in feed" "Hide in feed"
), ),
false,
StringResource( StringResource(
"revanced_hide_filter_bar_feed_in_feed_summary_on", "revanced_hide_filter_bar_feed_in_feed_summary_on",
"Hidden in feed" "Hidden in feed"
@ -46,7 +45,6 @@ class HideFilterBarResourcePatch : ResourcePatch {
"revanced_hide_filter_bar_feed_in_search_title", "revanced_hide_filter_bar_feed_in_search_title",
"Hide in search" "Hide in search"
), ),
false,
StringResource( StringResource(
"revanced_hide_filter_bar_feed_in_search_summary_on", "revanced_hide_filter_bar_feed_in_search_summary_on",
"Hidden in search" "Hidden in search"
@ -62,7 +60,6 @@ class HideFilterBarResourcePatch : ResourcePatch {
"revanced_hide_filter_bar_feed_in_related_videos_title", "revanced_hide_filter_bar_feed_in_related_videos_title",
"Hide in related videos" "Hide in related videos"
), ),
false,
StringResource( StringResource(
"revanced_hide_filter_bar_feed_in_related_videos_summary_on", "revanced_hide_filter_bar_feed_in_related_videos_summary_on",
"Hidden in related videos" "Hidden in related videos"

View File

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

View File

@ -36,7 +36,6 @@ class HideGetPremiumPatch : BytecodePatch(
SwitchPreference( SwitchPreference(
"revanced_hide_get_premium", "revanced_hide_get_premium",
StringResource("revanced_hide_get_premium_title", "Hide YouTube Premium advertisement"), 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_on", "YouTube Premium advertisement are hidden"),
StringResource("revanced_hide_get_premium_summary_off", "YouTube Premium advertisement are shown") StringResource("revanced_hide_get_premium_summary_off", "YouTube Premium advertisement are shown")
) )

View File

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

View File

@ -21,7 +21,6 @@ class HideLoadMoreButtonResourcePatch : ResourcePatch {
SwitchPreference( SwitchPreference(
"revanced_hide_load_more_button", "revanced_hide_load_more_button",
StringResource("revanced_hide_load_more_button_title", "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_on", "Load More button is hidden"),
StringResource("revanced_hide_load_more_button_summary_off", "Load More button is shown") StringResource("revanced_hide_load_more_button_summary_off", "Load More button is shown")
) )

View File

@ -27,7 +27,6 @@ class HideEmailAddressResourcePatch : ResourcePatch {
SwitchPreference( SwitchPreference(
"revanced_hide_email_address", "revanced_hide_email_address",
StringResource("revanced_hide_email_address_title", "Hide email in account switcher"), 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_on", "Email address is hidden"),
StringResource("revanced_hide_email_address_summary_off", "Email address is shown") StringResource("revanced_hide_email_address_summary_off", "Email address is shown")
) )

View File

@ -21,7 +21,6 @@ class HidePlayerOverlayResourcePatch : ResourcePatch {
SwitchPreference( SwitchPreference(
"revanced_hide_player_overlay", "revanced_hide_player_overlay",
StringResource("revanced_hide_player_overlay_title", "Hide background overlay in player"), 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_on", "Background overlay is hidden"),
StringResource("revanced_hide_player_overlay_summary_off", "Background overlay is shown") StringResource("revanced_hide_player_overlay_summary_off", "Background overlay is shown")
) )

View File

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

View File

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

View File

@ -33,7 +33,6 @@ class WatchInVRPatch : BytecodePatch(
SwitchPreference( SwitchPreference(
"revanced_hide_watch_in_vr", "revanced_hide_watch_in_vr",
StringResource("revanced_hide_watch_in_vr_title", "Hide VR setting"), 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_on", "VR setting is hidden"),
StringResource("revanced_hide_watch_in_vr_summary_off", "VR setting is shown") StringResource("revanced_hide_watch_in_vr_summary_off", "VR setting is shown")
) )

View File

@ -37,7 +37,6 @@ class HideWatermarkPatch : BytecodePatch(
SwitchPreference( SwitchPreference(
"revanced_hide_video_watermark", "revanced_hide_video_watermark",
StringResource("revanced_hide_video_watermark_title", "Hide creator watermark on videos"), 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_on", "Watermark is hidden"),
StringResource("revanced_hide_video_watermark_summary_off", "Watermark is shown") StringResource("revanced_hide_video_watermark_summary_off", "Watermark is shown")
) )

View File

@ -37,7 +37,6 @@ class FullscreenPanelsRemoverPatch : BytecodePatch(
SwitchPreference( SwitchPreference(
"revanced_hide_fullscreen_panels", "revanced_hide_fullscreen_panels",
StringResource("revanced_hide_fullscreen_panels_title", "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_on", "Fullscreen panels are hidden"),
StringResource("revanced_hide_fullscreen_panels_summary_off", "Fullscreen panels are shown") 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 { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_player_popup_panels_enabled", "revanced_hide_player_popup_panels",
StringResource("revanced_player_popup_panels_title", "Disable player popup panels"), StringResource("revanced_hide_player_popup_panels_title", "Hide player popup panels"),
false, StringResource("revanced_hide_player_popup_panels_summary_on", "Player popup panels are hidden"),
StringResource("revanced_player_popup_panels_summary_on", "Player popup panels are disabled"), StringResource("revanced_hide_player_popup_panels_summary_off", "Player popup panels are shown")
StringResource("revanced_player_popup_panels_summary_off", "Player popup panels are enabled")
) )
) )

View File

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

View File

@ -38,7 +38,6 @@ class WideSearchbarPatch : BytecodePatch(
SwitchPreference( SwitchPreference(
"revanced_wide_searchbar", "revanced_wide_searchbar",
StringResource("revanced_wide_searchbar_enabled_title", "Enable wide search bar"), 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_on", "Wide search bar is enabled"),
StringResource("revanced_wide_searchbar_summary_off", "Wide search bar is disabled") StringResource("revanced_wide_searchbar_summary_off", "Wide search bar is disabled")
) )

View File

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

View File

@ -37,12 +37,12 @@ class SpoofAppVersionPatch : BytecodePatch(
SwitchPreference( SwitchPreference(
"revanced_spoof_app_version", "revanced_spoof_app_version",
StringResource("revanced_spoof_app_version_title", "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_on", "Version spoofed"),
StringResource("revanced_spoof_app_version_summary_off", "Version not spoofed"), StringResource("revanced_spoof_app_version_summary_off", "Version not spoofed"),
StringResource("revanced_spoof_app_version_user_dialog_message", 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." "App version will be spoofed to an older version of YouTube."
+ " If later turned off, the old UI may remain until you log out or clear the app data.") + "\\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( ListPreference(
"revanced_spoof_app_version_target", "revanced_spoof_app_version_target",

View File

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

View File

@ -42,7 +42,6 @@ class TabletMiniPlayerPatch : BytecodePatch(
SwitchPreference( SwitchPreference(
"revanced_tablet_miniplayer", "revanced_tablet_miniplayer",
StringResource("revanced_tablet_miniplayer_title", "Enable tablet mini player"), 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_on", "Mini player is enabled"),
StringResource("revanced_tablet_miniplayer_summary_off", "Mini player is disabled") 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.DependsOn
import app.revanced.patcher.patch.annotations.Patch 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.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.resource.ThemeResourcePatch
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility 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]) @DependsOn([LithoColorHookPatch::class, SeekbarColorBytecodePatch::class, ThemeResourcePatch::class])
@ThemeCompatibility @ThemeCompatibility
@Version("0.0.1") @Version("0.0.1")
class ThemeBytecodePatch : BytecodePatch( class ThemeBytecodePatch : BytecodePatch() {
listOf(CreateDarkThemeSeekbarFingerprint, SetSeekbarClickedColorFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
LithoColorHookPatch.lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getValue") LithoColorHookPatch.lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getValue")

View File

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

View File

@ -35,9 +35,8 @@ class AutoRepeatPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.MISC.addPreferences( SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_pref_auto_repeat", "revanced_auto_repeat",
StringResource("revanced_auto_repeat_enabled_title", "Enable auto-repeat"), StringResource("revanced_auto_repeat_title", "Enable auto-repeat"),
false,
StringResource("revanced_auto_repeat_summary_on", "Auto-repeat is enabled"), StringResource("revanced_auto_repeat_summary_on", "Auto-repeat is enabled"),
StringResource("revanced_auto_repeat_summary_off", "Auto-repeat is disabled") 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 { override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.MISC.addPreferences( SettingsPatch.PreferenceScreen.MISC.addPreferences(
app.revanced.patches.shared.settings.preference.impl.PreferenceScreen( app.revanced.patches.shared.settings.preference.impl.PreferenceScreen(
"revanced_debug", "revanced_debug_preference_screen",
StringResource("revanced_debug_title", "Debugging"), StringResource("revanced_debug_preference_screen_title", "Debugging"),
listOf( listOf(
SwitchPreference( SwitchPreference(
"revanced_debug_enabled", "revanced_debug",
StringResource("revanced_debug_enabled_title", "Debug logging"), StringResource("revanced_debug_title", "Debug logging"),
false,
StringResource("revanced_debug_summary_on", "Debug logs are enabled"), StringResource("revanced_debug_summary_on", "Debug logs are enabled"),
StringResource("revanced_debug_summary_off", "Debug logs are disabled") StringResource("revanced_debug_summary_off", "Debug logs are disabled")
), ),
SwitchPreference( SwitchPreference(
"revanced_debug_stacktrace_enabled", "revanced_debug_stacktrace",
StringResource( StringResource(
"revanced_debug_stacktrace_enabled_title", "revanced_debug_stacktrace_title",
"Log stack traces" "Log stack traces"
), ),
false,
StringResource("revanced_debug_stacktrace_summary_on", "Debug logs include stack trace"), StringResource("revanced_debug_stacktrace_summary_on", "Debug logs include stack trace"),
StringResource("revanced_debug_stacktrace_summary_off", "Debug logs do not include stack trace") StringResource("revanced_debug_stacktrace_summary_off", "Debug logs do not include stack trace")
), ),
SwitchPreference( SwitchPreference(
"revanced_debug_toast_on_error_enabled", "revanced_debug_toast_on_error",
StringResource( StringResource(
"revanced_debug_toast_on_error_enabled_title", "revanced_debug_toast_on_error_title",
"Show toast on ReVanced error" "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_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_summary_off", "Toast not shown if error occurs"),
StringResource("revanced_debug_toast_on_error_user_dialog_message", StringResource("revanced_debug_toast_on_error_user_dialog_message",
"Turning off error toasts hides all ReVanced error notifications." + "Turning off error toasts hides all ReVanced error notifications."
" This includes hiding normal network connection timeouts, " + + "\\n\\nThis includes hiding normal network connection timeouts, "
"but also hides notification of any unexpected and more serious errors." + "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( SwitchPreference(
"revanced_spoof_signature_verification", "revanced_spoof_signature_verification",
StringResource("revanced_spoof_signature_verification_title", "Spoof app signature"), StringResource("revanced_spoof_signature_verification_title", "Spoof app signature"),
true,
StringResource("revanced_spoof_signature_verification_summary_on", StringResource("revanced_spoof_signature_verification_summary_on",
"App signature spoofed\\n\\n" "App signature spoofed\\n\\n"
+ "Side effects include:\\n" + "Side effects include:\\n"

View File

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

View File

@ -32,8 +32,8 @@ class MicroGResourcePatch : ResourcePatch {
SettingsPatch.addPreference( SettingsPatch.addPreference(
Preference( Preference(
StringResource("microg_settings", "MicroG Settings"), StringResource("microg_settings", "MicroG Settings"),
Preference.Intent("$MICROG_VENDOR.android.gms", "", "org.microg.gms.ui.SettingsActivity"),
StringResource("microg_settings_summary", "Settings for MicroG"), StringResource("microg_settings_summary", "Settings for MicroG"),
Preference.Intent("$MICROG_VENDOR.android.gms", "", "org.microg.gms.ui.SettingsActivity")
) )
) )
SettingsPatch.renameIntentsTargetPackage(REVANCED_PACKAGE_NAME) 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.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.addPreference 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.*
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.resource.patch.AbstractSettingsResourcePatch import app.revanced.patches.shared.settings.resource.patch.AbstractSettingsResourcePatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils
@ -71,10 +68,20 @@ class SettingsResourcePatch : AbstractSettingsResourcePatch(
SettingsPatch.addPreference( SettingsPatch.addPreference(
Preference( Preference(
StringResource("revanced_settings", "ReVanced"), StringResource("revanced_settings", "ReVanced"),
StringResource("revanced_settings_summary", "ReVanced specific settings"),
Preference.Intent( Preference.Intent(
youtubePackage, "revanced_settings", "com.google.android.libraries.social.licenses.LicenseActivity" 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( SwitchPreference(
"revanced_disable_zoom_haptics", "revanced_disable_zoom_haptics",
StringResource("revanced_disable_zoom_haptics_title", "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_on", "Haptics are disabled"),
StringResource("revanced_disable_zoom_haptics_summary_off", "Haptics are enabled") 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 { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.VIDEO.addPreferences( SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_pref_hdr_autobrightness", "revanced_hdr_auto_brightness",
StringResource("revanced_hdr_autobrightness_enabled_title", "Enable auto HDR brightness"), StringResource("revanced_hdr_auto_brightness_title", "Enable auto HDR brightness"),
true, StringResource("revanced_hdr_auto_brightness_summary_on", "Auto HDR brightness is enabled"),
StringResource("revanced_hdr_autobrightness_summary_on", "Auto HDR brightness is enabled"), StringResource("revanced_hdr_auto_brightness_summary_off", "Auto HDR brightness is disabled")
StringResource("revanced_hdr_autobrightness_summary_off", "Auto HDR brightness is disabled")
) )
) )

View File

@ -32,11 +32,10 @@ class OldQualityLayoutPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.VIDEO.addPreferences( SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_use_old_style_quality_settings", "revanced_show_old_video_menu",
StringResource("revanced_old_style_quality_settings_enabled_title", "Use old video quality player menu"), StringResource("revanced_show_old_video_menu_title", "Use old video quality player menu"),
true, StringResource("revanced_show_old_video_menu_summary_on", "Old video quality menu is used"),
StringResource("revanced_old_style_quality_settings_summary_on", "Old video quality menu is used"), StringResource("revanced_show_old_video_menu_summary_off", "Old video quality menu is not used")
StringResource("revanced_old_style_quality_settings_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 // 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) // ideally the entries would be raw values (and not a key to a String resource)
val entries = listOf( val entries = listOf(
StringResource("revanced_default_quality_entry_1", "Automatic quality"), StringResource("revanced_video_quality_default_entry_1", "Automatic quality"),
StringResource("revanced_default_quality_entry_2", "2160p"), StringResource("revanced_video_quality_default_entry_2", "2160p"),
StringResource("revanced_default_quality_entry_3", "1440p"), StringResource("revanced_video_quality_default_entry_3", "1440p"),
StringResource("revanced_default_quality_entry_4", "1080p"), StringResource("revanced_video_quality_default_entry_4", "1080p"),
StringResource("revanced_default_quality_entry_5", "720p"), StringResource("revanced_video_quality_default_entry_5", "720p"),
StringResource("revanced_default_quality_entry_6", "480p"), StringResource("revanced_video_quality_default_entry_6", "480p"),
StringResource("revanced_default_quality_entry_7", "360p"), StringResource("revanced_video_quality_default_entry_7", "360p"),
StringResource("revanced_default_quality_entry_8", "280p"), StringResource("revanced_video_quality_default_entry_8", "280p"),
StringResource("revanced_default_quality_entry_9", "144p"), StringResource("revanced_video_quality_default_entry_9", "144p"),
) )
val entryValues = listOf( val entryValues = listOf(
StringResource("revanced_default_quality_entry_value_1", "-2"), StringResource("revanced_video_quality_default_entry_value_1", "-2"),
StringResource("revanced_default_quality_entry_value_2", "2160"), StringResource("revanced_video_quality_default_entry_value_2", "2160"),
StringResource("revanced_default_quality_entry_value_3", "1440"), StringResource("revanced_video_quality_default_entry_value_3", "1440"),
StringResource("revanced_default_quality_entry_value_4", "1080"), StringResource("revanced_video_quality_default_entry_value_4", "1080"),
StringResource("revanced_default_quality_entry_value_5", "720"), StringResource("revanced_video_quality_default_entry_value_5", "720"),
StringResource("revanced_default_quality_entry_value_6", "480"), StringResource("revanced_video_quality_default_entry_value_6", "480"),
StringResource("revanced_default_quality_entry_value_7", "360"), StringResource("revanced_video_quality_default_entry_value_7", "360"),
StringResource("revanced_default_quality_entry_value_8", "280"), StringResource("revanced_video_quality_default_entry_value_8", "280"),
StringResource("revanced_default_quality_entry_value_9", "144"), StringResource("revanced_video_quality_default_entry_value_9", "144"),
) )
SettingsPatch.PreferenceScreen.VIDEO.addPreferences( SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
@ -73,7 +73,6 @@ class RememberVideoQualityPatch : BytecodePatch(
"revanced_remember_video_quality_last_selected_title", "revanced_remember_video_quality_last_selected_title",
"Remember video quality changes" "Remember video quality changes"
), ),
false,
StringResource( StringResource(
"revanced_remember_video_quality_last_selected_summary_on", "revanced_remember_video_quality_last_selected_summary_on",
"Quality changes apply to all videos" "Quality changes apply to all videos"
@ -84,23 +83,23 @@ class RememberVideoQualityPatch : BytecodePatch(
) )
), ),
ListPreference( ListPreference(
"revanced_default_video_quality_wifi", "revanced_video_quality_default_wifi",
StringResource( StringResource(
"revanced_default_video_quality_wifi_title", "revanced_video_quality_default_wifi_title",
"Default video quality on Wi-Fi network" "Default video quality on Wi-Fi network"
), ),
ArrayResource("revanced_video_quality_wifi_entry", entries), ArrayResource("revanced_video_quality_default_wifi_entry", entries),
ArrayResource("revanced_video_quality_wifi_entry_values", entryValues) ArrayResource("revanced_video_quality_default_wifi_entry_values", entryValues)
// default value and summary are set by integrations after loading // default value and summary are set by integrations after loading
), ),
ListPreference( ListPreference(
"revanced_default_video_quality_mobile", "revanced_video_quality_default_mobile",
StringResource( StringResource(
"revanced_default_video_quality_mobile_title", "revanced_video_quality_default_mobile_title",
"Default video quality on mobile network" "Default video quality on mobile network"
), ),
ArrayResource("revanced_video_quality_mobile_entries", entries), ArrayResource("revanced_video_quality_default_mobile_entries", entries),
ArrayResource("revanced_video_quality_mobile_entry_values", entryValues) ArrayResource("revanced_video_quality_default_mobile_values", entryValues)
) )
) )

View File

@ -34,17 +34,16 @@ class CustomVideoSpeedPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.VIDEO.addPreferences( SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
TextPreference( TextPreference(
key = "revanced_custom_video_speeds", key = "revanced_custom_playback_speeds",
title = StringResource( title = StringResource(
"revanced_custom_video_speeds_title", "revanced_custom_playback_speeds_title",
"Custom playback speeds" "Custom playback speeds"
), ),
inputType = InputType.TEXT_MULTI_LINE, inputType = InputType.TEXT_MULTI_LINE,
summary = StringResource( summary = StringResource(
"revanced_custom_video_speeds_summary", "revanced_custom_playback_speeds_summary",
"Add or change the video speeds available" "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", "revanced_remember_playback_speed_last_selected_title",
"Remember playback speed changes" "Remember playback speed changes"
), ),
true,
StringResource( StringResource(
"revanced_remember_playback_speed_last_selected_summary_on", "revanced_remember_playback_speed_last_selected_summary_on",
"Playback speed changes apply to all videos" "Playback speed changes apply to all videos"
@ -51,21 +50,21 @@ class RememberPlaybackSpeedPatch : BytecodePatch(
) )
), ),
ListPreference( ListPreference(
"revanced_default_playback_speed", "revanced_playback_speed_default",
StringResource( StringResource(
"revanced_default_playback_speed_title", "revanced_playback_speed_default_title",
"Default playback speed" "Default playback speed"
), ),
// Dummy data: // Dummy data:
// Entries and values are set by Integrations code based on the actual speeds available, // Entries and values are set by Integrations code based on the actual speeds available,
// and the values set here are ignored and do nothing. // and the values set here are ignored and do nothing.
ArrayResource( ArrayResource(
"revanced_default_playback_speed_entries", "revanced_playback_speed_default_entries",
listOf(StringResource("revanced_default_playback_speed_entry", "1.0x")) listOf(StringResource("revanced_playback_speed_default_entries", "1.0x"))
), ),
ArrayResource( ArrayResource(
"revanced_default_playback_speed_entry_values", "revanced_playback_speed_default_entry_values",
listOf(StringResource("revanced_default_playback_speed_entry_value", "1.0")) listOf(StringResource("revanced_playback_speed_default_entry_value", "1.0"))
) )
) )
) )

View File

@ -2,4 +2,10 @@
<resources> <resources>
<string name="revanced_settings_confirm_user_dialog_title">Do you wish to proceed?</string> <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_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> </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_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">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_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">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_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_reset">API URL reset</string>
<string name="sb_api_url_invalid">API URL is invalid</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_api_url_changed">API URL changed</string>
<string name="sb_settings_ie">Import/Export settings</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_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_successful">Settings imported successfully</string>
<string name="sb_settings_import_failed">Failed to import: %s</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_diff_segments">Change segment behavior</string>
<string name="sb_segments_sponsor">Sponsor</string> <string name="sb_segments_sponsor">Sponsor</string>