Merge pull request #1845 from vector-im/feature/bma/sendingStateA11y

Content description: add for sending state and fix other issues.
This commit is contained in:
Benoit Marty 2023-11-22 17:51:48 +01:00 committed by GitHub
commit 68c4f1e6bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 90 additions and 49 deletions

View file

@ -70,7 +70,7 @@ fun RoundedIconAtom(
tint = tint,
resourceId = resourceId,
imageVector = imageVector,
contentDescription = "",
contentDescription = null,
)
}
}

View file

@ -51,7 +51,7 @@ fun BackButton(
@Composable
internal fun BackButtonPreview() = ElementThemedPreview {
Column {
BackButton(onClick = { }, enabled = true, contentDescription = "Back")
BackButton(onClick = { }, enabled = false, contentDescription = "Back")
BackButton(onClick = { }, enabled = true)
BackButton(onClick = { }, enabled = false)
}
}

View file

@ -51,7 +51,7 @@ fun PreferenceIcon(
Icon(
imageVector = icon,
resourceId = iconResourceId,
contentDescription = "",
contentDescription = null,
tint = tintColor ?: enabled.toSecondaryEnabledColor(),
modifier = Modifier
.padding(end = 16.dp)

View file

@ -66,7 +66,7 @@ internal fun FloatingActionButtonPreview() =
private fun ContentToPreview() {
Box(modifier = Modifier.padding(8.dp)) {
FloatingActionButton(onClick = {}) {
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = "")
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = null)
}
}
}

View file

@ -145,5 +145,5 @@ internal fun IconImageVectorPreview() =
@Composable
private fun ContentToPreview() {
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = "")
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = null)
}

View file

@ -67,20 +67,20 @@ private fun ContentToPreview() {
CompositionLocalProvider(LocalContentColor provides ElementTheme.colors.iconPrimary) {
Row {
IconButton(onClick = {}) {
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = "")
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = null)
}
IconButton(enabled = false, onClick = {}) {
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = "")
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = null)
}
}
}
CompositionLocalProvider(LocalContentColor provides ElementTheme.colors.iconSecondary) {
Row {
IconButton(onClick = {}) {
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = "")
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = null)
}
IconButton(enabled = false, onClick = {}) {
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = "")
Icon(resourceId = CommonDrawables.ic_compound_close, contentDescription = null)
}
}
}

View file

@ -69,7 +69,7 @@ private fun ContentToPreview() {
val icon: @Composable () -> Unit = {
Icon(
imageVector = if (checked) Icons.Default.CheckCircle else Icons.Default.RadioButtonUnchecked,
contentDescription = "IconToggleButton"
contentDescription = null
)
}
IconToggleButton(checked = checked, enabled = true, onCheckedChange = { checked = !checked }, content = icon)
@ -79,7 +79,7 @@ private fun ContentToPreview() {
val icon: @Composable () -> Unit = {
Icon(
imageVector = if (!checked) Icons.Default.CheckCircle else Icons.Default.RadioButtonUnchecked,
contentDescription = "IconToggleButton"
contentDescription = null
)
}
IconToggleButton(checked = !checked, enabled = true, onCheckedChange = { checked = !checked }, content = icon)

View file

@ -43,7 +43,10 @@ internal fun MenuPreview() {
for (i in 0..5) {
val leadingIcon: @Composable (() -> Unit)? = if (i in 2..3) {
@Composable {
Icon(Icons.Filled.Favorite, contentDescription = "Favorite")
Icon(
imageVector = Icons.Filled.Favorite,
contentDescription = null
)
}
} else {
null
@ -53,7 +56,7 @@ internal fun MenuPreview() {
@Composable {
Icon(
resourceId = CommonDrawables.ic_compound_chevron_right,
contentDescription = "Favorite",
contentDescription = null,
)
}
} else {

View file

@ -87,7 +87,7 @@ fun EditableAvatarView(
Icon(
modifier = Modifier.size(16.dp),
resourceId = CommonDrawables.ic_edit,
contentDescription = "",
contentDescription = null,
tint = MaterialTheme.colorScheme.onPrimary,
)
}

View file

@ -79,7 +79,7 @@ fun UnresolvedUserRow(
) {
Icon(
resourceId = CommonDrawables.ic_compound_error,
contentDescription = "",
contentDescription = null,
modifier = Modifier
.size(18.dp)
.align(Alignment.Top)

View file

@ -72,7 +72,7 @@ fun UnsavedAvatar(
Box(modifier = commonModifier.background(ElementTheme.colors.temporaryColorBgSpecial)) {
Icon(
imageVector = Icons.Outlined.AddAPhoto,
contentDescription = "",
contentDescription = null,
modifier = Modifier
.align(Alignment.Center)
.size(40.dp),

View file

@ -32,33 +32,31 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.theme.components.Icon
import io.element.android.libraries.designsystem.theme.iconSuccessPrimaryBackground
import io.element.android.libraries.designsystem.utils.CommonDrawables
import io.element.android.libraries.theme.ElementTheme
import io.element.android.libraries.theme.compound.generated.SemanticColors
@Composable
internal fun FormattingOption(
state: FormattingOptionState,
onClick: () -> Unit,
imageVector: ImageVector,
contentDescription: String,
contentDescription: String?,
modifier: Modifier = Modifier,
colors: SemanticColors = ElementTheme.colors,
) {
val backgroundColor = when (state) {
FormattingOptionState.Selected -> colors.iconSuccessPrimaryBackground
FormattingOptionState.Selected -> ElementTheme.colors.iconSuccessPrimaryBackground
FormattingOptionState.Default,
FormattingOptionState.Disabled -> Color.Transparent
}
val foregroundColor = when (state) {
FormattingOptionState.Selected -> colors.iconSuccessPrimary
FormattingOptionState.Default -> colors.iconSecondary
FormattingOptionState.Disabled -> colors.iconDisabled
FormattingOptionState.Selected -> ElementTheme.colors.iconSuccessPrimary
FormattingOptionState.Default -> ElementTheme.colors.iconSecondary
FormattingOptionState.Disabled -> ElementTheme.colors.iconDisabled
}
Box(
modifier = modifier
@ -98,19 +96,19 @@ internal fun FormattingButtonPreview() = ElementPreview {
state = FormattingOptionState.Default,
onClick = { },
imageVector = ImageVector.vectorResource(CommonDrawables.ic_bold),
contentDescription = "",
contentDescription = null,
)
FormattingOption(
state = FormattingOptionState.Selected,
onClick = { },
imageVector = ImageVector.vectorResource(CommonDrawables.ic_italic),
contentDescription = "",
contentDescription = null,
)
FormattingOption(
state = FormattingOptionState.Disabled,
onClick = { },
imageVector = ImageVector.vectorResource(CommonDrawables.ic_underline),
contentDescription = "",
contentDescription = null,
)
}
}

View file

@ -2,21 +2,27 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="a11y_delete">"Delete"</string>
<string name="a11y_hide_password">"Hide password"</string>
<string name="a11y_jump_to_bottom">"Jump to bottom"</string>
<string name="a11y_notifications_mentions_only">"Mentions only"</string>
<string name="a11y_notifications_muted">"Muted"</string>
<string name="a11y_page_n">"Page %1$d"</string>
<string name="a11y_pause">"Pause"</string>
<string name="a11y_pin_field">"PIN field"</string>
<string name="a11y_play">"Play"</string>
<string name="a11y_poll">"Poll"</string>
<string name="a11y_poll_end">"Ended poll"</string>
<string name="a11y_react_with">"React with %1$s"</string>
<string name="a11y_react_with_other_emojis">"React with other emojis"</string>
<string name="a11y_read_receipts_multiple">"Read by %1$s and %2$s"</string>
<string name="a11y_read_receipts_single">"Read by %1$s"</string>
<string name="a11y_read_receipts_tap_to_show_all">"Tap to show all"</string>
<string name="a11y_remove_reaction_with">"Remove reaction with %1$s"</string>
<string name="a11y_send_files">"Send files"</string>
<string name="a11y_show_password">"Show password"</string>
<string name="a11y_start_call">"Start a call"</string>
<string name="a11y_user_menu">"User menu"</string>
<string name="a11y_voice_message_record">"Record voice message."</string>
<string name="a11y_voice_message_stop_recording">"Stop recording"</string>
<string name="a11y_read_receipts_multiple">"Read by %1$s and %2$s"</string>
<string name="action_accept">"Accept"</string>
<string name="action_add_to_timeline">"Add to timeline"</string>
<string name="action_back">"Back"</string>