Support AvatarBackgroundColor in Persona (#77)
Co-authored-by: Aishwarya <aishwarya@DESKTOP-SBI7.redmond.corp.microsoft.com>
This commit is contained in:
Родитель
f32b18d753
Коммит
e4747a0d34
|
@ -20,6 +20,7 @@ import android.view.accessibility.AccessibilityNodeInfo
|
|||
import android.widget.CheckBox
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.ColorInt
|
||||
import com.microsoft.fluentui.persona.R
|
||||
import com.microsoft.fluentui.persona.databinding.ViewPersonaChipBinding
|
||||
import com.microsoft.fluentui.theming.FluentUIContextThemeWrapper
|
||||
|
@ -71,6 +72,14 @@ class PersonaChipView : TemplateView {
|
|||
field = value
|
||||
updateViews()
|
||||
}
|
||||
@ColorInt
|
||||
var avatarBackgroundColor: Int? = null
|
||||
set(value) {
|
||||
if (field == value)
|
||||
return
|
||||
field = value
|
||||
updateViews()
|
||||
}
|
||||
/**
|
||||
* Flag for setting the chip's error state
|
||||
*/
|
||||
|
@ -204,6 +213,7 @@ class PersonaChipView : TemplateView {
|
|||
avatarImageDrawable = this@PersonaChipView.avatarImageDrawable
|
||||
avatarImageBitmap = this@PersonaChipView.avatarImageBitmap
|
||||
avatarImageUri = this@PersonaChipView.avatarImageUri
|
||||
avatarBackgroundColor = this@PersonaChipView.avatarBackgroundColor
|
||||
}
|
||||
|
||||
if (hasError)
|
||||
|
@ -273,4 +283,5 @@ fun PersonaChipView.setPersona(persona: IPersona) {
|
|||
avatarImageDrawable = persona.avatarImageDrawable
|
||||
avatarImageResourceId = persona.avatarImageResourceId
|
||||
avatarImageUri = persona.avatarImageUri
|
||||
avatarBackgroundColor = persona.avatarBackgroundColor
|
||||
}
|
|
@ -12,6 +12,7 @@ import android.graphics.drawable.Drawable
|
|||
import android.net.Uri
|
||||
import android.util.AttributeSet
|
||||
import android.view.accessibility.AccessibilityEvent
|
||||
import androidx.annotation.ColorInt
|
||||
import com.microsoft.fluentui.persona.R
|
||||
import com.microsoft.fluentui.listitem.ListItemView
|
||||
import com.microsoft.fluentui.util.isVisibleOnScreen
|
||||
|
@ -103,6 +104,14 @@ class PersonaView : ListItemView {
|
|||
field = value
|
||||
updateViews()
|
||||
}
|
||||
@ColorInt
|
||||
var avatarBackgroundColor: Int? = null
|
||||
set(value) {
|
||||
if (field == value)
|
||||
return
|
||||
field = value
|
||||
updateViews()
|
||||
}
|
||||
|
||||
private val avatarView = AvatarView(context)
|
||||
|
||||
|
@ -141,6 +150,7 @@ class PersonaView : ListItemView {
|
|||
avatarView.avatarImageDrawable = avatarImageDrawable
|
||||
avatarView.avatarImageBitmap = avatarImageBitmap
|
||||
avatarView.avatarImageUri = avatarImageUri
|
||||
avatarView.avatarBackgroundColor = avatarBackgroundColor
|
||||
|
||||
customView = avatarView
|
||||
|
||||
|
@ -172,4 +182,5 @@ fun PersonaView.setPersona(persona: IPersona) {
|
|||
avatarImageDrawable = persona.avatarImageDrawable
|
||||
avatarImageResourceId = persona.avatarImageResourceId
|
||||
avatarImageUri = persona.avatarImageUri
|
||||
avatarBackgroundColor = persona.avatarBackgroundColor
|
||||
}
|
Загрузка…
Ссылка в новой задаче