Skip to content

Commit

Permalink
You can no longer go back in time
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry-Hiles committed Dec 25, 2023
1 parent 841447c commit 43b7b42
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.henryhiles.qweather.presentation.components.weather
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
Expand All @@ -17,15 +16,14 @@ fun WeatherForecast(
onChangeSelected: (Int) -> Unit
) {
state.hourlyWeatherInfo?.weatherData?.let {
val rowState = rememberLazyListState(LocalDateTime.now().hour)
LazyRow(state = rowState, modifier = modifier) {
itemsIndexed(it) { index, data ->
val hour = LocalDateTime.now().hour
LazyRow(modifier = modifier) {
itemsIndexed(it.subList(hour, it.size)) { index, data ->
WeatherHour(
data = data,
modifier = Modifier
.padding(horizontal = 8.dp),
onChangeSelected = { onChangeSelected(index) }
)
.padding(horizontal = 8.dp)
) { onChangeSelected(index) }
}
}
}
Expand Down

0 comments on commit 43b7b42

Please sign in to comment.