mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Timeline: add avatar and displayname (not dynamic...)
This commit is contained in:
+1
-2
@@ -12,7 +12,6 @@ import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import coil.compose.AsyncImage
|
||||
import io.element.android.x.designsystem.AvatarGradientEnd
|
||||
@@ -27,7 +26,7 @@ fun Avatar(avatarData: AvatarData, modifier: Modifier = Modifier) {
|
||||
if (avatarData.model == null) {
|
||||
InitialsAvatar(
|
||||
modifier = commonModifier,
|
||||
initials = avatarData.initials
|
||||
initials = avatarData.name.first().uppercase()
|
||||
)
|
||||
} else {
|
||||
ImageAvatar(
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@ import androidx.compose.runtime.Stable
|
||||
|
||||
@Stable
|
||||
data class AvatarData(
|
||||
val initials: String = "",
|
||||
val name: String = "",
|
||||
val model: ByteArray? = null,
|
||||
val size: AvatarSize = AvatarSize.MEDIUM
|
||||
) {
|
||||
@@ -14,7 +14,7 @@ data class AvatarData(
|
||||
|
||||
other as AvatarData
|
||||
|
||||
if (initials != other.initials) return false
|
||||
if (name != other.name) return false
|
||||
if (model != null) {
|
||||
if (other.model == null) return false
|
||||
if (!model.contentEquals(other.model)) return false
|
||||
@@ -25,7 +25,7 @@ data class AvatarData(
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = initials.hashCode()
|
||||
var result = name.hashCode()
|
||||
result = 31 * result + (model?.contentHashCode() ?: 0)
|
||||
result = 31 * result + size.value
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user