Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30eba5b3 authored by Cosmin Tanislav's avatar Cosmin Tanislav
Browse files

ThemePicker: default to TONAL_SPOT for invalid Styles

It is possible for the current style to not be supported if users
are coming from a stock ROM and logging into their Google account
which will restore their settings.

Default to TONAL_SPOT, same as in all other places which parse
a Style value from string.

Change-Id: I28c08cff5f7fbb63233cd465f19b6995365d1cde
parent 42f7e4c4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -227,7 +227,9 @@ constructor(
    override fun getCurrentColorOption(): ColorOptionModel {
        val overlays = colorManager.currentOverlays
        val styleOrNull = colorManager.currentStyle
        val style = styleOrNull?.let { Style.valueOf(it) } ?: Style.TONAL_SPOT
        val style = runCatching {
            styleOrNull?.let { Style.valueOf(it) }
        }.getOrNull() ?: Style.TONAL_SPOT
        val source = colorManager.currentColorSource
        val colorOptionBuilder = ColorOptionImpl.Builder()
        colorOptionBuilder.source = source