Skip to content

Commit

Permalink
Update Vocalization with jetpackcompe (#594)
Browse files Browse the repository at this point in the history
* Update Vocalization : Add LiveRegion with jetpackcompe
Update Keyboard navigation :  Keyboard navigation with jetpackcompoe

* Update navigation-vocale.md

---------

Co-authored-by: Pierre-Yves Ayoul <[email protected]>
  • Loading branch information
afrahB and pya35 authored Jan 9, 2025
1 parent 1448f48 commit 9d5b280
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/fr/mobile/android/developpement/navigation-focus.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,38 @@ Exemple de sélecteur qui prend en compte l’état `state_focused` :
&lt;item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/draw_selected_pressed_selector" /&gt;
&lt;/selector&gt;</code></pre>

<pre>
<code class="kotlin">
// Avec Jetpack Compose
@Composable
fun CustomDrawableSelector(
isFocused: Boolean,
isSelected: Boolean,
isPressed: Boolean
) {
val drawableRes = when {
!isFocused && !isSelected && !isPressed -> R.drawable.draw_unselected_selector
!isFocused && isSelected && !isPressed -> R.drawable.draw_selected_selector
isFocused && !isSelected && !isPressed -> R.drawable.draw_unselected_focused_selector
isFocused && isSelected && !isPressed -> R.drawable.draw_selected_focused_selector
!isFocused && !isSelected && isPressed -> R.drawable.draw_unselected_pressed_selector
!isFocused && isSelected && isPressed -> R.drawable.draw_selected_pressed_selector
isFocused && !isSelected && isPressed -> R.drawable.draw_unselected_pressed_selector
isFocused && isSelected && isPressed -> R.drawable.draw_selected_pressed_selector
else -> R.drawable.draw_unselected_selector // Default fallback
}

Image(
painter = painterResource(id = drawableRes),
contentDescription = null,
modifier = Modifier
.size(48.dp) // Adjust size as needed
)
}

</code>
</pre>

Exemple d'une vue focusable avec la navigation au clavier
<pre><code>&lt;View android:focusable="true"
android:layout_width="0px"
Expand Down
16 changes: 16 additions & 0 deletions src/fr/mobile/android/developpement/navigation-vocale.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,22 @@ Il est fréquent de tester la version d’Android avant de déclencher une vocal
android:accessibilityLiveRegion="polite" /&gt;
</code></pre>

**Exemple de région live avec Jetpack Compose**:

<pre>
<code class="kotlin">@Composable
fun PoliteAccessibilityRegion() {
Column {
Text(
text = "Contenu mis à jour pour l'accessibilité",
modifier = Modifier.accessibilityLiveRegion(AccessibilityLiveRegion.Polite)
)
}
}
</code></pre>



## Ne pas vocaliser les éléments décoratifs et cachés

**Cible&nbsp;:** tout le monde et en particulier les personnes déficientes visuelles.
Expand Down

0 comments on commit 9d5b280

Please sign in to comment.