Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ class MessageInputFragment : Fragment() {
emojiPopup = EmojiPopup(
rootView = binding.root,
editText = inputEditText,
theming = viewThemeUtils.talk.getEmojiTheming(requireContext()),
onEmojiPopupShownListener = {
isEmojiPopupOpen = true
updateSmileyButtonIcon()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ import com.nextcloud.talk.ui.chat.LocalShowThreadButton
import com.nextcloud.talk.ui.chat.formatTime
import com.nextcloud.talk.ui.theme.LocalMessageUtils
import com.nextcloud.talk.ui.theme.LocalViewThemeUtils
import com.nextcloud.talk.ui.theme.emojiTheming
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.DateConstants
import com.nextcloud.talk.utils.DateUtils
Expand Down Expand Up @@ -809,6 +810,7 @@ class ScheduledMessagesActivity : BaseActivity() {
) {
val rootView = LocalView.current
val keyboardController = LocalSoftwareKeyboardController.current
val theming = emojiTheming()

val emojiEditTextRef = remember { mutableStateOf<EmojiEditText?>(null) }
var emojiPopup by remember { mutableStateOf<EmojiPopup?>(null) }
Expand Down Expand Up @@ -872,6 +874,7 @@ class ScheduledMessagesActivity : BaseActivity() {
emojiPopup = EmojiPopup(
rootView = rootView,
editText = editText,
theming = theming,
onEmojiPopupShownListener = {
isEmojiOpen = true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import com.nextcloud.talk.data.user.model.User
import com.nextcloud.talk.models.domain.ConversationModel
import com.nextcloud.talk.models.json.capabilities.SpreedCapability
import com.nextcloud.talk.models.json.conversations.ConversationEnums
import com.nextcloud.talk.ui.theme.emojiTheming
import com.nextcloud.talk.utils.CapabilitiesUtil
import com.nextcloud.talk.utils.CapabilitiesUtil.hasSpreedFeatureCapability
import com.nextcloud.talk.utils.ConversationUtils
Expand Down Expand Up @@ -648,6 +649,7 @@ private fun MoreEmojiButton(
) {
val context = LocalContext.current
val rootView = LocalView.current
val theming = emojiTheming()
val popupRef = remember { mutableStateOf<EmojiPopup?>(null) }

DisposableEffect(Unit) {
Expand All @@ -665,6 +667,7 @@ private fun MoreEmojiButton(
val emojiPopup = EmojiPopup(
rootView = rootView,
editText = this,
theming = theming,
onEmojiPopupShownListener = {
clearFocus()
onPickerShown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.content.getSystemService
import com.nextcloud.talk.R
import com.nextcloud.talk.ui.theme.emojiTheming
import com.vanniktech.emoji.EmojiEditText
import com.vanniktech.emoji.EmojiPopup
import com.vanniktech.emoji.installDisableKeyboardInput
Expand Down Expand Up @@ -83,6 +84,7 @@ internal fun EmojiAndMessageRow(
private fun EmojiButton(emoji: String, onEmojiSelected: (String) -> Unit) {
val isPreview = LocalInspectionMode.current
val rootView = LocalView.current
val theming = emojiTheming()
var emojiPopup by remember { mutableStateOf<EmojiPopup?>(null) }
val displayEmoji = emoji.ifEmpty { stringResource(R.string.default_emoji) }

Expand Down Expand Up @@ -115,6 +117,7 @@ private fun EmojiButton(emoji: String, onEmojiSelected: (String) -> Unit) {
val popup = EmojiPopup(
rootView = rootView,
editText = this,
theming = theming,
onEmojiClickListener = {
onEmojiSelected(text.toString())
emojiPopup?.dismiss()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class RenameConversationDialogFragment : DialogFragment() {
EmojiPopup(
rootView = requireView(),
editText = it.textEdit,
theming = viewThemeUtils.talk.getEmojiTheming(requireContext()),
onEmojiPopupShownListener = {
viewThemeUtils.platform.colorImageView(it.smileyButton, ColorRole.PRIMARY)
},
Expand Down
33 changes: 33 additions & 0 deletions app/src/main/java/com/nextcloud/talk/ui/theme/EmojiThemings.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/

package com.nextcloud.talk.ui.theme

import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.ui.graphics.toArgb
import com.vanniktech.emoji.EmojiTheming

/**
* Themes the vanniktech emoji popup from the current [MaterialTheme.colorScheme] so its category,
* search and backspace icons stay visible in dark mode.
* Keep in sync with the view variant [TalkSpecificViewThemeUtils.getEmojiTheming].
*/
@Composable
@ReadOnlyComposable
fun emojiTheming(): EmojiTheming =
with(MaterialTheme.colorScheme) {
EmojiTheming(
backgroundColor = surface.toArgb(),
primaryColor = onSurfaceVariant.toArgb(),
secondaryColor = primary.toArgb(),
dividerColor = outlineVariant.toArgb(),
textColor = onSurface.toArgb(),
textSecondaryColor = onSurfaceVariant.toArgb()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.DrawableUtils
import com.nextcloud.talk.utils.message.MessageUtils
import com.vanniktech.emoji.EmojiTextView
import com.vanniktech.emoji.EmojiTheming
import dynamiccolor.DynamicScheme
import dynamiccolor.MaterialDynamicColors
import eu.davidea.flexibleadapter.utils.FlexibleUtils
Expand Down Expand Up @@ -182,6 +183,22 @@ class TalkSpecificViewThemeUtils @Inject constructor(
}
}

/**
* Themes the vanniktech emoji popup so its category, search and backspace icons stay visible in dark mode.
* Keep in sync with the Compose variant [emojiTheming].
*/
fun getEmojiTheming(context: Context): EmojiTheming =
withScheme(context) { scheme ->
EmojiTheming(
backgroundColor = dynamicColor.surface().getArgb(scheme),
primaryColor = dynamicColor.onSurfaceVariant().getArgb(scheme),
secondaryColor = dynamicColor.primary().getArgb(scheme),
dividerColor = dynamicColor.outlineVariant().getArgb(scheme),
textColor = dynamicColor.onSurface().getArgb(scheme),
textSecondaryColor = dynamicColor.onSurfaceVariant().getArgb(scheme)
)
}

fun setReactionsBackground(linearLayout: LinearLayout, outgoing: Boolean, isBubbled: Boolean) {
withScheme(linearLayout) { scheme ->
val drawable = AppCompatResources
Expand Down
Loading