Some UI updates

This commit is contained in:
Henry Hiles 2023-12-25 14:51:27 -05:00
parent 3b456682f6
commit 01358325bf

View file

@ -2,6 +2,10 @@ package com.henryhiles.qweather.presentation.components.weather
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowDownward
import androidx.compose.material.icons.filled.ArrowUpward
import androidx.compose.material.icons.outlined.WaterDrop
import androidx.compose.material3.Card
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
@ -11,7 +15,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.henryhiles.qweather.R
import com.henryhiles.qweather.presentation.components.VerticalDivider
import com.henryhiles.qweather.presentation.screenmodel.HourlyWeatherState
import com.henryhiles.qweather.presentation.screenmodel.LocationPreferenceManager
import org.koin.compose.koinInject
@ -24,7 +27,10 @@ fun WeatherToday(state: HourlyWeatherState) {
Card(
shape = RoundedCornerShape(8.dp),
) {
Column(modifier = Modifier.padding(8.dp), horizontalAlignment = Alignment.CenterHorizontally) {
Column(
modifier = Modifier.padding(8.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = stringResource(id = R.string.today_in, with(locationPreferenceManager) {
locations.getOrNull(selectedIndex)?.location?.split(",")?.first()
@ -37,18 +43,25 @@ fun WeatherToday(state: HourlyWeatherState) {
modifier = Modifier
.height(24.dp)
.fillMaxWidth(),
horizontalArrangement = Arrangement.Center
horizontalArrangement = Arrangement.SpaceEvenly,
) {
Text(
text = stringResource(R.string.weather_high, it.highTemperature),
WeatherDataDisplay(
value = it.highTemperature,
unit = "°C",
icon = Icons.Default.ArrowUpward,
description = stringResource(R.string.weather_high, it.highTemperature)
)
VerticalDivider(modifier = Modifier.padding(horizontal = 8.dp))
Text(
text = stringResource(id = R.string.weather_low, it.lowTemperature)
WeatherDataDisplay(
value = it.lowTemperature,
unit = "°C",
icon = Icons.Default.ArrowDownward,
description = stringResource(id = R.string.weather_low, it.lowTemperature)
)
VerticalDivider(modifier = Modifier.padding(horizontal = 8.dp))
Text(
text = it.precipitationProbability?.let {
WeatherDataDisplay(
value = it.precipitationProbability,
unit = "%",
icon = Icons.Outlined.WaterDrop,
description = it.precipitationProbability?.let {
stringResource(
id = R.string.weather_precipitation,
it