Hide sender avatar in DMs

As proposed in https://github.com/SpiritCroc/SchildiChat-android/issues/7

Change-Id: I4a76283191fa1c6a021f7fb643bfddff7551abf8
This commit is contained in:
SpiritCroc 2020-09-25 11:27:54 +02:00
parent 7bdc4c30ec
commit 01b5a88d59
3 changed files with 10 additions and 2 deletions

View file

@ -112,6 +112,7 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses
ReferencesInfoData(verificationState)
},
sentByMe = event.root.senderId == session.myUserId,
isDirect = roomSummaryHolder.roomSummary?.isDirect ?: false,
e2eDecoration = e2eDecoration
)
}

View file

@ -68,7 +68,7 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
height = attributes.avatarSize
width = attributes.avatarSize
}
holder.avatarImageView.visibility = View.VISIBLE
//holder.avatarImageView.visibility = View.VISIBLE
holder.avatarImageView.setOnClickListener(_avatarClickListener)
//holder.memberNameView.visibility = View.VISIBLE
holder.memberNameView.setOnClickListener(_memberNameClickListener)
@ -89,11 +89,17 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
holder.timeView.visibility = View.GONE
holder.bubbleMemberNameView.visibility = View.VISIBLE
holder.bubbleTimeView.visibility = View.VISIBLE
if (attributes.informationData.isDirect) {
holder.avatarImageView.visibility = View.GONE
} else {
holder.avatarImageView.visibility = View.VISIBLE
}
} else {
holder.memberNameView.visibility = View.VISIBLE
holder.timeView.visibility = View.VISIBLE
holder.bubbleMemberNameView.visibility = View.GONE
holder.bubbleTimeView.visibility = View.GONE
holder.avatarImageView.visibility = View.VISIBLE
}
} else {
holder.avatarImageView.setOnClickListener(null)
@ -181,7 +187,7 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
}
override fun ignoreMessageGuideline(context: Context): Boolean {
return infoInBubbles(context) && attributes.informationData.sentByMe
return infoInBubbles(context) && (attributes.informationData.sentByMe || attributes.informationData.isDirect)
}
open fun getViewStubMinimumWidth(holder: H, contentInBubble: Boolean, showInformation: Boolean): Int {

View file

@ -41,6 +41,7 @@ data class MessageInformationData(
val readReceipts: List<ReadReceiptData> = emptyList(),
val referencesInfoData: ReferencesInfoData? = null,
val sentByMe : Boolean,
val isDirect: Boolean = false,
val e2eDecoration: E2EDecoration = E2EDecoration.NONE
) : Parcelable {