File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
java/com/android/developers/androidify/camera Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ import androidx.compose.ui.graphics.drawscope.Stroke
40
40
import androidx.compose.ui.platform.LocalDensity
41
41
import androidx.compose.ui.res.stringResource
42
42
import androidx.compose.ui.semantics.Role
43
+ import androidx.compose.ui.semantics.contentDescription
44
+ import androidx.compose.ui.semantics.semantics
43
45
import androidx.compose.ui.tooling.preview.Preview
44
46
import androidx.compose.ui.unit.dp
45
47
import com.android.developers.androidify.theme.AndroidifyTheme
@@ -78,6 +80,13 @@ internal fun CameraCaptureButton(
78
80
val disabledColor = MaterialTheme .colorScheme.surfaceContainer
79
81
val interactionSource = remember { MutableInteractionSource () }
80
82
val animationSpec = MaterialTheme .motionScheme.defaultSpatialSpec<Float >()
83
+
84
+ val semanticsDescription = if (enabled) {
85
+ stringResource(R .string.capture_image_button_enabled_content_description)
86
+ } else {
87
+ stringResource(R .string.capture_image_button_disabled_content_description)
88
+ }
89
+
81
90
Spacer (
82
91
modifier
83
92
.indication(interactionSource, ScaleIndicationNodeFactory (animationSpec))
@@ -90,6 +99,9 @@ internal fun CameraCaptureButton(
90
99
role = Role .Button ,
91
100
onClickLabel = stringResource(R .string.cd_capture_button),
92
101
)
102
+ .semantics {
103
+ contentDescription = semanticsDescription
104
+ }
93
105
.size(size)
94
106
.drawWithCache {
95
107
val outerPath = path.copy().apply {
Original file line number Diff line number Diff line change 25
25
<string name =" flip_camera_direction" >Flip camera direction</string >
26
26
<string name =" rear_camera_description" >Enable Rear Camera</string >
27
27
<string name =" camera_guide_text_label" >Use guides to frame yourself for the perfect Bot</string >
28
+ <string name =" capture_image_button_enabled_content_description" >Capture image</string >
29
+ <string name =" capture_image_button_disabled_content_description" >Image capture disabled. Make sure your face is clearly visible in the frame.</string >
28
30
29
31
<string-array name =" camera_result_compliments" >
30
32
<item >Great shot!</item >
You can’t perform that action at this time.
0 commit comments