mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-24 23:28:10 +00:00
Started removing AvatarView dependency
This commit is contained in:
parent
2cef7980ea
commit
e4a3ec37c5
32 changed files with 307 additions and 203 deletions
|
|
@ -0,0 +1,14 @@
|
|||
package org.linphone.contacts
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.core.ChatRoom
|
||||
|
||||
abstract class AbstractAvatarModel {
|
||||
val trust = MutableLiveData<ChatRoom.SecurityLevel>()
|
||||
|
||||
val showTrust = MutableLiveData<Boolean>()
|
||||
|
||||
val initials = MutableLiveData<String>()
|
||||
|
||||
val images = MutableLiveData<ArrayList<String>>()
|
||||
}
|
||||
107
app/src/main/java/org/linphone/contacts/AvatarGenerator.kt
Normal file
107
app/src/main/java/org/linphone/contacts/AvatarGenerator.kt
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2022 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.contacts
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.*
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.text.TextPaint
|
||||
import android.util.TypedValue
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import org.linphone.R
|
||||
import org.linphone.utils.AppUtils
|
||||
|
||||
class AvatarGenerator(private val context: Context) {
|
||||
private var textSize: Float
|
||||
private var textColor: Int
|
||||
private var avatarSize: Int
|
||||
private var initials = " "
|
||||
private var backgroundColor: Int
|
||||
|
||||
init {
|
||||
backgroundColor = ContextCompat.getColor(context, R.color.gray_main2_200)
|
||||
|
||||
textColor = ContextCompat.getColor(context, R.color.gray_main2_600)
|
||||
|
||||
textSize = AppUtils.getDimension(R.dimen.avatar_initials_text_size)
|
||||
|
||||
avatarSize = AppUtils.getDimension(R.dimen.avatar_list_cell_size).toInt()
|
||||
}
|
||||
|
||||
fun setTextSize(size: Float) = apply {
|
||||
textSize = size
|
||||
}
|
||||
|
||||
fun setTextColorResource(resource: Int) = apply {
|
||||
textColor = ContextCompat.getColor(context, resource)
|
||||
}
|
||||
|
||||
fun setAvatarSize(size: Int) = apply {
|
||||
avatarSize = size
|
||||
}
|
||||
|
||||
fun setInitials(label: String) = apply {
|
||||
initials = label
|
||||
}
|
||||
|
||||
fun setBackgroundColorAttribute(attribute: Int) = apply {
|
||||
val theme = context.theme
|
||||
val backgroundColorTypedValue = TypedValue()
|
||||
theme.resolveAttribute(attribute, backgroundColorTypedValue, true)
|
||||
backgroundColor = ContextCompat.getColor(context, backgroundColorTypedValue.resourceId)
|
||||
}
|
||||
|
||||
fun build(): BitmapDrawable {
|
||||
val textPainter = getTextPainter()
|
||||
val painter = getPainter()
|
||||
|
||||
val bitmap = Bitmap.createBitmap(avatarSize, avatarSize, Bitmap.Config.ARGB_8888)
|
||||
val canvas = Canvas(bitmap)
|
||||
val areaRect = Rect(0, 0, avatarSize, avatarSize)
|
||||
val bounds = RectF(areaRect)
|
||||
bounds.right = textPainter.measureText(initials, 0, initials.length)
|
||||
bounds.bottom = textPainter.descent() - textPainter.ascent()
|
||||
bounds.left += (areaRect.width() - bounds.right) / 2.0f
|
||||
bounds.top += (areaRect.height() - bounds.bottom) / 2.0f
|
||||
|
||||
val halfSize = (avatarSize / 2).toFloat()
|
||||
canvas.drawCircle(halfSize, halfSize, halfSize, painter)
|
||||
canvas.drawText(initials, bounds.left, bounds.top - textPainter.ascent(), textPainter)
|
||||
|
||||
return BitmapDrawable(context.resources, bitmap)
|
||||
}
|
||||
|
||||
private fun getTextPainter(): TextPaint {
|
||||
val textPainter = TextPaint()
|
||||
textPainter.isAntiAlias = true
|
||||
textPainter.textSize = textSize
|
||||
textPainter.color = textColor
|
||||
textPainter.typeface = ResourcesCompat.getFont(context, R.font.noto_sans_800)
|
||||
return textPainter
|
||||
}
|
||||
|
||||
private fun getPainter(): Paint {
|
||||
val painter = Paint()
|
||||
painter.isAntiAlias = true
|
||||
painter.color = backgroundColor
|
||||
return painter
|
||||
}
|
||||
}
|
||||
|
|
@ -44,7 +44,6 @@ import org.linphone.ui.call.model.ZrtpSasConfirmationDialogModel
|
|||
import org.linphone.ui.call.viewmodel.CallsViewModel
|
||||
import org.linphone.ui.call.viewmodel.CurrentCallViewModel
|
||||
import org.linphone.ui.call.viewmodel.SharedCallViewModel
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
import org.linphone.utils.addCharacterAtPosition
|
||||
|
|
@ -167,9 +166,9 @@ class ActiveCallFragment : GenericCallFragment() {
|
|||
R.drawable.trusted,
|
||||
doNotTint = true
|
||||
)
|
||||
binding.avatar.avatarBorderWidth = AppUtils.getDimension(
|
||||
/*binding.avatar.avatarBorderWidth = AppUtils.getDimension(
|
||||
R.dimen.avatar_trust_border_width
|
||||
).toInt()
|
||||
).toInt()*/ // TODO FIXME: show blue border
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class ConversationsListAdapter(
|
|||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: ConversationModel, newItem: ConversationModel): Boolean {
|
||||
return oldItem.avatarModel.id == newItem.avatarModel.id
|
||||
return oldItem.avatarModel.value?.id == newItem.avatarModel.value?.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class ConversationModel @WorkerThread constructor(private val chatRoom: ChatRoom
|
|||
|
||||
val unreadMessageCount = MutableLiveData<Int>()
|
||||
|
||||
val avatarModel: ContactAvatarModel
|
||||
val avatarModel = MutableLiveData<ContactAvatarModel>()
|
||||
|
||||
val groupAvatarModel: GroupAvatarModel
|
||||
|
||||
|
|
@ -147,11 +147,11 @@ class ConversationModel @WorkerThread constructor(private val chatRoom: ChatRoom
|
|||
}
|
||||
val friend = coreContext.contactsManager.findContactByAddress(address)
|
||||
if (friend != null) {
|
||||
avatarModel = ContactAvatarModel(friend)
|
||||
avatarModel.postValue(ContactAvatarModel(friend))
|
||||
} else {
|
||||
val fakeFriend = coreContext.core.createFriend()
|
||||
fakeFriend.address = address
|
||||
avatarModel = ContactAvatarModel(fakeFriend)
|
||||
avatarModel.postValue(ContactAvatarModel(fakeFriend))
|
||||
}
|
||||
groupAvatarModel = GroupAvatarModel(friends)
|
||||
|
||||
|
|
|
|||
|
|
@ -257,7 +257,10 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun processGroupedEvents(groupedEventLogs: ArrayList<EventLog>, isGroupChatRoom: Boolean): ArrayList<EventLogModel> {
|
||||
private fun processGroupedEvents(
|
||||
groupedEventLogs: ArrayList<EventLog>,
|
||||
isGroupChatRoom: Boolean
|
||||
): ArrayList<EventLogModel> {
|
||||
val eventsList = arrayListOf<EventLogModel>()
|
||||
|
||||
// Handle all events in group, then re-start a new group with current item
|
||||
|
|
|
|||
|
|
@ -127,14 +127,15 @@ class StartConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
val friend = coreContext.contactsManager.findContactByAddress(address)
|
||||
if (friend != null) {
|
||||
val model = ContactOrSuggestionModel(address, friend)
|
||||
model.contactAvatarModel = ContactAvatarModel(friend)
|
||||
val avatarModel = ContactAvatarModel(friend)
|
||||
model.avatarModel.postValue(avatarModel)
|
||||
|
||||
val currentLetter = friend.name?.get(0).toString()
|
||||
val displayLetter = previousLetter.isEmpty() || currentLetter != previousLetter
|
||||
if (currentLetter != previousLetter) {
|
||||
previousLetter = currentLetter
|
||||
}
|
||||
model.contactAvatarModel.firstContactStartingByThatLetter.postValue(
|
||||
avatarModel.firstContactStartingByThatLetter.postValue(
|
||||
displayLetter
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,16 +24,19 @@ import android.net.Uri
|
|||
import android.provider.ContactsContract
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.R
|
||||
import org.linphone.contacts.AbstractAvatarModel
|
||||
import org.linphone.core.ChatRoom.SecurityLevel
|
||||
import org.linphone.core.ConsolidatedPresence
|
||||
import org.linphone.core.Friend
|
||||
import org.linphone.core.FriendListenerStub
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.ui.main.model.isInSecureMode
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.TimestampUtils
|
||||
|
||||
class ContactAvatarModel @WorkerThread constructor(val friend: Friend) {
|
||||
class ContactAvatarModel @WorkerThread constructor(val friend: Friend) : AbstractAvatarModel() {
|
||||
companion object {
|
||||
private const val TAG = "[Contact Avatar Model]"
|
||||
}
|
||||
|
|
@ -42,10 +45,6 @@ class ContactAvatarModel @WorkerThread constructor(val friend: Friend) {
|
|||
|
||||
val starred = friend.starred
|
||||
|
||||
val avatar = MutableLiveData<Uri>()
|
||||
|
||||
val initials = AppUtils.getInitials(friend.name.orEmpty())
|
||||
|
||||
val lastPresenceInfo = MutableLiveData<String>()
|
||||
|
||||
val presenceStatus = MutableLiveData<ConsolidatedPresence>()
|
||||
|
|
@ -56,8 +55,6 @@ class ContactAvatarModel @WorkerThread constructor(val friend: Friend) {
|
|||
|
||||
val firstContactStartingByThatLetter = MutableLiveData<Boolean>()
|
||||
|
||||
val trust = MutableLiveData<SecurityLevel>()
|
||||
|
||||
private val friendListener = object : FriendListenerStub() {
|
||||
@WorkerThread
|
||||
override fun onPresenceReceived(fr: Friend) {
|
||||
|
|
@ -71,11 +68,13 @@ class ContactAvatarModel @WorkerThread constructor(val friend: Friend) {
|
|||
init {
|
||||
friend.addListener(friendListener)
|
||||
|
||||
initials.postValue(AppUtils.getInitials(friend.name.orEmpty()))
|
||||
trust.postValue(SecurityLevel.Safe) // TODO FIXME: use API
|
||||
showTrust.postValue(coreContext.core.defaultAccount?.isInSecureMode())
|
||||
images.postValue(arrayListOf(getAvatarUri().toString()))
|
||||
|
||||
name.postValue(friend.name)
|
||||
computePresence()
|
||||
avatar.postValue(getAvatarUri())
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class ContactsAndSuggestionsListAdapter(
|
|||
@UiThread
|
||||
fun bind(contactOrSuggestionModel: ContactOrSuggestionModel) {
|
||||
with(binding) {
|
||||
model = contactOrSuggestionModel.contactAvatarModel
|
||||
model = contactOrSuggestionModel.avatarModel.value
|
||||
|
||||
lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package org.linphone.ui.main.history.model
|
|||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.core.Address
|
||||
import org.linphone.core.Friend
|
||||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||
|
|
@ -42,7 +43,7 @@ class ContactOrSuggestionModel @WorkerThread constructor(
|
|||
|
||||
val initials = AppUtils.getInitials(name)
|
||||
|
||||
lateinit var contactAvatarModel: ContactAvatarModel
|
||||
val avatarModel = MutableLiveData<ContactAvatarModel>()
|
||||
|
||||
@UiThread
|
||||
fun onClicked() {
|
||||
|
|
|
|||
|
|
@ -197,14 +197,15 @@ class StartCallViewModel @UiThread constructor() : ViewModel() {
|
|||
val friend = coreContext.contactsManager.findContactByAddress(address)
|
||||
if (friend != null) {
|
||||
val model = ContactOrSuggestionModel(address, friend)
|
||||
model.contactAvatarModel = ContactAvatarModel(friend)
|
||||
val avatarModel = ContactAvatarModel(friend)
|
||||
model.avatarModel.postValue(avatarModel)
|
||||
|
||||
val currentLetter = friend.name?.get(0).toString()
|
||||
val displayLetter = previousLetter.isEmpty() || currentLetter != previousLetter
|
||||
if (currentLetter != previousLetter) {
|
||||
previousLetter = currentLetter
|
||||
}
|
||||
model.contactAvatarModel.firstContactStartingByThatLetter.postValue(
|
||||
avatarModel.firstContactStartingByThatLetter.postValue(
|
||||
displayLetter
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import androidx.annotation.WorkerThread
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.R
|
||||
import org.linphone.contacts.AbstractAvatarModel
|
||||
import org.linphone.core.Account
|
||||
import org.linphone.core.AccountListenerStub
|
||||
import org.linphone.core.ChatMessage
|
||||
|
|
@ -40,17 +41,13 @@ class AccountModel @WorkerThread constructor(
|
|||
val account: Account,
|
||||
private val onMenuClicked: ((view: View, account: Account) -> Unit)? = null,
|
||||
private val onSetAsDefault: ((account: Account) -> Unit)? = null
|
||||
) {
|
||||
) : AbstractAvatarModel() {
|
||||
companion object {
|
||||
private const val TAG = "[Account Model]"
|
||||
}
|
||||
|
||||
val displayName = MutableLiveData<String>()
|
||||
|
||||
val avatar = MutableLiveData<String>()
|
||||
|
||||
val initials = MutableLiveData<String>()
|
||||
|
||||
val registrationState = MutableLiveData<RegistrationState>()
|
||||
|
||||
val registrationStateLabel = MutableLiveData<String>()
|
||||
|
|
@ -59,8 +56,6 @@ class AccountModel @WorkerThread constructor(
|
|||
|
||||
val isDefault = MutableLiveData<Boolean>()
|
||||
|
||||
val showTrust = MutableLiveData<Boolean>()
|
||||
|
||||
val notificationsCount = MutableLiveData<Int>()
|
||||
|
||||
private val accountListener = object : AccountListenerStub() {
|
||||
|
|
@ -99,6 +94,7 @@ class AccountModel @WorkerThread constructor(
|
|||
account.addListener(accountListener)
|
||||
coreContext.core.addListener(coreListener)
|
||||
|
||||
trust.postValue(ChatRoom.SecurityLevel.Safe)
|
||||
showTrust.postValue(account.isInSecureMode())
|
||||
|
||||
update()
|
||||
|
|
@ -155,8 +151,8 @@ class AccountModel @WorkerThread constructor(
|
|||
initials.postValue(AppUtils.getInitials(name))
|
||||
|
||||
val pictureUri = account.params.pictureUri.orEmpty()
|
||||
if (pictureUri != avatar.value) {
|
||||
avatar.postValue(pictureUri)
|
||||
if (pictureUri != images.value?.firstOrNull()) {
|
||||
images.postValue(arrayListOf(pictureUri))
|
||||
Log.d("$TAG Account picture URI is [$pictureUri]")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class AccountProfileViewModel @UiThread constructor() : ViewModel() {
|
|||
copy.pictureUri = null
|
||||
}
|
||||
|
||||
accountModel.value?.avatar?.postValue(path)
|
||||
accountModel.value?.images?.postValue(arrayListOf(path))
|
||||
account.params = copy
|
||||
account.refreshRegister()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
package org.linphone.utils
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.PorterDuff
|
||||
import android.text.Editable
|
||||
|
|
@ -31,7 +32,9 @@ import android.widget.EditText
|
|||
import android.widget.ImageView
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.ColorRes
|
||||
import androidx.annotation.DimenRes
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.view.ViewCompat
|
||||
|
|
@ -43,19 +46,24 @@ import androidx.databinding.ViewDataBinding
|
|||
import androidx.emoji2.emojipicker.EmojiPickerView
|
||||
import androidx.emoji2.emojipicker.EmojiViewItem
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.findViewTreeLifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import coil.dispose
|
||||
import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import io.getstream.avatarview.AvatarView
|
||||
import io.getstream.avatarview.coil.loadImage
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.linphone.BR
|
||||
import org.linphone.R
|
||||
import org.linphone.contacts.AbstractAvatarModel
|
||||
import org.linphone.contacts.AvatarGenerator
|
||||
import org.linphone.core.ChatRoom
|
||||
import org.linphone.core.ConsolidatedPresence
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||
import org.linphone.ui.main.contacts.model.GroupAvatarModel
|
||||
import org.linphone.ui.main.model.AccountModel
|
||||
|
||||
/**
|
||||
* This file contains all the data binding necessary for the app
|
||||
|
|
@ -173,17 +181,6 @@ fun AppCompatTextView.setDrawableTint(@ColorInt color: Int) {
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("coil")
|
||||
fun ImageView.loadCircleFileWithCoil(file: String?) {
|
||||
Log.i("[Data Binding Utils] Loading file [$file] with coil")
|
||||
if (file != null) {
|
||||
load(file) {
|
||||
transformations(CircleCropTransformation())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("presenceIcon")
|
||||
fun ImageView.setPresenceIcon(presence: ConsolidatedPresence?) {
|
||||
|
|
@ -209,6 +206,106 @@ fun AppCompatTextView.setColor(@ColorRes color: Int) {
|
|||
}
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("coil")
|
||||
fun ImageView.loadCircleFileWithCoil(file: String?) {
|
||||
Log.i("[Data Binding Utils] Loading file [$file] with coil")
|
||||
if (file != null) {
|
||||
load(file) {
|
||||
transformations(CircleCropTransformation())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("coilAvatar")
|
||||
fun ImageView.loadAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
val imageView = this
|
||||
(context as AppCompatActivity).lifecycleScope.launch {
|
||||
loadContactPictureWithCoil(imageView, model)
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("coilBubbleAvatar")
|
||||
fun ImageView.loadBubbleAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
val imageView = this
|
||||
(context as AppCompatActivity).lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
val size = R.dimen.avatar_bubble_size
|
||||
val initialsSize = R.dimen.avatar_initials_bubble_text_size
|
||||
loadContactPictureWithCoil(imageView, model, size = size, textSize = initialsSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("coilBigAvatar")
|
||||
fun ImageView.loadBigAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
val imageView = this
|
||||
(context as AppCompatActivity).lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
val size = R.dimen.avatar_big_size
|
||||
val initialsSize = R.dimen.avatar_initials_big_text_size
|
||||
loadContactPictureWithCoil(imageView, model, size = size, textSize = initialsSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("coilCallAvatar")
|
||||
fun ImageView.loadCallAvatarWithCoil(model: AbstractAvatarModel?) {
|
||||
val imageView = this
|
||||
(context as AppCompatActivity).lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
val size = R.dimen.avatar_in_call_size
|
||||
val initialsSize = R.dimen.avatar_initials_call_text_size
|
||||
loadContactPictureWithCoil(imageView, model, size = size, textSize = initialsSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ResourceType")
|
||||
private suspend fun loadContactPictureWithCoil(
|
||||
imageView: ImageView,
|
||||
model: AbstractAvatarModel?,
|
||||
@DimenRes size: Int = 0,
|
||||
@DimenRes textSize: Int = 0
|
||||
) {
|
||||
withContext(Dispatchers.IO) {
|
||||
imageView.dispose()
|
||||
|
||||
val context = imageView.context
|
||||
if (model != null) {
|
||||
val image = model.images.value?.firstOrNull()
|
||||
imageView.load(image) {
|
||||
transformations(CircleCropTransformation())
|
||||
error(
|
||||
coroutineScope {
|
||||
withContext(Dispatchers.IO) {
|
||||
val builder = AvatarGenerator(context)
|
||||
builder.setInitials(model.initials.value.orEmpty())
|
||||
if (size > 0) {
|
||||
builder.setAvatarSize(AppUtils.getDimension(size).toInt())
|
||||
}
|
||||
if (textSize > 0) {
|
||||
builder.setTextSize(AppUtils.getDimension(textSize))
|
||||
}
|
||||
/*if (color > 0) {
|
||||
builder.setBackgroundColorAttribute(color)
|
||||
}
|
||||
if (textColor > 0) {
|
||||
builder.setTextColorResource(textColor)
|
||||
}*/
|
||||
builder.build()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*@UiThread
|
||||
@BindingAdapter("avatarInitials")
|
||||
fun AvatarView.loadInitials(initials: String?) {
|
||||
Log.i("[Data Binding Utils] Displaying initials [$initials] on AvatarView")
|
||||
|
|
@ -288,7 +385,7 @@ fun AvatarView.loadContactAvatar(contact: ContactAvatarModel?) {
|
|||
avatarBorderWidth =
|
||||
AppUtils.getDimension(R.dimen.avatar_trust_border_width).toInt()
|
||||
}
|
||||
ChatRoom.SecurityLevel.Encrypted -> {
|
||||
ChatRoom.SecurityLevel.Safe -> {
|
||||
avatarBorderColor =
|
||||
resources.getColor(R.color.blue_info_500, context.theme)
|
||||
avatarBorderWidth =
|
||||
|
|
@ -309,12 +406,7 @@ fun AvatarView.loadContactAvatar(contact: ContactAvatarModel?) {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("contactPicture")
|
||||
fun ImageView.loadContactPicture(contact: ContactAvatarModel?) {
|
||||
loadCircleFileWithCoil(contact?.avatar?.value?.toString())
|
||||
}
|
||||
}*/
|
||||
|
||||
@UiThread
|
||||
@BindingAdapter("groupAvatar")
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
app:barrierDirection="right"
|
||||
app:constraint_referenced_ids="name, register_status" />
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
|
|
@ -34,14 +34,7 @@
|
|||
android:layout_marginBottom="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
accountAvatar="@{model}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilAvatar="@{model}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@
|
|||
app:constraint_referenced_ids="sip_address, sip_address_label, display_name, display_name_label, details_background"
|
||||
android:visibility="@{viewModel.expandDetails ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:onClick="@{pickImageClickListener}"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_big_size"
|
||||
|
|
@ -92,15 +92,7 @@
|
|||
android:layout_marginTop="20dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
accountAvatar="@{viewModel.accountModel}"
|
||||
app:avatarViewInitials="JD"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="21sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilAvatar="@{viewModel.accountModel}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
@ -125,7 +117,7 @@
|
|||
android:textSize="14sp"
|
||||
android:drawableStart="@drawable/camera"
|
||||
android:drawablePadding="3dp"
|
||||
android:visibility="@{viewModel.accountModel.avatar.empty ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:visibility="@{viewModel.accountModel.images.size() == 0 ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintTop_toBottomOf="@id/avatar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
|
@ -141,7 +133,7 @@
|
|||
android:textSize="14sp"
|
||||
android:drawableStart="@drawable/pencil_simple"
|
||||
android:drawablePadding="3dp"
|
||||
android:visibility="@{viewModel.accountModel.avatar.empty ? View.GONE : View.VISIBLE}"
|
||||
android:visibility="@{viewModel.accountModel.images.size() == 0 ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintTop_toBottomOf="@id/avatar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -159,7 +151,7 @@
|
|||
android:textSize="14sp"
|
||||
android:drawableStart="@drawable/trash_simple"
|
||||
android:drawablePadding="3dp"
|
||||
android:visibility="@{viewModel.accountModel.avatar.empty ? View.GONE : View.VISIBLE}"
|
||||
android:visibility="@{viewModel.accountModel.images.size() == 0 ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/avatar"
|
||||
app:layout_constraintStart_toEndOf="@id/edit_picture_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
|
|
|||
|
|
@ -60,21 +60,13 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{viewModel.contact}"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="36sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
app:avatarViewBorderColor="@color/blue_info_500"
|
||||
coilCallAvatar="@{viewModel.contact}"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintWidth_max="@dimen/avatar_in_call_size"
|
||||
app:layout_constraintHeight_max="@dimen/avatar_in_call_size"
|
||||
|
|
|
|||
|
|
@ -82,19 +82,12 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_in_call_size"
|
||||
android:layout_height="@dimen/avatar_in_call_size"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{viewModel.contact}"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="36sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilCallAvatar="@{viewModel.contact}"
|
||||
app:layout_constraintEnd_toEndOf="@id/background"
|
||||
app:layout_constraintStart_toStartOf="@id/background"
|
||||
app:layout_constraintTop_toTopOf="@id/background"
|
||||
|
|
|
|||
|
|
@ -62,19 +62,12 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_in_call_size"
|
||||
android:layout_height="@dimen/avatar_in_call_size"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{viewModel.contact}"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="36sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilCallAvatar="@{viewModel.contact}"
|
||||
app:layout_constraintEnd_toEndOf="@id/background"
|
||||
app:layout_constraintStart_toStartOf="@id/background"
|
||||
app:layout_constraintTop_toTopOf="@id/background"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/primary_cell_background">
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
|
|
@ -34,14 +34,7 @@
|
|||
android:layout_marginBottom="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{model.contact}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilAvatar="@{model.contact}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
|||
|
|
@ -76,19 +76,12 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_in_call_size"
|
||||
android:layout_height="@dimen/avatar_in_call_size"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{viewModel.contact}"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="36sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilCallAvatar="@{viewModel.contact}"
|
||||
app:layout_constraintEnd_toEndOf="@id/background"
|
||||
app:layout_constraintStart_toStartOf="@id/background"
|
||||
app:layout_constraintTop_toTopOf="@id/background"
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
android:visibility="@{!model.isFromGroup ? View.GONE: model.isGroupedWithPreviousOne ? View.INVISIBLE : View.VISIBLE}"
|
||||
contactPicture="@{model.avatarModel}"
|
||||
coilBubbleAvatar="@{model.avatarModel}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/title"/>
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
|
|
@ -51,14 +51,7 @@
|
|||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
android:visibility="@{viewModel.isGroup ? View.GONE : View.VISIBLE}"
|
||||
contactAvatar="@{viewModel.avatarModel}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilAvatar="@{viewModel.avatarModel}"
|
||||
app:layout_constraintBottom_toBottomOf="@id/back"
|
||||
app:layout_constraintStart_toEndOf="@id/back"
|
||||
app:layout_constraintTop_toTopOf="@id/back" />
|
||||
|
|
|
|||
|
|
@ -30,22 +30,15 @@
|
|||
android:paddingBottom="4dp"
|
||||
android:background="@drawable/primary_cell_background">
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginStart="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{model.avatarModel}"
|
||||
coilAvatar="@{model.avatarModel}"
|
||||
android:visibility="@{model.isGroup ? View.GONE : View.VISIBLE}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
|||
|
|
@ -26,20 +26,13 @@
|
|||
android:padding="5dp"
|
||||
android:background="@drawable/primary_cell_background">
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_favorite_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_favorite_list_cell_size"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{model}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilAvatar="@{model}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
|||
|
|
@ -96,21 +96,14 @@
|
|||
app:constraint_referenced_ids="trusted_devices_count, trust_background, trusted_devices_progress, devices, trusted_devices_progress_label"
|
||||
android:visibility="@{viewModel.expandDevicesTrust ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_big_size"
|
||||
android:layout_height="@dimen/avatar_big_size"
|
||||
android:layout_marginTop="8dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{viewModel.contact}"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="21sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilBigAvatar="@{viewModel.contact}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
|
|
@ -61,14 +61,7 @@
|
|||
android:layout_marginBottom="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{model}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilAvatar="@{model}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/header"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
|||
|
|
@ -71,20 +71,13 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_big_size"
|
||||
android:layout_height="@dimen/avatar_big_size"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{viewModel.callLogModel.avatarModel}"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="21sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilBigAvatar="@{viewModel.callLogModel.avatarModel}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/primary_cell_background">
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
|
|
@ -38,14 +38,7 @@
|
|||
android:layout_marginStart="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{model.avatarModel}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilAvatar="@{model.avatarModel}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
|
|
@ -24,14 +24,7 @@
|
|||
android:layout_marginBottom="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{model.avatarModel}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilAvatar="@{model.avatarModel}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
|||
|
|
@ -34,21 +34,14 @@
|
|||
app:constraint_referenced_ids="title, search"
|
||||
app:barrierDirection="bottom" />
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
<ImageView
|
||||
android:onClick="@{() -> viewModel.openDrawerMenu()}"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginStart="15dp"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
accountAvatar="@{viewModel.account}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
coilAvatar="@{viewModel.account}"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/title" />
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@
|
|||
<dimen name="avatar_presence_badge_big_end_margin">5dp</dimen>
|
||||
<dimen name="avatar_trust_border_width">2dp</dimen>
|
||||
|
||||
<dimen name="avatar_initials_text_size">16sp</dimen>
|
||||
<dimen name="avatar_initials_bubble_text_size">14sp</dimen>
|
||||
<dimen name="avatar_initials_big_text_size">21sp</dimen>
|
||||
<dimen name="avatar_initials_call_text_size">36sp</dimen>
|
||||
|
||||
<dimen name="primary_secondary_buttons_label_padding">11dp</dimen>
|
||||
<dimen name="dialog_top_bottom_margin">20dp</dimen>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue