From f68d5e1e604e4d6697013167d20c4dbf5fa691a4 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Fri, 2 Sep 2022 10:13:21 +0100 Subject: [PATCH] android: fix alias layout (#986) * android: fix alias layout * Small changes to layout of alias text field Co-authored-by: Avently <7953703+avently@users.noreply.github.com> --- .../simplex/app/views/chat/ChatInfoView.kt | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatInfoView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatInfoView.kt index cd84fb6348..6ed71d2955 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatInfoView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatInfoView.kt @@ -254,22 +254,23 @@ fun ChatInfoHeader(cInfo: ChatInfo, contact: Contact) { @Composable private fun LocalAliasEditor(initialValue: String, updateValue: (String) -> Unit) { var value by rememberSaveable { mutableStateOf(initialValue) } - DefaultBasicTextField( - Modifier.fillMaxWidth().padding(horizontal = 10.dp), - value, - { - Text( - generalGetString(R.string.text_field_set_contact_placeholder), - Modifier.fillMaxWidth(), - textAlign = TextAlign.Center, - color = HighOrLowlight - ) - }, - color = HighOrLowlight, - textStyle = TextStyle.Default.copy(textAlign = TextAlign.Center), - keyboardActions = KeyboardActions(onDone = { updateValue(value) }) - ) { - value = it + Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) { + DefaultBasicTextField( + Modifier.padding(horizontal = 10.dp).widthIn(min = 100.dp), + value, + { + Text( + generalGetString(R.string.text_field_set_contact_placeholder), + textAlign = TextAlign.Center, + color = HighOrLowlight + ) + }, + color = HighOrLowlight, + textStyle = TextStyle.Default.copy(textAlign = if (value.isEmpty()) TextAlign.Start else TextAlign.Center), + keyboardActions = KeyboardActions(onDone = { updateValue(value) }) + ) { + value = it + } } LaunchedEffect(Unit) { snapshotFlow { value }