mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 13:59:48 +01:00
use displayName instead of source to display avatars
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
c2deca00ee
commit
d780d4b261
@ -129,14 +129,22 @@ class MentionAutocompleteItem(
|
||||
private fun setAvatar(holder: ParticipantItemViewHolder, objectId: String?) {
|
||||
when (source) {
|
||||
SOURCE_CALLS -> {
|
||||
run {}
|
||||
run {
|
||||
holder.binding.avatarView.loadUserAvatar(
|
||||
viewThemeUtils.talk.themePlaceholderAvatar(
|
||||
holder.binding.avatarView,
|
||||
R.drawable.ic_phone
|
||||
if (isPhoneNumber(displayName)) {
|
||||
holder.binding.avatarView.loadUserAvatar(
|
||||
viewThemeUtils.talk.themePlaceholderAvatar(
|
||||
holder.binding.avatarView,
|
||||
R.drawable.ic_phone
|
||||
)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
holder.binding.avatarView.loadUserAvatar(
|
||||
viewThemeUtils.talk.themePlaceholderAvatar(
|
||||
holder.binding.avatarView,
|
||||
R.drawable.ic_avatar_group
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,6 +202,10 @@ class MentionAutocompleteItem(
|
||||
}
|
||||
}
|
||||
|
||||
fun isPhoneNumber(input: String?): Boolean {
|
||||
return input?.matches(Regex("^\\+?\\d+$")) == true
|
||||
}
|
||||
|
||||
private fun drawStatus(holder: ParticipantItemViewHolder) {
|
||||
val size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context)
|
||||
holder.binding.userStatusImage.setImageDrawable(
|
||||
|
@ -164,7 +164,7 @@ object DisplayUtils {
|
||||
val drawable: Int
|
||||
val isCall = "call" == type || "calls" == type
|
||||
val isGroup = "groups" == type || "user-group" == type
|
||||
if (!isGroup) {
|
||||
if (!isGroup && !isCall) {
|
||||
drawable = if (chipResource == R.xml.chip_you) {
|
||||
R.drawable.mention_chip
|
||||
} else {
|
||||
@ -178,7 +178,7 @@ object DisplayUtils {
|
||||
chip.setChipIconResource(R.drawable.icon_team)
|
||||
}
|
||||
|
||||
if (isCall) {
|
||||
if (isCall && isPhoneNumber(label.toString())) {
|
||||
chip.setChipIconResource(R.drawable.icon_circular_phone)
|
||||
}
|
||||
chip.setBounds(0, 0, chip.intrinsicWidth, chip.intrinsicHeight)
|
||||
@ -536,4 +536,8 @@ object DisplayUtils {
|
||||
text
|
||||
}
|
||||
}
|
||||
|
||||
fun isPhoneNumber(input: String?): Boolean {
|
||||
return input?.matches(Regex("^\\+?\\d+$")) == true
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user