mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 22:04:24 +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?) {
|
private fun setAvatar(holder: ParticipantItemViewHolder, objectId: String?) {
|
||||||
when (source) {
|
when (source) {
|
||||||
SOURCE_CALLS -> {
|
SOURCE_CALLS -> {
|
||||||
run {}
|
|
||||||
run {
|
run {
|
||||||
holder.binding.avatarView.loadUserAvatar(
|
if (isPhoneNumber(displayName)) {
|
||||||
viewThemeUtils.talk.themePlaceholderAvatar(
|
holder.binding.avatarView.loadUserAvatar(
|
||||||
holder.binding.avatarView,
|
viewThemeUtils.talk.themePlaceholderAvatar(
|
||||||
R.drawable.ic_phone
|
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) {
|
private fun drawStatus(holder: ParticipantItemViewHolder) {
|
||||||
val size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context)
|
val size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context)
|
||||||
holder.binding.userStatusImage.setImageDrawable(
|
holder.binding.userStatusImage.setImageDrawable(
|
||||||
|
@ -164,7 +164,7 @@ object DisplayUtils {
|
|||||||
val drawable: Int
|
val drawable: Int
|
||||||
val isCall = "call" == type || "calls" == type
|
val isCall = "call" == type || "calls" == type
|
||||||
val isGroup = "groups" == type || "user-group" == type
|
val isGroup = "groups" == type || "user-group" == type
|
||||||
if (!isGroup) {
|
if (!isGroup && !isCall) {
|
||||||
drawable = if (chipResource == R.xml.chip_you) {
|
drawable = if (chipResource == R.xml.chip_you) {
|
||||||
R.drawable.mention_chip
|
R.drawable.mention_chip
|
||||||
} else {
|
} else {
|
||||||
@ -178,7 +178,7 @@ object DisplayUtils {
|
|||||||
chip.setChipIconResource(R.drawable.icon_team)
|
chip.setChipIconResource(R.drawable.icon_team)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCall) {
|
if (isCall && isPhoneNumber(label.toString())) {
|
||||||
chip.setChipIconResource(R.drawable.icon_circular_phone)
|
chip.setChipIconResource(R.drawable.icon_circular_phone)
|
||||||
}
|
}
|
||||||
chip.setBounds(0, 0, chip.intrinsicWidth, chip.intrinsicHeight)
|
chip.setBounds(0, 0, chip.intrinsicWidth, chip.intrinsicHeight)
|
||||||
@ -536,4 +536,8 @@ object DisplayUtils {
|
|||||||
text
|
text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isPhoneNumber(input: String?): Boolean {
|
||||||
|
return input?.matches(Regex("^\\+?\\d+$")) == true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user