|
|
@ -103,7 +103,7 @@ class ConversationView : LinearLayout {
|
|
|
|
R.drawable.ic_notifications_mentions
|
|
|
|
R.drawable.ic_notifications_mentions
|
|
|
|
}
|
|
|
|
}
|
|
|
|
binding.muteIndicatorImageView.setImageResource(drawableRes)
|
|
|
|
binding.muteIndicatorImageView.setImageResource(drawableRes)
|
|
|
|
binding.snippetTextView.text = highlightMentions(getSnippet(thread), thread.threadId, context)
|
|
|
|
binding.snippetTextView.text = highlightMentions(thread.getSnippet(), thread.threadId, context)
|
|
|
|
binding.snippetTextView.typeface = if (unreadCount > 0 && !thread.isRead) Typeface.DEFAULT_BOLD else Typeface.DEFAULT
|
|
|
|
binding.snippetTextView.typeface = if (unreadCount > 0 && !thread.isRead) Typeface.DEFAULT_BOLD else Typeface.DEFAULT
|
|
|
|
binding.snippetTextView.visibility = if (isTyping) View.GONE else View.VISIBLE
|
|
|
|
binding.snippetTextView.visibility = if (isTyping) View.GONE else View.VISIBLE
|
|
|
|
if (isTyping) {
|
|
|
|
if (isTyping) {
|
|
|
@ -136,20 +136,16 @@ class ConversationView : LinearLayout {
|
|
|
|
else -> recipient.toShortString() // Internally uses the Contact API
|
|
|
|
else -> recipient.toShortString() // Internally uses the Contact API
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun getSnippet(thread: ThreadRecord): CharSequence = thread.run {
|
|
|
|
private fun ThreadRecord.getSnippet(): CharSequence =
|
|
|
|
val body = getDisplayBody(context)
|
|
|
|
concatSnippet(getSnippetPrefix(), getDisplayBody(context))
|
|
|
|
|
|
|
|
|
|
|
|
when {
|
|
|
|
private fun concatSnippet(prefix: CharSequence?, body: CharSequence): CharSequence =
|
|
|
|
recipient.isLocalNumber || lastMessage?.isControlMessage == true -> body // Note to self
|
|
|
|
prefix?.let { TextUtils.concat(it, ": ", body) } ?: body
|
|
|
|
lastMessage?.isOutgoing == true -> {
|
|
|
|
|
|
|
|
TextUtils.concat(resources.getString(R.string.MessageRecord_you), ": ", body)
|
|
|
|
private fun ThreadRecord.getSnippetPrefix(): CharSequence? = when {
|
|
|
|
}
|
|
|
|
recipient.isLocalNumber || lastMessage?.isControlMessage == true -> null
|
|
|
|
else -> lastMessage
|
|
|
|
lastMessage?.isOutgoing == true -> resources.getString(R.string.MessageRecord_you)
|
|
|
|
?.individualRecipient
|
|
|
|
else -> lastMessage?.individualRecipient?.toShortString()
|
|
|
|
?.toShortString()
|
|
|
|
|
|
|
|
?.let { TextUtils.concat(it, ": ", body) }
|
|
|
|
|
|
|
|
?: body
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// endregion
|
|
|
|
// endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|