mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 13:59:48 +01:00
Merge pull request #5131 from nextcloud/fix_autocomplete
Fix mentions of phone conversation
This commit is contained in:
commit
e982864e55
14
app/src/main/java/com/nextcloud/talk/PhoneUtils.kt
Normal file
14
app/src/main/java/com/nextcloud/talk/PhoneUtils.kt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Nextcloud Talk - Android Client
|
||||||
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2025 Sowjanya Kota <sowjanya.kch@gmail.com>
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.nextcloud.talk
|
||||||
|
|
||||||
|
object PhoneUtils {
|
||||||
|
fun isPhoneNumber(input: String?): Boolean {
|
||||||
|
return input?.matches(Regex("^\\+?\\d+$")) == true
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
|||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import coil.Coil
|
import coil.Coil
|
||||||
import coil.request.ImageRequest
|
import coil.request.ImageRequest
|
||||||
|
import com.nextcloud.talk.PhoneUtils.isPhoneNumber
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.adapters.items.ParticipantItem.ParticipantItemViewHolder
|
import com.nextcloud.talk.adapters.items.ParticipantItem.ParticipantItemViewHolder
|
||||||
import com.nextcloud.talk.data.user.model.User
|
import com.nextcloud.talk.data.user.model.User
|
||||||
@ -129,14 +130,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_avatar_group
|
holder.binding.avatarView,
|
||||||
|
R.drawable.ic_phone_small
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
} else {
|
||||||
|
holder.binding.avatarView.loadUserAvatar(
|
||||||
|
viewThemeUtils.talk.themePlaceholderAvatar(
|
||||||
|
holder.binding.avatarView,
|
||||||
|
R.drawable.ic_avatar_group
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ import coil.request.ImageRequest
|
|||||||
import coil.target.Target
|
import coil.target.Target
|
||||||
import coil.transform.CircleCropTransformation
|
import coil.transform.CircleCropTransformation
|
||||||
import com.google.android.material.chip.ChipDrawable
|
import com.google.android.material.chip.ChipDrawable
|
||||||
|
import com.nextcloud.talk.PhoneUtils.isPhoneNumber
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
||||||
import com.nextcloud.talk.data.user.model.User
|
import com.nextcloud.talk.data.user.model.User
|
||||||
@ -162,8 +163,9 @@ object DisplayUtils {
|
|||||||
val config = context.resources.configuration
|
val config = context.resources.configuration
|
||||||
chip.setLayoutDirection(config.layoutDirection)
|
chip.setLayoutDirection(config.layoutDirection)
|
||||||
val drawable: Int
|
val drawable: Int
|
||||||
val isCallOrGroup = "call" == type || "calls" == type || "groups" == type || "user-group" == type
|
val isCall = "call" == type || "calls" == type
|
||||||
if (!isCallOrGroup) {
|
val isGroup = "groups" == type || "user-group" == type
|
||||||
|
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 {
|
||||||
@ -176,8 +178,12 @@ object DisplayUtils {
|
|||||||
if (type == "circle" || type == "teams") {
|
if (type == "circle" || type == "teams") {
|
||||||
chip.setChipIconResource(R.drawable.icon_team)
|
chip.setChipIconResource(R.drawable.icon_team)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCall && isPhoneNumber(label.toString())) {
|
||||||
|
chip.setChipIconResource(R.drawable.icon_circular_phone)
|
||||||
|
}
|
||||||
chip.setBounds(0, 0, chip.intrinsicWidth, chip.intrinsicHeight)
|
chip.setBounds(0, 0, chip.intrinsicWidth, chip.intrinsicHeight)
|
||||||
if (!isCallOrGroup) {
|
if (!isGroup) {
|
||||||
var url = getUrlForAvatar(conversationUser.baseUrl, id, false)
|
var url = getUrlForAvatar(conversationUser.baseUrl, id, false)
|
||||||
if ("guests" == type || "guest" == type || "email" == type) {
|
if ("guests" == type || "guest" == type || "email" == type) {
|
||||||
url = getUrlForGuestAvatar(
|
url = getUrlForGuestAvatar(
|
||||||
|
27
app/src/main/res/drawable-night/icon_circular_phone.xml
Normal file
27
app/src/main/res/drawable-night/icon_circular_phone.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!--
|
||||||
|
~ Nextcloud Talk - Android Client
|
||||||
|
~
|
||||||
|
~ SPDX-FileCopyrightText: 2018-2025 Google LLC
|
||||||
|
~ SPDX-License-Identifier: Apache-2.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="48dp"
|
||||||
|
android:height="48dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2z"
|
||||||
|
android:fillColor="#3B3B3B" />
|
||||||
|
|
||||||
|
<group
|
||||||
|
android:scaleX="0.55"
|
||||||
|
android:scaleY="0.55"
|
||||||
|
android:pivotX="12"
|
||||||
|
android:pivotY="12">
|
||||||
|
<path
|
||||||
|
android:pathData="M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1v3.5c0,0.55 -0.45,1 -1,1C10.07,21 3,13.93 3,5.5 3,4.95 3.45,4.5 4,4.5H7.5c0.55,0 1,0.45 1,1 0,1.24 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z"
|
||||||
|
android:fillColor="#FFFFFF" />
|
||||||
|
</group>
|
||||||
|
</vector>
|
@ -14,3 +14,4 @@
|
|||||||
android:fillColor="@android:color/white"
|
android:fillColor="@android:color/white"
|
||||||
android:pathData="M798,840Q673,840 551,785.5Q429,731 329,631Q229,531 174.5,409Q120,287 120,162Q120,144 132,132Q144,120 162,120L324,120Q338,120 349,129.5Q360,139 362,152L388,292Q390,308 387,319Q384,330 376,338L279,436Q299,473 326.5,507.5Q354,542 387,574Q418,605 452,631.5Q486,658 524,680L618,586Q627,577 641.5,572.5Q656,568 670,570L808,598Q822,602 831,612.5Q840,623 840,636L840,798Q840,816 828,828Q816,840 798,840ZM241,360L307,294Q307,294 307,294Q307,294 307,294L290,200Q290,200 290,200Q290,200 290,200L201,200Q201,200 201,200Q201,200 201,200Q206,241 215,281Q224,321 241,360ZM599,718Q638,735 678.5,745Q719,755 760,758Q760,758 760,758Q760,758 760,758L760,670Q760,670 760,670Q760,670 760,670L666,651Q666,651 666,651Q666,651 666,651L599,718ZM241,360Q241,360 241,360Q241,360 241,360Q241,360 241,360Q241,360 241,360L241,360Q241,360 241,360Q241,360 241,360L241,360Q241,360 241,360Q241,360 241,360ZM599,718L599,718Q599,718 599,718Q599,718 599,718L599,718Q599,718 599,718Q599,718 599,718L599,718Q599,718 599,718Q599,718 599,718Q599,718 599,718Q599,718 599,718Z" />
|
android:pathData="M798,840Q673,840 551,785.5Q429,731 329,631Q229,531 174.5,409Q120,287 120,162Q120,144 132,132Q144,120 162,120L324,120Q338,120 349,129.5Q360,139 362,152L388,292Q390,308 387,319Q384,330 376,338L279,436Q299,473 326.5,507.5Q354,542 387,574Q418,605 452,631.5Q486,658 524,680L618,586Q627,577 641.5,572.5Q656,568 670,570L808,598Q822,602 831,612.5Q840,623 840,636L840,798Q840,816 828,828Q816,840 798,840ZM241,360L307,294Q307,294 307,294Q307,294 307,294L290,200Q290,200 290,200Q290,200 290,200L201,200Q201,200 201,200Q201,200 201,200Q206,241 215,281Q224,321 241,360ZM599,718Q638,735 678.5,745Q719,755 760,758Q760,758 760,758Q760,758 760,758L760,670Q760,670 760,670Q760,670 760,670L666,651Q666,651 666,651Q666,651 666,651L599,718ZM241,360Q241,360 241,360Q241,360 241,360Q241,360 241,360Q241,360 241,360L241,360Q241,360 241,360Q241,360 241,360L241,360Q241,360 241,360Q241,360 241,360ZM599,718L599,718Q599,718 599,718Q599,718 599,718L599,718Q599,718 599,718Q599,718 599,718L599,718Q599,718 599,718Q599,718 599,718Q599,718 599,718Q599,718 599,718Z" />
|
||||||
</vector>
|
</vector>
|
||||||
|
|
||||||
|
22
app/src/main/res/drawable/ic_phone_small.xml
Normal file
22
app/src/main/res/drawable/ic_phone_small.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<!--
|
||||||
|
~ Nextcloud Talk - Android Client
|
||||||
|
~
|
||||||
|
~ SPDX-FileCopyrightText: 2018-2025 Google LLC
|
||||||
|
~ SPDX-License-Identifier: Apache-2.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<group
|
||||||
|
android:pivotX="480"
|
||||||
|
android:pivotY="480"
|
||||||
|
android:scaleX="0.6"
|
||||||
|
android:scaleY="0.6">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M798,840Q673,840 551,785.5Q429,731 329,631Q229,531 174.5,409Q120,287 120,162Q120,144 132,132Q144,120 162,120L324,120Q338,120 349,129.5Q360,139 362,152L388,292Q390,308 387,319Q384,330 376,338L279,436Q299,473 326.5,507.5Q354,542 387,574Q418,605 452,631.5Q486,658 524,680L618,586Q627,577 641.5,572.5Q656,568 670,570L808,598Q822,602 831,612.5Q840,623 840,636L840,798Q840,816 828,828Q816,840 798,840Z" />
|
||||||
|
</group>
|
||||||
|
</vector>
|
27
app/src/main/res/drawable/icon_circular_phone.xml
Normal file
27
app/src/main/res/drawable/icon_circular_phone.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!--
|
||||||
|
~ Nextcloud Talk - Android Client
|
||||||
|
~
|
||||||
|
~ SPDX-FileCopyrightText: 2018-2025 Google LLC
|
||||||
|
~ SPDX-License-Identifier: Apache-2.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2z"
|
||||||
|
android:fillColor="#6B6B6B" />
|
||||||
|
|
||||||
|
<group
|
||||||
|
android:scaleX="0.55"
|
||||||
|
android:scaleY="0.55"
|
||||||
|
android:pivotX="12"
|
||||||
|
android:pivotY="12">
|
||||||
|
<path
|
||||||
|
android:pathData="M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1v3.5c0,0.55 -0.45,1 -1,1C10.07,21 3,13.93 3,5.5 3,4.95 3.45,4.5 4,4.5H7.5c0.55,0 1,0.45 1,1 0,1.24 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z"
|
||||||
|
android:fillColor="#FFFFFF" />
|
||||||
|
</group>
|
||||||
|
</vector>
|
Loading…
Reference in New Issue
Block a user