mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 04:29:18 +01:00
minor updates to summaries in library settings
adding support for preSummaryRes for more deceptive summaries with the value
This commit is contained in:
parent
430bc10e4e
commit
51ec6d9bf6
@ -129,7 +129,8 @@ class SettingsLibraryController : SettingsController() {
|
||||
titleRes = R.string.library_update_restriction
|
||||
entriesRes = arrayOf(R.string.wifi, R.string.charging)
|
||||
entryValues = listOf("wifi", "ac")
|
||||
summaryRes = R.string.library_update_restriction_summary
|
||||
preSummaryRes = R.string.restrictions_
|
||||
noSelectionRes = R.string.none
|
||||
|
||||
preferences.libraryUpdateInterval().asObservable()
|
||||
.subscribeUntilDestroy { isVisible = it > 0 }
|
||||
@ -158,7 +159,6 @@ class SettingsLibraryController : SettingsController() {
|
||||
)
|
||||
entryRange = 0..1
|
||||
defaultValue = 0
|
||||
summaryRes = R.string.select_order_to_update
|
||||
}
|
||||
|
||||
triStateListPreference(activity) {
|
||||
|
@ -21,6 +21,12 @@ open class MatPreference @JvmOverloads constructor(
|
||||
Preference(context, attrs) {
|
||||
|
||||
protected val prefs: PreferencesHelper = Injekt.get()
|
||||
|
||||
@StringRes var preSummaryRes: Int? = null
|
||||
set(value) {
|
||||
field = value
|
||||
notifyChanged()
|
||||
}
|
||||
private var isShowing = false
|
||||
|
||||
@StringRes var dialogTitleRes: Int? = null
|
||||
@ -41,7 +47,14 @@ open class MatPreference @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun getSummary(): CharSequence? {
|
||||
customSummaryProvider?.let { return it.provideSummary(this) }
|
||||
customSummaryProvider?.let {
|
||||
val preSummaryRes = preSummaryRes
|
||||
return if (preSummaryRes != null) {
|
||||
context.getString(preSummaryRes, it.provideSummary(this))
|
||||
} else {
|
||||
it.provideSummary(this)
|
||||
}
|
||||
}
|
||||
return super.getSummary()
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ class MultiListMatPreference @JvmOverloads constructor(
|
||||
ListMatPreference(activity, context, attrs) {
|
||||
|
||||
var allSelectionRes: Int? = null
|
||||
var noSelectionRes: Int? = null
|
||||
|
||||
/** All item is always selected and uncheckabele */
|
||||
var allIsAlwaysSelected = false
|
||||
@ -56,6 +57,9 @@ class MultiListMatPreference @JvmOverloads constructor(
|
||||
allIsAlwaysSelected -> values = values + context.getString(allRes)
|
||||
}
|
||||
}
|
||||
if (values.isEmpty()) {
|
||||
noSelectionRes?.let { values = listOf(context.getString(it)) }
|
||||
}
|
||||
values.joinToString()
|
||||
}
|
||||
|
||||
|
@ -211,9 +211,9 @@
|
||||
<!-- Library settings -->
|
||||
<string name="library_update_frequency">Library update frequency</string>
|
||||
<string name="library_update_order">Library update order</string>
|
||||
<string name="select_order_to_update">Select the order in which Tachiyomi checks for update</string>
|
||||
<string name="library_update_restriction">Library update restrictions</string>
|
||||
<string name="library_update_restriction_summary">Update only when the conditions are met</string>
|
||||
<string name="restrictions_">Restrictions: %1$s</string>
|
||||
<string name="only_update_ongoing">Only update ongoing manga</string>
|
||||
<string name="sort_by_ignoring_articles">Sort by ignoring articles</string>
|
||||
<string name="when_sorting_ignore_articles">When sorting alphabetically, sort ignoring
|
||||
|
Loading…
Reference in New Issue
Block a user