You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Result --> Overlay[":scanner-ui<br/>Overlay, summary, report sheet"]
23
-
```
24
-
25
-
`:scanner-core` owns the scan engine, models, result state, and `A11yRule` contract. `:scanner-rules` contains the built-in rules. `:scanner-ui` reads the Compose semantics tree, samples colors through `ColorExtractor`, runs scans, and draws issue overlays on top of the host UI.
26
-
27
-
## Installation
13
+
Add JitPack and the debug-only scanner dependency:
Use a debug-only dependency because the scanner is intended for development builds. `:scanner-ui` brings `:scanner-core` and `:scanner-rules` transitively.
31
+
That is all the integration required. AndroidX Startup automatically attaches the overlay and runs an initial scan for each `ComponentActivity` in a debuggable app. Release builds do not package the scanner when it is added with `debugImplementation`.
32
+
33
+
To request another scan, call the API from a debug source set (for example, `src/debug/java/.../ScannerActions.kt`):
35
34
36
-
## Integration
35
+
```kotlin
36
+
importcom.composea11yscanner.ComposeA11yScanner
37
37
38
-
### A11yScannerScaffold
38
+
ComposeA11yScanner.triggerScan()
39
+
```
39
40
40
-
Wrap the screen you want to inspect with `A11yScannerScaffold`. Provide an `A11yScannerController`that can extract nodes from your current Compose semantics tree.
41
+
For shake-to-scan, add one call to a debug-only composable that is active while the screen is visible:
41
42
42
43
```kotlin
43
-
@Composable
44
-
funDebugScannerScreen(
45
-
scannerController:A11yScannerController,
46
-
content: @Composable () ->Unit,
47
-
) {
48
-
val config = remember {
49
-
ScannerConfig(
50
-
enabledRules =ScannerRules.allRuleIds().toSet(),
51
-
autoScan =false,
52
-
)
53
-
}
44
+
importcom.composea11yscanner.triggers.scanOnShake
54
45
55
-
A11yScannerScaffold(
56
-
scannerController = scannerController,
57
-
config = config,
58
-
modifier =Modifier.fillMaxSize(),
59
-
) {
60
-
content()
61
-
}
46
+
@Composable
47
+
funApp() {
48
+
scanOnShake()
49
+
AppContent()
62
50
}
63
51
```
64
52
65
-
The scaffold renders your content first, then draws issue highlight boxes, the scan summary bar, and the issue detail sheet above it.
53
+
The scanner enables all built-in rules by default. The overlay is removed automatically when its activity is destroyed. Keep direct scanner imports in `src/debug`; a `debugImplementation` dependency is intentionally unavailable while compiling release sources.
66
54
67
-
### Shake To Scan
55
+
##Configuration
68
56
69
-
Call `scanOnShake()` from a composable that is active while the scanned screen is visible.
57
+
Optional manifest metadata configures the auto-installed scanner:
70
58
71
-
```kotlin
72
-
scanOnShake(
73
-
enabled =true,
74
-
onScanRequested = {
75
-
scannerController.startScan()
76
-
},
77
-
)
59
+
```xml
60
+
<application>
61
+
<meta-data
62
+
android:name="a11y_scanner_min_contrast"
63
+
android:value="4.5" />
64
+
<meta-data
65
+
android:name="a11y_scanner_auto_scan"
66
+
android:value="false" />
67
+
</application>
78
68
```
79
69
80
-
### Manual Trigger
70
+
### Manual installation
71
+
72
+
Use manual installation only when you need a programmatic `ScannerConfig`. First disable the automatic initializer in the app manifest:
If you use the top-level activity overlay API, call `ComposeA11yScanner.triggerScan()` instead.
104
+
Do not combine automatic and manual installation. Repeated installation on the same activity is ignored, but keeping one ownership path makes configuration predictable.
105
+
106
+
### Embedded scaffold
107
+
108
+
`A11yScannerScaffold` is the advanced API for apps that want the scanner UI inside their own Compose hierarchy or need a custom node provider. It requires an `A11yScannerController`; most integrations should use the automatic activity overlay above.
94
109
95
110
```kotlin
96
-
ComposeA11yScanner.triggerScan()
111
+
A11yScannerScaffold(
112
+
scannerController = scannerController,
113
+
config = config,
114
+
modifier =Modifier.fillMaxSize(),
115
+
) {
116
+
AppContent()
117
+
}
97
118
```
98
119
99
120
## Built-In Rules
@@ -149,3 +170,17 @@ val scannerController = A11yScannerController(
149
170
```
150
171
151
172
Custom rule IDs are automatically enabled by `A11yScannerController.withRules(...)` before each scan.
Rules[":scanner-rules<br/>Built-in and custom rules"] --> Core
182
+
Core --> Result["ScanResult / ScannerState"]
183
+
Result --> Overlay[":scanner-ui<br/>Overlay and issue details"]
184
+
```
185
+
186
+
`:scanner-core` owns the scan engine and public models. `:scanner-rules` contains built-in rules. `:scanner-ui` handles Android/Compose integration, node extraction, triggers, and the overlay.
0 commit comments