mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
Merge pull request #4697 from nextcloud/backport/4678/stable-21.0
[stable-21.0] Team mentions
This commit is contained in:
commit
b6edcbf6ad
@ -13,6 +13,8 @@ import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import coil.Coil
|
||||
import coil.request.ImageRequest
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.adapters.items.ParticipantItem.ParticipantItemViewHolder
|
||||
import com.nextcloud.talk.data.user.model.User
|
||||
@ -165,6 +167,22 @@ class MentionAutocompleteItem(
|
||||
}
|
||||
}
|
||||
|
||||
SOURCE_TEAMS -> {
|
||||
holder.binding.avatarView.post {
|
||||
val imageViewWidth = holder.binding.avatarView.width
|
||||
val imageViewHeight = holder.binding.avatarView.height
|
||||
|
||||
val request = ImageRequest.Builder(context)
|
||||
.data(R.drawable.icon_team)
|
||||
.size(imageViewWidth, imageViewHeight)
|
||||
.scale(coil.size.Scale.FILL)
|
||||
.target(holder.binding.avatarView)
|
||||
.build()
|
||||
|
||||
Coil.imageLoader(context).enqueue(request)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
holder.binding.avatarView.loadUserAvatar(
|
||||
currentUser,
|
||||
@ -237,6 +255,7 @@ class MentionAutocompleteItem(
|
||||
const val SOURCE_GUESTS = "guests"
|
||||
const val SOURCE_GROUPS = "groups"
|
||||
const val SOURCE_EMAILS = "emails"
|
||||
const val SOURCE_TEAMS = "teams"
|
||||
const val SOURCE_FEDERATION = "federated_users"
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import com.nextcloud.talk.extensions.loadDefaultAvatar
|
||||
import com.nextcloud.talk.extensions.loadDefaultGroupCallAvatar
|
||||
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
|
||||
import com.nextcloud.talk.extensions.loadFirstLetterAvatar
|
||||
import com.nextcloud.talk.extensions.loadTeamAvatar
|
||||
import com.nextcloud.talk.extensions.loadUserAvatar
|
||||
import com.nextcloud.talk.models.domain.ConversationModel
|
||||
import com.nextcloud.talk.models.json.participants.Participant
|
||||
@ -207,10 +208,14 @@ class ParticipantItem(
|
||||
|
||||
private fun loadAvatars(holder: ParticipantItemViewHolder) {
|
||||
when (model.calculatedActorType) {
|
||||
Participant.ActorType.GROUPS, Participant.ActorType.CIRCLES -> {
|
||||
Participant.ActorType.GROUPS -> {
|
||||
holder.binding.avatarView.loadDefaultGroupCallAvatar(viewThemeUtils)
|
||||
}
|
||||
|
||||
Participant.ActorType.CIRCLES -> {
|
||||
holder.binding.avatarView.loadTeamAvatar(viewThemeUtils)
|
||||
}
|
||||
|
||||
Participant.ActorType.USERS -> {
|
||||
holder.binding.avatarView.loadUserAvatar(user, model.calculatedActorId!!, true, false)
|
||||
}
|
||||
|
@ -838,7 +838,8 @@ class MessageInputFragment : Fragment() {
|
||||
mentionId.contains("@") ||
|
||||
mentionId.startsWith("guest/") ||
|
||||
mentionId.startsWith("group/") ||
|
||||
mentionId.startsWith("email/")
|
||||
mentionId.startsWith("email/") ||
|
||||
mentionId.startsWith("team/")
|
||||
if (shouldQuote) {
|
||||
mentionId = "\"" + mentionId + "\""
|
||||
}
|
||||
|
@ -343,6 +343,11 @@ fun ImageView.loadDefaultGroupCallAvatar(viewThemeUtils: ViewThemeUtils): io.rea
|
||||
return loadUserAvatar(data)
|
||||
}
|
||||
|
||||
fun ImageView.loadTeamAvatar(viewThemeUtils: ViewThemeUtils): io.reactivex.disposables.Disposable {
|
||||
val data: Any = viewThemeUtils.talk.themePlaceholderAvatar(this, R.drawable.icon_team) as Any
|
||||
return loadUserAvatar(data)
|
||||
}
|
||||
|
||||
fun ImageView.loadDefaultAvatar(viewThemeUtils: ViewThemeUtils): io.reactivex.disposables.Disposable {
|
||||
val data: Any = viewThemeUtils.talk.themePlaceholderAvatar(this, R.drawable.account_circle_96dp) as Any
|
||||
return loadUserAvatar(data)
|
||||
|
@ -29,7 +29,9 @@ class ChatUtils {
|
||||
|
||||
if (individualHashMap != null) {
|
||||
val type = individualHashMap["type"]
|
||||
resultMessage = if (type == "user" || type == "guest" || type == "call" || type == "email") {
|
||||
resultMessage = if (type == "user" || type == "guest" || type == "call" || type == "email" ||
|
||||
type == "circle"
|
||||
) {
|
||||
resultMessage?.replace("{$key}", "@" + individualHashMap["name"])
|
||||
} else if (type == "geo-location") {
|
||||
individualHashMap["name"]
|
||||
|
@ -176,6 +176,9 @@ object DisplayUtils {
|
||||
} else {
|
||||
chip.setChipIconResource(R.drawable.ic_circular_group)
|
||||
}
|
||||
if (type == "circle" || type == "teams") {
|
||||
chip.setChipIconResource(R.drawable.icon_team)
|
||||
}
|
||||
chip.setBounds(0, 0, chip.intrinsicWidth, chip.intrinsicHeight)
|
||||
if (!isCallOrGroup) {
|
||||
var url = getUrlForAvatar(conversationUser.baseUrl, id, false)
|
||||
|
@ -107,7 +107,7 @@ class MessageUtils(val context: Context) {
|
||||
val individualHashMap = message.messageParameters!![key]
|
||||
if (individualHashMap != null) {
|
||||
when (individualHashMap["type"]) {
|
||||
"user", "guest", "call", "user-group", "email" -> {
|
||||
"user", "guest", "call", "user-group", "email", "circle" -> {
|
||||
val chip = if (individualHashMap["id"] == message.activeUser!!.userId) {
|
||||
R.xml.chip_you
|
||||
} else {
|
||||
|
19
app/src/main/res/drawable-night/icon_team.xml
Normal file
19
app/src/main/res/drawable-night/icon_team.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<!--
|
||||
~ 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="22dp"
|
||||
android:height="22dp"
|
||||
android:viewportWidth="44"
|
||||
android:viewportHeight="44">
|
||||
<path
|
||||
android:pathData="M22,22m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0"
|
||||
android:fillColor="#3b3b3b"/>
|
||||
<path
|
||||
android:pathData="M22,14.75A3.5,3.5 0,0 1,25.5 18.25,3.5 3.5,0 0,1 22,21.75 3.5,3.5 0,0 1,18.5 18.25,3.5 3.5,0 0,1 22,14.75M15,17.25c0.56,0 1.08,0.15 1.53,0.42 -0.15,1.43 0.27,2.85 1.13,3.96 -0.5,0.96 -1.5,1.62 -2.66,1.62A3,3 0,0 1,12 20.25,3 3,0 0,1 15,17.25m14,0A3,3 0,0 1,32 20.25,3 3,0 0,1 29,23.25c-1.16,0 -2.16,-0.66 -2.66,-1.62 0.86,-1.11 1.28,-2.53 1.13,-3.96C27.92,17.4 28.44,17.25 29,17.25M15.5,27.5C15.5,25.43 18.41,23.75 22,23.75 25.59,23.75 28.5,25.43 28.5,27.5v1.75h-13v-1.75m-5.5,1.75V27.75c0,-1.39 1.89,-2.56 4.45,-2.9C13.86,25.53 13.5,26.47 13.5,27.5v1.75H10m24,0h-3.5v-1.75C30.5,26.47 30.14,25.53 29.55,24.85 32.11,25.19 34,26.36 34,27.75Z"
|
||||
android:strokeWidth="1.00001"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
19
app/src/main/res/drawable/icon_team.xml
Normal file
19
app/src/main/res/drawable/icon_team.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<!--
|
||||
~ 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="22dp"
|
||||
android:height="22dp"
|
||||
android:viewportWidth="44"
|
||||
android:viewportHeight="44">
|
||||
<path
|
||||
android:pathData="M22,22m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0"
|
||||
android:fillColor="#6B6B6B"/>
|
||||
<path
|
||||
android:pathData="M22,14.75A3.5,3.5 0,0 1,25.5 18.25,3.5 3.5,0 0,1 22,21.75 3.5,3.5 0,0 1,18.5 18.25,3.5 3.5,0 0,1 22,14.75M15,17.25c0.56,0 1.08,0.15 1.53,0.42C16.38,19.1 16.8,20.52 17.66,21.63 17.16,22.59 16.16,23.25 15,23.25a3,3 0,0 1,-3 -3,3 3,0 0,1 3,-3m14,0a3,3 0,0 1,3 3A3,3 0,0 1,29 23.25c-1.16,0 -2.16,-0.66 -2.66,-1.62C27.2,20.52 27.62,19.1 27.47,17.67 27.92,17.4 28.44,17.25 29,17.25M15.5,27.5c0,-2.07 2.91,-3.75 6.5,-3.75C25.59,23.75 28.5,25.43 28.5,27.5v1.75h-13V27.5M10,29.25V27.75c0,-1.39 1.89,-2.56 4.45,-2.9C13.86,25.53 13.5,26.47 13.5,27.5v1.75H10m24,0H30.5V27.5c0,-1.03 -0.36,-1.97 -0.95,-2.65C32.11,25.19 34,26.36 34,27.75Z"
|
||||
android:strokeWidth="1.00001"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
@ -1,7 +1,7 @@
|
||||
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
build:
|
||||
maxIssues: 78
|
||||
maxIssues: 80
|
||||
weights:
|
||||
# complexity: 2
|
||||
# LongParameterList: 1
|
||||
|
Loading…
Reference in New Issue
Block a user