mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 17:31:55 +00:00
android, desktop: chat tags (#5396)
* types and api * remaining api * icons for tags (named label due to name conflict) * icon fix * wup * desktop handlers to open list * updates * filtering * progress * wip dump * icons * preset updates * unread * + button in tags view * drag n drop helpers * chats reorder * tag chat after list creation (when chat provided) * updates on unread tags * initial emoji picker * fixes and tweaks * reoder color * clickable shapes * paddings * reachable form * one hand for tags * ui tweaks * input for emojis desktop * wrap chat tags in desktop * handling longer texts * fixed a couple of issues in updates of unread tags * reset search text on active filter change * fix multi row alignment * fix modal paddings * fix single emoji picker for skin colors * dependency corrected * icon, refactor, back action to exit edit mode * different icon params to make it larger * refactor * refactor * rename * rename * refactor * refactor * padding * unread counter size --------- Co-authored-by: Avently <7953703+avently@users.noreply.github.com> Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
This commit is contained in:
19 files changed
+1501
-32
No files matched your search
+1
-2
@@ -4,8 +4,7 @@ import SectionDivider
|
||||
import androidx.compose.foundation.*
|
||||
import androidx.compose.foundation.interaction.InteractionSource
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.Divider
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package chat.simplex.common.views.chatlist
|
||||
|
||||
import SectionItemView
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.compose.ui.unit.dp
|
||||
import chat.simplex.common.ui.theme.CurrentColors
|
||||
import chat.simplex.common.ui.theme.DEFAULT_PADDING
|
||||
import chat.simplex.common.views.chat.item.isShortEmoji
|
||||
import chat.simplex.res.MR
|
||||
import dev.icerock.moko.resources.compose.painterResource
|
||||
|
||||
@Composable
|
||||
actual fun ChatTagInput(name: MutableState<String>, showError: State<Boolean>, emoji: MutableState<String?>) {
|
||||
SectionItemView(padding = PaddingValues(horizontal = DEFAULT_PADDING)) {
|
||||
SingleEmojiInput(emoji)
|
||||
TagListNameTextField(name, showError = showError)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SingleEmojiInput(
|
||||
emoji: MutableState<String?>
|
||||
) {
|
||||
TextField(
|
||||
value = emoji.value?.let { TextFieldValue(it) } ?: TextFieldValue(""),
|
||||
onValueChange = { newValue ->
|
||||
if (newValue.text == emoji.value) return@TextField
|
||||
val newValueClamped = newValue.text.replace(emoji.value ?: "", "")
|
||||
emoji.value = if (isShortEmoji(newValueClamped)) newValueClamped else null
|
||||
},
|
||||
singleLine = true,
|
||||
maxLines = 1,
|
||||
modifier = Modifier
|
||||
.size(60.dp)
|
||||
.padding(4.dp),
|
||||
placeholder = {
|
||||
Icon(
|
||||
painter = painterResource(MR.images.ic_add_reaction),
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colors.secondary
|
||||
)
|
||||
},
|
||||
shape = RoundedCornerShape(8.dp),
|
||||
colors = TextFieldDefaults.textFieldColors(
|
||||
backgroundColor = Color.Unspecified,
|
||||
focusedIndicatorColor = MaterialTheme.colors.secondary.copy(alpha = 0.6f),
|
||||
unfocusedIndicatorColor = CurrentColors.value.colors.secondary.copy(alpha = 0.3f),
|
||||
cursorColor = MaterialTheme.colors.secondary,
|
||||
),
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user