Update parsers
This commit is contained in:
@@ -23,6 +23,7 @@ class SourceSettings(context: Context, source: MangaSource) : MangaSourceConfig
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun <T> get(key: ConfigKey<T>): T {
|
||||
return when (key) {
|
||||
is ConfigKey.UserAgent -> prefs.getString(key.key, key.defaultValue).ifNullOrEmpty { key.defaultValue }
|
||||
is ConfigKey.Domain -> prefs.getString(key.key, key.defaultValue).ifNullOrEmpty { key.defaultValue }
|
||||
is ConfigKey.ShowSuspiciousContent -> prefs.getBoolean(key.key, key.defaultValue)
|
||||
} as T
|
||||
|
||||
@@ -37,6 +37,21 @@ fun PreferenceFragmentCompat.addPreferencesFromRepository(repository: RemoteMang
|
||||
}
|
||||
}
|
||||
|
||||
is ConfigKey.UserAgent -> {
|
||||
EditTextPreference(requireContext()).apply {
|
||||
summaryProvider = EditTextDefaultSummaryProvider(key.defaultValue)
|
||||
setOnBindEditTextListener(
|
||||
EditTextBindListener(
|
||||
inputType = EditorInfo.TYPE_CLASS_TEXT,
|
||||
hint = key.defaultValue,
|
||||
validator = null,
|
||||
),
|
||||
)
|
||||
setTitle(R.string.user_agent)
|
||||
setDialogTitle(R.string.user_agent)
|
||||
}
|
||||
}
|
||||
|
||||
is ConfigKey.ShowSuspiciousContent -> {
|
||||
SwitchPreferenceCompat(requireContext()).apply {
|
||||
setDefaultValue(key.defaultValue)
|
||||
|
||||
@@ -424,4 +424,5 @@
|
||||
<string name="allow_unstable_updates">Allow unstable updates</string>
|
||||
<string name="allow_unstable_updates_summary">Propose updates to beta versions of the app</string>
|
||||
<string name="download_started">Download started</string>
|
||||
<string name="user_agent">UserAgent header</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user