@@ -112,7 +112,7 @@ fun LocationScreenForecast(
112112 onLocationChange : (String ) -> Unit ,
113113 modifier : Modifier = Modifier
114114) {
115- val expandedDays = remember { mutableStateMapOf<String , Int >() }
115+ val expandedDays = rememberSaveable(saver = indexSaver) { mutableStateMapOf<String , Int >() }
116116 LocationScreenForecast (
117117 forecast = locationForecast,
118118 onLocationChange = onLocationChange,
@@ -154,11 +154,13 @@ fun LocationScreenForecast(
154154 contentDescription = label
155155 }) {
156156 val index = 0
157- WeekForecastRow (
158- forecast.forecastWeek[index],
159- expanded = index == expandedDayIndex,
160- onClick = { onExpandedChanged(if (expandedDayIndex == index) - 1 else index) }
161- )
157+ forecast.forecastWeek.forEachIndexed { index, forecastDay ->
158+ WeekForecastRow (
159+ forecast.forecastWeek[index],
160+ expanded = index == expandedDayIndex,
161+ onClick = { onExpandedChanged(if (expandedDayIndex == index) - 1 else index) }
162+ )
163+ }
162164 }
163165 }
164166}
@@ -175,19 +177,19 @@ fun TopAppBar(
175177 title = {
176178 Row (verticalAlignment = Alignment .CenterVertically ) {
177179 IconButton (
178- onClick = { onLocationChange(" Mountain View " ) }
180+ onClick = { onLocationChange(" Sunnyvale " ) }
179181 ) {
180182 Icon (
181183 Icons .Default .KeyboardArrowLeft ,
182184 stringResource(R .string.prev_location)
183185 )
184186 }
185187 Text (
186- " //TODO " ,
188+ locationName ,
187189 modifier = Modifier .padding(horizontal = 32 .dp)
188190 )
189191 IconButton (
190- onClick = { onLocationChange(" Sunnyvale " ) }
192+ onClick = { onLocationChange(" Mountain View " ) }
191193 ) {
192194 Icon (
193195 Icons .Default .KeyboardArrowRight ,
0 commit comments