Skip to content

Commit

Permalink
tweak emoji popup a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Jan 20, 2024
1 parent 09ee61a commit 2e4c7da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>> = 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)
Expand Down Expand Up @@ -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)) {
Expand Down
16 changes: 9 additions & 7 deletions src/main/kotlin/com/zoffcc/applications/trifa2/SendMessage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand All @@ -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,
) {
Expand All @@ -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)
}
}
}
Expand Down

0 comments on commit 2e4c7da

Please sign in to comment.