Fix icons
This commit is contained in:
parent
b36145a373
commit
3c9e1b4557
4 changed files with 9 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.henryhiles.qweather.domain.weather
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import java.time.LocalDateTime
|
||||
|
||||
data class HourlyWeatherData(
|
||||
|
@ -9,4 +10,5 @@ data class HourlyWeatherData(
|
|||
val weatherType: WeatherType,
|
||||
val precipitationProbability: Int?,
|
||||
val windSpeed: Int,
|
||||
@DrawableRes val icon: Int = if(time.hour < 8 || time.hour >= 19) weatherType.nightIconRes else weatherType.iconRes
|
||||
)
|
|
@ -13,6 +13,7 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
@ -36,7 +37,6 @@ fun WeatherCard(hour: HourlyWeatherData?, modifier: Modifier = Modifier) {
|
|||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(
|
||||
|
@ -45,9 +45,10 @@ fun WeatherCard(hour: HourlyWeatherData?, modifier: Modifier = Modifier) {
|
|||
}
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Image(
|
||||
painter = painterResource(id = if(it.time.hour > 6 || it.time.hour < 8) it.weatherType.nightIconRes else it.weatherType.iconRes),
|
||||
painter = painterResource(id = it.icon),
|
||||
contentDescription = "Image of ${it.weatherType.weatherDesc}",
|
||||
modifier = Modifier.height(152.dp)
|
||||
modifier = Modifier.height(140.dp),
|
||||
contentScale = ContentScale.FillHeight
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Text(text = "${it.temperature}°C", fontSize = 50.sp)
|
||||
|
|
|
@ -38,7 +38,7 @@ fun WeatherHour(
|
|||
) {
|
||||
Text(text = formattedTime)
|
||||
Image(
|
||||
painter = painterResource(id = it.weatherType.iconRes),
|
||||
painter = painterResource(id = it.icon),
|
||||
contentDescription = "Image of ${it.weatherType.weatherDesc}",
|
||||
modifier = Modifier.width(40.dp)
|
||||
)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
android:viewportWidth="64"
|
||||
android:viewportHeight="64">
|
||||
<path
|
||||
android:pathData="M44.54,41.47A23,23 0,0 1,24.49 11.73,1 1,0 0,0 23,10.59 23,23 0,1 0,54.41 42a1,1 0,0 0,-1.14 -1.47A23.06,23.06 0,0 1,44.54 41.47Z"
|
||||
android:pathData="M48.171,45.314A32.271,32.26 0,0 1,20.039 3.6,1.403 1.403,0 0,0 17.948,2.001 32.271,32.26 0,1 0,62.02 46.057,1.403 1.403,0 0,0 60.42,43.996 32.356,32.344 0,0 1,48.171 45.314Z"
|
||||
android:strokeWidth="1.40286"
|
||||
android:fillColor="#efcc00"/>
|
||||
</vector>
|
||||
|
|
Reference in a new issue