create ThemeViewModel using viewModel contructor
This commit is contained in:
@@ -58,10 +58,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val appLocale: LocaleListCompat = LocaleListCompat.forLanguageTags(language)
|
val appLocale: LocaleListCompat = LocaleListCompat.forLanguageTags(language)
|
||||||
AppCompatDelegate.setApplicationLocales(appLocale)
|
AppCompatDelegate.setApplicationLocales(appLocale)
|
||||||
}
|
}
|
||||||
val themeViewModel = ThemeViewModel()
|
|
||||||
themeViewModel.onChange(LocalPreferences.getTheme())
|
|
||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
|
val themeViewModel: ThemeViewModel = viewModel()
|
||||||
|
themeViewModel.onChange(LocalPreferences.getTheme())
|
||||||
AmethystTheme(themeViewModel) {
|
AmethystTheme(themeViewModel) {
|
||||||
// A surface container using the 'background' color from the theme
|
// A surface container using the 'background' color from the theme
|
||||||
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colors.background) {
|
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colors.background) {
|
||||||
|
|||||||
Reference in New Issue
Block a user