From 2e4c7da3459a47a6294982505890e17a9c60a3e6 Mon Sep 17 00:00:00 2001 From: zoff99 Date: Sat, 20 Jan 2024 17:25:54 +0100 Subject: [PATCH] tweak emoji popup a bit --- src/main/kotlin/Main.kt | 2 +- .../zoffcc/applications/trifa2/SendMessage.kt | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index b819311f..bd52eb71 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -226,6 +226,7 @@ const val MAX_ONE_ON_ONE_MESSAGES_TO_SHOW = 20000 const val MAX_GROUP_MESSAGES_TO_SHOW = 20000 const val SNACKBAR_TOAST_MS_DURATION: Long = 1000 var emojis_cat_0_gropued: ArrayList> = ArrayList() +val emojis_per_row = 6 val ImageloaderDispatcher = Executors.newFixedThreadPool(5).asCoroutineDispatcher() var global_semaphore_contactlist_ui = CustomSemaphore(1) var global_semaphore_grouppeerlist_ui = CustomSemaphore(1) @@ -1355,7 +1356,6 @@ fun main() = application(exitProcessOnExit = true) { EmojiManager.install(IosEmojiProvider()) val emojis_cat_0 = com.vanniktech.emoji.ios.IosEmojiProvider().categories[0].emojis - val emojis_per_row = 6 val grouped_entries = emojis_cat_0.size / emojis_per_row val remain = emojis_cat_0.size - (grouped_entries * emojis_per_row) for (i in 0..(grouped_entries - 1)) { diff --git a/src/main/kotlin/com/zoffcc/applications/trifa2/SendMessage.kt b/src/main/kotlin/com/zoffcc/applications/trifa2/SendMessage.kt index 38f7db1e..7d27613b 100644 --- a/src/main/kotlin/com/zoffcc/applications/trifa2/SendMessage.kt +++ b/src/main/kotlin/com/zoffcc/applications/trifa2/SendMessage.kt @@ -73,8 +73,6 @@ import com.zoffcc.applications.trifa.HelperMessage.getImageFromClipboard import com.zoffcc.applications.trifa.Log import com.zoffcc.applications.trifa.MainActivity.Companion.add_outgoing_file import com.zoffcc.applications.trifa.TRIFAGlobals -import org.briarproject.briar.desktop.contact.ContactItem -import org.jetbrains.compose.resources.stringArrayResource import java.awt.image.BufferedImage import java.io.File import javax.imageio.ImageIO @@ -231,12 +229,16 @@ fun SendMessage(focusRequester: FocusRequester, selectedContactPubkey: String?, } if (show_emoji_popup) { + val emoji_box_width_dp = 250.dp + val emoji_box_height_dp = 500.dp + val emoji_box_offset_x_px = 100.dp.DpAsPx.toInt() + val emoji_box_offset_y_px = -(emoji_box_height_dp + 10.dp).DpAsPx.toInt() Popup(alignment = Alignment.TopCenter, onDismissRequest = {}, - offset = IntOffset(100.dp.DpAsPx.toInt(), -310.dp.DpAsPx.toInt())) { + offset = IntOffset(emoji_box_offset_x_px, emoji_box_offset_y_px)) { Box( Modifier - .size(250.dp, 300.dp) + .size(emoji_box_width_dp, emoji_box_height_dp) .padding(top = 1.dp, bottom = 1.dp) .background(MaterialTheme.colors.background) .border(1.dp, color = Color.Black, RoundedCornerShape(10.dp)) @@ -249,7 +251,7 @@ fun SendMessage(focusRequester: FocusRequester, selectedContactPubkey: String?, val listState = rememberLazyListState() Box(Modifier.fillMaxSize()) { LazyColumn( - modifier = Modifier.fillMaxHeight().padding(start = 1.dp, end = 10.dp), + modifier = Modifier.fillMaxSize().padding(start = 1.dp, end = 10.dp), verticalArrangement = Arrangement.spacedBy(5.dp), state = listState, ) { @@ -258,8 +260,8 @@ fun SendMessage(focusRequester: FocusRequester, selectedContactPubkey: String?, for (k in 0..(it.size - 1)) { IconButton(modifier = Modifier.width(40.dp).height(40.dp), - onClick = { inputText = inputText + it[k]}) { - Text(text = it[k], fontSize = 30.sp) + onClick = { inputText = inputText + it[k] }) { + Text(text = it[k], fontSize = 30.sp, maxLines = 1) } } }