Fallback to preference title if dialog title isn't set

This commit is contained in:
arkon 2022-01-06 22:53:54 -05:00
parent d04d676d2f
commit 47723042c5
2 changed files with 5 additions and 14 deletions

View File

@ -248,7 +248,7 @@ dependencies {
val conductorVersion = "3.1.1"
implementation("com.bluelinelabs:conductor:$conductorVersion")
implementation("com.bluelinelabs:conductor-viewpager:$conductorVersion")
implementation("com.github.tachiyomiorg:conductor-support-preference:$conductorVersion")
implementation("com.github.tachiyomiorg:conductor-support-preference:3.1.2")
// FlowBinding
val flowbindingVersion = "1.2.0"

View File

@ -5,7 +5,6 @@ import androidx.appcompat.content.res.AppCompatResources
import androidx.biometric.BiometricPrompt
import androidx.fragment.app.FragmentActivity
import androidx.preference.CheckBoxPreference
import androidx.preference.DialogPreference
import androidx.preference.EditTextPreference
import androidx.preference.ListPreference
import androidx.preference.MultiSelectListPreference
@ -66,19 +65,19 @@ inline fun PreferenceGroup.checkBoxPreference(block: (@DSL CheckBoxPreference).(
}
inline fun PreferenceGroup.editTextPreference(block: (@DSL EditTextPreference).() -> Unit): EditTextPreference {
return initThenAdd(EditTextPreference(context), block).also(::initDialog)
return initThenAdd(EditTextPreference(context), block)
}
inline fun PreferenceGroup.listPreference(block: (@DSL ListPreference).() -> Unit): ListPreference {
return initThenAdd(ListPreference(context), block).also(::initDialog)
return initThenAdd(ListPreference(context), block)
}
inline fun PreferenceGroup.intListPreference(block: (@DSL IntListPreference).() -> Unit): IntListPreference {
return initThenAdd(IntListPreference(context), block).also(::initDialog)
return initThenAdd(IntListPreference(context), block)
}
inline fun PreferenceGroup.multiSelectListPreference(block: (@DSL MultiSelectListPreference).() -> Unit): MultiSelectListPreference {
return initThenAdd(MultiSelectListPreference(context), block).also(::initDialog)
return initThenAdd(MultiSelectListPreference(context), block)
}
inline fun PreferenceScreen.preferenceCategory(block: (@DSL PreferenceCategory).() -> Unit): PreferenceCategory {
@ -89,14 +88,6 @@ inline fun PreferenceScreen.preferenceScreen(block: (@DSL PreferenceScreen).() -
return addThenInit(preferenceManager.createPreferenceScreen(context), block)
}
fun initDialog(dialogPreference: DialogPreference) {
with(dialogPreference) {
if (dialogTitle == null) {
dialogTitle = title
}
}
}
inline fun <P : Preference> PreferenceGroup.add(p: P): P {
return p.apply {
this.isIconSpaceReserved = false