Commit 432c448
CMM-1973: Views card period selection and chart improvements (#22726)
* CMM-1973: Persist Views card chart type selection across sessions
Save the user's line/bar chart preference via SavedStateHandle (process
death) and SharedPreferences (app restart), mirroring the existing
period persistence pattern.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Show only current period in bar chart with wider bars
Remove previous period series from bar chart and increase bar
thickness from 8dp to 16dp for better readability.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Drill down period when tapping a bar in the chart
Tapping a bar changes the period selector to the tapped period:
daily bars drill into that single day, monthly bars into the full
month. Hourly bars (smallest granularity) are ignored.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Fix custom period granularity for drill-down
Single-day custom periods now use hourly granularity (24 data points)
and month-long periods use daily granularity. Threshold bumped from
30 to 31 so 31-day months don't fall into the monthly bucket.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Show previous period as grey line on bar chart
Overlay the previous period data as a grey line (no area fill)
on the bar chart so users can compare current vs previous at a
glance.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Use straight lines and dashed style for previous period
Replace cubic curves with sharp connectors in both line and bar
chart modes. Add dashed stroke to the previous period overlay
line in bar mode to match the line mode style.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Fix monthly bar tap to drill down into full month
Use the current period type to determine granularity instead of
guessing from the raw period format. The API returns daily-format
dates (YYYY-MM-DD) even for monthly data, so monthly taps now
correctly create a full-month Custom period (first to last day).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Add loading spinner on bar tap and fix custom period drill-down
Show a loading spinner overlay (with dimmed content) when tapping a
bar instead of replacing the card with a full shimmer skeleton.
Also fix drill-down for custom periods with monthly granularity
using the same daysBetween > 31 threshold as the repository.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Clean up duplicated constant and verbose modifier
Reuse existing isCustomPeriodMonthly() in drillDownPeriod() instead
of duplicating the MAX_DAYS_IN_MONTH threshold. Simplify the
conditional alpha modifier to idiomatic Compose style.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Add unit tests and consolidate chart type persistence
Move storage key conversion into ChartType enum (storageKey /
fromStorageKey), removing duplicated string constants and when
blocks. Add guard to ignore bar taps while a drill-down is already
loading. Add 10 unit tests covering chart type persistence,
drill-down edge cases, and the loading guard.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Fix double-load race, fragile date parsing, and reflection in test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Fix detekt issues (ReturnCount suppress, unused variable)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Fix crash when drilling down to hourly chart data
The Vico chart library crashes when CartesianValueFormatter returns
an empty string. Return a space for out-of-range x-axis indices.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Code review fixes — imports, formatter, parsing, cleanup
- Fix import ordering (CircularProgressIndicator in material3 group)
- Replace space workaround in x-axis formatter with merged labels
from both periods and toString() fallback
- Wrap date parsing in drillDownPeriod with try-catch for safety
- Extract drillDownMonth helper for clarity
- Remove stale test comment and identical if/else branches
- Remove extra blank line before @hiltviewmodel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Fire bar tap drill-down on marker hide instead of show
Store the tapped index in onShown and trigger the period change in
onHidden, so the user sees the marker tooltip before the chart
reloads.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Widen catch in drillDownPeriod to handle all parse errors
NumberFormatException from drillDownMonth() was not caught by the
DateTimeParseException-only catch block.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Catch specific exceptions instead of generic Exception
CI detekt flags TooGenericExceptionCaught. Catch both
DateTimeParseException and NumberFormatException explicitly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Suppress TooGenericExceptionCaught in drillDownPeriod
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* CMM-1973: Move TooGenericExceptionCaught suppress to function level
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 6c32946 commit 432c448
File tree
7 files changed
+538
-68
lines changed- WordPress/src
- main/java/org/wordpress/android/ui/newstats
- repository
- viewsstats
- test/java/org/wordpress/android/ui/newstats/viewsstats
7 files changed
+538
-68
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
| 527 | + | |
527 | 528 | | |
528 | 529 | | |
529 | 530 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
Lines changed: 19 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
512 | 513 | | |
513 | 514 | | |
514 | 515 | | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
515 | 531 | | |
516 | 532 | | |
517 | 533 | | |
518 | | - | |
| 534 | + | |
| 535 | + | |
519 | 536 | | |
520 | | - | |
| 537 | + | |
521 | 538 | | |
522 | 539 | | |
523 | 540 | | |
| |||
Lines changed: 127 additions & 55 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
| 78 | + | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
| |||
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| 120 | + | |
114 | 121 | | |
115 | 122 | | |
116 | 123 | | |
| |||
137 | 144 | | |
138 | 145 | | |
139 | 146 | | |
140 | | - | |
| 147 | + | |
141 | 148 | | |
142 | 149 | | |
143 | 150 | | |
| |||
256 | 263 | | |
257 | 264 | | |
258 | 265 | | |
| 266 | + | |
259 | 267 | | |
260 | 268 | | |
261 | 269 | | |
262 | 270 | | |
263 | 271 | | |
264 | 272 | | |
265 | 273 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
292 | 310 | | |
293 | 311 | | |
294 | 312 | | |
| |||
480 | 498 | | |
481 | 499 | | |
482 | 500 | | |
483 | | - | |
| 501 | + | |
| 502 | + | |
484 | 503 | | |
485 | 504 | | |
486 | 505 | | |
| |||
501 | 520 | | |
502 | 521 | | |
503 | 522 | | |
504 | | - | |
505 | 523 | | |
506 | | - | |
507 | | - | |
508 | | - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
509 | 531 | | |
510 | 532 | | |
511 | 533 | | |
| |||
534 | 556 | | |
535 | 557 | | |
536 | 558 | | |
537 | | - | |
538 | | - | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
539 | 568 | | |
540 | | - | |
541 | | - | |
| 569 | + | |
542 | 570 | | |
543 | 571 | | |
544 | 572 | | |
| |||
594 | 622 | | |
595 | 623 | | |
596 | 624 | | |
597 | | - | |
| 625 | + | |
598 | 626 | | |
599 | 627 | | |
600 | 628 | | |
601 | 629 | | |
602 | | - | |
| 630 | + | |
603 | 631 | | |
604 | 632 | | |
605 | 633 | | |
| |||
618 | 646 | | |
619 | 647 | | |
620 | 648 | | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
621 | 671 | | |
622 | 672 | | |
623 | 673 | | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
636 | 683 | | |
637 | | - | |
638 | | - | |
639 | 684 | | |
640 | | - | |
641 | | - | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
642 | 707 | | |
| 708 | + | |
643 | 709 | | |
644 | 710 | | |
645 | 711 | | |
646 | | - | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
647 | 715 | | |
648 | 716 | | |
649 | 717 | | |
| |||
821 | 889 | | |
822 | 890 | | |
823 | 891 | | |
| 892 | + | |
824 | 893 | | |
825 | 894 | | |
826 | 895 | | |
| |||
864 | 933 | | |
865 | 934 | | |
866 | 935 | | |
| 936 | + | |
867 | 937 | | |
868 | 938 | | |
869 | 939 | | |
| |||
879 | 949 | | |
880 | 950 | | |
881 | 951 | | |
| 952 | + | |
882 | 953 | | |
883 | 954 | | |
884 | 955 | | |
| |||
892 | 963 | | |
893 | 964 | | |
894 | 965 | | |
| 966 | + | |
895 | 967 | | |
896 | 968 | | |
897 | 969 | | |
| |||
0 commit comments