fix: allow using PreferenceScreen
outside of current module
This commit is contained in:
parent
d8ef855d5d
commit
fe94013a22
|
@ -12,7 +12,7 @@ import org.w3c.dom.Element
|
||||||
* @param tag The tag of the preference.
|
* @param tag The tag of the preference.
|
||||||
* @param summary The summary of the preference.
|
* @param summary The summary of the preference.
|
||||||
*/
|
*/
|
||||||
internal abstract class BasePreference(
|
abstract class BasePreference(
|
||||||
val key: String?,
|
val key: String?,
|
||||||
val title: StringResource,
|
val title: StringResource,
|
||||||
val summary: StringResource? = null,
|
val summary: StringResource? = null,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.w3c.dom.Element
|
||||||
* @param name The name of the resource.
|
* @param name The name of the resource.
|
||||||
* @param tag The tag of the resource.
|
* @param tag The tag of the resource.
|
||||||
*/
|
*/
|
||||||
internal abstract class BaseResource(
|
abstract class BaseResource(
|
||||||
val name: String,
|
val name: String,
|
||||||
val tag: String
|
val tag: String
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.w3c.dom.Document
|
||||||
* @param summary The summary of the preference.
|
* @param summary The summary of the preference.
|
||||||
* @param default The default value of the preference.
|
* @param default The default value of the preference.
|
||||||
*/
|
*/
|
||||||
internal abstract class DefaultBasePreference<T>(
|
abstract class DefaultBasePreference<T>(
|
||||||
key: String?,
|
key: String?,
|
||||||
title: StringResource,
|
title: StringResource,
|
||||||
summary: StringResource? = null,
|
summary: StringResource? = null,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.w3c.dom.Document
|
||||||
* @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.
|
||||||
*/
|
*/
|
||||||
internal class ArrayResource(
|
class ArrayResource(
|
||||||
name: String,
|
name: String,
|
||||||
val items: List<StringResource>
|
val items: List<StringResource>
|
||||||
) : BaseResource(name, "string-array") {
|
) : BaseResource(name, "string-array") {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.w3c.dom.Document
|
||||||
* @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.
|
* @param default The default entry value of the list preference.
|
||||||
*/
|
*/
|
||||||
internal class ListPreference(
|
class ListPreference(
|
||||||
key: String,
|
key: String,
|
||||||
title: StringResource,
|
title: StringResource,
|
||||||
val entries: ArrayResource,
|
val entries: ArrayResource,
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.w3c.dom.Element
|
||||||
* @param title The title of the preference.
|
* @param title The title of the preference.
|
||||||
* @param summary The summary of the text preference.
|
* @param summary The summary of the text preference.
|
||||||
*/
|
*/
|
||||||
internal class NonInteractivePreference(
|
class NonInteractivePreference(
|
||||||
title: StringResource,
|
title: StringResource,
|
||||||
summary: StringResource,
|
summary: StringResource,
|
||||||
) : BasePreference(null, title, summary, "Preference") {
|
) : BasePreference(null, title, summary, "Preference") {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.w3c.dom.Document
|
||||||
* @param summary The summary of the text preference.
|
* @param summary The summary of the text preference.
|
||||||
* @param intent The intent of the preference.
|
* @param intent The intent of the preference.
|
||||||
*/
|
*/
|
||||||
internal class Preference(
|
class Preference(
|
||||||
key: String,
|
key: String,
|
||||||
title: StringResource,
|
title: StringResource,
|
||||||
summary: StringResource,
|
summary: StringResource,
|
||||||
|
@ -33,7 +33,7 @@ internal class Preference(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class Intent(
|
class Intent(
|
||||||
internal val targetPackage: String,
|
internal val targetPackage: String,
|
||||||
internal val data: String,
|
internal val data: String,
|
||||||
internal val targetClass: String
|
internal val targetClass: String
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.w3c.dom.Document
|
||||||
* @param title The title of the preference.
|
* @param title The title of the preference.
|
||||||
* @param preferences Child preferences of this category.
|
* @param preferences Child preferences of this category.
|
||||||
*/
|
*/
|
||||||
internal open class PreferenceCategory(
|
open class PreferenceCategory(
|
||||||
key: String,
|
key: String,
|
||||||
title: StringResource,
|
title: StringResource,
|
||||||
var preferences: List<BasePreference>,
|
var preferences: List<BasePreference>,
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.w3c.dom.Document
|
||||||
* @param preferences Child preferences of this screen.
|
* @param preferences Child preferences of this screen.
|
||||||
* @param summary The summary of the text preference.
|
* @param summary The summary of the text preference.
|
||||||
*/
|
*/
|
||||||
internal open class PreferenceScreen(
|
open class PreferenceScreen(
|
||||||
key: String,
|
key: String,
|
||||||
title: StringResource,
|
title: StringResource,
|
||||||
var preferences: List<BasePreference>,
|
var preferences: List<BasePreference>,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.w3c.dom.Document
|
||||||
* @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 class StringResource(
|
class StringResource(
|
||||||
name: String,
|
name: String,
|
||||||
val value: String,
|
val value: String,
|
||||||
val formatted: Boolean = true
|
val formatted: Boolean = true
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.w3c.dom.Element
|
||||||
* @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.
|
* @param default The default value of the switch.
|
||||||
*/
|
*/
|
||||||
internal class SwitchPreference(
|
class SwitchPreference(
|
||||||
key: String, title: StringResource,
|
key: String, title: StringResource,
|
||||||
val summaryOn: StringResource,
|
val summaryOn: StringResource,
|
||||||
val summaryOff: StringResource,
|
val summaryOff: StringResource,
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.w3c.dom.Document
|
||||||
* @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.
|
* @param default The default value of the text preference.
|
||||||
*/
|
*/
|
||||||
internal class TextPreference(
|
class TextPreference(
|
||||||
key: String?,
|
key: String?,
|
||||||
title: StringResource,
|
title: StringResource,
|
||||||
summary: StringResource?,
|
summary: StringResource?,
|
||||||
|
|
|
@ -6,7 +6,7 @@ import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
|
|
||||||
internal abstract class AbstractPreferenceScreen(
|
abstract class AbstractPreferenceScreen(
|
||||||
private val root: MutableList<Screen> = mutableListOf()
|
private val root: MutableList<Screen> = mutableListOf()
|
||||||
) : Closeable {
|
) : Closeable {
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ class SettingsPatch : BytecodePatch(
|
||||||
/**
|
/**
|
||||||
* Preference screens patches should add their settings to.
|
* Preference screens patches should add their settings to.
|
||||||
*/
|
*/
|
||||||
internal object PreferenceScreen : AbstractPreferenceScreen() {
|
object PreferenceScreen : AbstractPreferenceScreen() {
|
||||||
val ADS = Screen("ads", "Ads", "Ad related settings")
|
val ADS = Screen("ads", "Ads", "Ad related settings")
|
||||||
val INTERACTIONS = Screen("interactions", "Interaction", "Settings related to interactions")
|
val INTERACTIONS = Screen("interactions", "Interaction", "Settings related to interactions")
|
||||||
val LAYOUT = Screen("layout", "Layout", "Settings related to the layout")
|
val LAYOUT = Screen("layout", "Layout", "Settings related to the layout")
|
||||||
|
|
Loading…
Reference in a new issue