android: create contacts with group members (#3078)

This commit is contained in:
spaced4ndy
2023-09-20 17:58:10 +04:00
committed by GitHub
parent 648a9761f9
commit ae6996b2ee
18 changed files with 430 additions and 112 deletions
@@ -44,6 +44,7 @@ import java.net.URI
@Composable
actual fun PlatformTextField(
composeState: MutableState<ComposeState>,
sendMsgEnabled: Boolean,
textStyle: MutableState<TextStyle>,
showDeleteTextButton: MutableState<Boolean>,
userIsObserver: Boolean,
@@ -60,6 +61,7 @@ actual fun PlatformTextField(
val paddingEnd = with(LocalDensity.current) { 45.dp.roundToPx() }
val paddingBottom = with(LocalDensity.current) { 7.dp.roundToPx() }
var showKeyboard by remember { mutableStateOf(false) }
var freeFocus by remember { mutableStateOf(false) }
LaunchedEffect(cs.contextItem) {
if (cs.contextItem is ComposeContextItem.QuotedItem) {
delay(100)
@@ -70,6 +72,11 @@ actual fun PlatformTextField(
showKeyboard = true
}
}
LaunchedEffect(sendMsgEnabled) {
if (!sendMsgEnabled) {
freeFocus = true
}
}
AndroidView(modifier = Modifier, factory = {
val editText = @SuppressLint("AppCompatCustomView") object: EditText(it) {
@@ -142,6 +149,11 @@ actual fun PlatformTextField(
imm.showSoftInput(it, InputMethodManager.SHOW_IMPLICIT)
showKeyboard = false
}
if (freeFocus) {
it.clearFocus()
hideKeyboard(it)
freeFocus = false
}
showDeleteTextButton.value = it.lineCount >= 4 && !cs.inProgress
}
if (composeState.value.preview is ComposePreview.VoicePreview) {