Apply card opacity preference to widget surfaces

This commit is contained in:
MM20
2023-02-21 16:48:01 +01:00
parent 1ba1eacd89
commit b0ce225c87
2 changed files with 8 additions and 2 deletions
@@ -38,6 +38,7 @@ import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.FilledTonalIconButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.PlainTooltipBox
@@ -73,6 +74,7 @@ import de.mm20.launcher2.ui.component.MissingPermissionBanner
import de.mm20.launcher2.ui.ktx.conditional
import de.mm20.launcher2.ui.launcher.transitions.HandleHomeTransition
import de.mm20.launcher2.ui.launcher.transitions.HomeTransitionParams
import de.mm20.launcher2.ui.locals.LocalCardStyle
import de.mm20.launcher2.ui.locals.LocalWindowSize
import kotlin.math.min
@@ -306,6 +308,9 @@ fun MusicWidget() {
FilledTonalIconButton(
modifier = Modifier
.size(40.dp),
colors = IconButtonDefaults.filledTonalIconButtonColors(
containerColor = MaterialTheme.colorScheme.secondaryContainer.copy(alpha = LocalCardStyle.current.opacity),
),
onClick = { viewModel.togglePause() },
shape = MaterialTheme.shapes.extraSmall,
) {
@@ -59,6 +59,7 @@ import de.mm20.launcher2.ui.component.weather.WeatherIcon
import de.mm20.launcher2.ui.icons.HumidityPercentage
import de.mm20.launcher2.ui.icons.Rain
import de.mm20.launcher2.ui.ktx.blendIntoViewScale
import de.mm20.launcher2.ui.locals.LocalCardStyle
import de.mm20.launcher2.weather.DailyForecast
import de.mm20.launcher2.weather.Forecast
import java.text.DateFormat
@@ -130,7 +131,7 @@ fun WeatherWidget() {
val currentDayForecasts by viewModel.currentDayForecasts.observeAsState(emptyList())
Surface(
color = MaterialTheme.colorScheme.surfaceVariant,
color = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = LocalCardStyle.current.opacity),
modifier = Modifier.fillMaxWidth()
) {
Column(
@@ -199,7 +200,7 @@ fun CurrentWeather(forecast: Forecast, imperialUnits: Boolean) {
topEnd = CornerSize(0),
bottomEnd = CornerSize(0)
),
color = MaterialTheme.colorScheme.secondaryContainer,
color = MaterialTheme.colorScheme.secondaryContainer.copy(alpha = LocalCardStyle.current.opacity),
) {
Text(
text = "${forecast.provider} (${