Signal-Android/app/src/main/java/org/thoughtcrime/securesms/wallpaper/WallpaperPreviewPortrait.kt

25 wiersze
939 B
Kotlin

package org.thoughtcrime.securesms.wallpaper
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.components.AvatarImageView
import org.thoughtcrime.securesms.conversation.colors.AvatarColor
import org.thoughtcrime.securesms.recipients.Recipient
sealed class WallpaperPreviewPortrait {
class ContactPhoto(private val recipient: Recipient) : WallpaperPreviewPortrait() {
override fun applyToAvatarImageView(avatarImageView: AvatarImageView) {
avatarImageView.setAvatar(recipient)
avatarImageView.colorFilter = null
}
}
class SolidColor(private val avatarColor: AvatarColor) : WallpaperPreviewPortrait() {
override fun applyToAvatarImageView(avatarImageView: AvatarImageView) {
avatarImageView.setImageResource(R.drawable.circle_tintable)
avatarImageView.setColorFilter(avatarColor.colorInt())
}
}
abstract fun applyToAvatarImageView(avatarImageView: AvatarImageView)
}