Making reply length a const

Signed-off-by: Julius Linus <julius.linus@nextcloud.com>

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
rapterjet2004 2023-05-23 11:24:33 -05:00 committed by Andy Scherzinger
parent a926c27ae7
commit 93da3a9c65
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 4 additions and 4 deletions

View file

@ -171,7 +171,6 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
} }
private fun processParentMessage(message: ChatMessage) { private fun processParentMessage(message: ChatMessage) {
val maxReplyLength = 250
val parentChatMessage = message.parentMessage val parentChatMessage = message.parentMessage
parentChatMessage!!.activeUser = message.activeUser parentChatMessage!!.activeUser = message.activeUser
parentChatMessage.imageUrl?.let { parentChatMessage.imageUrl?.let {
@ -190,7 +189,7 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
} else { } else {
parentChatMessage.actorDisplayName parentChatMessage.actorDisplayName
} }
binding.messageQuote.quotedMessage.text = DisplayUtils.ellipsize(parentChatMessage.text, maxReplyLength) binding.messageQuote.quotedMessage.text = DisplayUtils.ellipsize(parentChatMessage.text, MAX_REPLY_LENGTH)
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) { if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
viewThemeUtils.platform.colorViewBackground(binding.messageQuote.quoteColoredView) viewThemeUtils.platform.colorViewBackground(binding.messageQuote.quoteColoredView)
@ -263,5 +262,6 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
companion object { companion object {
const val TEXT_SIZE_MULTIPLIER = 2.5 const val TEXT_SIZE_MULTIPLIER = 2.5
const val MAX_REPLY_LENGTH = 250
} }
} }

View file

@ -148,7 +148,6 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
} }
private fun processParentMessage(message: ChatMessage) { private fun processParentMessage(message: ChatMessage) {
val maxReplyLength = 250
val parentChatMessage = message.parentMessage val parentChatMessage = message.parentMessage
val textColor = viewThemeUtils.getScheme(binding.messageQuote.quotedMessage.context).onSurfaceVariant val textColor = viewThemeUtils.getScheme(binding.messageQuote.quotedMessage.context).onSurfaceVariant
parentChatMessage!!.activeUser = message.activeUser parentChatMessage!!.activeUser = message.activeUser
@ -165,7 +164,7 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
} }
binding.messageQuote.quotedMessageAuthor.text = parentChatMessage.actorDisplayName binding.messageQuote.quotedMessageAuthor.text = parentChatMessage.actorDisplayName
?: context!!.getText(R.string.nc_nick_guest) ?: context!!.getText(R.string.nc_nick_guest)
binding.messageQuote.quotedMessage.text = DisplayUtils.ellipsize(parentChatMessage.text, maxReplyLength) binding.messageQuote.quotedMessage.text = DisplayUtils.ellipsize(parentChatMessage.text, MAX_REPLY_LENGTH)
binding.messageQuote.quotedMessageAuthor.setTextColor(textColor) binding.messageQuote.quotedMessageAuthor.setTextColor(textColor)
binding.messageQuote.quotedMessage.setTextColor(textColor) binding.messageQuote.quotedMessage.setTextColor(textColor)
@ -227,5 +226,6 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
companion object { companion object {
const val TEXT_SIZE_MULTIPLIER = 2.5 const val TEXT_SIZE_MULTIPLIER = 2.5
const val MAX_REPLY_LENGTH = 250
} }
} }