@@ -112,7 +112,7 @@ fun LocationScreenForecast(
112
112
onLocationChange : (String ) -> Unit ,
113
113
modifier : Modifier = Modifier
114
114
) {
115
- val expandedDays = remember { mutableStateMapOf<String , Int >() }
115
+ val expandedDays = rememberSaveable(saver = indexSaver) { mutableStateMapOf<String , Int >() }
116
116
LocationScreenForecast (
117
117
forecast = locationForecast,
118
118
onLocationChange = onLocationChange,
@@ -154,11 +154,13 @@ fun LocationScreenForecast(
154
154
contentDescription = label
155
155
}) {
156
156
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
+ }
162
164
}
163
165
}
164
166
}
@@ -175,19 +177,19 @@ fun TopAppBar(
175
177
title = {
176
178
Row (verticalAlignment = Alignment .CenterVertically ) {
177
179
IconButton (
178
- onClick = { onLocationChange(" Mountain View " ) }
180
+ onClick = { onLocationChange(" Sunnyvale " ) }
179
181
) {
180
182
Icon (
181
183
Icons .Default .KeyboardArrowLeft ,
182
184
stringResource(R .string.prev_location)
183
185
)
184
186
}
185
187
Text (
186
- " //TODO " ,
188
+ locationName ,
187
189
modifier = Modifier .padding(horizontal = 32 .dp)
188
190
)
189
191
IconButton (
190
- onClick = { onLocationChange(" Sunnyvale " ) }
192
+ onClick = { onLocationChange(" Mountain View " ) }
191
193
) {
192
194
Icon (
193
195
Icons .Default .KeyboardArrowRight ,
0 commit comments