Maxr1998 / ModernAndroidPreferences

Android Preferences defined through Kotlin DSL, shown in a RecyclerView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to set default option in SingleChoice preference

rosenpin opened this issue · comments

There should be a way to set a default value for the SingleChoice preference, example could be

val styleOption = listOf(
            SelectionItem(
                Prefs.Keys.ListStyles.COMPACT,
                "compact",
                ...
            ),
            SelectionItem(
                Prefs.Keys.ListStyles.STANDARD,
                "standard",
                ...
            ),
        )
        singleChoice(..., styleOption) {
            title = ...
            summary = ...
            icon = ...
            default = Prefs.Keys.ListStyles.STANDARD
        }

Already exists, use initalSelection in SingleChoiceDialogPreference