mobileui-os 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +47 -0
- package/CHANGELOG.md +25 -0
- package/README.md +78 -0
- package/bin/cli.mjs +375 -0
- package/knowledge/android/00-apple-to-android-adaption.md +1499 -0
- package/knowledge/android/accessibility.md +333 -0
- package/knowledge/android/components-controls.md +270 -0
- package/knowledge/android/material-design-3.md +174 -0
- package/knowledge/android/navigation-patterns.md +212 -0
- package/knowledge/apple/00-skill-reading-protocol.md +1296 -0
- package/knowledge/apple/Accessibility, Inclusive Design & Human Factors Intelligence.md +735 -0
- package/knowledge/apple/Advanced Interaction Patterns, Gestures, Feedback & State Transitions.md +1140 -0
- package/knowledge/apple/Advanced Navigation, Information Architecture & Wayfinding.md +551 -0
- package/knowledge/apple/Autonomus Ui-UX Improvement Loop.md +611 -0
- package/knowledge/apple/Color, Materials, Contrast, Themes & Visual Depth.md +1351 -0
- package/knowledge/apple/Content, Copy, Microinteractions & UX Communication.md +642 -0
- package/knowledge/apple/Data-Heavy Interfaces, Tables, Lists, Search, Filtering & Large-Scale Content.md +721 -0
- package/knowledge/apple/Design Systems & Component Architecture.md +412 -0
- package/knowledge/apple/Forms, Input, Data Entry & Validation Intelligence.md +705 -0
- package/knowledge/apple/Interaction, State & Edge-Case Engineering.md +491 -0
- package/knowledge/apple/Interaction-behaviour.md +1378 -0
- package/knowledge/apple/Layout Architecture, Responsive Design & Spatial Systems.md +1365 -0
- package/knowledge/apple/MASTER UI-UX ORCHESTRATOR.md +1210 -0
- package/knowledge/apple/Navigation Architecture, Routing, Deep Linking & State Restoration.md +1392 -0
- package/knowledge/apple/Navigation, Information Architecture & Spatial Hierarchy.md +1613 -0
- package/knowledge/apple/Notifications, Permissions, Privacy and Trust.md +1540 -0
- package/knowledge/apple/Patterns-templates-composition.md +647 -0
- package/knowledge/apple/Performance, Perceived Speed, Motion & Rendering Intelligence.md +855 -0
- package/knowledge/apple/Responsive, Adaptive & Cross-Platform UI Intelligence.md +669 -0
- package/knowledge/apple/Responsive, Adaptive, Accessible & Performant UI.md +545 -0
- package/knowledge/apple/Tablet Adaptation & Multi-Device UX.md +1447 -0
- package/knowledge/apple/UI Implementation & Refactoring.md +498 -0
- package/knowledge/apple/UI-UX Decision-Making, Prioritization & Trade-offs.md +533 -0
- package/knowledge/apple/UI-UX Project Lifecycle & Delivery.md +544 -0
- package/knowledge/apple/User Flows & Experience Architecture.md +335 -0
- package/knowledge/apple/Visual Design Systems, Theming, Tokens & Brand Intelligence.md +764 -0
- package/knowledge/apple/Visual QA, Testing & Validation.md +557 -0
- package/knowledge/apple/accessibility-inclusive-interaction.md +1361 -0
- package/knowledge/apple/accessibility.md +2162 -0
- package/knowledge/apple/color.md +1933 -0
- package/knowledge/apple/component-architecture.md +2208 -0
- package/knowledge/apple/components.md +2172 -0
- package/knowledge/apple/design-decision-framework.md +1883 -0
- package/knowledge/apple/design-review-engine.md +2108 -0
- package/knowledge/apple/design-tokens.md +1943 -0
- package/knowledge/apple/designing-for-ios.md +1680 -0
- package/knowledge/apple/gestures, touch behavior, feedback, motion, and micro-interactions.md +1538 -0
- package/knowledge/apple/hig-foundation.md +1806 -0
- package/knowledge/apple/iconography.md +1903 -0
- package/knowledge/apple/interaction-patterns.md +2513 -0
- package/knowledge/apple/interaction.md +2141 -0
- package/knowledge/apple/ios-alerts-confirmations-destructive-actions.md +1342 -0
- package/knowledge/apple/ios-components-and-controls.md +1634 -0
- package/knowledge/apple/ios-components-patterns.md +1343 -0
- package/knowledge/apple/ios-design-system-architecture.md +1520 -0
- package/knowledge/apple/ios-empty-error-offline-states.md +1370 -0
- package/knowledge/apple/ios-empty-loading-error-recovery.md +1674 -0
- package/knowledge/apple/ios-forms-and-input.md +1458 -0
- package/knowledge/apple/ios-forms-input-data-entry.md +1308 -0
- package/knowledge/apple/ios-gestures-and-touch.md +1272 -0
- package/knowledge/apple/ios-lists-collections-and-data-display.md +1735 -0
- package/knowledge/apple/ios-loading-progress-async-states.md +1378 -0
- package/knowledge/apple/ios-materials-and-surfaces.md +1543 -0
- package/knowledge/apple/ios-motion-animation-transitions.md +1178 -0
- package/knowledge/apple/ios-navigation-and-information-architecture.md +1674 -0
- package/knowledge/apple/ios-navigation-user-flows-design-architecture.md +1195 -0
- package/knowledge/apple/ios-search-and-discovery.md +1456 -0
- package/knowledge/apple/ios-search-filtering-discovery.md +1402 -0
- package/knowledge/apple/ios-sheets-modals-popovers.md +1205 -0
- package/knowledge/apple/ios-typography-icons-visual-hierarchy.md +1431 -0
- package/knowledge/apple/layout.md +2331 -0
- package/knowledge/apple/media-centric-content-ui-patterns.md +1470 -0
- package/knowledge/apple/motion, transitions, physics, and animation language.md +1535 -0
- package/knowledge/apple/motion-and-animation.md +1698 -0
- package/knowledge/apple/motion.md +2087 -0
- package/knowledge/apple/navigation.md +2281 -0
- package/knowledge/apple/responsive-adaptive.md +2159 -0
- package/knowledge/apple/screen-architecture.md +2067 -0
- package/knowledge/apple/typography, Content Hierarchy & Readability.md +1411 -0
- package/knowledge/apple/typography.md +1802 -0
- package/knowledge/apple/ui-ux inteligence audit.md +106 -0
- package/knowledge/apple/visual-design-and-premium-ui.md +1555 -0
- package/knowledge/apple/visual-hierarchy-engine.md +1647 -0
- package/knowledge/apple/visual-materials.md +2189 -0
- package/package.json +53 -0
- package/principles/design-principles.md +37 -0
- package/principles/platform-principles.md +25 -0
- package/principles/ux-principles.md +16 -0
- package/references/official-links.md +11 -0
- package/skills/accessibility-engineer/SKILL.md +125 -0
- package/skills/analytics-engineer/SKILL.md +283 -0
- package/skills/animation-engineer/SKILL.md +316 -0
- package/skills/component-designer/SKILL.md +75 -0
- package/skills/component-library-engineer/SKILL.md +140 -0
- package/skills/component-library-ops/SKILL.md +155 -0
- package/skills/design-system/SKILL.md +77 -0
- package/skills/design-token-engineer/SKILL.md +203 -0
- package/skills/design-token-pipeline/SKILL.md +277 -0
- package/skills/device-lab-engineer/SKILL.md +387 -0
- package/skills/forms-engineer/SKILL.md +79 -0
- package/skills/internationalization-engineer/SKILL.md +256 -0
- package/skills/motion-designer/SKILL.md +77 -0
- package/skills/native-data-fetching/SKILL.md +50 -0
- package/skills/navigation-architect/SKILL.md +65 -0
- package/skills/performance-engineer/SKILL.md +250 -0
- package/skills/platform-specialist/SKILL.md +95 -0
- package/skills/pre-release-gate/SKILL.md +75 -0
- package/skills/screen-designer/SKILL.md +117 -0
- package/skills/security-engineer/SKILL.md +375 -0
- package/skills/skills.json +134 -0
- package/skills/testing-auditor/SKILL.md +62 -0
- package/skills/ui-architect/SKILL.md +86 -0
- package/skills/ui-implementer/SKILL.md +188 -0
- package/skills/ux-architect/SKILL.md +49 -0
- package/skills/ux-auditor/SKILL.md +52 -0
- package/skills/visual-auditor/SKILL.md +71 -0
- package/templates/audit-report.md +29 -0
- package/templates/design-tokens.ts +33 -0
- package/templates/screen-spec.md +61 -0
- package/workflows/new-screen.md +17 -0
- package/workflows/pre-release.md +21 -0
- package/workflows/redesign.md +14 -0
- package/workflows/ui-audit.md +22 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
# Android Accessibility Implementation
|
|
2
|
+
|
|
3
|
+
TalkBack, accessibility APIs, and implementation patterns for Android.
|
|
4
|
+
|
|
5
|
+
## TalkBack Basics
|
|
6
|
+
|
|
7
|
+
### Gesture Navigation
|
|
8
|
+
| Gesture | Action |
|
|
9
|
+
|---------|--------|
|
|
10
|
+
| Single tap | Select & speak |
|
|
11
|
+
| Double tap | Activate |
|
|
12
|
+
| Swipe right | Next element |
|
|
13
|
+
| Swipe left | Previous element |
|
|
14
|
+
| Swipe up/down | Granularity (char/word/line/heading) |
|
|
15
|
+
| Two-finger swipe | Scroll (bypass TalkBack) |
|
|
16
|
+
| Three-finger tap | Home |
|
|
17
|
+
| L-swipe (down-right) | Back |
|
|
18
|
+
|
|
19
|
+
### Announcement Priorities
|
|
20
|
+
- `polite` — Queue after current (default)
|
|
21
|
+
- `assertive` — Interrupt immediately
|
|
22
|
+
- `off` — No announcement
|
|
23
|
+
|
|
24
|
+
## View Accessibility
|
|
25
|
+
|
|
26
|
+
### Essential Attributes
|
|
27
|
+
```xml
|
|
28
|
+
<!-- Role + name (required for interactive) -->
|
|
29
|
+
<Button
|
|
30
|
+
android:text="Save"
|
|
31
|
+
android:contentDescription="Save changes" />
|
|
32
|
+
|
|
33
|
+
<!-- State -->
|
|
34
|
+
<Switch
|
|
35
|
+
android:checked="true"
|
|
36
|
+
android:contentDescription="Notifications, on" />
|
|
37
|
+
|
|
38
|
+
<!-- Live region for dynamic content -->
|
|
39
|
+
<TextView
|
|
40
|
+
android:id="@+id/status"
|
|
41
|
+
android:accessibilityLiveRegion="polite" />
|
|
42
|
+
|
|
43
|
+
<!-- Heading for navigation -->
|
|
44
|
+
<TextView
|
|
45
|
+
android:text="Settings"
|
|
46
|
+
android:accessibilityHeading="true" />
|
|
47
|
+
|
|
48
|
+
<!-- Group related elements -->
|
|
49
|
+
<LinearLayout
|
|
50
|
+
android:screenReaderFocusable="true"
|
|
51
|
+
android:focusable="true"
|
|
52
|
+
android:contentDescription="User profile section">
|
|
53
|
+
<!-- Children hidden from TalkBack -->
|
|
54
|
+
</LinearLayout>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Important Properties
|
|
58
|
+
| Property | Values | Use |
|
|
59
|
+
|----------|--------|-----|
|
|
60
|
+
| `importantForAccessibility` | yes, no, noHideDescendants, auto | Control exposure |
|
|
61
|
+
| `accessibilityHeading` | true/false | Heading navigation |
|
|
62
|
+
| `accessibilityLiveRegion` | none, polite, assertive | Announcements |
|
|
63
|
+
| `accessibilityPaneTitle` | string | Pane identification |
|
|
64
|
+
| `screenReaderFocusable` | true/false | Group focus |
|
|
65
|
+
| `focusable` | true/false | Input focus |
|
|
66
|
+
|
|
67
|
+
### Custom Actions
|
|
68
|
+
```kotlin
|
|
69
|
+
ViewCompat.replaceAccessibilityAction(
|
|
70
|
+
view,
|
|
71
|
+
AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_CLICK,
|
|
72
|
+
"Delete item",
|
|
73
|
+
null
|
|
74
|
+
) { _, _ ->
|
|
75
|
+
// Handle delete
|
|
76
|
+
true
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Custom AccessibilityDelegate
|
|
81
|
+
```kotlin
|
|
82
|
+
view.accessibilityDelegate = object : View.AccessibilityDelegate() {
|
|
83
|
+
override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfo) {
|
|
84
|
+
super.onInitializeAccessibilityNodeInfo(host, info)
|
|
85
|
+
info.className = "android.widget.Button"
|
|
86
|
+
info.isClickable = true
|
|
87
|
+
info.isEnabled = host.isEnabled
|
|
88
|
+
info.setCheckable(true)
|
|
89
|
+
info.isChecked = isSelected
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
override fun performAccessibilityAction(host: View, action: Int, args: Bundle?): Boolean {
|
|
93
|
+
return when (action) {
|
|
94
|
+
AccessibilityNodeInfo.ACTION_CLICK -> { performClick(); true }
|
|
95
|
+
else -> super.performAccessibilityAction(host, action, args)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Compose Accessibility
|
|
102
|
+
|
|
103
|
+
### Semantics Modifier
|
|
104
|
+
```kotlin
|
|
105
|
+
Text("Hello")
|
|
106
|
+
.semantics { heading() }
|
|
107
|
+
|
|
108
|
+
Button(onClick = { }) {
|
|
109
|
+
Text("Save")
|
|
110
|
+
}.semantics {
|
|
111
|
+
role = Role.Button
|
|
112
|
+
stateDescription = "Saves changes"
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
Box(
|
|
116
|
+
modifier = Modifier
|
|
117
|
+
.fillMaxWidth()
|
|
118
|
+
.semantics {
|
|
119
|
+
role = Role.Image
|
|
120
|
+
contentDescription = "Profile photo"
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Semantics Properties
|
|
126
|
+
| Property | Type | Use |
|
|
127
|
+
|----------|------|-----|
|
|
128
|
+
| `role` | Role | Button, Image, Heading, Text, etc. |
|
|
129
|
+
| `stateDescription` | String | Custom state text |
|
|
130
|
+
| `contentDescription` | String | Label for non-text |
|
|
131
|
+
| `heading` | Boolean | Heading navigation |
|
|
132
|
+
| `liveRegion` | LiveRegionMode | Polite/assertive |
|
|
133
|
+
| `mergeAllDescendants` | Boolean | Group children |
|
|
134
|
+
| `focusOrder` | Int | Custom traversal |
|
|
135
|
+
| `actions` | Map<Action, ()> | Custom actions |
|
|
136
|
+
|
|
137
|
+
### Focus Management
|
|
138
|
+
```kotlin
|
|
139
|
+
var focusRequester = remember { FocusRequester() }
|
|
140
|
+
|
|
141
|
+
Column {
|
|
142
|
+
Text("First").semantics { focusOrder = 1 }
|
|
143
|
+
Text("Second")
|
|
144
|
+
.semantics { focusOrder = 2 }
|
|
145
|
+
.onFocusChanged { if (it.hasFocus) focusRequester.requestFocus() }
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Touch Targets
|
|
150
|
+
|
|
151
|
+
### Minimum Sizes
|
|
152
|
+
| Platform | Minimum | Recommended |
|
|
153
|
+
|----------|---------|-------------|
|
|
154
|
+
| Android | 48×48dp | 56×56dp |
|
|
155
|
+
| iOS | 44×44pt | 48×48pt |
|
|
156
|
+
|
|
157
|
+
### Implementation
|
|
158
|
+
```xml
|
|
159
|
+
<!-- Visual 24dp, touch 48dp -->
|
|
160
|
+
<ImageButton
|
|
161
|
+
android:layout_width="24dp"
|
|
162
|
+
android:layout_height="24dp"
|
|
163
|
+
android:padding="12dp"
|
|
164
|
+
android:src="@drawable/ic_icon" />
|
|
165
|
+
|
|
166
|
+
<!-- Or use minTouchTargetSize (API 34+) -->
|
|
167
|
+
<Button
|
|
168
|
+
android:minTouchTargetSize="48dp" ... />
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Compose
|
|
172
|
+
```kotlin
|
|
173
|
+
Icon(
|
|
174
|
+
imageVector = Icons.Default.Favorite,
|
|
175
|
+
contentDescription = "Like",
|
|
176
|
+
modifier = Modifier
|
|
177
|
+
.size(24.dp)
|
|
178
|
+
.padding(12.dp) // 48dp touch target
|
|
179
|
+
.clickable { }
|
|
180
|
+
)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Dynamic Text / Font Scaling
|
|
184
|
+
|
|
185
|
+
### System Font Scale
|
|
186
|
+
- User setting: Settings → Accessibility → Font size
|
|
187
|
+
- Range: 0.85x (small) to 2.0x (largest)
|
|
188
|
+
- Test at 1.0x, 1.3x, 1.5x, 2.0x
|
|
189
|
+
|
|
190
|
+
### Implementation
|
|
191
|
+
```xml
|
|
192
|
+
<!-- Use sp for text -->
|
|
193
|
+
<TextView
|
|
194
|
+
android:textSize="16sp" ... />
|
|
195
|
+
|
|
196
|
+
<!-- Constraint max lines or ellipsize -->
|
|
197
|
+
<TextView
|
|
198
|
+
android:maxLines="2"
|
|
199
|
+
android:ellipsize="end" ... />
|
|
200
|
+
|
|
201
|
+
<!-- Or allow wrapping -->
|
|
202
|
+
<TextView
|
|
203
|
+
android:maxLines="5"
|
|
204
|
+
android:scrollHorizontally="false" ... />
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Compose
|
|
208
|
+
```kotlin
|
|
209
|
+
Text(
|
|
210
|
+
text = "Long text...",
|
|
211
|
+
fontSize = 16.sp,
|
|
212
|
+
maxLines = 2,
|
|
213
|
+
overflow = TextOverflow.Ellipsis,
|
|
214
|
+
modifier = Modifier
|
|
215
|
+
.fillMaxWidth()
|
|
216
|
+
.heightIn(min = 48.dp) // Prevent collapse
|
|
217
|
+
)
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Testing
|
|
221
|
+
```bash
|
|
222
|
+
# ADB commands
|
|
223
|
+
adb shell settings put system font_scale 1.3
|
|
224
|
+
adb shell settings put system font_scale 1.5
|
|
225
|
+
adb shell settings put system font_scale 2.0
|
|
226
|
+
adb shell settings put system font_scale 1.0 # Reset
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Contrast Requirements
|
|
230
|
+
|
|
231
|
+
### WCAG 2.1 AA (Minimum)
|
|
232
|
+
| Text Size | Contrast Ratio |
|
|
233
|
+
|-----------|----------------|
|
|
234
|
+
| Normal (< 18sp or < 14sp bold) | 4.5:1 |
|
|
235
|
+
| Large (≥ 18sp or ≥ 14sp bold) | 3:1 |
|
|
236
|
+
| UI Components (borders, icons) | 3:1 |
|
|
237
|
+
|
|
238
|
+
### WCAG 2.1 AAA (Enhanced)
|
|
239
|
+
| Text Size | Contrast Ratio |
|
|
240
|
+
|-----------|----------------|
|
|
241
|
+
| Normal | 7:1 |
|
|
242
|
+
| Large | 4.5:1 |
|
|
243
|
+
|
|
244
|
+
### Tools
|
|
245
|
+
- Accessibility Scanner (Play Store)
|
|
246
|
+
- `adb shell am start -n com.google.android.apps.accessibility.auditor/.AuditorActivity`
|
|
247
|
+
- Compose: `Preview(..., uiMode = UI_MODE_NIGHT_YES)`
|
|
248
|
+
|
|
249
|
+
## Reduced Motion
|
|
250
|
+
|
|
251
|
+
### System Setting
|
|
252
|
+
Settings → Accessibility → Remove animations
|
|
253
|
+
|
|
254
|
+
### Implementation
|
|
255
|
+
```kotlin
|
|
256
|
+
// Check preference
|
|
257
|
+
val reduceMotion = (context.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager)
|
|
258
|
+
.isTouchExplorationEnabled // Or check Settings.Secure.TRANSITION_ANIMATION_SCALE
|
|
259
|
+
|
|
260
|
+
// Compose
|
|
261
|
+
val reduceMotion = LocalReduceMotion.current
|
|
262
|
+
if (!reduceMotion) {
|
|
263
|
+
// Apply animation
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Disable Animations
|
|
268
|
+
```xml
|
|
269
|
+
<!-- In theme -->
|
|
270
|
+
<style name="Theme.App" parent="Theme.Material3.DayNight">
|
|
271
|
+
<item name="android:windowAnimationStyle">@null</item>
|
|
272
|
+
<item name="android:activityOpenEnterAnimation">@null</item>
|
|
273
|
+
<item name="android:activityOpenExitAnimation">@null</item>
|
|
274
|
+
</style>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## RTL Support
|
|
278
|
+
|
|
279
|
+
### Manifest
|
|
280
|
+
```xml
|
|
281
|
+
<application
|
|
282
|
+
android:supportsRtl="true"
|
|
283
|
+
... >
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Layout
|
|
287
|
+
```xml
|
|
288
|
+
<!-- Use start/end not left/right -->
|
|
289
|
+
<LinearLayout
|
|
290
|
+
android:layout_width="match_parent"
|
|
291
|
+
android:layout_height="wrap_content"
|
|
292
|
+
android:paddingStart="16dp"
|
|
293
|
+
android:paddingEnd="16dp">
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Drawables
|
|
297
|
+
- Place RTL versions in `drawable-ldrtl/`
|
|
298
|
+
- Or use `android:autoMirrored="true"` on vector drawables
|
|
299
|
+
|
|
300
|
+
### Compose
|
|
301
|
+
```kotlin
|
|
302
|
+
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
|
|
303
|
+
// RTL content
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## Testing Checklist
|
|
308
|
+
|
|
309
|
+
### Automated (CI)
|
|
310
|
+
- [ ] Accessibility Scanner: 0 errors
|
|
311
|
+
- [ ] Espresso: `onView(withId(...)).check(matches(hasContentDescription("...")))`
|
|
312
|
+
- [ ] Compose: `SemanticsMatcher` assertions
|
|
313
|
+
|
|
314
|
+
### Manual (Device)
|
|
315
|
+
- [ ] TalkBack: Full critical path navigation
|
|
316
|
+
- [ ] TalkBack: All states announced (loading, error, success)
|
|
317
|
+
- [ ] Font scale: 1.0x, 1.5x, 2.0x — no clipping
|
|
318
|
+
- [ ] Contrast: Scanner passes AA
|
|
319
|
+
- [ ] Touch targets: All ≥ 48dp
|
|
320
|
+
- [ ] RTL: Arabic/Hebrew — layout mirrors correctly
|
|
321
|
+
- [ ] Reduced motion: Animations disabled
|
|
322
|
+
- [ ] Switch Access: Full navigation
|
|
323
|
+
- [ ] Voice Access: Commands work
|
|
324
|
+
|
|
325
|
+
### Common Failures
|
|
326
|
+
- Missing contentDescription on ImageView/IconButton
|
|
327
|
+
- Custom views without AccessibilityDelegate
|
|
328
|
+
- Live regions not announcing errors
|
|
329
|
+
- Touch targets < 48dp
|
|
330
|
+
- Text clipped at 200% font scale
|
|
331
|
+
- Color-only state indication
|
|
332
|
+
- Focus order illogical
|
|
333
|
+
- RTL: icons not mirrored, layout not flipped
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# Android Components & Controls
|
|
2
|
+
|
|
3
|
+
Material 3 + Android-native components reference. Map Apple components → Android equivalents.
|
|
4
|
+
|
|
5
|
+
## Component Translation Map
|
|
6
|
+
|
|
7
|
+
| Apple (iOS) | Android Equivalent | Notes |
|
|
8
|
+
|-------------|-------------------|-------|
|
|
9
|
+
| Navigation Bar | Top App Bar / Toolbar | No large title equivalent; use collapsing toolbar |
|
|
10
|
+
| Tab Bar | Bottom Navigation | 3–5 items; labels required |
|
|
11
|
+
| Toolbar | Top App Bar | Can be contextual (edit mode) |
|
|
12
|
+
| Sheet | Bottom Sheet | Modal, persistent, or standard |
|
|
13
|
+
| Alert | Dialog / AlertDialog | Button order: dismiss → confirm |
|
|
14
|
+
| Action Sheet | Bottom Sheet / Menu | Context-dependent |
|
|
15
|
+
| Popover | Dropdown Menu / Tooltip | No direct equivalent |
|
|
16
|
+
| Modal View | Dialog / Full-screen Dialog | Full-screen for complex flows |
|
|
17
|
+
| Popover (iPad) | Dialog / Bottom Sheet | Consider screen size |
|
|
18
|
+
| Split View | Two-pane Layout / Navigation Rail | Tablet/large screen |
|
|
19
|
+
| Page Control | Tab Layout / Indicator | Scrollable or fixed |
|
|
20
|
+
| Segmented Control | Chip Group / Tab Layout | Single selection |
|
|
21
|
+
| Stepper | Slider / Number Input | No direct equivalent |
|
|
22
|
+
| Picker (Date/Time) | MaterialDatePicker / MaterialTimePicker | Modal bottom sheet |
|
|
23
|
+
| Switch | SwitchMaterial | Track + thumb |
|
|
24
|
+
| Slider | Slider | Continuous or discrete |
|
|
25
|
+
| Progress View | LinearProgressIndicator / CircularProgressIndicator | Determinate/indeterminate |
|
|
26
|
+
| Activity Indicator | CircularProgressIndicator | Indeterminate only |
|
|
27
|
+
| Refresh Control | SwipeRefreshLayout | Pull-to-refresh |
|
|
28
|
+
| Search Bar | SearchView / MaterialSearchBar | Expandable in toolbar |
|
|
29
|
+
| Collection View | RecyclerView / LazyColumn | Adapter-based |
|
|
30
|
+
| Table View | RecyclerView / LazyColumn | Single column |
|
|
31
|
+
| Text Field | TextInputLayout + TextInputEditText | Floating label |
|
|
32
|
+
| Label | TextView | Style with typography tokens |
|
|
33
|
+
| Button | MaterialButton / Button | Filled, tonal, outlined, text |
|
|
34
|
+
| Image View | ImageView / Coil / Glide | Async loading |
|
|
35
|
+
| Scroll View | NestedScrollView / Column(Modifier.verticalScroll) | Nested scrolling |
|
|
36
|
+
| Stack View | LinearLayout / Column / Row | Flexbox-like |
|
|
37
|
+
| Safe Area | WindowInsets / PaddingValues | System bars, cutouts |
|
|
38
|
+
| Haptic Feedback | HapticFeedbackConstants / Vibrator | Map intent, not pattern |
|
|
39
|
+
| Notification | NotificationManager + Channels | Required for Android 8+ |
|
|
40
|
+
| Permission | ActivityResultContracts.RequestPermission | Runtime, explain first |
|
|
41
|
+
|
|
42
|
+
## Detailed Component Specs
|
|
43
|
+
|
|
44
|
+
### MaterialButton
|
|
45
|
+
```kotlin
|
|
46
|
+
// Filled (primary)
|
|
47
|
+
Button(onClick = { }) { Text("Primary") }
|
|
48
|
+
|
|
49
|
+
// Filled Tonal (secondary)
|
|
50
|
+
Button(onClick = { }, colors = ButtonDefaults.filledTonalButtonColors()) { Text("Secondary") }
|
|
51
|
+
|
|
52
|
+
// Outlined (tertiary)
|
|
53
|
+
OutlinedButton(onClick = { }) { Text("Tertiary") }
|
|
54
|
+
|
|
55
|
+
// Text (low emphasis)
|
|
56
|
+
TextButton(onClick = { }) { Text("Text") }
|
|
57
|
+
```
|
|
58
|
+
- Height: 40dp
|
|
59
|
+
- Horizontal padding: 24dp (12dp for icon buttons)
|
|
60
|
+
- Corner radius: 12dp (20dp for FAB)
|
|
61
|
+
- Label: 14sp, 500 weight, all caps (configurable)
|
|
62
|
+
|
|
63
|
+
### TextInputLayout + TextInputEditText
|
|
64
|
+
```xml
|
|
65
|
+
<com.google.android.material.textfield.TextInputLayout
|
|
66
|
+
style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
|
|
67
|
+
android:hint="Email"
|
|
68
|
+
app:helperText="We'll never share your email"
|
|
69
|
+
app:errorEnabled="true">
|
|
70
|
+
<com.google.android.material.textfield.TextInputEditText
|
|
71
|
+
android:inputType="textEmailAddress"
|
|
72
|
+
android:autofillHints="email" />
|
|
73
|
+
</com.google.android.material.textfield.TextInputLayout>
|
|
74
|
+
```
|
|
75
|
+
- States: idle, hover, focus, error, disabled
|
|
76
|
+
- Floating label animates to top
|
|
77
|
+
- Helper/error text below: 12sp
|
|
78
|
+
- Character counter: optional, right-aligned
|
|
79
|
+
|
|
80
|
+
### SwitchMaterial
|
|
81
|
+
```xml
|
|
82
|
+
<com.google.android.material.switchmaterial.SwitchMaterial
|
|
83
|
+
android:text="Notifications"
|
|
84
|
+
android:checked="false" />
|
|
85
|
+
```
|
|
86
|
+
- Track: 28×16dp, thumb: 20×20dp
|
|
87
|
+
- Animation: 150ms standard easing
|
|
88
|
+
- Touch target: 48×48dp (extends beyond visual)
|
|
89
|
+
|
|
90
|
+
### Slider
|
|
91
|
+
```xml
|
|
92
|
+
<com.google.android.material.slider.Slider
|
|
93
|
+
android:valueFrom="0"
|
|
94
|
+
android:valueTo="100"
|
|
95
|
+
android:stepSize="1"
|
|
96
|
+
android:value="50"
|
|
97
|
+
android:labelFormatter="@{value -> "${value}%"}" />
|
|
98
|
+
```
|
|
99
|
+
- Track: 4dp height
|
|
100
|
+
- Thumb: 20×20dp (rest), 28×28dp (active)
|
|
101
|
+
- Value label: tooltip on drag
|
|
102
|
+
- Discrete: tick marks at steps
|
|
103
|
+
|
|
104
|
+
### BottomSheetBehavior
|
|
105
|
+
```kotlin
|
|
106
|
+
val behavior = BottomSheetBehavior.from(bottomSheet)
|
|
107
|
+
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
|
|
108
|
+
behavior.peekHeight = 300
|
|
109
|
+
behavior.isHideable = true
|
|
110
|
+
```
|
|
111
|
+
- States: COLLAPSED, HALF_EXPANDED, EXPANDED, HIDDEN
|
|
112
|
+
- Drag handle: 24×4dp, centered top
|
|
113
|
+
- Modal: `BottomSheetDialogFragment`
|
|
114
|
+
- Persistent: coordinate with parent layout
|
|
115
|
+
|
|
116
|
+
### NavigationView (Drawer)
|
|
117
|
+
```xml
|
|
118
|
+
<com.google.android.material.navigation.NavigationView
|
|
119
|
+
app:menu="@menu/drawer_menu"
|
|
120
|
+
app:headerLayout="@layout/drawer_header"
|
|
121
|
+
app:itemIconTint="?attr/colorOnSurfaceVariant"
|
|
122
|
+
app:itemTextColor="?attr/colorOnSurface" />
|
|
123
|
+
```
|
|
124
|
+
- Menu: groups with checkableBehavior="single"
|
|
125
|
+
- Header: avatar, name, email
|
|
126
|
+
- Width: 280–320dp
|
|
127
|
+
|
|
128
|
+
### Chip / ChipGroup
|
|
129
|
+
```xml
|
|
130
|
+
<com.google.android.material.chip.ChipGroup
|
|
131
|
+
android:singleSelection="true"
|
|
132
|
+
android:checkedChip="@id/chip_option1">
|
|
133
|
+
<com.google.android.material.chip.Chip
|
|
134
|
+
android:id="@+id/chip_option1"
|
|
135
|
+
android:text="Option 1" />
|
|
136
|
+
</com.google.android.material.chip.ChipGroup>
|
|
137
|
+
```
|
|
138
|
+
- Types: Filter (toggle), Input (removable), Suggestion, Assist
|
|
139
|
+
- Height: 32dp
|
|
140
|
+
- Corner: full (pill)
|
|
141
|
+
|
|
142
|
+
### Progress Indicators
|
|
143
|
+
```xml
|
|
144
|
+
<!-- Linear (determinate) -->
|
|
145
|
+
<com.google.android.material.progressindicator.LinearProgressIndicator
|
|
146
|
+
android:progress="50"
|
|
147
|
+
android:indeterminate="false" />
|
|
148
|
+
|
|
149
|
+
<!-- Circular (indeterminate) -->
|
|
150
|
+
<com.google.android.material.progressindicator.CircularProgressIndicator
|
|
151
|
+
android:indeterminate="true" />
|
|
152
|
+
```
|
|
153
|
+
- Track: 4dp (linear), 4dp stroke (circular)
|
|
154
|
+
- Color: primary
|
|
155
|
+
- Animation: 1000ms repeat (indeterminate)
|
|
156
|
+
|
|
157
|
+
### Snackbar
|
|
158
|
+
```kotlin
|
|
159
|
+
Snackbar.make(view, "Message saved", Snackbar.LENGTH_LONG)
|
|
160
|
+
.setAction("Undo") { }
|
|
161
|
+
.show()
|
|
162
|
+
```
|
|
163
|
+
- Duration: SHORT (4s), LONG (10s), INDEFINITE
|
|
164
|
+
- Action: optional, max 1
|
|
165
|
+
- Position: bottom, above nav bar
|
|
166
|
+
- Swipe to dismiss
|
|
167
|
+
|
|
168
|
+
## Platform-Specific Controls
|
|
169
|
+
|
|
170
|
+
### MaterialDatePicker / MaterialTimePicker
|
|
171
|
+
```kotlin
|
|
172
|
+
val picker = MaterialDatePicker.Builder.datePicker().build()
|
|
173
|
+
picker.show(supportFragmentManager, "DATE_PICKER")
|
|
174
|
+
```
|
|
175
|
+
- Modal bottom sheet
|
|
176
|
+
- Calendar or text input mode
|
|
177
|
+
- Range selection supported
|
|
178
|
+
- Themeable via `MaterialCalendarTheme`
|
|
179
|
+
|
|
180
|
+
### Menu / PopupMenu
|
|
181
|
+
```xml
|
|
182
|
+
<menu>
|
|
183
|
+
<item android:id="@+id/share" android:title="Share" android:icon="@drawable/ic_share" />
|
|
184
|
+
<item android:id="@+id/delete" android:title="Delete" android:icon="@drawable/ic_delete" />
|
|
185
|
+
</menu>
|
|
186
|
+
```
|
|
187
|
+
- Overflow menu (toolbar)
|
|
188
|
+
- Contextual action bar (selection mode)
|
|
189
|
+
- Dropdown menu (anchor to view)
|
|
190
|
+
|
|
191
|
+
### SwipeRefreshLayout
|
|
192
|
+
```xml
|
|
193
|
+
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
|
194
|
+
android:id="@+id/swipe_refresh">
|
|
195
|
+
<androidx.recyclerview.widget.RecyclerView ... />
|
|
196
|
+
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
|
197
|
+
```
|
|
198
|
+
- Pull distance: 96dp
|
|
199
|
+
- Spinner: Material circular progress
|
|
200
|
+
- Colors: primary, accent, etc.
|
|
201
|
+
|
|
202
|
+
### CoordinatorLayout Behaviors
|
|
203
|
+
- AppBarLayout: collapsing toolbar
|
|
204
|
+
- BottomSheetBehavior: sheets
|
|
205
|
+
- SwipeDismissBehavior: dismissable items
|
|
206
|
+
- AnchorBehavior: FAB attached to app bar
|
|
207
|
+
|
|
208
|
+
## Accessibility Implementation
|
|
209
|
+
|
|
210
|
+
### Content Descriptions
|
|
211
|
+
```xml
|
|
212
|
+
<ImageView
|
|
213
|
+
android:contentDescription="@string/share_image_desc"
|
|
214
|
+
android:importantForAccessibility="yes" />
|
|
215
|
+
|
|
216
|
+
<Button
|
|
217
|
+
android:text="Delete"
|
|
218
|
+
android:contentDescription="Delete this item permanently" />
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### State Descriptions
|
|
222
|
+
```kotlin
|
|
223
|
+
view.setAccessibilityDelegate(object : AccessibilityDelegate() {
|
|
224
|
+
override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfo) {
|
|
225
|
+
super.onInitializeAccessibilityNodeInfo(host, info)
|
|
226
|
+
info.setCheckable(true)
|
|
227
|
+
info.setChecked(isSelected)
|
|
228
|
+
info.setSelected(isSelected)
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Traversal Order
|
|
234
|
+
```xml
|
|
235
|
+
<LinearLayout
|
|
236
|
+
android:screenReaderFocusable="true"
|
|
237
|
+
android:focusable="true">
|
|
238
|
+
<!-- Order follows XML/layout order -->
|
|
239
|
+
</LinearLayout>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Live Regions (Announcements)
|
|
243
|
+
```xml
|
|
244
|
+
<TextView
|
|
245
|
+
android:id="@+id/error_message"
|
|
246
|
+
android:accessibilityLiveRegion="polite"
|
|
247
|
+
android:text="@string/error_network" />
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Touch Target Enforcement
|
|
251
|
+
|
|
252
|
+
```kotlin
|
|
253
|
+
// In Compose
|
|
254
|
+
Modifier
|
|
255
|
+
.size(24.dp) // Visual size
|
|
256
|
+
.padding(12.dp) // Touch target = 48dp
|
|
257
|
+
.clickable { }
|
|
258
|
+
|
|
259
|
+
// In Views
|
|
260
|
+
<ImageButton
|
|
261
|
+
android:layout_width="48dp"
|
|
262
|
+
android:layout_height="48dp"
|
|
263
|
+
android:src="@drawable/ic_icon"
|
|
264
|
+
android:padding="12dp" />
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Resources
|
|
268
|
+
- Material Components: https://github.com/material-components/material-components-android
|
|
269
|
+
- Compose Material3: https://developer.android.com/jetpack/compose/material3
|
|
270
|
+
- Android Views: https://developer.android.com/develop/ui/views
|