Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.android.developers.androidify.theme.AndroidifyTheme
Expand Down Expand Up @@ -78,6 +80,13 @@ internal fun CameraCaptureButton(
val disabledColor = MaterialTheme.colorScheme.surfaceContainer
val interactionSource = remember { MutableInteractionSource() }
val animationSpec = MaterialTheme.motionScheme.defaultSpatialSpec<Float>()

val semanticsDescription = if (enabled) {
stringResource(R.string.capture_image_button_enabled_content_description)
} else {
stringResource(R.string.capture_image_button_disabled_content_description)
}

Spacer(
modifier
.indication(interactionSource, ScaleIndicationNodeFactory(animationSpec))
Expand All @@ -90,6 +99,9 @@ internal fun CameraCaptureButton(
role = Role.Button,
onClickLabel = stringResource(R.string.cd_capture_button),
)
.semantics {
contentDescription = semanticsDescription
}
.size(size)
.drawWithCache {
val outerPath = path.copy().apply {
Expand Down
2 changes: 2 additions & 0 deletions feature/camera/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<string name="flip_camera_direction">Flip camera direction</string>
<string name="rear_camera_description">Enable Rear Camera</string>
<string name="camera_guide_text_label">Use guides to frame yourself for the perfect Bot</string>
<string name="capture_image_button_enabled_content_description">Capture image</string>
<string name="capture_image_button_disabled_content_description">Image capture disabled. Make sure your face is clearly visible in the frame.</string>

<string-array name="camera_result_compliments">
<item>Great shot!</item>
Expand Down