Timeline: add avatar and displayname (not dynamic...)
This commit is contained in:
parent
560d2a3291
commit
c8b8c08c99
14 changed files with 206 additions and 93 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue