Merge pull request #1337 from nextcloud/circles-support

Add tracking circles support
This commit is contained in:
Marcel Hibbe 2021-06-22 11:51:48 +02:00 committed by GitHub
commit 9ce5184fe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 2 deletions

View File

@ -226,6 +226,9 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
if (participant.getActorType() == Participant.ActorType.GROUPS) {
userType = NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_group);
}
if (participant.getActorType() == Participant.ActorType.CIRCLES) {
userType = NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_circle);
}
break;
case 4:
userType = NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest);

View File

@ -62,6 +62,7 @@ import com.nextcloud.talk.models.json.conversations.RoomOverall
import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter
import com.nextcloud.talk.models.json.generic.GenericOverall
import com.nextcloud.talk.models.json.participants.Participant
import com.nextcloud.talk.models.json.participants.Participant.ActorType.CIRCLES
import com.nextcloud.talk.models.json.participants.Participant.ActorType.GROUPS
import com.nextcloud.talk.models.json.participants.Participant.ActorType.USERS
import com.nextcloud.talk.models.json.participants.ParticipantsOverall
@ -900,6 +901,26 @@ class ConversationInfoController(args: Bundle) :
return true
}
if (participant.getActorType() == CIRCLES) {
val items = mutableListOf(
BasicListItemWithImage(
R.drawable.ic_delete_grey600_24dp,
context!!.getString(R.string.nc_remove_circle_and_members)
)
)
MaterialDialog(activity!!, BottomSheet(WRAP_CONTENT)).show {
cornerRadius(res = R.dimen.corner_radius)
title(text = participant.displayName)
listItemsWithImage(items = items) { dialog, index, _ ->
if (index == 0) {
removeAttendeeFromConversation(apiVersion, participant)
}
}
}
return true
}
val items = mutableListOf(
BasicListItemWithImage(
R.drawable.ic_lock_grey600_24px,
@ -975,8 +996,8 @@ class ConversationInfoController(args: Bundle) :
*/
class UserItemComparator : Comparator<UserItem> {
override fun compare(left: UserItem, right: UserItem): Int {
val leftIsGroup = left.model.actorType == GROUPS
val rightIsGroup = right.model.actorType == GROUPS
val leftIsGroup = left.model.actorType == GROUPS || left.model.actorType == CIRCLES
val rightIsGroup = right.model.actorType == GROUPS || right.model.actorType == CIRCLES
if (leftIsGroup != rightIsGroup) {
// Groups below participants
return if (rightIsGroup) {

View File

@ -257,6 +257,7 @@
<string name="nc_demote">Demote from moderator</string>
<string name="nc_promote">Promote to moderator</string>
<string name="nc_remove_participant">Remove participant</string>
<string name="nc_remove_circle_and_members">Remove circle and members</string>
<string name="nc_remove_group_and_members">Remove group and members</string>
<string name="nc_attendee_pin">Pin: %1$s</string>
@ -315,6 +316,7 @@
<string name="nc_limit_hit">%s characters limit has been hit</string>
<string name="nc_email">Email</string>
<string name="nc_group">Group</string>
<string name="nc_circle">Circle</string>
<string name="nc_groups">Groups</string>
<string name="nc_circles">Circles</string>
<string name="nc_participants">Participants</string>