Fix contentDescriptions on pick display and message notifications

This commit is contained in:
Andrew 2024-06-26 23:24:45 +09:30
parent 9831758060
commit 031f3eb45f
3 changed files with 10 additions and 11 deletions

View File

@ -64,8 +64,8 @@ internal fun MessageNotificationsScreen(
NotificationRadioButton(
R.string.activity_pn_mode_fast_mode,
R.string.activity_pn_mode_fast_mode_explanation,
R.string.activity_pn_mode_recommended_option_tag,
contentDescription = R.string.AccessibilityId_fast_mode_notifications_button,
modifier = Modifier.contentDescription(R.string.AccessibilityId_fast_mode_notifications_button),
tag = R.string.activity_pn_mode_recommended_option_tag,
selected = state.pushEnabled,
onClick = { setEnabled(true) }
)
@ -75,7 +75,7 @@ internal fun MessageNotificationsScreen(
NotificationRadioButton(
R.string.activity_pn_mode_slow_mode,
R.string.activity_pn_mode_slow_mode_explanation,
contentDescription = R.string.AccessibilityId_slow_mode_notifications_button,
modifier = Modifier.contentDescription(R.string.AccessibilityId_slow_mode_notifications_button),
selected = state.pushDisabled,
onClick = { setEnabled(false) }
)
@ -90,13 +90,13 @@ internal fun MessageNotificationsScreen(
private fun NotificationRadioButton(
@StringRes title: Int,
@StringRes explanation: Int,
modifier: Modifier = Modifier,
@StringRes tag: Int? = null,
@StringRes contentDescription: Int? = null,
selected: Boolean = false,
onClick: () -> Unit = {}
) {
TextButton(
modifier = Modifier.fillMaxWidth(),
modifier = modifier.fillMaxWidth(),
colors = transparentButtonColors(),
onClick = onClick,
shape = RectangleShape,
@ -105,7 +105,6 @@ private fun NotificationRadioButton(
Box(
modifier = Modifier
.weight(1f)
.contentDescription(contentDescription)
.border(LocalDimensions.current.borderStroke, LocalColors.current.borders, RoundedCornerShape(8.dp)),
) {
Column(modifier = Modifier.padding(horizontal = 15.dp).padding(top = 10.dp, bottom = 11.dp)) {

View File

@ -20,7 +20,6 @@ import org.thoughtcrime.securesms.ui.LocalDimensions
import org.thoughtcrime.securesms.ui.PreviewTheme
import org.thoughtcrime.securesms.ui.base
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
import org.thoughtcrime.securesms.ui.contentDescription
import org.thoughtcrime.securesms.ui.h4
@Preview
@ -53,9 +52,8 @@ internal fun DisplayName(state: State, onChange: (String) -> Unit = {}, onContin
Spacer(Modifier.height(LocalDimensions.current.itemSpacing))
SessionOutlinedTextField(
text = state.displayName,
modifier = Modifier
.fillMaxWidth()
.contentDescription(R.string.AccessibilityId_enter_display_name),
modifier = Modifier.fillMaxWidth(),
contentDescription = stringResource(R.string.AccessibilityId_enter_display_name),
placeholder = stringResource(R.string.displayNameEnter),
onChange = onChange,
onContinue = onContinue,

View File

@ -44,6 +44,7 @@ import org.thoughtcrime.securesms.ui.color.LocalColors
import org.thoughtcrime.securesms.ui.color.borders
import org.thoughtcrime.securesms.ui.color.text
import org.thoughtcrime.securesms.ui.color.textSecondary
import org.thoughtcrime.securesms.ui.contentDescription
@Preview
@Composable
@ -68,6 +69,7 @@ fun PreviewSessionOutlinedTextField() {
fun SessionOutlinedTextField(
text: String,
modifier: Modifier = Modifier,
contentDescription: String? = null,
onChange: (String) -> Unit = {},
textStyle: TextStyle = base,
placeholder: String = "",
@ -100,7 +102,7 @@ fun SessionOutlinedTextField(
BasicTextField(
value = text,
onValueChange = onChange,
modifier = Modifier.wrapContentHeight().fillMaxWidth(),
modifier = Modifier.wrapContentHeight().fillMaxWidth().contentDescription(contentDescription),
textStyle = textStyle.copy(color = LocalColors.current.text(error != null)),
cursorBrush = SolidColor(LocalColors.current.text(error != null)),
keyboardOptions = KeyboardOptions.Default.copy(imeAction = ImeAction.Done),