InterceptPlatformTextInputSample
@Suppress("UNUSED_PARAMETER")
@Sampled
@Composable
fun InterceptPlatformTextInputSample() {
var text by remember { mutableStateOf("") }
InterceptPlatformTextInput(
interceptor = { request, nextHandler ->
// Create a new request to wrap the incoming one with some custom logic.
val modifiedRequest =
object : PlatformTextInputMethodRequest {
override fun createInputConnection(outAttributes: EditorInfo): InputConnection {
val inputConnection = request.createInputConnection(outAttributes)
// After the original request finishes initializing the EditorInfo we can
// customize it. If we needed to we could also wrap the InputConnection
// before
// returning it.
updateEditorInfo(outAttributes)
return inputConnection
}
disableSoftKeyboardSample
@Sampled
fun disableSoftKeyboardSample() {
/**
* A function that disables the soft keyboard for any text field within its content.
*
* The keyboard is re-enabled by removing this modifier or passing `disable = false`.
*/