|
|
@ -17,9 +17,11 @@
|
|
|
|
package com.google.samples.apps.nowinandroid.feature.settings
|
|
|
|
package com.google.samples.apps.nowinandroid.feature.settings
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.Intent
|
|
|
|
import android.content.Intent
|
|
|
|
|
|
|
|
import androidx.compose.animation.AnimatedVisibility
|
|
|
|
import androidx.compose.foundation.clickable
|
|
|
|
import androidx.compose.foundation.clickable
|
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
|
|
|
|
|
import androidx.compose.foundation.layout.ColumnScope
|
|
|
|
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
|
|
|
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
|
|
|
import androidx.compose.foundation.layout.FlowRow
|
|
|
|
import androidx.compose.foundation.layout.FlowRow
|
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
@ -149,8 +151,9 @@ fun SettingsDialog(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// [ColumnScope] is used for using the [ColumnScope.AnimatedVisibility] extension overload composable.
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
private fun SettingsPanel(
|
|
|
|
private fun ColumnScope.SettingsPanel(
|
|
|
|
settings: UserEditableSettings,
|
|
|
|
settings: UserEditableSettings,
|
|
|
|
supportDynamicColor: Boolean,
|
|
|
|
supportDynamicColor: Boolean,
|
|
|
|
onChangeThemeBrand: (themeBrand: ThemeBrand) -> Unit,
|
|
|
|
onChangeThemeBrand: (themeBrand: ThemeBrand) -> Unit,
|
|
|
@ -170,7 +173,8 @@ private fun SettingsPanel(
|
|
|
|
onClick = { onChangeThemeBrand(ANDROID) },
|
|
|
|
onClick = { onChangeThemeBrand(ANDROID) },
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (settings.brand == DEFAULT && supportDynamicColor) {
|
|
|
|
AnimatedVisibility(visible = settings.brand == DEFAULT && supportDynamicColor) {
|
|
|
|
|
|
|
|
Column {
|
|
|
|
SettingsDialogSectionTitle(text = stringResource(R.string.dynamic_color_preference))
|
|
|
|
SettingsDialogSectionTitle(text = stringResource(R.string.dynamic_color_preference))
|
|
|
|
Column(Modifier.selectableGroup()) {
|
|
|
|
Column(Modifier.selectableGroup()) {
|
|
|
|
SettingsDialogThemeChooserRow(
|
|
|
|
SettingsDialogThemeChooserRow(
|
|
|
@ -185,6 +189,7 @@ private fun SettingsPanel(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
SettingsDialogSectionTitle(text = stringResource(R.string.dark_mode_preference))
|
|
|
|
SettingsDialogSectionTitle(text = stringResource(R.string.dark_mode_preference))
|
|
|
|
Column(Modifier.selectableGroup()) {
|
|
|
|
Column(Modifier.selectableGroup()) {
|
|
|
|
SettingsDialogThemeChooserRow(
|
|
|
|
SettingsDialogThemeChooserRow(
|
|
|
|