No luck for me and compose codelabs :disappointed:...
# compose
h
No luck for me and compose codelabs 😞. I am currently doing the state codelab. Yesterday I posted about a problem where a TextField somehow remembers it's state. Problem only occured on one Samsung though. Now I am in the next chapter "7 Dynamic UI based on state". At the end an onClick action is extracted into a lambda variable and set when you press the "add" button or send an IME action via keyboard. The IME action doesnt work for me. In my code an empty Todo item is added, in the finished solution the "Done" button on the keyboard only closes the keyboard. This time the problem occurs on the Samsung and a current emulator. I would be interested if the IME functionality is working for anybody else and if I should invest time in troubleshooting ;)
Copy code
@Composable
fun TodoItemInput(onItemComplete: (TodoItem) -> Unit) {
    val (text, setText) = remember { mutableStateOf("") }
    val (icon, setIcon) = remember { mutableStateOf(TodoIcon.Default)}
    val iconsVisible = text.isNotBlank()

    val submit = {
        onItemComplete(TodoItem(text, icon))
        setText("")
        setIcon(TodoIcon.Default)
    }

    Column {
        Row(Modifier
                .padding(horizontal = 16.dp)
                .padding(top = 16.dp)
        ) {
            TodoInputText(
                    text = text,
                    onTextChange = setText,
                    modifier = Modifier
                            .weight(1f)
                            .padding(end = 8.dp),
                    onImeAction = submit
            )
            TodoEditButton(
                    onClick = submit,
                    text = "Add",
                    modifier = Modifier.align(Alignment.CenterVertically),
                    enabled = text.isNotBlank()
            )
        }
        if (iconsVisible) {
            AnimatedIconRow(icon = icon, onIconChange = setIcon, Modifier.padding(top = 8.dp))
        } else {
            Spacer(modifier = Modifier.preferredHeight(16.dp))
        }
    }
}
a
IME stopped working after one of the compose updates (can’t remember which exactly)
j
cc @Siyamed
h
Thanks for the info