Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.getValue
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
Expand All @@ -13,6 +14,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.looker.droidify.compose.settings.SettingsScreen
import com.looker.droidify.compose.settings.SettingsViewModel
import com.looker.droidify.compose.theme.DroidifyTheme
import com.looker.droidify.datastore.model.Theme
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
Expand All @@ -33,7 +35,13 @@ class SettingsFragment : Fragment() {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
val settings by viewModel.settings.collectAsStateWithLifecycle()
val isDarkTheme = when (settings.theme) {
Theme.DARK, Theme.AMOLED -> true
Theme.LIGHT -> false
Theme.SYSTEM, Theme.SYSTEM_BLACK -> isSystemInDarkTheme()
}
DroidifyTheme(
darkTheme = isDarkTheme,
dynamicColor = settings.dynamicTheme
) {
SettingsScreen(
Expand Down
Loading