Commit c05425b
committed
fix(theme): color the in-progress status text (Dracula yellow) and harden getColorAttr
The 'Connecting…' / 'Testing…' status text fell into the colorOnPrimary branch, which
renders dark on Dracula's light-purple primary instead of yellow. Add a
statusConnectingColor attr (default colorOnPrimary; Dracula = yellow) and use it for the
Connecting state.
While wiring it up, surfaced and fixed a latent crash in getColorAttr: when a theme attr
resolves to a literal color value (resourceId == 0) rather than a @color resource ref,
ContextCompat.getColor(0) threw Resources$NotFoundException (Resource ID #0x0). Now use
the literal data when it is a color type, falling back to TRANSPARENT otherwise. This
hardens every getColorAttr caller, not just the new attr.
Verified on-device (Dracula): connect no longer crashes; in-progress status renders yellow.1 parent 9e38302 commit c05425b
4 files changed
Lines changed: 27 additions & 4 deletions
File tree
- app/src/main
- java/io/nekohasekai/sagernet
- ktx
- widget
- res/values
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
287 | | - | |
288 | | - | |
289 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
290 | 304 | | |
291 | 305 | | |
292 | 306 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| 118 | + | |
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
642 | 644 | | |
643 | 645 | | |
644 | 646 | | |
| 647 | + | |
645 | 648 | | |
646 | 649 | | |
647 | 650 | | |
| |||
689 | 692 | | |
690 | 693 | | |
691 | 694 | | |
| 695 | + | |
692 | 696 | | |
693 | 697 | | |
694 | 698 | | |
| |||
0 commit comments