mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-31 17:04:59 +01:00
supports conversation name
This commit is contained in:
parent
39d77df300
commit
3842396f36
@ -29,14 +29,16 @@ fun ParcelableMessageConversation.applyFrom(message: ParcelableMessage, details:
|
||||
val ParcelableMessageConversation.timestamp: Long
|
||||
get() = if (message_timestamp > 0) message_timestamp else local_timestamp
|
||||
|
||||
fun ParcelableMessageConversation.getConversationName(context: Context): Pair<String, String?> {
|
||||
fun ParcelableMessageConversation.getConversationName(context: Context,
|
||||
manager: UserColorNameManager): Pair<String, String?> {
|
||||
if (conversation_type == ConversationType.ONE_TO_ONE) {
|
||||
val user = this.user ?: return Pair(context.getString(R.string.direct_messages), null)
|
||||
return Pair(user.name, user.screen_name)
|
||||
}
|
||||
return Pair(participants.joinToString(separator = ", ") {
|
||||
it.name
|
||||
}, null)
|
||||
if (conversation_name != null) {
|
||||
return Pair(conversation_name, null)
|
||||
}
|
||||
return Pair(participants.joinToString(separator = ", ") { manager.getDisplayName(it, false) }, null)
|
||||
}
|
||||
|
||||
fun ParcelableMessageConversation.getSummaryText(context: Context, manager: UserColorNameManager,
|
||||
|
@ -54,7 +54,8 @@ class MessageEntryViewHolder(itemView: View, val adapter: MessagesEntriesAdapter
|
||||
} else {
|
||||
content.drawEnd()
|
||||
}
|
||||
val (name, secondaryName) = conversation.getConversationName(itemView.context)
|
||||
val (name, secondaryName) = conversation.getConversationName(itemView.context,
|
||||
adapter.userColorNameManager)
|
||||
this.time.time = conversation.timestamp
|
||||
this.name.name = name
|
||||
this.name.screenName = secondaryName
|
||||
|
Loading…
x
Reference in New Issue
Block a user