Commit 01bafb0
committed
Dashboard: Promote the stats card while on the charger
The battery-statistics card sat permanently at the tail of the dashboard,
so a live charge was several scrolls below the fold. It now claims the
second slot whenever external power is reported, and returns to the tail
when unplugged.
Promotion is plug-driven only: a device held at its limit reports
BATTERY_STATUS_NOT_CHARGING while still connected, so charge status must
not gate it. It is also independent of the card's content state — promo,
loading and unavailable are promoted too, so the slot can't shift under
the user while the stats DB answers. The promoted slot sits below the
interrupted-session warning and the access setup guide, which are rarer
and actionable.
The single "on the charger" rule moves to BatteryReadout.onCharger,
shared with the card's presentation mapping. The card keeps one lexical
construction site; only its placement is conditional. Every dashboard
item gains a stable LazyColumn key: index-keyed items would renumber when
the stats card moves and lose their remembered state — plugging in
mid-drag would have snapped the alarm slider back.
Statistics also lose their settings entry: the dashboard card is now the
only way in, so the capture switch lives next to the data it produces.
While a session is live the card's own tap deep-links into that session,
so the live state carries an explicit "History" action for the
past-sessions list; it must not bubble to the card's navigation, which is
asserted. With one entry point left, the stats screen's back paths
(top-bar and system) both return to the dashboard, so statsOrigin is gone.
AmplyNavigationCard's KDoc claimed it must hold no interactive controls,
which its own tested "Retry" button already contradicted; it now
describes the real contract (surface tap plus at most one small
non-bubbling text action).
Ordering assertions run at a tall Robolectric qualifier so every compared
card is composed — otherwise a failure would mean "scrolled out", not
"wrong order" — while above-the-fold assertions stay at the real screen
height. A live plug/unplug transition test covers the move itself.1 parent ae4bd4e commit 01bafb0
11 files changed
Lines changed: 379 additions & 139 deletions
File tree
- app/src
- main
- java/eu/darken/amply
- battery/core
- common/compose
- main/ui
- dashboard
- settings
- stats/ui
- res/values
- test/java/eu/darken/amply
- main/ui/dashboard
- stats/ui
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
315 | 320 | | |
316 | 321 | | |
317 | 322 | | |
| |||
Lines changed: 10 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | 109 | | |
113 | 110 | | |
114 | 111 | | |
| |||
207 | 204 | | |
208 | 205 | | |
209 | 206 | | |
210 | | - | |
| 207 | + | |
| 208 | + | |
211 | 209 | | |
212 | 210 | | |
213 | | - | |
214 | | - | |
215 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
216 | 215 | | |
217 | 216 | | |
218 | 217 | | |
219 | 218 | | |
220 | | - | |
221 | 219 | | |
222 | 220 | | |
223 | 221 | | |
| |||
256 | 254 | | |
257 | 255 | | |
258 | 256 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 257 | + | |
263 | 258 | | |
264 | 259 | | |
265 | 260 | | |
| |||
289 | 284 | | |
290 | 285 | | |
291 | 286 | | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | 287 | | |
297 | 288 | | |
298 | 289 | | |
| |||
367 | 358 | | |
368 | 359 | | |
369 | 360 | | |
370 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
371 | 364 | | |
372 | 365 | | |
373 | 366 | | |
| |||
Lines changed: 56 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
161 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
162 | 169 | | |
163 | 170 | | |
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
167 | 174 | | |
168 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
169 | 195 | | |
170 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
171 | 200 | | |
172 | 201 | | |
173 | 202 | | |
174 | 203 | | |
175 | | - | |
| 204 | + | |
176 | 205 | | |
177 | 206 | | |
178 | 207 | | |
| |||
186 | 215 | | |
187 | 216 | | |
188 | 217 | | |
189 | | - | |
| 218 | + | |
190 | 219 | | |
191 | 220 | | |
192 | 221 | | |
| |||
198 | 227 | | |
199 | 228 | | |
200 | 229 | | |
201 | | - | |
| 230 | + | |
202 | 231 | | |
203 | 232 | | |
204 | 233 | | |
| |||
212 | 241 | | |
213 | 242 | | |
214 | 243 | | |
215 | | - | |
| 244 | + | |
216 | 245 | | |
217 | 246 | | |
218 | 247 | | |
219 | 248 | | |
220 | 249 | | |
221 | | - | |
| 250 | + | |
222 | 251 | | |
223 | 252 | | |
224 | 253 | | |
| |||
231 | 260 | | |
232 | 261 | | |
233 | 262 | | |
234 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
235 | 268 | | |
236 | 269 | | |
237 | 270 | | |
238 | 271 | | |
239 | 272 | | |
240 | 273 | | |
241 | 274 | | |
242 | | - | |
| 275 | + | |
243 | 276 | | |
244 | 277 | | |
245 | 278 | | |
246 | | - | |
| 279 | + | |
247 | 280 | | |
248 | 281 | | |
249 | 282 | | |
| |||
255 | 288 | | |
256 | 289 | | |
257 | 290 | | |
258 | | - | |
259 | | - | |
260 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
261 | 295 | | |
262 | 296 | | |
263 | 297 | | |
| |||
266 | 300 | | |
267 | 301 | | |
268 | 302 | | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
| 303 | + | |
277 | 304 | | |
278 | 305 | | |
279 | 306 | | |
280 | | - | |
| 307 | + | |
281 | 308 | | |
282 | 309 | | |
283 | 310 | | |
| |||
302 | 329 | | |
303 | 330 | | |
304 | 331 | | |
305 | | - | |
| 332 | + | |
306 | 333 | | |
307 | 334 | | |
308 | 335 | | |
| |||
320 | 347 | | |
321 | 348 | | |
322 | 349 | | |
323 | | - | |
| 350 | + | |
324 | 351 | | |
325 | 352 | | |
326 | 353 | | |
| |||
332 | 359 | | |
333 | 360 | | |
334 | 361 | | |
335 | | - | |
| 362 | + | |
336 | 363 | | |
337 | 364 | | |
338 | 365 | | |
| |||
926 | 953 | | |
927 | 954 | | |
928 | 955 | | |
929 | | - | |
| 956 | + | |
| 957 | + | |
930 | 958 | | |
931 | 959 | | |
932 | 960 | | |
| |||
0 commit comments