@@ -44,7 +44,7 @@ import androidx.compose.material.AmbientContentAlpha
44
44
import androidx.compose.material.AmbientContentColor
45
45
import androidx.compose.material.AmbientTextStyle
46
46
import androidx.compose.material.Button
47
- import androidx.compose.material.ButtonConstants
47
+ import androidx.compose.material.ButtonDefaults
48
48
import androidx.compose.material.ContentAlpha
49
49
import androidx.compose.material.Divider
50
50
import androidx.compose.material.Icon
@@ -70,18 +70,17 @@ import androidx.compose.runtime.setValue
70
70
import androidx.compose.ui.Alignment
71
71
import androidx.compose.ui.Modifier
72
72
import androidx.compose.ui.focus
73
- import androidx.compose.ui.focus.ExperimentalFocus
74
73
import androidx.compose.ui.focus.FocusRequester
75
74
import androidx.compose.ui.focus.FocusState
76
- import androidx.compose.ui.focusObserver
75
+ import androidx.compose.ui.focus.onFocusChanged
77
76
import androidx.compose.ui.focusRequester
78
77
import androidx.compose.ui.graphics.Color
79
78
import androidx.compose.ui.graphics.vector.ImageVector
80
79
import androidx.compose.ui.layout.FirstBaseline
81
80
import androidx.compose.ui.res.stringResource
82
81
import androidx.compose.ui.semantics.SemanticsPropertyKey
83
82
import androidx.compose.ui.semantics.SemanticsPropertyReceiver
84
- import androidx.compose.ui.semantics.accessibilityLabel
83
+ import androidx.compose.ui.semantics.contentDescription
85
84
import androidx.compose.ui.semantics.semantics
86
85
import androidx.compose.ui.text.SoftwareKeyboardController
87
86
import androidx.compose.ui.text.TextRange
@@ -188,7 +187,6 @@ private fun TextFieldValue.addText(newString: String): TextFieldValue {
188
187
return this .copy(text = newText, selection = newSelection)
189
188
}
190
189
191
- @OptIn(ExperimentalFocus ::class )
192
190
@Composable
193
191
private fun SelectorExpanded (
194
192
currentSelector : InputSelector ,
@@ -311,7 +309,7 @@ private fun UserInputSelector(
311
309
val disabledContentColor =
312
310
MaterialTheme .colors.onSurface.copy(alpha = ContentAlpha .disabled)
313
311
314
- val buttonColors = ButtonConstants .defaultButtonColors (
312
+ val buttonColors = ButtonDefaults .buttonColors (
315
313
disabledBackgroundColor = MaterialTheme .colors.surface,
316
314
disabledContentColor = disabledContentColor
317
315
)
@@ -345,7 +343,7 @@ private fun InputSelectorButton(
345
343
) {
346
344
IconButton (
347
345
onClick = onClick,
348
- modifier = Modifier .semantics { accessibilityLabel = description }
346
+ modifier = Modifier .semantics { contentDescription = description }
349
347
) {
350
348
Providers (AmbientContentAlpha provides ContentAlpha .medium) {
351
349
val tint = if (selected) MaterialTheme .colors.primary else AmbientContentColor .current
@@ -366,7 +364,6 @@ private fun NotAvailablePopup(onDismissed: () -> Unit) {
366
364
val KeyboardShownKey = SemanticsPropertyKey <Boolean >(" KeyboardShownKey" )
367
365
var SemanticsPropertyReceiver .keyboardShownProperty by KeyboardShownKey
368
366
369
- @OptIn(ExperimentalFocus ::class )
370
367
@ExperimentalFoundationApi
371
368
@Composable
372
369
private fun UserInputText (
@@ -393,7 +390,7 @@ private fun UserInputText(
393
390
.fillMaxWidth()
394
391
.preferredHeight(48 .dp)
395
392
.semantics {
396
- accessibilityLabel = a11ylabel
393
+ contentDescription = a11ylabel
397
394
keyboardShownProperty = keyboardShown
398
395
},
399
396
horizontalArrangement = Arrangement .End
@@ -410,7 +407,7 @@ private fun UserInputText(
410
407
.fillMaxWidth()
411
408
.padding(start = 16 .dp)
412
409
.align(Alignment .CenterStart )
413
- .focusObserver { state ->
410
+ .onFocusChanged { state ->
414
411
if (lastFocusState != state) {
415
412
onTextFieldFocused(state == FocusState .Active )
416
413
}
@@ -442,7 +439,6 @@ private fun UserInputText(
442
439
}
443
440
}
444
441
445
- @OptIn(ExperimentalFocus ::class )
446
442
@Composable
447
443
fun EmojiSelector (
448
444
onTextAdded : (String ) -> Unit ,
@@ -455,7 +451,7 @@ fun EmojiSelector(
455
451
modifier = Modifier
456
452
.focusRequester(focusRequester) // Requests focus when the Emoji selector is displayed
457
453
.focus() // Make the emoji selector focusable so it can steal focus from TextField
458
- .semantics { accessibilityLabel = a11yLabel }
454
+ .semantics { contentDescription = a11yLabel }
459
455
) {
460
456
Row (modifier = Modifier .fillMaxWidth().padding(horizontal = 8 .dp)) {
461
457
ExtendedSelectorInnerButton (
@@ -487,7 +483,7 @@ fun ExtendedSelectorInnerButton(
487
483
selected : Boolean ,
488
484
modifier : Modifier = Modifier
489
485
) {
490
- val colors = ButtonConstants .defaultButtonColors (
486
+ val colors = ButtonDefaults .buttonColors (
491
487
backgroundColor = MaterialTheme .colors.onSurface.copy(alpha = 0.08f ),
492
488
disabledBackgroundColor = getSelectorExpandedColor(), // Same as background
493
489
contentColor = MaterialTheme .colors.onSurface,
0 commit comments