Add missing API level check

This commit is contained in:
Sad Ellie 2023-12-06 22:39:38 +03:00
parent 409c52d899
commit f5fdf181a2

View File

@ -19,6 +19,7 @@
package com.sadellie.unitto.feature.settings.display package com.sadellie.unitto.feature.settings.display
import android.os.Build import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.expandVertically import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeIn
@ -95,8 +96,10 @@ internal fun DisplayRoute(
themmoController.setMonetMode(MonetMode.TonalSpot) themmoController.setMonetMode(MonetMode.TonalSpot)
viewModel.updateMonetMode(MonetMode.TonalSpot) viewModel.updateMonetMode(MonetMode.TonalSpot)
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
themmoController.enableDynamicTheme(newValue) themmoController.enableDynamicTheme(newValue)
viewModel.updateDynamicTheme(newValue) viewModel.updateDynamicTheme(newValue)
}
}, },
isAmoledThemeEnabled = themmoController.isAmoledThemeEnabled, isAmoledThemeEnabled = themmoController.isAmoledThemeEnabled,
onAmoledThemeChange = { newValue -> onAmoledThemeChange = { newValue ->
@ -295,6 +298,7 @@ private fun DisplayScreen(
} }
} }
@RequiresApi(Build.VERSION_CODES.O_MR1)
@Preview @Preview
@Composable @Composable
private fun Preview() { private fun Preview() {