fix: allow using PreferenceScreen outside of current module

This commit is contained in:
oSumAtrIX 2023-08-13 18:36:07 +02:00
parent d8ef855d5d
commit fe94013a22
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
14 changed files with 15 additions and 15 deletions

View file

@ -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,

View file

@ -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
) { ) {

View file

@ -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,

View file

@ -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") {

View file

@ -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,

View file

@ -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") {

View file

@ -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

View file

@ -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>,

View file

@ -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>,

View file

@ -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

View file

@ -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,

View file

@ -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?,

View file

@ -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 {

View file

@ -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")